@prisma-next/framework-components 0.5.0-dev.3 → 0.5.0-dev.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +61 -0
  2. package/dist/authoring.d.mts +1 -1
  3. package/dist/authoring.mjs +1 -1
  4. package/dist/authoring.mjs.map +1 -1
  5. package/dist/codec-types-CB0jWeHU.d.mts +207 -0
  6. package/dist/codec-types-CB0jWeHU.d.mts.map +1 -0
  7. package/dist/codec.d.mts +2 -2
  8. package/dist/codec.mjs +38 -2
  9. package/dist/codec.mjs.map +1 -1
  10. package/dist/components.d.mts +1 -1
  11. package/dist/components.mjs +1 -1
  12. package/dist/control.d.mts +80 -27
  13. package/dist/control.d.mts.map +1 -1
  14. package/dist/control.mjs +11 -5
  15. package/dist/control.mjs.map +1 -1
  16. package/dist/emission-types-D6t3_a0x.d.mts +39 -0
  17. package/dist/emission-types-D6t3_a0x.d.mts.map +1 -0
  18. package/dist/emission.d.mts +2 -2
  19. package/dist/execution.d.mts +5 -5
  20. package/dist/execution.d.mts.map +1 -1
  21. package/dist/execution.mjs +3 -3
  22. package/dist/execution.mjs.map +1 -1
  23. package/dist/{framework-authoring-D1-JZ37B.d.mts → framework-authoring-BdrFDx4x.d.mts} +2 -2
  24. package/dist/framework-authoring-BdrFDx4x.d.mts.map +1 -0
  25. package/dist/{framework-components-EJXe-pum.d.mts → framework-components-AHI6V96G.d.mts} +6 -6
  26. package/dist/framework-components-AHI6V96G.d.mts.map +1 -0
  27. package/dist/{framework-components-C8ZhSwXe.mjs → framework-components-BsWST1Rn.mjs} +2 -2
  28. package/dist/framework-components-BsWST1Rn.mjs.map +1 -0
  29. package/dist/psl-ast-9X5rwo98.d.mts +159 -0
  30. package/dist/psl-ast-9X5rwo98.d.mts.map +1 -0
  31. package/dist/psl-ast.d.mts +2 -0
  32. package/dist/psl-ast.mjs +1 -0
  33. package/dist/runtime.d.mts +251 -19
  34. package/dist/runtime.d.mts.map +1 -1
  35. package/dist/runtime.mjs +215 -4
  36. package/dist/runtime.mjs.map +1 -1
  37. package/dist/{types-import-spec-C4sc7wbb.d.mts → types-import-spec-D-O6GotH.d.mts} +2 -2
  38. package/dist/types-import-spec-D-O6GotH.d.mts.map +1 -0
  39. package/package.json +8 -6
  40. package/src/control/control-capabilities.ts +71 -0
  41. package/src/{control-descriptors.ts → control/control-descriptors.ts} +7 -7
  42. package/src/{control-instances.ts → control/control-instances.ts} +6 -6
  43. package/src/{control-migration-types.ts → control/control-migration-types.ts} +27 -15
  44. package/src/control/control-operation-preview.ts +23 -0
  45. package/src/{control-stack.ts → control/control-stack.ts} +13 -13
  46. package/src/control/emission-types.ts +49 -0
  47. package/src/control/psl-ast.ts +193 -0
  48. package/src/{execution-descriptors.ts → execution/execution-descriptors.ts} +7 -7
  49. package/src/{execution-instances.ts → execution/execution-instances.ts} +1 -1
  50. package/src/{execution-requirements.ts → execution/execution-requirements.ts} +1 -1
  51. package/src/execution/query-plan.ts +53 -0
  52. package/src/execution/race-against-abort.ts +85 -0
  53. package/src/execution/run-with-middleware.ts +77 -0
  54. package/src/execution/runtime-core.ts +133 -0
  55. package/src/execution/runtime-error.ts +83 -0
  56. package/src/{runtime-middleware.ts → execution/runtime-middleware.ts} +32 -12
  57. package/src/exports/authoring.ts +2 -2
  58. package/src/exports/codec.ts +14 -2
  59. package/src/exports/components.ts +2 -2
  60. package/src/exports/control.ts +26 -12
  61. package/src/exports/emission.ts +2 -2
  62. package/src/exports/execution.ts +5 -5
  63. package/src/exports/psl-ast.ts +1 -0
  64. package/src/exports/runtime.ts +16 -5
  65. package/src/shared/codec-types.ts +261 -0
  66. package/dist/codec-types-B58nCJiu.d.mts +0 -40
  67. package/dist/codec-types-B58nCJiu.d.mts.map +0 -1
  68. package/dist/emission-types-BPAALJbF.d.mts +0 -24
  69. package/dist/emission-types-BPAALJbF.d.mts.map +0 -1
  70. package/dist/framework-authoring-D1-JZ37B.d.mts.map +0 -1
  71. package/dist/framework-components-C8ZhSwXe.mjs.map +0 -1
  72. package/dist/framework-components-EJXe-pum.d.mts.map +0 -1
  73. package/dist/types-import-spec-C4sc7wbb.d.mts.map +0 -1
  74. package/src/codec-types.ts +0 -46
  75. package/src/control-capabilities.ts +0 -34
  76. package/src/emission-types.ts +0 -28
  77. package/src/runtime-error.ts +0 -39
  78. /package/src/{control-result-types.ts → control/control-result-types.ts} +0 -0
  79. /package/src/{control-schema-view.ts → control/control-schema-view.ts} +0 -0
  80. /package/src/{async-iterable-result.ts → execution/async-iterable-result.ts} +0 -0
  81. /package/src/{execution-stack.ts → execution/execution-stack.ts} +0 -0
  82. /package/src/{framework-authoring.ts → shared/framework-authoring.ts} +0 -0
  83. /package/src/{framework-components.ts → shared/framework-components.ts} +0 -0
  84. /package/src/{mutation-default-types.ts → shared/mutation-default-types.ts} +0 -0
  85. /package/src/{types-import-spec.ts → shared/types-import-spec.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"execution.mjs","names":[],"sources":["../src/execution-requirements.ts","../src/execution-stack.ts"],"sourcesContent":["import type {\n RuntimeAdapterDescriptor,\n RuntimeExtensionDescriptor,\n RuntimeFamilyDescriptor,\n RuntimeTargetDescriptor,\n} from './execution-descriptors';\nimport { checkContractComponentRequirements } from './framework-components';\n\nexport function assertRuntimeContractRequirementsSatisfied<\n TFamilyId extends string,\n TTargetId extends string,\n>({\n contract,\n family,\n target,\n adapter,\n extensionPacks,\n}: {\n readonly contract: { readonly target: string; readonly extensionPacks?: Record<string, unknown> };\n readonly family: RuntimeFamilyDescriptor<TFamilyId>;\n readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId>;\n readonly extensionPacks: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId>[];\n}): void {\n const providedComponentIds = new Set<string>([family.id, target.id, adapter.id]);\n for (const extension of extensionPacks) {\n providedComponentIds.add(extension.id);\n }\n\n const result = checkContractComponentRequirements({\n contract,\n expectedTargetId: target.targetId,\n providedComponentIds,\n });\n\n if (result.targetMismatch) {\n throw new Error(\n `Contract target '${result.targetMismatch.actual}' does not match runtime target descriptor '${result.targetMismatch.expected}'.`,\n );\n }\n\n for (const packId of result.missingExtensionPackIds) {\n throw new Error(\n `Contract requires extension pack '${packId}', but runtime descriptors do not provide a matching component.`,\n );\n }\n}\n","import type {\n RuntimeAdapterDescriptor,\n RuntimeDriverDescriptor,\n RuntimeExtensionDescriptor,\n RuntimeTargetDescriptor,\n} from './execution-descriptors';\nimport type {\n RuntimeAdapterInstance,\n RuntimeDriverInstance,\n RuntimeExtensionInstance,\n RuntimeTargetInstance,\n} from './execution-instances';\n\nexport interface ExecutionStack<\n TFamilyId extends string,\n TTargetId extends string,\n TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId> = RuntimeAdapterInstance<\n TFamilyId,\n TTargetId\n >,\n TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId> = RuntimeDriverInstance<\n TFamilyId,\n TTargetId\n >,\n TExtensionInstance extends RuntimeExtensionInstance<\n TFamilyId,\n TTargetId\n > = RuntimeExtensionInstance<TFamilyId, TTargetId>,\n> {\n readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId, TAdapterInstance>;\n readonly driver:\n | RuntimeDriverDescriptor<TFamilyId, TTargetId, unknown, TDriverInstance>\n | undefined;\n readonly extensionPacks: readonly RuntimeExtensionDescriptor<\n TFamilyId,\n TTargetId,\n TExtensionInstance\n >[];\n}\n\nexport interface ExecutionStackInstance<\n TFamilyId extends string,\n TTargetId extends string,\n TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId> = RuntimeAdapterInstance<\n TFamilyId,\n TTargetId\n >,\n TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId> = RuntimeDriverInstance<\n TFamilyId,\n TTargetId\n >,\n TExtensionInstance extends RuntimeExtensionInstance<\n TFamilyId,\n TTargetId\n > = RuntimeExtensionInstance<TFamilyId, TTargetId>,\n> {\n readonly stack: ExecutionStack<\n TFamilyId,\n TTargetId,\n TAdapterInstance,\n TDriverInstance,\n TExtensionInstance\n >;\n readonly target: RuntimeTargetInstance<TFamilyId, TTargetId>;\n readonly adapter: TAdapterInstance;\n readonly driver: TDriverInstance | undefined;\n readonly extensionPacks: readonly TExtensionInstance[];\n}\n\nexport function createExecutionStack<\n TFamilyId extends string,\n TTargetId extends string,\n TTargetInstance extends RuntimeTargetInstance<TFamilyId, TTargetId>,\n TTargetDescriptor extends RuntimeTargetDescriptor<TFamilyId, TTargetId, TTargetInstance>,\n TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId>,\n TAdapterDescriptor extends RuntimeAdapterDescriptor<TFamilyId, TTargetId, TAdapterInstance>,\n TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId> = RuntimeDriverInstance<\n TFamilyId,\n TTargetId\n >,\n TDriverDescriptor extends\n | RuntimeDriverDescriptor<TFamilyId, TTargetId, unknown, TDriverInstance>\n | undefined = undefined,\n TExtensionInstance extends RuntimeExtensionInstance<\n TFamilyId,\n TTargetId\n > = RuntimeExtensionInstance<TFamilyId, TTargetId>,\n TExtensionDescriptor extends RuntimeExtensionDescriptor<\n TFamilyId,\n TTargetId,\n TExtensionInstance\n > = never,\n>(input: {\n readonly target: TTargetDescriptor;\n readonly adapter: TAdapterDescriptor;\n readonly driver?: TDriverDescriptor | undefined;\n readonly extensionPacks?: readonly TExtensionDescriptor[] | undefined;\n}): ExecutionStack<TFamilyId, TTargetId, TAdapterInstance, TDriverInstance, TExtensionInstance> & {\n readonly target: TTargetDescriptor;\n readonly adapter: TAdapterDescriptor;\n readonly driver: TDriverDescriptor | undefined;\n readonly extensionPacks: readonly TExtensionDescriptor[];\n} {\n return {\n target: input.target,\n adapter: input.adapter,\n driver: input.driver,\n extensionPacks: input.extensionPacks ?? [],\n };\n}\n\nexport function instantiateExecutionStack<\n TFamilyId extends string,\n TTargetId extends string,\n TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId>,\n TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId>,\n TExtensionInstance extends RuntimeExtensionInstance<TFamilyId, TTargetId>,\n>(\n stack: ExecutionStack<\n TFamilyId,\n TTargetId,\n TAdapterInstance,\n TDriverInstance,\n TExtensionInstance\n >,\n): ExecutionStackInstance<\n TFamilyId,\n TTargetId,\n TAdapterInstance,\n TDriverInstance,\n TExtensionInstance\n> {\n const driver = stack.driver ? stack.driver.create() : undefined;\n\n return {\n stack,\n target: stack.target.create(),\n adapter: stack.adapter.create(stack),\n driver,\n extensionPacks: stack.extensionPacks.map((descriptor) => descriptor.create()),\n };\n}\n"],"mappings":";;;AAQA,SAAgB,2CAGd,EACA,UACA,QACA,QACA,SACA,kBAOO;CACP,MAAM,uBAAuB,IAAI,IAAY;EAAC,OAAO;EAAI,OAAO;EAAI,QAAQ;EAAG,CAAC;AAChF,MAAK,MAAM,aAAa,eACtB,sBAAqB,IAAI,UAAU,GAAG;CAGxC,MAAM,SAAS,mCAAmC;EAChD;EACA,kBAAkB,OAAO;EACzB;EACD,CAAC;AAEF,KAAI,OAAO,eACT,OAAM,IAAI,MACR,oBAAoB,OAAO,eAAe,OAAO,8CAA8C,OAAO,eAAe,SAAS,IAC/H;AAGH,MAAK,MAAM,UAAU,OAAO,wBAC1B,OAAM,IAAI,MACR,qCAAqC,OAAO,iEAC7C;;;;;AC0BL,SAAgB,qBAuBd,OAUA;AACA,QAAO;EACL,QAAQ,MAAM;EACd,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,gBAAgB,MAAM,kBAAkB,EAAE;EAC3C;;AAGH,SAAgB,0BAOd,OAaA;CACA,MAAM,SAAS,MAAM,SAAS,MAAM,OAAO,QAAQ,GAAG;AAEtD,QAAO;EACL;EACA,QAAQ,MAAM,OAAO,QAAQ;EAC7B,SAAS,MAAM,QAAQ,OAAO,MAAM;EACpC;EACA,gBAAgB,MAAM,eAAe,KAAK,eAAe,WAAW,QAAQ,CAAC;EAC9E"}
