everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
102 lines (100 loc) • 4.23 kB
JavaScript
import { JsonObjectSchema, SharedDepMapSchema, SlotPinSchema } from "../types.mjs";
import * as z$1 from "zod";
//#region src/descriptor/schema.ts
/** Pipeline-owned fields — never authored; injected from the deploy map. */
const PipelineFieldsSchema = z$1.object({
production: z$1.string().optional(),
integrity: z$1.string().optional(),
ssr: z$1.string().optional(),
ssrIntegrity: z$1.string().optional(),
pin: SlotPinSchema.optional()
});
const DevelopmentRefSchema = z$1.object({
/** local workspace directory, relative to the App root — emitted as `local:<path>` */
path: z$1.string().optional(),
/** explicit development ref override (e.g. a remote dev URL) */
development: z$1.string().optional()
});
/** An attached App (today's `plugins.<id>` / `app.auth` entries). */
const AttachmentRefSchema = DevelopmentRefSchema.extend({
name: z$1.string().optional(),
/** published module reference (bos://…) consumed by resolution */
extends: z$1.string().optional(),
proxy: z$1.string().optional(),
variables: JsonObjectSchema.optional(),
secrets: z$1.array(z$1.string()).optional(),
routes: z$1.array(z$1.string()).optional(),
shared: SharedDepMapSchema.optional(),
connectSrc: z$1.array(z$1.string()).optional(),
dependsOn: z$1.array(z$1.string()).optional(),
version: z$1.string().optional(),
ui: z$1.object({
name: z$1.string().optional(),
path: z$1.string().optional(),
development: z$1.string().optional(),
integrity: z$1.string().optional(),
pin: SlotPinSchema.optional()
}).strict().optional()
});
/** The `app.api` slot. */
const ApiRefSchema = DevelopmentRefSchema.extend({
proxy: z$1.string().optional(),
variables: JsonObjectSchema.optional(),
secrets: z$1.array(z$1.string()).optional(),
routes: z$1.array(z$1.string()).optional(),
shared: SharedDepMapSchema.optional(),
dependsOn: z$1.array(z$1.string()).optional()
}).strict();
/** The `app.ui` slot — pipeline fields (production/integrity/ssr) come from the deploy map. */
const UiRefSchema = DevelopmentRefSchema.strict();
/** The `app.host` slot — production/integrity come from the deploy map. */
const HostRefSchema = DevelopmentRefSchema.extend({ secrets: z$1.array(z$1.string()).optional() }).strict();
/**
* The authored App — pure data, the boot input. Local paths only (dev
* authoring shape); deployment resolves them through the deploy map.
*/
const AppDescriptorSchema = z$1.object({
name: z$1.string(),
/**
* The base App this App inherits (child-wins): a registry name
* (`"everything.dev"`) or an imported App descriptor value — an imported
* parent is an inlined parent (same-repo composition; the resolved shape
* is identical to a fetched one). The value is validated and depth-guarded
* at resolution (flattenParent re-parses it); chains deeper than one
* level are deferred (wayfinder ticket 08).
*/
extends: z$1.union([z$1.string(), z$1.record(z$1.string(), z$1.unknown())]).optional(),
account: z$1.string().optional(),
domain: z$1.string().optional(),
title: z$1.string().optional(),
description: z$1.string().optional(),
repository: z$1.string().optional(),
testnet: z$1.string().optional(),
staging: z$1.object({
domain: z$1.string(),
account: z$1.string().optional()
}).strict().optional(),
/** Authoring-only: the starter level this child was scaffolded with.
* Stripped from resolved configs — publish canonicalization never
* carries it. */
starter: z$1.enum(["simple", "advanced"]).optional(),
ci: z$1.object({
image: z$1.string().optional(),
railway: z$1.object({ service: z$1.string() }).strict().optional()
}).strict().optional(),
cdn: z$1.object({ origin: z$1.string().optional() }).strict().optional(),
publish: z$1.object({ auth: z$1.enum([
"session",
"key",
"custody"
]).optional() }).strict().optional(),
host: HostRefSchema.optional(),
api: ApiRefSchema.optional(),
ui: UiRefSchema.optional(),
/** attachment landing in the `app.auth` slot */
auth: AttachmentRefSchema.optional(),
plugins: z$1.record(z$1.string(), AttachmentRefSchema).optional()
}).strict();
//#endregion
export { ApiRefSchema, AppDescriptorSchema, AttachmentRefSchema, HostRefSchema, PipelineFieldsSchema, UiRefSchema };
//# sourceMappingURL=schema.mjs.map