@prisma-next/framework-components 0.13.0-dev.15 → 0.13.0-dev.17

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.
Files changed (33) hide show
  1. package/dist/authoring.d.mts +2 -2
  2. package/dist/authoring.mjs +1 -1
  3. package/dist/{codec-DCQAerzB.d.mts → codec-types-7Qng7VFc.d.mts} +67 -67
  4. package/dist/codec-types-7Qng7VFc.d.mts.map +1 -0
  5. package/dist/codec.d.mts +1 -1
  6. package/dist/components.d.mts +1 -1
  7. package/dist/control.d.mts +10 -22
  8. package/dist/control.d.mts.map +1 -1
  9. package/dist/control.mjs +1 -1
  10. package/dist/execution.d.mts +1 -1
  11. package/dist/{framework-authoring-CnwPJCO4.mjs → framework-authoring-CLCzDm3Y.mjs} +35 -15
  12. package/dist/framework-authoring-CLCzDm3Y.mjs.map +1 -0
  13. package/dist/{framework-authoring-R0TYCkvG.d.mts → framework-authoring-DMAwH52s.d.mts} +90 -7
  14. package/dist/framework-authoring-DMAwH52s.d.mts.map +1 -0
  15. package/dist/{framework-components-DDQXmW0b.d.mts → framework-components-DXqiWAJX.d.mts} +3 -3
  16. package/dist/{framework-components-DDQXmW0b.d.mts.map → framework-components-DXqiWAJX.d.mts.map} +1 -1
  17. package/dist/{psl-ast-Cn50B-UG.d.mts → psl-ast-Mq7MlfKe.d.mts} +4 -4
  18. package/dist/{psl-ast-Cn50B-UG.d.mts.map → psl-ast-Mq7MlfKe.d.mts.map} +1 -1
  19. package/dist/psl-ast.d.mts +4 -4
  20. package/dist/psl-ast.mjs +11 -9
  21. package/dist/psl-ast.mjs.map +1 -1
  22. package/dist/runtime.d.mts +1 -1
  23. package/package.json +7 -7
  24. package/src/control/control-migration-types.ts +5 -22
  25. package/src/control/psl-ast.ts +4 -1
  26. package/src/control/psl-extension-block-validator.ts +11 -9
  27. package/src/exports/authoring.ts +1 -0
  28. package/src/exports/control.ts +0 -1
  29. package/src/shared/framework-authoring.ts +86 -26
  30. package/src/shared/psl-extension-block.ts +56 -5
  31. package/dist/codec-DCQAerzB.d.mts.map +0 -1
  32. package/dist/framework-authoring-CnwPJCO4.mjs.map +0 -1
  33. package/dist/framework-authoring-R0TYCkvG.d.mts.map +0 -1