1
+ {"version":3,"file":"execution.mjs","names":[],"sources":["../src/execution/execution-requirements.ts","../src/execution/execution-stack.ts"],"sourcesContent":["import { checkContractComponentRequirements } from '../shared/framework-components';\nimport type {\n RuntimeAdapterDescriptor,\n RuntimeExtensionDescriptor,\n RuntimeFamilyDescriptor,\n RuntimeTargetDescriptor,\n} from './execution-descriptors';\n\nexport function assertRuntimeContractRequirementsSatisfied<\n TFamilyId extends string,\n TTargetId extends string,\n>({\n contract,\n family,\n target,\n adapter,\n extensionPacks,\n}: {\n readonly contract: { readonly target: string; readonly extensionPacks?: Record<string, unknown> };\n readonly family: RuntimeFamilyDescriptor<TFamilyId>;\n readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId>;\n readonly extensionPacks: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId>[];\n}): void {\n const providedComponentIds = new Set<string>([family.id, target.id, adapter.id]);\n for (const extension of extensionPacks) {\n providedComponentIds.add(extension.id);\n }\n\n const result = checkContractComponentRequirements({\n contract,\n expectedTargetId: target.targetId,\n providedComponentIds,\n });\n\n if (result.targetMismatch) {\n throw new Error(\n `Contract target '${result.targetMismatch.actual}' does not match runtime target descriptor '${result.targetMismatch.expected}'.`,\n );\n }\n\n for (const packId of result.missingExtensionPackIds) {\n throw new Error(\n `Contract requires extension pack '${packId}', but runtime descriptors do not provide a matching component.`,\n );\n }\n}\n","import type {\n RuntimeAdapterDescriptor,\n RuntimeDriverDescriptor,\n RuntimeExtensionDescriptor,\n RuntimeTargetDescriptor,\n} from './execution-descriptors';\nimport type {\n RuntimeAdapterInstance,\n RuntimeDriverInstance,\n RuntimeExtensionInstance,\n RuntimeTargetInstance,\n} from './execution-instances';\n\nexport interface ExecutionStack<\n TFamilyId extends string,\n TTargetId extends string,\n TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId> = RuntimeAdapterInstance<\n TFamilyId,\n TTargetId\n >,\n TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId> = RuntimeDriverInstance<\n TFamilyId,\n TTargetId\n >,\n TExtensionInstance extends RuntimeExtensionInstance<\n TFamilyId,\n TTargetId\n > = RuntimeExtensionInstance<TFamilyId, TTargetId>,\n> {\n readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId, TAdapterInstance>;\n readonly driver:\n | RuntimeDriverDescriptor<TFamilyId, TTargetId, unknown, TDriverInstance>\n | undefined;\n readonly extensionPacks: readonly RuntimeExtensionDescriptor<\n TFamilyId,\n TTargetId,\n TExtensionInstance\n >[];\n}\n\nexport interface ExecutionStackInstance<\n TFamilyId extends string,\n TTargetId extends string,\n TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId> = RuntimeAdapterInstance<\n TFamilyId,\n TTargetId\n >,\n TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId> = RuntimeDriverInstance<\n TFamilyId,\n TTargetId\n >,\n TExtensionInstance extends RuntimeExtensionInstance<\n TFamilyId,\n TTargetId\n > = RuntimeExtensionInstance<TFamilyId, TTargetId>,\n> {\n readonly stack: ExecutionStack<\n TFamilyId,\n TTargetId,\n TAdapterInstance,\n TDriverInstance,\n TExtensionInstance\n >;\n readonly target: RuntimeTargetInstance<TFamilyId, TTargetId>;\n readonly adapter: TAdapterInstance;\n readonly driver: TDriverInstance | undefined;\n readonly extensionPacks: readonly TExtensionInstance[];\n}\n\nexport function createExecutionStack<\n TFamilyId extends string,\n TTargetId extends string,\n TTargetInstance extends RuntimeTargetInstance<TFamilyId, TTargetId>,\n TTargetDescriptor extends RuntimeTargetDescriptor<TFamilyId, TTargetId, TTargetInstance>,\n TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId>,\n TAdapterDescriptor extends RuntimeAdapterDescriptor<TFamilyId, TTargetId, TAdapterInstance>,\n TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId> = RuntimeDriverInstance<\n TFamilyId,\n TTargetId\n >,\n TDriverDescriptor extends\n | RuntimeDriverDescriptor<TFamilyId, TTargetId, unknown, TDriverInstance>\n | undefined = undefined,\n TExtensionInstance extends RuntimeExtensionInstance<\n TFamilyId,\n TTargetId\n > = RuntimeExtensionInstance<TFamilyId, TTargetId>,\n TExtensionDescriptor extends RuntimeExtensionDescriptor<\n TFamilyId,\n TTargetId,\n TExtensionInstance\n > = never,\n>(input: {\n readonly target: TTargetDescriptor;\n readonly adapter: TAdapterDescriptor;\n readonly driver?: TDriverDescriptor | undefined;\n readonly extensionPacks?: readonly TExtensionDescriptor[] | undefined;\n}): ExecutionStack<TFamilyId, TTargetId, TAdapterInstance, TDriverInstance, TExtensionInstance> & {\n readonly target: TTargetDescriptor;\n readonly adapter: TAdapterDescriptor;\n readonly driver: TDriverDescriptor | undefined;\n readonly extensionPacks: readonly TExtensionDescriptor[];\n} {\n return {\n target: input.target,\n adapter: input.adapter,\n driver: input.driver,\n extensionPacks: input.extensionPacks ?? [],\n };\n}\n\nexport function instantiateExecutionStack<\n TFamilyId extends string,\n TTargetId extends string,\n TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId>,\n TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId>,\n TExtensionInstance extends RuntimeExtensionInstance<TFamilyId, TTargetId>,\n>(\n stack: ExecutionStack<\n TFamilyId,\n TTargetId,\n TAdapterInstance,\n TDriverInstance,\n TExtensionInstance\n >,\n): ExecutionStackInstance<\n TFamilyId,\n TTargetId,\n TAdapterInstance,\n TDriverInstance,\n TExtensionInstance\n> {\n const driver = stack.driver ? stack.driver.create() : undefined;\n\n return {\n stack,\n target: stack.target.create(),\n adapter: stack.adapter.create(stack),\n driver,\n extensionPacks: stack.extensionPacks.map((descriptor) => descriptor.create()),\n };\n}\n"],"mappings":";;;AAQA,SAAgB,2CAGd,EACA,UACA,QACA,QACA,SACA,kBAOO;CACP,MAAM,uBAAuB,IAAI,IAAY;EAAC,OAAO;EAAI,OAAO;EAAI,QAAQ;EAAG,CAAC;AAChF,MAAK,MAAM,aAAa,eACtB,sBAAqB,IAAI,UAAU,GAAG;CAGxC,MAAM,SAAS,mCAAmC;EAChD;EACA,kBAAkB,OAAO;EACzB;EACD,CAAC;AAEF,KAAI,OAAO,eACT,OAAM,IAAI,MACR,oBAAoB,OAAO,eAAe,OAAO,8CAA8C,OAAO,eAAe,SAAS,IAC/H;AAGH,MAAK,MAAM,UAAU,OAAO,wBAC1B,OAAM,IAAI,MACR,qCAAqC,OAAO,iEAC7C;;;;;AC0BL,SAAgB,qBAuBd,OAUA;AACA,QAAO;EACL,QAAQ,MAAM;EACd,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,gBAAgB,MAAM,kBAAkB,EAAE;EAC3C;;AAGH,SAAgB,0BAOd,OAaA;CACA,MAAM,SAAS,MAAM,SAAS,MAAM,OAAO,QAAQ,GAAG;AAEtD,QAAO;EACL;EACA,QAAQ,MAAM,OAAO,QAAQ;EAC7B,SAAS,MAAM,QAAQ,OAAO,MAAM;EACpC;EACA,gBAAgB,MAAM,eAAe,KAAK,eAAe,WAAW,QAAQ,CAAC;EAC9E"}
@@ -1,4 +1,4 @@
1
- //#region src/framework-authoring.d.ts
1
+ //#region src/shared/framework-authoring.d.ts
2
2
  type AuthoringArgRef = {
3
3
  readonly kind: 'arg';
4
4
  readonly index: number;
@@ -96,4 +96,4 @@ declare function instantiateAuthoringFieldPreset(descriptor: AuthoringFieldPrese
96
96
  };
97
97
  //#endregion
98
98
  export { resolveAuthoringTemplateValue as _, AuthoringFieldNamespace as a, AuthoringStorageTypeTemplate as c, AuthoringTypeNamespace as d, instantiateAuthoringFieldPreset as f, isAuthoringTypeConstructorDescriptor as g, isAuthoringFieldPresetDescriptor as h, AuthoringContributions as i, AuthoringTemplateValue as l, isAuthoringArgRef as m, AuthoringArgumentDescriptor as n, AuthoringFieldPresetDescriptor as o, instantiateAuthoringTypeConstructor as p, AuthoringColumnDefaultTemplate as r, AuthoringFieldPresetOutput as s, AuthoringArgRef as t, AuthoringTypeConstructorDescriptor as u, validateAuthoringHelperArguments as v };
99
- //# sourceMappingURL=framework-authoring-D1-JZ37B.d.mts.map
99
+ //# sourceMappingURL=framework-authoring-BdrFDx4x.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-authoring-BdrFDx4x.d.mts","names":[],"sources":["../src/shared/framework-authoring.ts"],"sourcesContent":[],"mappings":";KAEY,eAAA;EAAA,SAAA,IAAA,EAAA,KAAe;EAOf,SAAA,KAAA,EAAA,MAAA;EAKR,SAAA,IAAA,CAAA,EAAA,SAAA,MAAA,EAAA;EACS,SAAA,OAAA,CAAA,EATQ,sBASR;CACiB;AAAsB,KAPxC,sBAAA,GAOwC,MAAA,GAAA,MAAA,GAAA,OAAA,GAAA,IAAA,GAFhD,eAEgD,GAAA,SADvC,sBACuC,EAAA,GAAA;EAE1C,UAAA,GAAA,EAAA,MAAA,CAAA,EAFoB,sBAEa;AAK3C,CAAA;UALU,iCAAA,CAKgC;EAYE,SAAA,IAAA,CAAA,EAAA,MAAA;EAAf,SAAA,QAAA,CAAA,EAAA,OAAA;;AAIZ,KAhBL,2BAAA,GAA8B,iCAgBG,GAAA,CAAA;EAEtB,SAAA,IAAA,EAAA,QAAA;CACgB,GAAA;EAAf,SAAA,IAAA,EAAA,QAAA;EAAM,SAAA,OAAA,CAAA,EAAA,OAAA;EAGb,SAAA,OAAA,CAAA,EAAA,MAAA;EAMA,SAAA,OAAA,CAAA,EAAA,MAAA;AAKjB,CAAA,GAAiB;EAKL,SAAA,IAAA,EAAA,aAAA;AAIZ,CAAA,GAAiB;EAEI,SAAA,IAAA,EAAA,QAAA;EACS,SAAA,UAAA,EAjCD,MAiCC,CAAA,MAAA,EAjCc,2BAiCd,CAAA;CAHsB,CAAA;AAA4B,UA1B/D,4BAAA,CA0B+D;EAQ/D,SAAA,OAAA,EAAA,MAAA;EAML,SAAA,UAAA,EAtCW,sBAuCI;EAGf,SAAA,UAAA,CAAA,EAzCY,MAyCW,CAAA,MAAA,EAzCI,sBA0CZ,CAAA;AAG3B;AAKgB,UA/CC,kCAAA,CA+C2C;EAkB5C,SAAA,IAAA,EAAA,iBAAA;EAYA,SAAA,IAAA,CAAA,EAAA,SA3EW,2BA6Ef,EAAA;EAUI,SAAA,MAAA,EAtFG,4BAuFP;AA2GZ;AAuFgB,UAtRC,qCAAA,CAuRH;EAUE,SAAA,IAAA,EAAA,SAAA;kBA/RE;;UAGD,sCAAA;;uBAEM;;KAGX,8BAAA,GACR,wCACA;UAEa,0BAAA,SAAmC;;qBAE/B;8BACS;;;;UAKb,8BAAA;;2BAEU;mBACR;;KAGP,sBAAA;2BACe,qCAAqC;;KAGpD,uBAAA;2BACe,iCAAiC;;UAG3C,sBAAA;kBACC;mBACC;;iBAGH,iBAAA,2BAA4C;iBAkB5C,oCAAA,2BAEJ;iBAUI,gCAAA,2BAEJ;iBAUI,6BAAA,WACJ;iBA2GI,gCAAA,2CAEQ;iBAqFR,mCAAA,aACF;;;wBAKU;;iBAKR,+BAAA,aACF;;;;0BAMY"}
@@ -1,9 +1,9 @@
1
- import { i as AuthoringContributions } from "./framework-authoring-D1-JZ37B.mjs";
2
- import { t as Codec } from "./codec-types-B58nCJiu.mjs";
3
- import { t as TypesImportSpec } from "./types-import-spec-C4sc7wbb.mjs";
1
+ import { i as AuthoringContributions } from "./framework-authoring-BdrFDx4x.mjs";
2
+ import { t as Codec } from "./codec-types-CB0jWeHU.mjs";
3
+ import { t as TypesImportSpec } from "./types-import-spec-D-O6GotH.mjs";
4
4
  import { ColumnDefault, ExecutionMutationDefaultValue } from "@prisma-next/contract/types";
5
5
 
6
- //#region src/mutation-default-types.d.ts
6
+ //#region src/shared/mutation-default-types.d.ts
7
7
  interface SourcePosition {
8
8
  readonly offset: number;
9
9
  readonly line: number;
@@ -84,7 +84,7 @@ interface ControlMutationDefaults {
84
84
  readonly generatorDescriptors: readonly MutationDefaultGeneratorDescriptor[];
85
85
  }
86
86
  //#endregion
87
- //#region src/framework-components.d.ts
87
+ //#region src/shared/framework-components.d.ts
88
88
  /**
89
89
  * Declarative fields that describe component metadata.
90
90
  */
@@ -421,4 +421,4 @@ interface ExtensionInstance<TFamilyId extends string, TTargetId extends string>
421
421
  }
422
422
  //#endregion
423
423
  export { LoweredDefaultResult as A, ControlMutationDefaultEntry as C, DefaultFunctionLoweringHandler as D, DefaultFunctionLoweringContext as E, SourceSpan as F, MutationDefaultGeneratorDescriptor as M, ParsedDefaultFunctionCall as N, DefaultFunctionRegistry as O, SourceDiagnostic as P, checkContractComponentRequirements as S, ControlMutationDefaults as T, PackRefBase as _, ComponentMetadata as a, TargetInstance as b, DriverDescriptor as c, ExtensionDescriptor as d, ExtensionInstance as f, FamilyPackRef as g, FamilyInstance as h, ComponentDescriptor as i, LoweredDefaultValue as j, DefaultFunctionRegistryEntry as k, DriverInstance as l, FamilyDescriptor as m, AdapterInstance as n, ContractComponentRequirementsCheckInput as o, ExtensionPackRef as p, AdapterPackRef as r, ContractComponentRequirementsCheckResult as s, AdapterDescriptor as t, DriverPackRef as u, TargetBoundComponentDescriptor as v, ControlMutationDefaultRegistry as w, TargetPackRef as x, TargetDescriptor as y };
424
- //# sourceMappingURL=framework-components-EJXe-pum.d.mts.map
424
+ //# sourceMappingURL=framework-components-AHI6V96G.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-components-AHI6V96G.d.mts","names":[],"sources":["../src/shared/mutation-default-types.ts","../src/shared/framework-components.ts"],"sourcesContent":[],"mappings":";;;;;;UAEU,cAAA;;;;;AAAA,UAMO,UAAA,CANO;EAMP,SAAA,KAAU,EACT,cAAA;EAID,SAAA,GAAA,EAHD,cAGiB;;AAKN,UALV,gBAAA,CAKU;EAAT,SAAA,IAAA,EAAA,MAAA;EAAQ,SAAA,OAAA,EAAA,MAAA;EAGhB,SAAA,QAAA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CAAA;;AAC+B,UA9QlB,wCAAA,CA8QkB;EAA/B,SAAA,cAAA,CAAA,EAAA;IAAmB,SAAA,QAAA,EAAA,MAAA;IAEN,SAAA,MAAc,EAAA,MAAA;EAId,CAAA,GAAA,SAAA;EAKA,SAAA,cAAe,CAAA,EAAA;IAKf,SAAA,QAAc,EAAA,MAAA;IAKd,SAAA,MAAA,EAAiB,MAAA;;;;iBA7RlB,kCAAA,QACP,0CACN;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA6Dc,mDAAmD;;qBAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA8BJ,6EACP;;qBAEW;;qBAGA;;;;;;UAOJ,mEACP;iBACO;;qBAEI;;uBAEE;;KAGX,mDAAmD,sBAAsB;KAEzE,sFAGR,sBAAsB;qBACL;;KAGT,uFAGR,uBAAuB;qBACN;;KAGT,yFAGR,yBAAyB;qBACR;;KAGT,sFAGR,sBAAsB;qBACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA+BJ,8EACP;;qBAEW;;qBAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiCJ,6EACP;;qBAEW;;qBAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA8BJ,gFACP;;qBAEW;;qBAGA;;;KAIT,qFACR,iBAAiB,WAAW,aAC5B,kBAAkB,WAAW,aAC7B,iBAAiB,WAAW,aAC5B,oBAAoB,WAAW;UAElB;qBACI;;UAGJ;qBACI;qBACA;;UAGJ;qBACI;qBACA;;UAGJ;qBACI;qBACA;;UAGJ;qBACI;qBACA"}
@@ -1,4 +1,4 @@
1
- //#region src/framework-components.ts
1
+ //#region src/shared/framework-components.ts
2
2
  function checkContractComponentRequirements(input) {
3
3
  const providedIds = /* @__PURE__ */ new Set();
4
4
  for (const id of input.providedComponentIds) providedIds.add(id);
@@ -24,4 +24,4 @@ function checkContractComponentRequirements(input) {
24
24
 
25
25
  //#endregion
26
26
  export { checkContractComponentRequirements as t };
27
- //# sourceMappingURL=framework-components-C8ZhSwXe.mjs.map
27
+ //# sourceMappingURL=framework-components-BsWST1Rn.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-components-BsWST1Rn.mjs","names":[],"sources":["../src/shared/framework-components.ts"],"sourcesContent":["import type { Codec } from './codec-types';\nimport type { AuthoringContributions } from './framework-authoring';\nimport type { ControlMutationDefaults } from './mutation-default-types';\nimport type { TypesImportSpec } from './types-import-spec';\n\n/**\n * Declarative fields that describe component metadata.\n */\nexport interface ComponentMetadata {\n /** Component version (semver) */\n readonly version: string;\n\n /**\n * Capabilities this component provides.\n *\n * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into\n * the contract) and also exposed in runtime adapter code (e.g. `adapter.profile.capabilities`);\n * keep these declarations in sync. Targets are identifiers/descriptors and typically do not\n * declare capabilities.\n */\n readonly capabilities?: Record<string, unknown>;\n\n /** Type imports for contract.d.ts generation */\n readonly types?: {\n readonly codecTypes?: {\n /**\n * Base codec types import spec.\n * Optional: adapters typically provide this, extensions usually don't.\n */\n readonly import?: TypesImportSpec;\n /**\n * Additional type-only imports for parameterized codec branded types.\n *\n * These imports are included in generated `contract.d.ts` but are NOT treated as\n * codec type maps (i.e., they should not be intersected into `export type CodecTypes = ...`).\n *\n * Example: `Vector<N>` for pgvector codecs that emit `Vector<1536>`\n */\n readonly typeImports?: ReadonlyArray<TypesImportSpec>;\n /**\n * Optional control-plane hooks keyed by codecId.\n * Used by family-specific planners/verifiers to handle storage types.\n */\n readonly controlPlaneHooks?: Record<string, unknown>;\n /**\n * Codec instances contributed by this component.\n * Used to build a CodecLookup for codec-dispatched type rendering during emission.\n */\n readonly codecInstances?: ReadonlyArray<Codec>;\n };\n readonly operationTypes?: { readonly import: TypesImportSpec };\n readonly queryOperationTypes?: { readonly import: TypesImportSpec };\n readonly storage?: ReadonlyArray<{\n readonly typeId: string;\n readonly familyId: string;\n readonly targetId: string;\n readonly nativeType?: string;\n }>;\n };\n\n /**\n * Optional pure-data authoring contributions exposed by this component.\n *\n * These contributions are safe to include on pack refs and descriptors because\n * they contain only declarative metadata. Higher-level authoring packages may\n * project them into concrete helper functions for TS-first workflows.\n */\n readonly authoring?: AuthoringContributions;\n\n /**\n * Scalar type name to codec ID mapping contributed by this component.\n * Assembled by `createControlStack` with duplicate detection.\n */\n readonly scalarTypeDescriptors?: ReadonlyMap<string, string>;\n\n /**\n * Mutation default function handlers and generator descriptors contributed\n * by this component. Assembled by `createControlStack` with duplicate detection.\n */\n readonly controlMutationDefaults?: ControlMutationDefaults;\n}\n\n/**\n * Base descriptor for any framework component.\n *\n * All component descriptors share these fundamental properties that identify\n * the component and provide its metadata. This interface is extended by\n * specific descriptor types (FamilyDescriptor, TargetDescriptor, etc.).\n *\n * @template Kind - Discriminator literal identifying the component type.\n * Built-in kinds are 'family', 'target', 'adapter', 'driver', 'extension',\n * but the type accepts any string to allow ecosystem extensions.\n *\n * @example\n * ```ts\n * // All descriptors have these properties\n * descriptor.kind // The Kind type parameter (e.g., 'family', 'target', or custom kinds)\n * descriptor.id // Unique string identifier (e.g., 'sql', 'postgres')\n * descriptor.version // Component version (semver)\n * ```\n */\nexport interface ComponentDescriptor<Kind extends string> extends ComponentMetadata {\n /** Discriminator identifying the component type */\n readonly kind: Kind;\n\n /** Unique identifier for this component (e.g., 'sql', 'postgres', 'pgvector') */\n readonly id: string;\n}\n\nexport interface ContractComponentRequirementsCheckInput {\n readonly contract: {\n readonly target: string;\n readonly targetFamily?: string | undefined;\n readonly extensionPacks?: Record<string, unknown> | undefined;\n };\n readonly expectedTargetFamily?: string | undefined;\n readonly expectedTargetId?: string | undefined;\n readonly providedComponentIds: Iterable<string>;\n}\n\nexport interface ContractComponentRequirementsCheckResult {\n readonly familyMismatch?: { readonly expected: string; readonly actual: string } | undefined;\n readonly targetMismatch?: { readonly expected: string; readonly actual: string } | undefined;\n readonly missingExtensionPackIds: readonly string[];\n}\n\nexport function checkContractComponentRequirements(\n input: ContractComponentRequirementsCheckInput,\n): ContractComponentRequirementsCheckResult {\n const providedIds = new Set<string>();\n for (const id of input.providedComponentIds) {\n providedIds.add(id);\n }\n\n const requiredExtensionPackIds = input.contract.extensionPacks\n ? Object.keys(input.contract.extensionPacks)\n : [];\n const missingExtensionPackIds = requiredExtensionPackIds.filter((id) => !providedIds.has(id));\n\n const expectedTargetFamily = input.expectedTargetFamily;\n const contractTargetFamily = input.contract.targetFamily;\n const familyMismatch =\n expectedTargetFamily !== undefined &&\n contractTargetFamily !== undefined &&\n contractTargetFamily !== expectedTargetFamily\n ? { expected: expectedTargetFamily, actual: contractTargetFamily }\n : undefined;\n\n const expectedTargetId = input.expectedTargetId;\n const contractTargetId = input.contract.target;\n const targetMismatch =\n expectedTargetId !== undefined && contractTargetId !== expectedTargetId\n ? { expected: expectedTargetId, actual: contractTargetId }\n : undefined;\n\n return {\n ...(familyMismatch ? { familyMismatch } : {}),\n ...(targetMismatch ? { targetMismatch } : {}),\n missingExtensionPackIds,\n };\n}\n\n/**\n * Descriptor for a family component.\n *\n * A \"family\" represents a category of data sources with shared semantics\n * (e.g., SQL databases, document stores). Families define:\n * - Query semantics and operations (SELECT, INSERT, find, aggregate, etc.)\n * - Contract structure (tables vs collections, columns vs fields)\n * - Type system and codecs\n *\n * Families are the top-level grouping. Each family contains multiple targets\n * (e.g., SQL family contains Postgres, MySQL, SQLite targets).\n *\n * Extended by plane-specific descriptors:\n * - `ControlFamilyDescriptor` - adds `emission` for CLI/tooling operations\n * - `RuntimeFamilyDescriptor` - adds runtime-specific factory methods\n *\n * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')\n *\n * @example\n * ```ts\n * import sql from '@prisma-next/family-sql/control';\n *\n * sql.kind // 'family'\n * sql.familyId // 'sql'\n * sql.id // 'sql'\n * ```\n */\nexport interface FamilyDescriptor<TFamilyId extends string> extends ComponentDescriptor<'family'> {\n /** The family identifier (e.g., 'sql', 'document') */\n readonly familyId: TFamilyId;\n}\n\n/**\n * Descriptor for a target component.\n *\n * A \"target\" represents a specific database or data store within a family\n * (e.g., Postgres, MySQL, MongoDB). Targets define:\n * - Native type mappings (e.g., Postgres int4 → TypeScript number)\n * - Target-specific capabilities (e.g., RETURNING, LATERAL joins)\n *\n * Targets are bound to a family and provide the target-specific implementation\n * details that adapters and drivers use.\n *\n * Extended by plane-specific descriptors:\n * - `ControlTargetDescriptor` - adds optional `migrations` capability\n * - `RuntimeTargetDescriptor` - adds runtime factory method\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')\n *\n * @example\n * ```ts\n * import postgres from '@prisma-next/target-postgres/control';\n *\n * postgres.kind // 'target'\n * postgres.familyId // 'sql'\n * postgres.targetId // 'postgres'\n * ```\n */\nexport interface TargetDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'target'> {\n /** The family this target belongs to */\n readonly familyId: TFamilyId;\n\n /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */\n readonly targetId: TTargetId;\n}\n\n/**\n * Base shape for any pack reference.\n * Pack refs are pure JSON-friendly objects safe to import in authoring flows.\n */\nexport interface PackRefBase<Kind extends string, TFamilyId extends string>\n extends ComponentMetadata {\n readonly kind: Kind;\n readonly id: string;\n readonly familyId: TFamilyId;\n readonly targetId?: string;\n readonly authoring?: AuthoringContributions;\n}\n\nexport type FamilyPackRef<TFamilyId extends string = string> = PackRefBase<'family', TFamilyId>;\n\nexport type TargetPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'target', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type AdapterPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'adapter', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type ExtensionPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'extension', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type DriverPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'driver', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\n/**\n * Descriptor for an adapter component.\n *\n * An \"adapter\" provides the protocol and dialect implementation for a target.\n * Adapters handle:\n * - SQL/query generation (lowering AST to target-specific syntax)\n * - Codec registration (encoding/decoding between JS and wire types)\n * - Type mappings and coercions\n *\n * Adapters are bound to a specific family+target combination and work with\n * any compatible driver for that target.\n *\n * Extended by plane-specific descriptors:\n * - `ControlAdapterDescriptor` - control-plane factory\n * - `RuntimeAdapterDescriptor` - runtime factory\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import postgresAdapter from '@prisma-next/adapter-postgres/control';\n *\n * postgresAdapter.kind // 'adapter'\n * postgresAdapter.familyId // 'sql'\n * postgresAdapter.targetId // 'postgres'\n * ```\n */\nexport interface AdapterDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'adapter'> {\n /** The family this adapter belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this adapter is designed for */\n readonly targetId: TTargetId;\n}\n\n/**\n * Descriptor for a driver component.\n *\n * A \"driver\" provides the connection and execution layer for a target.\n * Drivers handle:\n * - Connection management (pooling, timeouts, retries)\n * - Query execution (sending SQL/commands, receiving results)\n * - Transaction management\n * - Wire protocol communication\n *\n * Drivers are bound to a specific family+target and work with any compatible\n * adapter. Multiple drivers can exist for the same target (e.g., node-postgres\n * vs postgres.js for Postgres).\n *\n * Extended by plane-specific descriptors:\n * - `ControlDriverDescriptor` - creates driver from connection URL\n * - `RuntimeDriverDescriptor` - creates driver with runtime options\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import postgresDriver from '@prisma-next/driver-postgres/control';\n *\n * postgresDriver.kind // 'driver'\n * postgresDriver.familyId // 'sql'\n * postgresDriver.targetId // 'postgres'\n * ```\n */\nexport interface DriverDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'driver'> {\n /** The family this driver belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this driver connects to */\n readonly targetId: TTargetId;\n}\n\n/**\n * Descriptor for an extension component.\n *\n * An \"extension\" adds optional capabilities to a target. Extensions can provide:\n * - Additional operations (e.g., vector similarity search with pgvector)\n * - Custom types and codecs (e.g., vector type)\n * - Extended query capabilities\n *\n * Extensions are bound to a specific family+target and are registered in the\n * config alongside the core components. Multiple extensions can be used together.\n *\n * Extended by plane-specific descriptors:\n * - `ControlExtensionDescriptor` - control-plane extension factory\n * - `RuntimeExtensionDescriptor` - runtime extension factory\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import pgvector from '@prisma-next/extension-pgvector/control';\n *\n * pgvector.kind // 'extension'\n * pgvector.familyId // 'sql'\n * pgvector.targetId // 'postgres'\n * ```\n */\nexport interface ExtensionDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'extension'> {\n /** The family this extension belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this extension is designed for */\n readonly targetId: TTargetId;\n}\n\n/** Components bound to a specific family+target combination. */\nexport type TargetBoundComponentDescriptor<TFamilyId extends string, TTargetId extends string> =\n | TargetDescriptor<TFamilyId, TTargetId>\n | AdapterDescriptor<TFamilyId, TTargetId>\n | DriverDescriptor<TFamilyId, TTargetId>\n | ExtensionDescriptor<TFamilyId, TTargetId>;\n\nexport interface FamilyInstance<TFamilyId extends string> {\n readonly familyId: TFamilyId;\n}\n\nexport interface TargetInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface AdapterInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface DriverInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface ExtensionInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n"],"mappings":";AA8HA,SAAgB,mCACd,OAC0C;CAC1C,MAAM,8BAAc,IAAI,KAAa;AACrC,MAAK,MAAM,MAAM,MAAM,qBACrB,aAAY,IAAI,GAAG;CAMrB,MAAM,2BAH2B,MAAM,SAAS,iBAC5C,OAAO,KAAK,MAAM,SAAS,eAAe,GAC1C,EAAE,EACmD,QAAQ,OAAO,CAAC,YAAY,IAAI,GAAG,CAAC;CAE7F,MAAM,uBAAuB,MAAM;CACnC,MAAM,uBAAuB,MAAM,SAAS;CAC5C,MAAM,iBACJ,yBAAyB,UACzB,yBAAyB,UACzB,yBAAyB,uBACrB;EAAE,UAAU;EAAsB,QAAQ;EAAsB,GAChE;CAEN,MAAM,mBAAmB,MAAM;CAC/B,MAAM,mBAAmB,MAAM,SAAS;CACxC,MAAM,iBACJ,qBAAqB,UAAa,qBAAqB,mBACnD;EAAE,UAAU;EAAkB,QAAQ;EAAkB,GACxD;AAEN,QAAO;EACL,GAAI,iBAAiB,EAAE,gBAAgB,GAAG,EAAE;EAC5C,GAAI,iBAAiB,EAAE,gBAAgB,GAAG,EAAE;EAC5C;EACD"}
@@ -0,0 +1,159 @@
1
+ //#region src/control/psl-ast.d.ts
2
+ interface PslPosition {
3
+ readonly offset: number;
4
+ readonly line: number;
5
+ readonly column: number;
6
+ }
7
+ interface PslSpan {
8
+ readonly start: PslPosition;
9
+ readonly end: PslPosition;
10
+ }
11
+ type PslDiagnosticCode = 'PSL_UNTERMINATED_BLOCK' | 'PSL_UNSUPPORTED_TOP_LEVEL_BLOCK' | 'PSL_INVALID_ATTRIBUTE_SYNTAX' | 'PSL_INVALID_MODEL_MEMBER' | 'PSL_UNSUPPORTED_MODEL_ATTRIBUTE' | 'PSL_UNSUPPORTED_FIELD_ATTRIBUTE' | 'PSL_INVALID_RELATION_ATTRIBUTE' | 'PSL_INVALID_REFERENTIAL_ACTION' | 'PSL_INVALID_DEFAULT_VALUE' | 'PSL_INVALID_ENUM_MEMBER' | 'PSL_INVALID_TYPES_MEMBER';
12
+ interface PslDiagnostic {
13
+ readonly code: PslDiagnosticCode;
14
+ readonly message: string;
15
+ readonly sourceId: string;
16
+ readonly span: PslSpan;
17
+ }
18
+ interface PslDefaultFunctionValue {
19
+ readonly kind: 'function';
20
+ readonly name: 'autoincrement' | 'now';
21
+ }
22
+ interface PslDefaultLiteralValue {
23
+ readonly kind: 'literal';
24
+ readonly value: string | number | boolean;
25
+ }
26
+ type PslDefaultValue = PslDefaultFunctionValue | PslDefaultLiteralValue;
27
+ type PslAttributeTarget = 'field' | 'model' | 'enum' | 'namedType';
28
+ interface PslAttributePositionalArgument {
29
+ readonly kind: 'positional';
30
+ readonly value: string;
31
+ readonly span: PslSpan;
32
+ }
33
+ interface PslAttributeNamedArgument {
34
+ readonly kind: 'named';
35
+ readonly name: string;
36
+ readonly value: string;
37
+ readonly span: PslSpan;
38
+ }
39
+ type PslAttributeArgument = PslAttributePositionalArgument | PslAttributeNamedArgument;
40
+ interface PslTypeConstructorCall {
41
+ readonly kind: 'typeConstructor';
42
+ readonly path: readonly string[];
43
+ readonly args: readonly PslAttributeArgument[];
44
+ readonly span: PslSpan;
45
+ }
46
+ interface PslAttribute {
47
+ readonly kind: 'attribute';
48
+ readonly target: PslAttributeTarget;
49
+ readonly name: string;
50
+ readonly args: readonly PslAttributeArgument[];
51
+ readonly span: PslSpan;
52
+ }
53
+ type PslReferentialAction = string;
54
+ type PslFieldAttribute = PslAttribute;
55
+ interface PslField {
56
+ readonly kind: 'field';
57
+ readonly name: string;
58
+ readonly typeName: string;
59
+ readonly typeConstructor?: PslTypeConstructorCall;
60
+ readonly optional: boolean;
61
+ readonly list: boolean;
62
+ readonly typeRef?: string;
63
+ readonly attributes: readonly PslFieldAttribute[];
64
+ readonly span: PslSpan;
65
+ }
66
+ interface PslUniqueConstraint {
67
+ readonly kind: 'unique';
68
+ readonly fields: readonly string[];
69
+ readonly span: PslSpan;
70
+ }
71
+ interface PslIndexConstraint {
72
+ readonly kind: 'index';
73
+ readonly fields: readonly string[];
74
+ readonly span: PslSpan;
75
+ }
76
+ type PslModelAttribute = PslAttribute;
77
+ interface PslModel {
78
+ readonly kind: 'model';
79
+ readonly name: string;
80
+ readonly fields: readonly PslField[];
81
+ readonly attributes: readonly PslModelAttribute[];
82
+ readonly span: PslSpan;
83
+ /**
84
+ * Optional leading comment line emitted above the `model` keyword by the
85
+ * printer. Producers (e.g. `sqlSchemaIrToPslAst`) attach introspection
86
+ * advisories such as "// WARNING: This table has no primary key in the
87
+ * database" here. The parser leaves this field unset; round-tripping a
88
+ * parsed schema does not re-attach comments.
89
+ */
90
+ readonly comment?: string;
91
+ }
92
+ interface PslEnumValue {
93
+ readonly kind: 'enumValue';
94
+ readonly name: string;
95
+ /**
96
+ * Optional storage label for the enum member, captured from a trailing
97
+ * `@map("...")` attribute on the member line. The parser populates this
98
+ * when the source PSL carries an explicit `@map`. Producers (e.g.
99
+ * `sqlSchemaIrToPslAst`) leave it unset; the printer emits `@map(...)`
100
+ * automatically when normalisation would change the printed member name
101
+ * (so an enum value `'in-progress'` becomes `inProgress @map("in-progress")`
102
+ * in PSL, preserving the round-trip).
103
+ */
104
+ readonly mapName?: string;
105
+ readonly span: PslSpan;
106
+ }
107
+ interface PslEnum {
108
+ readonly kind: 'enum';
109
+ readonly name: string;
110
+ readonly values: readonly PslEnumValue[];
111
+ readonly attributes: readonly PslAttribute[];
112
+ readonly span: PslSpan;
113
+ }
114
+ interface PslCompositeType {
115
+ readonly kind: 'compositeType';
116
+ readonly name: string;
117
+ readonly fields: readonly PslField[];
118
+ readonly attributes: readonly PslAttribute[];
119
+ readonly span: PslSpan;
120
+ }
121
+ interface PslNamedTypeDeclaration {
122
+ readonly kind: 'namedType';
123
+ readonly name: string;
124
+ /**
125
+ * Parser invariant: exactly one of `baseType` and `typeConstructor` is set.
126
+ * Expressing this as a discriminated union trips TypeScript narrowing when
127
+ * the declaration flows through helpers that accept the full union.
128
+ */
129
+ readonly baseType?: string;
130
+ readonly typeConstructor?: PslTypeConstructorCall;
131
+ readonly attributes: readonly PslAttribute[];
132
+ readonly span: PslSpan;
133
+ }
134
+ interface PslTypesBlock {
135
+ readonly kind: 'types';
136
+ readonly declarations: readonly PslNamedTypeDeclaration[];
137
+ readonly span: PslSpan;
138
+ }
139
+ interface PslDocumentAst {
140
+ readonly kind: 'document';
141
+ readonly sourceId: string;
142
+ readonly models: readonly PslModel[];
143
+ readonly enums: readonly PslEnum[];
144
+ readonly compositeTypes: readonly PslCompositeType[];
145
+ readonly types?: PslTypesBlock;
146
+ readonly span: PslSpan;
147
+ }
148
+ interface ParsePslDocumentInput {
149
+ readonly schema: string;
150
+ readonly sourceId: string;
151
+ }
152
+ interface ParsePslDocumentResult {
153
+ readonly ast: PslDocumentAst;
154
+ readonly diagnostics: readonly PslDiagnostic[];
155
+ readonly ok: boolean;
156
+ }
157
+ //#endregion
158
+ export { PslPosition as C, PslTypesBlock as D, PslTypeConstructorCall as E, PslUniqueConstraint as O, PslNamedTypeDeclaration as S, PslSpan as T, PslField as _, PslAttributeNamedArgument as a, PslModel as b, PslCompositeType as c, PslDefaultValue as d, PslDiagnostic as f, PslEnumValue as g, PslEnum as h, PslAttributeArgument as i, PslDefaultFunctionValue as l, PslDocumentAst as m, ParsePslDocumentResult as n, PslAttributePositionalArgument as o, PslDiagnosticCode as p, PslAttribute as r, PslAttributeTarget as s, ParsePslDocumentInput as t, PslDefaultLiteralValue as u, PslFieldAttribute as v, PslReferentialAction as w, PslModelAttribute as x, PslIndexConstraint as y };
159
+ //# sourceMappingURL=psl-ast-9X5rwo98.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"psl-ast-9X5rwo98.d.mts","names":[],"sources":["../src/control/psl-ast.ts"],"sourcesContent":[],"mappings":";UAAiB,WAAA;EAAA,SAAA,MAAW,EAAA,MAAA;EAMX,SAAA,IAAO,EAAA,MACN;EAIN,SA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AAA;EACI,SAAA,IAAA,EAAA,SAtFN,oBAsFM,EAAA;EACf,SAAA,IAAA,EAtFA,OAsFA;;AAGA,UAtFA,YAAA,CAsFuB;EASX,SAAA,IAAA,EAAA,WAAA;EACG,SAAA,MAAA,EA9Fb,kBA8Fa;EACf,SAAA,IAAA,EAAA,MAAA;EAAO,SAAA,IAAA,EAAA,SA7FE,oBA6FF,EAAA;EAGP,SAAA,IAAA,EA/FA,OA+Fa;AAM9B;AAG4B,KArGhB,oBAAA,GAqGgB,MAAA;AACD,KApGf,iBAAA,GAAoB,YAoGL;AACS,UAnGnB,QAAA,CAmGmB;EACjB,SAAA,IAAA,EAAA,OAAA;EACF,SAAA,IAAA,EAAA,MAAA;EAAO,SAAA,QAAA,EAAA,MAAA;EAGP,SAAA,eAAqB,CAAA,EApGT,sBAoGS;EAKrB,SAAA,QAAA,EAAA,OAAsB;;;gCArGP;iBACf;;UAGA,mBAAA;;;iBAGA;;UAGA,kBAAA;;;iBAGA;;KAGL,iBAAA,GAAoB;UAEf,QAAA;;;4BAGW;gCACI;iBACf;;;;;;;;;;UAWA,YAAA;;;;;;;;;;;;;iBAaA;;UAGA,OAAA;;;4BAGW;gCACI;iBACf;;UAGA,gBAAA;;;4BAGW;gCACI;iBACf;;UAGA,uBAAA;;;;;;;;;6BASY;gCACG;iBACf;;UAGA,aAAA;;kCAEiB;iBACjB;;UAGA,cAAA;;;4BAGW;2BACD;oCACS;mBACjB;iBACF;;UAGA,qBAAA;;;;UAKA,sBAAA;gBACD;iCACiB"}
@@ -0,0 +1,2 @@
1
+ import { C as PslPosition, D as PslTypesBlock, E as PslTypeConstructorCall, O as PslUniqueConstraint, S as PslNamedTypeDeclaration, T as PslSpan, _ as PslField, a as PslAttributeNamedArgument, b as PslModel, c as PslCompositeType, d as PslDefaultValue, f as PslDiagnostic, g as PslEnumValue, h as PslEnum, i as PslAttributeArgument, l as PslDefaultFunctionValue, m as PslDocumentAst, n as ParsePslDocumentResult, o as PslAttributePositionalArgument, p as PslDiagnosticCode, r as PslAttribute, s as PslAttributeTarget, t as ParsePslDocumentInput, u as PslDefaultLiteralValue, v as PslFieldAttribute, w as PslReferentialAction, x as PslModelAttribute, y as PslIndexConstraint } from "./psl-ast-9X5rwo98.mjs";
2
+ export { ParsePslDocumentInput, ParsePslDocumentResult, PslAttribute, PslAttributeArgument, PslAttributeNamedArgument, PslAttributePositionalArgument, PslAttributeTarget, PslCompositeType, PslDefaultFunctionValue, PslDefaultLiteralValue, PslDefaultValue, PslDiagnostic, PslDiagnosticCode, PslDocumentAst, PslEnum, PslEnumValue, PslField, PslFieldAttribute, PslIndexConstraint, PslModel, PslModelAttribute, PslNamedTypeDeclaration, PslPosition, PslReferentialAction, PslSpan, PslTypeConstructorCall, PslTypesBlock, PslUniqueConstraint };
@@ -0,0 +1 @@
1
+ export { };
@@ -1,6 +1,7 @@
1
+ import { n as CodecCallContext } from "./codec-types-CB0jWeHU.mjs";
1
2
  import { PlanMeta } from "@prisma-next/contract/types";
2
3
 
3
- //#region src/async-iterable-result.d.ts
4
+ //#region src/execution/async-iterable-result.d.ts
4
5
  declare class AsyncIterableResult<Row> implements AsyncIterable<Row>, PromiseLike<Row[]> {
5
6
  private readonly generator;
6
7
  private consumed;
@@ -14,16 +15,136 @@ declare class AsyncIterableResult<Row> implements AsyncIterable<Row>, PromiseLik
14
15
  then<TResult1 = Row[], TResult2 = never>(onfulfilled?: ((value: Row[]) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
15
16
  }
16
17
  //#endregion
17
- //#region src/runtime-error.d.ts
18
+ //#region src/execution/query-plan.d.ts
19
+ /**
20
+ * Family-agnostic plan marker.
21
+ *
22
+ * Carries only `meta` (the family-agnostic plan metadata) and the optional
23
+ * phantom `_row` parameter that lets type-level utilities recover the row
24
+ * type from a plan value. SQL and Mongo extend this marker with their own
25
+ * concrete shapes (`SqlQueryPlan`, `MongoQueryPlan`).
26
+ *
27
+ * `QueryPlan` is the *pre-lowering* marker — i.e. the surface a builder
28
+ * produces before family-specific lowering turns it into an executable
29
+ * plan (`ExecutionPlan`).
30
+ */
31
+ interface QueryPlan<Row = unknown> {
32
+ readonly meta: PlanMeta;
33
+ /**
34
+ * Phantom property to carry the Row generic for type-level utilities.
35
+ * Not set at runtime; used only for `ResultType` extraction.
36
+ */
37
+ readonly _row?: Row;
38
+ }
39
+ /**
40
+ * Family-agnostic execution-plan marker.
41
+ *
42
+ * Extends `QueryPlan` with no additional structural fields — the marker
43
+ * exists to nominally distinguish executable plans from pre-lowering plans
44
+ * in the type system. Family-specific execution plans (`SqlExecutionPlan`,
45
+ * `MongoExecutionPlan`) extend this marker with their concrete shapes
46
+ * (e.g. `sql + params` for SQL, `wireCommand` for Mongo).
47
+ */
48
+ interface ExecutionPlan<Row = unknown> extends QueryPlan<Row> {}
49
+ /**
50
+ * Extracts the `Row` type from a plan via the phantom `_row` property.
51
+ *
52
+ * Works with any plan that extends `QueryPlan<Row>` — including
53
+ * `ExecutionPlan<Row>`, `SqlQueryPlan<Row>`, `SqlExecutionPlan<Row>`,
54
+ * `MongoQueryPlan<Row>`, and `MongoExecutionPlan<Row>`.
55
+ *
56
+ * The `_row` property must be present in the plan's static type for the
57
+ * conditional to bind `R`; objects whose type lacks `_row` resolve to
58
+ * `never`. Without the `keyof` guard, `extends { _row?: infer R }` would
59
+ * silently match any object and infer `unknown`.
60
+ *
61
+ * Example: `type Row = ResultType<typeof plan>`.
62
+ */
63
+ type ResultType<P> = '_row' extends keyof P ? P extends {
64
+ readonly _row?: infer R;
65
+ } ? R : never : never;
66
+ //#endregion
67
+ //#region src/execution/runtime-error.d.ts
18
68
  interface RuntimeErrorEnvelope extends Error {
19
69
  readonly code: string;
20
70
  readonly category: 'PLAN' | 'CONTRACT' | 'LINT' | 'BUDGET' | 'RUNTIME';
21
71
  readonly severity: 'error';
22
72
  readonly details?: Record<string, unknown>;
23
73
  }
74
+ /**
75
+ * Stable code emitted by the runtime when an in-flight `execute()`
76
+ * is cancelled via the per-query `AbortSignal`. The envelope's
77
+ * `details.phase` distinguishes where the abort was observed:
78
+ *
79
+ * - `'encode'` — abort fired during `encodeParams` (SQL) or
80
+ * `resolveValue` (Mongo).
81
+ * - `'decode'` — abort fired during `decodeRow` / `decodeField`.
82
+ * - `'stream'` — abort fired between rows or before any codec call
83
+ * (already-aborted at entry).
84
+ */
85
+ declare const RUNTIME_ABORTED: "RUNTIME.ABORTED";
86
+ /** Discriminator placed in `details.phase` of a `RUNTIME.ABORTED` envelope. */
87
+ type RuntimeAbortedPhase = 'encode' | 'decode' | 'stream';
88
+ /**
89
+ * Type guard for the runtime-error envelope produced by `runtimeError`.
90
+ *
91
+ * Prefer this over duck-typing on `error.code` directly so consumers stay
92
+ * insulated from the envelope's internal shape.
93
+ */
94
+ declare function isRuntimeError(error: unknown): error is RuntimeErrorEnvelope;
24
95
  declare function runtimeError(code: string, message: string, details?: Record<string, unknown>): RuntimeErrorEnvelope;
96
+ /**
97
+ * Construct a `RUNTIME.ABORTED` envelope. Phase distinguishes where the
98
+ * abort was observed (encode / decode / stream); cause carries `signal.reason`
99
+ * verbatim from the platform — native abort produces a `DOMException`,
100
+ * explicit `controller.abort(reason)` produces whatever the caller passed.
101
+ * No synthesis happens here.
102
+ */
103
+ declare function runtimeAborted(phase: RuntimeAbortedPhase, cause?: unknown): RuntimeErrorEnvelope;
104
+ //#endregion
105
+ //#region src/execution/race-against-abort.d.ts
106
+ /**
107
+ * Throw a phase-tagged `RUNTIME.ABORTED` envelope if the supplied
108
+ * codec-call context is already aborted at the precheck site. Centralises
109
+ * the `if (ctx.signal?.aborted) throw runtimeAborted(...)` pattern that
110
+ * every codec dispatch site repeats.
111
+ */
112
+ declare function checkAborted(ctx: CodecCallContext, phase: RuntimeAbortedPhase): void;
113
+ /**
114
+ * Race a per-cell `Promise.all` (or any other in-flight work promise) against
115
+ * the supplied abort signal so the runtime returns `RUNTIME.ABORTED` promptly
116
+ * even when codec bodies ignore the signal. In-flight bodies that ignore the
117
+ * signal are abandoned and run to completion in the background — the
118
+ * cooperative-cancellation contract documented in ADR 204.
119
+ *
120
+ * Call sites still SHOULD pre-check `signal.aborted` and short-circuit with
121
+ * a phase-tagged `RUNTIME.ABORTED` envelope before invoking this helper —
122
+ * that path is the canonical "aborted at entry" surface and avoids
123
+ * scheduling the work promise. As a defensive belt-and-braces, this helper
124
+ * also handles the already-aborted case internally: `AbortSignal` does not
125
+ * replay past abort events to listeners registered after the abort, so we
126
+ * inspect `signal.aborted` synchronously and reject with the sentinel
127
+ * before installing the listener. The rejection is still attributed to the
128
+ * abort path via the sentinel-identity check.
129
+ *
130
+ * Distinguishing the rejection source is load-bearing for AC-ERR4
131
+ * (`RUNTIME.ENCODE_FAILED` / `RUNTIME.DECODE_FAILED` pass through unchanged).
132
+ * The semantically equivalent `abortable(signal)` helper in
133
+ * `@prisma-next/utils` rejects with `signal.reason ?? new DOMException(...)`,
134
+ * which is not stably distinguishable from a codec-thrown error by identity
135
+ * alone (a fresh fallback DOMException is allocated per call). We instead
136
+ * track abort attribution with a unique sentinel: only the `onAbort` listener
137
+ * installed here ever rejects with the sentinel, so an `error === sentinel`
138
+ * identity check after the race is unambiguous.
139
+ *
140
+ * Lives in `framework-components` (rather than the SQL family, where it
141
+ * originated in m2) so every family runtime that needs cooperative
142
+ * cancellation around a codec-dispatch `Promise.all` (SQL encode + decode
143
+ * today, Mongo encode in m3) shares the same attribution logic.
144
+ */
145
+ declare function raceAgainstAbort<T>(work: Promise<T>, signal: AbortSignal | undefined, phase: RuntimeAbortedPhase): Promise<T>;
25
146
  //#endregion
26
- //#region src/runtime-middleware.d.ts
147
+ //#region src/execution/runtime-middleware.d.ts
27
148
  interface RuntimeLog {
28
149
  info(event: unknown): void;
29
150
  warn(event: unknown): void;
@@ -41,19 +162,33 @@ interface AfterExecuteResult {
41
162
  readonly latencyMs: number;
42
163
  readonly completed: boolean;
43
164
  }
44
- interface RuntimeMiddleware {
165
+ /**
166
+ * Family-agnostic middleware SPI parameterized over the plan marker.
167
+ *
168
+ * `TPlan` defaults to the framework `QueryPlan` marker so a generic
169
+ * middleware (e.g. cross-family telemetry) can be authored without
170
+ * naming a family. Family-specific middleware (`SqlMiddleware`,
171
+ * `MongoMiddleware`) narrow `TPlan` to their concrete plan type.
172
+ */
173
+ interface RuntimeMiddleware<TPlan extends QueryPlan = QueryPlan> {
45
174
  readonly name: string;
46
175
  readonly familyId?: string;
47
176
  readonly targetId?: string;
48
- beforeExecute?(plan: {
49
- readonly meta: PlanMeta;
50
- }, ctx: RuntimeMiddlewareContext): Promise<void>;
51
- onRow?(row: Record<string, unknown>, plan: {
52
- readonly meta: PlanMeta;
53
- }, ctx: RuntimeMiddlewareContext): Promise<void>;
54
- afterExecute?(plan: {
55
- readonly meta: PlanMeta;
56
- }, result: AfterExecuteResult, ctx: RuntimeMiddlewareContext): Promise<void>;
177
+ beforeExecute?(plan: TPlan, ctx: RuntimeMiddlewareContext): Promise<void>;
178
+ onRow?(row: Record<string, unknown>, plan: TPlan, ctx: RuntimeMiddlewareContext): Promise<void>;
179
+ afterExecute?(plan: TPlan, result: AfterExecuteResult, ctx: RuntimeMiddlewareContext): Promise<void>;
180
+ }
181
+ /**
182
+ * Optional per-`execute` options accepted by every family runtime.
183
+ *
184
+ * `signal` is the per-query cancellation signal. The runtime threads the
185
+ * signal through to every codec call for the query and uses it to short-
186
+ * circuit the row stream with `RUNTIME.ABORTED` when the caller aborts.
187
+ * Omitting the option (or passing `undefined`) preserves today's behavior
188
+ * bit-for-bit.
189
+ */
190
+ interface RuntimeExecuteOptions {
191
+ readonly signal?: AbortSignal;
57
192
  }
58
193
  /**
59
194
  * Cross-family SPI for any runtime that can execute plans and be shut down.
@@ -61,17 +196,114 @@ interface RuntimeMiddleware {
61
196
  * Mongo structurally (due to its phantom Row parameter using a unique symbol).
62
197
  *
63
198
  * The `_row` intersection on `execute` connects the `Row` type parameter to the
64
- * plan, mirroring how `ExecutionPlan<Row>` carries a phantom `_row?: Row`.
199
+ * plan, mirroring how `QueryPlan<Row>` carries a phantom `_row?: Row`.
65
200
  */
66
- interface RuntimeExecutor<TPlan extends {
67
- readonly meta: PlanMeta;
68
- }> {
201
+ interface RuntimeExecutor<TPlan extends QueryPlan> {
69
202
  execute<Row>(plan: TPlan & {
70
203
  readonly _row?: Row;
71
- }): AsyncIterableResult<Row>;
204
+ }, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
72
205
  close(): Promise<void>;
73
206
  }
74
207
  declare function checkMiddlewareCompatibility(middleware: RuntimeMiddleware, runtimeFamilyId: string, runtimeTargetId: string): void;
75
208
  //#endregion
76
- export { type AfterExecuteResult, AsyncIterableResult, type RuntimeErrorEnvelope, type RuntimeExecutor, type RuntimeLog, type RuntimeMiddleware, type RuntimeMiddlewareContext, checkMiddlewareCompatibility, runtimeError };
209
+ //#region src/execution/run-with-middleware.d.ts
210
+ /**
211
+ * Drives a single execution of `runDriver()` through the middleware lifecycle.
212
+ *
213
+ * Lifecycle, in order:
214
+ * 1. For each middleware in registration order: `beforeExecute(exec, ctx)`.
215
+ * 2. For each row yielded by `runDriver()`: for each middleware in registration
216
+ * order: `onRow(row, exec, ctx)`; then yield the row to the consumer.
217
+ * 3. On successful completion: for each middleware in registration order:
218
+ * `afterExecute(exec, { rowCount, latencyMs, completed: true }, ctx)`.
219
+ * 4. On any error thrown by the driver loop: for each middleware in
220
+ * registration order: `afterExecute(exec, { rowCount, latencyMs,
221
+ * completed: false }, ctx)`. Errors thrown by `afterExecute` during the
222
+ * error path are swallowed so they do not mask the original driver error.
223
+ * The original error is then rethrown.
224
+ *
225
+ * This helper is the single canonical implementation of the middleware
226
+ * orchestration loop; family runtimes should not reimplement it.
227
+ */
228
+ declare function runWithMiddleware<TExec extends ExecutionPlan, Row>(exec: TExec, middleware: ReadonlyArray<RuntimeMiddleware<TExec>>, ctx: RuntimeMiddlewareContext, runDriver: () => AsyncIterable<Row>): AsyncIterableResult<Row>;
229
+ //#endregion
230
+ //#region src/execution/runtime-core.d.ts
231
+ /**
232
+ * Constructor options shared by every concrete `RuntimeCore` subclass.
233
+ *
234
+ * Family runtimes typically build the middleware list and the
235
+ * `RuntimeMiddlewareContext` themselves (running compatibility checks,
236
+ * narrowing the context's `contract` field, etc.) before calling `super`.
237
+ */
238
+ interface RuntimeCoreOptions<TMiddleware extends RuntimeMiddleware<ExecutionPlan>> {
239
+ readonly middleware: ReadonlyArray<TMiddleware>;
240
+ readonly ctx: RuntimeMiddlewareContext;
241
+ }
242
+ /**
243
+ * Family-agnostic abstract runtime base.
244
+ *
245
+ * Defines the entire `execute(plan)` template in one place:
246
+ *
247
+ * 1. `runBeforeCompile(plan)` — concrete; defaults to identity. SQL overrides
248
+ * this to run its `beforeCompile` middleware-hook chain.
249
+ * 2. `lower(plan)` — abstract. Each family produces its `*ExecutionPlan`
250
+ * (SQL via `lowerSqlPlan`, Mongo via `adapter.lower`).
251
+ * 3. `runWithMiddleware(exec, this.middleware, this.ctx,
252
+ * () => runDriver(exec))` — concrete; lifts the middleware lifecycle
253
+ * out of the family runtimes into the canonical helper.
254
+ *
255
+ * Concrete subclasses must implement `lower`, `runDriver`, and `close`.
256
+ *
257
+ * The class is generic over:
258
+ * - `TPlan` — the family's pre-lowering plan type.
259
+ * - `TExec` — the family's post-lowering (executable) plan type.
260
+ * - `TMiddleware` — the family's middleware type. Constrained to
261
+ * `RuntimeMiddleware<TExec>` because `runWithMiddleware` invokes the
262
+ * `beforeExecute` / `onRow` / `afterExecute` hooks with the lowered
263
+ * `TExec`. (The spec/plan wording "RuntimeMiddleware<TPlan>" is
264
+ * tightened to `<TExec>` here so the helper call typechecks; the
265
+ * intent is unchanged — middleware sees the post-lowering plan.)
266
+ */
267
+ declare abstract class RuntimeCore<TPlan extends QueryPlan, TExec extends ExecutionPlan, TMiddleware extends RuntimeMiddleware<TExec>> implements RuntimeExecutor<TPlan> {
268
+ protected readonly middleware: ReadonlyArray<TMiddleware>;
269
+ protected readonly ctx: RuntimeMiddlewareContext;
270
+ constructor(options: RuntimeCoreOptions<TMiddleware>);
271
+ /**
272
+ * Pre-lowering hook for plan rewriting. Defaults to identity. Subclasses
273
+ * may override to run a `beforeCompile` middleware chain (SQL does this
274
+ * to support typed AST rewrites — see `before-compile-chain.ts`).
275
+ */
276
+ protected runBeforeCompile(plan: TPlan): TPlan | Promise<TPlan>;
277
+ /**
278
+ * Lower a pre-lowering `TPlan` into the family's executable `TExec`.
279
+ * Family-specific: SQL produces `{ sql, params, ast?, ... }`; Mongo
280
+ * produces `{ command, ... }`.
281
+ *
282
+ * `ctx` carries per-query cancellation (and any future fields on
283
+ * `CodecCallContext`); concrete subclasses forward it to the
284
+ * encode-side codec dispatch site (e.g. SQL's `encodeParams` in m2,
285
+ * Mongo's `resolveValue` in m3). The runtime allocates one ctx per
286
+ * `execute()` call and threads the same reference everywhere; the
287
+ * `signal` field inside may be `undefined`, but the ctx object itself
288
+ * is always present.
289
+ */
290
+ protected abstract lower(plan: TPlan, ctx: CodecCallContext): TExec | Promise<TExec>;
291
+ /**
292
+ * Drive the underlying transport for a lowered `TExec`. Yields raw rows
293
+ * directly from the driver as `Record<string, unknown>`; codec decoding
294
+ * (if any) is the subclass's responsibility, applied by wrapping
295
+ * `execute()` rather than living inside this hook.
296
+ *
297
+ * The `Row` type parameter on `execute()` is satisfied by the caller via
298
+ * the plan's phantom `_row`; the runtime treats rows as opaque records
299
+ * here and trusts the caller's row typing.
300
+ */
301
+ protected abstract runDriver(exec: TExec): AsyncIterable<Record<string, unknown>>;
302
+ abstract close(): Promise<void>;
303
+ execute<Row>(plan: TPlan & {
304
+ readonly _row?: Row;
305
+ }, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
306
+ }
307
+ //#endregion
308
+ export { type AfterExecuteResult, AsyncIterableResult, type ExecutionPlan, type QueryPlan, RUNTIME_ABORTED, type ResultType, type RuntimeAbortedPhase, RuntimeCore, type RuntimeCoreOptions, type RuntimeErrorEnvelope, type RuntimeExecuteOptions, type RuntimeExecutor, type RuntimeLog, type RuntimeMiddleware, type RuntimeMiddlewareContext, checkAborted, checkMiddlewareCompatibility, isRuntimeError, raceAgainstAbort, runWithMiddleware, runtimeAborted, runtimeError };
77
309
  //# sourceMappingURL=runtime.d.mts.map