All files / types/dist/schemas service.js

100% Statements 5/5
100% Branches 0/0
100% Functions 0/0
100% Lines 5/5

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 29 30 31 32 33 34 35 36 37      16x             16x             16x         16x                 16x          
import { z } from 'zod';
import { configurationsSchema, siteConfigSchema, workspaceSchema, workspaceDetailsSchema } from './config.js';
// Service Response Schemas
export const siteAndWorkspaceDataSchema = z.object({
    configurations: configurationsSchema,
    site: siteConfigSchema,
    siteWorkspaces: z.array(workspaceSchema),
    workspace: workspaceSchema,
    workspaceDetails: workspaceDetailsSchema
});
export const snackMessageSchema = z.object({
    message: z.string(),
    severity: z.enum(['success', 'info', 'warning', 'error']),
    action: z.any().optional(),
    onActionClick: z.unknown().optional(),
    autoHideDuration: z.number().optional()
});
export const consoleMessageSchema = z.object({
    id: z.number(),
    line: z.string()
});
// Service Schemas mapping - maps Service method names to their response schemas
export const serviceSchemas = {
    getConfigurations: configurationsSchema,
    getSiteAndWorkspaceData: siteAndWorkspaceDataSchema,
    getWorkspaceDetails: workspaceDetailsSchema,
    getSiteCreatorMessage: z.string(),
    serveWorkspace: z.void(),
    openWorkspaceDir: z.void()
};
// UI Service Schemas
export const uiServiceSchemas = {
    getCurrentSnackMessage: snackMessageSchema.optional(),
    getPreviousSnackMessage: snackMessageSchema.optional(),
    getConsoleMessages: z.array(consoleMessageSchema)
};