everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
109 lines (107 loc) • 4.54 kB
JavaScript
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
const require_types = require('../types.cjs');
let zod = require("zod");
zod = require_runtime.__toESM(zod, 1);
//#region src/descriptor/schema.ts
/** Pipeline-owned fields — never authored; injected from the deploy map. */
const PipelineFieldsSchema = zod.object({
production: zod.string().optional(),
integrity: zod.string().optional(),
ssr: zod.string().optional(),
ssrIntegrity: zod.string().optional(),
pin: require_types.SlotPinSchema.optional()
});
const DevelopmentRefSchema = zod.object({
/** local workspace directory, relative to the App root — emitted as `local:<path>` */
path: zod.string().optional(),
/** explicit development ref override (e.g. a remote dev URL) */
development: zod.string().optional()
});
/** An attached App (today's `plugins.<id>` / `app.auth` entries). */
const AttachmentRefSchema = DevelopmentRefSchema.extend({
name: zod.string().optional(),
/** published module reference (bos://…) consumed by resolution */
extends: zod.string().optional(),
proxy: zod.string().optional(),
variables: require_types.JsonObjectSchema.optional(),
secrets: zod.array(zod.string()).optional(),
routes: zod.array(zod.string()).optional(),
shared: require_types.SharedDepMapSchema.optional(),
connectSrc: zod.array(zod.string()).optional(),
dependsOn: zod.array(zod.string()).optional(),
version: zod.string().optional(),
ui: zod.object({
name: zod.string().optional(),
path: zod.string().optional(),
development: zod.string().optional(),
integrity: zod.string().optional(),
pin: require_types.SlotPinSchema.optional()
}).strict().optional()
});
/** The `app.api` slot. */
const ApiRefSchema = DevelopmentRefSchema.extend({
proxy: zod.string().optional(),
variables: require_types.JsonObjectSchema.optional(),
secrets: zod.array(zod.string()).optional(),
routes: zod.array(zod.string()).optional(),
shared: require_types.SharedDepMapSchema.optional(),
dependsOn: zod.array(zod.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: zod.array(zod.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 = zod.object({
name: zod.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: zod.union([zod.string(), zod.record(zod.string(), zod.unknown())]).optional(),
account: zod.string().optional(),
domain: zod.string().optional(),
title: zod.string().optional(),
description: zod.string().optional(),
repository: zod.string().optional(),
testnet: zod.string().optional(),
staging: zod.object({
domain: zod.string(),
account: zod.string().optional()
}).strict().optional(),
/** Authoring-only: the starter level this child was scaffolded with.
* Stripped from resolved configs — publish canonicalization never
* carries it. */
starter: zod.enum(["simple", "advanced"]).optional(),
ci: zod.object({
image: zod.string().optional(),
railway: zod.object({ service: zod.string() }).strict().optional()
}).strict().optional(),
cdn: zod.object({ origin: zod.string().optional() }).strict().optional(),
publish: zod.object({ auth: zod.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: zod.record(zod.string(), AttachmentRefSchema).optional()
}).strict();
//#endregion
exports.ApiRefSchema = ApiRefSchema;
exports.AppDescriptorSchema = AppDescriptorSchema;
exports.AttachmentRefSchema = AttachmentRefSchema;
exports.HostRefSchema = HostRefSchema;
exports.PipelineFieldsSchema = PipelineFieldsSchema;
exports.UiRefSchema = UiRefSchema;
//# sourceMappingURL=schema.cjs.map