All files / frontend/src/services api-service.ts

11.11% Statements 1/9
0% Branches 0/2
0% Functions 0/5
12.5% Lines 1/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28                2x                                      
// Re-export all API functions for direct import
export * from '../api';
 
import * as apiModule from '../api';
import { serviceSchemas } from '../../types';
import { validateServiceResponse } from '../utils/validation';
 
// Create api object for backward compatibility with service.api.method() pattern
export const api = apiModule;
 
export function getSiteCreatorMessage(siteKey: string, workspaceKey: string): Promise<string> {
  return apiModule.getCreatorMessage(siteKey, workspaceKey).then((message) => {
    return validateServiceResponse('getSiteCreatorMessage', serviceSchemas.getSiteCreatorMessage, message);
  });
}
 
export function serveWorkspace(siteKey: string, workspaceKey: string, serveKey: string): void {
  apiModule.serveWorkspace(siteKey, workspaceKey, serveKey);
}
 
export async function openWorkspaceDir(siteKey: string, workspaceKey: string): Promise<void> {
  const workspaces = await apiModule.listWorkspaces(siteKey);
  const workspace = workspaces.find((ws) => ws.key === workspaceKey);
 
  if (workspace) {
    apiModule.openFileExplorer(workspace.path, false);
  }
}