@prisma/orm-framework 8.0.0-rc.9-dev.9 → 8.0.0-rc.9-dev.10

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.
@@ -1,6 +1,6 @@
1
1
  import { t as blindCast } from "./casts-DpaahrlC-Bd5n2coI.mjs";
2
- import { n as isCodecTrait } from "./codec-types-DcNvNeY1-BO6kUiH0.mjs";
3
- //#region ../../../1-framework/1-core/framework-components/dist/capabilities-BCEONw9w.mjs
2
+ import { n as isCodecTrait } from "./codec-types-smcGzGq6-BohNffPc.mjs";
3
+ //#region ../../../1-framework/1-core/framework-components/dist/capabilities-BzwH_XMZ.mjs
4
4
  /**
5
5
  * Ownership key of an `(operation, input)` pair. Two descriptors sharing a key are two contributors claiming one overload, which is a composition error.
6
6
  */
@@ -117,4 +117,4 @@ function mergeCapabilityMatrices(base, contributors) {
117
117
  //#endregion
118
118
  export { mergeCapabilityMatrices as a, isNoInputAggregateDescriptor as i, isAggregateDescriptor as n, isAnyInputAggregateDescriptor as r, aggregateDescriptorKey as t };
119
119
 
120
- //# sourceMappingURL=capabilities-BCEONw9w-C-lo3rF8.mjs.map
120
+ //# sourceMappingURL=capabilities-BzwH_XMZ-CkgWaxF9.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities-BCEONw9w-C-lo3rF8.mjs","names":[],"sources":["../../../../1-framework/1-core/framework-components/dist/capabilities-BCEONw9w.mjs"],"sourcesContent":["import { n as isCodecTrait } from \"./codec-types-DcNvNeY1.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/shared/aggregate-descriptor.ts\n/**\n* Ownership key of an `(operation, input)` pair. Two descriptors sharing a key are two contributors claiming one overload, which is a composition error.\n*/\nfunction aggregateDescriptorKey(descriptor) {\n\tswitch (descriptor.input.kind) {\n\t\tcase \"none\": return `${descriptor.operation}:none`;\n\t\tcase \"any\": return `${descriptor.operation}:any`;\n\t\tcase \"codec\": return `${descriptor.operation}:codec:${descriptor.input.codecId}`;\n\t\tcase \"trait\": return `${descriptor.operation}:trait:${descriptor.input.trait}`;\n\t}\n}\n/** Whether `descriptor` is the overload of an operation that consumes no value — the case whose result always names a codec outright. */\nfunction isNoInputAggregateDescriptor(descriptor) {\n\treturn descriptor.input.kind === \"none\";\n}\n/** Whether `descriptor` answers regardless of input — the fallback rung of resolution. */\nfunction isAnyInputAggregateDescriptor(descriptor) {\n\treturn descriptor.input.kind === \"any\";\n}\nfunction isObjectLike(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction isNonEmptyString(value) {\n\treturn typeof value === \"string\" && value.length > 0;\n}\nfunction isAggregateInputMatch(value) {\n\tif (!isObjectLike(value) || !(\"kind\" in value)) return false;\n\tswitch (value.kind) {\n\t\tcase \"none\":\n\t\tcase \"any\": return true;\n\t\tcase \"codec\": return \"codecId\" in value && isNonEmptyString(value.codecId);\n\t\tcase \"trait\": return \"trait\" in value && isCodecTrait(value.trait);\n\t\tdefault: return false;\n\t}\n}\nfunction isAggregateOutputCodec(value) {\n\tif (!isObjectLike(value) || !(\"kind\" in value)) return false;\n\tswitch (value.kind) {\n\t\tcase \"self\": return true;\n\t\tcase \"codec\": return \"codecId\" in value && isNonEmptyString(value.codecId) && (!(\"typeParams\" in value) || value.typeParams === void 0 || typeof value.typeParams === \"function\");\n\t\tdefault: return false;\n\t}\n}\n/**\n* Structural validation of a contributed descriptor. Components assembled from JavaScript reach the contribution slot unchecked, so composition validates the shape once and every later read is a plain lookup.\n*/\nfunction isAggregateDescriptor(value) {\n\tif (!isObjectLike(value)) return false;\n\tif (!(\"operation\" in value) || !isNonEmptyString(value.operation)) return false;\n\tif (!(\"nullable\" in value) || typeof value.nullable !== \"boolean\") return false;\n\tif (value.nullable === false && (!(\"emptyResultJson\" in value) || value.emptyResultJson === void 0)) return false;\n\tif (!(\"input\" in value) || !isAggregateInputMatch(value.input)) return false;\n\tif (!(\"output\" in value) || !isAggregateOutputCodec(value.output)) return false;\n\treturn value.input.kind === \"codec\" || value.input.kind === \"trait\" || value.output.kind === \"codec\";\n}\n//#endregion\n//#region src/shared/capabilities.ts\n/**\n* Capability matrix merge primitive shared by emit-time and runtime stack composition.\n*\n* The CLI's `enrichContract` and the SQL runtime's `createExecutionContext` both need\n* to fold a stack of component descriptors' `capabilities` declarations into a single\n* matrix keyed by namespace. Keeping the primitive here lets both call sites stay\n* byte-for-byte consistent without one depending on the other.\n*/\nfunction isPlainObject(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction sortDeep(value) {\n\tif (Array.isArray(value)) return value.map(sortDeep);\n\tif (!isPlainObject(value)) return value;\n\tconst entries = Object.entries(value).sort(([a], [b]) => a.localeCompare(b));\n\tconst next = {};\n\tfor (const [key, child] of entries) next[key] = sortDeep(child);\n\treturn next;\n}\nfunction extractCapabilityMatrix(value) {\n\tif (!isPlainObject(value)) return {};\n\tconst out = {};\n\tfor (const [namespace, maybeCaps] of Object.entries(value)) {\n\t\tif (!isPlainObject(maybeCaps)) continue;\n\t\tconst caps = {};\n\t\tfor (const [key, flag] of Object.entries(maybeCaps)) if (typeof flag === \"boolean\") caps[key] = flag;\n\t\tif (Object.keys(caps).length > 0) out[namespace] = caps;\n\t}\n\treturn out;\n}\n/**\n* Merge an ordered list of contributor capability declarations into a base matrix.\n*\n* Behaviour:\n* - `base` and each contributor's `capabilities` are filtered through the same\n* structural extraction: non-plain-object namespace blocks are dropped,\n* non-boolean leaves inside a namespace block are dropped, and a namespace\n* block that ends up with zero boolean leaves is omitted entirely (so a\n* later contributor with a malformed namespace cannot erase a namespace\n* already present in `base`).\n* - Non-plain-object `capabilities` on a contributor (including `undefined`,\n* `null`, arrays, primitives) are skipped silently — the contributor\n* contributes nothing.\n* - Later contributors win on `(namespace, key)` collisions.\n* - The returned object is fresh — neither `base` nor any contributor is mutated.\n* - Output keys are sorted lexicographically at every plain-object level.\n*/\nfunction mergeCapabilityMatrices(base, contributors) {\n\tconst merged = extractCapabilityMatrix(base);\n\tfor (const contributor of contributors) {\n\t\tconst extracted = extractCapabilityMatrix(contributor.capabilities);\n\t\tfor (const [namespace, capabilities] of Object.entries(extracted)) merged[namespace] = {\n\t\t\t...merged[namespace] ?? {},\n\t\t\t...capabilities\n\t\t};\n\t}\n\treturn blindCast(sortDeep(merged));\n}\n//#endregion\nexport { isNoInputAggregateDescriptor as a, isAnyInputAggregateDescriptor as i, aggregateDescriptorKey as n, isAggregateDescriptor as r, mergeCapabilityMatrices as t };\n\n//# sourceMappingURL=capabilities-BCEONw9w.mjs.map"],"mappings":";;;;;;AAMA,SAAS,uBAAuB,YAAY;CAC3C,QAAQ,WAAW,MAAM,MAAzB;EACC,KAAK,QAAQ,OAAO,GAAG,WAAW,UAAU;EAC5C,KAAK,OAAO,OAAO,GAAG,WAAW,UAAU;EAC3C,KAAK,SAAS,OAAO,GAAG,WAAW,UAAU,SAAS,WAAW,MAAM;EACvE,KAAK,SAAS,OAAO,GAAG,WAAW,UAAU,SAAS,WAAW,MAAM;CACxE;AACD;;AAEA,SAAS,6BAA6B,YAAY;CACjD,OAAO,WAAW,MAAM,SAAS;AAClC;;AAEA,SAAS,8BAA8B,YAAY;CAClD,OAAO,WAAW,MAAM,SAAS;AAClC;AACA,SAAS,aAAa,OAAO;CAC5B,OAAO,OAAO,UAAU,YAAY,UAAU;AAC/C;AACA,SAAS,iBAAiB,OAAO;CAChC,OAAO,OAAO,UAAU,YAAY,MAAM,SAAS;AACpD;AACA,SAAS,sBAAsB,OAAO;CACrC,IAAI,CAAC,aAAa,KAAK,KAAK,EAAE,UAAU,QAAQ,OAAO;CACvD,QAAQ,MAAM,MAAd;EACC,KAAK;EACL,KAAK,OAAO,OAAO;EACnB,KAAK,SAAS,OAAO,aAAa,SAAS,iBAAiB,MAAM,OAAO;EACzE,KAAK,SAAS,OAAO,WAAW,SAAS,aAAa,MAAM,KAAK;EACjE,SAAS,OAAO;CACjB;AACD;AACA,SAAS,uBAAuB,OAAO;CACtC,IAAI,CAAC,aA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ACvC,IAAI,CAAC,cAAc,KAAK,GAAG,OAAO,CAAC;CACnC,MAAM,MAAM,CAAC;CACb,KAAK,MAAM,CAAC,WAAW,cAAc,OAAO,QAAQ,KAAK,GAAG;EAC3D,IAAI,CAAC,cAAc,SAAS,GAAG;EAC/B,MAAM,OAAO,CAAC;EACd,KAAK,MAAM,CAAC,KAAK,SAAS,OAAO,QAAQ,SAAS,GAAG,IAAI,OAAO,SAAS,WAAW,KAAK,OAAO;EAChG,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC,SAAS,GAAG,IAAI,aAAa;CACpD;CACA,OAAO;AACR;;;;;;;;;;;;;;;;;;AAkBA,SAAS,wBAAwB,MAAM,cAAc;CACpD,MAAM,SAAS,wBAAwB,IAAI;CAC3C,KAAK,MAAM,eAAe,cAAc;EACvC,MAAM,YAAY,wBAAwB,YAAY,YAAY;EAClE,KAAK,MAAM,CAAC,WAAW,iBAAiB,OAAO,QAAQ,SAAS,GAAG,OAAO,aAAa;GACtF,GAAG,OAAO,cAAc,CAAC;GACzB,GAAG;EACJ;CACD;CACA,OAAO,UAAU,SAAS,MAAM,CAAC;AAClC"}
1
+ {"version":3,"file":"capabilities-BzwH_XMZ-CkgWaxF9.mjs","names":[],"sources":["../../../../1-framework/1-core/framework-components/dist/capabilities-BzwH_XMZ.mjs"],"sourcesContent":["import { n as isCodecTrait } from \"./codec-types-smcGzGq6.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/shared/aggregate-descriptor.ts\n/**\n* Ownership key of an `(operation, input)` pair. Two descriptors sharing a key are two contributors claiming one overload, which is a composition error.\n*/\nfunction aggregateDescriptorKey(descriptor) {\n\tswitch (descriptor.input.kind) {\n\t\tcase \"none\": return `${descriptor.operation}:none`;\n\t\tcase \"any\": return `${descriptor.operation}:any`;\n\t\tcase \"codec\": return `${descriptor.operation}:codec:${descriptor.input.codecId}`;\n\t\tcase \"trait\": return `${descriptor.operation}:trait:${descriptor.input.trait}`;\n\t}\n}\n/** Whether `descriptor` is the overload of an operation that consumes no value — the case whose result always names a codec outright. */\nfunction isNoInputAggregateDescriptor(descriptor) {\n\treturn descriptor.input.kind === \"none\";\n}\n/** Whether `descriptor` answers regardless of input — the fallback rung of resolution. */\nfunction isAnyInputAggregateDescriptor(descriptor) {\n\treturn descriptor.input.kind === \"any\";\n}\nfunction isObjectLike(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction isNonEmptyString(value) {\n\treturn typeof value === \"string\" && value.length > 0;\n}\nfunction isAggregateInputMatch(value) {\n\tif (!isObjectLike(value) || !(\"kind\" in value)) return false;\n\tswitch (value.kind) {\n\t\tcase \"none\":\n\t\tcase \"any\": return true;\n\t\tcase \"codec\": return \"codecId\" in value && isNonEmptyString(value.codecId);\n\t\tcase \"trait\": return \"trait\" in value && isCodecTrait(value.trait);\n\t\tdefault: return false;\n\t}\n}\nfunction isAggregateOutputCodec(value) {\n\tif (!isObjectLike(value) || !(\"kind\" in value)) return false;\n\tswitch (value.kind) {\n\t\tcase \"self\": return true;\n\t\tcase \"codec\": return \"codecId\" in value && isNonEmptyString(value.codecId) && (!(\"typeParams\" in value) || value.typeParams === void 0 || typeof value.typeParams === \"function\");\n\t\tdefault: return false;\n\t}\n}\n/**\n* Structural validation of a contributed descriptor. Components assembled from JavaScript reach the contribution slot unchecked, so composition validates the shape once and every later read is a plain lookup.\n*/\nfunction isAggregateDescriptor(value) {\n\tif (!isObjectLike(value)) return false;\n\tif (!(\"operation\" in value) || !isNonEmptyString(value.operation)) return false;\n\tif (!(\"nullable\" in value) || typeof value.nullable !== \"boolean\") return false;\n\tif (value.nullable === false && (!(\"emptyResultJson\" in value) || value.emptyResultJson === void 0)) return false;\n\tif (!(\"input\" in value) || !isAggregateInputMatch(value.input)) return false;\n\tif (!(\"output\" in value) || !isAggregateOutputCodec(value.output)) return false;\n\treturn value.input.kind === \"codec\" || value.input.kind === \"trait\" || value.output.kind === \"codec\";\n}\n//#endregion\n//#region src/shared/capabilities.ts\n/**\n* Capability matrix merge primitive shared by emit-time and runtime stack composition.\n*\n* The CLI's `enrichContract` and the SQL runtime's `createExecutionContext` both need\n* to fold a stack of component descriptors' `capabilities` declarations into a single\n* matrix keyed by namespace. Keeping the primitive here lets both call sites stay\n* byte-for-byte consistent without one depending on the other.\n*/\nfunction isPlainObject(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction sortDeep(value) {\n\tif (Array.isArray(value)) return value.map(sortDeep);\n\tif (!isPlainObject(value)) return value;\n\tconst entries = Object.entries(value).sort(([a], [b]) => a.localeCompare(b));\n\tconst next = {};\n\tfor (const [key, child] of entries) next[key] = sortDeep(child);\n\treturn next;\n}\nfunction extractCapabilityMatrix(value) {\n\tif (!isPlainObject(value)) return {};\n\tconst out = {};\n\tfor (const [namespace, maybeCaps] of Object.entries(value)) {\n\t\tif (!isPlainObject(maybeCaps)) continue;\n\t\tconst caps = {};\n\t\tfor (const [key, flag] of Object.entries(maybeCaps)) if (typeof flag === \"boolean\") caps[key] = flag;\n\t\tif (Object.keys(caps).length > 0) out[namespace] = caps;\n\t}\n\treturn out;\n}\n/**\n* Merge an ordered list of contributor capability declarations into a base matrix.\n*\n* Behaviour:\n* - `base` and each contributor's `capabilities` are filtered through the same\n* structural extraction: non-plain-object namespace blocks are dropped,\n* non-boolean leaves inside a namespace block are dropped, and a namespace\n* block that ends up with zero boolean leaves is omitted entirely (so a\n* later contributor with a malformed namespace cannot erase a namespace\n* already present in `base`).\n* - Non-plain-object `capabilities` on a contributor (including `undefined`,\n* `null`, arrays, primitives) are skipped silently — the contributor\n* contributes nothing.\n* - Later contributors win on `(namespace, key)` collisions.\n* - The returned object is fresh — neither `base` nor any contributor is mutated.\n* - Output keys are sorted lexicographically at every plain-object level.\n*/\nfunction mergeCapabilityMatrices(base, contributors) {\n\tconst merged = extractCapabilityMatrix(base);\n\tfor (const contributor of contributors) {\n\t\tconst extracted = extractCapabilityMatrix(contributor.capabilities);\n\t\tfor (const [namespace, capabilities] of Object.entries(extracted)) merged[namespace] = {\n\t\t\t...merged[namespace] ?? {},\n\t\t\t...capabilities\n\t\t};\n\t}\n\treturn blindCast(sortDeep(merged));\n}\n//#endregion\nexport { isNoInputAggregateDescriptor as a, isAnyInputAggregateDescriptor as i, aggregateDescriptorKey as n, isAggregateDescriptor as r, mergeCapabilityMatrices as t };\n\n//# sourceMappingURL=capabilities-BzwH_XMZ.mjs.map"],"mappings":";;;;;;AAMA,SAAS,uBAAuB,YAAY;CAC3C,QAAQ,WAAW,MAAM,MAAzB;EACC,KAAK,QAAQ,OAAO,GAAG,WAAW,UAAU;EAC5C,KAAK,OAAO,OAAO,GAAG,WAAW,UAAU;EAC3C,KAAK,SAAS,OAAO,GAAG,WAAW,UAAU,SAAS,WAAW,MAAM;EACvE,KAAK,SAAS,OAAO,GAAG,WAAW,UAAU,SAAS,WAAW,MAAM;CACxE;AACD;;AAEA,SAAS,6BAA6B,YAAY;CACjD,OAAO,WAAW,MAAM,SAAS;AAClC;;AAEA,SAAS,8BAA8B,YAAY;CAClD,OAAO,WAAW,MAAM,SAAS;AAClC;AACA,SAAS,aAAa,OAAO;CAC5B,OAAO,OAAO,UAAU,YAAY,UAAU;AAC/C;AACA,SAAS,iBAAiB,OAAO;CAChC,OAAO,OAAO,UAAU,YAAY,MAAM,SAAS;AACpD;AACA,SAAS,sBAAsB,OAAO;CACrC,IAAI,CAAC,aAAa,KAAK,KAAK,EAAE,UAAU,QAAQ,OAAO;CACvD,QAAQ,MAAM,MAAd;EACC,KAAK;EACL,KAAK,OAAO,OAAO;EACnB,KAAK,SAAS,OAAO,aAAa,SAAS,iBAAiB,MAAM,OAAO;EACzE,KAAK,SAAS,OAAO,WAAW,SAAS,aAAa,MAAM,KAAK;EACjE,SAAS,OAAO;CACjB;AACD;AACA,SAAS,uBAAuB,OAAO;CACtC,IAAI,CAAC,aAAa,KAAK,KAAK,EAAE,UAAU,QAAQ,OAAO;CACvD,QAAQ,MAAM,MAAd;EACC,KAAK,QAAQ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AAM,CAAC,WAAW,cAAc,OAAO,QAAQ,KAAK,GAAG;EAC3D,IAAI,CAAC,cAAc,SAAS,GAAG;EAC/B,MAAM,OAAO,CAAC;EACd,KAAK,MAAM,CAAC,KAAK,SAAS,OAAO,QAAQ,SAAS,GAAG,IAAI,OAAO,SAAS,WAAW,KAAK,OAAO;EAChG,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC,SAAS,GAAG,IAAI,aAAa;CACpD;CACA,OAAO;AACR;;;;;;;;;;;;;;;;;;AAkBA,SAAS,wBAAwB,MAAM,cAAc;CACpD,MAAM,SAAS,wBAAwB,IAAI;CAC3C,KAAK,MAAM,eAAe,cAAc;EACvC,MAAM,YAAY,wBAAwB,YAAY,YAAY;EAClE,KAAK,MAAM,CAAC,WAAW,iBAAiB,OAAO,QAAQ,SAAS,GAAG,OAAO,aAAa;GACtF,GAAG,OAAO,cAAc,CAAC;GACzB,GAAG;EACJ;CACD;CACA,OAAO,UAAU,SAAS,MAAM,CAAC;AAClC"}
@@ -1,4 +1,4 @@
1
- import { r as voidParamsSchema } from "./codec-types-DcNvNeY1-BO6kUiH0.mjs";
1
+ import { r as voidParamsSchema } from "./codec-types-smcGzGq6-BohNffPc.mjs";
2
2
  import { i as tsStringLiteral } from "./dist-DUlexZHp.mjs";
3
3
  //#region ../../../1-framework/1-core/framework-components/dist/codec.mjs
4
4
  /**
@@ -60,4 +60,4 @@ function renderTsLiteral(value) {
60
60
  //#endregion
61
61
  export { renderTsLiteral as i, CodecImpl as n, column as r, CodecDescriptorImpl as t };
62
62
 
63
- //# sourceMappingURL=codec-G-sce0J8.mjs.map
63
+ //# sourceMappingURL=codec-DWYH-Ra4.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"codec-G-sce0J8.mjs","names":[],"sources":["../../../../1-framework/1-core/framework-components/dist/codec.mjs"],"sourcesContent":["import { r as voidParamsSchema, t as emptyCodecLookup } from \"./codec-types-DcNvNeY1.mjs\";\nimport { i as validateCodecTypeParams, n as materializeCodec, r as resolveCodecDescriptorOrThrow, t as CONTRACT_CODEC_DESCRIPTOR_MISSING } from \"./resolve-codec-BLRGmP1f.mjs\";\nimport { tsStringLiteral } from \"@internal/ts-render\";\n//#region src/shared/codec.ts\n/**\n* Abstract base class for concrete codec implementations.\n*\n* Codec authors extend this class with their typed `Id`, `TTraits`, `TWire`, `TInput` and override all four abstract conversion methods: `encode`, `decode`, `encodeJson`, and `decodeJson`. The runtime instance carries only its `id` (proxied through the descriptor so alias subclasses inherit the descriptor's id automatically) and the conversion methods — static metadata lives on the {@link CodecDescriptor}.\n*/\nvar CodecImpl = class {\n\tdescriptor;\n\t/**\n\t* Variance-erased descriptor reference. Concrete codec subclasses receive the typed descriptor in their own constructors and forward it via `super(descriptor)`; the variance erasure lives at this base because the abstract surface can't carry the concrete `TParams`.\n\t*/\n\tconstructor(descriptor) {\n\t\tthis.descriptor = descriptor;\n\t}\n\tget id() {\n\t\treturn this.descriptor.codecId;\n\t}\n};\n//#endregion\n//#region src/shared/codec-descriptor.ts\n/**\n* Abstract base class for concrete codec descriptors.\n*\n* Codec authors extend this class with their typed `TParams` and declare `codecId`, `traits`, `targetTypes`, `paramsSchema`, the curried `factory(params)`, and (optionally) `renderOutputType`.\n*\n* Implements the {@link CodecDescriptor} interface so a concrete subclass instance is directly usable wherever the framework expects a `CodecDescriptor<P>`.\n*/\nvar CodecDescriptorImpl = class {\n\t/** Boolean derived from `paramsSchema`: `true` whenever the schema is not the singleton `voidParamsSchema`. */\n\tget isParameterized() {\n\t\treturn this.paramsSchema !== voidParamsSchema;\n\t}\n};\n//#endregion\n//#region src/shared/column-spec.ts\n/**\n* Trivial column packager. Per-codec helpers call this directly with the result of `descriptor.factory(params)` — direct method invocation binds the descriptor's method-level generic at the call site and the literal flows through `R`.\n*\n* `nativeType` is the column's database-native type spelling — the value the postgres adapter's migration planner, the SQL renderer's cast policy, and the emitted contract's column `nativeType` slot read. Per-codec helpers pass the literal native-type string for their codec (e.g. `'text'`, `'int4'`, `'character varying'`); for codecs whose native-type spelling depends on parameters (none today; reserved for future shapes), the helper computes the rendered string before calling `column`. The framework does not derive the value from `codecId` — that mapping is target-specific and lives at the helper.\n*/\nfunction column(codecFactory, codecId, typeParams, nativeType) {\n\treturn {\n\t\tcodecFactory,\n\t\tcodecId,\n\t\ttypeParams,\n\t\tnativeType\n\t};\n}\n//#endregion\n//#region src/shared/render-ts-literal.ts\n/**\n* Renders a codec-encoded value as a TypeScript literal (e.g. `\"low\"`, `1`, `true`), or `undefined`\n* when the value isn't literal-expressible (objects, arrays, null).\n*\n* Valid **only for identity codecs** whose `encodeJson` output equals their decoded output type\n* (text, int, float, bool). A non-identity codec (e.g. one that encodes to an int but decodes to a\n* string literal) must NOT use this: it has to `decodeJson` first, then render, in its own\n* `renderValueLiteral`.\n*/\nfunction renderTsLiteral(value) {\n\tif (typeof value === \"string\") return tsStringLiteral(value);\n\tif (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n}\n//#endregion\nexport { CONTRACT_CODEC_DESCRIPTOR_MISSING, CodecDescriptorImpl, CodecImpl, column, emptyCodecLookup, materializeCodec, renderTsLiteral, resolveCodecDescriptorOrThrow, validateCodecTypeParams, voidParamsSchema };\n\n//# sourceMappingURL=codec.mjs.map"],"mappings":";;;;;;;;AASA,IAAI,YAAY,MAAM;CACrB;;;;CAIA,YAAY,YAAY;EACvB,KAAK,aAAa;CACnB;CACA,IAAI,KAAK;EACR,OAAO,KAAK,WAAW;CACxB;AACD;;;;;;;;AAUA,IAAI,sBAAsB,MAAM;;CAE/B,IAAI,kBAAkB;EACrB,OAAO,KAAK,iBAAiB;CAC9B;AACD;;;;;;AAQA,SAAS,OAAO,cAAc,SAAS,YAAY,YAAY;CAC9D,OAAO;EACN;EACA;EACA;EACA;CACD;AACD;;;;;;;;;;AAYA,SAAS,gBAAgB,OAAO;CAC/B,IAAI,OAAO,UAAU,UAAU,OAAO,gBAAgB,KAAK;CAC3D,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,WAAW,OAAO,OAAO,KAAK;AACjF"}
1
+ {"version":3,"file":"codec-DWYH-Ra4.mjs","names":[],"sources":["../../../../1-framework/1-core/framework-components/dist/codec.mjs"],"sourcesContent":["import { r as voidParamsSchema, t as emptyCodecLookup } from \"./codec-types-smcGzGq6.mjs\";\nimport { i as validateCodecTypeParams, n as materializeCodec, r as resolveCodecDescriptorOrThrow, t as CONTRACT_CODEC_DESCRIPTOR_MISSING } from \"./resolve-codec-BLRGmP1f.mjs\";\nimport { tsStringLiteral } from \"@internal/ts-render\";\n//#region src/shared/codec.ts\n/**\n* Abstract base class for concrete codec implementations.\n*\n* Codec authors extend this class with their typed `Id`, `TTraits`, `TWire`, `TInput` and override all four abstract conversion methods: `encode`, `decode`, `encodeJson`, and `decodeJson`. The runtime instance carries only its `id` (proxied through the descriptor so alias subclasses inherit the descriptor's id automatically) and the conversion methods — static metadata lives on the {@link CodecDescriptor}.\n*/\nvar CodecImpl = class {\n\tdescriptor;\n\t/**\n\t* Variance-erased descriptor reference. Concrete codec subclasses receive the typed descriptor in their own constructors and forward it via `super(descriptor)`; the variance erasure lives at this base because the abstract surface can't carry the concrete `TParams`.\n\t*/\n\tconstructor(descriptor) {\n\t\tthis.descriptor = descriptor;\n\t}\n\tget id() {\n\t\treturn this.descriptor.codecId;\n\t}\n};\n//#endregion\n//#region src/shared/codec-descriptor.ts\n/**\n* Abstract base class for concrete codec descriptors.\n*\n* Codec authors extend this class with their typed `TParams` and declare `codecId`, `traits`, `targetTypes`, `paramsSchema`, the curried `factory(params)`, and (optionally) `renderOutputType`.\n*\n* Implements the {@link CodecDescriptor} interface so a concrete subclass instance is directly usable wherever the framework expects a `CodecDescriptor<P>`.\n*/\nvar CodecDescriptorImpl = class {\n\t/** Boolean derived from `paramsSchema`: `true` whenever the schema is not the singleton `voidParamsSchema`. */\n\tget isParameterized() {\n\t\treturn this.paramsSchema !== voidParamsSchema;\n\t}\n};\n//#endregion\n//#region src/shared/column-spec.ts\n/**\n* Trivial column packager. Per-codec helpers call this directly with the result of `descriptor.factory(params)` — direct method invocation binds the descriptor's method-level generic at the call site and the literal flows through `R`.\n*\n* `nativeType` is the column's database-native type spelling — the value the postgres adapter's migration planner, the SQL renderer's cast policy, and the emitted contract's column `nativeType` slot read. Per-codec helpers pass the literal native-type string for their codec (e.g. `'text'`, `'int4'`, `'character varying'`); for codecs whose native-type spelling depends on parameters (none today; reserved for future shapes), the helper computes the rendered string before calling `column`. The framework does not derive the value from `codecId` — that mapping is target-specific and lives at the helper.\n*/\nfunction column(codecFactory, codecId, typeParams, nativeType) {\n\treturn {\n\t\tcodecFactory,\n\t\tcodecId,\n\t\ttypeParams,\n\t\tnativeType\n\t};\n}\n//#endregion\n//#region src/shared/render-ts-literal.ts\n/**\n* Renders a codec-encoded value as a TypeScript literal (e.g. `\"low\"`, `1`, `true`), or `undefined`\n* when the value isn't literal-expressible (objects, arrays, null).\n*\n* Valid **only for identity codecs** whose `encodeJson` output equals their decoded output type\n* (text, int, float, bool). A non-identity codec (e.g. one that encodes to an int but decodes to a\n* string literal) must NOT use this: it has to `decodeJson` first, then render, in its own\n* `renderValueLiteral`.\n*/\nfunction renderTsLiteral(value) {\n\tif (typeof value === \"string\") return tsStringLiteral(value);\n\tif (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n}\n//#endregion\nexport { CONTRACT_CODEC_DESCRIPTOR_MISSING, CodecDescriptorImpl, CodecImpl, column, emptyCodecLookup, materializeCodec, renderTsLiteral, resolveCodecDescriptorOrThrow, validateCodecTypeParams, voidParamsSchema };\n\n//# sourceMappingURL=codec.mjs.map"],"mappings":";;;;;;;;AASA,IAAI,YAAY,MAAM;CACrB;;;;CAIA,YAAY,YAAY;EACvB,KAAK,aAAa;CACnB;CACA,IAAI,KAAK;EACR,OAAO,KAAK,WAAW;CACxB;AACD;;;;;;;;AAUA,IAAI,sBAAsB,MAAM;;CAE/B,IAAI,kBAAkB;EACrB,OAAO,KAAK,iBAAiB;CAC9B;AACD;;;;;;AAQA,SAAS,OAAO,cAAc,SAAS,YAAY,YAAY;CAC9D,OAAO;EACN;EACA;EACA;EACA;CACD;AACD;;;;;;;;;;AAYA,SAAS,gBAAgB,OAAO;CAC/B,IAAI,OAAO,UAAU,UAAU,OAAO,gBAAgB,KAAK;CAC3D,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,WAAW,OAAO,OAAO,KAAK;AACjF"}
@@ -1,4 +1,4 @@
1
- //#region ../../../1-framework/1-core/framework-components/dist/codec-types-DcNvNeY1.mjs
1
+ //#region ../../../1-framework/1-core/framework-components/dist/codec-types-smcGzGq6.mjs
2
2
  /** Every semantic trait a codec may advertise. The runtime tuple backs validation of trait-keyed contributions arriving from JavaScript. */
3
3
  const CODEC_TRAITS = [
4
4
  "equality",
@@ -21,10 +21,10 @@ const emptyCodecLookup = {
21
21
  */
22
22
  const voidParamsSchema = { "~standard": {
23
23
  version: 1,
24
- vendor: "prisma-next",
24
+ vendor: "prisma",
25
25
  validate: (input) => input === void 0 ? { value: void 0 } : { issues: [{ message: "unexpected typeParams for non-parameterized codec (void params expected)" }] }
26
26
  } };
27
27
  //#endregion
28
28
  export { isCodecTrait as n, voidParamsSchema as r, emptyCodecLookup as t };
29
29
 
30
- //# sourceMappingURL=codec-types-DcNvNeY1-BO6kUiH0.mjs.map
30
+ //# sourceMappingURL=codec-types-smcGzGq6-BohNffPc.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"codec-types-DcNvNeY1-BO6kUiH0.mjs","names":[],"sources":["../../../../1-framework/1-core/framework-components/dist/codec-types-DcNvNeY1.mjs"],"sourcesContent":["//#region src/shared/codec-types.ts\n/** Every semantic trait a codec may advertise. The runtime tuple backs validation of trait-keyed contributions arriving from JavaScript. */\nconst CODEC_TRAITS = [\n\t\"equality\",\n\t\"order\",\n\t\"boolean\",\n\t\"numeric\",\n\t\"textual\"\n];\n/** Whether `value` names one of the {@link CODEC_TRAITS}. */\nfunction isCodecTrait(value) {\n\treturn CODEC_TRAITS.some((trait) => trait === value);\n}\nconst emptyCodecLookup = {\n\tget: () => void 0,\n\ttargetTypesFor: () => void 0,\n\trenderOutputTypeFor: () => void 0\n};\n/**\n* Standard Schema validator for `void` params. Accepts only `undefined` (or absent input); rejects any other value so a contract that tries to thread `typeParams` through a non-parameterized codec id fails fast at the JSON boundary instead of silently coercing the value away. Used by the framework-supplied non-parameterized descriptor synthesizer.\n*/\nconst voidParamsSchema = { \"~standard\": {\n\tversion: 1,\n\tvendor: \"prisma-next\",\n\tvalidate: (input) => input === void 0 ? { value: void 0 } : { issues: [{ message: \"unexpected typeParams for non-parameterized codec (void params expected)\" }] }\n} };\n//#endregion\nexport { isCodecTrait as n, voidParamsSchema as r, emptyCodecLookup as t };\n\n//# sourceMappingURL=codec-types-DcNvNeY1.mjs.map"],"mappings":";;AAEA,MAAM,eAAe;CACpB;CACA;CACA;CACA;CACA;AACD;;AAEA,SAAS,aAAa,OAAO;CAC5B,OAAO,aAAa,MAAM,UAAU,UAAU,KAAK;AACpD;AACA,MAAM,mBAAmB;CACxB,WAAW,KAAK;CAChB,sBAAsB,KAAK;CAC3B,2BAA2B,KAAK;AACjC;;;;AAIA,MAAM,mBAAmB,EAAE,aAAa;CACvC,SAAS;CACT,QAAQ;CACR,WAAW,UAAU,UAAU,KAAK,IAAI,EAAE,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,SAAS,2EAA2E,CAAC,EAAE;AACjK,EAAE"}
1
+ {"version":3,"file":"codec-types-smcGzGq6-BohNffPc.mjs","names":[],"sources":["../../../../1-framework/1-core/framework-components/dist/codec-types-smcGzGq6.mjs"],"sourcesContent":["//#region src/shared/codec-types.ts\n/** Every semantic trait a codec may advertise. The runtime tuple backs validation of trait-keyed contributions arriving from JavaScript. */\nconst CODEC_TRAITS = [\n\t\"equality\",\n\t\"order\",\n\t\"boolean\",\n\t\"numeric\",\n\t\"textual\"\n];\n/** Whether `value` names one of the {@link CODEC_TRAITS}. */\nfunction isCodecTrait(value) {\n\treturn CODEC_TRAITS.some((trait) => trait === value);\n}\nconst emptyCodecLookup = {\n\tget: () => void 0,\n\ttargetTypesFor: () => void 0,\n\trenderOutputTypeFor: () => void 0\n};\n/**\n* Standard Schema validator for `void` params. Accepts only `undefined` (or absent input); rejects any other value so a contract that tries to thread `typeParams` through a non-parameterized codec id fails fast at the JSON boundary instead of silently coercing the value away. Used by the framework-supplied non-parameterized descriptor synthesizer.\n*/\nconst voidParamsSchema = { \"~standard\": {\n\tversion: 1,\n\tvendor: \"prisma\",\n\tvalidate: (input) => input === void 0 ? { value: void 0 } : { issues: [{ message: \"unexpected typeParams for non-parameterized codec (void params expected)\" }] }\n} };\n//#endregion\nexport { isCodecTrait as n, voidParamsSchema as r, emptyCodecLookup as t };\n\n//# sourceMappingURL=codec-types-smcGzGq6.mjs.map"],"mappings":";;AAEA,MAAM,eAAe;CACpB;CACA;CACA;CACA;CACA;AACD;;AAEA,SAAS,aAAa,OAAO;CAC5B,OAAO,aAAa,MAAM,UAAU,UAAU,KAAK;AACpD;AACA,MAAM,mBAAmB;CACxB,WAAW,KAAK;CAChB,sBAAsB,KAAK;CAC3B,2BAA2B,KAAK;AACjC;;;;AAIA,MAAM,mBAAmB,EAAE,aAAa;CACvC,SAAS;CACT,QAAQ;CACR,WAAW,UAAU,UAAU,KAAK,IAAI,EAAE,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,SAAS,2EAA2E,CAAC,EAAE;AACjK,EAAE"}
@@ -1,4 +1,4 @@
1
- import { t as aggregateDescriptorKey } from "./capabilities-BCEONw9w-C-lo3rF8.mjs";
1
+ import { t as aggregateDescriptorKey } from "./capabilities-BzwH_XMZ-CkgWaxF9.mjs";
2
2
  //#region ../../../1-framework/1-core/framework-components/dist/components.mjs
3
3
  /**
4
4
  * Settle every contributed overload against `codecs`.
@@ -85,4 +85,4 @@ function settleAggregateOverloads(descriptors, codecs) {
85
85
  //#endregion
86
86
  export { settleAggregateOverloads as t };
87
87
 
88
- //# sourceMappingURL=components-dZRz3T5y.mjs.map
88
+ //# sourceMappingURL=components-CnV-6irM.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"components-dZRz3T5y.mjs","names":[],"sources":["../../../../1-framework/1-core/framework-components/dist/components.mjs"],"sourcesContent":["import { a as isNoInputAggregateDescriptor, i as isAnyInputAggregateDescriptor, n as aggregateDescriptorKey, r as isAggregateDescriptor, t as mergeCapabilityMatrices } from \"./capabilities-BCEONw9w.mjs\";\nimport { t as checkContractComponentRequirements } from \"./framework-components-D6j4Y5K7.mjs\";\n//#region src/shared/aggregate-overloads.ts\n/**\n* Settle every contributed overload against `codecs`.\n*\n* Exact codec overloads win over trait overloads, and trait overloads are expanded only over the codecs given — so a caller that passes the codecs a stack actually composes cannot end up with a row for one it does not. An exact overload survives even for a codec outside that set, because naming a codec id is a claim that stands on its own.\n*\n* The input-agnostic overload is left unexpanded: it answers whatever the other two rungs do not, so materializing it per codec would say the same thing once per codec.\n*\n* A second claim on one `(operation, input)` key is reported as a duplicate and does not unseat the first; both production callers reject duplicates before settling, so the report guards a consumer that calls this directly.\n*/\nfunction settleAggregateOverloads(descriptors, codecs) {\n\tconst byOperation = /* @__PURE__ */ new Map();\n\tconst firstClaims = /* @__PURE__ */ new Map();\n\tconst duplicates = [];\n\tfor (const descriptor of descriptors) {\n\t\tconst key = aggregateDescriptorKey(descriptor);\n\t\tconst first = firstClaims.get(key);\n\t\tif (first !== void 0) {\n\t\t\tduplicates.push({\n\t\t\t\toperation: descriptor.operation,\n\t\t\t\tkey,\n\t\t\t\tfirst,\n\t\t\t\tsecond: descriptor\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tfirstClaims.set(key, descriptor);\n\t\tconst entry = byOperation.get(descriptor.operation) ?? {\n\t\t\texact: /* @__PURE__ */ new Map(),\n\t\t\ttraits: [],\n\t\t\tnoInput: void 0,\n\t\t\tanyInput: void 0\n\t\t};\n\t\tswitch (descriptor.input.kind) {\n\t\t\tcase \"none\":\n\t\t\t\tentry.noInput = descriptor;\n\t\t\t\tbreak;\n\t\t\tcase \"any\":\n\t\t\t\tentry.anyInput = descriptor;\n\t\t\t\tbreak;\n\t\t\tcase \"codec\":\n\t\t\t\tentry.exact.set(descriptor.input.codecId, descriptor);\n\t\t\t\tbreak;\n\t\t\tcase \"trait\":\n\t\t\t\tentry.traits.push({\n\t\t\t\t\tdescriptor,\n\t\t\t\t\ttrait: descriptor.input.trait\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t}\n\t\tbyOperation.set(descriptor.operation, entry);\n\t}\n\tconst codecList = [...codecs];\n\tconst operations = /* @__PURE__ */ new Map();\n\tconst ambiguities = [];\n\tfor (const [operation, entry] of byOperation) {\n\t\tconst byCodecId = new Map(entry.exact);\n\t\tfor (const codec of codecList) {\n\t\t\tif (byCodecId.has(codec.codecId)) continue;\n\t\t\tconst claims = entry.traits.filter((candidate) => codec.traits.includes(candidate.trait));\n\t\t\tif (claims.length > 1) {\n\t\t\t\tambiguities.push({\n\t\t\t\t\toperation,\n\t\t\t\t\tcodecId: codec.codecId,\n\t\t\t\t\ttraits: claims.map((claim) => claim.trait)\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst claim = claims[0];\n\t\t\tif (claim !== void 0) byCodecId.set(codec.codecId, claim.descriptor);\n\t\t}\n\t\toperations.set(operation, {\n\t\t\tbyCodecId,\n\t\t\tnoInput: entry.noInput,\n\t\t\tanyInput: entry.anyInput\n\t\t});\n\t}\n\treturn {\n\t\toperations,\n\t\tambiguities,\n\t\tduplicates\n\t};\n}\n//#endregion\nexport { aggregateDescriptorKey, checkContractComponentRequirements, isAggregateDescriptor, isAnyInputAggregateDescriptor, isNoInputAggregateDescriptor, mergeCapabilityMatrices, settleAggregateOverloads };\n\n//# sourceMappingURL=components.mjs.map"],"mappings":";;;;;;;;;;;AAYA,SAAS,yBAAyB,aAAa,QAAQ;CACtD,MAAM,8BAA8B,IAAI,IAAI;CAC5C,MAAM,8BAA8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AAU,IAAI,MAAM,SAAS,MAAM,UAAU;EACpE;EACA,WAAW,IAAI,WAAW;GACzB;GACA,SAAS,MAAM;GACf,UAAU,MAAM;EACjB,CAAC;CACF;CACA,OAAO;EACN;EACA;EACA;CACD;AACD"}
1
+ {"version":3,"file":"components-CnV-6irM.mjs","names":[],"sources":["../../../../1-framework/1-core/framework-components/dist/components.mjs"],"sourcesContent":["import { a as isNoInputAggregateDescriptor, i as isAnyInputAggregateDescriptor, n as aggregateDescriptorKey, r as isAggregateDescriptor, t as mergeCapabilityMatrices } from \"./capabilities-BzwH_XMZ.mjs\";\nimport { t as checkContractComponentRequirements } from \"./framework-components-D6j4Y5K7.mjs\";\n//#region src/shared/aggregate-overloads.ts\n/**\n* Settle every contributed overload against `codecs`.\n*\n* Exact codec overloads win over trait overloads, and trait overloads are expanded only over the codecs given — so a caller that passes the codecs a stack actually composes cannot end up with a row for one it does not. An exact overload survives even for a codec outside that set, because naming a codec id is a claim that stands on its own.\n*\n* The input-agnostic overload is left unexpanded: it answers whatever the other two rungs do not, so materializing it per codec would say the same thing once per codec.\n*\n* A second claim on one `(operation, input)` key is reported as a duplicate and does not unseat the first; both production callers reject duplicates before settling, so the report guards a consumer that calls this directly.\n*/\nfunction settleAggregateOverloads(descriptors, codecs) {\n\tconst byOperation = /* @__PURE__ */ new Map();\n\tconst firstClaims = /* @__PURE__ */ new Map();\n\tconst duplicates = [];\n\tfor (const descriptor of descriptors) {\n\t\tconst key = aggregateDescriptorKey(descriptor);\n\t\tconst first = firstClaims.get(key);\n\t\tif (first !== void 0) {\n\t\t\tduplicates.push({\n\t\t\t\toperation: descriptor.operation,\n\t\t\t\tkey,\n\t\t\t\tfirst,\n\t\t\t\tsecond: descriptor\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tfirstClaims.set(key, descriptor);\n\t\tconst entry = byOperation.get(descriptor.operation) ?? {\n\t\t\texact: /* @__PURE__ */ new Map(),\n\t\t\ttraits: [],\n\t\t\tnoInput: void 0,\n\t\t\tanyInput: void 0\n\t\t};\n\t\tswitch (descriptor.input.kind) {\n\t\t\tcase \"none\":\n\t\t\t\tentry.noInput = descriptor;\n\t\t\t\tbreak;\n\t\t\tcase \"any\":\n\t\t\t\tentry.anyInput = descriptor;\n\t\t\t\tbreak;\n\t\t\tcase \"codec\":\n\t\t\t\tentry.exact.set(descriptor.input.codecId, descriptor);\n\t\t\t\tbreak;\n\t\t\tcase \"trait\":\n\t\t\t\tentry.traits.push({\n\t\t\t\t\tdescriptor,\n\t\t\t\t\ttrait: descriptor.input.trait\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t}\n\t\tbyOperation.set(descriptor.operation, entry);\n\t}\n\tconst codecList = [...codecs];\n\tconst operations = /* @__PURE__ */ new Map();\n\tconst ambiguities = [];\n\tfor (const [operation, entry] of byOperation) {\n\t\tconst byCodecId = new Map(entry.exact);\n\t\tfor (const codec of codecList) {\n\t\t\tif (byCodecId.has(codec.codecId)) continue;\n\t\t\tconst claims = entry.traits.filter((candidate) => codec.traits.includes(candidate.trait));\n\t\t\tif (claims.length > 1) {\n\t\t\t\tambiguities.push({\n\t\t\t\t\toperation,\n\t\t\t\t\tcodecId: codec.codecId,\n\t\t\t\t\ttraits: claims.map((claim) => claim.trait)\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst claim = claims[0];\n\t\t\tif (claim !== void 0) byCodecId.set(codec.codecId, claim.descriptor);\n\t\t}\n\t\toperations.set(operation, {\n\t\t\tbyCodecId,\n\t\t\tnoInput: entry.noInput,\n\t\t\tanyInput: entry.anyInput\n\t\t});\n\t}\n\treturn {\n\t\toperations,\n\t\tambiguities,\n\t\tduplicates\n\t};\n}\n//#endregion\nexport { aggregateDescriptorKey, checkContractComponentRequirements, isAggregateDescriptor, isAnyInputAggregateDescriptor, isNoInputAggregateDescriptor, mergeCapabilityMatrices, settleAggregateOverloads };\n\n//# sourceMappingURL=components.mjs.map"],"mappings":";;;;;;;;;;;AAYA,SA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AC1C,CAAC;IACD;GACD;GACA,MAAM,QAAQ,OAAO;GACrB,IAAI,UAAU,KAAK,GAAG,UAAU,IAAI,MAAM,SAAS,MAAM,UAAU;EACpE;EACA,WAAW,IAAI,WAAW;GACzB;GACA,SAAS,MAAM;GACf,UAAU,MAAM;EACjB,CAAC;CACF;CACA,OAAO;EACN;EACA;EACA;CACD;AACD"}
@@ -1,13 +1,13 @@
1
1
  import { t as isPlainRecord } from "./is-plain-record-CUofyVQ7-DWEzdhIx.mjs";
2
2
  import { n as runtimeError, t as isRuntimeError } from "./runtime-error-BA9d7XjZ-BlT8t6LB.mjs";
3
3
  import { a as collectScalarTypeConstructors, b as resolveEnumCodecId, c as instantiateAuthoringEntityType, d as isAuthoringArgRef, f as isAuthoringEntityTypeDescriptor, g as isAuthoringTypeConstructorDescriptor, h as isAuthoringPslBlockDescriptor, l as instantiateAuthoringFieldPreset, m as isAuthoringModelAttributeDescriptor, n as assertResolvableTypeConstructorTemplates, o as flushAuthoringWarnings, p as isAuthoringFieldPresetDescriptor, r as classifyEnumMemberType, s as hasRegisteredFieldNamespace, t as assertNoCrossRegistryCollisions, u as instantiateAuthoringTypeConstructor, v as mergeAuthoringNamespaces, x as validateAuthoringHelperArguments, y as resolveAuthoringTemplateValue } from "./framework-authoring-BvxZnsPY-DlD1nwU5.mjs";
4
- import { r as voidParamsSchema, t as emptyCodecLookup } from "./codec-types-DcNvNeY1-BO6kUiH0.mjs";
4
+ import { r as voidParamsSchema, t as emptyCodecLookup } from "./codec-types-smcGzGq6-BohNffPc.mjs";
5
5
  import { i as validateCodecTypeParams, n as materializeCodec, r as resolveCodecDescriptorOrThrow, t as CONTRACT_CODEC_DESCRIPTOR_MISSING } from "./resolve-codec-BLRGmP1f-CydhIhLP.mjs";
6
- import { i as renderTsLiteral, n as CodecImpl, r as column, t as CodecDescriptorImpl } from "./codec-G-sce0J8.mjs";
7
- import { a as mergeCapabilityMatrices, i as isNoInputAggregateDescriptor, n as isAggregateDescriptor, r as isAnyInputAggregateDescriptor, t as aggregateDescriptorKey } from "./capabilities-BCEONw9w-C-lo3rF8.mjs";
6
+ import { i as renderTsLiteral, n as CodecImpl, r as column, t as CodecDescriptorImpl } from "./codec-DWYH-Ra4.mjs";
7
+ import { a as mergeCapabilityMatrices, i as isNoInputAggregateDescriptor, n as isAggregateDescriptor, r as isAnyInputAggregateDescriptor, t as aggregateDescriptorKey } from "./capabilities-BzwH_XMZ-CkgWaxF9.mjs";
8
8
  import { t as checkContractComponentRequirements } from "./framework-components-D6j4Y5K7-RW9H184y.mjs";
9
- import { t as settleAggregateOverloads } from "./components-dZRz3T5y.mjs";
10
- import { C as hasOperationPreview, D as issueOutcome, E as hasSchemaView, O as orderIssuesByDependencies, S as hasMigrations, T as hasSchemaSubjectClassifier, _ as dispositionForCategory, a as VERIFY_CODE_HASH_MISMATCH, b as extractComponentIds, c as VERIFY_CODE_TARGET_MISMATCH, d as assertUniqueCodecOwner, f as buildExtensionLoadOrder, g as diffSchemas, h as createControlStack, i as SchemaTreeNode, k as storageHashHex, l as assembleAuthoringContributions, m as contractSnapshotTypesSpecifier, n as CONTRACT_SNAPSHOTS_DIRNAME, o as VERIFY_CODE_MARKER_MISSING, p as contractSnapshotJsonSpecifier, r as SchemaDiff, s as VERIFY_CODE_SCHEMA_FAILURE, t as APP_SPACE_ID, u as assembleControlMutationDefaults, v as extractCodecLookup, w as hasPslContractInfer, x as extractQueryOperationTypeImports, y as extractCodecTypeImports } from "./control-BQNAs06v.mjs";
9
+ import { t as settleAggregateOverloads } from "./components-CnV-6irM.mjs";
10
+ import { C as hasOperationPreview, D as issueOutcome, E as hasSchemaView, O as orderIssuesByDependencies, S as hasMigrations, T as hasSchemaSubjectClassifier, _ as dispositionForCategory, a as VERIFY_CODE_HASH_MISMATCH, b as extractComponentIds, c as VERIFY_CODE_TARGET_MISMATCH, d as assertUniqueCodecOwner, f as buildExtensionLoadOrder, g as diffSchemas, h as createControlStack, i as SchemaTreeNode, k as storageHashHex, l as assembleAuthoringContributions, m as contractSnapshotTypesSpecifier, n as CONTRACT_SNAPSHOTS_DIRNAME, o as VERIFY_CODE_MARKER_MISSING, p as contractSnapshotJsonSpecifier, r as SchemaDiff, s as VERIFY_CODE_SCHEMA_FAILURE, t as APP_SPACE_ID, u as assembleControlMutationDefaults, v as extractCodecLookup, w as hasPslContractInfer, x as extractQueryOperationTypeImports, y as extractCodecTypeImports } from "./control-DR0zF1b7.mjs";
11
11
  import { n as resolveRequirementSpecifiers, t as keepInternalSpecifiers } from "./emission-CeoAV9mj.mjs";
12
12
  import { n as createExecutionStack, r as instantiateExecutionStack, t as assertRuntimeContractRequirementsSatisfied } from "./execution-BNwBzmRd.mjs";
13
13
  import { a as buildSingleNamespaceView, c as elementCoordinates, d as hydrateNamespaceEntities, f as promoteBuiltinKinds, i as buildNamespacedEntities, l as entityAt, n as NamespaceBase, o as coordinateKey, r as UNBOUND_NAMESPACE_ID, s as domainElementCoordinates, t as IRNodeBase, u as freezeNode } from "./ir-CV5d1FJ0.mjs";
@@ -1,4 +1,4 @@
1
- import { r as voidParamsSchema, t as emptyCodecLookup } from "./codec-types-DcNvNeY1-BO6kUiH0.mjs";
1
+ import { r as voidParamsSchema, t as emptyCodecLookup } from "./codec-types-smcGzGq6-BohNffPc.mjs";
2
2
  import { i as validateCodecTypeParams, n as materializeCodec, r as resolveCodecDescriptorOrThrow, t as CONTRACT_CODEC_DESCRIPTOR_MISSING } from "./resolve-codec-BLRGmP1f-CydhIhLP.mjs";
3
- import { i as renderTsLiteral, n as CodecImpl, r as column, t as CodecDescriptorImpl } from "./codec-G-sce0J8.mjs";
3
+ import { i as renderTsLiteral, n as CodecImpl, r as column, t as CodecDescriptorImpl } from "./codec-DWYH-Ra4.mjs";
4
4
  export { CONTRACT_CODEC_DESCRIPTOR_MISSING, CodecDescriptorImpl, CodecImpl, column, emptyCodecLookup, materializeCodec, renderTsLiteral, resolveCodecDescriptorOrThrow, validateCodecTypeParams, voidParamsSchema };
@@ -1,4 +1,4 @@
1
- import { a as mergeCapabilityMatrices, i as isNoInputAggregateDescriptor, n as isAggregateDescriptor, r as isAnyInputAggregateDescriptor, t as aggregateDescriptorKey } from "./capabilities-BCEONw9w-C-lo3rF8.mjs";
1
+ import { a as mergeCapabilityMatrices, i as isNoInputAggregateDescriptor, n as isAggregateDescriptor, r as isAnyInputAggregateDescriptor, t as aggregateDescriptorKey } from "./capabilities-BzwH_XMZ-CkgWaxF9.mjs";
2
2
  import { t as checkContractComponentRequirements } from "./framework-components-D6j4Y5K7-RW9H184y.mjs";
3
- import { t as settleAggregateOverloads } from "./components-dZRz3T5y.mjs";
3
+ import { t as settleAggregateOverloads } from "./components-CnV-6irM.mjs";
4
4
  export { aggregateDescriptorKey, checkContractComponentRequirements, isAggregateDescriptor, isAnyInputAggregateDescriptor, isNoInputAggregateDescriptor, mergeCapabilityMatrices, settleAggregateOverloads };
@@ -1,2 +1,2 @@
1
- import { C as hasOperationPreview, D as issueOutcome, E as hasSchemaView, O as orderIssuesByDependencies, S as hasMigrations, T as hasSchemaSubjectClassifier, _ as dispositionForCategory, a as VERIFY_CODE_HASH_MISMATCH, b as extractComponentIds, c as VERIFY_CODE_TARGET_MISMATCH, d as assertUniqueCodecOwner, f as buildExtensionLoadOrder, g as diffSchemas, h as createControlStack, i as SchemaTreeNode, k as storageHashHex, l as assembleAuthoringContributions, m as contractSnapshotTypesSpecifier, n as CONTRACT_SNAPSHOTS_DIRNAME, o as VERIFY_CODE_MARKER_MISSING, p as contractSnapshotJsonSpecifier, r as SchemaDiff, s as VERIFY_CODE_SCHEMA_FAILURE, t as APP_SPACE_ID, u as assembleControlMutationDefaults, v as extractCodecLookup, w as hasPslContractInfer, x as extractQueryOperationTypeImports, y as extractCodecTypeImports } from "./control-BQNAs06v.mjs";
1
+ import { C as hasOperationPreview, D as issueOutcome, E as hasSchemaView, O as orderIssuesByDependencies, S as hasMigrations, T as hasSchemaSubjectClassifier, _ as dispositionForCategory, a as VERIFY_CODE_HASH_MISMATCH, b as extractComponentIds, c as VERIFY_CODE_TARGET_MISMATCH, d as assertUniqueCodecOwner, f as buildExtensionLoadOrder, g as diffSchemas, h as createControlStack, i as SchemaTreeNode, k as storageHashHex, l as assembleAuthoringContributions, m as contractSnapshotTypesSpecifier, n as CONTRACT_SNAPSHOTS_DIRNAME, o as VERIFY_CODE_MARKER_MISSING, p as contractSnapshotJsonSpecifier, r as SchemaDiff, s as VERIFY_CODE_SCHEMA_FAILURE, t as APP_SPACE_ID, u as assembleControlMutationDefaults, v as extractCodecLookup, w as hasPslContractInfer, x as extractQueryOperationTypeImports, y as extractCodecTypeImports } from "./control-DR0zF1b7.mjs";
2
2
  export { APP_SPACE_ID, CONTRACT_SNAPSHOTS_DIRNAME, SchemaDiff, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_SCHEMA_FAILURE, VERIFY_CODE_TARGET_MISMATCH, assembleAuthoringContributions, assembleControlMutationDefaults, assertUniqueCodecOwner, buildExtensionLoadOrder, contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier, createControlStack, diffSchemas, dispositionForCategory, extractCodecLookup, extractCodecTypeImports, extractComponentIds, extractQueryOperationTypeImports, hasMigrations, hasOperationPreview, hasPslContractInfer, hasSchemaSubjectClassifier, hasSchemaView, issueOutcome, orderIssuesByDependencies, storageHashHex };
@@ -3,7 +3,7 @@ import { t as InternalError } from "./internal-error-ChGYPVpq-DhUD05u0.mjs";
3
3
  import { n as runtimeError } from "./runtime-error-BA9d7XjZ-BlT8t6LB.mjs";
4
4
  import { _ as mergeAuthoringAttributeSpecs, a as collectScalarTypeConstructors, i as collectContributedDescriptorPaths, n as assertResolvableTypeConstructorTemplates, t as assertNoCrossRegistryCollisions, v as mergeAuthoringNamespaces } from "./framework-authoring-BvxZnsPY-DlD1nwU5.mjs";
5
5
  import { n as materializeCodec, r as resolveCodecDescriptorOrThrow, t as CONTRACT_CODEC_DESCRIPTOR_MISSING } from "./resolve-codec-BLRGmP1f-CydhIhLP.mjs";
6
- import { a as mergeCapabilityMatrices, n as isAggregateDescriptor, t as aggregateDescriptorKey } from "./capabilities-BCEONw9w-C-lo3rF8.mjs";
6
+ import { a as mergeCapabilityMatrices, n as isAggregateDescriptor, t as aggregateDescriptorKey } from "./capabilities-BzwH_XMZ-CkgWaxF9.mjs";
7
7
  //#region ../../../1-framework/1-core/framework-components/dist/control.mjs
8
8
  const CONTRACT_SNAPSHOTS_DIRNAME = "snapshots";
9
9
  const STORAGE_HASH_PATTERN = /^[0-9a-f]{64}$/;
@@ -664,4 +664,4 @@ function dispositionForCategory(controlPolicy, category) {
664
664
  //#endregion
665
665
  export { hasOperationPreview as C, issueOutcome as D, hasSchemaView as E, orderIssuesByDependencies as O, hasMigrations as S, hasSchemaSubjectClassifier as T, dispositionForCategory as _, VERIFY_CODE_HASH_MISMATCH as a, extractComponentIds as b, VERIFY_CODE_TARGET_MISMATCH as c, assertUniqueCodecOwner as d, buildExtensionLoadOrder as f, diffSchemas as g, createControlStack as h, SchemaTreeNode as i, storageHashHex as k, assembleAuthoringContributions as l, contractSnapshotTypesSpecifier as m, CONTRACT_SNAPSHOTS_DIRNAME as n, VERIFY_CODE_MARKER_MISSING as o, contractSnapshotJsonSpecifier as p, SchemaDiff as r, VERIFY_CODE_SCHEMA_FAILURE as s, APP_SPACE_ID as t, assembleControlMutationDefaults as u, extractCodecLookup as v, hasPslContractInfer as w, extractQueryOperationTypeImports as x, extractCodecTypeImports as y };
666
666
 
667
- //# sourceMappingURL=control-BQNAs06v.mjs.map
667
+ //# sourceMappingURL=control-DR0zF1b7.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-BQNAs06v.mjs","names":[],"sources":["../../../../1-framework/1-core/framework-components/dist/control.mjs"],"sourcesContent":["import { n as runtimeError } from \"./runtime-error-BA9d7XjZ.mjs\";\nimport { n as materializeCodec, r as resolveCodecDescriptorOrThrow, t as CONTRACT_CODEC_DESCRIPTOR_MISSING } from \"./resolve-codec-BLRGmP1f.mjs\";\nimport { n as aggregateDescriptorKey, r as isAggregateDescriptor, t as mergeCapabilityMatrices } from \"./capabilities-BCEONw9w.mjs\";\nimport { _ as mergeAuthoringAttributeSpecs, a as collectScalarTypeConstructors, i as collectContributedDescriptorPaths, n as assertResolvableTypeConstructorTemplates, t as assertNoCrossRegistryCollisions, v as mergeAuthoringNamespaces } from \"./framework-authoring-BvxZnsPY.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/control/contract-snapshot-layout.ts\nconst CONTRACT_SNAPSHOTS_DIRNAME = \"snapshots\";\nconst STORAGE_HASH_PATTERN = /^[0-9a-f]{64}$/;\n/** Validate a storage hash for use as a directory name. */\nfunction storageHashHex(storageHash) {\n\tif (!STORAGE_HASH_PATTERN.test(storageHash)) throw new InternalError(`Invalid storage hash \"${storageHash}\": expected 64 lowercase hex characters`);\n\treturn storageHash;\n}\n/** Module specifier for the store's `contract.json`, POSIX separators. */\nfunction contractSnapshotJsonSpecifier(snapshotsImportPath, storageHash) {\n\treturn `${snapshotsImportPath}/${storageHashHex(storageHash)}/contract.json`;\n}\n/** Type-only module specifier for the store's `contract.d.ts` (no extension). */\nfunction contractSnapshotTypesSpecifier(snapshotsImportPath, storageHash) {\n\treturn `${snapshotsImportPath}/${storageHashHex(storageHash)}/contract`;\n}\n//#endregion\n//#region src/control/control-capabilities.ts\nfunction hasMigrations(target) {\n\treturn \"migrations\" in target && !!target[\"migrations\"];\n}\nfunction hasSchemaView(instance) {\n\treturn \"toSchemaView\" in instance && typeof instance[\"toSchemaView\"] === \"function\";\n}\nfunction hasPslContractInfer(instance) {\n\treturn \"inferPslContract\" in instance && typeof instance[\"inferPslContract\"] === \"function\";\n}\nfunction hasOperationPreview(instance) {\n\treturn \"toOperationPreview\" in instance && typeof instance[\"toOperationPreview\"] === \"function\";\n}\nfunction hasSchemaSubjectClassifier(instance) {\n\treturn \"classifySubjectGranularity\" in instance && typeof instance[\"classifySubjectGranularity\"] === \"function\" && \"classifyEntityKind\" in instance && typeof instance[\"classifyEntityKind\"] === \"function\";\n}\n//#endregion\n//#region src/control/control-operation-results.ts\nconst VERIFY_CODE_MARKER_MISSING = \"CONTRACT.MARKER_MISSING\";\nconst VERIFY_CODE_HASH_MISMATCH = \"CONTRACT.MARKER_MISMATCH\";\nconst VERIFY_CODE_TARGET_MISMATCH = \"CONTRACT.TARGET_MISMATCH\";\nconst VERIFY_CODE_SCHEMA_FAILURE = \"CONTRACT.SCHEMA_VERIFICATION_FAILED\";\n//#endregion\n//#region src/control/control-schema-view.ts\nvar SchemaTreeNode = class {\n\tkind;\n\tid;\n\tlabel;\n\tmeta;\n\tchildren;\n\tconstructor(options) {\n\t\tthis.kind = options.kind;\n\t\tthis.id = options.id;\n\t\tthis.label = options.label;\n\t\tif (options.meta !== void 0) this.meta = options.meta;\n\t\tif (options.children !== void 0) this.children = options.children;\n\t\tObject.freeze(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.visit(this);\n\t}\n};\n//#endregion\n//#region src/control/control-spaces.ts\n/**\n* Canonical control-plane identifiers for contract spaces.\n*\n* A contract space is the disjoint `(contract.json, migration-graph)` unit\n* the per-space planner / runner / verifier (project: extension contract\n* spaces, TML-2397) operates on. The application owns one well-known\n* space — the value below — and each loaded extension that contributes\n* schema owns a uniquely-named space.\n*\n* Lives in `framework-components/control` so every layer that has to\n* reason about space identity (the migration tooling, the SQL runtime's\n* marker reader, target-side statement builders, target-side adapters)\n* can import a single value rather than duplicating the literal. Raw\n* `'app'` string literals in framework / target / runtime / adapter\n* source code are forbidden and policed by\n* `scripts/lint-app-space-id.mjs` (wired into `pnpm lint:deps`).\n*\n* @see specs/framework-mechanism.spec.md § 3 — Layout convention (γ).\n*/\nconst APP_SPACE_ID = \"app\";\n//#endregion\n//#region src/control/control-stack.ts\nfunction addUniqueId(ids, seen, id) {\n\tif (!seen.has(id)) {\n\t\tids.push(id);\n\t\tseen.add(id);\n\t}\n}\nfunction assertUniqueCodecOwner(options) {\n\tconst existingOwner = options.owners.get(options.codecId);\n\tif (existingOwner !== void 0) throw new InternalError(`Duplicate ${options.entityLabel} for codecId \"${options.codecId}\". Descriptor \"${options.descriptorId}\" conflicts with \"${existingOwner}\". Each codecId can only have one ${options.entityOwnershipLabel}.`);\n}\nfunction extractCodecTypeImports(descriptors) {\n\tconst imports = [];\n\tfor (const descriptor of descriptors) {\n\t\tconst codecTypes = descriptor.types?.codecTypes;\n\t\tif (codecTypes?.import) imports.push(codecTypes.import);\n\t\tif (codecTypes?.typeImports) imports.push(...codecTypes.typeImports);\n\t}\n\treturn imports;\n}\nfunction extractQueryOperationTypeImports(descriptors) {\n\tconst imports = [];\n\tfor (const descriptor of descriptors) {\n\t\tconst queryOperationTypes = descriptor.types?.queryOperationTypes;\n\t\tif (queryOperationTypes?.import) imports.push(queryOperationTypes.import);\n\t}\n\treturn imports;\n}\nfunction extractComponentIds(family, target, adapter, extensions) {\n\tconst ids = [];\n\tconst seen = /* @__PURE__ */ new Set();\n\taddUniqueId(ids, seen, family.id);\n\taddUniqueId(ids, seen, target.id);\n\tif (adapter) addUniqueId(ids, seen, adapter.id);\n\tfor (const ext of extensions) addUniqueId(ids, seen, ext.id);\n\treturn ids;\n}\nfunction assembleAuthoringContributions(descriptors) {\n\tconst field = {};\n\tconst type = {};\n\tconst entityTypes = {};\n\tconst pslBlockDescriptors = {};\n\tconst modelAttributes = {};\n\tconst attributeSpecs = {\n\t\tmodel: {},\n\t\tfield: {}\n\t};\n\tconst attributeSpecOwners = /* @__PURE__ */ new Map();\n\tconst pathOwners = /* @__PURE__ */ new Map();\n\tconst claimContributedPaths = (namespace, descriptorKind, label, descriptorId) => {\n\t\tfor (const path of collectContributedDescriptorPaths(namespace, descriptorKind)) {\n\t\t\tconst key = `${label}:${path}`;\n\t\t\tconst existingOwner = pathOwners.get(key);\n\t\t\tif (existingOwner !== void 0) throw new InternalError(`Duplicate authoring ${label} helper \"${path}\". Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\".`);\n\t\t\tpathOwners.set(key, descriptorId);\n\t\t}\n\t};\n\tlet valueObjectStorageDeclaration;\n\tfor (const descriptor of descriptors) {\n\t\tconst descriptorId = descriptor.id ?? \"<unknown>\";\n\t\tconst declaredValueObjectStorageType = descriptor.authoring?.valueObjectStorageType;\n\t\tif (declaredValueObjectStorageType !== void 0) {\n\t\t\tif (valueObjectStorageDeclaration !== void 0) throw new InternalError(`Duplicate authoring valueObjectStorageType declaration. Descriptor \"${descriptorId}\" conflicts with \"${valueObjectStorageDeclaration.ownerId}\". Exactly one composed component may declare the value-object storage type.`);\n\t\t\tvalueObjectStorageDeclaration = {\n\t\t\t\tname: declaredValueObjectStorageType,\n\t\t\t\townerId: descriptorId\n\t\t\t};\n\t\t}\n\t\tif (descriptor.authoring?.field) {\n\t\t\tclaimContributedPaths(descriptor.authoring.field, \"fieldPreset\", \"field\", descriptorId);\n\t\t\tmergeAuthoringNamespaces(field, descriptor.authoring.field, [], \"fieldPreset\", \"field\");\n\t\t}\n\t\tif (descriptor.authoring?.type) {\n\t\t\tclaimContributedPaths(descriptor.authoring.type, \"typeConstructor\", \"type\", descriptorId);\n\t\t\tassertResolvableTypeConstructorTemplates(descriptor.authoring.type, descriptorId);\n\t\t\tmergeAuthoringNamespaces(type, descriptor.authoring.type, [], \"typeConstructor\", \"type\");\n\t\t}\n\t\tif (descriptor.authoring?.entityTypes) {\n\t\t\tclaimContributedPaths(descriptor.authoring.entityTypes, \"entity\", \"entity\", descriptorId);\n\t\t\tmergeAuthoringNamespaces(entityTypes, descriptor.authoring.entityTypes, [], \"entity\", \"entity\");\n\t\t}\n\t\tif (descriptor.authoring?.pslBlockDescriptors) {\n\t\t\tclaimContributedPaths(descriptor.authoring.pslBlockDescriptors, \"pslBlock\", \"pslBlock\", descriptorId);\n\t\t\tmergeAuthoringNamespaces(pslBlockDescriptors, descriptor.authoring.pslBlockDescriptors, [], \"pslBlock\", \"pslBlock\");\n\t\t}\n\t\tif (descriptor.authoring?.modelAttributes) mergeAuthoringNamespaces(modelAttributes, descriptor.authoring.modelAttributes, [], \"modelAttribute\", \"modelAttribute\");\n\t\tif (descriptor.authoring?.attributeSpecs) mergeAuthoringAttributeSpecs(attributeSpecs, descriptor.authoring.attributeSpecs, descriptorId, attributeSpecOwners);\n\t}\n\tconst fieldNamespace = field;\n\tconst typeNamespace = type;\n\tconst entityTypeNamespace = entityTypes;\n\tconst pslBlockDescriptorNamespace = blindCast(pslBlockDescriptors);\n\tconst modelAttributeNamespace = blindCast(modelAttributes);\n\tassertNoCrossRegistryCollisions(typeNamespace, fieldNamespace, entityTypeNamespace, pslBlockDescriptorNamespace, modelAttributeNamespace);\n\tif (valueObjectStorageDeclaration !== void 0 && !collectScalarTypeConstructors(typeNamespace).has(valueObjectStorageDeclaration.name)) throw new InternalError(`Invalid authoring valueObjectStorageType \"${valueObjectStorageDeclaration.name}\" declared by descriptor \"${valueObjectStorageDeclaration.ownerId}\". The name must be a top-level bare-eligible type constructor in the assembled authoring namespace.`);\n\treturn {\n\t\tfield: fieldNamespace,\n\t\ttype: typeNamespace,\n\t\tentityTypes: entityTypeNamespace,\n\t\tpslBlockDescriptors: pslBlockDescriptorNamespace,\n\t\tmodelAttributes: modelAttributeNamespace,\n\t\tattributeSpecs,\n\t\t...valueObjectStorageDeclaration !== void 0 ? { valueObjectStorageType: valueObjectStorageDeclaration.name } : {}\n\t};\n}\nfunction assembleControlMutationDefaults(descriptors) {\n\tconst defaultFunctionRegistry = /* @__PURE__ */ new Map();\n\tconst functionOwners = /* @__PURE__ */ new Map();\n\tconst generatorMap = /* @__PURE__ */ new Map();\n\tconst generatorOwners = /* @__PURE__ */ new Map();\n\tfor (const descriptor of descriptors) {\n\t\tconst contributions = descriptor.controlMutationDefaults;\n\t\tif (!contributions) continue;\n\t\tconst descriptorId = descriptor.id ?? \"<unknown>\";\n\t\tfor (const generatorDescriptor of contributions.generatorDescriptors) {\n\t\t\tconst existingOwner = generatorOwners.get(generatorDescriptor.id);\n\t\t\tif (existingOwner !== void 0) throw new InternalError(`Duplicate mutation default generator id \"${generatorDescriptor.id}\". Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\".`);\n\t\t\tgeneratorMap.set(generatorDescriptor.id, generatorDescriptor);\n\t\t\tgeneratorOwners.set(generatorDescriptor.id, descriptorId);\n\t\t}\n\t\tfor (const [functionName, handler] of contributions.defaultFunctionRegistry) {\n\t\t\tconst existingOwner = functionOwners.get(functionName);\n\t\t\tif (existingOwner !== void 0) throw new InternalError(`Duplicate mutation default function \"${functionName}\". Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\".`);\n\t\t\tdefaultFunctionRegistry.set(functionName, handler);\n\t\t\tfunctionOwners.set(functionName, descriptorId);\n\t\t}\n\t}\n\treturn {\n\t\tdefaultFunctionRegistry,\n\t\tgeneratorDescriptors: Array.from(generatorMap.values())\n\t};\n}\n/**\n* Collect every contributed {@link AggregateDescriptor} across the composed components, rejecting malformed shapes and second claims on one `(operation, input)` overload.\n*\n* Both planes read the same contribution slot: emission derives result types from these descriptors, and family runtimes build their resolution registry from them. Rejections are user-facing — an extension author's bad contribution surfaces here first, during `contract emit` — so a malformed shape raises `CONTRACT.AGGREGATE_DESCRIPTOR_INVALID` and a second claim raises `CONTRACT.AGGREGATE_DESCRIPTOR_DUPLICATE`, each naming the contributing component.\n*/\nfunction collectAggregateDescriptors(descriptors) {\n\tconst collected = [];\n\tconst owners = /* @__PURE__ */ new Map();\n\tfor (const descriptor of descriptors) {\n\t\tconst descriptorId = descriptor.id ?? \"<unknown>\";\n\t\tfor (const contributed of descriptor.types?.aggregateDescriptors ?? []) {\n\t\t\tif (!isAggregateDescriptor(contributed)) throw runtimeError(\"CONTRACT.AGGREGATE_DESCRIPTOR_INVALID\", `Malformed aggregate descriptor contributed by \"${descriptorId}\". A descriptor declares a non-empty \\`operation\\`, an \\`input\\` match of kind \\`none\\`/\\`any\\`/\\`codec\\`/\\`trait\\`, an \\`output\\` of kind \\`self\\`/\\`codec\\`, and a boolean \\`nullable\\` — plus \\`emptyResultJson\\`, in the result codec's canonical JSON, where \\`nullable\\` is false; a \\`self\\` output needs an input to reuse.`, {\n\t\t\t\tcontributedBy: descriptorId,\n\t\t\t\tdescriptor: contributed\n\t\t\t});\n\t\t\tconst key = aggregateDescriptorKey(contributed);\n\t\t\tconst existingOwner = owners.get(key);\n\t\t\tif (existingOwner !== void 0) throw runtimeError(\"CONTRACT.AGGREGATE_DESCRIPTOR_DUPLICATE\", `Duplicate aggregate descriptor for \"${key}\". Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\". Each operation/input pair can only have one provider.`, {\n\t\t\t\tkey,\n\t\t\t\tcontributedBy: descriptorId,\n\t\t\t\towner: existingOwner\n\t\t\t});\n\t\t\towners.set(key, descriptorId);\n\t\t\tcollected.push(contributed);\n\t\t}\n\t}\n\treturn collected;\n}\n/**\n* Flatten the codec descriptors the composed components contribute.\n*\n* A component may know a codec and still withhold it — an adapter that cannot name a codec's emitted type contributes the rest without it — so the contributed set is not always the set some component's own registry holds. Consumers whose output must agree with what the runtime resolves read this list rather than any one component's registry.\n*/\nfunction collectCodecDescriptors(descriptors) {\n\treturn descriptors.flatMap((descriptor) => descriptor.types?.codecTypes?.codecDescriptors ?? []);\n}\nfunction extractCodecLookup(descriptors) {\n\tconst byId = /* @__PURE__ */ new Map();\n\tconst descriptorsById = /* @__PURE__ */ new Map();\n\tconst targetTypesById = /* @__PURE__ */ new Map();\n\tconst renderersById = /* @__PURE__ */ new Map();\n\tconst inputRenderersById = /* @__PURE__ */ new Map();\n\tconst valueLiteralRenderersById = /* @__PURE__ */ new Map();\n\tconst owners = /* @__PURE__ */ new Map();\n\tfor (const descriptor of descriptors) {\n\t\tconst codecTypes = descriptor.types?.codecTypes;\n\t\tconst descriptorId = descriptor.id;\n\t\tfor (const codecDescriptor of codecTypes?.codecDescriptors ?? []) {\n\t\t\tassertUniqueCodecOwner({\n\t\t\t\tcodecId: codecDescriptor.codecId,\n\t\t\t\towners,\n\t\t\t\tdescriptorId,\n\t\t\t\tentityLabel: \"codec descriptor\",\n\t\t\t\tentityOwnershipLabel: \"codec descriptor provider\"\n\t\t\t});\n\t\t\towners.set(codecDescriptor.codecId, descriptorId);\n\t\t\tdescriptorsById.set(codecDescriptor.codecId, codecDescriptor);\n\t\t\tif (Array.isArray(codecDescriptor.targetTypes)) targetTypesById.set(codecDescriptor.codecId, codecDescriptor.targetTypes);\n\t\t\tif (typeof codecDescriptor.renderOutputType === \"function\") renderersById.set(codecDescriptor.codecId, codecDescriptor.renderOutputType);\n\t\t\tif (typeof codecDescriptor.renderInputType === \"function\") inputRenderersById.set(codecDescriptor.codecId, codecDescriptor.renderInputType);\n\t\t\tif (typeof codecDescriptor.renderValueLiteral === \"function\") valueLiteralRenderersById.set(codecDescriptor.codecId, codecDescriptor.renderValueLiteral);\n\t\t\tif (!byId.has(codecDescriptor.codecId)) if (codecDescriptor.isParameterized) try {\n\t\t\t\tconst representative = codecDescriptor.factory({})({ name: `<lookup:${codecDescriptor.codecId}>` });\n\t\t\t\tbyId.set(codecDescriptor.codecId, representative);\n\t\t\t} catch {}\n\t\t\telse {\n\t\t\t\tconst representative = codecDescriptor.factory(void 0)({ name: `<lookup:${codecDescriptor.codecId}>` });\n\t\t\t\tbyId.set(codecDescriptor.codecId, representative);\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tget: (id) => byId.get(id),\n\t\tforCodecRef(ref) {\n\t\t\treturn materializeCodec(resolveCodecDescriptorOrThrow((id) => descriptorsById.get(id), ref, CONTRACT_CODEC_DESCRIPTOR_MISSING), ref, { name: `<ref:${ref.codecId}>` });\n\t\t},\n\t\tforColumn: () => void 0,\n\t\ttargetTypesFor: (id) => targetTypesById.get(id),\n\t\trenderOutputTypeFor: (id, params) => renderersById.get(id)?.(params),\n\t\trenderInputTypeFor: (id, params) => inputRenderersById.get(id)?.(params),\n\t\trenderValueLiteralFor: (id, value, side) => valueLiteralRenderersById.get(id)?.(value, side),\n\t\tdescriptorFor: (id) => descriptorsById.get(id)\n\t};\n}\nfunction assembleExtensionContracts(extensions) {\n\tconst result = /* @__PURE__ */ new Map();\n\tfor (const ext of extensions) {\n\t\tif (ext.contractSpace === void 0) continue;\n\t\tresult.set(ext.id, ext.contractSpace.contractJson);\n\t}\n\treturn result;\n}\nfunction readDeclaredDependencyIds(descriptor) {\n\tconst packs = descriptor.contractSpace?.contractJson?.extensions;\n\tif (packs === null || typeof packs !== \"object\") return [];\n\treturn Object.keys(packs);\n}\n/**\n* Builds a dependency-respecting load order for the given extension descriptors\n* using Kahn's topological sort algorithm. Dependencies (packs declared in\n* `contractSpace.contractJson.extensions`) are placed before the extensions\n* that depend on them.\n*\n* Throws if the dependency graph contains a cycle, with an error message that\n* names every extension involved in the cycle.\n*\n* Throws if any extension declares a dependency on a pack ID that is not present\n* in the provided list — add the missing pack to the `extensions` list to\n* resolve the error.\n*/\nfunction buildExtensionLoadOrder(extensions) {\n\tif (extensions.length === 0) return [];\n\tconst idSet = new Set(extensions.map((e) => e.id));\n\tconst inDegree = /* @__PURE__ */ new Map();\n\tconst dependents = /* @__PURE__ */ new Map();\n\tfor (const ext of extensions) {\n\t\tif (!inDegree.has(ext.id)) inDegree.set(ext.id, 0);\n\t\tif (!dependents.has(ext.id)) dependents.set(ext.id, []);\n\t}\n\tfor (const ext of extensions) for (const depId of readDeclaredDependencyIds(ext)) {\n\t\tif (!idSet.has(depId)) throw new InternalError(`Extension \"${ext.id}\" declares a dependency on \"${depId}\", but \"${depId}\" is not in the provided extension set. Add the missing space to extensions.`);\n\t\tinDegree.set(ext.id, (inDegree.get(ext.id) ?? 0) + 1);\n\t\tconst list = dependents.get(depId);\n\t\tif (list !== void 0) list.push(ext.id);\n\t}\n\tconst queue = [];\n\tfor (const [id, deg] of inDegree) if (deg === 0) queue.push(id);\n\tqueue.sort();\n\tconst result = [];\n\twhile (queue.length > 0) {\n\t\tconst id = queue.shift();\n\t\tif (id === void 0) break;\n\t\tresult.push(id);\n\t\tconst children = dependents.get(id) ?? [];\n\t\tchildren.sort();\n\t\tfor (const childId of children) {\n\t\t\tconst newDeg = (inDegree.get(childId) ?? 1) - 1;\n\t\t\tinDegree.set(childId, newDeg);\n\t\t\tif (newDeg === 0) queue.push(childId);\n\t\t}\n\t}\n\tif (result.length < extensions.length) throw new InternalError(`Extension dependency cycle detected. Cycle members: ${extensions.map((e) => e.id).filter((id) => !result.includes(id)).sort().map((id) => `\"${id}\"`).join(\", \")}.`);\n\treturn result;\n}\nfunction createControlStack(input) {\n\tconst { family, target, adapter, driver, extensions = [] } = input;\n\tconst orderedIds = buildExtensionLoadOrder(extensions);\n\tconst extensionById = new Map(extensions.map((ext) => [ext.id, ext]));\n\tconst orderedExtensions = orderedIds.map((id) => extensionById.get(id)).filter((ext) => ext !== void 0);\n\tconst allDescriptors = [\n\t\tfamily,\n\t\ttarget,\n\t\t...adapter ? [adapter] : [],\n\t\t...orderedExtensions\n\t];\n\tconst codecLookup = extractCodecLookup(allDescriptors);\n\tconst authoringContributions = assembleAuthoringContributions(allDescriptors);\n\treturn {\n\t\tfamily,\n\t\ttarget,\n\t\tadapter,\n\t\tdriver,\n\t\textensions: orderedExtensions,\n\t\textensionContracts: assembleExtensionContracts(orderedExtensions),\n\t\tcodecTypeImports: extractCodecTypeImports(allDescriptors),\n\t\tqueryOperationTypeImports: extractQueryOperationTypeImports(allDescriptors),\n\t\textensionIds: extractComponentIds(family, target, adapter, orderedExtensions),\n\t\tcodecLookup,\n\t\tcodecDescriptors: collectCodecDescriptors(allDescriptors),\n\t\taggregateDescriptors: collectAggregateDescriptors(allDescriptors),\n\t\tauthoringContributions,\n\t\tscalarTypes: [...collectScalarTypeConstructors(authoringContributions.type).keys()],\n\t\tcontrolMutationDefaults: assembleControlMutationDefaults(allDescriptors),\n\t\tcapabilities: mergeCapabilityMatrices({}, [\n\t\t\ttarget,\n\t\t\t...adapter ? [adapter] : [],\n\t\t\t...orderedExtensions\n\t\t])\n\t};\n}\n//#endregion\n//#region src/control/order-issues-by-dependencies.ts\nconst PATH_DELIMITER = \" \";\nfunction pathKey(path) {\n\treturn path.join(PATH_DELIMITER);\n}\n/**\n* Whether an issue's op builds its subject up (create or alter) rather than\n* only tearing it down. The differ sets `expected` on every create (`not-found`)\n* and alter (`not-equal`) issue and leaves it absent on a pure drop\n* (`not-expected`). This is the single signal the ordering law reads for edge\n* direction — never `reason`.\n*/\nfunction buildsUp(issue) {\n\treturn issue.expected !== void 0;\n}\n/**\n* The nearest strict-ancestor bucket of `path` — the surviving parent entity a\n* child is contained by. Walks the path's proper prefixes from longest to\n* shortest and returns the first prefix that maps to a bucket; a gap (a prefix\n* with no bucket) is skipped so containment always attaches to the closest real\n* parent.\n*\n* Returns a list because a path prefix can be shared by two siblings of\n* different `nodeKind` (a role and a namespace named alike); linking the child\n* to every candidate over-constrains safely (the extra edge points at a same-\n* direction op and never forms a cycle, since a parent never depends on its\n* child) rather than risk picking the wrong one.\n*/\nfunction nearestAncestors(path, byPath) {\n\tfor (let end = path.length - 1; end >= 1; end -= 1) {\n\t\tconst bucket = byPath.get(pathKey(path.slice(0, end)));\n\t\tif (bucket !== void 0) return bucket;\n\t}\n\treturn [];\n}\n/**\n* Orders schema-diff issues so that every dependency's op precedes its\n* dependent on the way up and follows it on the way down, breaking ties\n* deterministically by path.\n*\n* Edges come from two sources:\n* - **`dependsOn` cross-links** — the resolved issue-to-issue paths the differ\n* mirrors onto each issue (a node's declared structural prerequisites). A\n* path that resolves to no issue in this list is skipped (the dependency is\n* satisfied by reality); a path shared by two same-id/different-kind siblings\n* links to every match, over-constraining safely.\n* - **containment** — every issue depends on its nearest strict-ancestor issue\n* (a child entity on the parent entity that owns it). Subtree coalescing has\n* already removed the descendants of a whole create/drop, so this only links\n* the parent/child pairs that legitimately survive together.\n*\n* The ordering law reads each dependent's presence for direction: an issue that\n* builds up (`expected` present — a create or alter) needs its dependency\n* first; a pure drop needs its dependent removed first, so the edge reverses.\n* The graph is a DAG by construction (dependencies point from dependents to\n* their prerequisites, and prerequisites never point back), so a cycle is a\n* derivation or authoring bug: the topological sort asserts acyclicity and\n* throws, naming the issues it could not place.\n*/\nfunction orderIssuesByDependencies(issues) {\n\tif (issues.length <= 1) return issues;\n\tconst nodes = issues.map((issue) => ({\n\t\tissue,\n\t\tkey: pathKey(issue.path),\n\t\tbuildsUp: buildsUp(issue),\n\t\toutgoing: /* @__PURE__ */ new Set(),\n\t\tinDegree: 0\n\t}));\n\tconst nodesByPath = /* @__PURE__ */ new Map();\n\tfor (const node of nodes) {\n\t\tconst bucket = nodesByPath.get(node.key);\n\t\tif (bucket === void 0) nodesByPath.set(node.key, [node]);\n\t\telse bucket.push(node);\n\t}\n\tconst addEdge = (before, after) => {\n\t\tif (before.outgoing.has(after)) return;\n\t\tbefore.outgoing.add(after);\n\t\tafter.inDegree += 1;\n\t};\n\tconst addDependency = (dependent, dependency) => {\n\t\tif (dependent === dependency) return;\n\t\tif (dependent.buildsUp) addEdge(dependency, dependent);\n\t\telse addEdge(dependent, dependency);\n\t};\n\tfor (const node of nodes) {\n\t\tfor (const targetPath of node.issue.dependsOn ?? []) for (const target of nodesByPath.get(pathKey(targetPath)) ?? []) addDependency(node, target);\n\t\tfor (const ancestor of nearestAncestors(node.issue.path, nodesByPath)) addDependency(node, ancestor);\n\t}\n\tconst ready = nodes.filter((node) => node.inDegree === 0);\n\tconst order = [];\n\twhile (ready.length > 0) {\n\t\tlet best;\n\t\tfor (const candidate of ready) if (best === void 0 || candidate.key < best.key) best = candidate;\n\t\tif (best === void 0) break;\n\t\tready.splice(ready.indexOf(best), 1);\n\t\torder.push(best);\n\t\tfor (const next of best.outgoing) {\n\t\t\tnext.inDegree -= 1;\n\t\t\tif (next.inDegree === 0) ready.push(next);\n\t\t}\n\t}\n\tif (order.length !== nodes.length) {\n\t\tconst placed = new Set(order);\n\t\tthrow new InternalError(`orderIssuesByDependencies: dependency cycle among schema-diff issues (unresolved: ${nodes.filter((node) => !placed.has(node)).map((node) => node.issue.path.join(\"/\")).join(\", \")})`);\n\t}\n\treturn order.map((node) => node.issue);\n}\n//#endregion\n//#region src/control/schema-diff.ts\n/**\n* The outcome an issue represents, discriminated by presence rather than any\n* stored field — the single source of truth every consumer reads. An issue\n* always carries at least one side by construction; neither is a malformed\n* issue and throws.\n*/\nfunction issueOutcome(issue) {\n\tconst hasExpected = issue.expected !== void 0;\n\tconst hasActual = issue.actual !== void 0;\n\tif (hasExpected && hasActual) return \"not-equal\";\n\tif (hasExpected) return \"not-found\";\n\tif (hasActual) return \"not-expected\";\n\tthrow new InternalError(`issueOutcome: issue at \"${issue.path.join(\"/\")}\" carries neither an expected nor an actual node`);\n}\n/** Delimiter joining `nodeKind` and `id` into one sibling-map key. Every `nodeKind` is a code-defined literal (kebab-case-style), so a null character can never appear in one. */\nconst SIBLING_KEY_DELIMITER = \"\\0\";\nfunction siblingKey(node) {\n\treturn `${node.nodeKind}${SIBLING_KEY_DELIMITER}${node.id}`;\n}\nfunction insertNode(map, node) {\n\tconst key = siblingKey(node);\n\tif (map.has(key)) throw new InternalError(`diffSchemas: duplicate id among siblings: ${node.nodeKind}/${node.id}`);\n\tmap.set(key, node);\n}\nfunction emitMissingSubtree(node, parentPath) {\n\tconst path = [...parentPath, node.id];\n\treturn [{\n\t\tpath,\n\t\texpected: node\n\t}, ...node.children().flatMap((c) => emitMissingSubtree(c, path))];\n}\nfunction emitExtraSubtree(node, parentPath) {\n\tconst path = [...parentPath, node.id];\n\treturn [{\n\t\tpath,\n\t\tactual: node\n\t}, ...node.children().flatMap((c) => emitExtraSubtree(c, path))];\n}\n/**\n* Diff two schema trees starting from their roots.\n*\n* The differ is **total**: every node-level difference is reported. An unmatched\n* non-leaf node emits its own issue and descends, emitting an issue for every\n* node in the missing/extra subtree. Coalescing a parent change over its\n* children is the planner's responsibility. Ownership filtering (dropping `extra`\n* issues in namespaces a contract doesn't own) is the caller's responsibility.\n*/\nfunction diffSchemas(expected, actual) {\n\treturn mirrorDependsOnOntoIssues(diffPair(expected, actual, []));\n}\nfunction schemaNodeRefKey(ref) {\n\treturn ref.map((step) => step.id).join(SIBLING_KEY_DELIMITER);\n}\nfunction issuePathKey(path) {\n\treturn path.join(SIBLING_KEY_DELIMITER);\n}\nfunction terminalNodeKind(issue) {\n\treturn (issue.expected ?? issue.actual)?.nodeKind;\n}\n/**\n* Copies each issue's node's `dependsOn` refs onto the issue itself, as\n* issue-to-issue path references. A ref is kept only when some emitted issue\n* sits at that exact path AND that issue's node `nodeKind` matches the ref's\n* last step — otherwise the ref is dropped (its target either didn't\n* change, or was never part of either tree; either way the dependency is\n* satisfied by reality, not by an operation this diff will produce).\n*\n* The path index is a multimap: two siblings may share an `id` under\n* different `nodeKind`s (a role and a namespace named alike), so an id-path\n* alone is ambiguous. The ref's terminal `nodeKind` disambiguates — the ref\n* resolves only against a same-path issue whose own node carries that kind.\n*/\nfunction mirrorDependsOnOntoIssues(issues) {\n\tconst issuesByPath = /* @__PURE__ */ new Map();\n\tfor (const issue of issues) {\n\t\tconst key = issuePathKey(issue.path);\n\t\tconst bucket = issuesByPath.get(key);\n\t\tif (bucket === void 0) issuesByPath.set(key, [issue]);\n\t\telse bucket.push(issue);\n\t}\n\treturn issues.map((issue) => {\n\t\tconst refs = (issue.expected ?? issue.actual)?.dependsOn;\n\t\tif (refs === void 0 || refs.length === 0) return issue;\n\t\tconst dependsOn = refs.flatMap((ref) => {\n\t\t\tconst lastStep = ref[ref.length - 1];\n\t\t\tif (lastStep === void 0) return [];\n\t\t\tif (!(issuesByPath.get(schemaNodeRefKey(ref)) ?? []).some((c) => terminalNodeKind(c) === lastStep.nodeKind)) return [];\n\t\t\treturn [ref.map((step) => step.id)];\n\t\t});\n\t\tif (dependsOn.length === 0) return issue;\n\t\treturn {\n\t\t\t...issue,\n\t\t\tdependsOn\n\t\t};\n\t});\n}\nfunction diffPair(expected, actual, parentPath) {\n\tconst path = [...parentPath, expected.id];\n\tconst issues = [];\n\tif (!expected.isEqualTo(actual)) issues.push({\n\t\tpath,\n\t\texpected,\n\t\tactual\n\t});\n\tissues.push(...diffChildren(expected.children(), actual.children(), path));\n\treturn issues;\n}\n/**\n* Align one level of nodes by `(nodeKind, id)`; emit issues in input order\n* and recurse.\n*\n* A missing node emits one issue for itself and one for every node in its\n* subtree (total descent). Same for extra nodes. A matched pair recurses via\n* `diffPair`.\n*/\nfunction diffChildren(expected, actual, parentPath) {\n\tconst expectedMap = /* @__PURE__ */ new Map();\n\tfor (const node of expected) insertNode(expectedMap, node);\n\tconst actualMap = /* @__PURE__ */ new Map();\n\tfor (const node of actual) insertNode(actualMap, node);\n\tconst issues = [];\n\tfor (const [key, expectedNode] of expectedMap) {\n\t\tconst actualNode = actualMap.get(key);\n\t\tif (actualNode === void 0) issues.push(...emitMissingSubtree(expectedNode, parentPath));\n\t\telse issues.push(...diffPair(expectedNode, actualNode, parentPath));\n\t}\n\tfor (const [key, actualNode] of actualMap) if (!expectedMap.has(key)) issues.push(...emitExtraSubtree(actualNode, parentPath));\n\treturn issues;\n}\n/**\n* The result of diffing a contract's expected schema against the introspected\n* actual schema: one node-typed issue list. Carries no verdict, verification\n* tree, or counts — those are the verifier's own presentation, built from the\n* same underlying comparison.\n*\n* `TNode` is the concrete schema-IR node the issues carry; it defaults to\n* `DiffableNode`, so this is purely additive — a caller that wants the\n* concrete node opts in (the Postgres planner uses the concrete node type),\n* everyone else keeps the default unchanged.\n*/\nvar SchemaDiff = class SchemaDiff {\n\tissues;\n\tconstructor(issues) {\n\t\tthis.issues = issues;\n\t}\n\t/** Returns a new `SchemaDiff` narrowed to the issues `keep` returns true for. */\n\tfilter(keep) {\n\t\treturn new SchemaDiff(this.issues.filter(keep));\n\t}\n};\n//#endregion\n//#region src/control/verifier-disposition.ts\n/**\n* Grades a target-neutral issue category against a control policy.\n*\n* - `observed` warns on everything.\n* - `tolerated` suppresses only an extra nested element (everything else fails).\n* - `external` suppresses every extra category and value drift (existence and\n* declared-shape divergences still fail).\n* - `managed` (and any other) fails.\n*/\nfunction dispositionForCategory(controlPolicy, category) {\n\tif (controlPolicy === \"observed\") return \"warn\";\n\tif (controlPolicy === \"tolerated\" && category === \"extraNestedElement\") return \"suppress\";\n\tif (controlPolicy === \"external\") {\n\t\tif (category === \"extraNestedElement\" || category === \"extraAuxiliary\" || category === \"extraTopLevelObject\" || category === \"valueDrift\") return \"suppress\";\n\t}\n\treturn \"fail\";\n}\n//#endregion\nexport { APP_SPACE_ID, CONTRACT_SNAPSHOTS_DIRNAME, SchemaDiff, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_SCHEMA_FAILURE, VERIFY_CODE_TARGET_MISMATCH, assembleAuthoringContributions, assembleControlMutationDefaults, assertUniqueCodecOwner, buildExtensionLoadOrder, contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier, createControlStack, diffSchemas, dispositionForCategory, extractCodecLookup, extractCodecTypeImports, extractComponentIds, extractQueryOperationTypeImports, hasMigrations, hasOperationPreview, hasPslContractInfer, hasSchemaSubjectClassifier, hasSchemaView, issueOutcome, orderIssuesByDependencies, storageHashHex };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;AAOA,MAAM,6BAA6B;AACnC,MAAM,uBAAuB;;AAE7B,SAAS,eAAe,aAAa;CACpC,IAAI,CAAC,qBAAqB,KAAK,WAAW,GAAG,MAAM,IAAI,cAAc,yBAAyB,YAAY,wCAAwC;CAClJ,OAAO;AACR;;AAEA,SAAS,8BAA8B,qBAAqB,aAAa;CACxE,OAAO,GAAG,oBAAoB,GAAG,eAAe,WAAW,EAAE;AAC9D;;AAEA,SAAS,+BAA+B,qBAAqB,aAAa;CACzE,OAAO,GAAG,oBAAoB,GAAG,eAAe,WAAW,EAAE;AAC9D;AAGA,SAAS,cAAc,QAAQ;CAC9B,OAAO,gBAAgB,UAAU,CAAC,CAAC,OAAO;AAC3C;AACA,SAAS,cAAc,UAAU;CAChC,OAAO,kBAAkB,YA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C5C;EACA;EACA;CACD,CAAC;CACD,OAAO,KAAK,GAAG,aAAa,SAAS,SAAS,GAAG,OAAO,SAAS,GAAG,IAAI,CAAC;CACzE,OAAO;AACR;;;;;;;;;AASA,SAAS,aAAa,UAAU,QAAQ,YAAY;CACnD,MAAM,8BAA8B,IAAI,IAAI;CAC5C,KAAK,MAAM,QAAQ,UAAU,WAAW,aAAa,IAAI;CACzD,MAAM,4BAA4B,IAAI,IAAI;CAC1C,KAAK,MAAM,QAAQ,QAAQ,WAAW,WAAW,IAAI;CACrD,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,CAAC,KAAK,iBAAiB,aAAa;EAC9C,MAAM,aAAa,UAAU,IAAI,GAAG;EACpC,IAAI,eAAe,KAAK,GAAG,OAAO,KAAK,GAAG,mBAAmB,cAAc,UAAU,CAAC;OACjF,OAAO,KAAK,GAAG,SAAS,cAAc,YAAY,UAAU,CAAC;CACnE;CACA,KAAK,MAAM,CAAC,KAAK,eAAe,WAAW,IAAI,CAAC,YAAY,IAAI,GAAG,GAAG,OAAO,KAAK,GAAG,iBAAiB,YAAY,UAAU,CAAC;CAC7H,OAAO;AACR;;;;;;;;;;;;AAYA,IAAI,aAAa,MAAM,WAAW;CACjC;CACA,YAAY,QAAQ;EACnB,KAAK,SAAS;CACf;;CAEA,OAAO,MAAM;EACZ,OAAO,IAAI,WAAW,KAAK,OAAO,OAAO,IAAI,CAAC;CAC/C;AACD;;;;;;;;;;AAYA,SAAS,uBAAuB,eAAe,UAAU;CACxD,IAAI,kBAAkB,YAAY,OAAO;CACzC,IAAI,kBAAkB,eAAe,aAAa,sBAAsB,OAAO;CAC/E,IAAI,kBAAkB,YACjB;MAAA,aAAa,wBAAwB,aAAa,oBAAoB,aAAa,yBAAyB,aAAa,cAAc,OAAO;CAAA;CAEnJ,OAAO;AACR"}
1
+ {"version":3,"file":"control-DR0zF1b7.mjs","names":[],"sources":["../../../../1-framework/1-core/framework-components/dist/control.mjs"],"sourcesContent":["import { n as runtimeError } from \"./runtime-error-BA9d7XjZ.mjs\";\nimport { n as materializeCodec, r as resolveCodecDescriptorOrThrow, t as CONTRACT_CODEC_DESCRIPTOR_MISSING } from \"./resolve-codec-BLRGmP1f.mjs\";\nimport { n as aggregateDescriptorKey, r as isAggregateDescriptor, t as mergeCapabilityMatrices } from \"./capabilities-BzwH_XMZ.mjs\";\nimport { _ as mergeAuthoringAttributeSpecs, a as collectScalarTypeConstructors, i as collectContributedDescriptorPaths, n as assertResolvableTypeConstructorTemplates, t as assertNoCrossRegistryCollisions, v as mergeAuthoringNamespaces } from \"./framework-authoring-BvxZnsPY.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/control/contract-snapshot-layout.ts\nconst CONTRACT_SNAPSHOTS_DIRNAME = \"snapshots\";\nconst STORAGE_HASH_PATTERN = /^[0-9a-f]{64}$/;\n/** Validate a storage hash for use as a directory name. */\nfunction storageHashHex(storageHash) {\n\tif (!STORAGE_HASH_PATTERN.test(storageHash)) throw new InternalError(`Invalid storage hash \"${storageHash}\": expected 64 lowercase hex characters`);\n\treturn storageHash;\n}\n/** Module specifier for the store's `contract.json`, POSIX separators. */\nfunction contractSnapshotJsonSpecifier(snapshotsImportPath, storageHash) {\n\treturn `${snapshotsImportPath}/${storageHashHex(storageHash)}/contract.json`;\n}\n/** Type-only module specifier for the store's `contract.d.ts` (no extension). */\nfunction contractSnapshotTypesSpecifier(snapshotsImportPath, storageHash) {\n\treturn `${snapshotsImportPath}/${storageHashHex(storageHash)}/contract`;\n}\n//#endregion\n//#region src/control/control-capabilities.ts\nfunction hasMigrations(target) {\n\treturn \"migrations\" in target && !!target[\"migrations\"];\n}\nfunction hasSchemaView(instance) {\n\treturn \"toSchemaView\" in instance && typeof instance[\"toSchemaView\"] === \"function\";\n}\nfunction hasPslContractInfer(instance) {\n\treturn \"inferPslContract\" in instance && typeof instance[\"inferPslContract\"] === \"function\";\n}\nfunction hasOperationPreview(instance) {\n\treturn \"toOperationPreview\" in instance && typeof instance[\"toOperationPreview\"] === \"function\";\n}\nfunction hasSchemaSubjectClassifier(instance) {\n\treturn \"classifySubjectGranularity\" in instance && typeof instance[\"classifySubjectGranularity\"] === \"function\" && \"classifyEntityKind\" in instance && typeof instance[\"classifyEntityKind\"] === \"function\";\n}\n//#endregion\n//#region src/control/control-operation-results.ts\nconst VERIFY_CODE_MARKER_MISSING = \"CONTRACT.MARKER_MISSING\";\nconst VERIFY_CODE_HASH_MISMATCH = \"CONTRACT.MARKER_MISMATCH\";\nconst VERIFY_CODE_TARGET_MISMATCH = \"CONTRACT.TARGET_MISMATCH\";\nconst VERIFY_CODE_SCHEMA_FAILURE = \"CONTRACT.SCHEMA_VERIFICATION_FAILED\";\n//#endregion\n//#region src/control/control-schema-view.ts\nvar SchemaTreeNode = class {\n\tkind;\n\tid;\n\tlabel;\n\tmeta;\n\tchildren;\n\tconstructor(options) {\n\t\tthis.kind = options.kind;\n\t\tthis.id = options.id;\n\t\tthis.label = options.label;\n\t\tif (options.meta !== void 0) this.meta = options.meta;\n\t\tif (options.children !== void 0) this.children = options.children;\n\t\tObject.freeze(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.visit(this);\n\t}\n};\n//#endregion\n//#region src/control/control-spaces.ts\n/**\n* Canonical control-plane identifiers for contract spaces.\n*\n* A contract space is the disjoint `(contract.json, migration-graph)` unit\n* the per-space planner / runner / verifier (project: extension contract\n* spaces, TML-2397) operates on. The application owns one well-known\n* space — the value below — and each loaded extension that contributes\n* schema owns a uniquely-named space.\n*\n* Lives in `framework-components/control` so every layer that has to\n* reason about space identity (the migration tooling, the SQL runtime's\n* marker reader, target-side statement builders, target-side adapters)\n* can import a single value rather than duplicating the literal. Raw\n* `'app'` string literals in framework / target / runtime / adapter\n* source code are forbidden and policed by\n* `scripts/lint-app-space-id.mjs` (wired into `pnpm lint:deps`).\n*\n* @see specs/framework-mechanism.spec.md § 3 — Layout convention (γ).\n*/\nconst APP_SPACE_ID = \"app\";\n//#endregion\n//#region src/control/control-stack.ts\nfunction addUniqueId(ids, seen, id) {\n\tif (!seen.has(id)) {\n\t\tids.push(id);\n\t\tseen.add(id);\n\t}\n}\nfunction assertUniqueCodecOwner(options) {\n\tconst existingOwner = options.owners.get(options.codecId);\n\tif (existingOwner !== void 0) throw new InternalError(`Duplicate ${options.entityLabel} for codecId \"${options.codecId}\". Descriptor \"${options.descriptorId}\" conflicts with \"${existingOwner}\". Each codecId can only have one ${options.entityOwnershipLabel}.`);\n}\nfunction extractCodecTypeImports(descriptors) {\n\tconst imports = [];\n\tfor (const descriptor of descriptors) {\n\t\tconst codecTypes = descriptor.types?.codecTypes;\n\t\tif (codecTypes?.import) imports.push(codecTypes.import);\n\t\tif (codecTypes?.typeImports) imports.push(...codecTypes.typeImports);\n\t}\n\treturn imports;\n}\nfunction extractQueryOperationTypeImports(descriptors) {\n\tconst imports = [];\n\tfor (const descriptor of descriptors) {\n\t\tconst queryOperationTypes = descriptor.types?.queryOperationTypes;\n\t\tif (queryOperationTypes?.import) imports.push(queryOperationTypes.import);\n\t}\n\treturn imports;\n}\nfunction extractComponentIds(family, target, adapter, extensions) {\n\tconst ids = [];\n\tconst seen = /* @__PURE__ */ new Set();\n\taddUniqueId(ids, seen, family.id);\n\taddUniqueId(ids, seen, target.id);\n\tif (adapter) addUniqueId(ids, seen, adapter.id);\n\tfor (const ext of extensions) addUniqueId(ids, seen, ext.id);\n\treturn ids;\n}\nfunction assembleAuthoringContributions(descriptors) {\n\tconst field = {};\n\tconst type = {};\n\tconst entityTypes = {};\n\tconst pslBlockDescriptors = {};\n\tconst modelAttributes = {};\n\tconst attributeSpecs = {\n\t\tmodel: {},\n\t\tfield: {}\n\t};\n\tconst attributeSpecOwners = /* @__PURE__ */ new Map();\n\tconst pathOwners = /* @__PURE__ */ new Map();\n\tconst claimContributedPaths = (namespace, descriptorKind, label, descriptorId) => {\n\t\tfor (const path of collectContributedDescriptorPaths(namespace, descriptorKind)) {\n\t\t\tconst key = `${label}:${path}`;\n\t\t\tconst existingOwner = pathOwners.get(key);\n\t\t\tif (existingOwner !== void 0) throw new InternalError(`Duplicate authoring ${label} helper \"${path}\". Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\".`);\n\t\t\tpathOwners.set(key, descriptorId);\n\t\t}\n\t};\n\tlet valueObjectStorageDeclaration;\n\tfor (const descriptor of descriptors) {\n\t\tconst descriptorId = descriptor.id ?? \"<unknown>\";\n\t\tconst declaredValueObjectStorageType = descriptor.authoring?.valueObjectStorageType;\n\t\tif (declaredValueObjectStorageType !== void 0) {\n\t\t\tif (valueObjectStorageDeclaration !== void 0) throw new InternalError(`Duplicate authoring valueObjectStorageType declaration. Descriptor \"${descriptorId}\" conflicts with \"${valueObjectStorageDeclaration.ownerId}\". Exactly one composed component may declare the value-object storage type.`);\n\t\t\tvalueObjectStorageDeclaration = {\n\t\t\t\tname: declaredValueObjectStorageType,\n\t\t\t\townerId: descriptorId\n\t\t\t};\n\t\t}\n\t\tif (descriptor.authoring?.field) {\n\t\t\tclaimContributedPaths(descriptor.authoring.field, \"fieldPreset\", \"field\", descriptorId);\n\t\t\tmergeAuthoringNamespaces(field, descriptor.authoring.field, [], \"fieldPreset\", \"field\");\n\t\t}\n\t\tif (descriptor.authoring?.type) {\n\t\t\tclaimContributedPaths(descriptor.authoring.type, \"typeConstructor\", \"type\", descriptorId);\n\t\t\tassertResolvableTypeConstructorTemplates(descriptor.authoring.type, descriptorId);\n\t\t\tmergeAuthoringNamespaces(type, descriptor.authoring.type, [], \"typeConstructor\", \"type\");\n\t\t}\n\t\tif (descriptor.authoring?.entityTypes) {\n\t\t\tclaimContributedPaths(descriptor.authoring.entityTypes, \"entity\", \"entity\", descriptorId);\n\t\t\tmergeAuthoringNamespaces(entityTypes, descriptor.authoring.entityTypes, [], \"entity\", \"entity\");\n\t\t}\n\t\tif (descriptor.authoring?.pslBlockDescriptors) {\n\t\t\tclaimContributedPaths(descriptor.authoring.pslBlockDescriptors, \"pslBlock\", \"pslBlock\", descriptorId);\n\t\t\tmergeAuthoringNamespaces(pslBlockDescriptors, descriptor.authoring.pslBlockDescriptors, [], \"pslBlock\", \"pslBlock\");\n\t\t}\n\t\tif (descriptor.authoring?.modelAttributes) mergeAuthoringNamespaces(modelAttributes, descriptor.authoring.modelAttributes, [], \"modelAttribute\", \"modelAttribute\");\n\t\tif (descriptor.authoring?.attributeSpecs) mergeAuthoringAttributeSpecs(attributeSpecs, descriptor.authoring.attributeSpecs, descriptorId, attributeSpecOwners);\n\t}\n\tconst fieldNamespace = field;\n\tconst typeNamespace = type;\n\tconst entityTypeNamespace = entityTypes;\n\tconst pslBlockDescriptorNamespace = blindCast(pslBlockDescriptors);\n\tconst modelAttributeNamespace = blindCast(modelAttributes);\n\tassertNoCrossRegistryCollisions(typeNamespace, fieldNamespace, entityTypeNamespace, pslBlockDescriptorNamespace, modelAttributeNamespace);\n\tif (valueObjectStorageDeclaration !== void 0 && !collectScalarTypeConstructors(typeNamespace).has(valueObjectStorageDeclaration.name)) throw new InternalError(`Invalid authoring valueObjectStorageType \"${valueObjectStorageDeclaration.name}\" declared by descriptor \"${valueObjectStorageDeclaration.ownerId}\". The name must be a top-level bare-eligible type constructor in the assembled authoring namespace.`);\n\treturn {\n\t\tfield: fieldNamespace,\n\t\ttype: typeNamespace,\n\t\tentityTypes: entityTypeNamespace,\n\t\tpslBlockDescriptors: pslBlockDescriptorNamespace,\n\t\tmodelAttributes: modelAttributeNamespace,\n\t\tattributeSpecs,\n\t\t...valueObjectStorageDeclaration !== void 0 ? { valueObjectStorageType: valueObjectStorageDeclaration.name } : {}\n\t};\n}\nfunction assembleControlMutationDefaults(descriptors) {\n\tconst defaultFunctionRegistry = /* @__PURE__ */ new Map();\n\tconst functionOwners = /* @__PURE__ */ new Map();\n\tconst generatorMap = /* @__PURE__ */ new Map();\n\tconst generatorOwners = /* @__PURE__ */ new Map();\n\tfor (const descriptor of descriptors) {\n\t\tconst contributions = descriptor.controlMutationDefaults;\n\t\tif (!contributions) continue;\n\t\tconst descriptorId = descriptor.id ?? \"<unknown>\";\n\t\tfor (const generatorDescriptor of contributions.generatorDescriptors) {\n\t\t\tconst existingOwner = generatorOwners.get(generatorDescriptor.id);\n\t\t\tif (existingOwner !== void 0) throw new InternalError(`Duplicate mutation default generator id \"${generatorDescriptor.id}\". Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\".`);\n\t\t\tgeneratorMap.set(generatorDescriptor.id, generatorDescriptor);\n\t\t\tgeneratorOwners.set(generatorDescriptor.id, descriptorId);\n\t\t}\n\t\tfor (const [functionName, handler] of contributions.defaultFunctionRegistry) {\n\t\t\tconst existingOwner = functionOwners.get(functionName);\n\t\t\tif (existingOwner !== void 0) throw new InternalError(`Duplicate mutation default function \"${functionName}\". Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\".`);\n\t\t\tdefaultFunctionRegistry.set(functionName, handler);\n\t\t\tfunctionOwners.set(functionName, descriptorId);\n\t\t}\n\t}\n\treturn {\n\t\tdefaultFunctionRegistry,\n\t\tgeneratorDescriptors: Array.from(generatorMap.values())\n\t};\n}\n/**\n* Collect every contributed {@link AggregateDescriptor} across the composed components, rejecting malformed shapes and second claims on one `(operation, input)` overload.\n*\n* Both planes read the same contribution slot: emission derives result types from these descriptors, and family runtimes build their resolution registry from them. Rejections are user-facing — an extension author's bad contribution surfaces here first, during `contract emit` — so a malformed shape raises `CONTRACT.AGGREGATE_DESCRIPTOR_INVALID` and a second claim raises `CONTRACT.AGGREGATE_DESCRIPTOR_DUPLICATE`, each naming the contributing component.\n*/\nfunction collectAggregateDescriptors(descriptors) {\n\tconst collected = [];\n\tconst owners = /* @__PURE__ */ new Map();\n\tfor (const descriptor of descriptors) {\n\t\tconst descriptorId = descriptor.id ?? \"<unknown>\";\n\t\tfor (const contributed of descriptor.types?.aggregateDescriptors ?? []) {\n\t\t\tif (!isAggregateDescriptor(contributed)) throw runtimeError(\"CONTRACT.AGGREGATE_DESCRIPTOR_INVALID\", `Malformed aggregate descriptor contributed by \"${descriptorId}\". A descriptor declares a non-empty \\`operation\\`, an \\`input\\` match of kind \\`none\\`/\\`any\\`/\\`codec\\`/\\`trait\\`, an \\`output\\` of kind \\`self\\`/\\`codec\\`, and a boolean \\`nullable\\` — plus \\`emptyResultJson\\`, in the result codec's canonical JSON, where \\`nullable\\` is false; a \\`self\\` output needs an input to reuse.`, {\n\t\t\t\tcontributedBy: descriptorId,\n\t\t\t\tdescriptor: contributed\n\t\t\t});\n\t\t\tconst key = aggregateDescriptorKey(contributed);\n\t\t\tconst existingOwner = owners.get(key);\n\t\t\tif (existingOwner !== void 0) throw runtimeError(\"CONTRACT.AGGREGATE_DESCRIPTOR_DUPLICATE\", `Duplicate aggregate descriptor for \"${key}\". Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\". Each operation/input pair can only have one provider.`, {\n\t\t\t\tkey,\n\t\t\t\tcontributedBy: descriptorId,\n\t\t\t\towner: existingOwner\n\t\t\t});\n\t\t\towners.set(key, descriptorId);\n\t\t\tcollected.push(contributed);\n\t\t}\n\t}\n\treturn collected;\n}\n/**\n* Flatten the codec descriptors the composed components contribute.\n*\n* A component may know a codec and still withhold it — an adapter that cannot name a codec's emitted type contributes the rest without it — so the contributed set is not always the set some component's own registry holds. Consumers whose output must agree with what the runtime resolves read this list rather than any one component's registry.\n*/\nfunction collectCodecDescriptors(descriptors) {\n\treturn descriptors.flatMap((descriptor) => descriptor.types?.codecTypes?.codecDescriptors ?? []);\n}\nfunction extractCodecLookup(descriptors) {\n\tconst byId = /* @__PURE__ */ new Map();\n\tconst descriptorsById = /* @__PURE__ */ new Map();\n\tconst targetTypesById = /* @__PURE__ */ new Map();\n\tconst renderersById = /* @__PURE__ */ new Map();\n\tconst inputRenderersById = /* @__PURE__ */ new Map();\n\tconst valueLiteralRenderersById = /* @__PURE__ */ new Map();\n\tconst owners = /* @__PURE__ */ new Map();\n\tfor (const descriptor of descriptors) {\n\t\tconst codecTypes = descriptor.types?.codecTypes;\n\t\tconst descriptorId = descriptor.id;\n\t\tfor (const codecDescriptor of codecTypes?.codecDescriptors ?? []) {\n\t\t\tassertUniqueCodecOwner({\n\t\t\t\tcodecId: codecDescriptor.codecId,\n\t\t\t\towners,\n\t\t\t\tdescriptorId,\n\t\t\t\tentityLabel: \"codec descriptor\",\n\t\t\t\tentityOwnershipLabel: \"codec descriptor provider\"\n\t\t\t});\n\t\t\towners.set(codecDescriptor.codecId, descriptorId);\n\t\t\tdescriptorsById.set(codecDescriptor.codecId, codecDescriptor);\n\t\t\tif (Array.isArray(codecDescriptor.targetTypes)) targetTypesById.set(codecDescriptor.codecId, codecDescriptor.targetTypes);\n\t\t\tif (typeof codecDescriptor.renderOutputType === \"function\") renderersById.set(codecDescriptor.codecId, codecDescriptor.renderOutputType);\n\t\t\tif (typeof codecDescriptor.renderInputType === \"function\") inputRenderersById.set(codecDescriptor.codecId, codecDescriptor.renderInputType);\n\t\t\tif (typeof codecDescriptor.renderValueLiteral === \"function\") valueLiteralRenderersById.set(codecDescriptor.codecId, codecDescriptor.renderValueLiteral);\n\t\t\tif (!byId.has(codecDescriptor.codecId)) if (codecDescriptor.isParameterized) try {\n\t\t\t\tconst representative = codecDescriptor.factory({})({ name: `<lookup:${codecDescriptor.codecId}>` });\n\t\t\t\tbyId.set(codecDescriptor.codecId, representative);\n\t\t\t} catch {}\n\t\t\telse {\n\t\t\t\tconst representative = codecDescriptor.factory(void 0)({ name: `<lookup:${codecDescriptor.codecId}>` });\n\t\t\t\tbyId.set(codecDescriptor.codecId, representative);\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tget: (id) => byId.get(id),\n\t\tforCodecRef(ref) {\n\t\t\treturn materializeCodec(resolveCodecDescriptorOrThrow((id) => descriptorsById.get(id), ref, CONTRACT_CODEC_DESCRIPTOR_MISSING), ref, { name: `<ref:${ref.codecId}>` });\n\t\t},\n\t\tforColumn: () => void 0,\n\t\ttargetTypesFor: (id) => targetTypesById.get(id),\n\t\trenderOutputTypeFor: (id, params) => renderersById.get(id)?.(params),\n\t\trenderInputTypeFor: (id, params) => inputRenderersById.get(id)?.(params),\n\t\trenderValueLiteralFor: (id, value, side) => valueLiteralRenderersById.get(id)?.(value, side),\n\t\tdescriptorFor: (id) => descriptorsById.get(id)\n\t};\n}\nfunction assembleExtensionContracts(extensions) {\n\tconst result = /* @__PURE__ */ new Map();\n\tfor (const ext of extensions) {\n\t\tif (ext.contractSpace === void 0) continue;\n\t\tresult.set(ext.id, ext.contractSpace.contractJson);\n\t}\n\treturn result;\n}\nfunction readDeclaredDependencyIds(descriptor) {\n\tconst packs = descriptor.contractSpace?.contractJson?.extensions;\n\tif (packs === null || typeof packs !== \"object\") return [];\n\treturn Object.keys(packs);\n}\n/**\n* Builds a dependency-respecting load order for the given extension descriptors\n* using Kahn's topological sort algorithm. Dependencies (packs declared in\n* `contractSpace.contractJson.extensions`) are placed before the extensions\n* that depend on them.\n*\n* Throws if the dependency graph contains a cycle, with an error message that\n* names every extension involved in the cycle.\n*\n* Throws if any extension declares a dependency on a pack ID that is not present\n* in the provided list — add the missing pack to the `extensions` list to\n* resolve the error.\n*/\nfunction buildExtensionLoadOrder(extensions) {\n\tif (extensions.length === 0) return [];\n\tconst idSet = new Set(extensions.map((e) => e.id));\n\tconst inDegree = /* @__PURE__ */ new Map();\n\tconst dependents = /* @__PURE__ */ new Map();\n\tfor (const ext of extensions) {\n\t\tif (!inDegree.has(ext.id)) inDegree.set(ext.id, 0);\n\t\tif (!dependents.has(ext.id)) dependents.set(ext.id, []);\n\t}\n\tfor (const ext of extensions) for (const depId of readDeclaredDependencyIds(ext)) {\n\t\tif (!idSet.has(depId)) throw new InternalError(`Extension \"${ext.id}\" declares a dependency on \"${depId}\", but \"${depId}\" is not in the provided extension set. Add the missing space to extensions.`);\n\t\tinDegree.set(ext.id, (inDegree.get(ext.id) ?? 0) + 1);\n\t\tconst list = dependents.get(depId);\n\t\tif (list !== void 0) list.push(ext.id);\n\t}\n\tconst queue = [];\n\tfor (const [id, deg] of inDegree) if (deg === 0) queue.push(id);\n\tqueue.sort();\n\tconst result = [];\n\twhile (queue.length > 0) {\n\t\tconst id = queue.shift();\n\t\tif (id === void 0) break;\n\t\tresult.push(id);\n\t\tconst children = dependents.get(id) ?? [];\n\t\tchildren.sort();\n\t\tfor (const childId of children) {\n\t\t\tconst newDeg = (inDegree.get(childId) ?? 1) - 1;\n\t\t\tinDegree.set(childId, newDeg);\n\t\t\tif (newDeg === 0) queue.push(childId);\n\t\t}\n\t}\n\tif (result.length < extensions.length) throw new InternalError(`Extension dependency cycle detected. Cycle members: ${extensions.map((e) => e.id).filter((id) => !result.includes(id)).sort().map((id) => `\"${id}\"`).join(\", \")}.`);\n\treturn result;\n}\nfunction createControlStack(input) {\n\tconst { family, target, adapter, driver, extensions = [] } = input;\n\tconst orderedIds = buildExtensionLoadOrder(extensions);\n\tconst extensionById = new Map(extensions.map((ext) => [ext.id, ext]));\n\tconst orderedExtensions = orderedIds.map((id) => extensionById.get(id)).filter((ext) => ext !== void 0);\n\tconst allDescriptors = [\n\t\tfamily,\n\t\ttarget,\n\t\t...adapter ? [adapter] : [],\n\t\t...orderedExtensions\n\t];\n\tconst codecLookup = extractCodecLookup(allDescriptors);\n\tconst authoringContributions = assembleAuthoringContributions(allDescriptors);\n\treturn {\n\t\tfamily,\n\t\ttarget,\n\t\tadapter,\n\t\tdriver,\n\t\textensions: orderedExtensions,\n\t\textensionContracts: assembleExtensionContracts(orderedExtensions),\n\t\tcodecTypeImports: extractCodecTypeImports(allDescriptors),\n\t\tqueryOperationTypeImports: extractQueryOperationTypeImports(allDescriptors),\n\t\textensionIds: extractComponentIds(family, target, adapter, orderedExtensions),\n\t\tcodecLookup,\n\t\tcodecDescriptors: collectCodecDescriptors(allDescriptors),\n\t\taggregateDescriptors: collectAggregateDescriptors(allDescriptors),\n\t\tauthoringContributions,\n\t\tscalarTypes: [...collectScalarTypeConstructors(authoringContributions.type).keys()],\n\t\tcontrolMutationDefaults: assembleControlMutationDefaults(allDescriptors),\n\t\tcapabilities: mergeCapabilityMatrices({}, [\n\t\t\ttarget,\n\t\t\t...adapter ? [adapter] : [],\n\t\t\t...orderedExtensions\n\t\t])\n\t};\n}\n//#endregion\n//#region src/control/order-issues-by-dependencies.ts\nconst PATH_DELIMITER = \" \";\nfunction pathKey(path) {\n\treturn path.join(PATH_DELIMITER);\n}\n/**\n* Whether an issue's op builds its subject up (create or alter) rather than\n* only tearing it down. The differ sets `expected` on every create (`not-found`)\n* and alter (`not-equal`) issue and leaves it absent on a pure drop\n* (`not-expected`). This is the single signal the ordering law reads for edge\n* direction — never `reason`.\n*/\nfunction buildsUp(issue) {\n\treturn issue.expected !== void 0;\n}\n/**\n* The nearest strict-ancestor bucket of `path` — the surviving parent entity a\n* child is contained by. Walks the path's proper prefixes from longest to\n* shortest and returns the first prefix that maps to a bucket; a gap (a prefix\n* with no bucket) is skipped so containment always attaches to the closest real\n* parent.\n*\n* Returns a list because a path prefix can be shared by two siblings of\n* different `nodeKind` (a role and a namespace named alike); linking the child\n* to every candidate over-constrains safely (the extra edge points at a same-\n* direction op and never forms a cycle, since a parent never depends on its\n* child) rather than risk picking the wrong one.\n*/\nfunction nearestAncestors(path, byPath) {\n\tfor (let end = path.length - 1; end >= 1; end -= 1) {\n\t\tconst bucket = byPath.get(pathKey(path.slice(0, end)));\n\t\tif (bucket !== void 0) return bucket;\n\t}\n\treturn [];\n}\n/**\n* Orders schema-diff issues so that every dependency's op precedes its\n* dependent on the way up and follows it on the way down, breaking ties\n* deterministically by path.\n*\n* Edges come from two sources:\n* - **`dependsOn` cross-links** — the resolved issue-to-issue paths the differ\n* mirrors onto each issue (a node's declared structural prerequisites). A\n* path that resolves to no issue in this list is skipped (the dependency is\n* satisfied by reality); a path shared by two same-id/different-kind siblings\n* links to every match, over-constraining safely.\n* - **containment** — every issue depends on its nearest strict-ancestor issue\n* (a child entity on the parent entity that owns it). Subtree coalescing has\n* already removed the descendants of a whole create/drop, so this only links\n* the parent/child pairs that legitimately survive together.\n*\n* The ordering law reads each dependent's presence for direction: an issue that\n* builds up (`expected` present — a create or alter) needs its dependency\n* first; a pure drop needs its dependent removed first, so the edge reverses.\n* The graph is a DAG by construction (dependencies point from dependents to\n* their prerequisites, and prerequisites never point back), so a cycle is a\n* derivation or authoring bug: the topological sort asserts acyclicity and\n* throws, naming the issues it could not place.\n*/\nfunction orderIssuesByDependencies(issues) {\n\tif (issues.length <= 1) return issues;\n\tconst nodes = issues.map((issue) => ({\n\t\tissue,\n\t\tkey: pathKey(issue.path),\n\t\tbuildsUp: buildsUp(issue),\n\t\toutgoing: /* @__PURE__ */ new Set(),\n\t\tinDegree: 0\n\t}));\n\tconst nodesByPath = /* @__PURE__ */ new Map();\n\tfor (const node of nodes) {\n\t\tconst bucket = nodesByPath.get(node.key);\n\t\tif (bucket === void 0) nodesByPath.set(node.key, [node]);\n\t\telse bucket.push(node);\n\t}\n\tconst addEdge = (before, after) => {\n\t\tif (before.outgoing.has(after)) return;\n\t\tbefore.outgoing.add(after);\n\t\tafter.inDegree += 1;\n\t};\n\tconst addDependency = (dependent, dependency) => {\n\t\tif (dependent === dependency) return;\n\t\tif (dependent.buildsUp) addEdge(dependency, dependent);\n\t\telse addEdge(dependent, dependency);\n\t};\n\tfor (const node of nodes) {\n\t\tfor (const targetPath of node.issue.dependsOn ?? []) for (const target of nodesByPath.get(pathKey(targetPath)) ?? []) addDependency(node, target);\n\t\tfor (const ancestor of nearestAncestors(node.issue.path, nodesByPath)) addDependency(node, ancestor);\n\t}\n\tconst ready = nodes.filter((node) => node.inDegree === 0);\n\tconst order = [];\n\twhile (ready.length > 0) {\n\t\tlet best;\n\t\tfor (const candidate of ready) if (best === void 0 || candidate.key < best.key) best = candidate;\n\t\tif (best === void 0) break;\n\t\tready.splice(ready.indexOf(best), 1);\n\t\torder.push(best);\n\t\tfor (const next of best.outgoing) {\n\t\t\tnext.inDegree -= 1;\n\t\t\tif (next.inDegree === 0) ready.push(next);\n\t\t}\n\t}\n\tif (order.length !== nodes.length) {\n\t\tconst placed = new Set(order);\n\t\tthrow new InternalError(`orderIssuesByDependencies: dependency cycle among schema-diff issues (unresolved: ${nodes.filter((node) => !placed.has(node)).map((node) => node.issue.path.join(\"/\")).join(\", \")})`);\n\t}\n\treturn order.map((node) => node.issue);\n}\n//#endregion\n//#region src/control/schema-diff.ts\n/**\n* The outcome an issue represents, discriminated by presence rather than any\n* stored field — the single source of truth every consumer reads. An issue\n* always carries at least one side by construction; neither is a malformed\n* issue and throws.\n*/\nfunction issueOutcome(issue) {\n\tconst hasExpected = issue.expected !== void 0;\n\tconst hasActual = issue.actual !== void 0;\n\tif (hasExpected && hasActual) return \"not-equal\";\n\tif (hasExpected) return \"not-found\";\n\tif (hasActual) return \"not-expected\";\n\tthrow new InternalError(`issueOutcome: issue at \"${issue.path.join(\"/\")}\" carries neither an expected nor an actual node`);\n}\n/** Delimiter joining `nodeKind` and `id` into one sibling-map key. Every `nodeKind` is a code-defined literal (kebab-case-style), so a null character can never appear in one. */\nconst SIBLING_KEY_DELIMITER = \"\\0\";\nfunction siblingKey(node) {\n\treturn `${node.nodeKind}${SIBLING_KEY_DELIMITER}${node.id}`;\n}\nfunction insertNode(map, node) {\n\tconst key = siblingKey(node);\n\tif (map.has(key)) throw new InternalError(`diffSchemas: duplicate id among siblings: ${node.nodeKind}/${node.id}`);\n\tmap.set(key, node);\n}\nfunction emitMissingSubtree(node, parentPath) {\n\tconst path = [...parentPath, node.id];\n\treturn [{\n\t\tpath,\n\t\texpected: node\n\t}, ...node.children().flatMap((c) => emitMissingSubtree(c, path))];\n}\nfunction emitExtraSubtree(node, parentPath) {\n\tconst path = [...parentPath, node.id];\n\treturn [{\n\t\tpath,\n\t\tactual: node\n\t}, ...node.children().flatMap((c) => emitExtraSubtree(c, path))];\n}\n/**\n* Diff two schema trees starting from their roots.\n*\n* The differ is **total**: every node-level difference is reported. An unmatched\n* non-leaf node emits its own issue and descends, emitting an issue for every\n* node in the missing/extra subtree. Coalescing a parent change over its\n* children is the planner's responsibility. Ownership filtering (dropping `extra`\n* issues in namespaces a contract doesn't own) is the caller's responsibility.\n*/\nfunction diffSchemas(expected, actual) {\n\treturn mirrorDependsOnOntoIssues(diffPair(expected, actual, []));\n}\nfunction schemaNodeRefKey(ref) {\n\treturn ref.map((step) => step.id).join(SIBLING_KEY_DELIMITER);\n}\nfunction issuePathKey(path) {\n\treturn path.join(SIBLING_KEY_DELIMITER);\n}\nfunction terminalNodeKind(issue) {\n\treturn (issue.expected ?? issue.actual)?.nodeKind;\n}\n/**\n* Copies each issue's node's `dependsOn` refs onto the issue itself, as\n* issue-to-issue path references. A ref is kept only when some emitted issue\n* sits at that exact path AND that issue's node `nodeKind` matches the ref's\n* last step — otherwise the ref is dropped (its target either didn't\n* change, or was never part of either tree; either way the dependency is\n* satisfied by reality, not by an operation this diff will produce).\n*\n* The path index is a multimap: two siblings may share an `id` under\n* different `nodeKind`s (a role and a namespace named alike), so an id-path\n* alone is ambiguous. The ref's terminal `nodeKind` disambiguates — the ref\n* resolves only against a same-path issue whose own node carries that kind.\n*/\nfunction mirrorDependsOnOntoIssues(issues) {\n\tconst issuesByPath = /* @__PURE__ */ new Map();\n\tfor (const issue of issues) {\n\t\tconst key = issuePathKey(issue.path);\n\t\tconst bucket = issuesByPath.get(key);\n\t\tif (bucket === void 0) issuesByPath.set(key, [issue]);\n\t\telse bucket.push(issue);\n\t}\n\treturn issues.map((issue) => {\n\t\tconst refs = (issue.expected ?? issue.actual)?.dependsOn;\n\t\tif (refs === void 0 || refs.length === 0) return issue;\n\t\tconst dependsOn = refs.flatMap((ref) => {\n\t\t\tconst lastStep = ref[ref.length - 1];\n\t\t\tif (lastStep === void 0) return [];\n\t\t\tif (!(issuesByPath.get(schemaNodeRefKey(ref)) ?? []).some((c) => terminalNodeKind(c) === lastStep.nodeKind)) return [];\n\t\t\treturn [ref.map((step) => step.id)];\n\t\t});\n\t\tif (dependsOn.length === 0) return issue;\n\t\treturn {\n\t\t\t...issue,\n\t\t\tdependsOn\n\t\t};\n\t});\n}\nfunction diffPair(expected, actual, parentPath) {\n\tconst path = [...parentPath, expected.id];\n\tconst issues = [];\n\tif (!expected.isEqualTo(actual)) issues.push({\n\t\tpath,\n\t\texpected,\n\t\tactual\n\t});\n\tissues.push(...diffChildren(expected.children(), actual.children(), path));\n\treturn issues;\n}\n/**\n* Align one level of nodes by `(nodeKind, id)`; emit issues in input order\n* and recurse.\n*\n* A missing node emits one issue for itself and one for every node in its\n* subtree (total descent). Same for extra nodes. A matched pair recurses via\n* `diffPair`.\n*/\nfunction diffChildren(expected, actual, parentPath) {\n\tconst expectedMap = /* @__PURE__ */ new Map();\n\tfor (const node of expected) insertNode(expectedMap, node);\n\tconst actualMap = /* @__PURE__ */ new Map();\n\tfor (const node of actual) insertNode(actualMap, node);\n\tconst issues = [];\n\tfor (const [key, expectedNode] of expectedMap) {\n\t\tconst actualNode = actualMap.get(key);\n\t\tif (actualNode === void 0) issues.push(...emitMissingSubtree(expectedNode, parentPath));\n\t\telse issues.push(...diffPair(expectedNode, actualNode, parentPath));\n\t}\n\tfor (const [key, actualNode] of actualMap) if (!expectedMap.has(key)) issues.push(...emitExtraSubtree(actualNode, parentPath));\n\treturn issues;\n}\n/**\n* The result of diffing a contract's expected schema against the introspected\n* actual schema: one node-typed issue list. Carries no verdict, verification\n* tree, or counts — those are the verifier's own presentation, built from the\n* same underlying comparison.\n*\n* `TNode` is the concrete schema-IR node the issues carry; it defaults to\n* `DiffableNode`, so this is purely additive — a caller that wants the\n* concrete node opts in (the Postgres planner uses the concrete node type),\n* everyone else keeps the default unchanged.\n*/\nvar SchemaDiff = class SchemaDiff {\n\tissues;\n\tconstructor(issues) {\n\t\tthis.issues = issues;\n\t}\n\t/** Returns a new `SchemaDiff` narrowed to the issues `keep` returns true for. */\n\tfilter(keep) {\n\t\treturn new SchemaDiff(this.issues.filter(keep));\n\t}\n};\n//#endregion\n//#region src/control/verifier-disposition.ts\n/**\n* Grades a target-neutral issue category against a control policy.\n*\n* - `observed` warns on everything.\n* - `tolerated` suppresses only an extra nested element (everything else fails).\n* - `external` suppresses every extra category and value drift (existence and\n* declared-shape divergences still fail).\n* - `managed` (and any other) fails.\n*/\nfunction dispositionForCategory(controlPolicy, category) {\n\tif (controlPolicy === \"observed\") return \"warn\";\n\tif (controlPolicy === \"tolerated\" && category === \"extraNestedElement\") return \"suppress\";\n\tif (controlPolicy === \"external\") {\n\t\tif (category === \"extraNestedElement\" || category === \"extraAuxiliary\" || category === \"extraTopLevelObject\" || category === \"valueDrift\") return \"suppress\";\n\t}\n\treturn \"fail\";\n}\n//#endregion\nexport { APP_SPACE_ID, CONTRACT_SNAPSHOTS_DIRNAME, SchemaDiff, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_SCHEMA_FAILURE, VERIFY_CODE_TARGET_MISMATCH, assembleAuthoringContributions, assembleControlMutationDefaults, assertUniqueCodecOwner, buildExtensionLoadOrder, contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier, createControlStack, diffSchemas, dispositionForCategory, extractCodecLookup, extractCodecTypeImports, extractComponentIds, extractQueryOperationTypeImports, hasMigrations, hasOperationPreview, hasPslContractInfer, hasSchemaSubjectClassifier, hasSchemaView, issueOutcome, orderIssuesByDependencies, storageHashHex };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;AAOA,MAAM,6BAA6B;AACnC,MAAM,uBAAuB;;AAE7B,SAAS,eAAe,aAAa;CACpC,IAAI,CAAC,qBAAqB,KAAK,WAAW,GAAG,MAAM,IAAI,cAAc,yBAAyB,YAAY,wCAAwC;CAClJ,OAAO;AACR;;AAEA,SAAS,8BAA8B,qBAAqB,aAAa;CACxE,OAAO,GAAG,oBAAoB,GAAG,eAAe,WAAW,EAAE;AAC9D;;AAEA,SAAS,+BAA+B,qBAAqB,aAAa;CACzE,OAAO,GAAG,oBAAoB,GAAG,eAAe,WAAW,EAAE;AAC9D;AAGA,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EnJ,OAAO;AACR"}
@@ -193,7 +193,7 @@ function formatFieldType(field) {
193
193
  else if (field.optional) type += "?";
194
194
  return type;
195
195
  }
196
- const DEFAULT_AST_PRINT_HEADER = "// use prisma-next\n// Contract inferred from the live database schema. Edit as needed, then run `prisma contract emit`.";
196
+ const DEFAULT_AST_PRINT_HEADER = "// use prisma-8\n// Contract inferred from the live database schema. Edit as needed, then run `prisma contract emit`.";
197
197
  function astDocumentToPrintDocument(ast) {
198
198
  const allModels = flatPslModels(ast);
199
199
  const sortedModels = topologicalSortModels(allModels, buildModelFkDeps(allModels, new Set(allModels.map((m) => m.name))));
@@ -1 +1 @@
1
- {"version":3,"file":"psl-printer.mjs","names":[],"sources":["../../../../1-framework/2-authoring/psl-printer/dist/index.mjs"],"sourcesContent":["import { ifDefined } from \"@internal/utils/defined\";\nimport { UNSPECIFIED_PSL_NAMESPACE_ID, flatPslModels, namespacePslExtensionBlocks } from \"@internal/framework-components/psl-ast\";\nimport { isAuthoringPslBlockDescriptor } from \"@internal/framework-components/authoring\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/contract-errors.ts\nfunction contractError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/serialize-print-document.ts\n/**\n* Indent unit used for PSL block bodies and namespace nesting.\n*/\nconst PSL_INDENT_UNIT = \" \";\nfunction buildPslBlockDispatchMap(namespace) {\n\tconst byKeyword = /* @__PURE__ */ new Map();\n\tif (namespace) collectBlockDescriptors(namespace, byKeyword);\n\treturn { byKeyword };\n}\nfunction collectBlockDescriptors(namespace, byKeyword) {\n\tfor (const value of Object.values(namespace)) {\n\t\tif (isAuthoringPslBlockDescriptor(value)) {\n\t\t\tbyKeyword.set(value.keyword, value);\n\t\t\tcontinue;\n\t\t}\n\t\tif (typeof value === \"object\" && value !== null && !Array.isArray(value)) collectBlockDescriptors(value, byKeyword);\n\t}\n}\nfunction escapePslString(value) {\n\treturn value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, \"\\\\\\\"\").replace(/\\n/g, \"\\\\n\").replace(/\\r/g, \"\\\\r\");\n}\nfunction serializePrintDocument(doc, options = {}) {\n\tconst sections = [];\n\tsections.push(doc.headerComment);\n\tconst namedTypeEntries = [...doc.namedTypes].sort((a, b) => a.name.localeCompare(b.name));\n\tif (namedTypeEntries.length > 0) sections.push(serializeTypesBlock(namedTypeEntries));\n\tconst blockDispatchMap = buildPslBlockDispatchMap(options.pslBlockDescriptors);\n\tfor (const namespace of doc.namespaces) {\n\t\tconst namespaceSections = serializeNamespaceContents(namespace, blockDispatchMap, options.codecLookup);\n\t\tif (namespaceSections.length === 0) continue;\n\t\tif (namespace.name === UNSPECIFIED_PSL_NAMESPACE_ID) sections.push(...namespaceSections);\n\t\telse sections.push(wrapNamespaceBlock(namespace.name, namespaceSections));\n\t}\n\treturn `${sections.join(\"\\n\\n\")}\\n`;\n}\nfunction serializeNamespaceContents(namespace, blockDispatchMap, codecLookup) {\n\tconst sections = [];\n\tfor (const model of namespace.models) sections.push(serializeModel(model));\n\tfor (const extensionBlock of namespace.extensionBlocks) sections.push(serializeExtensionBlock(extensionBlock, blockDispatchMap, codecLookup));\n\treturn sections;\n}\nfunction serializeExtensionBlock(extensionBlock, blockDispatchMap, codecLookup) {\n\tconst descriptor = blockDispatchMap.byKeyword.get(extensionBlock.keyword);\n\tif (!descriptor) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `No pslBlockDescriptors contribution registered for extension-contributed block keyword \"${extensionBlock.keyword}\". Provide a matching pslBlockDescriptors contribution to serializePrintDocument, or remove the block from the input AST.`, { meta: {\n\t\treason: \"block-descriptor-missing\",\n\t\tkeyword: extensionBlock.keyword\n\t} });\n\tif (descriptor.discriminator !== extensionBlock.kind) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `The pslBlockDescriptors contribution for keyword \"${extensionBlock.keyword}\" owns discriminator \"${descriptor.discriminator}\", but the block carries kind \"${extensionBlock.kind}\". Provide a matching pslBlockDescriptors contribution to serializePrintDocument, or remove the block from the input AST.`, { meta: {\n\t\treason: \"block-descriptor-kind-mismatch\",\n\t\tkeyword: extensionBlock.keyword,\n\t\tdescriptorDiscriminator: descriptor.discriminator,\n\t\tblockKind: extensionBlock.kind\n\t} });\n\tconst lines = [`${extensionBlock.keyword} ${extensionBlock.name} {`];\n\tfor (const [paramName, paramDescriptor] of Object.entries(descriptor.parameters)) {\n\t\tconst paramValue = extensionBlock.parameters[paramName];\n\t\tif (paramValue === void 0) continue;\n\t\tconst rendered = renderParamValue(paramValue, paramDescriptor, codecLookup, paramName);\n\t\tlines.push(`${PSL_INDENT_UNIT}${paramName} = ${rendered}`);\n\t}\n\tif (descriptor.variadicParameters) for (const [paramName, paramValue] of Object.entries(extensionBlock.parameters)) {\n\t\tif (Object.hasOwn(descriptor.parameters, paramName)) continue;\n\t\tlines.push(`${PSL_INDENT_UNIT}${renderVariadicParam(paramName, paramValue)}`);\n\t}\n\tfor (const attr of extensionBlock.blockAttributes ?? []) {\n\t\tconst args = attr.args.map((arg) => arg.value).join(\", \");\n\t\tlines.push(`${PSL_INDENT_UNIT}@@${attr.name}${args.length > 0 ? `(${args})` : \"\"}`);\n\t}\n\tlines.push(\"}\");\n\treturn lines.join(\"\\n\");\n}\n/**\n* Renders one undeclared parameter of a `variadicParameters` block (e.g. a\n* `native_enum` member line). Variadic entries have no per-parameter\n* descriptor, so there is no codec to round-trip a `value` through — the raw\n* PSL literal is emitted verbatim. A `bare` entry is just its key.\n*/\nfunction renderVariadicParam(paramName, paramValue) {\n\tif (paramValue.kind === \"bare\") return paramName;\n\treturn `${paramName} = ${renderVariadicValue(paramValue)}`;\n}\nfunction renderVariadicValue(paramValue) {\n\tswitch (paramValue.kind) {\n\t\tcase \"bare\": return \"\";\n\t\tcase \"value\": return paramValue.raw;\n\t\tcase \"ref\": return paramValue.identifier;\n\t\tcase \"option\": return paramValue.token;\n\t\tcase \"list\": return `[${paramValue.items.map(renderVariadicValue).join(\", \")}]`;\n\t}\n}\nfunction renderParamValue(paramValue, descriptor, codecLookup, paramName) {\n\tswitch (descriptor.kind) {\n\t\tcase \"ref\":\n\t\t\tif (paramValue.kind !== \"ref\") throw paramKindMismatchError(paramName, \"ref\", paramValue.kind);\n\t\t\treturn paramValue.identifier;\n\t\tcase \"value\":\n\t\t\tif (paramValue.kind !== \"value\") throw paramKindMismatchError(paramName, \"value\", paramValue.kind);\n\t\t\treturn renderValueParam(paramValue.raw, descriptor.codecId, codecLookup, paramName);\n\t\tcase \"option\":\n\t\t\tif (paramValue.kind !== \"option\") throw paramKindMismatchError(paramName, \"option\", paramValue.kind);\n\t\t\treturn paramValue.token;\n\t\tcase \"list\":\n\t\t\tif (paramValue.kind !== \"list\") throw paramKindMismatchError(paramName, \"list\", paramValue.kind);\n\t\t\treturn `[${paramValue.items.map((item) => renderParamValue(item, descriptor.of, codecLookup, paramName)).join(\", \")}]`;\n\t}\n}\nfunction paramKindMismatchError(paramName, descriptorKind, valueKind) {\n\treturn contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Extension block parameter \"${paramName}\": descriptor is \"${descriptorKind}\" but AST node has kind \"${valueKind}\"`, { meta: {\n\t\treason: \"param-kind-mismatch\",\n\t\tparamName,\n\t\tdescriptorKind,\n\t\tvalueKind\n\t} });\n}\nfunction renderValueParam(raw, codecId, codecLookup, paramName) {\n\tif (!codecLookup) return raw;\n\tconst codec = codecLookup.get(codecId);\n\tif (!codec) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Extension block parameter \"${paramName}\": no codec registered for id \"${codecId}\"`, { meta: {\n\t\treason: \"codec-unregistered\",\n\t\tparamName,\n\t\tcodecId\n\t} });\n\tlet parsedJson;\n\ttry {\n\t\tparsedJson = JSON.parse(raw);\n\t} catch (e) {\n\t\tthrow contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Extension block parameter \"${paramName}\": codec \"${codecId}\" — raw literal is not valid JSON: ${String(e)}`, {\n\t\t\tmeta: {\n\t\t\t\treason: \"raw-literal-invalid-json\",\n\t\t\t\tparamName,\n\t\t\t\tcodecId\n\t\t\t},\n\t\t\tcause: e\n\t\t});\n\t}\n\treturn JSON.stringify(codec.encodeJson(codec.decodeJson(blindCast(parsedJson))));\n}\nfunction wrapNamespaceBlock(name, innerSections) {\n\treturn `namespace ${name} {\\n${innerSections.map((section) => section.split(\"\\n\").map((line) => line.length > 0 ? ` ${line}` : line).join(\"\\n\")).join(\"\\n\\n\")}\\n}`;\n}\nfunction serializeTypesBlock(namedTypes) {\n\tconst lines = [\"types {\"];\n\tfor (const nt of namedTypes) {\n\t\tconst attrStr = nt.attributes.length > 0 ? ` ${nt.attributes.join(\" \")}` : \"\";\n\t\tlines.push(` ${nt.name} = ${nt.baseType}${attrStr}`);\n\t}\n\tlines.push(\"}\");\n\treturn lines.join(\"\\n\");\n}\nfunction serializeModel(model) {\n\tconst lines = [];\n\tif (model.comment) lines.push(model.comment);\n\tlines.push(`model ${model.name} {`);\n\tconst idFields = model.fields.filter((f) => f.isId);\n\tconst scalarFields = model.fields.filter((f) => !f.isId && !f.isRelation);\n\tconst relationFields = model.fields.filter((f) => f.isRelation);\n\tconst allOrderedFields = [\n\t\t...idFields,\n\t\t...scalarFields,\n\t\t...relationFields\n\t];\n\tif (allOrderedFields.length > 0) {\n\t\tconst maxNameLen = Math.max(...allOrderedFields.map((f) => f.name.length));\n\t\tconst maxTypeLen = Math.max(...allOrderedFields.map((f) => formatFieldType(f).length));\n\t\tfor (const field of allOrderedFields) {\n\t\t\tconst typePart = formatFieldType(field);\n\t\t\tconst paddedName = field.name.padEnd(maxNameLen);\n\t\t\tconst paddedType = typePart.padEnd(maxTypeLen);\n\t\t\tif (field.comment) lines.push(` ${field.comment}`);\n\t\t\tconst attrStr = field.attributes.length > 0 ? ` ${field.attributes.join(\" \")}` : \"\";\n\t\t\tlines.push(` ${paddedName} ${paddedType}${attrStr}`.trimEnd());\n\t\t}\n\t}\n\tif (model.modelAttributes.length > 0) {\n\t\tif (allOrderedFields.length > 0) lines.push(\"\");\n\t\tfor (const attr of model.modelAttributes) lines.push(` ${attr}`);\n\t}\n\tlines.push(\"}\");\n\treturn lines.join(\"\\n\");\n}\nfunction formatFieldType(field) {\n\tlet type = field.typeName;\n\tif (field.list) type += \"[]\";\n\telse if (field.optional) type += \"?\";\n\treturn type;\n}\n//#endregion\n//#region src/ast-to-print-document.ts\nconst DEFAULT_AST_PRINT_HEADER = \"// use prisma-next\\n// Contract inferred from the live database schema. Edit as needed, then run `prisma contract emit`.\";\nfunction astDocumentToPrintDocument(ast) {\n\tconst allModels = flatPslModels(ast);\n\tconst sortedModels = topologicalSortModels(allModels, buildModelFkDeps(allModels, new Set(allModels.map((m) => m.name))));\n\tconst namedTypes = ast.types ? ast.types.declarations.map(namedTypeDeclarationToPrinterNamedType) : [];\n\tconst modelOrder = new Map(sortedModels.map((model, index) => [model.name, index]));\n\tconst sectionsByName = /* @__PURE__ */ new Map();\n\tfor (const namespace of ast.namespaces) {\n\t\tconst section = sectionsByName.get(namespace.name) ?? {\n\t\t\tmodels: /* @__PURE__ */ new Map(),\n\t\t\tblocks: /* @__PURE__ */ new Map()\n\t\t};\n\t\tfor (const model of namespace.models) section.models.set(model.name, model);\n\t\tfor (const block of namespacePslExtensionBlocks(namespace)) section.blocks.set(`${block.kind} ${block.name}`, block);\n\t\tsectionsByName.set(namespace.name, section);\n\t}\n\tconst unranked = sortedModels.length;\n\tconst namespaceSections = [...sectionsByName].map(([name, section]) => ({\n\t\tname,\n\t\tmodels: [...section.models.values()].sort((a, b) => (modelOrder.get(a.name) ?? unranked) - (modelOrder.get(b.name) ?? unranked)).map((m) => modelToPrinterModel(m)),\n\t\textensionBlocks: [...section.blocks.values()]\n\t}));\n\tnamespaceSections.sort((a, b) => {\n\t\tif (a.name === b.name) return 0;\n\t\tif (a.name === UNSPECIFIED_PSL_NAMESPACE_ID) return -1;\n\t\tif (b.name === UNSPECIFIED_PSL_NAMESPACE_ID) return 1;\n\t\treturn a.name < b.name ? -1 : 1;\n\t});\n\treturn {\n\t\theaderComment: DEFAULT_AST_PRINT_HEADER,\n\t\tnamedTypes,\n\t\tnamespaces: namespaceSections\n\t};\n}\nfunction renderPslAttribute(attr) {\n\tconst prefix = attr.target === \"model\" || attr.target === \"enum\" ? \"@@\" : \"@\";\n\tif (attr.args.length === 0) return `${prefix}${attr.name}`;\n\tconst inner = attr.args.map(renderAttributeArgument).join(\", \");\n\treturn `${prefix}${attr.name}(${inner})`;\n}\nfunction renderAttributeArgument(arg) {\n\tif (arg.kind === \"positional\") return arg.value;\n\treturn `${arg.name}: ${arg.value}`;\n}\nfunction namedTypeDeclarationToPrinterNamedType(decl) {\n\tconst base = decl.baseType ?? (decl.typeConstructor !== void 0 ? formatTypeConstructor(decl.typeConstructor) : \"\");\n\tconst attributes = decl.attributes.map(renderPslAttribute);\n\treturn {\n\t\tname: decl.name,\n\t\tbaseType: base,\n\t\tattributes\n\t};\n}\nfunction formatTypeConstructor(tc) {\n\tconst path = tc.path.join(\".\");\n\tif (tc.args.length === 0) return path;\n\treturn `${path}(${tc.args.map(renderAttributeArgument).join(\", \")})`;\n}\nfunction getPositionalStringArg(attr, index) {\n\tconst raw = attr.args.filter((a) => a.kind === \"positional\")[index]?.value.trim();\n\tif (!raw) return void 0;\n\tconst m = raw.match(/^(['\"])(.*)\\1$/);\n\tif (!m) return void 0;\n\treturn unescapePslString(m[2]);\n}\n/**\n* Inverse of `escapePslString`. The parser stores quoted-literal arguments with\n* their PSL escape sequences (`\\\\`, `\\\"`, `\\n`, `\\r`) intact; when we round-trip\n* a value through `getPositionalStringArg` and re-render via `escapePslString`,\n* we must decode it once on extraction to avoid double-escaping the same\n* sequences on output.\n*/\nfunction unescapePslString(value) {\n\tlet result = \"\";\n\tfor (let i = 0; i < value.length; i++) {\n\t\tif (value.charCodeAt(i) !== 92 || i + 1 >= value.length) {\n\t\t\tresult += value[i];\n\t\t\tcontinue;\n\t\t}\n\t\tconst next = value[i + 1];\n\t\tif (next === \"\\\\\" || next === \"\\\"\" || next === \"'\") result += next;\n\t\telse if (next === \"n\") result += \"\\n\";\n\t\telse if (next === \"r\") result += \"\\r\";\n\t\telse {\n\t\t\tresult += \"\\\\\";\n\t\t\tresult += next;\n\t\t}\n\t\ti++;\n\t}\n\treturn result;\n}\nfunction modelToPrinterModel(model) {\n\tlet mapName;\n\tconst modelAttrStrings = [];\n\tfor (const a of model.attributes) {\n\t\tif (a.name === \"map\" && a.target === \"model\") {\n\t\t\tmapName = getPositionalStringArg(a, 0) ?? mapName;\n\t\t\tcontinue;\n\t\t}\n\t\tmodelAttrStrings.push(renderPslAttribute(a));\n\t}\n\tif (mapName !== void 0) modelAttrStrings.push(`@@map(\"${escapePslString(mapName)}\")`);\n\tconst printerFields = model.fields.map((f) => fieldToPrinterField(f));\n\treturn {\n\t\tname: model.name,\n\t\tmapName,\n\t\tfields: printerFields,\n\t\tmodelAttributes: modelAttrStrings,\n\t\tcomment: model.comment\n\t};\n}\n/**\n* Assembles the qualified type name string for a field type reference.\n*\n* Handles all four forms:\n* - `space:ns.Name` — typeContractSpaceId + typeNamespaceId + typeName\n* - `space:Name` — typeContractSpaceId + typeName (no namespace)\n* - `ns.Name` — typeNamespaceId + typeName (no space); fixes TML-2459 printer gap\n* - `Name` — typeName only (no qualifier)\n*/\nfunction assembleQualifiedTypeName(field) {\n\tconst { typeName, typeNamespaceId, typeContractSpaceId } = field;\n\tconst dotted = typeNamespaceId !== void 0 ? `${typeNamespaceId}.${typeName}` : typeName;\n\treturn typeContractSpaceId !== void 0 ? `${typeContractSpaceId}:${dotted}` : dotted;\n}\nfunction fieldToPrinterField(field) {\n\tconst typeName = field.typeConstructor !== void 0 ? formatTypeConstructor(field.typeConstructor) : assembleQualifiedTypeName(field);\n\tlet mapName;\n\tconst attrStrings = [];\n\tfor (const a of field.attributes) {\n\t\tif (a.name === \"map\" && a.target === \"field\") {\n\t\t\tmapName = getPositionalStringArg(a, 0) ?? mapName;\n\t\t\tcontinue;\n\t\t}\n\t\tattrStrings.push(renderPslAttribute(a));\n\t}\n\tif (mapName !== void 0) attrStrings.push(`@map(\"${escapePslString(mapName)}\")`);\n\tconst isRelation = field.attributes.some((a) => a.name === \"relation\" && a.target === \"field\");\n\tconst isUnsupported = typeName.startsWith(\"Unsupported(\");\n\tconst isId = field.attributes.some((a) => a.name === \"id\" && a.target === \"field\");\n\treturn {\n\t\tname: field.name,\n\t\ttypeName,\n\t\toptional: field.optional,\n\t\tlist: field.list,\n\t\tattributes: attrStrings,\n\t\tmapName,\n\t\tisId,\n\t\tisRelation,\n\t\tisUnsupported,\n\t\tcomment: void 0\n\t};\n}\nfunction buildModelFkDeps(models, modelNames) {\n\tconst deps = /* @__PURE__ */ new Map();\n\tfor (const m of models) deps.set(m.name, /* @__PURE__ */ new Set());\n\tfor (const m of models) for (const field of m.fields) {\n\t\tconst refModel = relationReferencedModel(field, modelNames);\n\t\tif (!refModel || refModel === m.name) continue;\n\t\tif (!hasFullRelation(field)) continue;\n\t\tdeps.get(m.name).add(refModel);\n\t}\n\treturn deps;\n}\nfunction hasFullRelation(field) {\n\tconst rel = field.attributes.find((a) => a.name === \"relation\" && a.target === \"field\");\n\tif (!rel) return false;\n\tconst named = Object.fromEntries(rel.args.filter((a) => a.kind === \"named\").map((a) => [a.name, a.value.trim()]));\n\treturn named[\"fields\"] !== void 0 && named[\"references\"] !== void 0;\n}\nfunction relationReferencedModel(field, modelNames) {\n\tconst raw = field.typeConstructor?.path[0] ?? field.typeName.replace(/\\?$/, \"\").replace(/\\[\\]$/, \"\");\n\tif (raw.length === 0) return;\n\treturn modelNames.has(raw) ? raw : void 0;\n}\nfunction topologicalSortModels(models, deps) {\n\tconst byName = new Map(models.map((m) => [m.name, m]));\n\tconst result = [];\n\tconst visited = /* @__PURE__ */ new Set();\n\tconst visiting = /* @__PURE__ */ new Set();\n\tconst sortedNames = [...deps.keys()].sort();\n\tfunction visit(name) {\n\t\tif (visited.has(name)) return;\n\t\tif (visiting.has(name)) return;\n\t\tvisiting.add(name);\n\t\tconst sortedDeps = [...deps.get(name) ?? /* @__PURE__ */ new Set()].sort();\n\t\tfor (const dep of sortedDeps) visit(dep);\n\t\tvisiting.delete(name);\n\t\tvisited.add(name);\n\t\tconst model = byName.get(name);\n\t\tif (model) result.push(model);\n\t}\n\tfor (const name of sortedNames) visit(name);\n\treturn result;\n}\n//#endregion\n//#region src/print-psl.ts\nfunction printPslFromAst(ast, options = {}) {\n\treturn serializePrintDocument(astDocumentToPrintDocument(ast), {\n\t\t...ifDefined(\"pslBlockDescriptors\", options.pslBlockDescriptors),\n\t\t...ifDefined(\"codecLookup\", options.codecLookup)\n\t});\n}\n//#endregion\nexport { printPslFromAst as printPsl };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;AAMA,SAAS,cAAc,MAAM,SAAS,SAAS;CAC9C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;;;;AAMA,MAAM,kBAAkB;AACxB,SAAS,yBAAyB,WAAW;CAC5C,MAAM,4BAA4B,IAAI,IAAI;CAC1C,IAAI,WAAW,wBAAwB,WAAW,SAAS;CAC3D,OAAO,EAAE,UAAU;AACpB;AACA,SAAS,wBAAwB,WAAW,WAAW;CACtD,KAAK,MAAM,SAAS,OAAO,OAAO,SAAS,GAAG;EAC7C,IAAI,8BAA8B,KAAK,GAAG;GACzC,UAAU,IAAI,MAAM,SAAS,KAAK;GAClC;EACD;EACA,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK,GAAG,wBAAwB,OAAO,SAAS;CACnH;AACD;AACA,SAAS,gBAAgB,OAAO;CAC/B,OAAO,MAAM,QAAQ,OAAO,MAAM,CAAC,CAAC,QAAQ,MAAM,MAAM,CAAC,CAAC,QAAQ,OAAO,KAAK,CAAC,CAAC,QAAQ,OAAO,KAAK;AACrG;AACA,SAAS,uBAAuB,KAAK,UAAU,CAAC,GAAG;CACl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CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK;CAC1C,SAAS,MAAM,MAAM;EACpB,IAAI,QAAQ,IAAI,IAAI,GAAG;EACvB,IAAI,SAAS,IAAI,IAAI,GAAG;EACxB,SAAS,IAAI,IAAI;EACjB,MAAM,aAAa,CAAC,GAAG,KAAK,IAAI,IAAI,qBAAqB,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK;EACzE,KAAK,MAAM,OAAO,YAAY,MAAM,GAAG;EACvC,SAAS,OAAO,IAAI;EACpB,QAAQ,IAAI,IAAI;EAChB,MAAM,QAAQ,OAAO,IAAI,IAAI;EAC7B,IAAI,OAAO,OAAO,KAAK,KAAK;CAC7B;CACA,KAAK,MAAM,QAAQ,aAAa,MAAM,IAAI;CAC1C,OAAO;AACR;AAGA,SAAS,gBAAgB,KAAK,UAAU,CAAC,GAAG;CAC3C,OAAO,uBAAuB,2BAA2B,GAAG,GAAG;EAC9D,GAAG,UAAU,uBAAuB,QAAQ,mBAAmB;EAC/D,GAAG,UAAU,eAAe,QAAQ,WAAW;CAChD,CAAC;AACF"}
1
+ {"version":3,"file":"psl-printer.mjs","names":[],"sources":["../../../../1-framework/2-authoring/psl-printer/dist/index.mjs"],"sourcesContent":["import { ifDefined } from \"@internal/utils/defined\";\nimport { UNSPECIFIED_PSL_NAMESPACE_ID, flatPslModels, namespacePslExtensionBlocks } from \"@internal/framework-components/psl-ast\";\nimport { isAuthoringPslBlockDescriptor } from \"@internal/framework-components/authoring\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/contract-errors.ts\nfunction contractError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/serialize-print-document.ts\n/**\n* Indent unit used for PSL block bodies and namespace nesting.\n*/\nconst PSL_INDENT_UNIT = \" \";\nfunction buildPslBlockDispatchMap(namespace) {\n\tconst byKeyword = /* @__PURE__ */ new Map();\n\tif (namespace) collectBlockDescriptors(namespace, byKeyword);\n\treturn { byKeyword };\n}\nfunction collectBlockDescriptors(namespace, byKeyword) {\n\tfor (const value of Object.values(namespace)) {\n\t\tif (isAuthoringPslBlockDescriptor(value)) {\n\t\t\tbyKeyword.set(value.keyword, value);\n\t\t\tcontinue;\n\t\t}\n\t\tif (typeof value === \"object\" && value !== null && !Array.isArray(value)) collectBlockDescriptors(value, byKeyword);\n\t}\n}\nfunction escapePslString(value) {\n\treturn value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, \"\\\\\\\"\").replace(/\\n/g, \"\\\\n\").replace(/\\r/g, \"\\\\r\");\n}\nfunction serializePrintDocument(doc, options = {}) {\n\tconst sections = [];\n\tsections.push(doc.headerComment);\n\tconst namedTypeEntries = [...doc.namedTypes].sort((a, b) => a.name.localeCompare(b.name));\n\tif (namedTypeEntries.length > 0) sections.push(serializeTypesBlock(namedTypeEntries));\n\tconst blockDispatchMap = buildPslBlockDispatchMap(options.pslBlockDescriptors);\n\tfor (const namespace of doc.namespaces) {\n\t\tconst namespaceSections = serializeNamespaceContents(namespace, blockDispatchMap, options.codecLookup);\n\t\tif (namespaceSections.length === 0) continue;\n\t\tif (namespace.name === UNSPECIFIED_PSL_NAMESPACE_ID) sections.push(...namespaceSections);\n\t\telse sections.push(wrapNamespaceBlock(namespace.name, namespaceSections));\n\t}\n\treturn `${sections.join(\"\\n\\n\")}\\n`;\n}\nfunction serializeNamespaceContents(namespace, blockDispatchMap, codecLookup) {\n\tconst sections = [];\n\tfor (const model of namespace.models) sections.push(serializeModel(model));\n\tfor (const extensionBlock of namespace.extensionBlocks) sections.push(serializeExtensionBlock(extensionBlock, blockDispatchMap, codecLookup));\n\treturn sections;\n}\nfunction serializeExtensionBlock(extensionBlock, blockDispatchMap, codecLookup) {\n\tconst descriptor = blockDispatchMap.byKeyword.get(extensionBlock.keyword);\n\tif (!descriptor) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `No pslBlockDescriptors contribution registered for extension-contributed block keyword \"${extensionBlock.keyword}\". Provide a matching pslBlockDescriptors contribution to serializePrintDocument, or remove the block from the input AST.`, { meta: {\n\t\treason: \"block-descriptor-missing\",\n\t\tkeyword: extensionBlock.keyword\n\t} });\n\tif (descriptor.discriminator !== extensionBlock.kind) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `The pslBlockDescriptors contribution for keyword \"${extensionBlock.keyword}\" owns discriminator \"${descriptor.discriminator}\", but the block carries kind \"${extensionBlock.kind}\". Provide a matching pslBlockDescriptors contribution to serializePrintDocument, or remove the block from the input AST.`, { meta: {\n\t\treason: \"block-descriptor-kind-mismatch\",\n\t\tkeyword: extensionBlock.keyword,\n\t\tdescriptorDiscriminator: descriptor.discriminator,\n\t\tblockKind: extensionBlock.kind\n\t} });\n\tconst lines = [`${extensionBlock.keyword} ${extensionBlock.name} {`];\n\tfor (const [paramName, paramDescriptor] of Object.entries(descriptor.parameters)) {\n\t\tconst paramValue = extensionBlock.parameters[paramName];\n\t\tif (paramValue === void 0) continue;\n\t\tconst rendered = renderParamValue(paramValue, paramDescriptor, codecLookup, paramName);\n\t\tlines.push(`${PSL_INDENT_UNIT}${paramName} = ${rendered}`);\n\t}\n\tif (descriptor.variadicParameters) for (const [paramName, paramValue] of Object.entries(extensionBlock.parameters)) {\n\t\tif (Object.hasOwn(descriptor.parameters, paramName)) continue;\n\t\tlines.push(`${PSL_INDENT_UNIT}${renderVariadicParam(paramName, paramValue)}`);\n\t}\n\tfor (const attr of extensionBlock.blockAttributes ?? []) {\n\t\tconst args = attr.args.map((arg) => arg.value).join(\", \");\n\t\tlines.push(`${PSL_INDENT_UNIT}@@${attr.name}${args.length > 0 ? `(${args})` : \"\"}`);\n\t}\n\tlines.push(\"}\");\n\treturn lines.join(\"\\n\");\n}\n/**\n* Renders one undeclared parameter of a `variadicParameters` block (e.g. a\n* `native_enum` member line). Variadic entries have no per-parameter\n* descriptor, so there is no codec to round-trip a `value` through — the raw\n* PSL literal is emitted verbatim. A `bare` entry is just its key.\n*/\nfunction renderVariadicParam(paramName, paramValue) {\n\tif (paramValue.kind === \"bare\") return paramName;\n\treturn `${paramName} = ${renderVariadicValue(paramValue)}`;\n}\nfunction renderVariadicValue(paramValue) {\n\tswitch (paramValue.kind) {\n\t\tcase \"bare\": return \"\";\n\t\tcase \"value\": return paramValue.raw;\n\t\tcase \"ref\": return paramValue.identifier;\n\t\tcase \"option\": return paramValue.token;\n\t\tcase \"list\": return `[${paramValue.items.map(renderVariadicValue).join(\", \")}]`;\n\t}\n}\nfunction renderParamValue(paramValue, descriptor, codecLookup, paramName) {\n\tswitch (descriptor.kind) {\n\t\tcase \"ref\":\n\t\t\tif (paramValue.kind !== \"ref\") throw paramKindMismatchError(paramName, \"ref\", paramValue.kind);\n\t\t\treturn paramValue.identifier;\n\t\tcase \"value\":\n\t\t\tif (paramValue.kind !== \"value\") throw paramKindMismatchError(paramName, \"value\", paramValue.kind);\n\t\t\treturn renderValueParam(paramValue.raw, descriptor.codecId, codecLookup, paramName);\n\t\tcase \"option\":\n\t\t\tif (paramValue.kind !== \"option\") throw paramKindMismatchError(paramName, \"option\", paramValue.kind);\n\t\t\treturn paramValue.token;\n\t\tcase \"list\":\n\t\t\tif (paramValue.kind !== \"list\") throw paramKindMismatchError(paramName, \"list\", paramValue.kind);\n\t\t\treturn `[${paramValue.items.map((item) => renderParamValue(item, descriptor.of, codecLookup, paramName)).join(\", \")}]`;\n\t}\n}\nfunction paramKindMismatchError(paramName, descriptorKind, valueKind) {\n\treturn contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Extension block parameter \"${paramName}\": descriptor is \"${descriptorKind}\" but AST node has kind \"${valueKind}\"`, { meta: {\n\t\treason: \"param-kind-mismatch\",\n\t\tparamName,\n\t\tdescriptorKind,\n\t\tvalueKind\n\t} });\n}\nfunction renderValueParam(raw, codecId, codecLookup, paramName) {\n\tif (!codecLookup) return raw;\n\tconst codec = codecLookup.get(codecId);\n\tif (!codec) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Extension block parameter \"${paramName}\": no codec registered for id \"${codecId}\"`, { meta: {\n\t\treason: \"codec-unregistered\",\n\t\tparamName,\n\t\tcodecId\n\t} });\n\tlet parsedJson;\n\ttry {\n\t\tparsedJson = JSON.parse(raw);\n\t} catch (e) {\n\t\tthrow contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Extension block parameter \"${paramName}\": codec \"${codecId}\" — raw literal is not valid JSON: ${String(e)}`, {\n\t\t\tmeta: {\n\t\t\t\treason: \"raw-literal-invalid-json\",\n\t\t\t\tparamName,\n\t\t\t\tcodecId\n\t\t\t},\n\t\t\tcause: e\n\t\t});\n\t}\n\treturn JSON.stringify(codec.encodeJson(codec.decodeJson(blindCast(parsedJson))));\n}\nfunction wrapNamespaceBlock(name, innerSections) {\n\treturn `namespace ${name} {\\n${innerSections.map((section) => section.split(\"\\n\").map((line) => line.length > 0 ? ` ${line}` : line).join(\"\\n\")).join(\"\\n\\n\")}\\n}`;\n}\nfunction serializeTypesBlock(namedTypes) {\n\tconst lines = [\"types {\"];\n\tfor (const nt of namedTypes) {\n\t\tconst attrStr = nt.attributes.length > 0 ? ` ${nt.attributes.join(\" \")}` : \"\";\n\t\tlines.push(` ${nt.name} = ${nt.baseType}${attrStr}`);\n\t}\n\tlines.push(\"}\");\n\treturn lines.join(\"\\n\");\n}\nfunction serializeModel(model) {\n\tconst lines = [];\n\tif (model.comment) lines.push(model.comment);\n\tlines.push(`model ${model.name} {`);\n\tconst idFields = model.fields.filter((f) => f.isId);\n\tconst scalarFields = model.fields.filter((f) => !f.isId && !f.isRelation);\n\tconst relationFields = model.fields.filter((f) => f.isRelation);\n\tconst allOrderedFields = [\n\t\t...idFields,\n\t\t...scalarFields,\n\t\t...relationFields\n\t];\n\tif (allOrderedFields.length > 0) {\n\t\tconst maxNameLen = Math.max(...allOrderedFields.map((f) => f.name.length));\n\t\tconst maxTypeLen = Math.max(...allOrderedFields.map((f) => formatFieldType(f).length));\n\t\tfor (const field of allOrderedFields) {\n\t\t\tconst typePart = formatFieldType(field);\n\t\t\tconst paddedName = field.name.padEnd(maxNameLen);\n\t\t\tconst paddedType = typePart.padEnd(maxTypeLen);\n\t\t\tif (field.comment) lines.push(` ${field.comment}`);\n\t\t\tconst attrStr = field.attributes.length > 0 ? ` ${field.attributes.join(\" \")}` : \"\";\n\t\t\tlines.push(` ${paddedName} ${paddedType}${attrStr}`.trimEnd());\n\t\t}\n\t}\n\tif (model.modelAttributes.length > 0) {\n\t\tif (allOrderedFields.length > 0) lines.push(\"\");\n\t\tfor (const attr of model.modelAttributes) lines.push(` ${attr}`);\n\t}\n\tlines.push(\"}\");\n\treturn lines.join(\"\\n\");\n}\nfunction formatFieldType(field) {\n\tlet type = field.typeName;\n\tif (field.list) type += \"[]\";\n\telse if (field.optional) type += \"?\";\n\treturn type;\n}\n//#endregion\n//#region src/ast-to-print-document.ts\nconst DEFAULT_AST_PRINT_HEADER = \"// use prisma-8\\n// Contract inferred from the live database schema. Edit as needed, then run `prisma contract emit`.\";\nfunction astDocumentToPrintDocument(ast) {\n\tconst allModels = flatPslModels(ast);\n\tconst sortedModels = topologicalSortModels(allModels, buildModelFkDeps(allModels, new Set(allModels.map((m) => m.name))));\n\tconst namedTypes = ast.types ? ast.types.declarations.map(namedTypeDeclarationToPrinterNamedType) : [];\n\tconst modelOrder = new Map(sortedModels.map((model, index) => [model.name, index]));\n\tconst sectionsByName = /* @__PURE__ */ new Map();\n\tfor (const namespace of ast.namespaces) {\n\t\tconst section = sectionsByName.get(namespace.name) ?? {\n\t\t\tmodels: /* @__PURE__ */ new Map(),\n\t\t\tblocks: /* @__PURE__ */ new Map()\n\t\t};\n\t\tfor (const model of namespace.models) section.models.set(model.name, model);\n\t\tfor (const block of namespacePslExtensionBlocks(namespace)) section.blocks.set(`${block.kind} ${block.name}`, block);\n\t\tsectionsByName.set(namespace.name, section);\n\t}\n\tconst unranked = sortedModels.length;\n\tconst namespaceSections = [...sectionsByName].map(([name, section]) => ({\n\t\tname,\n\t\tmodels: [...section.models.values()].sort((a, b) => (modelOrder.get(a.name) ?? unranked) - (modelOrder.get(b.name) ?? unranked)).map((m) => modelToPrinterModel(m)),\n\t\textensionBlocks: [...section.blocks.values()]\n\t}));\n\tnamespaceSections.sort((a, b) => {\n\t\tif (a.name === b.name) return 0;\n\t\tif (a.name === UNSPECIFIED_PSL_NAMESPACE_ID) return -1;\n\t\tif (b.name === UNSPECIFIED_PSL_NAMESPACE_ID) return 1;\n\t\treturn a.name < b.name ? -1 : 1;\n\t});\n\treturn {\n\t\theaderComment: DEFAULT_AST_PRINT_HEADER,\n\t\tnamedTypes,\n\t\tnamespaces: namespaceSections\n\t};\n}\nfunction renderPslAttribute(attr) {\n\tconst prefix = attr.target === \"model\" || attr.target === \"enum\" ? \"@@\" : \"@\";\n\tif (attr.args.length === 0) return `${prefix}${attr.name}`;\n\tconst inner = attr.args.map(renderAttributeArgument).join(\", \");\n\treturn `${prefix}${attr.name}(${inner})`;\n}\nfunction renderAttributeArgument(arg) {\n\tif (arg.kind === \"positional\") return arg.value;\n\treturn `${arg.name}: ${arg.value}`;\n}\nfunction namedTypeDeclarationToPrinterNamedType(decl) {\n\tconst base = decl.baseType ?? (decl.typeConstructor !== void 0 ? formatTypeConstructor(decl.typeConstructor) : \"\");\n\tconst attributes = decl.attributes.map(renderPslAttribute);\n\treturn {\n\t\tname: decl.name,\n\t\tbaseType: base,\n\t\tattributes\n\t};\n}\nfunction formatTypeConstructor(tc) {\n\tconst path = tc.path.join(\".\");\n\tif (tc.args.length === 0) return path;\n\treturn `${path}(${tc.args.map(renderAttributeArgument).join(\", \")})`;\n}\nfunction getPositionalStringArg(attr, index) {\n\tconst raw = attr.args.filter((a) => a.kind === \"positional\")[index]?.value.trim();\n\tif (!raw) return void 0;\n\tconst m = raw.match(/^(['\"])(.*)\\1$/);\n\tif (!m) return void 0;\n\treturn unescapePslString(m[2]);\n}\n/**\n* Inverse of `escapePslString`. The parser stores quoted-literal arguments with\n* their PSL escape sequences (`\\\\`, `\\\"`, `\\n`, `\\r`) intact; when we round-trip\n* a value through `getPositionalStringArg` and re-render via `escapePslString`,\n* we must decode it once on extraction to avoid double-escaping the same\n* sequences on output.\n*/\nfunction unescapePslString(value) {\n\tlet result = \"\";\n\tfor (let i = 0; i < value.length; i++) {\n\t\tif (value.charCodeAt(i) !== 92 || i + 1 >= value.length) {\n\t\t\tresult += value[i];\n\t\t\tcontinue;\n\t\t}\n\t\tconst next = value[i + 1];\n\t\tif (next === \"\\\\\" || next === \"\\\"\" || next === \"'\") result += next;\n\t\telse if (next === \"n\") result += \"\\n\";\n\t\telse if (next === \"r\") result += \"\\r\";\n\t\telse {\n\t\t\tresult += \"\\\\\";\n\t\t\tresult += next;\n\t\t}\n\t\ti++;\n\t}\n\treturn result;\n}\nfunction modelToPrinterModel(model) {\n\tlet mapName;\n\tconst modelAttrStrings = [];\n\tfor (const a of model.attributes) {\n\t\tif (a.name === \"map\" && a.target === \"model\") {\n\t\t\tmapName = getPositionalStringArg(a, 0) ?? mapName;\n\t\t\tcontinue;\n\t\t}\n\t\tmodelAttrStrings.push(renderPslAttribute(a));\n\t}\n\tif (mapName !== void 0) modelAttrStrings.push(`@@map(\"${escapePslString(mapName)}\")`);\n\tconst printerFields = model.fields.map((f) => fieldToPrinterField(f));\n\treturn {\n\t\tname: model.name,\n\t\tmapName,\n\t\tfields: printerFields,\n\t\tmodelAttributes: modelAttrStrings,\n\t\tcomment: model.comment\n\t};\n}\n/**\n* Assembles the qualified type name string for a field type reference.\n*\n* Handles all four forms:\n* - `space:ns.Name` — typeContractSpaceId + typeNamespaceId + typeName\n* - `space:Name` — typeContractSpaceId + typeName (no namespace)\n* - `ns.Name` — typeNamespaceId + typeName (no space); fixes TML-2459 printer gap\n* - `Name` — typeName only (no qualifier)\n*/\nfunction assembleQualifiedTypeName(field) {\n\tconst { typeName, typeNamespaceId, typeContractSpaceId } = field;\n\tconst dotted = typeNamespaceId !== void 0 ? `${typeNamespaceId}.${typeName}` : typeName;\n\treturn typeContractSpaceId !== void 0 ? `${typeContractSpaceId}:${dotted}` : dotted;\n}\nfunction fieldToPrinterField(field) {\n\tconst typeName = field.typeConstructor !== void 0 ? formatTypeConstructor(field.typeConstructor) : assembleQualifiedTypeName(field);\n\tlet mapName;\n\tconst attrStrings = [];\n\tfor (const a of field.attributes) {\n\t\tif (a.name === \"map\" && a.target === \"field\") {\n\t\t\tmapName = getPositionalStringArg(a, 0) ?? mapName;\n\t\t\tcontinue;\n\t\t}\n\t\tattrStrings.push(renderPslAttribute(a));\n\t}\n\tif (mapName !== void 0) attrStrings.push(`@map(\"${escapePslString(mapName)}\")`);\n\tconst isRelation = field.attributes.some((a) => a.name === \"relation\" && a.target === \"field\");\n\tconst isUnsupported = typeName.startsWith(\"Unsupported(\");\n\tconst isId = field.attributes.some((a) => a.name === \"id\" && a.target === \"field\");\n\treturn {\n\t\tname: field.name,\n\t\ttypeName,\n\t\toptional: field.optional,\n\t\tlist: field.list,\n\t\tattributes: attrStrings,\n\t\tmapName,\n\t\tisId,\n\t\tisRelation,\n\t\tisUnsupported,\n\t\tcomment: void 0\n\t};\n}\nfunction buildModelFkDeps(models, modelNames) {\n\tconst deps = /* @__PURE__ */ new Map();\n\tfor (const m of models) deps.set(m.name, /* @__PURE__ */ new Set());\n\tfor (const m of models) for (const field of m.fields) {\n\t\tconst refModel = relationReferencedModel(field, modelNames);\n\t\tif (!refModel || refModel === m.name) continue;\n\t\tif (!hasFullRelation(field)) continue;\n\t\tdeps.get(m.name).add(refModel);\n\t}\n\treturn deps;\n}\nfunction hasFullRelation(field) {\n\tconst rel = field.attributes.find((a) => a.name === \"relation\" && a.target === \"field\");\n\tif (!rel) return false;\n\tconst named = Object.fromEntries(rel.args.filter((a) => a.kind === \"named\").map((a) => [a.name, a.value.trim()]));\n\treturn named[\"fields\"] !== void 0 && named[\"references\"] !== void 0;\n}\nfunction relationReferencedModel(field, modelNames) {\n\tconst raw = field.typeConstructor?.path[0] ?? field.typeName.replace(/\\?$/, \"\").replace(/\\[\\]$/, \"\");\n\tif (raw.length === 0) return;\n\treturn modelNames.has(raw) ? raw : void 0;\n}\nfunction topologicalSortModels(models, deps) {\n\tconst byName = new Map(models.map((m) => [m.name, m]));\n\tconst result = [];\n\tconst visited = /* @__PURE__ */ new Set();\n\tconst visiting = /* @__PURE__ */ new Set();\n\tconst sortedNames = [...deps.keys()].sort();\n\tfunction visit(name) {\n\t\tif (visited.has(name)) return;\n\t\tif (visiting.has(name)) return;\n\t\tvisiting.add(name);\n\t\tconst sortedDeps = [...deps.get(name) ?? /* @__PURE__ */ new Set()].sort();\n\t\tfor (const dep of sortedDeps) visit(dep);\n\t\tvisiting.delete(name);\n\t\tvisited.add(name);\n\t\tconst model = byName.get(name);\n\t\tif (model) result.push(model);\n\t}\n\tfor (const name of sortedNames) visit(name);\n\treturn result;\n}\n//#endregion\n//#region src/print-psl.ts\nfunction printPslFromAst(ast, options = {}) {\n\treturn serializePrintDocument(astDocumentToPrintDocument(ast), {\n\t\t...ifDefined(\"pslBlockDescriptors\", options.pslBlockDescriptors),\n\t\t...ifDefined(\"codecLookup\", options.codecLookup)\n\t});\n}\n//#endregion\nexport { printPslFromAst as printPsl };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;AAMA,SAAS,cAAc,MAAM,SAAS,SAAS;CAC9C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;;;;AAMA,MAAM,kBAAkB;AACxB,SAAS,yBAAyB,WAAW;CAC5C,MAAM,4BAA4B,IAAI,IAAI;CAC1C,IAAI,WAAW,wBAAwB,WAAW,SAAS;CAC3D,OAAO,EAAE,UAAU;AACpB;AACA,SAAS,wBAAwB,WAAW,WAAW;CACtD,KAAK,MAAM,SAAS,OAAO,OAAO,SAAS,GAAG;EAC7C,IAAI,8BAA8B,KAAK,GAAG;GACzC,UAAU,IAAI,MAAM,SAAS,KAAK;GAClC;EACD;EACA,IAAI,OAAO,UAAU,YAAY,U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GAAG;CACtB,OAAO,WAAW,IAAI,GAAG,IAAI,MAAM,KAAK;AACzC;AACA,SAAS,sBAAsB,QAAQ,MAAM;CAC5C,MAAM,SAAS,IAAI,IAAI,OAAO,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;CACrD,MAAM,SAAS,CAAC;CAChB,MAAM,0BAA0B,IAAI,IAAI;CACxC,MAAM,2BAA2B,IAAI,IAAI;CACzC,MAAM,cAAc,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK;CAC1C,SAAS,MAAM,MAAM;EACpB,IAAI,QAAQ,IAAI,IAAI,GAAG;EACvB,IAAI,SAAS,IAAI,IAAI,GAAG;EACxB,SAAS,IAAI,IAAI;EACjB,MAAM,aAAa,CAAC,GAAG,KAAK,IAAI,IAAI,qBAAqB,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK;EACzE,KAAK,MAAM,OAAO,YAAY,MAAM,GAAG;EACvC,SAAS,OAAO,IAAI;EACpB,QAAQ,IAAI,IAAI;EAChB,MAAM,QAAQ,OAAO,IAAI,IAAI;EAC7B,IAAI,OAAO,OAAO,KAAK,KAAK;CAC7B;CACA,KAAK,MAAM,QAAQ,aAAa,MAAM,IAAI;CAC1C,OAAO;AACR;AAGA,SAAS,gBAAgB,KAAK,UAAU,CAAC,GAAG;CAC3C,OAAO,uBAAuB,2BAA2B,GAAG,GAAG;EAC9D,GAAG,UAAU,uBAAuB,QAAQ,mBAAmB;EAC/D,GAAG,UAAU,eAAe,QAAQ,WAAW;CAChD,CAAC;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-framework",
3
- "version": "8.0.0-rc.9-dev.9",
3
+ "version": "8.0.0-rc.9-dev.10",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -15,20 +15,20 @@
15
15
  "uniku": "^0.5.0"
16
16
  },
17
17
  "devDependencies": {
18
- "@internal/config": "8.0.0-rc.9-dev.9",
19
- "@internal/contract": "8.0.0-rc.9-dev.9",
20
- "@internal/contract-authoring": "8.0.0-rc.9-dev.9",
21
- "@internal/errors": "8.0.0-rc.9-dev.9",
22
- "@internal/framework-components": "8.0.0-rc.9-dev.9",
23
- "@internal/ids": "8.0.0-rc.9-dev.9",
24
- "@internal/operations": "8.0.0-rc.9-dev.9",
25
- "@internal/psl-parser": "8.0.0-rc.9-dev.9",
26
- "@internal/psl-printer": "8.0.0-rc.9-dev.9",
27
- "@internal/ts-render": "8.0.0-rc.9-dev.9",
28
- "@repo/tsconfig": "8.0.0-rc.9-dev.9",
29
- "@internal/publish-surface": "8.0.0-rc.9-dev.9",
30
- "@repo/tsdown": "8.0.0-rc.9-dev.9",
31
- "@internal/utils": "8.0.0-rc.9-dev.9",
18
+ "@internal/config": "8.0.0-rc.9-dev.10",
19
+ "@internal/contract": "8.0.0-rc.9-dev.10",
20
+ "@internal/contract-authoring": "8.0.0-rc.9-dev.10",
21
+ "@internal/errors": "8.0.0-rc.9-dev.10",
22
+ "@internal/framework-components": "8.0.0-rc.9-dev.10",
23
+ "@internal/ids": "8.0.0-rc.9-dev.10",
24
+ "@internal/operations": "8.0.0-rc.9-dev.10",
25
+ "@internal/psl-parser": "8.0.0-rc.9-dev.10",
26
+ "@internal/psl-printer": "8.0.0-rc.9-dev.10",
27
+ "@internal/ts-render": "8.0.0-rc.9-dev.10",
28
+ "@repo/tsconfig": "8.0.0-rc.9-dev.10",
29
+ "@internal/publish-surface": "8.0.0-rc.9-dev.10",
30
+ "@repo/tsdown": "8.0.0-rc.9-dev.10",
31
+ "@internal/utils": "8.0.0-rc.9-dev.10",
32
32
  "tsdown": "0.22.14",
33
33
  "typescript": "5.9.3",
34
34
  "vitest": "5.0.0-rc.2"