@prisma-next/framework-components 0.7.0 → 0.8.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authoring.d.mts +2 -2
- package/dist/authoring.mjs +2 -2
- package/dist/components.d.mts +1 -1
- package/dist/control.d.mts +108 -21
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +8 -5
- package/dist/control.mjs.map +1 -1
- package/dist/execution.d.mts +1 -1
- package/dist/{framework-authoring-DGIQbNPt.d.mts → framework-authoring-Bb_GEnzj.d.mts} +43 -3
- package/dist/framework-authoring-Bb_GEnzj.d.mts.map +1 -0
- package/dist/{framework-authoring-DxXcjyJX.mjs → framework-authoring-DcEZ5Lin.mjs} +26 -5
- package/dist/framework-authoring-DcEZ5Lin.mjs.map +1 -0
- package/dist/{framework-components-DwkHnl-e.d.mts → framework-components-DQRRmQOH.d.mts} +2 -2
- package/dist/{framework-components-DwkHnl-e.d.mts.map → framework-components-DQRRmQOH.d.mts.map} +1 -1
- package/dist/ir.d.mts +161 -0
- package/dist/ir.d.mts.map +1 -0
- package/dist/ir.mjs +39 -0
- package/dist/ir.mjs.map +1 -0
- package/dist/runtime.d.mts +336 -1
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +140 -1
- package/dist/runtime.mjs.map +1 -1
- package/package.json +10 -9
- package/src/annotations.ts +322 -0
- package/src/control/contract-serializer.ts +37 -0
- package/src/control/control-descriptors.ts +10 -0
- package/src/control/control-instances.ts +7 -15
- package/src/control/control-schema-view.ts +3 -3
- package/src/control/control-stack.ts +24 -10
- package/src/control/schema-verifier.ts +51 -0
- package/src/execution/runtime-middleware.ts +49 -0
- package/src/exports/authoring.ts +7 -0
- package/src/exports/control.ts +7 -1
- package/src/exports/ir.ts +6 -0
- package/src/exports/runtime.ts +11 -0
- package/src/ir/ir-node.ts +62 -0
- package/src/ir/namespace.ts +40 -0
- package/src/ir/storage-type.ts +23 -0
- package/src/ir/storage.ts +41 -0
- package/src/meta-builder.ts +101 -0
- package/src/shared/framework-authoring.ts +116 -12
- package/dist/framework-authoring-DGIQbNPt.d.mts.map +0 -1
- package/dist/framework-authoring-DxXcjyJX.mjs.map +0 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type AnnotationValue,
|
|
3
|
+
assertAnnotationsApplicable,
|
|
4
|
+
type OperationKind,
|
|
5
|
+
} from './annotations';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Per-terminal meta configurator handed to user callbacks. The terminal's
|
|
9
|
+
* operation kind `K` is fixed by the terminal that constructed the builder;
|
|
10
|
+
* `annotate(...)` accepts only annotations whose declared `Kinds` include
|
|
11
|
+
* `K`.
|
|
12
|
+
*
|
|
13
|
+
* The conditional parameter type
|
|
14
|
+
* `K extends Kinds ? AnnotationValue<P, Kinds> : never` collapses to `never`
|
|
15
|
+
* for inapplicable annotations, surfacing the mismatch as a type error at
|
|
16
|
+
* the call site of `meta.annotate(...)`. No variadic-tuple inference is
|
|
17
|
+
* involved — TypeScript infers `Kinds` from the annotation argument and
|
|
18
|
+
* checks the conditional directly.
|
|
19
|
+
*
|
|
20
|
+
* The runtime gate inside `annotate` (via
|
|
21
|
+
* `assertAnnotationsApplicable`) catches cast / `any` / dynamic bypasses
|
|
22
|
+
* and throws `RUNTIME.ANNOTATION_INAPPLICABLE`.
|
|
23
|
+
*
|
|
24
|
+
* `annotate` returns the builder for chaining; the return value of the
|
|
25
|
+
* configurator callback is unused, so both block-body and expression-body
|
|
26
|
+
* callbacks compile.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* await db.User.find({ id }, (meta) => meta.annotate(cacheAnnotation({ ttl: 60 })));
|
|
31
|
+
* await db.User.create(input, (meta) => {
|
|
32
|
+
* meta.annotate(auditAnnotation({ actor: 'system' }));
|
|
33
|
+
* meta.annotate(otelAnnotation({ traceId }));
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export interface MetaBuilder<K extends OperationKind> {
|
|
38
|
+
annotate<P, Kinds extends OperationKind>(
|
|
39
|
+
annotation: K extends Kinds ? AnnotationValue<P, Kinds> : never,
|
|
40
|
+
): this;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Lane-side view of a meta builder. Extends the public `MetaBuilder<K>`
|
|
45
|
+
* surface with `annotations` so lane terminals can read the recorded map
|
|
46
|
+
* after invoking the user configurator.
|
|
47
|
+
*
|
|
48
|
+
* Lane terminals construct one of these via `createMetaBuilder(kind, terminalName)`,
|
|
49
|
+
* pass it to the user callback as `MetaBuilder<K>` (the narrower public
|
|
50
|
+
* view), then read `meta.annotations` to thread the recorded values into
|
|
51
|
+
* `plan.meta.annotations`.
|
|
52
|
+
*/
|
|
53
|
+
export interface LaneMetaBuilder<K extends OperationKind> extends MetaBuilder<K> {
|
|
54
|
+
readonly annotations: ReadonlyMap<string, AnnotationValue<unknown, OperationKind>>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
class MetaBuilderImpl<K extends OperationKind> implements LaneMetaBuilder<K> {
|
|
58
|
+
readonly #kind: K;
|
|
59
|
+
readonly #terminalName: string;
|
|
60
|
+
readonly #annotations = new Map<string, AnnotationValue<unknown, OperationKind>>();
|
|
61
|
+
|
|
62
|
+
constructor(kind: K, terminalName: string) {
|
|
63
|
+
this.#kind = kind;
|
|
64
|
+
this.#terminalName = terminalName;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
get annotations(): ReadonlyMap<string, AnnotationValue<unknown, OperationKind>> {
|
|
68
|
+
return this.#annotations;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
annotate<P, Kinds extends OperationKind>(
|
|
72
|
+
annotation: K extends Kinds ? AnnotationValue<P, Kinds> : never,
|
|
73
|
+
): this {
|
|
74
|
+
// Inside the body, the conditional `K extends Kinds ? AnnotationValue<P, Kinds> : never`
|
|
75
|
+
// is opaque to TypeScript — it can't pick a branch without a concrete
|
|
76
|
+
// K. Widen to the structural shape so we can call into the runtime
|
|
77
|
+
// gate. The runtime gate (assertAnnotationsApplicable) is what
|
|
78
|
+
// catches cast bypasses where the conditional would have resolved to
|
|
79
|
+
// `never` had the type checker been allowed to specialise.
|
|
80
|
+
const value = annotation as AnnotationValue<unknown, OperationKind>;
|
|
81
|
+
assertAnnotationsApplicable([value], this.#kind, this.#terminalName);
|
|
82
|
+
this.#annotations.set(value.namespace, value);
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Construct a lane-side meta builder for a terminal of operation kind `K`.
|
|
89
|
+
*
|
|
90
|
+
* Lane terminals call this with their `kind` (`'read'` or `'write'`) and a
|
|
91
|
+
* `terminalName` for error messages, hand the resulting builder to the
|
|
92
|
+
* user-supplied configurator callback (typed as `MetaBuilder<K>`, the
|
|
93
|
+
* narrower public view), and read `meta.annotations` afterwards to thread
|
|
94
|
+
* the recorded values into `plan.meta.annotations`.
|
|
95
|
+
*/
|
|
96
|
+
export function createMetaBuilder<K extends OperationKind>(
|
|
97
|
+
kind: K,
|
|
98
|
+
terminalName: string,
|
|
99
|
+
): LaneMetaBuilder<K> {
|
|
100
|
+
return new MetaBuilderImpl(kind, terminalName);
|
|
101
|
+
}
|
|
@@ -100,9 +100,54 @@ export type AuthoringFieldNamespace = {
|
|
|
100
100
|
readonly [name: string]: AuthoringFieldPresetDescriptor | AuthoringFieldNamespace;
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Context surfaced to entity-type factories at call time. Currently a
|
|
105
|
+
* placeholder — sharpened as concrete consumers (enum, namespace, …)
|
|
106
|
+
* discover what the factory actually needs to read (codec lookup,
|
|
107
|
+
* namespace registry, …).
|
|
108
|
+
*/
|
|
109
|
+
export interface AuthoringEntityContext {
|
|
110
|
+
readonly family: string;
|
|
111
|
+
readonly target: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface AuthoringEntityTypeTemplateOutput {
|
|
115
|
+
readonly template: AuthoringTemplateValue;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Default `Input = never` is load-bearing for pack-bag-driven type
|
|
120
|
+
* narrowing. Factory parameter positions are contravariant, so a pack
|
|
121
|
+
* literal declaring `factory: (input: DemoEntityInput) => DemoEntity`
|
|
122
|
+
* is only assignable to the base descriptor's factory shape if the
|
|
123
|
+
* base's input is `never` (the bottom of the contravariant position).
|
|
124
|
+
* The concrete input/output types are recovered at the helper-derivation
|
|
125
|
+
* site via `EntityHelperFunction<Descriptor>`'s conditional inference,
|
|
126
|
+
* which reads them from the pack's `as const` literal factory signature
|
|
127
|
+
* — the base widening does not erase the literal because `satisfies`
|
|
128
|
+
* does not widen the declared type.
|
|
129
|
+
*/
|
|
130
|
+
export interface AuthoringEntityTypeFactoryOutput<Input = never, Output = unknown> {
|
|
131
|
+
readonly factory: (input: Input, ctx: AuthoringEntityContext) => Output;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface AuthoringEntityTypeDescriptor<Input = never, Output = unknown> {
|
|
135
|
+
readonly kind: 'entity';
|
|
136
|
+
readonly discriminator: string;
|
|
137
|
+
readonly args?: readonly AuthoringArgumentDescriptor[];
|
|
138
|
+
readonly output:
|
|
139
|
+
| AuthoringEntityTypeTemplateOutput
|
|
140
|
+
| AuthoringEntityTypeFactoryOutput<Input, Output>;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export type AuthoringEntityTypeNamespace = {
|
|
144
|
+
readonly [name: string]: AuthoringEntityTypeDescriptor | AuthoringEntityTypeNamespace;
|
|
145
|
+
};
|
|
146
|
+
|
|
103
147
|
export interface AuthoringContributions {
|
|
104
148
|
readonly type?: AuthoringTypeNamespace;
|
|
105
149
|
readonly field?: AuthoringFieldNamespace;
|
|
150
|
+
readonly entityTypes?: AuthoringEntityTypeNamespace;
|
|
106
151
|
}
|
|
107
152
|
|
|
108
153
|
export function isAuthoringArgRef(value: unknown): value is AuthoringArgRef {
|
|
@@ -147,6 +192,29 @@ export function isAuthoringFieldPresetDescriptor(
|
|
|
147
192
|
);
|
|
148
193
|
}
|
|
149
194
|
|
|
195
|
+
export function isAuthoringEntityTypeDescriptor(
|
|
196
|
+
value: unknown,
|
|
197
|
+
): value is AuthoringEntityTypeDescriptor {
|
|
198
|
+
if (
|
|
199
|
+
typeof value !== 'object' ||
|
|
200
|
+
value === null ||
|
|
201
|
+
(value as { kind?: unknown }).kind !== 'entity'
|
|
202
|
+
) {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
const discriminator = (value as { discriminator?: unknown }).discriminator;
|
|
206
|
+
if (typeof discriminator !== 'string' || discriminator.length === 0) {
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
const output = (value as { output?: unknown }).output;
|
|
210
|
+
if (typeof output !== 'object' || output === null) {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
const factory = (output as { factory?: unknown }).factory;
|
|
214
|
+
const template = (output as { template?: unknown }).template;
|
|
215
|
+
return typeof factory === 'function' || template !== undefined;
|
|
216
|
+
}
|
|
217
|
+
|
|
150
218
|
/**
|
|
151
219
|
* Returns true when `namespace` is a non-leaf key in `contributions.field`.
|
|
152
220
|
*
|
|
@@ -263,27 +331,33 @@ function collectAuthoringLeafPaths(
|
|
|
263
331
|
export function assertNoCrossRegistryCollisions(
|
|
264
332
|
typeNamespace: AuthoringTypeNamespace,
|
|
265
333
|
fieldNamespace: AuthoringFieldNamespace,
|
|
334
|
+
entityTypeNamespace: AuthoringEntityTypeNamespace = {},
|
|
266
335
|
): void {
|
|
267
336
|
const typePaths = new Set(
|
|
268
337
|
collectAuthoringLeafPaths(typeNamespace, isAuthoringTypeConstructorDescriptor),
|
|
269
338
|
);
|
|
339
|
+
const fieldPaths = new Set(
|
|
340
|
+
collectAuthoringLeafPaths(fieldNamespace, isAuthoringFieldPresetDescriptor),
|
|
341
|
+
);
|
|
342
|
+
const entityPaths = new Set(
|
|
343
|
+
collectAuthoringLeafPaths(entityTypeNamespace, isAuthoringEntityTypeDescriptor),
|
|
344
|
+
);
|
|
270
345
|
// Within-registry duplicate detection is handled upstream by the merge
|
|
271
346
|
// walker (`mergeAuthoringNamespaces` in control-stack.ts and
|
|
272
347
|
// `mergeHelperNamespaces` in composed-authoring-helpers.ts), which throws
|
|
273
|
-
// on same-path registrations within
|
|
274
|
-
// runs. This function only handles the cross-registry case
|
|
275
|
-
|
|
276
|
-
// impossible, so the early-out is sound.
|
|
277
|
-
if (typePaths.size === 0) {
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
for (const fieldPath of collectAuthoringLeafPaths(
|
|
281
|
-
fieldNamespace,
|
|
282
|
-
isAuthoringFieldPresetDescriptor,
|
|
283
|
-
)) {
|
|
348
|
+
// on same-path registrations within any single registry before this check
|
|
349
|
+
// runs. This function only handles the cross-registry case.
|
|
350
|
+
for (const fieldPath of fieldPaths) {
|
|
284
351
|
if (typePaths.has(fieldPath)) {
|
|
285
352
|
throw new Error(
|
|
286
|
-
`Ambiguous authoring registry path "${fieldPath}". The same path is registered as both a type constructor and a field preset; PSL resolution would be ambiguous. Register each path in only one of authoringContributions.field / authoringContributions.type.`,
|
|
353
|
+
`Ambiguous authoring registry path "${fieldPath}". The same path is registered as both a type constructor and a field preset; PSL resolution would be ambiguous. Register each path in only one of authoringContributions.field / authoringContributions.type / authoringContributions.entityTypes.`,
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
for (const entityPath of entityPaths) {
|
|
358
|
+
if (typePaths.has(entityPath) || fieldPaths.has(entityPath)) {
|
|
359
|
+
throw new Error(
|
|
360
|
+
`Ambiguous authoring registry path "${entityPath}". The same path is registered as an entity contribution AND as a type constructor or field preset; PSL resolution would be ambiguous. Register each path in only one of authoringContributions.field / authoringContributions.type / authoringContributions.entityTypes.`,
|
|
287
361
|
);
|
|
288
362
|
}
|
|
289
363
|
}
|
|
@@ -533,6 +607,36 @@ export function instantiateAuthoringTypeConstructor(
|
|
|
533
607
|
return resolveAuthoringStorageTypeTemplate(descriptor.output, args);
|
|
534
608
|
}
|
|
535
609
|
|
|
610
|
+
export function instantiateAuthoringEntityType(
|
|
611
|
+
helperPath: string,
|
|
612
|
+
descriptor: AuthoringEntityTypeDescriptor,
|
|
613
|
+
args: readonly unknown[],
|
|
614
|
+
ctx: AuthoringEntityContext,
|
|
615
|
+
): unknown {
|
|
616
|
+
// Factory-output entities carry their input contract on the factory
|
|
617
|
+
// signature itself — TypeScript narrows callers via
|
|
618
|
+
// `EntityHelperFunction`'s extracted `input` parameter, and the factory
|
|
619
|
+
// is free to do its own runtime validation (e.g. arktype Type). The
|
|
620
|
+
// descriptor-level `args` validator is reserved for template-output
|
|
621
|
+
// entities (which mirror field/type's declarative argument shape).
|
|
622
|
+
if ('factory' in descriptor.output) {
|
|
623
|
+
const input = args[0];
|
|
624
|
+
// The base `AuthoringEntityTypeDescriptor`'s factory is typed
|
|
625
|
+
// `(input: never, ctx) => unknown` so concrete pack-literal factories
|
|
626
|
+
// with narrower input types remain assignable through the
|
|
627
|
+
// contravariant position (see the type's docstring). The runtime
|
|
628
|
+
// delegates input validation to the pack's factory itself, so we
|
|
629
|
+
// forward the supplied input here without a static input contract.
|
|
630
|
+
const factory = descriptor.output.factory as (
|
|
631
|
+
input: unknown,
|
|
632
|
+
ctx: AuthoringEntityContext,
|
|
633
|
+
) => unknown;
|
|
634
|
+
return factory(input, ctx);
|
|
635
|
+
}
|
|
636
|
+
validateAuthoringHelperArguments(helperPath, descriptor.args, args);
|
|
637
|
+
return resolveAuthoringTemplateValue(descriptor.output.template, args);
|
|
638
|
+
}
|
|
639
|
+
|
|
536
640
|
export function instantiateAuthoringFieldPreset(
|
|
537
641
|
descriptor: AuthoringFieldPresetDescriptor,
|
|
538
642
|
args: readonly unknown[],
|
|
@@ -1 +0,0 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,aAAA;EAAA,SACV,iBAAA,GAAoB,8BAAA;EAAA,SACpB,EAAA;EAAA,SACA,MAAA;AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"framework-authoring-DxXcjyJX.mjs","names":[],"sources":["../src/shared/framework-authoring.ts"],"sourcesContent":["import type {\n ColumnDefault,\n ExecutionMutationDefaultPhases,\n ExecutionMutationDefaultValue,\n} from '@prisma-next/contract/types';\nimport {\n isColumnDefaultLiteralInputValue,\n isExecutionMutationDefaultValue,\n} from '@prisma-next/contract/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\n\nexport type AuthoringArgRef = {\n readonly kind: 'arg';\n readonly index: number;\n readonly path?: readonly string[];\n readonly default?: AuthoringTemplateValue;\n};\n\nexport type AuthoringTemplateValue =\n | string\n | number\n | boolean\n | null\n | AuthoringArgRef\n | readonly AuthoringTemplateValue[]\n | { readonly [key: string]: AuthoringTemplateValue };\n\ninterface AuthoringArgumentDescriptorCommon {\n readonly name?: string;\n readonly optional?: boolean;\n}\n\nexport type AuthoringArgumentDescriptor = AuthoringArgumentDescriptorCommon &\n (\n | { readonly kind: 'string' }\n | { readonly kind: 'boolean' }\n | {\n readonly kind: 'number';\n readonly integer?: boolean;\n readonly minimum?: number;\n readonly maximum?: number;\n }\n | { readonly kind: 'stringArray' }\n | {\n readonly kind: 'object';\n readonly properties: Record<string, AuthoringArgumentDescriptor>;\n }\n );\n\nexport interface AuthoringStorageTypeTemplate {\n readonly codecId: string;\n readonly nativeType: AuthoringTemplateValue;\n readonly typeParams?: Record<string, AuthoringTemplateValue>;\n}\n\nexport interface AuthoringTypeConstructorDescriptor {\n readonly kind: 'typeConstructor';\n readonly args?: readonly AuthoringArgumentDescriptor[];\n readonly output: AuthoringStorageTypeTemplate;\n}\n\nexport interface AuthoringColumnDefaultTemplateLiteral {\n readonly kind: 'literal';\n readonly value: AuthoringTemplateValue;\n}\n\nexport interface AuthoringColumnDefaultTemplateFunction {\n readonly kind: 'function';\n readonly expression: AuthoringTemplateValue;\n}\n\nexport type AuthoringColumnDefaultTemplate =\n | AuthoringColumnDefaultTemplateLiteral\n | AuthoringColumnDefaultTemplateFunction;\n\nexport interface AuthoringExecutionDefaultsTemplate {\n readonly onCreate?: AuthoringTemplateValue;\n readonly onUpdate?: AuthoringTemplateValue;\n}\n\nexport interface AuthoringFieldPresetOutput extends AuthoringStorageTypeTemplate {\n readonly nullable?: boolean;\n readonly default?: AuthoringColumnDefaultTemplate;\n readonly executionDefaults?: AuthoringExecutionDefaultsTemplate;\n readonly id?: boolean;\n readonly unique?: boolean;\n}\n\nexport interface AuthoringFieldPresetDescriptor {\n readonly kind: 'fieldPreset';\n readonly args?: readonly AuthoringArgumentDescriptor[];\n readonly output: AuthoringFieldPresetOutput;\n}\n\nexport type AuthoringTypeNamespace = {\n readonly [name: string]: AuthoringTypeConstructorDescriptor | AuthoringTypeNamespace;\n};\n\nexport type AuthoringFieldNamespace = {\n readonly [name: string]: AuthoringFieldPresetDescriptor | AuthoringFieldNamespace;\n};\n\nexport interface AuthoringContributions {\n readonly type?: AuthoringTypeNamespace;\n readonly field?: AuthoringFieldNamespace;\n}\n\nexport function isAuthoringArgRef(value: unknown): value is AuthoringArgRef {\n if (typeof value !== 'object' || value === null || (value as { kind?: unknown }).kind !== 'arg') {\n return false;\n }\n const { index, path } = value as { index?: unknown; path?: unknown };\n if (typeof index !== 'number' || !Number.isInteger(index) || index < 0) {\n return false;\n }\n if (path !== undefined && (!Array.isArray(path) || path.some((s) => typeof s !== 'string'))) {\n return false;\n }\n return true;\n}\n\nfunction isAuthoringTemplateRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport function isAuthoringTypeConstructorDescriptor(\n value: unknown,\n): value is AuthoringTypeConstructorDescriptor {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { kind?: unknown }).kind === 'typeConstructor' &&\n typeof (value as { output?: unknown }).output === 'object' &&\n (value as { output?: unknown }).output !== null\n );\n}\n\nexport function isAuthoringFieldPresetDescriptor(\n value: unknown,\n): value is AuthoringFieldPresetDescriptor {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { kind?: unknown }).kind === 'fieldPreset' &&\n typeof (value as { output?: unknown }).output === 'object' &&\n (value as { output?: unknown }).output !== null\n );\n}\n\n/**\n * Returns true when `namespace` is a non-leaf key in `contributions.field`.\n *\n * `AuthoringFieldNamespace` permits a leaf descriptor at any depth — including\n * the root — so a top-level `field: { Foo: { kind: 'fieldPreset', ... } }`\n * registration must NOT be treated as a \"namespace\" with sub-paths. Callers\n * use this predicate to gate dot-namespaced lookups (e.g. PSL `@Foo.bar`).\n */\nexport function hasRegisteredFieldNamespace(\n contributions: AuthoringContributions | undefined,\n namespace: string,\n): boolean {\n if (contributions?.field === undefined || !Object.hasOwn(contributions.field, namespace)) {\n return false;\n }\n return !isAuthoringFieldPresetDescriptor(contributions.field[namespace]);\n}\n\nfunction isPlainNamespaceObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Merges `source` into `target` recursively at the descriptor-namespace\n * level. `leafGuard` decides which values are descriptors (terminal\n * merge points; same-path registrations across components are reported\n * as duplicates) versus sub-namespaces (recursion targets).\n *\n * Path segments are validated against prototype-pollution names\n * (`__proto__`, `constructor`, `prototype`). A value that is neither a\n * recognized leaf nor a plain object — e.g. a malformed descriptor\n * where the canonical leaf guard rejected it for missing `output` —\n * is reported as an invalid contribution rather than recursed into,\n * which would either silently mangle state or infinite-loop on\n * primitive properties.\n *\n * Within-registry duplicate detection is this walker's job;\n * cross-registry detection runs separately via\n * `assertNoCrossRegistryCollisions` after merging completes.\n */\nexport function mergeAuthoringNamespaces(\n target: Record<string, unknown>,\n source: Record<string, unknown>,\n path: readonly string[],\n leafGuard: (value: unknown) => boolean,\n label: string,\n): void {\n const assertSafePath = (currentPath: readonly string[]) => {\n const blockedSegment = currentPath.find(\n (segment) => segment === '__proto__' || segment === 'constructor' || segment === 'prototype',\n );\n if (blockedSegment) {\n throw new Error(\n `Invalid authoring ${label} helper \"${currentPath.join('.')}\". Helper path segments must not use \"${blockedSegment}\".`,\n );\n }\n };\n\n for (const [key, sourceValue] of Object.entries(source)) {\n const currentPath = [...path, key];\n assertSafePath(currentPath);\n const hasExistingValue = Object.hasOwn(target, key);\n const existingValue = hasExistingValue ? target[key] : undefined;\n\n if (!hasExistingValue) {\n target[key] = sourceValue;\n continue;\n }\n\n const existingIsLeaf = leafGuard(existingValue);\n const sourceIsLeaf = leafGuard(sourceValue);\n\n if (existingIsLeaf || sourceIsLeaf) {\n throw new Error(\n `Duplicate authoring ${label} helper \"${currentPath.join('.')}\". Helper names must be unique across composed packs.`,\n );\n }\n\n if (!isPlainNamespaceObject(existingValue) || !isPlainNamespaceObject(sourceValue)) {\n throw new Error(\n `Invalid authoring ${label} helper \"${currentPath.join('.')}\". Expected a sub-namespace object or a recognized descriptor; received a malformed value.`,\n );\n }\n\n mergeAuthoringNamespaces(existingValue, sourceValue, currentPath, leafGuard, label);\n }\n}\n\nfunction collectAuthoringLeafPaths(\n namespace: Readonly<Record<string, unknown>>,\n isLeaf: (value: unknown) => boolean,\n path: readonly string[] = [],\n): string[] {\n const paths: string[] = [];\n for (const [key, value] of Object.entries(namespace)) {\n const currentPath = [...path, key];\n if (isLeaf(value)) {\n paths.push(currentPath.join('.'));\n continue;\n }\n if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n paths.push(\n ...collectAuthoringLeafPaths(\n value as Readonly<Record<string, unknown>>,\n isLeaf,\n currentPath,\n ),\n );\n }\n }\n return paths;\n}\n\nexport function assertNoCrossRegistryCollisions(\n typeNamespace: AuthoringTypeNamespace,\n fieldNamespace: AuthoringFieldNamespace,\n): void {\n const typePaths = new Set(\n collectAuthoringLeafPaths(typeNamespace, isAuthoringTypeConstructorDescriptor),\n );\n // Within-registry duplicate detection is handled upstream by the merge\n // walker (`mergeAuthoringNamespaces` in control-stack.ts and\n // `mergeHelperNamespaces` in composed-authoring-helpers.ts), which throws\n // on same-path registrations within either registry before this check\n // runs. This function only handles the cross-registry case — and an\n // empty type namespace makes a cross-registry collision structurally\n // impossible, so the early-out is sound.\n if (typePaths.size === 0) {\n return;\n }\n for (const fieldPath of collectAuthoringLeafPaths(\n fieldNamespace,\n isAuthoringFieldPresetDescriptor,\n )) {\n if (typePaths.has(fieldPath)) {\n throw new Error(\n `Ambiguous authoring registry path \"${fieldPath}\". The same path is registered as both a type constructor and a field preset; PSL resolution would be ambiguous. Register each path in only one of authoringContributions.field / authoringContributions.type.`,\n );\n }\n }\n}\n\nexport function resolveAuthoringTemplateValue(\n template: AuthoringTemplateValue,\n args: readonly unknown[],\n): unknown {\n if (isAuthoringArgRef(template)) {\n let value = args[template.index];\n\n for (const segment of template.path ?? []) {\n if (!isAuthoringTemplateRecord(value) || !Object.hasOwn(value, segment)) {\n value = undefined;\n break;\n }\n value = (value as Record<string, unknown>)[segment];\n }\n\n if (value === undefined && template.default !== undefined) {\n return resolveAuthoringTemplateValue(template.default, args);\n }\n\n return value;\n }\n if (Array.isArray(template)) {\n return template.map((value) => resolveAuthoringTemplateValue(value, args));\n }\n if (typeof template === 'object' && template !== null) {\n const resolved: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(template)) {\n const resolvedValue = resolveAuthoringTemplateValue(value, args);\n if (resolvedValue !== undefined) {\n resolved[key] = resolvedValue;\n }\n }\n return resolved;\n }\n return template;\n}\n\nfunction validateAuthoringArgument(\n descriptor: AuthoringArgumentDescriptor,\n value: unknown,\n path: string,\n): void {\n if (value === undefined) {\n if (descriptor.optional) {\n return;\n }\n throw new Error(`Missing required authoring helper argument at ${path}`);\n }\n\n if (descriptor.kind === 'string') {\n if (typeof value !== 'string') {\n throw new Error(`Authoring helper argument at ${path} must be a string`);\n }\n return;\n }\n\n if (descriptor.kind === 'boolean') {\n if (typeof value !== 'boolean') {\n throw new Error(`Authoring helper argument at ${path} must be a boolean`);\n }\n return;\n }\n\n if (descriptor.kind === 'stringArray') {\n if (!Array.isArray(value)) {\n throw new Error(`Authoring helper argument at ${path} must be an array of strings`);\n }\n for (const entry of value) {\n if (typeof entry !== 'string') {\n throw new Error(`Authoring helper argument at ${path} must be an array of strings`);\n }\n }\n return;\n }\n\n if (descriptor.kind === 'object') {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n throw new Error(`Authoring helper argument at ${path} must be an object`);\n }\n\n const input = value as Record<string, unknown>;\n const expectedKeys = new Set(Object.keys(descriptor.properties));\n\n for (const key of Object.keys(input)) {\n if (!expectedKeys.has(key)) {\n throw new Error(`Authoring helper argument at ${path} contains unknown property \"${key}\"`);\n }\n }\n\n for (const [key, propertyDescriptor] of Object.entries(descriptor.properties)) {\n validateAuthoringArgument(propertyDescriptor, input[key], `${path}.${key}`);\n }\n\n return;\n }\n\n if (typeof value !== 'number' || Number.isNaN(value)) {\n throw new Error(`Authoring helper argument at ${path} must be a number`);\n }\n\n if (descriptor.integer && !Number.isInteger(value)) {\n throw new Error(`Authoring helper argument at ${path} must be an integer`);\n }\n if (descriptor.minimum !== undefined && value < descriptor.minimum) {\n throw new Error(\n `Authoring helper argument at ${path} must be >= ${descriptor.minimum}, received ${value}`,\n );\n }\n if (descriptor.maximum !== undefined && value > descriptor.maximum) {\n throw new Error(\n `Authoring helper argument at ${path} must be <= ${descriptor.maximum}, received ${value}`,\n );\n }\n}\n\nexport function validateAuthoringHelperArguments(\n helperPath: string,\n descriptors: readonly AuthoringArgumentDescriptor[] | undefined,\n args: readonly unknown[],\n): void {\n const expected = descriptors ?? [];\n const minimumArgs = expected.reduce(\n (count, descriptor, index) => (descriptor.optional ? count : index + 1),\n 0,\n );\n if (args.length < minimumArgs || args.length > expected.length) {\n throw new Error(\n `${helperPath} expects ${minimumArgs === expected.length ? expected.length : `${minimumArgs}-${expected.length}`} argument(s), received ${args.length}`,\n );\n }\n\n expected.forEach((descriptor, index) => {\n validateAuthoringArgument(descriptor, args[index], `${helperPath}[${index}]`);\n });\n}\n\nfunction resolveAuthoringStorageTypeTemplate(\n template: AuthoringStorageTypeTemplate,\n args: readonly unknown[],\n): {\n readonly codecId: string;\n readonly nativeType: string;\n readonly typeParams?: Record<string, unknown>;\n} {\n const nativeType = resolveAuthoringTemplateValue(template.nativeType, args);\n if (typeof nativeType !== 'string') {\n throw new Error(\n `Resolved authoring nativeType must be a string for codec \"${template.codecId}\", received ${String(nativeType)}`,\n );\n }\n const typeParams =\n template.typeParams === undefined\n ? undefined\n : resolveAuthoringTemplateValue(template.typeParams, args);\n if (typeParams !== undefined && !isAuthoringTemplateRecord(typeParams)) {\n throw new Error(\n `Resolved authoring typeParams must be an object for codec \"${template.codecId}\", received ${String(typeParams)}`,\n );\n }\n\n return {\n codecId: template.codecId,\n nativeType,\n ...(typeParams === undefined ? {} : { typeParams }),\n };\n}\n\nfunction resolveAuthoringColumnDefaultTemplate(\n template: AuthoringColumnDefaultTemplate,\n args: readonly unknown[],\n): ColumnDefault {\n if (template.kind === 'literal') {\n const value = resolveAuthoringTemplateValue(template.value, args);\n if (value === undefined) {\n throw new Error('Resolved authoring literal default must not be undefined');\n }\n if (!isColumnDefaultLiteralInputValue(value)) {\n throw new Error(\n `Resolved authoring literal default must be a JSON-serializable value or Date, received ${String(value)}`,\n );\n }\n return {\n kind: 'literal',\n value,\n };\n }\n\n const expression = resolveAuthoringTemplateValue(template.expression, args);\n if (expression === undefined || (typeof expression === 'object' && expression !== null)) {\n throw new Error(\n `Resolved authoring function default expression must resolve to a primitive, received ${String(expression)}`,\n );\n }\n return {\n kind: 'function',\n expression: String(expression),\n };\n}\n\nfunction resolveExecutionMutationDefaultPhase(\n phase: 'onCreate' | 'onUpdate',\n template: AuthoringTemplateValue,\n args: readonly unknown[],\n): ExecutionMutationDefaultValue {\n const value = resolveAuthoringTemplateValue(template, args);\n if (!isExecutionMutationDefaultValue(value)) {\n throw new Error(\n `Authoring preset executionDefaults.${phase} did not resolve to a valid generator descriptor (kind: 'generator', id: string).`,\n );\n }\n return value;\n}\n\nfunction resolveAuthoringExecutionDefaultsTemplate(\n template: AuthoringExecutionDefaultsTemplate,\n args: readonly unknown[],\n): ExecutionMutationDefaultPhases {\n return {\n ...ifDefined(\n 'onCreate',\n template.onCreate !== undefined\n ? resolveExecutionMutationDefaultPhase('onCreate', template.onCreate, args)\n : undefined,\n ),\n ...ifDefined(\n 'onUpdate',\n template.onUpdate !== undefined\n ? resolveExecutionMutationDefaultPhase('onUpdate', template.onUpdate, args)\n : undefined,\n ),\n };\n}\n\nexport function instantiateAuthoringTypeConstructor(\n descriptor: AuthoringTypeConstructorDescriptor,\n args: readonly unknown[],\n): {\n readonly codecId: string;\n readonly nativeType: string;\n readonly typeParams?: Record<string, unknown>;\n} {\n return resolveAuthoringStorageTypeTemplate(descriptor.output, args);\n}\n\nexport function instantiateAuthoringFieldPreset(\n descriptor: AuthoringFieldPresetDescriptor,\n args: readonly unknown[],\n): {\n readonly descriptor: {\n readonly codecId: string;\n readonly nativeType: string;\n readonly typeParams?: Record<string, unknown>;\n };\n readonly nullable: boolean;\n readonly default?: ColumnDefault;\n readonly executionDefaults?: ExecutionMutationDefaultPhases;\n readonly id: boolean;\n readonly unique: boolean;\n} {\n return {\n descriptor: resolveAuthoringStorageTypeTemplate(descriptor.output, args),\n nullable: descriptor.output.nullable ?? false,\n ...ifDefined(\n 'default',\n descriptor.output.default !== undefined\n ? resolveAuthoringColumnDefaultTemplate(descriptor.output.default, args)\n : undefined,\n ),\n ...ifDefined(\n 'executionDefaults',\n descriptor.output.executionDefaults !== undefined\n ? resolveAuthoringExecutionDefaultsTemplate(descriptor.output.executionDefaults, args)\n : undefined,\n ),\n id: descriptor.output.id ?? false,\n unique: descriptor.output.unique ?? false,\n };\n}\n"],"mappings":";;;AA2GA,SAAgB,kBAAkB,OAA0C;CAC1E,IAAI,OAAO,UAAU,YAAY,UAAU,QAAS,MAA6B,SAAS,OACxF,OAAO;CAET,MAAM,EAAE,OAAO,SAAS;CACxB,IAAI,O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