@prisma-next/framework-components
Advanced tools
| import { n as runtimeError } from "./runtime-error-B2gWOtgH.mjs"; | ||
| import { blindCast } from "@prisma-next/utils/casts"; | ||
| //#region src/shared/resolve-codec.ts | ||
| const CONTRACT_CODEC_DESCRIPTOR_MISSING = "CONTRACT.CODEC_DESCRIPTOR_MISSING"; | ||
| /** | ||
| * Look up a descriptor for `ref.codecId` using `descriptorFor`; throw | ||
| * `code` if none is found. Each plane names its own error path: the control | ||
| * plane resolves contract-stack descriptors (`CONTRACT.*`), the execution | ||
| * plane resolves at query time (`RUNTIME.*`). | ||
| */ | ||
| function resolveCodecDescriptorOrThrow(descriptorFor, ref, code) { | ||
| const descriptor = descriptorFor(ref.codecId); | ||
| if (!descriptor) throw runtimeError(code, `No codec descriptor registered for codecId '${ref.codecId}'.`, { codecId: ref.codecId }); | ||
| return descriptor; | ||
| } | ||
| /** | ||
| * Validates `ref.typeParams` against `descriptor.paramsSchema`. | ||
| * | ||
| * Parameterized codecs that omit `typeParams` have it normalized to `{}` before | ||
| * validation (mirrors `ast-codec-resolver.ts` semantics). Throws | ||
| * `RUNTIME.TYPE_PARAMS_INVALID` when the validator returns a `Promise` or | ||
| * reports issues. | ||
| */ | ||
| function validateCodecTypeParams(descriptor, ref) { | ||
| const normalized = descriptor.isParameterized && ref.typeParams === void 0 ? { | ||
| ...ref, | ||
| typeParams: {} | ||
| } : ref; | ||
| const result = blindCast(descriptor.paramsSchema["~standard"].validate(normalized.typeParams)); | ||
| if (result instanceof Promise) throw runtimeError("RUNTIME.TYPE_PARAMS_INVALID", `paramsSchema for codec '${ref.codecId}' returned a Promise; runtime validation requires a synchronous Standard Schema validator.`, { | ||
| codecId: ref.codecId, | ||
| typeParams: ref.typeParams | ||
| }); | ||
| if ("issues" in result && result.issues) { | ||
| const messages = result.issues.map((issue) => issue.message).join("; "); | ||
| throw runtimeError("RUNTIME.TYPE_PARAMS_INVALID", `Invalid typeParams for codec '${ref.codecId}': ${messages}`, { | ||
| codecId: ref.codecId, | ||
| typeParams: ref.typeParams | ||
| }); | ||
| } | ||
| return blindCast(result).value; | ||
| } | ||
| /** | ||
| * Resolves a `Codec` instance: validates `ref.typeParams` via | ||
| * {@link validateCodecTypeParams} then calls `descriptor.factory(validated)(ctx)`. | ||
| * | ||
| * The descriptor's `factory` is typed against its own `P`; the registry erases | ||
| * `P` to `any`, so the factory is narrowed to `(params: unknown) => (ctx) => Codec` | ||
| * at the call boundary. The `paramsSchema` validates the input above before we | ||
| * forward it, so the narrowing is safe by construction. | ||
| */ | ||
| function materializeCodec(descriptor, ref, ctx) { | ||
| const validated = validateCodecTypeParams(descriptor, ref); | ||
| return blindCast(descriptor.factory)(validated)(ctx); | ||
| } | ||
| //#endregion | ||
| export { validateCodecTypeParams as i, materializeCodec as n, resolveCodecDescriptorOrThrow as r, CONTRACT_CODEC_DESCRIPTOR_MISSING as t }; | ||
| //# sourceMappingURL=resolve-codec-D8EPZosv.mjs.map |
| {"version":3,"file":"resolve-codec-D8EPZosv.mjs","names":[],"sources":["../src/shared/resolve-codec.ts"],"sourcesContent":["import { blindCast } from '@prisma-next/utils/casts';\nimport type { Codec } from './codec';\nimport type { AnyCodecDescriptor } from './codec-descriptor';\nimport type { CodecInstanceContext, CodecRef } from './codec-types';\nimport { runtimeError } from './runtime-error';\n\nexport const CONTRACT_CODEC_DESCRIPTOR_MISSING = 'CONTRACT.CODEC_DESCRIPTOR_MISSING' as const;\n\n/**\n * Look up a descriptor for `ref.codecId` using `descriptorFor`; throw\n * `code` if none is found. Each plane names its own error path: the control\n * plane resolves contract-stack descriptors (`CONTRACT.*`), the execution\n * plane resolves at query time (`RUNTIME.*`).\n */\nexport function resolveCodecDescriptorOrThrow(\n descriptorFor: (codecId: string) => AnyCodecDescriptor | undefined,\n ref: CodecRef,\n code: 'CONTRACT.CODEC_DESCRIPTOR_MISSING' | 'RUNTIME.CODEC_DESCRIPTOR_MISSING',\n): AnyCodecDescriptor {\n const descriptor = descriptorFor(ref.codecId);\n if (!descriptor) {\n throw runtimeError(code, `No codec descriptor registered for codecId '${ref.codecId}'.`, {\n codecId: ref.codecId,\n });\n }\n return descriptor;\n}\n\n/**\n * Validates `ref.typeParams` against `descriptor.paramsSchema`.\n *\n * Parameterized codecs that omit `typeParams` have it normalized to `{}` before\n * validation (mirrors `ast-codec-resolver.ts` semantics). Throws\n * `RUNTIME.TYPE_PARAMS_INVALID` when the validator returns a `Promise` or\n * reports issues.\n */\nexport function validateCodecTypeParams(descriptor: AnyCodecDescriptor, ref: CodecRef): unknown {\n const normalized =\n descriptor.isParameterized && ref.typeParams === undefined ? { ...ref, typeParams: {} } : ref;\n\n const result = blindCast<\n { value: unknown } | { issues: ReadonlyArray<{ message: string }> } | Promise<unknown>,\n 'Standard Schema validate returns unknown; the spec guarantees this union shape'\n >(descriptor.paramsSchema['~standard'].validate(normalized.typeParams));\n\n if (result instanceof Promise) {\n throw runtimeError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `paramsSchema for codec '${ref.codecId}' returned a Promise; runtime validation requires a synchronous Standard Schema validator.`,\n { codecId: ref.codecId, typeParams: ref.typeParams },\n );\n }\n\n if ('issues' in result && result.issues) {\n const messages = result.issues.map((issue) => issue.message).join('; ');\n throw runtimeError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `Invalid typeParams for codec '${ref.codecId}': ${messages}`,\n { codecId: ref.codecId, typeParams: ref.typeParams },\n );\n }\n\n return blindCast<{ value: unknown }, 'issues guard above rules out the issues branch'>(result)\n .value;\n}\n\n/**\n * Resolves a `Codec` instance: validates `ref.typeParams` via\n * {@link validateCodecTypeParams} then calls `descriptor.factory(validated)(ctx)`.\n *\n * The descriptor's `factory` is typed against its own `P`; the registry erases\n * `P` to `any`, so the factory is narrowed to `(params: unknown) => (ctx) => Codec`\n * at the call boundary. The `paramsSchema` validates the input above before we\n * forward it, so the narrowing is safe by construction.\n */\nexport function materializeCodec(\n descriptor: AnyCodecDescriptor,\n ref: CodecRef,\n ctx: CodecInstanceContext,\n): Codec {\n const validated = validateCodecTypeParams(descriptor, ref);\n return blindCast<\n (params: unknown) => (ctx: CodecInstanceContext) => Codec,\n 'registry erases P to any; paramsSchema validates input before forwarding'\n >(descriptor.factory)(validated)(ctx);\n}\n"],"mappings":";;;AAMA,MAAa,oCAAoC;;;;;;;AAQjD,SAAgB,8BACd,eACA,KACA,MACoB;CACpB,MAAM,aAAa,cAAc,IAAI,OAAO;CAC5C,IAAI,CAAC,YACH,MAAM,aAAa,MAAM,+CAA+C,IAAI,QAAQ,KAAK,EACvF,SAAS,IAAI,QACf,CAAC;CAEH,OAAO;AACT;;;;;;;;;AAUA,SAAgB,wBAAwB,YAAgC,KAAwB;CAC9F,MAAM,aACJ,WAAW,mBAAmB,IAAI,eAAe,KAAA,IAAY;EAAE,GAAG;EAAK,YAAY,CAAC;CAAE,IAAI;CAE5F,MAAM,SAAS,UAGb,WAAW,aAAa,YAAY,CAAC,SAAS,WAAW,UAAU,CAAC;CAEtE,IAAI,kBAAkB,SACpB,MAAM,aACJ,+BACA,2BAA2B,IAAI,QAAQ,6FACvC;EAAE,SAAS,IAAI;EAAS,YAAY,IAAI;CAAW,CACrD;CAGF,IAAI,YAAY,UAAU,OAAO,QAAQ;EACvC,MAAM,WAAW,OAAO,OAAO,KAAK,UAAU,MAAM,OAAO,CAAC,CAAC,KAAK,IAAI;EACtE,MAAM,aACJ,+BACA,iCAAiC,IAAI,QAAQ,KAAK,YAClD;GAAE,SAAS,IAAI;GAAS,YAAY,IAAI;EAAW,CACrD;CACF;CAEA,OAAO,UAAgF,MAAM,CAAC,CAC3F;AACL;;;;;;;;;;AAWA,SAAgB,iBACd,YACA,KACA,KACO;CACP,MAAM,YAAY,wBAAwB,YAAY,GAAG;CACzD,OAAO,UAGL,WAAW,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG;AACtC"} |
+9
-1
@@ -48,3 +48,11 @@ import { a as CodecRef, c as emptyCodecLookup, d as CodecImpl, f as AnyCodecDescriptor, i as CodecMeta, l as voidParamsSchema, m as CodecDescriptorImpl, n as CodecInstanceContext, o as CodecRegistry, p as CodecDescriptor, r as CodecLookup, s as CodecTrait, t as CodecCallContext, u as Codec } from "./codec-types-yY3eSmi0.mjs"; | ||
| //#region src/shared/resolve-codec.d.ts | ||
| declare const CONTRACT_CODEC_DESCRIPTOR_MISSING: "CONTRACT.CODEC_DESCRIPTOR_MISSING"; | ||
| /** | ||
| * Look up a descriptor for `ref.codecId` using `descriptorFor`; throw | ||
| * `code` if none is found. Each plane names its own error path: the control | ||
| * plane resolves contract-stack descriptors (`CONTRACT.*`), the execution | ||
| * plane resolves at query time (`RUNTIME.*`). | ||
| */ | ||
| declare function resolveCodecDescriptorOrThrow(descriptorFor: (codecId: string) => AnyCodecDescriptor | undefined, ref: CodecRef, code: 'CONTRACT.CODEC_DESCRIPTOR_MISSING' | 'RUNTIME.CODEC_DESCRIPTOR_MISSING'): AnyCodecDescriptor; | ||
| /** | ||
| * Validates `ref.typeParams` against `descriptor.paramsSchema`. | ||
@@ -69,3 +77,3 @@ * | ||
| //#endregion | ||
| export { type AnyCodecDescriptor, type Codec, type CodecCallContext, type CodecDescriptor, CodecDescriptorImpl, CodecImpl, type CodecInstanceContext, type CodecLookup, type CodecMeta, type CodecRef, type CodecRegistry, type CodecTrait, type ColumnHelperFor, type ColumnHelperForStrict, type ColumnSpec, type ColumnTypeDescriptor, column, emptyCodecLookup, materializeCodec, validateCodecTypeParams, voidParamsSchema }; | ||
| export { type AnyCodecDescriptor, CONTRACT_CODEC_DESCRIPTOR_MISSING, type Codec, type CodecCallContext, type CodecDescriptor, CodecDescriptorImpl, CodecImpl, type CodecInstanceContext, type CodecLookup, type CodecMeta, type CodecRef, type CodecRegistry, type CodecTrait, type ColumnHelperFor, type ColumnHelperForStrict, type ColumnSpec, type ColumnTypeDescriptor, column, emptyCodecLookup, materializeCodec, resolveCodecDescriptorOrThrow, validateCodecTypeParams, voidParamsSchema }; | ||
| //# sourceMappingURL=codec.d.mts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"codec.d.mts","names":[],"sources":["../src/shared/column-spec.ts","../src/shared/resolve-codec.ts"],"mappings":";;;;;;;;;AAsBkB;KAJN,oBAAA;EAAA,SACD,OAAA,EAAS,QAAA;EAAA,SACT,UAAA;EAAA,SACA,UAAA,GAAa,MAAM;EAAA,SACnB,OAAA;AAAA;;;;;;UAQM,UAAA,cAAwB,MAAA,uCAC/B,oBAAA;EAAA,SACC,YAAA,GAAe,GAAA,EAAK,oBAAA,KAAyB,CAAA;EAAA,SAC7C,UAAA,EAAY,CAAA;AAAA;;;;;;iBAQP,MAAA,cAAoB,MAAA,+BAClC,YAAA,GAAe,GAAA,EAAK,oBAAA,KAAyB,CAAA,EAC7C,OAAA,UACA,UAAA,EAAY,CAAA,EACZ,UAAA,WACC,UAAA,CAAW,CAAA,EAAG,CAAA;AAbO;AAQxB;;;;AARwB,KA4BZ,eAAA,WAA0B,eAAA,aAEjC,IAAA,YACA,UAAA,UAAoB,kBAAA,CAAmB,CAAA;;;;KAMhC,qBAAA,WAAgC,eAAA,aAEvC,IAAA,YACA,UAAA,CAAW,UAAA,CAAW,UAAA,CAAW,CAAA,eAAgB,kBAAA,CAAmB,CAAA;;;;KAMpE,kBAAA,WAA6B,eAAA,SAChC,UAAA,CAAW,CAAA,wBAAyB,MAAA,oBAChC,UAAA,CAAW,CAAA;;;AA/DjB;;;;;;;;AAAA,iBCJgB,uBAAA,CAAwB,UAAA,EAAY,kBAAA,EAAoB,GAAA,EAAK,QAAQ;;;;ADQnE;AAQlB;;;;;iBCuBgB,gBAAA,CACd,UAAA,EAAY,kBAAA,EACZ,GAAA,EAAK,QAAA,EACL,GAAA,EAAK,oBAAA,GACJ,KAAA"} | ||
| {"version":3,"file":"codec.d.mts","names":[],"sources":["../src/shared/column-spec.ts","../src/shared/resolve-codec.ts"],"mappings":";;;;;;;;;AAsBkB;KAJN,oBAAA;EAAA,SACD,OAAA,EAAS,QAAA;EAAA,SACT,UAAA;EAAA,SACA,UAAA,GAAa,MAAM;EAAA,SACnB,OAAA;AAAA;;;;;;UAQM,UAAA,cAAwB,MAAA,uCAC/B,oBAAA;EAAA,SACC,YAAA,GAAe,GAAA,EAAK,oBAAA,KAAyB,CAAA;EAAA,SAC7C,UAAA,EAAY,CAAA;AAAA;;;;;;iBAQP,MAAA,cAAoB,MAAA,+BAClC,YAAA,GAAe,GAAA,EAAK,oBAAA,KAAyB,CAAA,EAC7C,OAAA,UACA,UAAA,EAAY,CAAA,EACZ,UAAA,WACC,UAAA,CAAW,CAAA,EAAG,CAAA;AAbO;AAQxB;;;;AARwB,KA4BZ,eAAA,WAA0B,eAAA,aAEjC,IAAA,YACA,UAAA,UAAoB,kBAAA,CAAmB,CAAA;;;;KAMhC,qBAAA,WAAgC,eAAA,aAEvC,IAAA,YACA,UAAA,CAAW,UAAA,CAAW,UAAA,CAAW,CAAA,eAAgB,kBAAA,CAAmB,CAAA;;;;KAMpE,kBAAA,WAA6B,eAAA,SAChC,UAAA,CAAW,CAAA,wBAAyB,MAAA,oBAChC,UAAA,CAAW,CAAA;;;cC3EJ,iCAAA;;;;;;;iBAQG,6BAAA,CACd,aAAA,GAAgB,OAAA,aAAoB,kBAAA,cACpC,GAAA,EAAK,QAAA,EACL,IAAA,6EACC,kBAAA;;;;;ADIe;AAQlB;;;iBCMgB,uBAAA,CAAwB,UAAA,EAAY,kBAAA,EAAoB,GAAA,EAAK,QAAQ;;;;;;;;;;iBAuCrE,gBAAA,CACd,UAAA,EAAY,kBAAA,EACZ,GAAA,EAAK,QAAA,EACL,GAAA,EAAK,oBAAA,GACJ,KAAA"} |
+2
-2
@@ -1,2 +0,2 @@ | ||
| import { n as validateCodecTypeParams, t as materializeCodec } from "./resolve-codec-DR7uyr_c.mjs"; | ||
| import { i as validateCodecTypeParams, n as materializeCodec, r as resolveCodecDescriptorOrThrow, t as CONTRACT_CODEC_DESCRIPTOR_MISSING } from "./resolve-codec-D8EPZosv.mjs"; | ||
| //#region src/shared/codec.ts | ||
@@ -68,4 +68,4 @@ /** | ||
| //#endregion | ||
| export { CodecDescriptorImpl, CodecImpl, column, emptyCodecLookup, materializeCodec, validateCodecTypeParams, voidParamsSchema }; | ||
| export { CONTRACT_CODEC_DESCRIPTOR_MISSING, CodecDescriptorImpl, CodecImpl, column, emptyCodecLookup, materializeCodec, resolveCodecDescriptorOrThrow, validateCodecTypeParams, voidParamsSchema }; | ||
| //# sourceMappingURL=codec.mjs.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"control.d.mts","names":[],"sources":["../src/control/contract-serializer.ts","../src/control/control-result-types.ts","../src/control/control-instances.ts","../src/control/control-stack.ts","../src/control/control-descriptors.ts","../src/control/control-migration-types.ts","../src/control/control-operation-preview.ts","../src/control/control-schema-view.ts","../src/control/control-capabilities.ts","../src/control/control-spaces.ts","../src/control/schema-verifier.ts","../src/control/verifier-disposition.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmBA;;;;;UAAiB,kBAAA;EAuBa;;;;;;;;;;;EAX5B,mBAAA,WAA8B,SAAA,GAAY,SAAA,EAAW,IAAA,YAAgB,CAAA;EAAA;;;;;;;;;EAWrE,iBAAA,CAAkB,QAAA,EAAU,SAAA,GAAY,UAAA;EAkBN;;;;AC5DpC;;;ED4DoC,SATzB,mBAAA,GAAsB,sBAAA;ECnDM;AACvC;;;;AAAsC;AACtC;EAFuC,SD4D5B,WAAA,GAAc,WAAA;AAAA;;;cC5DZ,0BAAA;AAAA,cACA,yBAAA;AAAA,cACA,2BAAA;AAAA,cACA,0BAAA;AAAA,UAEI,gBAAA;EAAA,SACN,YAAA;EAAA,SACA,UAAA;EAAA,SACA,IAAA,GAAO,QAAQ,CAAC,MAAA;AAAA;AAAA,UAGV,oBAAA;EAAA,SACN,EAAA;EAAA,SACA,IAAA;EAAA,SACA,OAAA;EAAA,SACA,QAAA;IAAA,SACE,WAAA;IAAA,SACA,WAAA;EAAA;EAAA,SAEF,MAAA;IAAA,SACE,WAAA;IAA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;;;;;;;UAYI,oBAAA;EAAA,SACN,IAAA;EAAA,SACA,UAAU;AAAA;;;;;;ATwBe;;;;AC5DpC;;;;AAAuC;UQqDtB,gBAAA;EAAA,SACN,OAAA;EAAA,SACA,QAAA,EAAU,iBAAA;EAAA,SACV,GAAA,WAAc,sBAAsB;AAAA;ARtD/C;;;;AAAwC;AACxC;;;;AAAuC;AAEvC;;;;;;;AAHA,UQ0EiB,aAAA,mBAAgC,QAAA,GAAW,QAAA;EAAA,SACjD,YAAA,EAAc,SAAA;EAAA,SACd,UAAA,WAAqB,gBAAA;EAAA,SACrB,OAAA,EAAS,oBAAA;AAAA;;;;;;;;;;;;;;;AT5DpB;;;;;;;;;;;UUMiB,cAAA;EACf,YAAA,CAAa,OAAA,EAAS,mBAAA,CAAoB,SAAA,EAAW,OAAA,IAAW,kBAAA;AAAA;;;;;;;UASjD,mBAAA;EAAA,SACN,QAAA,EAAU,SAAA;EAAA,SACV,MAAA,EAAQ,OAAO;AAAA;;;;;AVuBU;;;UUbnB,kBAAA;EAAA,SACN,EAAA;EAAA,SACA,MAAA,WAAiB,WAAW;AAAA;;;KC9C3B,kBAAA,GAAqB,sBAAsB;AAAA,KAE3C,eAAA,GAAkB,kBAAkB;;;;;;;;;;AXchD;;;;;;;KWIY,qBAAA;;;;;;;;;;iBAiBI,sBAAA,CACd,aAAA,EAAe,aAAA,EACf,QAAA,EAAU,qBAAA,GACT,eAAA"} | ||
| {"version":3,"file":"control.d.mts","names":[],"sources":["../src/control/contract-serializer.ts","../src/control/control-result-types.ts","../src/control/control-instances.ts","../src/control/control-stack.ts","../src/control/control-descriptors.ts","../src/control/control-migration-types.ts","../src/control/control-operation-preview.ts","../src/control/control-schema-view.ts","../src/control/control-capabilities.ts","../src/control/control-spaces.ts","../src/control/schema-verifier.ts","../src/control/verifier-disposition.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmBA;;;;;UAAiB,kBAAA;EAuBa;;;;;;;;;;;EAX5B,mBAAA,WA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;EAAA,SACA,MAAA,WAAiB,WAAW;AAAA;;;KC9C3B,kBAAA,GAAqB,sBAAsB;AAAA,KAE3C,eAAA,GAAkB,kBAAkB;;;;;;;;;;AXchD;;;;;;;KWIY,qBAAA;;;;;;;;;;iBAiBI,sBAAA,CACd,aAAA,EAAe,aAAA,EACf,QAAA,EAAU,qBAAA,GACT,eAAA"} |
+2
-5
@@ -1,3 +0,2 @@ | ||
| import { n as runtimeError } from "./runtime-error-B2gWOtgH.mjs"; | ||
| import { t as materializeCodec } from "./resolve-codec-DR7uyr_c.mjs"; | ||
| import { n as materializeCodec, r as resolveCodecDescriptorOrThrow, t as CONTRACT_CODEC_DESCRIPTOR_MISSING } from "./resolve-codec-D8EPZosv.mjs"; | ||
| import { c as isAuthoringFieldPresetDescriptor, d as mergeAuthoringNamespaces, l as isAuthoringPslBlockDescriptor, s as isAuthoringEntityTypeDescriptor, t as assertNoCrossRegistryCollisions, u as isAuthoringTypeConstructorDescriptor } from "./framework-authoring-Dv5F3EFC.mjs"; | ||
@@ -208,5 +207,3 @@ import { blindCast } from "@prisma-next/utils/casts"; | ||
| forCodecRef(ref) { | ||
| const d = descriptorsById.get(ref.codecId); | ||
| if (d === void 0) throw runtimeError("RUNTIME.CODEC_DESCRIPTOR_MISSING", `No codec descriptor registered for codecId '${ref.codecId}'.`, { codecId: ref.codecId }); | ||
| return materializeCodec(d, ref, { name: `<ref:${ref.codecId}>` }); | ||
| return materializeCodec(resolveCodecDescriptorOrThrow((id) => descriptorsById.get(id), ref, CONTRACT_CODEC_DESCRIPTOR_MISSING), ref, { name: `<ref:${ref.codecId}>` }); | ||
| }, | ||
@@ -213,0 +210,0 @@ forColumn: () => void 0, |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"control.mjs","names":[],"sources":["../src/control/control-capabilities.ts","../src/control/control-result-types.ts","../src/control/control-schema-view.ts","../src/control/control-spaces.ts","../src/control/control-stack.ts","../src/control/verifier-disposition.ts"],"sourcesContent":["import type { ControlTargetDescriptor } from './control-descriptors';\nimport type { ControlFamilyInstance } from './control-instances';\nimport type { MigrationPlanOperation, TargetMigrationsCapability } from './control-migration-types';\nimport type { OperationPreview } from './control-operation-preview';\nimport type { CoreSchemaView } from './control-schema-view';\nimport type { PslDocumentAst } from './psl-ast';\n\nexport interface MigratableTargetDescriptor<\n TFamilyId extends string,\n TTargetId extends string,\n TFamilyInstance extends ControlFamilyInstance<TFamilyId, unknown> = ControlFamilyInstance<\n TFamilyId,\n unknown\n >,\n> extends ControlTargetDescriptor<TFamilyId, TTargetId> {\n readonly migrations: TargetMigrationsCapability<TFamilyId, TTargetId, TFamilyInstance>;\n}\n\nexport function hasMigrations<TFamilyId extends string, TTargetId extends string>(\n target: ControlTargetDescriptor<TFamilyId, TTargetId>,\n): target is MigratableTargetDescriptor<TFamilyId, TTargetId> {\n return 'migrations' in target && !!(target as Record<string, unknown>)['migrations'];\n}\n\nexport interface SchemaViewCapable<TSchemaIR = unknown> {\n toSchemaView(schema: TSchemaIR): CoreSchemaView;\n}\n\nexport function hasSchemaView<TFamilyId extends string, TSchemaIR>(\n instance: ControlFamilyInstance<TFamilyId, TSchemaIR>,\n): instance is ControlFamilyInstance<TFamilyId, TSchemaIR> & SchemaViewCapable<TSchemaIR> {\n return (\n 'toSchemaView' in instance &&\n typeof (instance as Record<string, unknown>)['toSchemaView'] === 'function'\n );\n}\n\n/**\n * Capability declaring that a family can infer a PSL contract AST from its\n * opaque introspected schema IR. Consumed by `prisma-next contract infer`.\n */\nexport interface PslContractInferCapable<TSchemaIR = unknown> {\n inferPslContract(schemaIR: TSchemaIR): PslDocumentAst;\n}\n\nexport function hasPslContractInfer<TFamilyId extends string, TSchemaIR>(\n instance: ControlFamilyInstance<TFamilyId, TSchemaIR>,\n): instance is ControlFamilyInstance<TFamilyId, TSchemaIR> & PslContractInferCapable<TSchemaIR> {\n return (\n 'inferPslContract' in instance &&\n typeof (instance as Record<string, unknown>)['inferPslContract'] === 'function'\n );\n}\n\n/**\n * Capability declaring that a family can render a textual preview of migration\n * operations for the CLI's \"DDL preview\" output. SQL families emit\n * `language: 'sql'` statements; Mongo families emit `language: 'mongodb-shell'`.\n */\nexport interface OperationPreviewCapable {\n toOperationPreview(operations: readonly MigrationPlanOperation[]): OperationPreview;\n}\n\nexport function hasOperationPreview<TFamilyId extends string, TSchemaIR>(\n instance: ControlFamilyInstance<TFamilyId, TSchemaIR>,\n): instance is ControlFamilyInstance<TFamilyId, TSchemaIR> & OperationPreviewCapable {\n return (\n 'toOperationPreview' in instance &&\n typeof (instance as Record<string, unknown>)['toOperationPreview'] === 'function'\n );\n}\n","export const VERIFY_CODE_MARKER_MISSING = 'PN-RUN-3001';\nexport const VERIFY_CODE_HASH_MISMATCH = 'PN-RUN-3002';\nexport const VERIFY_CODE_TARGET_MISMATCH = 'PN-RUN-3003';\nexport const VERIFY_CODE_SCHEMA_FAILURE = 'PN-RUN-3010';\n\nexport interface OperationContext {\n readonly contractPath?: string;\n readonly configPath?: string;\n readonly meta?: Readonly<Record<string, unknown>>;\n}\n\nexport interface VerifyDatabaseResult {\n readonly ok: boolean;\n readonly code?: string;\n readonly summary: string;\n readonly contract: {\n readonly storageHash: string;\n readonly profileHash?: string;\n };\n readonly marker?: {\n readonly storageHash?: string;\n readonly profileHash?: string;\n };\n readonly target: {\n readonly expected: string;\n readonly actual?: string;\n };\n readonly missingCodecs?: readonly string[];\n readonly codecCoverageSkipped?: boolean;\n readonly meta?: {\n readonly configPath?: string;\n readonly contractPath: string;\n };\n readonly timings: {\n readonly total: number;\n };\n}\n\nexport interface BaseSchemaIssue {\n readonly kind:\n | 'missing_schema'\n | 'missing_table'\n | 'missing_column'\n | 'extra_table'\n | 'extra_column'\n | 'extra_primary_key'\n | 'extra_foreign_key'\n | 'extra_unique_constraint'\n | 'extra_index'\n | 'extra_validator'\n | 'type_mismatch'\n | 'type_missing'\n | 'type_values_mismatch'\n | 'nullability_mismatch'\n | 'primary_key_mismatch'\n | 'foreign_key_mismatch'\n | 'unique_constraint_mismatch'\n | 'index_mismatch'\n | 'default_missing'\n | 'default_mismatch'\n | 'extra_default'\n | 'check_missing'\n | 'check_removed'\n | 'check_mismatch';\n readonly table?: string;\n /**\n * Namespace coordinate of the issue's subject (e.g. the schema a SQL\n * table lives in). Populated by family verifiers that have the\n * coordinate in scope when constructing the issue; absent for issues\n * whose family has no namespace concept (e.g. Mongo collections) or\n * whose subject isn't in any contract namespace (e.g. an extra-table\n * issue raised for a table that exists in the live DB but not in the\n * contract).\n *\n * Downstream planners trust this field as the authoritative subject\n * coordinate and do not re-derive it by name lookup. A finer-grained\n * structural split between framework-shared and family-specific issue\n * fields is tracked under a follow-up ticket.\n */\n readonly namespaceId?: string;\n readonly column?: string;\n readonly indexOrConstraint?: string;\n readonly typeName?: string;\n readonly expected?: string;\n readonly actual?: string;\n readonly message: string;\n}\n\nexport interface EnumValuesChangedIssue {\n readonly kind: 'enum_values_changed';\n /**\n * Namespace coordinate of the enum type that changed values. Populated by\n * family verifiers that have the coordinate in scope when constructing the\n * issue. Downstream planners trust this field as the authoritative subject\n * coordinate and do not re-derive it by name lookup.\n */\n readonly namespaceId: string;\n readonly typeName: string;\n readonly addedValues: readonly string[];\n readonly removedValues: readonly string[];\n readonly message: string;\n}\n\nexport type SchemaIssue = BaseSchemaIssue | EnumValuesChangedIssue;\n\nexport interface SchemaVerificationNode {\n readonly status: 'pass' | 'warn' | 'fail';\n readonly kind: string;\n readonly name: string;\n readonly contractPath: string;\n readonly code: string;\n readonly message: string;\n readonly expected: unknown;\n readonly actual: unknown;\n readonly children: readonly SchemaVerificationNode[];\n}\n\nexport interface VerifyDatabaseSchemaResult {\n readonly ok: boolean;\n readonly code?: string;\n readonly summary: string;\n readonly contract: {\n readonly storageHash: string;\n readonly profileHash?: string;\n };\n readonly target: {\n readonly expected: string;\n readonly actual?: string;\n };\n readonly schema: {\n readonly issues: readonly SchemaIssue[];\n readonly root: SchemaVerificationNode;\n readonly counts: {\n readonly pass: number;\n readonly warn: number;\n readonly fail: number;\n readonly totalNodes: number;\n };\n };\n readonly meta?: {\n readonly configPath?: string;\n readonly contractPath?: string;\n readonly strict: boolean;\n };\n readonly timings: {\n readonly total: number;\n };\n}\n\nexport interface EmitContractResult {\n readonly contractJson: string;\n readonly contractDts: string;\n readonly storageHash: string;\n readonly executionHash?: string;\n readonly profileHash: string;\n}\n\nexport interface IntrospectSchemaResult<TSchemaIR> {\n readonly ok: true;\n readonly summary: string;\n readonly target: {\n readonly familyId: string;\n readonly id: string;\n };\n readonly schema: TSchemaIR;\n readonly meta?: {\n readonly configPath?: string;\n readonly dbUrl?: string;\n };\n readonly timings: {\n readonly total: number;\n };\n}\n\nexport interface SignDatabaseResult {\n readonly ok: boolean;\n readonly summary: string;\n readonly contract: {\n readonly storageHash: string;\n readonly profileHash?: string;\n };\n readonly target: {\n readonly expected: string;\n readonly actual?: string;\n };\n readonly marker: {\n readonly created: boolean;\n readonly updated: boolean;\n readonly previous?: {\n readonly storageHash?: string;\n readonly profileHash?: string;\n };\n };\n readonly meta?: {\n readonly configPath?: string;\n readonly contractPath: string;\n };\n readonly timings: {\n readonly total: number;\n };\n}\n","/**\n * Core schema view types for family-agnostic schema visualization.\n *\n * These types provide a minimal, generic, tree-shaped representation of schemas\n * across families, designed for CLI visualization and lightweight tooling.\n *\n * Families can optionally project their family-specific Schema IR into this\n * core view via the `toSchemaView` method on `FamilyInstance`.\n */\n\nexport type SchemaViewNodeKind =\n | 'root'\n | 'namespace'\n | 'collection'\n | 'entity'\n | 'field'\n | 'index'\n | 'dependency';\n\nexport interface SchemaTreeVisitor<R> {\n visit(node: SchemaTreeNode): R;\n}\n\nexport interface SchemaTreeNodeOptions {\n readonly kind: SchemaViewNodeKind;\n readonly id: string;\n readonly label: string;\n readonly meta?: Record<string, unknown>;\n readonly children?: readonly SchemaTreeNode[];\n}\n\nexport class SchemaTreeNode {\n readonly kind: SchemaViewNodeKind;\n readonly id: string;\n readonly label: string;\n readonly meta?: Record<string, unknown>;\n readonly children?: readonly SchemaTreeNode[];\n\n constructor(options: SchemaTreeNodeOptions) {\n this.kind = options.kind;\n this.id = options.id;\n this.label = options.label;\n if (options.meta !== undefined) this.meta = options.meta;\n if (options.children !== undefined) this.children = options.children;\n Object.freeze(this);\n }\n\n accept<R>(visitor: SchemaTreeVisitor<R>): R {\n return visitor.visit(this);\n }\n}\n\n/**\n * Core schema view providing a family-agnostic tree representation of a schema.\n * Used by CLI and cross-family tooling for visualization.\n */\nexport interface CoreSchemaView {\n readonly root: SchemaTreeNode;\n}\n","import type { Contract } from '@prisma-next/contract/types';\nimport type { MigrationMetadata, MigrationPlanOperation } from './control-migration-types';\n\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 */\nexport const APP_SPACE_ID = 'app' as const;\n\n/**\n * Head ref for a contract space — the `(hash, invariants)` tuple\n * a runner targets when applying that space's migration graph. Identical\n * in shape to the on-disk `migrations/<space-id>/refs/head.json` the\n * framework writes per loaded extension, and to the app-space\n * `<projectRoot>/refs/head.json`. Family-agnostic: SQL, Mongo, and any\n * future family share the same head-ref shape.\n *\n * @see specs/framework-mechanism.spec.md § 1.\n */\nexport interface ContractSpaceHeadRef {\n readonly hash: string;\n readonly invariants: readonly string[];\n}\n\n/**\n * Canonical structural shape of a migration package — the unit a planner\n * produces and a runner consumes: a directory name, the metadata\n * envelope, and the operation list.\n *\n * In-memory by default. Readers in `@prisma-next/migration-tools`\n * (`readMigrationPackage` / `readMigrationsDir`) return the augmented\n * {@link import('@prisma-next/migration-tools/package').OnDiskMigrationPackage}\n * variant which adds `dirPath`; everything else operates against the\n * canonical shape so the same value flows through pre-emission\n * authoring, on-disk loading, and runner execution without conversion.\n *\n * @see specs/framework-mechanism.spec.md § 1.\n */\nexport interface MigrationPackage {\n readonly dirName: string;\n readonly metadata: MigrationMetadata;\n readonly ops: readonly MigrationPlanOperation[];\n}\n\n/**\n * Canonical structural shape of a contract space — one disjoint\n * `(contractJson, migration-graph)` unit the per-space planner / runner\n * / verifier operates on. The application owns one well-known space\n * ({@link APP_SPACE_ID}); each loaded extension that contributes schema\n * owns a uniquely-named space. Whether a value is the app's space or an\n * extension's space is a control-plane concern; the type carries no\n * such distinction.\n *\n * Generic over the contract so each family pins a typed contract value\n * at consumption time. The SQL family specialises to\n * `ContractSpace<Contract<SqlStorage>>` at the descriptor surface;\n * Mongo's symmetrical `ContractSpace<Contract<MongoStorage>>` will land\n * with that family.\n *\n * @see specs/framework-mechanism.spec.md § 1.\n */\nexport interface ContractSpace<TContract extends Contract = Contract> {\n readonly contractJson: TContract;\n readonly migrations: readonly MigrationPackage[];\n readonly headRef: ContractSpaceHeadRef;\n}\n","import { blindCast } from '@prisma-next/utils/casts';\nimport type { Codec } from '../shared/codec';\nimport type { AnyCodecDescriptor } from '../shared/codec-descriptor';\nimport type { CodecLookup, CodecMeta, CodecRef, CodecRegistry } from '../shared/codec-types';\nimport type {\n AuthoringContributions,\n AuthoringEntityTypeNamespace,\n AuthoringFieldNamespace,\n AuthoringPslBlockDescriptorNamespace,\n AuthoringTypeNamespace,\n} from '../shared/framework-authoring';\nimport {\n assertNoCrossRegistryCollisions,\n isAuthoringEntityTypeDescriptor,\n isAuthoringFieldPresetDescriptor,\n isAuthoringPslBlockDescriptor,\n isAuthoringTypeConstructorDescriptor,\n mergeAuthoringNamespaces,\n} from '../shared/framework-authoring';\nimport type { ComponentMetadata } from '../shared/framework-components';\nimport type {\n ControlMutationDefaultEntry,\n ControlMutationDefaults,\n MutationDefaultGeneratorDescriptor,\n} from '../shared/mutation-default-types';\nimport { materializeCodec } from '../shared/resolve-codec';\nimport { runtimeError } from '../shared/runtime-error';\nimport type { TypesImportSpec } from '../shared/types-import-spec';\nimport type {\n ControlAdapterDescriptor,\n ControlDriverDescriptor,\n ControlExtensionDescriptor,\n ControlFamilyDescriptor,\n ControlTargetDescriptor,\n} from './control-descriptors';\n\nexport interface AssembledAuthoringContributions {\n readonly field: AuthoringFieldNamespace;\n readonly type: AuthoringTypeNamespace;\n readonly entityTypes: AuthoringEntityTypeNamespace;\n readonly pslBlockDescriptors: AuthoringPslBlockDescriptorNamespace;\n}\n\nexport interface ControlStack<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> {\n readonly family: ControlFamilyDescriptor<TFamilyId>;\n readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter?: ControlAdapterDescriptor<TFamilyId, TTargetId> | undefined;\n readonly driver?: ControlDriverDescriptor<TFamilyId, TTargetId> | undefined;\n readonly extensionPacks: readonly ControlExtensionDescriptor<TFamilyId, TTargetId>[];\n\n readonly codecTypeImports: ReadonlyArray<TypesImportSpec>;\n readonly queryOperationTypeImports: ReadonlyArray<TypesImportSpec>;\n readonly extensionIds: ReadonlyArray<string>;\n readonly codecLookup: CodecRegistry;\n readonly authoringContributions: AssembledAuthoringContributions;\n readonly scalarTypeDescriptors: ReadonlyMap<string, string>;\n readonly controlMutationDefaults: ControlMutationDefaults;\n}\n\nexport interface CreateControlStackInput<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> {\n readonly family: ControlFamilyDescriptor<TFamilyId>;\n readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter?: ControlAdapterDescriptor<TFamilyId, TTargetId> | undefined;\n readonly driver?: ControlDriverDescriptor<TFamilyId, TTargetId> | undefined;\n readonly extensionPacks?:\n | ReadonlyArray<ControlExtensionDescriptor<TFamilyId, TTargetId>>\n | undefined;\n}\n\nfunction addUniqueId(ids: string[], seen: Set<string>, id: string): void {\n if (!seen.has(id)) {\n ids.push(id);\n seen.add(id);\n }\n}\n\nexport function assertUniqueCodecOwner(options: {\n readonly codecId: string;\n readonly owners: Map<string, string>;\n readonly descriptorId: string;\n readonly entityLabel: string;\n readonly entityOwnershipLabel: string;\n}): void {\n const existingOwner = options.owners.get(options.codecId);\n if (existingOwner !== undefined) {\n throw new Error(\n `Duplicate ${options.entityLabel} for codecId \"${options.codecId}\". ` +\n `Descriptor \"${options.descriptorId}\" conflicts with \"${existingOwner}\". ` +\n `Each codecId can only have one ${options.entityOwnershipLabel}.`,\n );\n }\n}\n\nexport function extractCodecTypeImports(\n descriptors: ReadonlyArray<Pick<ComponentMetadata, 'types'>>,\n): ReadonlyArray<TypesImportSpec> {\n const imports: TypesImportSpec[] = [];\n\n for (const descriptor of descriptors) {\n const codecTypes = descriptor.types?.codecTypes;\n if (codecTypes?.import) {\n imports.push(codecTypes.import);\n }\n if (codecTypes?.typeImports) {\n imports.push(...codecTypes.typeImports);\n }\n }\n\n return imports;\n}\n\nexport function extractQueryOperationTypeImports(\n descriptors: ReadonlyArray<Pick<ComponentMetadata, 'types'>>,\n): ReadonlyArray<TypesImportSpec> {\n const imports: TypesImportSpec[] = [];\n\n for (const descriptor of descriptors) {\n const queryOperationTypes = descriptor.types?.queryOperationTypes;\n if (queryOperationTypes?.import) {\n imports.push(queryOperationTypes.import);\n }\n }\n\n return imports;\n}\n\nexport function extractComponentIds(\n family: { readonly id: string },\n target: { readonly id: string },\n adapter: { readonly id: string } | undefined,\n extensions: ReadonlyArray<{ readonly id: string }>,\n): ReadonlyArray<string> {\n const ids: string[] = [];\n const seen = new Set<string>();\n\n addUniqueId(ids, seen, family.id);\n addUniqueId(ids, seen, target.id);\n if (adapter) {\n addUniqueId(ids, seen, adapter.id);\n }\n\n for (const ext of extensions) {\n addUniqueId(ids, seen, ext.id);\n }\n\n return ids;\n}\n\nexport function assembleAuthoringContributions(\n descriptors: ReadonlyArray<{ readonly authoring?: AuthoringContributions }>,\n): AssembledAuthoringContributions {\n const field = {} as Record<string, unknown>;\n const type = {} as Record<string, unknown>;\n const entityTypes = {} as Record<string, unknown>;\n const pslBlockDescriptors: Record<string, unknown> = {};\n\n for (const descriptor of descriptors) {\n if (descriptor.authoring?.field) {\n mergeAuthoringNamespaces(\n field,\n descriptor.authoring.field,\n [],\n isAuthoringFieldPresetDescriptor,\n 'field',\n );\n }\n if (descriptor.authoring?.type) {\n mergeAuthoringNamespaces(\n type,\n descriptor.authoring.type,\n [],\n isAuthoringTypeConstructorDescriptor,\n 'type',\n );\n }\n if (descriptor.authoring?.entityTypes) {\n mergeAuthoringNamespaces(\n entityTypes,\n descriptor.authoring.entityTypes,\n [],\n isAuthoringEntityTypeDescriptor,\n 'entity',\n );\n }\n if (descriptor.authoring?.pslBlockDescriptors) {\n mergeAuthoringNamespaces(\n pslBlockDescriptors,\n descriptor.authoring.pslBlockDescriptors,\n [],\n isAuthoringPslBlockDescriptor,\n 'pslBlock',\n );\n }\n }\n\n const fieldNamespace = field as AuthoringFieldNamespace;\n const typeNamespace = type as AuthoringTypeNamespace;\n const entityTypeNamespace = entityTypes as AuthoringEntityTypeNamespace;\n const pslBlockDescriptorNamespace = blindCast<\n AuthoringPslBlockDescriptorNamespace,\n 'merge target accumulator narrows to typed namespace post-merge'\n >(pslBlockDescriptors);\n assertNoCrossRegistryCollisions(\n typeNamespace,\n fieldNamespace,\n entityTypeNamespace,\n pslBlockDescriptorNamespace,\n );\n\n return {\n field: fieldNamespace,\n type: typeNamespace,\n entityTypes: entityTypeNamespace,\n pslBlockDescriptors: pslBlockDescriptorNamespace,\n };\n}\n\nexport function assembleScalarTypeDescriptors(\n descriptors: ReadonlyArray<\n Pick<ComponentMetadata, 'scalarTypeDescriptors'> & { readonly id?: string }\n >,\n): ReadonlyMap<string, string> {\n const result = new Map<string, string>();\n const owners = new Map<string, string>();\n\n for (const descriptor of descriptors) {\n const descriptorMap = descriptor.scalarTypeDescriptors;\n if (!descriptorMap) continue;\n const descriptorId = descriptor.id ?? '<unknown>';\n for (const [typeName, codecId] of descriptorMap) {\n const existingOwner = owners.get(typeName);\n if (existingOwner !== undefined) {\n throw new Error(\n `Duplicate scalar type descriptor \"${typeName}\". ` +\n `Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\".`,\n );\n }\n result.set(typeName, codecId);\n owners.set(typeName, descriptorId);\n }\n }\n\n return result;\n}\n\nexport function assembleControlMutationDefaults(\n descriptors: ReadonlyArray<\n Pick<ComponentMetadata, 'controlMutationDefaults'> & { readonly id?: string }\n >,\n): ControlMutationDefaults {\n const defaultFunctionRegistry = new Map<string, ControlMutationDefaultEntry>();\n const functionOwners = new Map<string, string>();\n const generatorMap = new Map<string, MutationDefaultGeneratorDescriptor>();\n const generatorOwners = new Map<string, string>();\n\n for (const descriptor of descriptors) {\n const contributions = descriptor.controlMutationDefaults;\n if (!contributions) continue;\n const descriptorId = descriptor.id ?? '<unknown>';\n\n for (const generatorDescriptor of contributions.generatorDescriptors) {\n const existingOwner = generatorOwners.get(generatorDescriptor.id);\n if (existingOwner !== undefined) {\n throw new Error(\n `Duplicate mutation default generator id \"${generatorDescriptor.id}\". ` +\n `Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\".`,\n );\n }\n generatorMap.set(generatorDescriptor.id, generatorDescriptor);\n generatorOwners.set(generatorDescriptor.id, descriptorId);\n }\n\n for (const [functionName, handler] of contributions.defaultFunctionRegistry) {\n const existingOwner = functionOwners.get(functionName);\n if (existingOwner !== undefined) {\n throw new Error(\n `Duplicate mutation default function \"${functionName}\". ` +\n `Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\".`,\n );\n }\n defaultFunctionRegistry.set(functionName, handler);\n functionOwners.set(functionName, descriptorId);\n }\n }\n\n return {\n defaultFunctionRegistry,\n generatorDescriptors: Array.from(generatorMap.values()),\n };\n}\n\nexport function extractCodecLookup(\n descriptors: ReadonlyArray<Pick<ComponentMetadata & { id: string }, 'types' | 'id'>>,\n): CodecRegistry {\n const byId = new Map<string, Codec>();\n const descriptorsById = new Map<string, AnyCodecDescriptor>();\n const targetTypesById = new Map<string, readonly string[]>();\n const metaById = new Map<string, CodecMeta>();\n const renderersById = new Map<string, (params: Record<string, unknown>) => string | undefined>();\n const inputRenderersById = new Map<\n string,\n (params: Record<string, unknown>) => string | undefined\n >();\n const owners = new Map<string, string>();\n for (const descriptor of descriptors) {\n const codecTypes = descriptor.types?.codecTypes;\n const descriptorId = descriptor.id;\n // Descriptor-side metadata is the single source of truth for `targetTypes` / `meta` / `renderOutputType`. Every contributor ships a `codecDescriptors` list on `types.codecTypes`.\n for (const codecDescriptor of codecTypes?.codecDescriptors ?? []) {\n assertUniqueCodecOwner({\n codecId: codecDescriptor.codecId,\n owners,\n descriptorId,\n entityLabel: 'codec descriptor',\n entityOwnershipLabel: 'codec descriptor provider',\n });\n owners.set(codecDescriptor.codecId, descriptorId);\n descriptorsById.set(codecDescriptor.codecId, codecDescriptor);\n if (Array.isArray(codecDescriptor.targetTypes)) {\n targetTypesById.set(codecDescriptor.codecId, codecDescriptor.targetTypes);\n }\n if (codecDescriptor.meta !== undefined) {\n metaById.set(codecDescriptor.codecId, codecDescriptor.meta);\n }\n if (typeof codecDescriptor.renderOutputType === 'function') {\n renderersById.set(codecDescriptor.codecId, codecDescriptor.renderOutputType);\n }\n if (typeof codecDescriptor.renderInputType === 'function') {\n inputRenderersById.set(codecDescriptor.codecId, codecDescriptor.renderInputType);\n }\n // Materialize a representative `Codec` instance for `byId.get()` so consumers reading the lookup's instance side (e.g. SQL renderer's cast-policy lookup, or the contract emitter's literal-default `encodeJson` resolver) keep finding the codec.\n //\n // Two cohorts:\n // - Non-parameterized descriptors: factory must succeed; any throw is a real bug and we let it propagate (no silent try/catch).\n // - Parameterized descriptors: try with empty params. Many parameterized codecs treat params as advisory (e.g. `pg/timestamptz@1` whose precision is rendered into the `nativeType` only and never read by the runtime codec), so an empty-params construction yields a usable representative for id-keyed lookups (e.g. emit-time literal-default encoding). Codecs whose factory genuinely requires params (e.g. `pg/vector@1` threading `length` into the runtime codec) will throw; for those, per-column instances are materialized at runtime by `buildContractCodecRegistry` and the id-keyed lookup miss is correct (the column-aware path resolves them).\n if (!byId.has(codecDescriptor.codecId)) {\n if (codecDescriptor.isParameterized) {\n try {\n const representative = codecDescriptor.factory({} as never)({\n name: `<lookup:${codecDescriptor.codecId}>`,\n } as Parameters<ReturnType<typeof codecDescriptor.factory>>[0]);\n byId.set(codecDescriptor.codecId, representative);\n } catch {\n // Factory requires concrete params; skip representative materialization. Per-column instances are built at runtime; id-keyed lookup miss is the correct outcome here.\n }\n } else {\n const representative = codecDescriptor.factory(undefined as never)({\n name: `<lookup:${codecDescriptor.codecId}>`,\n } as Parameters<ReturnType<typeof codecDescriptor.factory>>[0]);\n byId.set(codecDescriptor.codecId, representative);\n }\n }\n }\n }\n return {\n get: (id) => byId.get(id),\n forCodecRef(ref: CodecRef) {\n const d = descriptorsById.get(ref.codecId);\n if (d === undefined) {\n throw runtimeError(\n 'RUNTIME.CODEC_DESCRIPTOR_MISSING',\n `No codec descriptor registered for codecId '${ref.codecId}'.`,\n { codecId: ref.codecId },\n );\n }\n return materializeCodec(d, ref, { name: `<ref:${ref.codecId}>` });\n },\n forColumn: () => undefined,\n targetTypesFor: (id) => targetTypesById.get(id),\n metaFor: (id) => metaById.get(id),\n renderOutputTypeFor: (id, params) => renderersById.get(id)?.(params),\n renderInputTypeFor: (id, params) => inputRenderersById.get(id)?.(params),\n };\n}\n\nexport function validateScalarTypeCodecIds(\n scalarTypeDescriptors: ReadonlyMap<string, string>,\n codecLookup: CodecLookup,\n): string[] {\n const errors: string[] = [];\n for (const [typeName, codecId] of scalarTypeDescriptors) {\n if (!codecLookup.get(codecId)) {\n errors.push(\n `Scalar type \"${typeName}\" references codec \"${codecId}\" which is not registered by any component.`,\n );\n }\n }\n return errors;\n}\n\ninterface DependencyDeclaringDescriptor {\n readonly id: string;\n readonly contractSpace?: {\n readonly contractJson?: {\n readonly extensionPacks?: Readonly<Record<string, unknown>>;\n };\n };\n}\n\nfunction readDeclaredDependencyIds(descriptor: DependencyDeclaringDescriptor): readonly string[] {\n const packs = descriptor.contractSpace?.contractJson?.extensionPacks;\n if (packs === null || typeof packs !== 'object') return [];\n return Object.keys(packs);\n}\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.extensionPacks`) 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 `extensionPacks` list to\n * resolve the error.\n */\n\nexport function buildExtensionLoadOrder(\n extensions: ReadonlyArray<DependencyDeclaringDescriptor>,\n): readonly string[] {\n if (extensions.length === 0) return [];\n\n const idSet = new Set(extensions.map((e) => e.id));\n const inDegree = new Map<string, number>();\n const dependents = new Map<string, string[]>();\n\n for (const ext of extensions) {\n if (!inDegree.has(ext.id)) inDegree.set(ext.id, 0);\n if (!dependents.has(ext.id)) dependents.set(ext.id, []);\n }\n\n for (const ext of extensions) {\n for (const depId of readDeclaredDependencyIds(ext)) {\n if (!idSet.has(depId)) {\n throw new Error(\n `Extension \"${ext.id}\" declares a dependency on \"${depId}\", but \"${depId}\" is not in the provided extension set. Add the missing space to extensionPacks.`,\n );\n }\n inDegree.set(ext.id, (inDegree.get(ext.id) ?? 0) + 1);\n const list = dependents.get(depId);\n if (list !== undefined) list.push(ext.id);\n }\n }\n\n const queue: string[] = [];\n for (const [id, deg] of inDegree) {\n if (deg === 0) queue.push(id);\n }\n queue.sort();\n\n const result: string[] = [];\n while (queue.length > 0) {\n const id = queue.shift();\n if (id === undefined) break;\n result.push(id);\n const children = dependents.get(id) ?? [];\n children.sort();\n for (const childId of children) {\n const newDeg = (inDegree.get(childId) ?? 1) - 1;\n inDegree.set(childId, newDeg);\n if (newDeg === 0) queue.push(childId);\n }\n }\n\n if (result.length < extensions.length) {\n const cycleMembers = extensions\n .map((e) => e.id)\n .filter((id) => !result.includes(id))\n .sort();\n throw new Error(\n `Extension dependency cycle detected. Cycle members: ${cycleMembers.map((id) => `\"${id}\"`).join(', ')}.`,\n );\n }\n\n return result;\n}\n\nexport function createControlStack<TFamilyId extends string, TTargetId extends string>(\n input: CreateControlStackInput<TFamilyId, TTargetId>,\n): ControlStack<TFamilyId, TTargetId> {\n const { family, target, adapter, driver, extensionPacks = [] } = input;\n\n const orderedIds = buildExtensionLoadOrder(extensionPacks);\n const extensionById = new Map(extensionPacks.map((ext) => [ext.id, ext]));\n const orderedExtensionPacks = orderedIds\n .map((id) => extensionById.get(id))\n .filter((ext): ext is ControlExtensionDescriptor<TFamilyId, TTargetId> => ext !== undefined);\n\n const allDescriptors = [family, target, ...(adapter ? [adapter] : []), ...orderedExtensionPacks];\n\n const codecLookup = extractCodecLookup(allDescriptors);\n const scalarTypeDescriptors = assembleScalarTypeDescriptors(allDescriptors);\n\n return {\n family,\n target,\n adapter,\n driver,\n extensionPacks: orderedExtensionPacks,\n\n codecTypeImports: extractCodecTypeImports(allDescriptors),\n queryOperationTypeImports: extractQueryOperationTypeImports(allDescriptors),\n extensionIds: extractComponentIds(family, target, adapter, orderedExtensionPacks),\n codecLookup,\n authoringContributions: assembleAuthoringContributions(allDescriptors),\n scalarTypeDescriptors,\n controlMutationDefaults: assembleControlMutationDefaults(allDescriptors),\n };\n}\n","import type { ControlPolicy } from '@prisma-next/contract/types';\nimport type { SchemaVerificationNode } from './control-result-types';\n\nexport type VerificationStatus = SchemaVerificationNode['status'];\n\nexport type VerifierOutcome = VerificationStatus | 'suppress';\n\n/**\n * Target-neutral classification of a verifier finding, abstracted away from any\n * one storage model's vocabulary. Each family classifies its own concrete issue\n * kinds into these categories; the framework only grades the category against a\n * control policy.\n *\n * - `declaredMissing` — a declared object/element is absent from the database.\n * - `declaredIncompatible` — a declared object/element exists but its shape diverges.\n * - `valueDrift` — the value set of an existing type drifted (e.g. enum values).\n * - `extraNestedElement` — an undeclared element nested inside a declared object\n * (a SQL column, a document field).\n * - `extraAuxiliary` — an undeclared auxiliary attached to a declared object\n * (a SQL constraint/index, a Mongo index/validator).\n * - `extraTopLevelObject` — an undeclared top-level object (a SQL table, a\n * Mongo collection).\n */\nexport type VerifierIssueCategory =\n | 'declaredMissing'\n | 'declaredIncompatible'\n | 'valueDrift'\n | 'extraNestedElement'\n | 'extraAuxiliary'\n | 'extraTopLevelObject';\n\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 */\nexport function dispositionForCategory(\n controlPolicy: ControlPolicy,\n category: VerifierIssueCategory,\n): VerifierOutcome {\n if (controlPolicy === 'observed') {\n return 'warn';\n }\n if (controlPolicy === 'tolerated' && category === 'extraNestedElement') {\n return 'suppress';\n }\n if (controlPolicy === 'external') {\n if (\n category === 'extraNestedElement' ||\n category === 'extraAuxiliary' ||\n category === 'extraTopLevelObject' ||\n category === 'valueDrift'\n ) {\n return 'suppress';\n }\n }\n return 'fail';\n}\n"],"mappings":";;;;;AAkBA,SAAgB,cACd,QAC4D;CAC5D,OAAO,gBAAgB,UAAU,CAAC,CAAE,OAAmC;AACzE;AAMA,SAAgB,cACd,UACwF;CACxF,OACE,kBAAkB,YAClB,OAAQ,SAAqC,oBAAoB;AAErE;AAUA,SAAgB,oBACd,UAC8F;CAC9F,OACE,sBAAsB,YACtB,OAAQ,SAAqC,wBAAwB;AAEzE;AAWA,SAAgB,oBACd,UACmF;CACnF,OACE,wBAAwB,YACxB,OAAQ,SAAqC,0BAA0B;AAE3E;;;ACtEA,MAAa,6BAA6B;AAC1C,MAAa,4BAA4B;AACzC,MAAa,8BAA8B;AAC3C,MAAa,6BAA6B;;;AC4B1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IAAI,EAAE,CAAC,CAAC,CAClC,QAAQ,QAAiE,QAAQ,KAAA,CAAS;CAE7F,MAAM,iBAAiB;EAAC;EAAQ;EAAQ,GAAI,UAAU,CAAC,OAAO,IAAI,CAAC;EAAI,GAAG;CAAqB;CAE/F,MAAM,cAAc,mBAAmB,cAAc;CACrD,MAAM,wBAAwB,8BAA8B,cAAc;CAE1E,OAAO;EACL;EACA;EACA;EACA;EACA,gBAAgB;EAEhB,kBAAkB,wBAAwB,cAAc;EACxD,2BAA2B,iCAAiC,cAAc;EAC1E,cAAc,oBAAoB,QAAQ,QAAQ,SAAS,qBAAqB;EAChF;EACA,wBAAwB,+BAA+B,cAAc;EACrE;EACA,yBAAyB,gCAAgC,cAAc;CACzE;AACF;;;;;;;;;;;;AC5dA,SAAgB,uBACd,eACA,UACiB;CACjB,IAAI,kBAAkB,YACpB,OAAO;CAET,IAAI,kBAAkB,eAAe,aAAa,sBAChD,OAAO;CAET,IAAI,kBAAkB;MAElB,aAAa,wBACb,aAAa,oBACb,aAAa,yBACb,aAAa,cAEb,OAAO;CAAA;CAGX,OAAO;AACT"} | ||
| {"version":3,"file":"control.mjs","names":[],"sources":["../src/control/control-capabilities.ts","../src/control/control-result-types.ts","../src/control/control-schema-view.ts","../src/control/control-spaces.ts","../src/control/control-stack.ts","../src/control/verifier-disposition.ts"],"sourcesContent":["import type { ControlTargetDescriptor } from './control-descriptors';\nimport type { ControlFamilyInstance } from './control-instances';\nimport type { MigrationPlanOperation, TargetMigrationsCapability } from './control-migration-types';\nimport type { OperationPreview } from './control-operation-preview';\nimport type { CoreSchemaView } from './control-schema-view';\nimport type { PslDocumentAst } from './psl-ast';\n\nexport interface MigratableTargetDescriptor<\n TFamilyId extends string,\n TTargetId extends string,\n TFamilyInstance extends ControlFamilyInstance<TFamilyId, unknown> = ControlFamilyInstance<\n TFamilyId,\n unknown\n >,\n> extends ControlTargetDescriptor<TFamilyId, TTargetId> {\n readonly migrations: TargetMigrationsCapability<TFamilyId, TTargetId, TFamilyInstance>;\n}\n\nexport function hasMigrations<TFamilyId extends string, TTargetId extends string>(\n target: ControlTargetDescriptor<TFamilyId, TTargetId>,\n): target is MigratableTargetDescriptor<TFamilyId, TTargetId> {\n return 'migrations' in target && !!(target as Record<string, unknown>)['migrations'];\n}\n\nexport interface SchemaViewCapable<TSchemaIR = unknown> {\n toSchemaView(schema: TSchemaIR): CoreSchemaView;\n}\n\nexport function hasSchemaView<TFamilyId extends string, TSchemaIR>(\n instance: ControlFamilyInstance<TFamilyId, TSchemaIR>,\n): instance is ControlFamilyInstance<TFamilyId, TSchemaIR> & SchemaViewCapable<TSchemaIR> {\n return (\n 'toSchemaView' in instance &&\n typeof (instance as Record<string, unknown>)['toSchemaView'] === 'function'\n );\n}\n\n/**\n * Capability declaring that a family can infer a PSL contract AST from its\n * opaque introspected schema IR. Consumed by `prisma-next contract infer`.\n */\nexport interface PslContractInferCapable<TSchemaIR = unknown> {\n inferPslContract(schemaIR: TSchemaIR): PslDocumentAst;\n}\n\nexport function hasPslContractInfer<TFamilyId extends string, TSchemaIR>(\n instance: ControlFamilyInstance<TFamilyId, TSchemaIR>,\n): instance is ControlFamilyInstance<TFamilyId, TSchemaIR> & PslContractInferCapable<TSchemaIR> {\n return (\n 'inferPslContract' in instance &&\n typeof (instance as Record<string, unknown>)['inferPslContract'] === 'function'\n );\n}\n\n/**\n * Capability declaring that a family can render a textual preview of migration\n * operations for the CLI's \"DDL preview\" output. SQL families emit\n * `language: 'sql'` statements; Mongo families emit `language: 'mongodb-shell'`.\n */\nexport interface OperationPreviewCapable {\n toOperationPreview(operations: readonly MigrationPlanOperation[]): OperationPreview;\n}\n\nexport function hasOperationPreview<TFamilyId extends string, TSchemaIR>(\n instance: ControlFamilyInstance<TFamilyId, TSchemaIR>,\n): instance is ControlFamilyInstance<TFamilyId, TSchemaIR> & OperationPreviewCapable {\n return (\n 'toOperationPreview' in instance &&\n typeof (instance as Record<string, unknown>)['toOperationPreview'] === 'function'\n );\n}\n","export const VERIFY_CODE_MARKER_MISSING = 'PN-RUN-3001';\nexport const VERIFY_CODE_HASH_MISMATCH = 'PN-RUN-3002';\nexport const VERIFY_CODE_TARGET_MISMATCH = 'PN-RUN-3003';\nexport const VERIFY_CODE_SCHEMA_FAILURE = 'PN-RUN-3010';\n\nexport interface OperationContext {\n readonly contractPath?: string;\n readonly configPath?: string;\n readonly meta?: Readonly<Record<string, unknown>>;\n}\n\nexport interface VerifyDatabaseResult {\n readonly ok: boolean;\n readonly code?: string;\n readonly summary: string;\n readonly contract: {\n readonly storageHash: string;\n readonly profileHash?: string;\n };\n readonly marker?: {\n readonly storageHash?: string;\n readonly profileHash?: string;\n };\n readonly target: {\n readonly expected: string;\n readonly actual?: string;\n };\n readonly missingCodecs?: readonly string[];\n readonly codecCoverageSkipped?: boolean;\n readonly meta?: {\n readonly configPath?: string;\n readonly contractPath: string;\n };\n readonly timings: {\n readonly total: number;\n };\n}\n\nexport interface BaseSchemaIssue {\n readonly kind:\n | 'missing_schema'\n | 'missing_table'\n | 'missing_column'\n | 'extra_table'\n | 'extra_column'\n | 'extra_primary_key'\n | 'extra_foreign_key'\n | 'extra_unique_constraint'\n | 'extra_index'\n | 'extra_validator'\n | 'type_mismatch'\n | 'type_missing'\n | 'type_values_mismatch'\n | 'nullability_mismatch'\n | 'primary_key_mismatch'\n | 'foreign_key_mismatch'\n | 'unique_constraint_mismatch'\n | 'index_mismatch'\n | 'default_missing'\n | 'default_mismatch'\n | 'extra_default'\n | 'check_missing'\n | 'check_removed'\n | 'check_mismatch';\n readonly table?: string;\n /**\n * Namespace coordinate of the issue's subject (e.g. the schema a SQL\n * table lives in). Populated by family verifiers that have the\n * coordinate in scope when constructing the issue; absent for issues\n * whose family has no namespace concept (e.g. Mongo collections) or\n * whose subject isn't in any contract namespace (e.g. an extra-table\n * issue raised for a table that exists in the live DB but not in the\n * contract).\n *\n * Downstream planners trust this field as the authoritative subject\n * coordinate and do not re-derive it by name lookup. A finer-grained\n * structural split between framework-shared and family-specific issue\n * fields is tracked under a follow-up ticket.\n */\n readonly namespaceId?: string;\n readonly column?: string;\n readonly indexOrConstraint?: string;\n readonly typeName?: string;\n readonly expected?: string;\n readonly actual?: string;\n readonly message: string;\n}\n\nexport interface EnumValuesChangedIssue {\n readonly kind: 'enum_values_changed';\n /**\n * Namespace coordinate of the enum type that changed values. Populated by\n * family verifiers that have the coordinate in scope when constructing the\n * issue. Downstream planners trust this field as the authoritative subject\n * coordinate and do not re-derive it by name lookup.\n */\n readonly namespaceId: string;\n readonly typeName: string;\n readonly addedValues: readonly string[];\n readonly removedValues: readonly string[];\n readonly message: string;\n}\n\nexport type SchemaIssue = BaseSchemaIssue | EnumValuesChangedIssue;\n\nexport interface SchemaVerificationNode {\n readonly status: 'pass' | 'warn' | 'fail';\n readonly kind: string;\n readonly name: string;\n readonly contractPath: string;\n readonly code: string;\n readonly message: string;\n readonly expected: unknown;\n readonly actual: unknown;\n readonly children: readonly SchemaVerificationNode[];\n}\n\nexport interface VerifyDatabaseSchemaResult {\n readonly ok: boolean;\n readonly code?: string;\n readonly summary: string;\n readonly contract: {\n readonly storageHash: string;\n readonly profileHash?: string;\n };\n readonly target: {\n readonly expected: string;\n readonly actual?: string;\n };\n readonly schema: {\n readonly issues: readonly SchemaIssue[];\n readonly root: SchemaVerificationNode;\n readonly counts: {\n readonly pass: number;\n readonly warn: number;\n readonly fail: number;\n readonly totalNodes: number;\n };\n };\n readonly meta?: {\n readonly configPath?: string;\n readonly contractPath?: string;\n readonly strict: boolean;\n };\n readonly timings: {\n readonly total: number;\n };\n}\n\nexport interface EmitContractResult {\n readonly contractJson: string;\n readonly contractDts: string;\n readonly storageHash: string;\n readonly executionHash?: string;\n readonly profileHash: string;\n}\n\nexport interface IntrospectSchemaResult<TSchemaIR> {\n readonly ok: true;\n readonly summary: string;\n readonly target: {\n readonly familyId: string;\n readonly id: string;\n };\n readonly schema: TSchemaIR;\n readonly meta?: {\n readonly configPath?: string;\n readonly dbUrl?: string;\n };\n readonly timings: {\n readonly total: number;\n };\n}\n\nexport interface SignDatabaseResult {\n readonly ok: boolean;\n readonly summary: string;\n readonly contract: {\n readonly storageHash: string;\n readonly profileHash?: string;\n };\n readonly target: {\n readonly expected: string;\n readonly actual?: string;\n };\n readonly marker: {\n readonly created: boolean;\n readonly updated: boolean;\n readonly previous?: {\n readonly storageHash?: string;\n readonly profileHash?: string;\n };\n };\n readonly meta?: {\n readonly configPath?: string;\n readonly contractPath: string;\n };\n readonly timings: {\n readonly total: number;\n };\n}\n","/**\n * Core schema view types for family-agnostic schema visualization.\n *\n * These types provide a minimal, generic, tree-shaped representation of schemas\n * across families, designed for CLI visualization and lightweight tooling.\n *\n * Families can optionally project their family-specific Schema IR into this\n * core view via the `toSchemaView` method on `FamilyInstance`.\n */\n\nexport type SchemaViewNodeKind =\n | 'root'\n | 'namespace'\n | 'collection'\n | 'entity'\n | 'field'\n | 'index'\n | 'dependency';\n\nexport interface SchemaTreeVisitor<R> {\n visit(node: SchemaTreeNode): R;\n}\n\nexport interface SchemaTreeNodeOptions {\n readonly kind: SchemaViewNodeKind;\n readonly id: string;\n readonly label: string;\n readonly meta?: Record<string, unknown>;\n readonly children?: readonly SchemaTreeNode[];\n}\n\nexport class SchemaTreeNode {\n readonly kind: SchemaViewNodeKind;\n readonly id: string;\n readonly label: string;\n readonly meta?: Record<string, unknown>;\n readonly children?: readonly SchemaTreeNode[];\n\n constructor(options: SchemaTreeNodeOptions) {\n this.kind = options.kind;\n this.id = options.id;\n this.label = options.label;\n if (options.meta !== undefined) this.meta = options.meta;\n if (options.children !== undefined) this.children = options.children;\n Object.freeze(this);\n }\n\n accept<R>(visitor: SchemaTreeVisitor<R>): R {\n return visitor.visit(this);\n }\n}\n\n/**\n * Core schema view providing a family-agnostic tree representation of a schema.\n * Used by CLI and cross-family tooling for visualization.\n */\nexport interface CoreSchemaView {\n readonly root: SchemaTreeNode;\n}\n","import type { Contract } from '@prisma-next/contract/types';\nimport type { MigrationMetadata, MigrationPlanOperation } from './control-migration-types';\n\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 */\nexport const APP_SPACE_ID = 'app' as const;\n\n/**\n * Head ref for a contract space — the `(hash, invariants)` tuple\n * a runner targets when applying that space's migration graph. Identical\n * in shape to the on-disk `migrations/<space-id>/refs/head.json` the\n * framework writes per loaded extension, and to the app-space\n * `<projectRoot>/refs/head.json`. Family-agnostic: SQL, Mongo, and any\n * future family share the same head-ref shape.\n *\n * @see specs/framework-mechanism.spec.md § 1.\n */\nexport interface ContractSpaceHeadRef {\n readonly hash: string;\n readonly invariants: readonly string[];\n}\n\n/**\n * Canonical structural shape of a migration package — the unit a planner\n * produces and a runner consumes: a directory name, the metadata\n * envelope, and the operation list.\n *\n * In-memory by default. Readers in `@prisma-next/migration-tools`\n * (`readMigrationPackage` / `readMigrationsDir`) return the augmented\n * {@link import('@prisma-next/migration-tools/package').OnDiskMigrationPackage}\n * variant which adds `dirPath`; everything else operates against the\n * canonical shape so the same value flows through pre-emission\n * authoring, on-disk loading, and runner execution without conversion.\n *\n * @see specs/framework-mechanism.spec.md § 1.\n */\nexport interface MigrationPackage {\n readonly dirName: string;\n readonly metadata: MigrationMetadata;\n readonly ops: readonly MigrationPlanOperation[];\n}\n\n/**\n * Canonical structural shape of a contract space — one disjoint\n * `(contractJson, migration-graph)` unit the per-space planner / runner\n * / verifier operates on. The application owns one well-known space\n * ({@link APP_SPACE_ID}); each loaded extension that contributes schema\n * owns a uniquely-named space. Whether a value is the app's space or an\n * extension's space is a control-plane concern; the type carries no\n * such distinction.\n *\n * Generic over the contract so each family pins a typed contract value\n * at consumption time. The SQL family specialises to\n * `ContractSpace<Contract<SqlStorage>>` at the descriptor surface;\n * Mongo's symmetrical `ContractSpace<Contract<MongoStorage>>` will land\n * with that family.\n *\n * @see specs/framework-mechanism.spec.md § 1.\n */\nexport interface ContractSpace<TContract extends Contract = Contract> {\n readonly contractJson: TContract;\n readonly migrations: readonly MigrationPackage[];\n readonly headRef: ContractSpaceHeadRef;\n}\n","import { blindCast } from '@prisma-next/utils/casts';\nimport type { Codec } from '../shared/codec';\nimport type { AnyCodecDescriptor } from '../shared/codec-descriptor';\nimport type { CodecLookup, CodecMeta, CodecRef, CodecRegistry } from '../shared/codec-types';\nimport type {\n AuthoringContributions,\n AuthoringEntityTypeNamespace,\n AuthoringFieldNamespace,\n AuthoringPslBlockDescriptorNamespace,\n AuthoringTypeNamespace,\n} from '../shared/framework-authoring';\nimport {\n assertNoCrossRegistryCollisions,\n isAuthoringEntityTypeDescriptor,\n isAuthoringFieldPresetDescriptor,\n isAuthoringPslBlockDescriptor,\n isAuthoringTypeConstructorDescriptor,\n mergeAuthoringNamespaces,\n} from '../shared/framework-authoring';\nimport type { ComponentMetadata } from '../shared/framework-components';\nimport type {\n ControlMutationDefaultEntry,\n ControlMutationDefaults,\n MutationDefaultGeneratorDescriptor,\n} from '../shared/mutation-default-types';\nimport {\n CONTRACT_CODEC_DESCRIPTOR_MISSING,\n materializeCodec,\n resolveCodecDescriptorOrThrow,\n} from '../shared/resolve-codec';\nimport type { TypesImportSpec } from '../shared/types-import-spec';\nimport type {\n ControlAdapterDescriptor,\n ControlDriverDescriptor,\n ControlExtensionDescriptor,\n ControlFamilyDescriptor,\n ControlTargetDescriptor,\n} from './control-descriptors';\n\nexport interface AssembledAuthoringContributions {\n readonly field: AuthoringFieldNamespace;\n readonly type: AuthoringTypeNamespace;\n readonly entityTypes: AuthoringEntityTypeNamespace;\n readonly pslBlockDescriptors: AuthoringPslBlockDescriptorNamespace;\n}\n\nexport interface ControlStack<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> {\n readonly family: ControlFamilyDescriptor<TFamilyId>;\n readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter?: ControlAdapterDescriptor<TFamilyId, TTargetId> | undefined;\n readonly driver?: ControlDriverDescriptor<TFamilyId, TTargetId> | undefined;\n readonly extensionPacks: readonly ControlExtensionDescriptor<TFamilyId, TTargetId>[];\n\n readonly codecTypeImports: ReadonlyArray<TypesImportSpec>;\n readonly queryOperationTypeImports: ReadonlyArray<TypesImportSpec>;\n readonly extensionIds: ReadonlyArray<string>;\n readonly codecLookup: CodecRegistry;\n readonly authoringContributions: AssembledAuthoringContributions;\n readonly scalarTypeDescriptors: ReadonlyMap<string, string>;\n readonly controlMutationDefaults: ControlMutationDefaults;\n}\n\nexport interface CreateControlStackInput<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> {\n readonly family: ControlFamilyDescriptor<TFamilyId>;\n readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter?: ControlAdapterDescriptor<TFamilyId, TTargetId> | undefined;\n readonly driver?: ControlDriverDescriptor<TFamilyId, TTargetId> | undefined;\n readonly extensionPacks?:\n | ReadonlyArray<ControlExtensionDescriptor<TFamilyId, TTargetId>>\n | undefined;\n}\n\nfunction addUniqueId(ids: string[], seen: Set<string>, id: string): void {\n if (!seen.has(id)) {\n ids.push(id);\n seen.add(id);\n }\n}\n\nexport function assertUniqueCodecOwner(options: {\n readonly codecId: string;\n readonly owners: Map<string, string>;\n readonly descriptorId: string;\n readonly entityLabel: string;\n readonly entityOwnershipLabel: string;\n}): void {\n const existingOwner = options.owners.get(options.codecId);\n if (existingOwner !== undefined) {\n throw new Error(\n `Duplicate ${options.entityLabel} for codecId \"${options.codecId}\". ` +\n `Descriptor \"${options.descriptorId}\" conflicts with \"${existingOwner}\". ` +\n `Each codecId can only have one ${options.entityOwnershipLabel}.`,\n );\n }\n}\n\nexport function extractCodecTypeImports(\n descriptors: ReadonlyArray<Pick<ComponentMetadata, 'types'>>,\n): ReadonlyArray<TypesImportSpec> {\n const imports: TypesImportSpec[] = [];\n\n for (const descriptor of descriptors) {\n const codecTypes = descriptor.types?.codecTypes;\n if (codecTypes?.import) {\n imports.push(codecTypes.import);\n }\n if (codecTypes?.typeImports) {\n imports.push(...codecTypes.typeImports);\n }\n }\n\n return imports;\n}\n\nexport function extractQueryOperationTypeImports(\n descriptors: ReadonlyArray<Pick<ComponentMetadata, 'types'>>,\n): ReadonlyArray<TypesImportSpec> {\n const imports: TypesImportSpec[] = [];\n\n for (const descriptor of descriptors) {\n const queryOperationTypes = descriptor.types?.queryOperationTypes;\n if (queryOperationTypes?.import) {\n imports.push(queryOperationTypes.import);\n }\n }\n\n return imports;\n}\n\nexport function extractComponentIds(\n family: { readonly id: string },\n target: { readonly id: string },\n adapter: { readonly id: string } | undefined,\n extensions: ReadonlyArray<{ readonly id: string }>,\n): ReadonlyArray<string> {\n const ids: string[] = [];\n const seen = new Set<string>();\n\n addUniqueId(ids, seen, family.id);\n addUniqueId(ids, seen, target.id);\n if (adapter) {\n addUniqueId(ids, seen, adapter.id);\n }\n\n for (const ext of extensions) {\n addUniqueId(ids, seen, ext.id);\n }\n\n return ids;\n}\n\nexport function assembleAuthoringContributions(\n descriptors: ReadonlyArray<{ readonly authoring?: AuthoringContributions }>,\n): AssembledAuthoringContributions {\n const field = {} as Record<string, unknown>;\n const type = {} as Record<string, unknown>;\n const entityTypes = {} as Record<string, unknown>;\n const pslBlockDescriptors: Record<string, unknown> = {};\n\n for (const descriptor of descriptors) {\n if (descriptor.authoring?.field) {\n mergeAuthoringNamespaces(\n field,\n descriptor.authoring.field,\n [],\n isAuthoringFieldPresetDescriptor,\n 'field',\n );\n }\n if (descriptor.authoring?.type) {\n mergeAuthoringNamespaces(\n type,\n descriptor.authoring.type,\n [],\n isAuthoringTypeConstructorDescriptor,\n 'type',\n );\n }\n if (descriptor.authoring?.entityTypes) {\n mergeAuthoringNamespaces(\n entityTypes,\n descriptor.authoring.entityTypes,\n [],\n isAuthoringEntityTypeDescriptor,\n 'entity',\n );\n }\n if (descriptor.authoring?.pslBlockDescriptors) {\n mergeAuthoringNamespaces(\n pslBlockDescriptors,\n descriptor.authoring.pslBlockDescriptors,\n [],\n isAuthoringPslBlockDescriptor,\n 'pslBlock',\n );\n }\n }\n\n const fieldNamespace = field as AuthoringFieldNamespace;\n const typeNamespace = type as AuthoringTypeNamespace;\n const entityTypeNamespace = entityTypes as AuthoringEntityTypeNamespace;\n const pslBlockDescriptorNamespace = blindCast<\n AuthoringPslBlockDescriptorNamespace,\n 'merge target accumulator narrows to typed namespace post-merge'\n >(pslBlockDescriptors);\n assertNoCrossRegistryCollisions(\n typeNamespace,\n fieldNamespace,\n entityTypeNamespace,\n pslBlockDescriptorNamespace,\n );\n\n return {\n field: fieldNamespace,\n type: typeNamespace,\n entityTypes: entityTypeNamespace,\n pslBlockDescriptors: pslBlockDescriptorNamespace,\n };\n}\n\nexport function assembleScalarTypeDescriptors(\n descriptors: ReadonlyArray<\n Pick<ComponentMetadata, 'scalarTypeDescriptors'> & { readonly id?: string }\n >,\n): ReadonlyMap<string, string> {\n const result = new Map<string, string>();\n const owners = new Map<string, string>();\n\n for (const descriptor of descriptors) {\n const descriptorMap = descriptor.scalarTypeDescriptors;\n if (!descriptorMap) continue;\n const descriptorId = descriptor.id ?? '<unknown>';\n for (const [typeName, codecId] of descriptorMap) {\n const existingOwner = owners.get(typeName);\n if (existingOwner !== undefined) {\n throw new Error(\n `Duplicate scalar type descriptor \"${typeName}\". ` +\n `Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\".`,\n );\n }\n result.set(typeName, codecId);\n owners.set(typeName, descriptorId);\n }\n }\n\n return result;\n}\n\nexport function assembleControlMutationDefaults(\n descriptors: ReadonlyArray<\n Pick<ComponentMetadata, 'controlMutationDefaults'> & { readonly id?: string }\n >,\n): ControlMutationDefaults {\n const defaultFunctionRegistry = new Map<string, ControlMutationDefaultEntry>();\n const functionOwners = new Map<string, string>();\n const generatorMap = new Map<string, MutationDefaultGeneratorDescriptor>();\n const generatorOwners = new Map<string, string>();\n\n for (const descriptor of descriptors) {\n const contributions = descriptor.controlMutationDefaults;\n if (!contributions) continue;\n const descriptorId = descriptor.id ?? '<unknown>';\n\n for (const generatorDescriptor of contributions.generatorDescriptors) {\n const existingOwner = generatorOwners.get(generatorDescriptor.id);\n if (existingOwner !== undefined) {\n throw new Error(\n `Duplicate mutation default generator id \"${generatorDescriptor.id}\". ` +\n `Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\".`,\n );\n }\n generatorMap.set(generatorDescriptor.id, generatorDescriptor);\n generatorOwners.set(generatorDescriptor.id, descriptorId);\n }\n\n for (const [functionName, handler] of contributions.defaultFunctionRegistry) {\n const existingOwner = functionOwners.get(functionName);\n if (existingOwner !== undefined) {\n throw new Error(\n `Duplicate mutation default function \"${functionName}\". ` +\n `Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\".`,\n );\n }\n defaultFunctionRegistry.set(functionName, handler);\n functionOwners.set(functionName, descriptorId);\n }\n }\n\n return {\n defaultFunctionRegistry,\n generatorDescriptors: Array.from(generatorMap.values()),\n };\n}\n\nexport function extractCodecLookup(\n descriptors: ReadonlyArray<Pick<ComponentMetadata & { id: string }, 'types' | 'id'>>,\n): CodecRegistry {\n const byId = new Map<string, Codec>();\n const descriptorsById = new Map<string, AnyCodecDescriptor>();\n const targetTypesById = new Map<string, readonly string[]>();\n const metaById = new Map<string, CodecMeta>();\n const renderersById = new Map<string, (params: Record<string, unknown>) => string | undefined>();\n const inputRenderersById = new Map<\n string,\n (params: Record<string, unknown>) => string | undefined\n >();\n const owners = new Map<string, string>();\n for (const descriptor of descriptors) {\n const codecTypes = descriptor.types?.codecTypes;\n const descriptorId = descriptor.id;\n // Descriptor-side metadata is the single source of truth for `targetTypes` / `meta` / `renderOutputType`. Every contributor ships a `codecDescriptors` list on `types.codecTypes`.\n for (const codecDescriptor of codecTypes?.codecDescriptors ?? []) {\n assertUniqueCodecOwner({\n codecId: codecDescriptor.codecId,\n owners,\n descriptorId,\n entityLabel: 'codec descriptor',\n entityOwnershipLabel: 'codec descriptor provider',\n });\n owners.set(codecDescriptor.codecId, descriptorId);\n descriptorsById.set(codecDescriptor.codecId, codecDescriptor);\n if (Array.isArray(codecDescriptor.targetTypes)) {\n targetTypesById.set(codecDescriptor.codecId, codecDescriptor.targetTypes);\n }\n if (codecDescriptor.meta !== undefined) {\n metaById.set(codecDescriptor.codecId, codecDescriptor.meta);\n }\n if (typeof codecDescriptor.renderOutputType === 'function') {\n renderersById.set(codecDescriptor.codecId, codecDescriptor.renderOutputType);\n }\n if (typeof codecDescriptor.renderInputType === 'function') {\n inputRenderersById.set(codecDescriptor.codecId, codecDescriptor.renderInputType);\n }\n // Materialize a representative `Codec` instance for `byId.get()` so consumers reading the lookup's instance side (e.g. SQL renderer's cast-policy lookup, or the contract emitter's literal-default `encodeJson` resolver) keep finding the codec.\n //\n // Two cohorts:\n // - Non-parameterized descriptors: factory must succeed; any throw is a real bug and we let it propagate (no silent try/catch).\n // - Parameterized descriptors: try with empty params. Many parameterized codecs treat params as advisory (e.g. `pg/timestamptz@1` whose precision is rendered into the `nativeType` only and never read by the runtime codec), so an empty-params construction yields a usable representative for id-keyed lookups (e.g. emit-time literal-default encoding). Codecs whose factory genuinely requires params (e.g. `pg/vector@1` threading `length` into the runtime codec) will throw; for those, per-column instances are materialized at runtime by `buildContractCodecRegistry` and the id-keyed lookup miss is correct (the column-aware path resolves them).\n if (!byId.has(codecDescriptor.codecId)) {\n if (codecDescriptor.isParameterized) {\n try {\n const representative = codecDescriptor.factory({} as never)({\n name: `<lookup:${codecDescriptor.codecId}>`,\n } as Parameters<ReturnType<typeof codecDescriptor.factory>>[0]);\n byId.set(codecDescriptor.codecId, representative);\n } catch {\n // Factory requires concrete params; skip representative materialization. Per-column instances are built at runtime; id-keyed lookup miss is the correct outcome here.\n }\n } else {\n const representative = codecDescriptor.factory(undefined as never)({\n name: `<lookup:${codecDescriptor.codecId}>`,\n } as Parameters<ReturnType<typeof codecDescriptor.factory>>[0]);\n byId.set(codecDescriptor.codecId, representative);\n }\n }\n }\n }\n return {\n get: (id) => byId.get(id),\n forCodecRef(ref: CodecRef) {\n const d = resolveCodecDescriptorOrThrow(\n (id) => descriptorsById.get(id),\n ref,\n CONTRACT_CODEC_DESCRIPTOR_MISSING,\n );\n return materializeCodec(d, ref, { name: `<ref:${ref.codecId}>` });\n },\n forColumn: () => undefined,\n targetTypesFor: (id) => targetTypesById.get(id),\n metaFor: (id) => metaById.get(id),\n renderOutputTypeFor: (id, params) => renderersById.get(id)?.(params),\n renderInputTypeFor: (id, params) => inputRenderersById.get(id)?.(params),\n };\n}\n\nexport function validateScalarTypeCodecIds(\n scalarTypeDescriptors: ReadonlyMap<string, string>,\n codecLookup: CodecLookup,\n): string[] {\n const errors: string[] = [];\n for (const [typeName, codecId] of scalarTypeDescriptors) {\n if (!codecLookup.get(codecId)) {\n errors.push(\n `Scalar type \"${typeName}\" references codec \"${codecId}\" which is not registered by any component.`,\n );\n }\n }\n return errors;\n}\n\ninterface DependencyDeclaringDescriptor {\n readonly id: string;\n readonly contractSpace?: {\n readonly contractJson?: {\n readonly extensionPacks?: Readonly<Record<string, unknown>>;\n };\n };\n}\n\nfunction readDeclaredDependencyIds(descriptor: DependencyDeclaringDescriptor): readonly string[] {\n const packs = descriptor.contractSpace?.contractJson?.extensionPacks;\n if (packs === null || typeof packs !== 'object') return [];\n return Object.keys(packs);\n}\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.extensionPacks`) 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 `extensionPacks` list to\n * resolve the error.\n */\n\nexport function buildExtensionLoadOrder(\n extensions: ReadonlyArray<DependencyDeclaringDescriptor>,\n): readonly string[] {\n if (extensions.length === 0) return [];\n\n const idSet = new Set(extensions.map((e) => e.id));\n const inDegree = new Map<string, number>();\n const dependents = new Map<string, string[]>();\n\n for (const ext of extensions) {\n if (!inDegree.has(ext.id)) inDegree.set(ext.id, 0);\n if (!dependents.has(ext.id)) dependents.set(ext.id, []);\n }\n\n for (const ext of extensions) {\n for (const depId of readDeclaredDependencyIds(ext)) {\n if (!idSet.has(depId)) {\n throw new Error(\n `Extension \"${ext.id}\" declares a dependency on \"${depId}\", but \"${depId}\" is not in the provided extension set. Add the missing space to extensionPacks.`,\n );\n }\n inDegree.set(ext.id, (inDegree.get(ext.id) ?? 0) + 1);\n const list = dependents.get(depId);\n if (list !== undefined) list.push(ext.id);\n }\n }\n\n const queue: string[] = [];\n for (const [id, deg] of inDegree) {\n if (deg === 0) queue.push(id);\n }\n queue.sort();\n\n const result: string[] = [];\n while (queue.length > 0) {\n const id = queue.shift();\n if (id === undefined) break;\n result.push(id);\n const children = dependents.get(id) ?? [];\n children.sort();\n for (const childId of children) {\n const newDeg = (inDegree.get(childId) ?? 1) - 1;\n inDegree.set(childId, newDeg);\n if (newDeg === 0) queue.push(childId);\n }\n }\n\n if (result.length < extensions.length) {\n const cycleMembers = extensions\n .map((e) => e.id)\n .filter((id) => !result.includes(id))\n .sort();\n throw new Error(\n `Extension dependency cycle detected. Cycle members: ${cycleMembers.map((id) => `\"${id}\"`).join(', ')}.`,\n );\n }\n\n return result;\n}\n\nexport function createControlStack<TFamilyId extends string, TTargetId extends string>(\n input: CreateControlStackInput<TFamilyId, TTargetId>,\n): ControlStack<TFamilyId, TTargetId> {\n const { family, target, adapter, driver, extensionPacks = [] } = input;\n\n const orderedIds = buildExtensionLoadOrder(extensionPacks);\n const extensionById = new Map(extensionPacks.map((ext) => [ext.id, ext]));\n const orderedExtensionPacks = orderedIds\n .map((id) => extensionById.get(id))\n .filter((ext): ext is ControlExtensionDescriptor<TFamilyId, TTargetId> => ext !== undefined);\n\n const allDescriptors = [family, target, ...(adapter ? [adapter] : []), ...orderedExtensionPacks];\n\n const codecLookup = extractCodecLookup(allDescriptors);\n const scalarTypeDescriptors = assembleScalarTypeDescriptors(allDescriptors);\n\n return {\n family,\n target,\n adapter,\n driver,\n extensionPacks: orderedExtensionPacks,\n\n codecTypeImports: extractCodecTypeImports(allDescriptors),\n queryOperationTypeImports: extractQueryOperationTypeImports(allDescriptors),\n extensionIds: extractComponentIds(family, target, adapter, orderedExtensionPacks),\n codecLookup,\n authoringContributions: assembleAuthoringContributions(allDescriptors),\n scalarTypeDescriptors,\n controlMutationDefaults: assembleControlMutationDefaults(allDescriptors),\n };\n}\n","import type { ControlPolicy } from '@prisma-next/contract/types';\nimport type { SchemaVerificationNode } from './control-result-types';\n\nexport type VerificationStatus = SchemaVerificationNode['status'];\n\nexport type VerifierOutcome = VerificationStatus | 'suppress';\n\n/**\n * Target-neutral classification of a verifier finding, abstracted away from any\n * one storage model's vocabulary. Each family classifies its own concrete issue\n * kinds into these categories; the framework only grades the category against a\n * control policy.\n *\n * - `declaredMissing` — a declared object/element is absent from the database.\n * - `declaredIncompatible` — a declared object/element exists but its shape diverges.\n * - `valueDrift` — the value set of an existing type drifted (e.g. enum values).\n * - `extraNestedElement` — an undeclared element nested inside a declared object\n * (a SQL column, a document field).\n * - `extraAuxiliary` — an undeclared auxiliary attached to a declared object\n * (a SQL constraint/index, a Mongo index/validator).\n * - `extraTopLevelObject` — an undeclared top-level object (a SQL table, a\n * Mongo collection).\n */\nexport type VerifierIssueCategory =\n | 'declaredMissing'\n | 'declaredIncompatible'\n | 'valueDrift'\n | 'extraNestedElement'\n | 'extraAuxiliary'\n | 'extraTopLevelObject';\n\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 */\nexport function dispositionForCategory(\n controlPolicy: ControlPolicy,\n category: VerifierIssueCategory,\n): VerifierOutcome {\n if (controlPolicy === 'observed') {\n return 'warn';\n }\n if (controlPolicy === 'tolerated' && category === 'extraNestedElement') {\n return 'suppress';\n }\n if (controlPolicy === 'external') {\n if (\n category === 'extraNestedElement' ||\n category === 'extraAuxiliary' ||\n category === 'extraTopLevelObject' ||\n category === 'valueDrift'\n ) {\n return 'suppress';\n }\n }\n return 'fail';\n}\n"],"mappings":";;;;AAkBA,SAAgB,cACd,QAC4D;CAC5D,OAAO,gBAAgB,UAAU,CAAC,CAAE,OAAmC;AACzE;AAMA,SAAgB,cACd,UACwF;CACxF,OACE,kBAAkB,YAClB,OAAQ,SAAqC,oBAAoB;AAErE;AAUA,SAAgB,oBACd,UAC8F;CAC9F,OACE,sBAAsB,YACtB,OAAQ,SAAqC,wBAAwB;AAEzE;AAWA,SAAgB,oBACd,UACmF;CACnF,OACE,wBAAwB,YACxB,OAAQ,SAAqC,0BAA0B;AAE3E;;;ACtEA,MAAa,6BAA6B;AAC1C,MAAa,4BAA4B;AACzC,MAAa,8BAA8B;AAC3C,MAAa,6BAA6B;;;AC4B1C,IAAa,iBAAb,MAA4B;CAC1B;CACA;CACA;CACA;CACA;CAEA,YAAY,SAAgC;EAC1C,KAAK,OAAO,QAAQ;EACpB,KAAK,KAAK,QAAQ;EAClB,KAAK,QAAQ,QAAQ;EACrB,IAAI,QAAQ,SAAS,KAAA,GAAW,KAAK,OAAO,QAAQ;EACpD,IAAI,QAAQ,aAAa,KAAA,GAAW,KAAK,WAAW,QAAQ;EAC5D,OAAO,OAAO,IAAI;CACpB;CAEA,OAAU,SAAkC;EAC1C,OAAO,QAAQ,MAAM,IAAI;CAC3B;AACF;;;;;;;;;;;;;;;;;;;;;;AC5BA,MAAa,eAAe;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A,UACiB;CACjB,IAAI,kBAAkB,YACpB,OAAO;CAET,IAAI,kBAAkB,eAAe,aAAa,sBAChD,OAAO;CAET,IAAI,kBAAkB;MAElB,aAAa,wBACb,aAAa,oBACb,aAAa,yBACb,aAAa,cAEb,OAAO;CAAA;CAGX,OAAO;AACT"} |
+7
-7
| { | ||
| "name": "@prisma-next/framework-components", | ||
| "version": "0.13.0-dev.31", | ||
| "version": "0.13.0-dev.32", | ||
| "license": "Apache-2.0", | ||
@@ -9,6 +9,6 @@ "type": "module", | ||
| "dependencies": { | ||
| "@prisma-next/contract": "0.13.0-dev.31", | ||
| "@prisma-next/operations": "0.13.0-dev.31", | ||
| "@prisma-next/ts-render": "0.13.0-dev.31", | ||
| "@prisma-next/utils": "0.13.0-dev.31", | ||
| "@prisma-next/contract": "0.13.0-dev.32", | ||
| "@prisma-next/operations": "0.13.0-dev.32", | ||
| "@prisma-next/ts-render": "0.13.0-dev.32", | ||
| "@prisma-next/utils": "0.13.0-dev.32", | ||
| "@standard-schema/spec": "^1.1.0", | ||
@@ -18,4 +18,4 @@ "arktype": "^2.2.0" | ||
| "devDependencies": { | ||
| "@prisma-next/tsconfig": "0.13.0-dev.31", | ||
| "@prisma-next/tsdown": "0.13.0-dev.31", | ||
| "@prisma-next/tsconfig": "0.13.0-dev.32", | ||
| "@prisma-next/tsdown": "0.13.0-dev.32", | ||
| "tsdown": "0.22.1", | ||
@@ -22,0 +22,0 @@ "typescript": "5.9.3", |
@@ -26,4 +26,7 @@ import { blindCast } from '@prisma-next/utils/casts'; | ||
| } from '../shared/mutation-default-types'; | ||
| import { materializeCodec } from '../shared/resolve-codec'; | ||
| import { runtimeError } from '../shared/runtime-error'; | ||
| import { | ||
| CONTRACT_CODEC_DESCRIPTOR_MISSING, | ||
| materializeCodec, | ||
| resolveCodecDescriptorOrThrow, | ||
| } from '../shared/resolve-codec'; | ||
| import type { TypesImportSpec } from '../shared/types-import-spec'; | ||
@@ -365,10 +368,7 @@ import type { | ||
| forCodecRef(ref: CodecRef) { | ||
| const d = descriptorsById.get(ref.codecId); | ||
| if (d === undefined) { | ||
| throw runtimeError( | ||
| 'RUNTIME.CODEC_DESCRIPTOR_MISSING', | ||
| `No codec descriptor registered for codecId '${ref.codecId}'.`, | ||
| { codecId: ref.codecId }, | ||
| ); | ||
| } | ||
| const d = resolveCodecDescriptorOrThrow( | ||
| (id) => descriptorsById.get(id), | ||
| ref, | ||
| CONTRACT_CODEC_DESCRIPTOR_MISSING, | ||
| ); | ||
| return materializeCodec(d, ref, { name: `<ref:${ref.codecId}>` }); | ||
@@ -375,0 +375,0 @@ }, |
@@ -30,2 +30,7 @@ /** | ||
| export { column } from '../shared/column-spec'; | ||
| export { materializeCodec, validateCodecTypeParams } from '../shared/resolve-codec'; | ||
| export { | ||
| CONTRACT_CODEC_DESCRIPTOR_MISSING, | ||
| materializeCodec, | ||
| resolveCodecDescriptorOrThrow, | ||
| validateCodecTypeParams, | ||
| } from '../shared/resolve-codec'; |
@@ -7,3 +7,25 @@ import { blindCast } from '@prisma-next/utils/casts'; | ||
| export const CONTRACT_CODEC_DESCRIPTOR_MISSING = 'CONTRACT.CODEC_DESCRIPTOR_MISSING' as const; | ||
| /** | ||
| * Look up a descriptor for `ref.codecId` using `descriptorFor`; throw | ||
| * `code` if none is found. Each plane names its own error path: the control | ||
| * plane resolves contract-stack descriptors (`CONTRACT.*`), the execution | ||
| * plane resolves at query time (`RUNTIME.*`). | ||
| */ | ||
| export function resolveCodecDescriptorOrThrow( | ||
| descriptorFor: (codecId: string) => AnyCodecDescriptor | undefined, | ||
| ref: CodecRef, | ||
| code: 'CONTRACT.CODEC_DESCRIPTOR_MISSING' | 'RUNTIME.CODEC_DESCRIPTOR_MISSING', | ||
| ): AnyCodecDescriptor { | ||
| const descriptor = descriptorFor(ref.codecId); | ||
| if (!descriptor) { | ||
| throw runtimeError(code, `No codec descriptor registered for codecId '${ref.codecId}'.`, { | ||
| codecId: ref.codecId, | ||
| }); | ||
| } | ||
| return descriptor; | ||
| } | ||
| /** | ||
| * Validates `ref.typeParams` against `descriptor.paramsSchema`. | ||
@@ -10,0 +32,0 @@ * |
| import { n as runtimeError } from "./runtime-error-B2gWOtgH.mjs"; | ||
| import { blindCast } from "@prisma-next/utils/casts"; | ||
| //#region src/shared/resolve-codec.ts | ||
| /** | ||
| * Validates `ref.typeParams` against `descriptor.paramsSchema`. | ||
| * | ||
| * Parameterized codecs that omit `typeParams` have it normalized to `{}` before | ||
| * validation (mirrors `ast-codec-resolver.ts` semantics). Throws | ||
| * `RUNTIME.TYPE_PARAMS_INVALID` when the validator returns a `Promise` or | ||
| * reports issues. | ||
| */ | ||
| function validateCodecTypeParams(descriptor, ref) { | ||
| const normalized = descriptor.isParameterized && ref.typeParams === void 0 ? { | ||
| ...ref, | ||
| typeParams: {} | ||
| } : ref; | ||
| const result = blindCast(descriptor.paramsSchema["~standard"].validate(normalized.typeParams)); | ||
| if (result instanceof Promise) throw runtimeError("RUNTIME.TYPE_PARAMS_INVALID", `paramsSchema for codec '${ref.codecId}' returned a Promise; runtime validation requires a synchronous Standard Schema validator.`, { | ||
| codecId: ref.codecId, | ||
| typeParams: ref.typeParams | ||
| }); | ||
| if ("issues" in result && result.issues) { | ||
| const messages = result.issues.map((issue) => issue.message).join("; "); | ||
| throw runtimeError("RUNTIME.TYPE_PARAMS_INVALID", `Invalid typeParams for codec '${ref.codecId}': ${messages}`, { | ||
| codecId: ref.codecId, | ||
| typeParams: ref.typeParams | ||
| }); | ||
| } | ||
| return blindCast(result).value; | ||
| } | ||
| /** | ||
| * Resolves a `Codec` instance: validates `ref.typeParams` via | ||
| * {@link validateCodecTypeParams} then calls `descriptor.factory(validated)(ctx)`. | ||
| * | ||
| * The descriptor's `factory` is typed against its own `P`; the registry erases | ||
| * `P` to `any`, so the factory is narrowed to `(params: unknown) => (ctx) => Codec` | ||
| * at the call boundary. The `paramsSchema` validates the input above before we | ||
| * forward it, so the narrowing is safe by construction. | ||
| */ | ||
| function materializeCodec(descriptor, ref, ctx) { | ||
| const validated = validateCodecTypeParams(descriptor, ref); | ||
| return blindCast(descriptor.factory)(validated)(ctx); | ||
| } | ||
| //#endregion | ||
| export { validateCodecTypeParams as n, materializeCodec as t }; | ||
| //# sourceMappingURL=resolve-codec-DR7uyr_c.mjs.map |
| {"version":3,"file":"resolve-codec-DR7uyr_c.mjs","names":[],"sources":["../src/shared/resolve-codec.ts"],"sourcesContent":["import { blindCast } from '@prisma-next/utils/casts';\nimport type { Codec } from './codec';\nimport type { AnyCodecDescriptor } from './codec-descriptor';\nimport type { CodecInstanceContext, CodecRef } from './codec-types';\nimport { runtimeError } from './runtime-error';\n\n/**\n * Validates `ref.typeParams` against `descriptor.paramsSchema`.\n *\n * Parameterized codecs that omit `typeParams` have it normalized to `{}` before\n * validation (mirrors `ast-codec-resolver.ts` semantics). Throws\n * `RUNTIME.TYPE_PARAMS_INVALID` when the validator returns a `Promise` or\n * reports issues.\n */\nexport function validateCodecTypeParams(descriptor: AnyCodecDescriptor, ref: CodecRef): unknown {\n const normalized =\n descriptor.isParameterized && ref.typeParams === undefined ? { ...ref, typeParams: {} } : ref;\n\n const result = blindCast<\n { value: unknown } | { issues: ReadonlyArray<{ message: string }> } | Promise<unknown>,\n 'Standard Schema validate returns unknown; the spec guarantees this union shape'\n >(descriptor.paramsSchema['~standard'].validate(normalized.typeParams));\n\n if (result instanceof Promise) {\n throw runtimeError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `paramsSchema for codec '${ref.codecId}' returned a Promise; runtime validation requires a synchronous Standard Schema validator.`,\n { codecId: ref.codecId, typeParams: ref.typeParams },\n );\n }\n\n if ('issues' in result && result.issues) {\n const messages = result.issues.map((issue) => issue.message).join('; ');\n throw runtimeError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `Invalid typeParams for codec '${ref.codecId}': ${messages}`,\n { codecId: ref.codecId, typeParams: ref.typeParams },\n );\n }\n\n return blindCast<{ value: unknown }, 'issues guard above rules out the issues branch'>(result)\n .value;\n}\n\n/**\n * Resolves a `Codec` instance: validates `ref.typeParams` via\n * {@link validateCodecTypeParams} then calls `descriptor.factory(validated)(ctx)`.\n *\n * The descriptor's `factory` is typed against its own `P`; the registry erases\n * `P` to `any`, so the factory is narrowed to `(params: unknown) => (ctx) => Codec`\n * at the call boundary. The `paramsSchema` validates the input above before we\n * forward it, so the narrowing is safe by construction.\n */\nexport function materializeCodec(\n descriptor: AnyCodecDescriptor,\n ref: CodecRef,\n ctx: CodecInstanceContext,\n): Codec {\n const validated = validateCodecTypeParams(descriptor, ref);\n return blindCast<\n (params: unknown) => (ctx: CodecInstanceContext) => Codec,\n 'registry erases P to any; paramsSchema validates input before forwarding'\n >(descriptor.factory)(validated)(ctx);\n}\n"],"mappings":";;;;;;;;;;;AAcA,SAAgB,wBAAwB,YAAgC,KAAwB;CAC9F,MAAM,aACJ,WAAW,mBAAmB,IAAI,eAAe,KAAA,IAAY;EAAE,GAAG;EAAK,YAAY,CAAC;CAAE,IAAI;CAE5F,MAAM,SAAS,UAGb,WAAW,aAAa,YAAY,CAAC,SAAS,WAAW,UAAU,CAAC;CAEtE,IAAI,kBAAkB,SACpB,MAAM,aACJ,+BACA,2BAA2B,IAAI,QAAQ,6FACvC;EAAE,SAAS,IAAI;EAAS,YAAY,IAAI;CAAW,CACrD;CAGF,IAAI,YAAY,UAAU,OAAO,QAAQ;EACvC,MAAM,WAAW,OAAO,OAAO,KAAK,UAAU,MAAM,OAAO,CAAC,CAAC,KAAK,IAAI;EACtE,MAAM,aACJ,+BACA,iCAAiC,IAAI,QAAQ,KAAK,YAClD;GAAE,SAAS,IAAI;GAAS,YAAY,IAAI;EAAW,CACrD;CACF;CAEA,OAAO,UAAgF,MAAM,CAAC,CAC3F;AACL;;;;;;;;;;AAWA,SAAgB,iBACd,YACA,KACA,KACO;CACP,MAAM,YAAY,wBAAwB,YAAY,GAAG;CACzD,OAAO,UAGL,WAAW,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG;AACtC"} |
920791
0.34%8717
0.39%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed