UNPKG

convex

Version:

Client for the Convex Cloud

44 lines (43 loc) 1.18 kB
"use strict"; import { z } from "zod"; import { componentDefinitionPath, componentFunctionPath, componentPath } from "./paths.js"; import { identifier } from "./types.js"; export const resource = z.union([ z.object({ type: z.literal("value"), value: z.string() }), z.object({ type: z.literal("function"), path: componentFunctionPath }) ]); export const checkedExport = z.lazy( () => z.union([ z.object({ type: z.literal("branch"), children: z.record(identifier, checkedExport) }), z.object({ type: z.literal("leaf"), resource }) ]) ); export const httpActionRoute = z.object({ method: z.string(), path: z.string() }); export const checkedHttpRoutes = z.object({ httpModuleRoutes: z.nullable(z.array(httpActionRoute)), mounts: z.array(z.string()) }); export const checkedComponent = z.lazy( () => z.object({ definitionPath: componentDefinitionPath, componentPath, args: z.record(identifier, resource), childComponents: z.record(identifier, checkedComponent), httpRoutes: checkedHttpRoutes, exports: z.record(identifier, checkedExport) }) ); //# sourceMappingURL=checkedComponent.js.map