@@ -107,15 +107,17 @@ export function validateExtensionBlock(
107
107
  const nodeKeys = new Set(Object.keys(node.parameters));
108
108
 
109
109
  // 1. Unknown parameters — keys in the node not in the descriptor.
110
- for (const key of nodeKeys) {
111
- if (!descriptorKeys.has(key)) {
112
- const captured = node.parameters[key];
113
- diagnostics.push({
114
- code: 'PSL_EXTENSION_UNKNOWN_PARAMETER',
115
- message: `Unknown parameter "${key}" in "${descriptor.keyword}" block "${node.name}". The descriptor does not declare this parameter.`,
116
- sourceId,
117
- span: captured?.span ?? node.span,
118
- });
110
+ if (!descriptor.variadicParameters) {
111
+ for (const key of nodeKeys) {
112
+ if (!descriptorKeys.has(key)) {
113
+ const captured = node.parameters[key];
114
+ diagnostics.push({
115
+ code: 'PSL_EXTENSION_UNKNOWN_PARAMETER',
116
+ message: `Unknown parameter "${key}" in "${descriptor.keyword}" block "${node.name}". The descriptor does not declare this parameter.`,
117
+ sourceId,
118
+ span: captured?.span ?? node.span,
119
+ });
120
+ }
119
121
  }
120
122
  }
121
123
 
@@ -3,6 +3,7 @@ export type {
3
3
  AuthoringArgumentDescriptor,
4
4
  AuthoringColumnDefaultTemplate,
5
5
  AuthoringContributions,
6
+ AuthoringDiagnosticSink,
6
7
  AuthoringEntityContext,
7
8
  AuthoringEntityTypeDescriptor,
8
9
  AuthoringEntityTypeFactoryOutput,
@@ -47,7 +47,6 @@ export type {
47
47
  MigrationRunnerSuccessValue,
48
48
  MigrationScaffoldContext,
49
49
  OpFactoryCall,
50
- SerializedQueryPlan,
51
50
  TargetMigrationsCapability,
52
51
  } from '../control/control-migration-types';
53
52
  export type {
@@ -10,6 +10,7 @@ import {
10
10
  import { blindCast } from '@prisma-next/utils/casts';
11
11
  import { ifDefined } from '@prisma-next/utils/defined';
12
12
  import type { Type } from 'arktype';
13
+ import type { CodecLookup } from './codec-types';
13
14
  import type { PslBlockParam } from './psl-extension-block';
14
15
 
15
16
  export type AuthoringArgRef = {
@@ -109,9 +110,30 @@ export type AuthoringFieldNamespace = {
109
110
  * discover what the factory actually needs to read (codec lookup,
110
111
  * namespace registry, …).
111
112
  */
113
+ /**
114
+ * A write-only sink that a factory may push authoring-time diagnostics into.
115
+ * The concrete type pushed must be structurally compatible with whatever the
116
+ * consumer accumulates (typically `ContractSourceDiagnostic[]`); the framework
117
+ * layer deliberately does not depend on that concrete type.
118
+ */
119
+ export interface AuthoringDiagnosticSink {
120
+ push(d: {
121
+ readonly code: string;
122
+ readonly message: string;
123
+ readonly sourceId: string;
124
+ readonly span?: unknown;
125
+ }): void;
126
+ }
127
+
112
128
  export interface AuthoringEntityContext {
113
129
  readonly family: string;
114
130
  readonly target: string;
131
+ /** Codec registry available to factories that need to validate or decode values. */
132
+ readonly codecLookup?: CodecLookup;
133
+ /** Source file identifier threaded into diagnostics emitted by the factory. */
134
+ readonly sourceId?: string;
135
+ /** Push channel for authoring-time diagnostics emitted by the factory. */
136
+ readonly diagnostics?: AuthoringDiagnosticSink;
115
137
  }
116
138
 
117
139
  export interface AuthoringEntityTypeTemplateOutput {
@@ -186,6 +208,21 @@ export interface AuthoringPslBlockDescriptor {
186
208
  readonly discriminator: string;
187
209
  readonly name: { readonly required: boolean };
188
210
  readonly parameters: Record<string, PslBlockParam>;
211
+ /**
212
+ * When `true`, the block body accepts a variadic tail of parameters beyond
213
+ * the declared set. The block body may contain: fields (model-style),
214
+ * `key = value` parameters, and `@@` attributes. With `variadicParameters`,
215
+ * bare identifiers (keys without a `= value`) and undeclared `key = value`
216
+ * pairs flow into the variadic tail — their semantics belong to the
217
+ * lowering, not the parser.
218
+ *
219
+ * A key that IS declared in `parameters` must still be supplied as
220
+ * `key = value`; a bare occurrence of a declared key is a diagnostic.
221
+ *
222
+ * When `false` (default), the validator emits `PSL_EXTENSION_UNKNOWN_PARAMETER`
223
+ * for keys absent from `parameters`.
224
+ */
225
+ readonly variadicParameters?: boolean;
189
226
  }
190
227
 
191
228
  export type AuthoringPslBlockDescriptorNamespace = {
@@ -399,7 +436,7 @@ export function mergeAuthoringNamespaces(
399
436
  }
400
437
  }
401
438
 
402
- function collectAuthoringLeafPaths(
439
+ function collectDescriptorPaths(
403
440
  namespace: Readonly<Record<string, unknown>>,
404
441
  isLeaf: (value: unknown) => boolean,
405
442
  path: readonly string[] = [],
@@ -413,29 +450,25 @@ function collectAuthoringLeafPaths(
413
450
  }
414
451
  if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
415
452
  paths.push(
416
- ...collectAuthoringLeafPaths(
417
- value as Readonly<Record<string, unknown>>,
418
- isLeaf,
419
- currentPath,
420
- ),
453
+ ...collectDescriptorPaths(value as Readonly<Record<string, unknown>>, isLeaf, currentPath),
421
454
  );
422
455
  }
423
456
  }
424
457
  return paths;
425
458
  }
426
459
 
427
- interface AuthoringLeafEntry {
460
+ interface DescriptorEntry {
428
461
  readonly path: string;
429
462
  readonly discriminator: string;
430
463
  }
431
464
 
432
- function collectAuthoringLeafDiscriminators(
465
+ function collectDescriptorEntries(
433
466
  namespace: Readonly<Record<string, unknown>>,
434
467
  isLeaf: (value: unknown) => boolean,
435
468
  label: string,
436
469
  path: readonly string[] = [],
437
- ): AuthoringLeafEntry[] {
438
- const entries: AuthoringLeafEntry[] = [];
470
+ ): DescriptorEntry[] {
471
+ const entries: DescriptorEntry[] = [];
439
472
  for (const [key, value] of Object.entries(namespace)) {
440
473
  const currentPath = [...path, key];
441
474
  if (isLeaf(value)) {
@@ -479,7 +512,7 @@ function collectAuthoringLeafDiscriminators(
479
512
  );
480
513
  }
481
514
  }
482
- entries.push(...collectAuthoringLeafDiscriminators(record, isLeaf, label, currentPath));
515
+ entries.push(...collectDescriptorEntries(record, isLeaf, label, currentPath));
483
516
  }
484
517
  }
485
518
  return entries;
@@ -491,7 +524,7 @@ function collectAuthoringLeafDiscriminators(
491
524
  * lowering factory lookup dispatches by discriminator, so one would silently
492
525
  * shadow the other. Catch duplicates before building any dispatch map.
493
526
  */
494
- function assertUniqueDiscriminators(entries: readonly AuthoringLeafEntry[], label: string): void {
527
+ function assertUniqueDiscriminators(entries: readonly DescriptorEntry[], label: string): void {
495
528
  const seen = new Map<string, string>();
496
529
  for (const { path, discriminator } of entries) {
497
530
  const existing = seen.get(discriminator);
@@ -504,23 +537,50 @@ function assertUniqueDiscriminators(entries: readonly AuthoringLeafEntry[], labe
504
537
  }
505
538
  }
506
539
 
540
+ function collectPslBlockDescriptorEntries(
541
+ namespace: Readonly<Record<string, unknown>>,
542
+ path: readonly string[] = [],
543
+ ): DescriptorEntry[] {
544
+ const entries: DescriptorEntry[] = [];
545
+ for (const [key, value] of Object.entries(namespace)) {
546
+ const currentPath = [...path, key];
547
+ if (isAuthoringPslBlockDescriptor(value)) {
548
+ entries.push({
549
+ path: currentPath.join('.'),
550
+ discriminator: value.discriminator,
551
+ });
552
+ continue;
553
+ }
554
+ if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
555
+ const record = blindCast<
556
+ Readonly<Record<string, unknown>>,
557
+ 'walker descends into psl block namespace'
558
+ >(value);
559
+ const hasKind = record['kind'] === 'pslBlock';
560
+ const hasKeyword = typeof record['keyword'] === 'string';
561
+ const hasDiscriminator = typeof record['discriminator'] === 'string';
562
+ if (hasKind || (hasKeyword && hasDiscriminator)) {
563
+ throw new Error(
564
+ `Malformed authoring pslBlock contribution at "${currentPath.join('.')}". The value carries descriptor keys (kind/keyword/discriminator) but does not satisfy the pslBlock descriptor shape. Fix the contribution so it is a complete descriptor, or remove the stray keys if it was meant to be a sub-namespace.`,
565
+ );
566
+ }
567
+ entries.push(...collectPslBlockDescriptorEntries(record, currentPath));
568
+ }
569
+ }
570
+ return entries;
571
+ }
572
+
507
573
  /**
508
- * Every `pslBlockDescriptors` entry needs a matching `entityTypes` factory
509
- * (same discriminator): the parser would otherwise produce an AST node
510
- * nothing can lower to an IR class instance. The link is one-directional
511
- * — an `entityTypes` factory may stand alone (e.g. `enum`, reachable from
512
- * the TypeScript builder without any PSL block).
574
+ * Every `pslBlockDescriptors` entry requires a matching `entityTypes` factory
575
+ * with the same discriminator. An `entityTypes` factory may stand alone (e.g.
576
+ * `enum`, reachable from the TypeScript builder without any PSL block).
513
577
  */
514
578
  function assertPslBlocksHaveFactories(
515
579
  entityTypeNamespace: AuthoringEntityTypeNamespace,
516
580
  pslBlockNamespace: AuthoringPslBlockDescriptorNamespace,
517
581
  ): void {
518
- const blockEntries = collectAuthoringLeafDiscriminators(
519
- pslBlockNamespace,
520
- isAuthoringPslBlockDescriptor,
521
- 'pslBlock',
522
- );
523
- const entityEntries = collectAuthoringLeafDiscriminators(
582
+ const blockEntries = collectPslBlockDescriptorEntries(pslBlockNamespace);
583
+ const entityEntries = collectDescriptorEntries(
524
584
  entityTypeNamespace,
525
585
  isAuthoringEntityTypeDescriptor,
526
586
  'entityType',
@@ -547,13 +607,13 @@ export function assertNoCrossRegistryCollisions(
547
607
  pslBlockNamespace: AuthoringPslBlockDescriptorNamespace = {},
548
608
  ): void {
549
609
  const typePaths = new Set(
550
- collectAuthoringLeafPaths(typeNamespace, isAuthoringTypeConstructorDescriptor),
610
+ collectDescriptorPaths(typeNamespace, isAuthoringTypeConstructorDescriptor),
551
611
  );
552
612
  const fieldPaths = new Set(
553
- collectAuthoringLeafPaths(fieldNamespace, isAuthoringFieldPresetDescriptor),
613
+ collectDescriptorPaths(fieldNamespace, isAuthoringFieldPresetDescriptor),
554
614
  );
555
615
  const entityPaths = new Set(
556
- collectAuthoringLeafPaths(entityTypeNamespace, isAuthoringEntityTypeDescriptor),
616
+ collectDescriptorPaths(entityTypeNamespace, isAuthoringEntityTypeDescriptor),
557
617
  );
558
618
  // Within-registry duplicate detection is handled upstream by the merge
559
619
  // walker (`mergeAuthoringNamespaces` in control-stack.ts and
@@ -70,7 +70,16 @@ export type PslDiagnosticCode =
70
70
  * A `ref`-kind parameter identifier does not resolve to a declared entity of
71
71
  * the required `refKind` within the declared scope.
72
72
  */
73
- | 'PSL_EXTENSION_UNRESOLVED_REF';
73
+ | 'PSL_EXTENSION_UNRESOLVED_REF'
74
+ /**
75
+ * A parameter key appears more than once in an extension block body.
76
+ * The first occurrence is kept; subsequent occurrences emit this diagnostic.
77
+ */
78
+ | 'PSL_EXTENSION_DUPLICATE_PARAMETER'
79
+ /**
80
+ * A `@@`-prefixed block-attribute line inside an extension block has invalid syntax.
81
+ */
82
+ | 'PSL_INVALID_EXTENSION_BLOCK_ATTRIBUTE';
74
83
 
75
84
  /**
76
85
  * Descriptor vocabulary for a single parameter on a declared block.
@@ -118,14 +127,17 @@ export interface PslBlockParamList {
118
127
  /**
119
128
  * The parsed representation of a single parameter value on a uniform
120
129
  * extension-block AST node. Mirrors the `PslBlockParam` descriptor
121
- * vocabulary:
130
+ * vocabulary, plus `bare` for keyonly entries:
122
131
  *
123
132
  * - `ref` → `PslExtensionBlockParamRef` — a raw identifier string
124
133
  * (resolution runs in the validator, not the parser).
125
- * - `value` → `PslExtensionBlockParamValue` — a raw PSL literal string
134
+ * - `value` → `PslExtensionBlockParamScalarValue` — a raw PSL literal string
126
135
  * (codec validation runs in the validator).
127
136
  * - `option` → `PslExtensionBlockParamOption` — the chosen token.
128
137
  * - `list` → `PslExtensionBlockParamList` — ordered list of the above.
138
+ * - `bare` → `PslExtensionBlockParamBare` — a bare identifier line with no
139
+ * `= value` (e.g. `Low` in an enum2 block). The name is the key in
140
+ * `parameters`; the interpreting consumer decides the default value.
129
141
  *
130
142
  * These shapes are intentionally minimal. The validator and lowering refine
131
143
  * and consume them; the generic framework parser produces them.
@@ -134,7 +146,8 @@ export type PslExtensionBlockParamValue =
134
146
  | PslExtensionBlockParamRef
135
147
  | PslExtensionBlockParamScalarValue
136
148
  | PslExtensionBlockParamOption
137
- | PslExtensionBlockParamList;
149
+ | PslExtensionBlockParamList
150
+ | PslExtensionBlockParamBare;
138
151
 
139
152
  export interface PslExtensionBlockParamRef {
140
153
  readonly kind: 'ref';
@@ -160,6 +173,38 @@ export interface PslExtensionBlockParamList {
160
173
  readonly span: PslSpan;
161
174
  }
162
175
 
176
+ /**
177
+ * A bare identifier line inside an extension block — a key with no `= value`.
178
+ * Emitted when a line matches `/^[A-Za-z_]\w*$/` with no assignment. The
179
+ * consumer decides what default value (if any) to apply.
180
+ */
181
+ export interface PslExtensionBlockParamBare {
182
+ readonly kind: 'bare';
183
+ readonly span: PslSpan;
184
+ }
185
+
186
+ /**
187
+ * A positional argument on a block attribute, e.g. the `"pg/text@1"` in
188
+ * `@@type("pg/text@1")`.
189
+ */
190
+ export interface PslExtensionBlockAttributeArg {
191
+ readonly kind: 'positional';
192
+ readonly value: string;
193
+ readonly span: PslSpan;
194
+ }
195
+
196
+ /**
197
+ * A `@@`-prefixed block-level attribute parsed inside an extension block,
198
+ * e.g. `@@type("pg/text@1")`. Block attributes are captured generically
199
+ * — the parser does not validate attribute names or argument shapes; that
200
+ * is a concern of the block's interpreter.
201
+ */
202
+ export interface PslExtensionBlockAttribute {
203
+ readonly name: string;
204
+ readonly args: readonly PslExtensionBlockAttributeArg[];
205
+ readonly span: PslSpan;
206
+ }
207
+
163
208
  /**
164
209
  * Base shape for a uniform extension-contributed top-level PSL block
165
210
  * node, as produced by the generic framework parser and consumed by the
@@ -173,12 +218,18 @@ export interface PslExtensionBlockParamList {
173
218
  * parameter names from the descriptor; values are the parsed parameter
174
219
  * representations. Only parameters present in the source are included
175
220
  * — absence of a required parameter is a validator concern, not a
176
- * parser concern.
221
+ * parser concern. Insertion order is preserved; the first occurrence of a
222
+ * duplicate key is retained and subsequent occurrences emit
223
+ * `PSL_EXTENSION_DUPLICATE_PARAMETER`.
224
+ * - `blockAttributes` are `@@`-prefixed attribute lines inside the block, in
225
+ * declaration order. Captured generically — names and args are not validated
226
+ * by the parser.
177
227
  * - `span` covers the full block from keyword to closing brace.
178
228
  */
179
229
  export interface PslExtensionBlock {
180
230
  readonly kind: string;
181
231
  readonly name: string;
182
232
  readonly parameters: Record<string, PslExtensionBlockParamValue>;
233
+ readonly blockAttributes: readonly PslExtensionBlockAttribute[];
183
234
  readonly span: PslSpan;
184
235
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"codec-DCQAerzB.d.mts","names":[],"sources":["../src/shared/codec-types.ts","../src/shared/codec-descriptor.ts","../src/shared/codec.ts"],"mappings":";;;;KAIY,UAAA;AAAZ;;;;AAAsB;AAWtB;;;;AAXA,UAWiB,QAAA;EAAA,SACN,OAAA;EAAA,SACA,UAAA,GAAa,SAAS;AAAA;AAAA;AAcjC;;;;AAC+B;AAW/B;;;;;AA1BiC,UAchB,gBAAA;EAAA,SACN,MAAA,GAAS,WAAW;AAAA;;;;;;;;;UAWd,WAAA;EACf,GAAA,CAAI,EAAA,WAAa,KAAA;EACjB,cAAA,CAAe,EAAA;EACf,OAAA,CAAQ,EAAA,WAAa,SAAA;EACrB,mBAAA,CAAoB,EAAA,UAAY,MAAA,EAAQ,MAAA;AAAA;AAAA,cAG7B,gBAAA,EAAkB,WAK9B;;;;AAAA;AASD;;;UAAiB,oBAAA;EAAA,SACN,IAAI;AAAA;;;;UAME,SAAA;EAAA,SACN,EAAA,GAAK,MAAM;AAAA;;;AAMyB;cAAlC,gBAAA,EAAkB,gBAAgB;;;;;;;;AA7Dd;AAcjC;;;;AAC+B;UCFd,eAAA;EDaW;EAAA,SCXjB,OAAA;EDYQ;EAAA,SCVR,MAAA,WAAiB,UAAA;EDac;EAAA,SCX/B,WAAA;EDWqC;EAAA,SCTrC,IAAA,GAAO,SAAA;EDMZ;EAAA,SCJK,YAAA,EAAc,gBAAA,CAAiB,CAAA;EDKxC;EAAA,SCHS,eAAA;EDIT;EAAA,SCFS,gBAAA,IAAoB,MAAA,EAAQ,CAAA;EDEhB;EAAA,SCAZ,OAAA,GAAU,MAAA,EAAQ,CAAA,MAAO,GAAA,EAAK,oBAAA,KAAyB,KAAA;AAAA;;;;ADCD;AAGj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M,KAAA,EAAO,GAAA,EAAK,gBAAA,GAAmB,OAAA,CAAQ,MAAA;EAAA,SACpD,UAAA,CAAW,KAAA,EAAO,MAAA,GAAS,SAAA;EAAA,SAC3B,UAAA,CAAW,IAAA,EAAM,SAAA,GAAY,MAAA;AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"framework-authoring-CnwPJCO4.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 { blindCast } from '@prisma-next/utils/casts';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport type { Type } from 'arktype';\nimport type { PslBlockParam } from './psl-extension-block';\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\n/**\n * Context surfaced to entity-type factories at call time. Currently a\n * placeholder — sharpened as concrete consumers (enum, namespace, …)\n * discover what the factory actually needs to read (codec lookup,\n * namespace registry, …).\n */\nexport interface AuthoringEntityContext {\n readonly family: string;\n readonly target: string;\n}\n\nexport interface AuthoringEntityTypeTemplateOutput {\n readonly template: AuthoringTemplateValue;\n}\n\n/**\n * Default `Input = never` is load-bearing for pack-bag-driven type\n * narrowing. Factory parameter positions are contravariant, so a pack\n * literal declaring `factory: (input: DemoEntityInput) => DemoEntity`\n * is only assignable to the base descriptor's factory shape if the\n * base's input is `never` (the bottom of the contravariant position).\n * The concrete input/output types are recovered at the helper-derivation\n * site via `EntityHelperFunction<Descriptor>`'s conditional inference,\n * which reads them from the pack's `as const` literal factory signature\n * — the base widening does not erase the literal because `satisfies`\n * does not widen the declared type.\n */\nexport interface AuthoringEntityTypeFactoryOutput<Input = never, Output = unknown> {\n readonly factory: (input: Input, ctx: AuthoringEntityContext) => Output;\n}\n\nexport interface AuthoringEntityTypeDescriptor<Input = never, Output = unknown> {\n readonly kind: 'entity';\n readonly discriminator: string;\n readonly args?: readonly AuthoringArgumentDescriptor[];\n readonly output:\n | AuthoringEntityTypeTemplateOutput\n | AuthoringEntityTypeFactoryOutput<Input, Output>;\n /**\n * arktype schema fragment for one entry whose envelope `kind` matches\n * this descriptor's {@link discriminator}. The family validator composes\n * contributed fragments into the per-namespace entry schema at\n * validator construction time so the structural check covers\n * pack-introduced kinds without the family core hard-coding the schema.\n *\n * Hydration uses {@link AuthoringEntityTypeFactoryOutput.factory}\n * directly — the wire shape conforms structurally to the factory's\n * `Input` after `validatorSchema` validates it.\n */\n readonly validatorSchema?: Type<unknown>;\n}\n\nexport type AuthoringEntityTypeNamespace = {\n readonly [name: string]: AuthoringEntityTypeDescriptor | AuthoringEntityTypeNamespace;\n};\n\n/**\n * Declarative descriptor for an extension-contributed top-level PSL block.\n *\n * An extension registers one of these per keyword it contributes. The\n * framework owns the generic parser, validator, and printer — no\n * parsing or printing code runs from the extension.\n *\n * - `keyword` is the PSL top-level identifier this descriptor claims\n * (`policy_select`, `role`, …).\n * - `discriminator` is the routing key used by the printer dispatch and\n * the `entityTypes` lowering factory lookup. Convention:\n * `<target-or-family>-<kind>` (`postgres-policy-select`).\n * - `name.required` declares whether the block must have a name token\n * after the keyword. Currently always `true` — anonymous blocks are\n * not part of the closed-grammar premise — but the field is explicit\n * so the type can evolve without a breaking change.\n * - `parameters` maps parameter names to their value-kind descriptors\n * (`ref` / `value` / `option` / `list`). The generic parser and\n * validator interpret these; the extension supplies no parser or\n * printer function.\n */\nexport interface AuthoringPslBlockDescriptor {\n readonly kind: 'pslBlock';\n readonly keyword: string;\n readonly discriminator: string;\n readonly name: { readonly required: boolean };\n readonly parameters: Record<string, PslBlockParam>;\n}\n\nexport type AuthoringPslBlockDescriptorNamespace = {\n readonly [name: string]: AuthoringPslBlockDescriptor | AuthoringPslBlockDescriptorNamespace;\n};\n\nexport interface AuthoringContributions {\n readonly type?: AuthoringTypeNamespace;\n readonly field?: AuthoringFieldNamespace;\n readonly entityTypes?: AuthoringEntityTypeNamespace;\n /**\n * Registry of declarative block descriptors this contribution registers,\n * keyed by arbitrary path segments. Each leaf is an\n * {@link AuthoringPslBlockDescriptor} that claims a PSL top-level keyword.\n * The framework owns the generic parser, validator, and printer; the\n * contribution supplies only these declarative descriptors.\n *\n * Contrast with the parsed block nodes themselves, which live in a\n * namespace's `entries` under their discriminator key; this field holds the\n * registry of descriptors that teach the parser how to read those blocks.\n */\n readonly pslBlockDescriptors?: AuthoringPslBlockDescriptorNamespace;\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\nexport function isAuthoringEntityTypeDescriptor(\n value: unknown,\n): value is AuthoringEntityTypeDescriptor {\n if (\n typeof value !== 'object' ||\n value === null ||\n (value as { kind?: unknown }).kind !== 'entity'\n ) {\n return false;\n }\n const discriminator = (value as { discriminator?: unknown }).discriminator;\n if (typeof discriminator !== 'string' || discriminator.length === 0) {\n return false;\n }\n const output = (value as { output?: unknown }).output;\n if (typeof output !== 'object' || output === null) {\n return false;\n }\n const factory = (output as { factory?: unknown }).factory;\n const template = (output as { template?: unknown }).template;\n return typeof factory === 'function' || template !== undefined;\n}\n\nexport function isAuthoringPslBlockDescriptor(\n value: unknown,\n): value is AuthoringPslBlockDescriptor {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n const record = blindCast<\n Record<string, unknown>,\n 'type-guard probing an unknown candidate-descriptor object for known property names'\n >(value);\n if (record['kind'] !== 'pslBlock') {\n return false;\n }\n const keyword = record['keyword'];\n if (typeof keyword !== 'string' || keyword.length === 0) {\n return false;\n }\n const discriminator = record['discriminator'];\n if (typeof discriminator !== 'string' || discriminator.length === 0) {\n return false;\n }\n const name = record['name'];\n if (typeof name !== 'object' || name === null) {\n return false;\n }\n const nameRecord = blindCast<\n Record<string, unknown>,\n 'type-guard probing the name property of a candidate pslBlock descriptor'\n >(name);\n if (typeof nameRecord['required'] !== 'boolean') {\n return false;\n }\n const parameters = record['parameters'];\n return typeof parameters === 'object' && parameters !== null && !Array.isArray(parameters);\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\ninterface AuthoringLeafEntry {\n readonly path: string;\n readonly discriminator: string;\n}\n\nfunction collectAuthoringLeafDiscriminators(\n namespace: Readonly<Record<string, unknown>>,\n isLeaf: (value: unknown) => boolean,\n label: string,\n path: readonly string[] = [],\n): AuthoringLeafEntry[] {\n const entries: AuthoringLeafEntry[] = [];\n for (const [key, value] of Object.entries(namespace)) {\n const currentPath = [...path, key];\n if (isLeaf(value)) {\n const record = blindCast<\n Record<string, unknown>,\n 'discriminator extraction from a leaf already validated by isLeaf'\n >(value);\n const discriminator = record['discriminator'];\n if (typeof discriminator === 'string' && discriminator.length > 0) {\n entries.push({ path: currentPath.join('.'), discriminator });\n }\n continue;\n }\n if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n const record = blindCast<\n Readonly<Record<string, unknown>>,\n 'walker inspects a non-leaf value for descriptor-shaped keys before recursing'\n >(value);\n // A value carrying descriptor-shaped keys (`kind`/`keyword`/`discriminator`)\n // but failing `isAuthoringPslBlockDescriptor` (e.g. missing `parameters`) is\n // a malformed declarative descriptor. Descending into it as a sub-namespace\n // would silently skip it, so a half-built contribution would pass validation.\n // Reject it at load time instead, naming the path and what's wrong.\n //\n // A valid sub-namespace whose key happens to be named `kind`, `keyword`, or\n // `discriminator` (but which does not look like a descriptor overall) must\n // still descend normally — the check requires descriptor-shaped keys present\n // AND the leaf guard rejecting it.\n if (\n (record['kind'] !== undefined ||\n record['keyword'] !== undefined ||\n record['discriminator'] !== undefined) &&\n !isLeaf(value)\n ) {\n const hasKind = record['kind'] === 'pslBlock';\n const hasKeyword = typeof record['keyword'] === 'string';\n const hasDiscriminator = typeof record['discriminator'] === 'string';\n if (hasKind || (hasKeyword && hasDiscriminator)) {\n throw new Error(\n `Malformed authoring ${label} contribution at \"${currentPath.join('.')}\". The value carries descriptor keys (kind/keyword/discriminator) but does not satisfy the ${label} descriptor shape. Fix the contribution so it is a complete descriptor, or remove the stray keys if it was meant to be a sub-namespace.`,\n );\n }\n }\n entries.push(...collectAuthoringLeafDiscriminators(record, isLeaf, label, currentPath));\n }\n }\n return entries;\n}\n\n/**\n * Throws when two or more entries in the same namespace share a discriminator.\n * Duplicate discriminators within a namespace make dispatch ambiguous — the\n * lowering factory lookup dispatches by discriminator, so one would silently\n * shadow the other. Catch duplicates before building any dispatch map.\n */\nfunction assertUniqueDiscriminators(entries: readonly AuthoringLeafEntry[], label: string): void {\n const seen = new Map<string, string>();\n for (const { path, discriminator } of entries) {\n const existing = seen.get(discriminator);\n if (existing !== undefined) {\n throw new Error(\n `Duplicate ${label} discriminator \"${discriminator}\" registered at both \"${existing}\" and \"${path}\". Each ${label} contribution must use a unique discriminator.`,\n );\n }\n seen.set(discriminator, path);\n }\n}\n\n/**\n * Every `pslBlockDescriptors` entry needs a matching `entityTypes` factory\n * (same discriminator): the parser would otherwise produce an AST node\n * nothing can lower to an IR class instance. The link is one-directional\n * — an `entityTypes` factory may stand alone (e.g. `enum`, reachable from\n * the TypeScript builder without any PSL block).\n */\nfunction assertPslBlocksHaveFactories(\n entityTypeNamespace: AuthoringEntityTypeNamespace,\n pslBlockNamespace: AuthoringPslBlockDescriptorNamespace,\n): void {\n const blockEntries = collectAuthoringLeafDiscriminators(\n pslBlockNamespace,\n isAuthoringPslBlockDescriptor,\n 'pslBlock',\n );\n const entityEntries = collectAuthoringLeafDiscriminators(\n entityTypeNamespace,\n isAuthoringEntityTypeDescriptor,\n 'entityType',\n );\n\n assertUniqueDiscriminators(blockEntries, 'pslBlock');\n assertUniqueDiscriminators(entityEntries, 'entityType');\n\n const entityDiscriminators = new Set(entityEntries.map((entry) => entry.discriminator));\n\n for (const block of blockEntries) {\n if (!entityDiscriminators.has(block.discriminator)) {\n throw new Error(\n `Incomplete extension contribution: pslBlock helper \"${block.path}\" registers discriminator \"${block.discriminator}\" but no entityType contribution shares that discriminator. An extension-contributed PSL block requires a matching entityType factory so the parsed AST node can lower to an IR class instance; add an entityType helper with discriminator \"${block.discriminator}\".`,\n );\n }\n }\n}\n\nexport function assertNoCrossRegistryCollisions(\n typeNamespace: AuthoringTypeNamespace,\n fieldNamespace: AuthoringFieldNamespace,\n entityTypeNamespace: AuthoringEntityTypeNamespace = {},\n pslBlockNamespace: AuthoringPslBlockDescriptorNamespace = {},\n): void {\n const typePaths = new Set(\n collectAuthoringLeafPaths(typeNamespace, isAuthoringTypeConstructorDescriptor),\n );\n const fieldPaths = new Set(\n collectAuthoringLeafPaths(fieldNamespace, isAuthoringFieldPresetDescriptor),\n );\n const entityPaths = new Set(\n collectAuthoringLeafPaths(entityTypeNamespace, isAuthoringEntityTypeDescriptor),\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 any single registry before this check\n // runs. This function only handles the cross-registry case.\n //\n // Cross-registry collisions are checked among `type` / `field` /\n // `entityTypes` only — these three are user-facing helper paths that PSL\n // must resolve unambiguously. `pslBlockDescriptors` is an internal\n // framework index consumed by parser and printer dispatch, not a\n // user-facing helper path; the natural authoring pattern is the same\n // path key in `entityTypes` and `pslBlockDescriptors` for a single\n // contribution. The block→factory link is enforced by\n // `assertPslBlocksHaveFactories` via the discriminator string, not by path.\n const ambiguityHint =\n 'Register each path in only one of authoringContributions.field / authoringContributions.type / authoringContributions.entityTypes.';\n for (const fieldPath of fieldPaths) {\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. ${ambiguityHint}`,\n );\n }\n }\n for (const entityPath of entityPaths) {\n if (typePaths.has(entityPath) || fieldPaths.has(entityPath)) {\n throw new Error(\n `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. ${ambiguityHint}`,\n );\n }\n }\n\n assertPslBlocksHaveFactories(entityTypeNamespace, pslBlockNamespace);\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 instantiateAuthoringEntityType(\n helperPath: string,\n descriptor: AuthoringEntityTypeDescriptor,\n args: readonly unknown[],\n ctx: AuthoringEntityContext,\n): unknown {\n // Factory-output entities carry their input contract on the factory\n // signature itself — TypeScript narrows callers via\n // `EntityHelperFunction`'s extracted `input` parameter, and the factory\n // is free to do its own runtime validation (e.g. arktype Type). The\n // descriptor-level `args` validator is reserved for template-output\n // entities (which mirror field/type's declarative argument shape).\n if ('factory' in descriptor.output) {\n const input = args[0];\n // The base `AuthoringEntityTypeDescriptor`'s factory is typed\n // `(input: never, ctx) => unknown` so concrete pack-literal factories\n // with narrower input types remain assignable through the\n // contravariant position (see the type's docstring). The runtime\n // delegates input validation to the pack's factory itself, so we\n // forward the supplied input here without a static input contract.\n const factory = descriptor.output.factory as (\n input: unknown,\n ctx: AuthoringEntityContext,\n ) => unknown;\n return factory(input, ctx);\n }\n validateAuthoringHelperArguments(helperPath, descriptor.args, args);\n return resolveAuthoringTemplateValue(descriptor.output.template, 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":";;;;AAoNA,SAAgB,kBAAkB,OAA0C;CAC1E,IAAI,OAAO,UAAU,YAAY,UAAU,QAAS,MAA6B,SAAS,OACxF,OAAO;CAET,MAAM,EAAE,OAAO,SAAS;CACxB,IAAI,OAAO,UAAU,YAAY,CAAC,OAAO,UAAU,KAAK,KAAK,QAAQ,GACnE,OAAO;CAET,IAAI,SAAS,KAAA,MAAc,CAAC,MAAM,QAAQ,IAAI,KAAK,KAAK,MAAM,MAAM,OAAO,MAAM,QAAQ,IACvF,OAAO;CAET,OAAO;AACT;AAEA,SAAS,0BAA0B,OAAkD;CACnF,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAgB,qCACd,OAC6C;CAC7C,OACE,OAAO,UAAU,YACjB,UAAU,QACT,MAA6B,SAAS,qBACvC,OAAQ,MAA+B,WAAW,YACjD,MAA+B,WAAW;AAE/C;AAEA,SAAgB,iCACd,OACyC;CACzC,OACE,OAAO,UAAU,YACjB,UAAU,QACT,MAA6B,SAAS,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ACN;EACA,GAAG,UACD,YACA,SAAS,aAAa,KAAA,IAClB,qCAAqC,YAAY,SAAS,UAAU,IAAI,IACxE,KAAA,CACN;CACF;AACF;AAEA,SAAgB,oCACd,YACA,MAKA;CACA,OAAO,oCAAoC,WAAW,QAAQ,IAAI;AACpE;AAEA,SAAgB,+BACd,YACA,YACA,MACA,KACS;CAOT,IAAI,aAAa,WAAW,QAAQ;EAClC,MAAM,QAAQ,KAAK;EAOnB,MAAM,UAAU,WAAW,OAAO;EAIlC,OAAO,QAAQ,OAAO,GAAG;CAC3B;CACA,iCAAiC,YAAY,WAAW,MAAM,IAAI;CAClE,OAAO,8BAA8B,WAAW,OAAO,UAAU,IAAI;AACvE;AAEA,SAAgB,gCACd,YACA,MAYA;CACA,OAAO;EACL,YAAY,oCAAoC,WAAW,QAAQ,IAAI;EACvE,UAAU,WAAW,OAAO,YAAY;EACxC,GAAG,UACD,WACA,WAAW,OAAO,YAAY,KAAA,IAC1B,sCAAsC,WAAW,OAAO,SAAS,IAAI,IACrE,KAAA,CACN;EACA,GAAG,UACD,qBACA,WAAW,OAAO,sBAAsB,KAAA,IACpC,0CAA0C,WAAW,OAAO,mBAAmB,IAAI,IACnF,KAAA,CACN;EACA,IAAI,WAAW,OAAO,MAAM;EAC5B,QAAQ,WAAW,OAAO,UAAU;CACtC;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"framework-authoring-R0TYCkvG.d.mts","names":[],"sources":["../src/shared/psl-extension-block.ts","../src/shared/framework-authoring.ts"],"mappings":";;;;;;;;AAYA;;;;;;;UAAiB,WAAA;EAAA,SACN,MAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA;AAAA;AAAA,UAGM,OAAA;EAAA,SACN,KAAA,EAAO,WAAA;EAAA,SACP,GAAA,EAAK,WAAW;AAAA;AAAA,KAGf,iBAAA;;AAHe;AAG3B;;;;AAA6B;AA+D7B;;;;;;;;;;;;;;AAIqB;AAErB;;;;;;;;;AAImB;AAGnB;;;AAHmB;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