@prisma/orm-framework 8.0.0-rc.1-dev.46 → 8.0.0-rc.10-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -5
- package/dist/{apply-specifier-default-control-policy-CAxiXxKg.d.mts → apply-specifier-default-control-policy-C2Njpc_G.d.mts} +2 -2
- package/dist/apply-specifier-default-control-policy-C2Njpc_G.d.mts.map +1 -0
- package/dist/{assertions-Cz-GWH8P.mjs → assertions-Dw1lZz_Q.mjs} +2 -2
- package/dist/{assertions-Cz-GWH8P.mjs.map → assertions-Dw1lZz_Q.mjs.map} +1 -1
- package/dist/authoring-D2ngo2MB.d.mts +1 -0
- package/dist/{canonicalization-DFpB09nP-4OdB2nsy.d.mts → canonicalization-BAvRuZ2i-IwsqxGme.d.mts} +3 -3
- package/dist/{canonicalization-DFpB09nP-4OdB2nsy.d.mts.map → canonicalization-BAvRuZ2i-IwsqxGme.d.mts.map} +1 -1
- package/dist/{capabilities-BCEONw9w-C-lo3rF8.mjs → capabilities-BzwH_XMZ-CkgWaxF9.mjs} +3 -3
- package/dist/{capabilities-BCEONw9w-C-lo3rF8.mjs.map → capabilities-BzwH_XMZ-CkgWaxF9.mjs.map} +1 -1
- package/dist/{codec-Cd0QcxAx.mjs → codec-DWYH-Ra4.mjs} +3 -3
- package/dist/{codec-Cd0QcxAx.mjs.map → codec-DWYH-Ra4.mjs.map} +1 -1
- package/dist/{codec-Ce07W3Mz.d.mts → codec-DxAIshoO.d.mts} +6 -9
- package/dist/{codec-Ce07W3Mz.d.mts.map → codec-DxAIshoO.d.mts.map} +1 -1
- package/dist/{codec-types-D6VRj2RE-BLElXc-O.d.mts → codec-types-nVMtogur-CYBdUQUH.d.mts} +4 -4
- package/dist/{codec-types-D6VRj2RE-BLElXc-O.d.mts.map → codec-types-nVMtogur-CYBdUQUH.d.mts.map} +1 -1
- package/dist/{codec-types-DcNvNeY1-BO6kUiH0.mjs → codec-types-smcGzGq6-BohNffPc.mjs} +3 -3
- package/dist/{codec-types-DcNvNeY1-BO6kUiH0.mjs.map → codec-types-smcGzGq6-BohNffPc.mjs.map} +1 -1
- package/dist/{components-CGA_WwEG.d.mts → components-CQrZAxZu.d.mts} +4 -4
- package/dist/{components-CGA_WwEG.d.mts.map → components-CQrZAxZu.d.mts.map} +1 -1
- package/dist/{components-dZRz3T5y.mjs → components-CnV-6irM.mjs} +2 -2
- package/dist/{components-dZRz3T5y.mjs.map → components-CnV-6irM.mjs.map} +1 -1
- package/dist/components.d.mts +16 -16
- package/dist/components.mjs +10 -10
- package/dist/components__authoring.d.mts +3 -3
- package/dist/components__authoring.mjs +1 -1
- package/dist/components__codec.d.mts +2 -2
- package/dist/components__codec.mjs +3 -3
- package/dist/components__components.d.mts +3 -3
- package/dist/components__components.mjs +2 -2
- package/dist/components__control.d.mts +2 -2
- package/dist/components__control.mjs +1 -1
- package/dist/components__emission.d.mts +3 -3
- package/dist/components__execution.d.mts +1 -1
- package/dist/components__ir.d.mts +1 -1
- package/dist/components__ir.mjs +1 -1
- package/dist/components__psl-ast.d.mts +4 -4
- package/dist/components__runtime.d.mts +2 -2
- package/dist/components__runtime.mjs +2 -2
- package/dist/{config-types-CW4PDwMC.d.mts → config-types-CeduUYkY.d.mts} +12 -25
- package/dist/{config-types-CW4PDwMC.d.mts.map → config-types-CeduUYkY.d.mts.map} +1 -1
- package/dist/config-types-D_UCRNbm.mjs +38 -0
- package/dist/config-types-D_UCRNbm.mjs.map +1 -0
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +2 -2
- package/dist/config__config-types.d.mts +2 -2
- package/dist/config__config-types.mjs +2 -2
- package/dist/contract-authoring.d.mts +39 -4
- package/dist/contract-authoring.d.mts.map +1 -1
- package/dist/contract-authoring.mjs +66 -3
- package/dist/contract-authoring.mjs.map +1 -1
- package/dist/{contract-types-CkdMH7F7-9EHXSwbH.d.mts → contract-types-Bje5yT4f-0D1Z41Lq.d.mts} +7 -7
- package/dist/{contract-types-CkdMH7F7-9EHXSwbH.d.mts.map → contract-types-Bje5yT4f-0D1Z41Lq.d.mts.map} +1 -1
- package/dist/contract.d.mts +11 -11
- package/dist/contract.mjs +3 -3
- package/dist/contract__apply-specifier-default-control-policy.d.mts +1 -1
- package/dist/contract__default-namespace.mjs +1 -1
- package/dist/contract__enum-accessor.d.mts +1 -1
- package/dist/contract__hashing-utils.d.mts +1 -1
- package/dist/contract__hashing.d.mts +2 -2
- package/dist/contract__resolve-domain-model.d.mts +1 -1
- package/dist/contract__types.d.mts +5 -5
- package/dist/contract__types.mjs +2 -2
- package/dist/contract__validate-domain.d.mts +1 -1
- package/dist/contract__validate-domain.mjs +1 -1
- package/dist/{control-DLEm6u5m.mjs → control-DR0zF1b7.mjs} +12 -5
- package/dist/control-DR0zF1b7.mjs.map +1 -0
- package/dist/{control-BD96JZi8-NUhO5Kkw.mjs → control-ZdvxNTVU-cVV8u7aQ.mjs} +7 -7
- package/dist/control-ZdvxNTVU-cVV8u7aQ.mjs.map +1 -0
- package/dist/{control-BF8qzdnM.d.mts → control-eH2MIHqA.d.mts} +12 -11
- package/dist/{control-BF8qzdnM.d.mts.map → control-eH2MIHqA.d.mts.map} +1 -1
- package/dist/{control-ql9N9u4f-r3Vv41kZ.d.mts → control-ql9N9u4f-D5sGnPR-.d.mts} +2 -2
- package/dist/{control-ql9N9u4f-r3Vv41kZ.d.mts.map → control-ql9N9u4f-D5sGnPR-.d.mts.map} +1 -1
- package/dist/{default-namespace-D4vCwkXg-lzVN7gSc.mjs → default-namespace-D4vCwkXg-BEZbN38y.mjs} +2 -2
- package/dist/{default-namespace-D4vCwkXg-lzVN7gSc.mjs.map → default-namespace-D4vCwkXg-BEZbN38y.mjs.map} +1 -1
- package/dist/{dist-Dqbo77p7.mjs → dist-DUlexZHp.mjs} +3 -3
- package/dist/{dist-Dqbo77p7.mjs.map → dist-DUlexZHp.mjs.map} +1 -1
- package/dist/{domain-envelope-D6Wn9AmZ-BqZKTT9U.d.mts → domain-envelope-CENjHN4U-BIIt9bl4.d.mts} +17 -5
- package/dist/{domain-envelope-D6Wn9AmZ-BqZKTT9U.d.mts.map → domain-envelope-CENjHN4U-BIIt9bl4.d.mts.map} +1 -1
- package/dist/emission-BWD6Z6w9.d.mts +2 -0
- package/dist/{emission-types-DLXP34Ki-CFms3VrX.d.mts → emission-types-BoSJNKfQ-B_19ILPP.d.mts} +10 -6
- package/dist/emission-types-BoSJNKfQ-B_19ILPP.d.mts.map +1 -0
- package/dist/{enum-accessor-PH5vjghI.d.mts → enum-accessor-PSFq-BB1.d.mts} +3 -3
- package/dist/{enum-accessor-PH5vjghI.d.mts.map → enum-accessor-PSFq-BB1.d.mts.map} +1 -1
- package/dist/errors.d.mts +3 -3
- package/dist/errors.mjs +3 -3
- package/dist/errors__control.d.mts +1 -1
- package/dist/errors__control.mjs +1 -1
- package/dist/errors__execution.d.mts +1 -1
- package/dist/errors__execution.mjs +1 -1
- package/dist/errors__migration.d.mts +1 -1
- package/dist/errors__migration.mjs +1 -1
- package/dist/{execution-CSnQT8EX.d.mts → execution-BDzJVN0t.d.mts} +2 -2
- package/dist/{execution-CSnQT8EX.d.mts.map → execution-BDzJVN0t.d.mts.map} +1 -1
- package/dist/{execution-Crk6IfTs.mjs → execution-BEVehm0I.mjs} +8 -8
- package/dist/execution-BEVehm0I.mjs.map +1 -0
- package/dist/{execution-Cyl2dXxX.d.mts → execution-BpT2YjbZ.d.mts} +4 -4
- package/dist/{execution-Cyl2dXxX.d.mts.map → execution-BpT2YjbZ.d.mts.map} +1 -1
- package/dist/{framework-authoring-BhctBwih-DQ_6noDM.d.mts → framework-authoring-BYgPL2X6-DMKO0Z_k.d.mts} +17 -12
- package/dist/framework-authoring-BYgPL2X6-DMKO0Z_k.d.mts.map +1 -0
- package/dist/{framework-authoring-CDEvlouU-DKklu-fL.mjs → framework-authoring-BvxZnsPY-DlD1nwU5.mjs} +34 -19
- package/dist/framework-authoring-BvxZnsPY-DlD1nwU5.mjs.map +1 -0
- package/dist/{framework-components-hZ2tO-KH-CdRXBOYd.d.mts → framework-components-CDppKaT_-DcMHokB8.d.mts} +9 -6
- package/dist/{framework-components-hZ2tO-KH-CdRXBOYd.d.mts.map → framework-components-CDppKaT_-DcMHokB8.d.mts.map} +1 -1
- package/dist/{hashing-CccSPELN.d.mts → hashing-BTx0s6Zw.d.mts} +3 -3
- package/dist/{hashing-CccSPELN.d.mts.map → hashing-BTx0s6Zw.d.mts.map} +1 -1
- package/dist/{hashing-utils-qKu59RSC.d.mts → hashing-utils-Bh9PVd4J.d.mts} +2 -2
- package/dist/{hashing-utils-qKu59RSC.d.mts.map → hashing-utils-Bh9PVd4J.d.mts.map} +1 -1
- package/dist/ids.d.mts +2 -2
- package/dist/ids.mjs +1 -1
- package/dist/ids__runtime.d.mts +1 -1
- package/dist/ids__runtime.mjs +1 -1
- package/dist/{internal-error-kK8QvlDE.d.mts → internal-error-2fJ9fcZX.d.mts} +2 -2
- package/dist/{internal-error-kK8QvlDE.d.mts.map → internal-error-2fJ9fcZX.d.mts.map} +1 -1
- package/dist/{internal-error-BIc-ehme-ouBQPoEL.mjs → internal-error-ChGYPVpq-DhUD05u0.mjs} +3 -3
- package/dist/internal-error-ChGYPVpq-DhUD05u0.mjs.map +1 -0
- package/dist/{ir-BvE7L9FK.d.mts → ir-BGaPKem0.d.mts} +2 -2
- package/dist/{ir-BvE7L9FK.d.mts.map → ir-BGaPKem0.d.mts.map} +1 -1
- package/dist/{ir-ChmSSAhX.mjs → ir-CV5d1FJ0.mjs} +2 -2
- package/dist/{ir-ChmSSAhX.mjs.map → ir-CV5d1FJ0.mjs.map} +1 -1
- package/dist/{migration-BvrgDZXw.d.mts → migration-Bdp-ucGZ.d.mts} +2 -2
- package/dist/{migration-BvrgDZXw.d.mts.map → migration-Bdp-ucGZ.d.mts.map} +1 -1
- package/dist/{migration-C57VKLUY.mjs → migration-S40Rgr7K.mjs} +3 -3
- package/dist/migration-S40Rgr7K.mjs.map +1 -0
- package/dist/operations.mjs +1 -1
- package/dist/{parse-0ZJjj_2N-DhQpSVmQ.d.mts → parse-B5xYL_oV-aGFgfM8N.d.mts} +5 -5
- package/dist/{parse-0ZJjj_2N-DhQpSVmQ.d.mts.map → parse-B5xYL_oV-aGFgfM8N.d.mts.map} +1 -1
- package/dist/{parse-GbZGfMUj-BFSrD2AN.mjs → parse-GbZGfMUj-C9tHGn-6.mjs} +2 -2
- package/dist/{parse-GbZGfMUj-BFSrD2AN.mjs.map → parse-GbZGfMUj-C9tHGn-6.mjs.map} +1 -1
- package/dist/{psl-ast-BXZoFQBk.d.mts → psl-ast-BkfQwHjE.d.mts} +4 -4
- package/dist/{psl-ast-BXZoFQBk.d.mts.map → psl-ast-BkfQwHjE.d.mts.map} +1 -1
- package/dist/{psl-ast-CWJQF8LA-Vr5JNPdn.d.mts → psl-ast-dnXw52MT-1jSUKlC9.d.mts} +4 -4
- package/dist/{psl-ast-CWJQF8LA-Vr5JNPdn.d.mts.map → psl-ast-dnXw52MT-1jSUKlC9.d.mts.map} +1 -1
- package/dist/psl-parser.d.mts +195 -74
- package/dist/psl-parser.d.mts.map +1 -1
- package/dist/psl-parser.mjs +213 -46
- package/dist/psl-parser.mjs.map +1 -1
- package/dist/psl-parser__format.mjs +2 -2
- package/dist/psl-parser__interpret.d.mts +32 -5
- package/dist/psl-parser__interpret.d.mts.map +1 -1
- package/dist/psl-parser__interpret.mjs +25 -2
- package/dist/psl-parser__interpret.mjs.map +1 -1
- package/dist/psl-parser__syntax.d.mts +1 -1
- package/dist/psl-parser__syntax.mjs +1 -1
- package/dist/psl-printer.d.mts +6 -6
- package/dist/psl-printer.mjs +20 -13
- package/dist/psl-printer.mjs.map +1 -1
- package/dist/{resolve-codec-BZF8TZh_-D-xORT9Q.mjs → resolve-codec-BLRGmP1f-CydhIhLP.mjs} +6 -9
- package/dist/{resolve-codec-BZF8TZh_-D-xORT9Q.mjs.map → resolve-codec-BLRGmP1f-CydhIhLP.mjs.map} +1 -1
- package/dist/{resolve-domain-model-BVSb5wS5-C6Yq0dsD.d.mts → resolve-domain-model-DXP2hfI2-D4fWewZQ.d.mts} +3 -3
- package/dist/resolve-domain-model-DXP2hfI2-D4fWewZQ.d.mts.map +1 -0
- package/dist/{result-CBZ8X9mU.mjs → result-C0NUq1Ok.mjs} +2 -2
- package/dist/{result-CBZ8X9mU.mjs.map → result-C0NUq1Ok.mjs.map} +1 -1
- package/dist/{runtime-Cuxw8obj.d.mts → runtime-DOHhUPFx.d.mts} +66 -4
- package/dist/{runtime-Cuxw8obj.d.mts.map → runtime-DOHhUPFx.d.mts.map} +1 -1
- package/dist/{runtime-BqzioOmU.mjs → runtime-DXmHIbAr.mjs} +7 -2
- package/dist/{runtime-BqzioOmU.mjs.map → runtime-DXmHIbAr.mjs.map} +1 -1
- package/dist/{structured-error-CgiSMpdU.mjs → structured-error-BXbihKQ-.mjs} +3 -3
- package/dist/{structured-error-CgiSMpdU.mjs.map → structured-error-BXbihKQ-.mjs.map} +1 -1
- package/dist/{structured-error-BsNT4Hun.d.mts → structured-error-Z4iE-fTI.d.mts} +4 -4
- package/dist/{structured-error-BsNT4Hun.d.mts.map → structured-error-Z4iE-fTI.d.mts.map} +1 -1
- package/dist/suppress-idle-connection-errors-CKrTbp5P.d.mts +18 -0
- package/dist/suppress-idle-connection-errors-CKrTbp5P.d.mts.map +1 -0
- package/dist/suppress-idle-connection-errors-DzApeUb3.mjs +22 -0
- package/dist/suppress-idle-connection-errors-DzApeUb3.mjs.map +1 -0
- package/dist/{symbol-table-CZ7EVCTL-CR-ncCpD.d.mts → symbol-table-BeOQBu3C-DduAXEh6.d.mts} +6 -6
- package/dist/{symbol-table-CZ7EVCTL-CR-ncCpD.d.mts.map → symbol-table-BeOQBu3C-DduAXEh6.d.mts.map} +1 -1
- package/dist/ts-render.mjs +1 -1
- package/dist/{types-ByeQhU9p.d.mts → types-BKJi4we0.d.mts} +2 -2
- package/dist/{types-ByeQhU9p.d.mts.map → types-BKJi4we0.d.mts.map} +1 -1
- package/dist/{types-BnH4zYvN.mjs → types-DG4qHrT8.mjs} +2 -2
- package/dist/{types-BnH4zYvN.mjs.map → types-DG4qHrT8.mjs.map} +1 -1
- package/dist/{types-import-spec-3mjbVBhI-DQI6BvKU.d.mts → types-import-spec-BijT0b-s-253rIcmj.d.mts} +4 -4
- package/dist/{types-import-spec-3mjbVBhI-DQI6BvKU.d.mts.map → types-import-spec-BijT0b-s-253rIcmj.d.mts.map} +1 -1
- package/dist/utils.d.mts +4 -3
- package/dist/utils.mjs +6 -5
- package/dist/utils__assertions.mjs +1 -1
- package/dist/utils__internal-error.d.mts +1 -1
- package/dist/utils__internal-error.mjs +1 -1
- package/dist/utils__result.mjs +1 -1
- package/dist/utils__structured-error.d.mts +1 -1
- package/dist/utils__structured-error.mjs +1 -1
- package/dist/utils__suppress-idle-connection-errors.d.mts +2 -0
- package/dist/utils__suppress-idle-connection-errors.mjs +2 -0
- package/dist/{validate-domain-BkvFlY3B.mjs → validate-domain-CaT6wlDH.mjs} +15 -1
- package/dist/validate-domain-CaT6wlDH.mjs.map +1 -0
- package/dist/{validate-domain-BNBs-TVv.d.mts → validate-domain-DJXNOlkP.d.mts} +9 -5
- package/dist/validate-domain-DJXNOlkP.d.mts.map +1 -0
- package/package.json +19 -18
- package/dist/apply-specifier-default-control-policy-CAxiXxKg.d.mts.map +0 -1
- package/dist/authoring-B2H-9qCv.d.mts +0 -1
- package/dist/config-types-BqhNxw0z.mjs +0 -67
- package/dist/config-types-BqhNxw0z.mjs.map +0 -1
- package/dist/control-BD96JZi8-NUhO5Kkw.mjs.map +0 -1
- package/dist/control-DLEm6u5m.mjs.map +0 -1
- package/dist/emission-CmUO03gQ.d.mts +0 -2
- package/dist/emission-types-DLXP34Ki-CFms3VrX.d.mts.map +0 -1
- package/dist/execution-Crk6IfTs.mjs.map +0 -1
- package/dist/framework-authoring-BhctBwih-DQ_6noDM.d.mts.map +0 -1
- package/dist/framework-authoring-CDEvlouU-DKklu-fL.mjs.map +0 -1
- package/dist/internal-error-BIc-ehme-ouBQPoEL.mjs.map +0 -1
- package/dist/migration-C57VKLUY.mjs.map +0 -1
- package/dist/resolve-domain-model-BVSb5wS5-C6Yq0dsD.d.mts.map +0 -1
- package/dist/validate-domain-BNBs-TVv.d.mts.map +0 -1
- package/dist/validate-domain-BkvFlY3B.mjs.map +0 -1
package/dist/psl-printer.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"psl-printer.mjs","names":[],"sources":["../../../../1-framework/2-authoring/psl-printer/dist/index.mjs"],"sourcesContent":["import { ifDefined } from \"@internal/utils/defined\";\nimport { UNSPECIFIED_PSL_NAMESPACE_ID, flatPslModels, namespacePslExtensionBlocks } from \"@internal/framework-components/psl-ast\";\nimport { isAuthoringPslBlockDescriptor } from \"@internal/framework-components/authoring\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/contract-errors.ts\nfunction contractError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/serialize-print-document.ts\n/**\n* Indent unit used for PSL block bodies and namespace nesting.\n*/\nconst PSL_INDENT_UNIT = \" \";\nfunction buildPslBlockDispatchMap(namespace) {\n\tconst byKeyword = /* @__PURE__ */ new Map();\n\tif (namespace) collectBlockDescriptors(namespace, byKeyword);\n\treturn { byKeyword };\n}\nfunction collectBlockDescriptors(namespace, byKeyword) {\n\tfor (const value of Object.values(namespace)) {\n\t\tif (isAuthoringPslBlockDescriptor(value)) {\n\t\t\tbyKeyword.set(value.keyword, value);\n\t\t\tcontinue;\n\t\t}\n\t\tif (typeof value === \"object\" && value !== null && !Array.isArray(value)) collectBlockDescriptors(value, byKeyword);\n\t}\n}\nfunction escapePslString(value) {\n\treturn value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, \"\\\\\\\"\").replace(/\\n/g, \"\\\\n\").replace(/\\r/g, \"\\\\r\");\n}\nfunction serializePrintDocument(doc, options = {}) {\n\tconst sections = [];\n\tsections.push(doc.headerComment);\n\tconst namedTypeEntries = [...doc.namedTypes].sort((a, b) => a.name.localeCompare(b.name));\n\tif (namedTypeEntries.length > 0) sections.push(serializeTypesBlock(namedTypeEntries));\n\tconst blockDispatchMap = buildPslBlockDispatchMap(options.pslBlockDescriptors);\n\tfor (const namespace of doc.namespaces) {\n\t\tconst namespaceSections = serializeNamespaceContents(namespace, blockDispatchMap, options.codecLookup);\n\t\tif (namespaceSections.length === 0) continue;\n\t\tif (namespace.name === UNSPECIFIED_PSL_NAMESPACE_ID) sections.push(...namespaceSections);\n\t\telse sections.push(wrapNamespaceBlock(namespace.name, namespaceSections));\n\t}\n\treturn `${sections.join(\"\\n\\n\")}\\n`;\n}\nfunction serializeNamespaceContents(namespace, blockDispatchMap, codecLookup) {\n\tconst sections = [];\n\tfor (const model of namespace.models) sections.push(serializeModel(model));\n\tfor (const extensionBlock of namespace.extensionBlocks) sections.push(serializeExtensionBlock(extensionBlock, blockDispatchMap, codecLookup));\n\treturn sections;\n}\nfunction serializeExtensionBlock(extensionBlock, blockDispatchMap, codecLookup) {\n\tconst descriptor = blockDispatchMap.byKeyword.get(extensionBlock.keyword);\n\tif (!descriptor) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `No pslBlockDescriptors contribution registered for extension-contributed block keyword \"${extensionBlock.keyword}\". Provide a matching pslBlockDescriptors contribution to serializePrintDocument, or remove the block from the input AST.`, { meta: {\n\t\treason: \"block-descriptor-missing\",\n\t\tkeyword: extensionBlock.keyword\n\t} });\n\tif (descriptor.discriminator !== extensionBlock.kind) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `The pslBlockDescriptors contribution for keyword \"${extensionBlock.keyword}\" owns discriminator \"${descriptor.discriminator}\", but the block carries kind \"${extensionBlock.kind}\". Provide a matching pslBlockDescriptors contribution to serializePrintDocument, or remove the block from the input AST.`, { meta: {\n\t\treason: \"block-descriptor-kind-mismatch\",\n\t\tkeyword: extensionBlock.keyword,\n\t\tdescriptorDiscriminator: descriptor.discriminator,\n\t\tblockKind: extensionBlock.kind\n\t} });\n\tconst lines = [`${extensionBlock.keyword} ${extensionBlock.name} {`];\n\tfor (const [paramName, paramDescriptor] of Object.entries(descriptor.parameters)) {\n\t\tconst paramValue = extensionBlock.parameters[paramName];\n\t\tif (paramValue === void 0) continue;\n\t\tconst rendered = renderParamValue(paramValue, paramDescriptor, codecLookup, paramName);\n\t\tlines.push(`${PSL_INDENT_UNIT}${paramName} = ${rendered}`);\n\t}\n\tif (descriptor.variadicParameters) for (const [paramName, paramValue] of Object.entries(extensionBlock.parameters)) {\n\t\tif (Object.hasOwn(descriptor.parameters, paramName)) continue;\n\t\tlines.push(`${PSL_INDENT_UNIT}${renderVariadicParam(paramName, paramValue)}`);\n\t}\n\tfor (const attr of extensionBlock.blockAttributes ?? []) {\n\t\tconst args = attr.args.map((arg) => arg.value).join(\", \");\n\t\tlines.push(`${PSL_INDENT_UNIT}@@${attr.name}${args.length > 0 ? `(${args})` : \"\"}`);\n\t}\n\tlines.push(\"}\");\n\treturn lines.join(\"\\n\");\n}\n/**\n* Renders one undeclared parameter of a `variadicParameters` block (e.g. a\n* `native_enum` member line). Variadic entries have no per-parameter\n* descriptor, so there is no codec to round-trip a `value` through — the raw\n* PSL literal is emitted verbatim. A `bare` entry is just its key.\n*/\nfunction renderVariadicParam(paramName, paramValue) {\n\tif (paramValue.kind === \"bare\") return paramName;\n\treturn `${paramName} = ${renderVariadicValue(paramValue)}`;\n}\nfunction renderVariadicValue(paramValue) {\n\tswitch (paramValue.kind) {\n\t\tcase \"bare\": return \"\";\n\t\tcase \"value\": return paramValue.raw;\n\t\tcase \"ref\": return paramValue.identifier;\n\t\tcase \"option\": return paramValue.token;\n\t\tcase \"list\": return `[${paramValue.items.map(renderVariadicValue).join(\", \")}]`;\n\t}\n}\nfunction renderParamValue(paramValue, descriptor, codecLookup, paramName) {\n\tswitch (descriptor.kind) {\n\t\tcase \"ref\":\n\t\t\tif (paramValue.kind !== \"ref\") throw paramKindMismatchError(paramName, \"ref\", paramValue.kind);\n\t\t\treturn paramValue.identifier;\n\t\tcase \"value\":\n\t\t\tif (paramValue.kind !== \"value\") throw paramKindMismatchError(paramName, \"value\", paramValue.kind);\n\t\t\treturn renderValueParam(paramValue.raw, descriptor.codecId, codecLookup, paramName);\n\t\tcase \"option\":\n\t\t\tif (paramValue.kind !== \"option\") throw paramKindMismatchError(paramName, \"option\", paramValue.kind);\n\t\t\treturn paramValue.token;\n\t\tcase \"list\":\n\t\t\tif (paramValue.kind !== \"list\") throw paramKindMismatchError(paramName, \"list\", paramValue.kind);\n\t\t\treturn `[${paramValue.items.map((item) => renderParamValue(item, descriptor.of, codecLookup, paramName)).join(\", \")}]`;\n\t}\n}\nfunction paramKindMismatchError(paramName, descriptorKind, valueKind) {\n\treturn contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Extension block parameter \"${paramName}\": descriptor is \"${descriptorKind}\" but AST node has kind \"${valueKind}\"`, { meta: {\n\t\treason: \"param-kind-mismatch\",\n\t\tparamName,\n\t\tdescriptorKind,\n\t\tvalueKind\n\t} });\n}\nfunction renderValueParam(raw, codecId, codecLookup, paramName) {\n\tif (!codecLookup) return raw;\n\tconst codec = codecLookup.get(codecId);\n\tif (!codec) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Extension block parameter \"${paramName}\": no codec registered for id \"${codecId}\"`, { meta: {\n\t\treason: \"codec-unregistered\",\n\t\tparamName,\n\t\tcodecId\n\t} });\n\tlet parsedJson;\n\ttry {\n\t\tparsedJson = JSON.parse(raw);\n\t} catch (e) {\n\t\tthrow contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Extension block parameter \"${paramName}\": codec \"${codecId}\" — raw literal is not valid JSON: ${String(e)}`, {\n\t\t\tmeta: {\n\t\t\t\treason: \"raw-literal-invalid-json\",\n\t\t\t\tparamName,\n\t\t\t\tcodecId\n\t\t\t},\n\t\t\tcause: e\n\t\t});\n\t}\n\treturn JSON.stringify(codec.encodeJson(codec.decodeJson(blindCast(parsedJson))));\n}\nfunction wrapNamespaceBlock(name, innerSections) {\n\treturn `namespace ${name} {\\n${innerSections.map((section) => section.split(\"\\n\").map((line) => line.length > 0 ? ` ${line}` : line).join(\"\\n\")).join(\"\\n\\n\")}\\n}`;\n}\nfunction serializeTypesBlock(namedTypes) {\n\tconst lines = [\"types {\"];\n\tfor (const nt of namedTypes) {\n\t\tconst attrStr = nt.attributes.length > 0 ? ` ${nt.attributes.join(\" \")}` : \"\";\n\t\tlines.push(` ${nt.name} = ${nt.baseType}${attrStr}`);\n\t}\n\tlines.push(\"}\");\n\treturn lines.join(\"\\n\");\n}\nfunction serializeModel(model) {\n\tconst lines = [];\n\tif (model.comment) lines.push(model.comment);\n\tlines.push(`model ${model.name} {`);\n\tconst idFields = model.fields.filter((f) => f.isId);\n\tconst scalarFields = model.fields.filter((f) => !f.isId && !f.isRelation);\n\tconst relationFields = model.fields.filter((f) => f.isRelation);\n\tconst allOrderedFields = [\n\t\t...idFields,\n\t\t...scalarFields,\n\t\t...relationFields\n\t];\n\tif (allOrderedFields.length > 0) {\n\t\tconst maxNameLen = Math.max(...allOrderedFields.map((f) => f.name.length));\n\t\tconst maxTypeLen = Math.max(...allOrderedFields.map((f) => formatFieldType(f).length));\n\t\tfor (const field of allOrderedFields) {\n\t\t\tconst typePart = formatFieldType(field);\n\t\t\tconst paddedName = field.name.padEnd(maxNameLen);\n\t\t\tconst paddedType = typePart.padEnd(maxTypeLen);\n\t\t\tif (field.comment) lines.push(` ${field.comment}`);\n\t\t\tconst attrStr = field.attributes.length > 0 ? ` ${field.attributes.join(\" \")}` : \"\";\n\t\t\tlines.push(` ${paddedName} ${paddedType}${attrStr}`.trimEnd());\n\t\t}\n\t}\n\tif (model.modelAttributes.length > 0) {\n\t\tif (allOrderedFields.length > 0) lines.push(\"\");\n\t\tfor (const attr of model.modelAttributes) lines.push(` ${attr}`);\n\t}\n\tlines.push(\"}\");\n\treturn lines.join(\"\\n\");\n}\nfunction formatFieldType(field) {\n\tlet type = field.typeName;\n\tif (field.list) type += \"[]\";\n\telse if (field.optional) type += \"?\";\n\treturn type;\n}\n//#endregion\n//#region src/ast-to-print-document.ts\nconst DEFAULT_AST_PRINT_HEADER = \"// use prisma-next\\n// Contract inferred from the live database schema. Edit as needed, then run `prisma-next contract emit`.\";\nfunction astDocumentToPrintDocument(ast) {\n\tconst allModels = flatPslModels(ast);\n\tconst sortedModels = topologicalSortModels(allModels, buildModelFkDeps(allModels, new Set(allModels.map((m) => m.name))));\n\tconst modelNamespaceIndex = /* @__PURE__ */ new Map();\n\tfor (const namespace of ast.namespaces) for (const model of namespace.models) modelNamespaceIndex.set(model.name, namespace.name);\n\tconst namedTypes = ast.types ? ast.types.declarations.map(namedTypeDeclarationToPrinterNamedType) : [];\n\tconst namespaceSections = ast.namespaces.map((namespace) => {\n\t\tconst printerModels = sortedModels.filter((model) => modelNamespaceIndex.get(model.name) === namespace.name).map((m) => modelToPrinterModel(m));\n\t\treturn {\n\t\t\tname: namespace.name,\n\t\t\tmodels: printerModels,\n\t\t\textensionBlocks: namespacePslExtensionBlocks(namespace)\n\t\t};\n\t});\n\tnamespaceSections.sort((a, b) => {\n\t\tif (a.name === b.name) return 0;\n\t\tif (a.name === UNSPECIFIED_PSL_NAMESPACE_ID) return -1;\n\t\tif (b.name === UNSPECIFIED_PSL_NAMESPACE_ID) return 1;\n\t\treturn a.name.localeCompare(b.name);\n\t});\n\treturn {\n\t\theaderComment: DEFAULT_AST_PRINT_HEADER,\n\t\tnamedTypes,\n\t\tnamespaces: namespaceSections\n\t};\n}\nfunction renderPslAttribute(attr) {\n\tconst prefix = attr.target === \"model\" || attr.target === \"enum\" ? \"@@\" : \"@\";\n\tif (attr.args.length === 0) return `${prefix}${attr.name}`;\n\tconst inner = attr.args.map(renderAttributeArgument).join(\", \");\n\treturn `${prefix}${attr.name}(${inner})`;\n}\nfunction renderAttributeArgument(arg) {\n\tif (arg.kind === \"positional\") return arg.value;\n\treturn `${arg.name}: ${arg.value}`;\n}\nfunction namedTypeDeclarationToPrinterNamedType(decl) {\n\tconst base = decl.baseType ?? (decl.typeConstructor !== void 0 ? formatTypeConstructor(decl.typeConstructor) : \"\");\n\tconst attributes = decl.attributes.map(renderPslAttribute);\n\treturn {\n\t\tname: decl.name,\n\t\tbaseType: base,\n\t\tattributes\n\t};\n}\nfunction formatTypeConstructor(tc) {\n\tconst path = tc.path.join(\".\");\n\tif (tc.args.length === 0) return path;\n\treturn `${path}(${tc.args.map(renderAttributeArgument).join(\", \")})`;\n}\nfunction getPositionalStringArg(attr, index) {\n\tconst raw = attr.args.filter((a) => a.kind === \"positional\")[index]?.value.trim();\n\tif (!raw) return void 0;\n\tconst m = raw.match(/^(['\"])(.*)\\1$/);\n\tif (!m) return void 0;\n\treturn unescapePslString(m[2]);\n}\n/**\n* Inverse of `escapePslString`. The parser stores quoted-literal arguments with\n* their PSL escape sequences (`\\\\`, `\\\"`, `\\n`, `\\r`) intact; when we round-trip\n* a value through `getPositionalStringArg` and re-render via `escapePslString`,\n* we must decode it once on extraction to avoid double-escaping the same\n* sequences on output.\n*/\nfunction unescapePslString(value) {\n\tlet result = \"\";\n\tfor (let i = 0; i < value.length; i++) {\n\t\tif (value.charCodeAt(i) !== 92 || i + 1 >= value.length) {\n\t\t\tresult += value[i];\n\t\t\tcontinue;\n\t\t}\n\t\tconst next = value[i + 1];\n\t\tif (next === \"\\\\\" || next === \"\\\"\" || next === \"'\") result += next;\n\t\telse if (next === \"n\") result += \"\\n\";\n\t\telse if (next === \"r\") result += \"\\r\";\n\t\telse {\n\t\t\tresult += \"\\\\\";\n\t\t\tresult += next;\n\t\t}\n\t\ti++;\n\t}\n\treturn result;\n}\nfunction modelToPrinterModel(model) {\n\tlet mapName;\n\tconst modelAttrStrings = [];\n\tfor (const a of model.attributes) {\n\t\tif (a.name === \"map\" && a.target === \"model\") {\n\t\t\tmapName = getPositionalStringArg(a, 0) ?? mapName;\n\t\t\tcontinue;\n\t\t}\n\t\tmodelAttrStrings.push(renderPslAttribute(a));\n\t}\n\tif (mapName !== void 0) modelAttrStrings.push(`@@map(\"${escapePslString(mapName)}\")`);\n\tconst printerFields = model.fields.map((f) => fieldToPrinterField(f));\n\treturn {\n\t\tname: model.name,\n\t\tmapName,\n\t\tfields: printerFields,\n\t\tmodelAttributes: modelAttrStrings,\n\t\tcomment: model.comment\n\t};\n}\n/**\n* Assembles the qualified type name string for a field type reference.\n*\n* Handles all four forms:\n* - `space:ns.Name` — typeContractSpaceId + typeNamespaceId + typeName\n* - `space:Name` — typeContractSpaceId + typeName (no namespace)\n* - `ns.Name` — typeNamespaceId + typeName (no space); fixes TML-2459 printer gap\n* - `Name` — typeName only (no qualifier)\n*/\nfunction assembleQualifiedTypeName(field) {\n\tconst { typeName, typeNamespaceId, typeContractSpaceId } = field;\n\tconst dotted = typeNamespaceId !== void 0 ? `${typeNamespaceId}.${typeName}` : typeName;\n\treturn typeContractSpaceId !== void 0 ? `${typeContractSpaceId}:${dotted}` : dotted;\n}\nfunction fieldToPrinterField(field) {\n\tconst typeName = field.typeConstructor !== void 0 ? formatTypeConstructor(field.typeConstructor) : assembleQualifiedTypeName(field);\n\tlet mapName;\n\tconst attrStrings = [];\n\tfor (const a of field.attributes) {\n\t\tif (a.name === \"map\" && a.target === \"field\") {\n\t\t\tmapName = getPositionalStringArg(a, 0) ?? mapName;\n\t\t\tcontinue;\n\t\t}\n\t\tattrStrings.push(renderPslAttribute(a));\n\t}\n\tif (mapName !== void 0) attrStrings.push(`@map(\"${escapePslString(mapName)}\")`);\n\tconst isRelation = field.attributes.some((a) => a.name === \"relation\" && a.target === \"field\");\n\tconst isUnsupported = typeName.startsWith(\"Unsupported(\");\n\tconst isId = field.attributes.some((a) => a.name === \"id\" && a.target === \"field\");\n\treturn {\n\t\tname: field.name,\n\t\ttypeName,\n\t\toptional: field.optional,\n\t\tlist: field.list,\n\t\tattributes: attrStrings,\n\t\tmapName,\n\t\tisId,\n\t\tisRelation,\n\t\tisUnsupported,\n\t\tcomment: void 0\n\t};\n}\nfunction buildModelFkDeps(models, modelNames) {\n\tconst deps = /* @__PURE__ */ new Map();\n\tfor (const m of models) deps.set(m.name, /* @__PURE__ */ new Set());\n\tfor (const m of models) for (const field of m.fields) {\n\t\tconst refModel = relationReferencedModel(field, modelNames);\n\t\tif (!refModel || refModel === m.name) continue;\n\t\tif (!hasFullRelation(field)) continue;\n\t\tdeps.get(m.name).add(refModel);\n\t}\n\treturn deps;\n}\nfunction hasFullRelation(field) {\n\tconst rel = field.attributes.find((a) => a.name === \"relation\" && a.target === \"field\");\n\tif (!rel) return false;\n\tconst named = Object.fromEntries(rel.args.filter((a) => a.kind === \"named\").map((a) => [a.name, a.value.trim()]));\n\treturn named[\"fields\"] !== void 0 && named[\"references\"] !== void 0;\n}\nfunction relationReferencedModel(field, modelNames) {\n\tconst raw = field.typeConstructor?.path[0] ?? field.typeName.replace(/\\?$/, \"\").replace(/\\[\\]$/, \"\");\n\tif (raw.length === 0) return;\n\treturn modelNames.has(raw) ? raw : void 0;\n}\nfunction topologicalSortModels(models, deps) {\n\tconst byName = new Map(models.map((m) => [m.name, m]));\n\tconst result = [];\n\tconst visited = /* @__PURE__ */ new Set();\n\tconst visiting = /* @__PURE__ */ new Set();\n\tconst sortedNames = [...deps.keys()].sort();\n\tfunction visit(name) {\n\t\tif (visited.has(name)) return;\n\t\tif (visiting.has(name)) return;\n\t\tvisiting.add(name);\n\t\tconst sortedDeps = [...deps.get(name) ?? /* @__PURE__ */ new Set()].sort();\n\t\tfor (const dep of sortedDeps) visit(dep);\n\t\tvisiting.delete(name);\n\t\tvisited.add(name);\n\t\tconst model = byName.get(name);\n\t\tif (model) result.push(model);\n\t}\n\tfor (const name of sortedNames) visit(name);\n\treturn result;\n}\n//#endregion\n//#region src/print-psl.ts\nfunction printPslFromAst(ast, options = {}) {\n\treturn serializePrintDocument(astDocumentToPrintDocument(ast), {\n\t\t...ifDefined(\"pslBlockDescriptors\", options.pslBlockDescriptors),\n\t\t...ifDefined(\"codecLookup\", options.codecLookup)\n\t});\n}\n//#endregion\nexport { printPslFromAst as printPsl };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;AAMA,SAAS,cAAc,MAAM,SAAS,SAAS;CAC9C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;;;;AAMA,MAAM,kBAAkB;AACxB,SAAS,yBAAyB,WAAW;CAC5C,MAAM,4BAA4B,IAAI,IAAI;CAC1C,IAAI,WAAW,wBAAwB,WAAW,SAAS;CAC3D,OAAO,EAAE,UAAU;AACpB;AACA,SAAS,wBAAwB,WAAW,WAAW;CACtD,KAAK,MAAM,SAAS,OAAO,OAAO,SAAS,GAAG;EAC7C,IAAI,8BAA8B,KAAK,GAAG;GACzC,UAAU,IAAI,MAAM,SAAS,KAAK;GAClC;EACD;EACA,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK,GAAG,wBAAwB,OAAO,SAAS;CACnH;AACD;AACA,SAAS,gBAAgB,OAAO;CAC/B,OAAO,MAAM,QAAQ,OAAO,MAAM,CAAC,CAAC,QAAQ,MAAM,MAAM,CAAC,CAAC,QAAQ,OAAO,KAAK,CAAC,CAAC,QAAQ,OAAO,KAAK;AACrG;AACA,SAAS,uBAAuB,KAAK,UAAU,CAAC,GAAG;CAClD,MAAM,WAAW,CAAC;CAClB,SAAS,KAAK,IAAI,aAAa;CAC/B,MAAM,mBAAmB,CAAC,GAAG,IAAI,UAAU,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC;CACxF,IAAI,iBAAiB,SAAS,GAAG,SAAS,KAAK,oBAAoB,gBAAgB,CAAC;CACpF,MAAM,mBAAmB,yBAAyB,QAAQ,mBAAmB;CAC7E,KAAK,MAAM,aAAa,IAAI,YAAY;EACvC,MAAM,oBAAoB,2BAA2B,WAAW,kBAAkB,QAAQ,WAAW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M,MAAM,MAAM,iBAAiB,KAAK,MAAM,MAAM,SAAS,QAAQ,OAAO,EAAE,CAAC,CAAC,QAAQ,SAAS,EAAE;CACnG,IAAI,IAAI,WAAW,GAAG;CACtB,OAAO,WAAW,IAAI,GAAG,IAAI,MAAM,KAAK;AACzC;AACA,SAAS,sBAAsB,QAAQ,MAAM;CAC5C,MAAM,SAAS,IAAI,IAAI,OAAO,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;CACrD,MAAM,SAAS,CAAC;CAChB,MAAM,0BAA0B,IAAI,IAAI;CACxC,MAAM,2BAA2B,IAAI,IAAI;CACzC,MAAM,cAAc,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK;CAC1C,SAAS,MAAM,MAAM;EACpB,IAAI,QAAQ,IAAI,IAAI,GAAG;EACvB,IAAI,SAAS,IAAI,IAAI,GAAG;EACxB,SAAS,IAAI,IAAI;EACjB,MAAM,aAAa,CAAC,GAAG,KAAK,IAAI,IAAI,qBAAqB,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK;EACzE,KAAK,MAAM,OAAO,YAAY,MAAM,GAAG;EACvC,SAAS,OAAO,IAAI;EACpB,QAAQ,IAAI,IAAI;EAChB,MAAM,QAAQ,OAAO,IAAI,IAAI;EAC7B,IAAI,OAAO,OAAO,KAAK,KAAK;CAC7B;CACA,KAAK,MAAM,QAAQ,aAAa,MAAM,IAAI;CAC1C,OAAO;AACR;AAGA,SAAS,gBAAgB,KAAK,UAAU,CAAC,GAAG;CAC3C,OAAO,uBAAuB,2BAA2B,GAAG,GAAG;EAC9D,GAAG,UAAU,uBAAuB,QAAQ,mBAAmB;EAC/D,GAAG,UAAU,eAAe,QAAQ,WAAW;CAChD,CAAC;AACF"}
|
|
1
|
+
{"version":3,"file":"psl-printer.mjs","names":[],"sources":["../../../../1-framework/2-authoring/psl-printer/dist/index.mjs"],"sourcesContent":["import { ifDefined } from \"@internal/utils/defined\";\nimport { UNSPECIFIED_PSL_NAMESPACE_ID, flatPslModels, namespacePslExtensionBlocks } from \"@internal/framework-components/psl-ast\";\nimport { isAuthoringPslBlockDescriptor } from \"@internal/framework-components/authoring\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/contract-errors.ts\nfunction contractError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/serialize-print-document.ts\n/**\n* Indent unit used for PSL block bodies and namespace nesting.\n*/\nconst PSL_INDENT_UNIT = \" \";\nfunction buildPslBlockDispatchMap(namespace) {\n\tconst byKeyword = /* @__PURE__ */ new Map();\n\tif (namespace) collectBlockDescriptors(namespace, byKeyword);\n\treturn { byKeyword };\n}\nfunction collectBlockDescriptors(namespace, byKeyword) {\n\tfor (const value of Object.values(namespace)) {\n\t\tif (isAuthoringPslBlockDescriptor(value)) {\n\t\t\tbyKeyword.set(value.keyword, value);\n\t\t\tcontinue;\n\t\t}\n\t\tif (typeof value === \"object\" && value !== null && !Array.isArray(value)) collectBlockDescriptors(value, byKeyword);\n\t}\n}\nfunction escapePslString(value) {\n\treturn value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, \"\\\\\\\"\").replace(/\\n/g, \"\\\\n\").replace(/\\r/g, \"\\\\r\");\n}\nfunction serializePrintDocument(doc, options = {}) {\n\tconst sections = [];\n\tsections.push(doc.headerComment);\n\tconst namedTypeEntries = [...doc.namedTypes].sort((a, b) => a.name.localeCompare(b.name));\n\tif (namedTypeEntries.length > 0) sections.push(serializeTypesBlock(namedTypeEntries));\n\tconst blockDispatchMap = buildPslBlockDispatchMap(options.pslBlockDescriptors);\n\tfor (const namespace of doc.namespaces) {\n\t\tconst namespaceSections = serializeNamespaceContents(namespace, blockDispatchMap, options.codecLookup);\n\t\tif (namespaceSections.length === 0) continue;\n\t\tif (namespace.name === UNSPECIFIED_PSL_NAMESPACE_ID) sections.push(...namespaceSections);\n\t\telse sections.push(wrapNamespaceBlock(namespace.name, namespaceSections));\n\t}\n\treturn `${sections.join(\"\\n\\n\")}\\n`;\n}\nfunction serializeNamespaceContents(namespace, blockDispatchMap, codecLookup) {\n\tconst sections = [];\n\tfor (const model of namespace.models) sections.push(serializeModel(model));\n\tfor (const extensionBlock of namespace.extensionBlocks) sections.push(serializeExtensionBlock(extensionBlock, blockDispatchMap, codecLookup));\n\treturn sections;\n}\nfunction serializeExtensionBlock(extensionBlock, blockDispatchMap, codecLookup) {\n\tconst descriptor = blockDispatchMap.byKeyword.get(extensionBlock.keyword);\n\tif (!descriptor) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `No pslBlockDescriptors contribution registered for extension-contributed block keyword \"${extensionBlock.keyword}\". Provide a matching pslBlockDescriptors contribution to serializePrintDocument, or remove the block from the input AST.`, { meta: {\n\t\treason: \"block-descriptor-missing\",\n\t\tkeyword: extensionBlock.keyword\n\t} });\n\tif (descriptor.discriminator !== extensionBlock.kind) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `The pslBlockDescriptors contribution for keyword \"${extensionBlock.keyword}\" owns discriminator \"${descriptor.discriminator}\", but the block carries kind \"${extensionBlock.kind}\". Provide a matching pslBlockDescriptors contribution to serializePrintDocument, or remove the block from the input AST.`, { meta: {\n\t\treason: \"block-descriptor-kind-mismatch\",\n\t\tkeyword: extensionBlock.keyword,\n\t\tdescriptorDiscriminator: descriptor.discriminator,\n\t\tblockKind: extensionBlock.kind\n\t} });\n\tconst lines = [`${extensionBlock.keyword} ${extensionBlock.name} {`];\n\tfor (const [paramName, paramDescriptor] of Object.entries(descriptor.parameters)) {\n\t\tconst paramValue = extensionBlock.parameters[paramName];\n\t\tif (paramValue === void 0) continue;\n\t\tconst rendered = renderParamValue(paramValue, paramDescriptor, codecLookup, paramName);\n\t\tlines.push(`${PSL_INDENT_UNIT}${paramName} = ${rendered}`);\n\t}\n\tif (descriptor.variadicParameters) for (const [paramName, paramValue] of Object.entries(extensionBlock.parameters)) {\n\t\tif (Object.hasOwn(descriptor.parameters, paramName)) continue;\n\t\tlines.push(`${PSL_INDENT_UNIT}${renderVariadicParam(paramName, paramValue)}`);\n\t}\n\tfor (const attr of extensionBlock.blockAttributes ?? []) {\n\t\tconst args = attr.args.map((arg) => arg.value).join(\", \");\n\t\tlines.push(`${PSL_INDENT_UNIT}@@${attr.name}${args.length > 0 ? `(${args})` : \"\"}`);\n\t}\n\tlines.push(\"}\");\n\treturn lines.join(\"\\n\");\n}\n/**\n* Renders one undeclared parameter of a `variadicParameters` block (e.g. a\n* `native_enum` member line). Variadic entries have no per-parameter\n* descriptor, so there is no codec to round-trip a `value` through — the raw\n* PSL literal is emitted verbatim. A `bare` entry is just its key.\n*/\nfunction renderVariadicParam(paramName, paramValue) {\n\tif (paramValue.kind === \"bare\") return paramName;\n\treturn `${paramName} = ${renderVariadicValue(paramValue)}`;\n}\nfunction renderVariadicValue(paramValue) {\n\tswitch (paramValue.kind) {\n\t\tcase \"bare\": return \"\";\n\t\tcase \"value\": return paramValue.raw;\n\t\tcase \"ref\": return paramValue.identifier;\n\t\tcase \"option\": return paramValue.token;\n\t\tcase \"list\": return `[${paramValue.items.map(renderVariadicValue).join(\", \")}]`;\n\t}\n}\nfunction renderParamValue(paramValue, descriptor, codecLookup, paramName) {\n\tswitch (descriptor.kind) {\n\t\tcase \"ref\":\n\t\t\tif (paramValue.kind !== \"ref\") throw paramKindMismatchError(paramName, \"ref\", paramValue.kind);\n\t\t\treturn paramValue.identifier;\n\t\tcase \"value\":\n\t\t\tif (paramValue.kind !== \"value\") throw paramKindMismatchError(paramName, \"value\", paramValue.kind);\n\t\t\treturn renderValueParam(paramValue.raw, descriptor.codecId, codecLookup, paramName);\n\t\tcase \"option\":\n\t\t\tif (paramValue.kind !== \"option\") throw paramKindMismatchError(paramName, \"option\", paramValue.kind);\n\t\t\treturn paramValue.token;\n\t\tcase \"list\":\n\t\t\tif (paramValue.kind !== \"list\") throw paramKindMismatchError(paramName, \"list\", paramValue.kind);\n\t\t\treturn `[${paramValue.items.map((item) => renderParamValue(item, descriptor.of, codecLookup, paramName)).join(\", \")}]`;\n\t}\n}\nfunction paramKindMismatchError(paramName, descriptorKind, valueKind) {\n\treturn contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Extension block parameter \"${paramName}\": descriptor is \"${descriptorKind}\" but AST node has kind \"${valueKind}\"`, { meta: {\n\t\treason: \"param-kind-mismatch\",\n\t\tparamName,\n\t\tdescriptorKind,\n\t\tvalueKind\n\t} });\n}\nfunction renderValueParam(raw, codecId, codecLookup, paramName) {\n\tif (!codecLookup) return raw;\n\tconst codec = codecLookup.get(codecId);\n\tif (!codec) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Extension block parameter \"${paramName}\": no codec registered for id \"${codecId}\"`, { meta: {\n\t\treason: \"codec-unregistered\",\n\t\tparamName,\n\t\tcodecId\n\t} });\n\tlet parsedJson;\n\ttry {\n\t\tparsedJson = JSON.parse(raw);\n\t} catch (e) {\n\t\tthrow contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Extension block parameter \"${paramName}\": codec \"${codecId}\" — raw literal is not valid JSON: ${String(e)}`, {\n\t\t\tmeta: {\n\t\t\t\treason: \"raw-literal-invalid-json\",\n\t\t\t\tparamName,\n\t\t\t\tcodecId\n\t\t\t},\n\t\t\tcause: e\n\t\t});\n\t}\n\treturn JSON.stringify(codec.encodeJson(codec.decodeJson(blindCast(parsedJson))));\n}\nfunction wrapNamespaceBlock(name, innerSections) {\n\treturn `namespace ${name} {\\n${innerSections.map((section) => section.split(\"\\n\").map((line) => line.length > 0 ? ` ${line}` : line).join(\"\\n\")).join(\"\\n\\n\")}\\n}`;\n}\nfunction serializeTypesBlock(namedTypes) {\n\tconst lines = [\"types {\"];\n\tfor (const nt of namedTypes) {\n\t\tconst attrStr = nt.attributes.length > 0 ? ` ${nt.attributes.join(\" \")}` : \"\";\n\t\tlines.push(` ${nt.name} = ${nt.baseType}${attrStr}`);\n\t}\n\tlines.push(\"}\");\n\treturn lines.join(\"\\n\");\n}\nfunction serializeModel(model) {\n\tconst lines = [];\n\tif (model.comment) lines.push(model.comment);\n\tlines.push(`model ${model.name} {`);\n\tconst idFields = model.fields.filter((f) => f.isId);\n\tconst scalarFields = model.fields.filter((f) => !f.isId && !f.isRelation);\n\tconst relationFields = model.fields.filter((f) => f.isRelation);\n\tconst allOrderedFields = [\n\t\t...idFields,\n\t\t...scalarFields,\n\t\t...relationFields\n\t];\n\tif (allOrderedFields.length > 0) {\n\t\tconst maxNameLen = Math.max(...allOrderedFields.map((f) => f.name.length));\n\t\tconst maxTypeLen = Math.max(...allOrderedFields.map((f) => formatFieldType(f).length));\n\t\tfor (const field of allOrderedFields) {\n\t\t\tconst typePart = formatFieldType(field);\n\t\t\tconst paddedName = field.name.padEnd(maxNameLen);\n\t\t\tconst paddedType = typePart.padEnd(maxTypeLen);\n\t\t\tif (field.comment) lines.push(` ${field.comment}`);\n\t\t\tconst attrStr = field.attributes.length > 0 ? ` ${field.attributes.join(\" \")}` : \"\";\n\t\t\tlines.push(` ${paddedName} ${paddedType}${attrStr}`.trimEnd());\n\t\t}\n\t}\n\tif (model.modelAttributes.length > 0) {\n\t\tif (allOrderedFields.length > 0) lines.push(\"\");\n\t\tfor (const attr of model.modelAttributes) lines.push(` ${attr}`);\n\t}\n\tlines.push(\"}\");\n\treturn lines.join(\"\\n\");\n}\nfunction formatFieldType(field) {\n\tlet type = field.typeName;\n\tif (field.list) type += \"[]\";\n\telse if (field.optional) type += \"?\";\n\treturn type;\n}\n//#endregion\n//#region src/ast-to-print-document.ts\nconst DEFAULT_AST_PRINT_HEADER = \"// use prisma-8\\n// Contract inferred from the live database schema. Edit as needed, then run `prisma contract emit`.\";\nfunction astDocumentToPrintDocument(ast) {\n\tconst allModels = flatPslModels(ast);\n\tconst sortedModels = topologicalSortModels(allModels, buildModelFkDeps(allModels, new Set(allModels.map((m) => m.name))));\n\tconst namedTypes = ast.types ? ast.types.declarations.map(namedTypeDeclarationToPrinterNamedType) : [];\n\tconst modelOrder = new Map(sortedModels.map((model, index) => [model.name, index]));\n\tconst sectionsByName = /* @__PURE__ */ new Map();\n\tfor (const namespace of ast.namespaces) {\n\t\tconst section = sectionsByName.get(namespace.name) ?? {\n\t\t\tmodels: /* @__PURE__ */ new Map(),\n\t\t\tblocks: /* @__PURE__ */ new Map()\n\t\t};\n\t\tfor (const model of namespace.models) section.models.set(model.name, model);\n\t\tfor (const block of namespacePslExtensionBlocks(namespace)) section.blocks.set(`${block.kind} ${block.name}`, block);\n\t\tsectionsByName.set(namespace.name, section);\n\t}\n\tconst unranked = sortedModels.length;\n\tconst namespaceSections = [...sectionsByName].map(([name, section]) => ({\n\t\tname,\n\t\tmodels: [...section.models.values()].sort((a, b) => (modelOrder.get(a.name) ?? unranked) - (modelOrder.get(b.name) ?? unranked)).map((m) => modelToPrinterModel(m)),\n\t\textensionBlocks: [...section.blocks.values()]\n\t}));\n\tnamespaceSections.sort((a, b) => {\n\t\tif (a.name === b.name) return 0;\n\t\tif (a.name === UNSPECIFIED_PSL_NAMESPACE_ID) return -1;\n\t\tif (b.name === UNSPECIFIED_PSL_NAMESPACE_ID) return 1;\n\t\treturn a.name < b.name ? -1 : 1;\n\t});\n\treturn {\n\t\theaderComment: DEFAULT_AST_PRINT_HEADER,\n\t\tnamedTypes,\n\t\tnamespaces: namespaceSections\n\t};\n}\nfunction renderPslAttribute(attr) {\n\tconst prefix = attr.target === \"model\" || attr.target === \"enum\" ? \"@@\" : \"@\";\n\tif (attr.args.length === 0) return `${prefix}${attr.name}`;\n\tconst inner = attr.args.map(renderAttributeArgument).join(\", \");\n\treturn `${prefix}${attr.name}(${inner})`;\n}\nfunction renderAttributeArgument(arg) {\n\tif (arg.kind === \"positional\") return arg.value;\n\treturn `${arg.name}: ${arg.value}`;\n}\nfunction namedTypeDeclarationToPrinterNamedType(decl) {\n\tconst base = decl.baseType ?? (decl.typeConstructor !== void 0 ? formatTypeConstructor(decl.typeConstructor) : \"\");\n\tconst attributes = decl.attributes.map(renderPslAttribute);\n\treturn {\n\t\tname: decl.name,\n\t\tbaseType: base,\n\t\tattributes\n\t};\n}\nfunction formatTypeConstructor(tc) {\n\tconst path = tc.path.join(\".\");\n\tif (tc.args.length === 0) return path;\n\treturn `${path}(${tc.args.map(renderAttributeArgument).join(\", \")})`;\n}\nfunction getPositionalStringArg(attr, index) {\n\tconst raw = attr.args.filter((a) => a.kind === \"positional\")[index]?.value.trim();\n\tif (!raw) return void 0;\n\tconst m = raw.match(/^(['\"])(.*)\\1$/);\n\tif (!m) return void 0;\n\treturn unescapePslString(m[2]);\n}\n/**\n* Inverse of `escapePslString`. The parser stores quoted-literal arguments with\n* their PSL escape sequences (`\\\\`, `\\\"`, `\\n`, `\\r`) intact; when we round-trip\n* a value through `getPositionalStringArg` and re-render via `escapePslString`,\n* we must decode it once on extraction to avoid double-escaping the same\n* sequences on output.\n*/\nfunction unescapePslString(value) {\n\tlet result = \"\";\n\tfor (let i = 0; i < value.length; i++) {\n\t\tif (value.charCodeAt(i) !== 92 || i + 1 >= value.length) {\n\t\t\tresult += value[i];\n\t\t\tcontinue;\n\t\t}\n\t\tconst next = value[i + 1];\n\t\tif (next === \"\\\\\" || next === \"\\\"\" || next === \"'\") result += next;\n\t\telse if (next === \"n\") result += \"\\n\";\n\t\telse if (next === \"r\") result += \"\\r\";\n\t\telse {\n\t\t\tresult += \"\\\\\";\n\t\t\tresult += next;\n\t\t}\n\t\ti++;\n\t}\n\treturn result;\n}\nfunction modelToPrinterModel(model) {\n\tlet mapName;\n\tconst modelAttrStrings = [];\n\tfor (const a of model.attributes) {\n\t\tif (a.name === \"map\" && a.target === \"model\") {\n\t\t\tmapName = getPositionalStringArg(a, 0) ?? mapName;\n\t\t\tcontinue;\n\t\t}\n\t\tmodelAttrStrings.push(renderPslAttribute(a));\n\t}\n\tif (mapName !== void 0) modelAttrStrings.push(`@@map(\"${escapePslString(mapName)}\")`);\n\tconst printerFields = model.fields.map((f) => fieldToPrinterField(f));\n\treturn {\n\t\tname: model.name,\n\t\tmapName,\n\t\tfields: printerFields,\n\t\tmodelAttributes: modelAttrStrings,\n\t\tcomment: model.comment\n\t};\n}\n/**\n* Assembles the qualified type name string for a field type reference.\n*\n* Handles all four forms:\n* - `space:ns.Name` — typeContractSpaceId + typeNamespaceId + typeName\n* - `space:Name` — typeContractSpaceId + typeName (no namespace)\n* - `ns.Name` — typeNamespaceId + typeName (no space); fixes TML-2459 printer gap\n* - `Name` — typeName only (no qualifier)\n*/\nfunction assembleQualifiedTypeName(field) {\n\tconst { typeName, typeNamespaceId, typeContractSpaceId } = field;\n\tconst dotted = typeNamespaceId !== void 0 ? `${typeNamespaceId}.${typeName}` : typeName;\n\treturn typeContractSpaceId !== void 0 ? `${typeContractSpaceId}:${dotted}` : dotted;\n}\nfunction fieldToPrinterField(field) {\n\tconst typeName = field.typeConstructor !== void 0 ? formatTypeConstructor(field.typeConstructor) : assembleQualifiedTypeName(field);\n\tlet mapName;\n\tconst attrStrings = [];\n\tfor (const a of field.attributes) {\n\t\tif (a.name === \"map\" && a.target === \"field\") {\n\t\t\tmapName = getPositionalStringArg(a, 0) ?? mapName;\n\t\t\tcontinue;\n\t\t}\n\t\tattrStrings.push(renderPslAttribute(a));\n\t}\n\tif (mapName !== void 0) attrStrings.push(`@map(\"${escapePslString(mapName)}\")`);\n\tconst isRelation = field.attributes.some((a) => a.name === \"relation\" && a.target === \"field\");\n\tconst isUnsupported = typeName.startsWith(\"Unsupported(\");\n\tconst isId = field.attributes.some((a) => a.name === \"id\" && a.target === \"field\");\n\treturn {\n\t\tname: field.name,\n\t\ttypeName,\n\t\toptional: field.optional,\n\t\tlist: field.list,\n\t\tattributes: attrStrings,\n\t\tmapName,\n\t\tisId,\n\t\tisRelation,\n\t\tisUnsupported,\n\t\tcomment: void 0\n\t};\n}\nfunction buildModelFkDeps(models, modelNames) {\n\tconst deps = /* @__PURE__ */ new Map();\n\tfor (const m of models) deps.set(m.name, /* @__PURE__ */ new Set());\n\tfor (const m of models) for (const field of m.fields) {\n\t\tconst refModel = relationReferencedModel(field, modelNames);\n\t\tif (!refModel || refModel === m.name) continue;\n\t\tif (!hasFullRelation(field)) continue;\n\t\tdeps.get(m.name).add(refModel);\n\t}\n\treturn deps;\n}\nfunction hasFullRelation(field) {\n\tconst rel = field.attributes.find((a) => a.name === \"relation\" && a.target === \"field\");\n\tif (!rel) return false;\n\tconst named = Object.fromEntries(rel.args.filter((a) => a.kind === \"named\").map((a) => [a.name, a.value.trim()]));\n\treturn named[\"fields\"] !== void 0 && named[\"references\"] !== void 0;\n}\nfunction relationReferencedModel(field, modelNames) {\n\tconst raw = field.typeConstructor?.path[0] ?? field.typeName.replace(/\\?$/, \"\").replace(/\\[\\]$/, \"\");\n\tif (raw.length === 0) return;\n\treturn modelNames.has(raw) ? raw : void 0;\n}\nfunction topologicalSortModels(models, deps) {\n\tconst byName = new Map(models.map((m) => [m.name, m]));\n\tconst result = [];\n\tconst visited = /* @__PURE__ */ new Set();\n\tconst visiting = /* @__PURE__ */ new Set();\n\tconst sortedNames = [...deps.keys()].sort();\n\tfunction visit(name) {\n\t\tif (visited.has(name)) return;\n\t\tif (visiting.has(name)) return;\n\t\tvisiting.add(name);\n\t\tconst sortedDeps = [...deps.get(name) ?? /* @__PURE__ */ new Set()].sort();\n\t\tfor (const dep of sortedDeps) visit(dep);\n\t\tvisiting.delete(name);\n\t\tvisited.add(name);\n\t\tconst model = byName.get(name);\n\t\tif (model) result.push(model);\n\t}\n\tfor (const name of sortedNames) visit(name);\n\treturn result;\n}\n//#endregion\n//#region src/print-psl.ts\nfunction printPslFromAst(ast, options = {}) {\n\treturn serializePrintDocument(astDocumentToPrintDocument(ast), {\n\t\t...ifDefined(\"pslBlockDescriptors\", options.pslBlockDescriptors),\n\t\t...ifDefined(\"codecLookup\", options.codecLookup)\n\t});\n}\n//#endregion\nexport { printPslFromAst as printPsl };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;AAMA,SAAS,cA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C,GAAG;CAC3C,OAAO,uBAAuB,2BAA2B,GAAG,GAAG;EAC9D,GAAG,UAAU,uBAAuB,QAAQ,mBAAmB;EAC/D,GAAG,UAAU,eAAe,QAAQ,WAAW;CAChD,CAAC;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as blindCast } from "./casts-DpaahrlC-Bd5n2coI.mjs";
|
|
2
2
|
import { n as runtimeError } from "./runtime-error-BA9d7XjZ-BlT8t6LB.mjs";
|
|
3
|
-
//#region ../../../1-framework/1-core/framework-components/dist/resolve-codec-
|
|
3
|
+
//#region ../../../1-framework/1-core/framework-components/dist/resolve-codec-BLRGmP1f.mjs
|
|
4
4
|
const CONTRACT_CODEC_DESCRIPTOR_MISSING = "CONTRACT.CODEC_DESCRIPTOR_MISSING";
|
|
5
5
|
/**
|
|
6
6
|
* Look up a descriptor for `ref.codecId` using `descriptorFor`; throw
|
|
@@ -42,18 +42,15 @@ function validateCodecTypeParams(descriptor, ref) {
|
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Resolves a `Codec` instance: validates `ref.typeParams` via
|
|
45
|
-
* {@link validateCodecTypeParams} then calls `descriptor.factory(validated)(ctx)
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* `P` to `any`, so the factory is narrowed to `(params: unknown) => (ctx) => Codec`
|
|
49
|
-
* at the call boundary. The `paramsSchema` validates the input above before we
|
|
50
|
-
* forward it, so the narrowing is safe by construction.
|
|
45
|
+
* {@link validateCodecTypeParams} then calls `descriptor.factory(validated)(ctx)`
|
|
46
|
+
* as a method on `descriptor`, preserving `this` for factories that build
|
|
47
|
+
* their returned codec from the descriptor instance (e.g. `new XCodec(this)`).
|
|
51
48
|
*/
|
|
52
49
|
function materializeCodec(descriptor, ref, ctx) {
|
|
53
50
|
const validated = validateCodecTypeParams(descriptor, ref);
|
|
54
|
-
return
|
|
51
|
+
return descriptor.factory(validated)(ctx);
|
|
55
52
|
}
|
|
56
53
|
//#endregion
|
|
57
54
|
export { validateCodecTypeParams as i, materializeCodec as n, resolveCodecDescriptorOrThrow as r, CONTRACT_CODEC_DESCRIPTOR_MISSING as t };
|
|
58
55
|
|
|
59
|
-
//# sourceMappingURL=resolve-codec-
|
|
56
|
+
//# sourceMappingURL=resolve-codec-BLRGmP1f-CydhIhLP.mjs.map
|
package/dist/{resolve-codec-BZF8TZh_-D-xORT9Q.mjs.map → resolve-codec-BLRGmP1f-CydhIhLP.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-codec-
|
|
1
|
+
{"version":3,"file":"resolve-codec-BLRGmP1f-CydhIhLP.mjs","names":[],"sources":["../../../../1-framework/1-core/framework-components/dist/resolve-codec-BLRGmP1f.mjs"],"sourcesContent":["import { n as runtimeError } from \"./runtime-error-BA9d7XjZ.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/shared/resolve-codec.ts\nconst CONTRACT_CODEC_DESCRIPTOR_MISSING = \"CONTRACT.CODEC_DESCRIPTOR_MISSING\";\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*/\nfunction resolveCodecDescriptorOrThrow(descriptorFor, ref, code) {\n\tconst descriptor = descriptorFor(ref.codecId);\n\tif (!descriptor) throw runtimeError(code, `No codec descriptor registered for codecId '${ref.codecId}'.`, { codecId: ref.codecId });\n\treturn descriptor;\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*/\nfunction validateCodecTypeParams(descriptor, ref) {\n\tconst normalized = descriptor.isParameterized && ref.typeParams === void 0 ? {\n\t\t...ref,\n\t\ttypeParams: {}\n\t} : ref;\n\tconst result = blindCast(descriptor.paramsSchema[\"~standard\"].validate(normalized.typeParams));\n\tif (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.`, {\n\t\tcodecId: ref.codecId,\n\t\ttypeParams: ref.typeParams\n\t});\n\tif (\"issues\" in result && result.issues) {\n\t\tconst messages = result.issues.map((issue) => issue.message).join(\"; \");\n\t\tthrow runtimeError(\"RUNTIME.TYPE_PARAMS_INVALID\", `Invalid typeParams for codec '${ref.codecId}': ${messages}`, {\n\t\t\tcodecId: ref.codecId,\n\t\t\ttypeParams: ref.typeParams\n\t\t});\n\t}\n\treturn blindCast(result).value;\n}\n/**\n* Resolves a `Codec` instance: validates `ref.typeParams` via\n* {@link validateCodecTypeParams} then calls `descriptor.factory(validated)(ctx)`\n* as a method on `descriptor`, preserving `this` for factories that build\n* their returned codec from the descriptor instance (e.g. `new XCodec(this)`).\n*/\nfunction materializeCodec(descriptor, ref, ctx) {\n\tconst validated = validateCodecTypeParams(descriptor, ref);\n\treturn descriptor.factory(validated)(ctx);\n}\n//#endregion\nexport { validateCodecTypeParams as i, materializeCodec as n, resolveCodecDescriptorOrThrow as r, CONTRACT_CODEC_DESCRIPTOR_MISSING as t };\n\n//# sourceMappingURL=resolve-codec-BLRGmP1f.mjs.map"],"mappings":";;;AAGA,MAAM,oCAAoC;;;;;;;AAO1C,SAAS,8BAA8B,eAAe,KAAK,MAAM;CAChE,MAAM,aAAa,cAAc,IAAI,OAAO;CAC5C,IAAI,CAAC,YAAY,MAAM,aAAa,MAAM,+CAA+C,IAAI,QAAQ,KAAK,EAAE,SAAS,IAAI,QAAQ,CAAC;CAClI,OAAO;AACR;;;;;;;;;AASA,SAAS,wBAAwB,YAAY,KAAK;CACjD,MAAM,aAAa,WAAW,mBAAmB,IAAI,eAAe,KAAK,IAAI;EAC5E,GAAG;EACH,YAAY,CAAC;CACd,IAAI;CACJ,MAAM,SAAS,UAAU,WAAW,aAAa,YAAY,CAAC,SAAS,WAAW,UAAU,CAAC;CAC7F,IAAI,kBAAkB,SAAS,MAAM,aAAa,+BAA+B,2BAA2B,IAAI,QAAQ,6FAA6F;EACpN,SAAS,IAAI;EACb,YAAY,IAAI;CACjB,CAAC;CACD,IAAI,YAAY,UAAU,OAAO,QAAQ;EACxC,MAAM,WAAW,OAAO,OAAO,KAAK,UAAU,MAAM,OAAO,CAAC,CAAC,KAAK,IAAI;EACtE,MAAM,aAAa,+BAA+B,iCAAiC,IAAI,QAAQ,KAAK,YAAY;GAC/G,SAAS,IAAI;GACb,YAAY,IAAI;EACjB,CAAC;CACF;CACA,OAAO,UAAU,MAAM,CAAC,CAAC;AAC1B;;;;;;;AAOA,SAAS,iBAAiB,YAAY,KAAK,KAAK;CAC/C,MAAM,YAAY,wBAAwB,YAAY,GAAG;CACzD,OAAO,WAAW,QAAQ,SAAS,CAAC,CAAC,GAAG;AACzC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as ContractModelBase, n as ApplicationDomain } from "./domain-envelope-
|
|
2
|
-
//#region ../../../1-framework/0-foundation/contract/dist/resolve-domain-model-
|
|
1
|
+
import { g as ContractModelBase, n as ApplicationDomain } from "./domain-envelope-CENjHN4U-BIIt9bl4.mjs";
|
|
2
|
+
//#region ../../../1-framework/0-foundation/contract/dist/resolve-domain-model-DXP2hfI2.d.mts
|
|
3
3
|
//#region src/resolve-domain-model.d.ts
|
|
4
4
|
interface ResolvedDomainModel {
|
|
5
5
|
readonly namespaceId: string;
|
|
@@ -14,4 +14,4 @@ interface ResolvedDomainModel {
|
|
|
14
14
|
declare function resolveDomainModel(domain: ApplicationDomain, modelName: string): ResolvedDomainModel | undefined;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { resolveDomainModel as n, ResolvedDomainModel as t };
|
|
17
|
-
//# sourceMappingURL=resolve-domain-model-
|
|
17
|
+
//# sourceMappingURL=resolve-domain-model-DXP2hfI2-D4fWewZQ.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-domain-model-DXP2hfI2-D4fWewZQ.d.mts","names":[],"sources":["../../../../1-framework/0-foundation/contract/dist/resolve-domain-model-DXP2hfI2.d.mts"],"mappings":";;;UAEU;WACC;WACA,OAAO;;;;;;;;iBAQD,mBAAmB,QAAQ,mBAAmB,oBAAoB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as blindCast } from "./casts-DpaahrlC-Bd5n2coI.mjs";
|
|
2
|
-
import { t as InternalError } from "./internal-error-
|
|
2
|
+
import { t as InternalError } from "./internal-error-ChGYPVpq-DhUD05u0.mjs";
|
|
3
3
|
//#region ../../../1-framework/0-foundation/utils/dist/result.mjs
|
|
4
4
|
/**
|
|
5
5
|
* Generic Result type for representing success or failure outcomes.
|
|
@@ -89,4 +89,4 @@ function okVoid() {
|
|
|
89
89
|
//#endregion
|
|
90
90
|
export { ok as n, okVoid as r, notOk as t };
|
|
91
91
|
|
|
92
|
-
//# sourceMappingURL=result-
|
|
92
|
+
//# sourceMappingURL=result-C0NUq1Ok.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-
|
|
1
|
+
{"version":3,"file":"result-C0NUq1Ok.mjs","names":[],"sources":["../../../../1-framework/0-foundation/utils/dist/result.mjs"],"sourcesContent":["import { t as InternalError } from \"./internal-error-ChGYPVpq.mjs\";\nimport { t as blindCast } from \"./casts-DpaahrlC.mjs\";\n//#region src/result.ts\n/**\n* Generic Result type for representing success or failure outcomes.\n*\n* This is the standard way to return \"expected failures\" as values rather than\n* throwing exceptions. See docs/Error Handling.md for the full taxonomy.\n*\n* Naming rationale:\n* - `Ok<T>` / `NotOk<F>` mirror the `ok: true/false` discriminator\n* - `NotOk` avoids collision with domain types like \"Failure\" or \"Error\"\n* - `failure` property distinguishes from JS Error semantics\n*/\n/**\n* Result class that implements both Ok and NotOk variants.\n*/\nvar ResultImpl = class ResultImpl {\n\tok;\n\t_value;\n\t_failure;\n\tconstructor(ok, valueOrFailure) {\n\t\tthis.ok = ok;\n\t\tif (ok) this._value = valueOrFailure;\n\t\telse this._failure = valueOrFailure;\n\t\tObject.freeze(this);\n\t}\n\tget value() {\n\t\tif (!this.ok) throw new InternalError(\"Cannot access value on NotOk result\");\n\t\treturn this._value;\n\t}\n\tget failure() {\n\t\tif (this.ok) throw new InternalError(\"Cannot access failure on Ok result\");\n\t\treturn this._failure;\n\t}\n\t/**\n\t* Creates a successful result.\n\t*/\n\tstatic ok(value) {\n\t\treturn blindCast(new ResultImpl(true, value));\n\t}\n\t/**\n\t* Creates an unsuccessful result.\n\t*/\n\tstatic notOk(failure) {\n\t\treturn blindCast(new ResultImpl(false, failure));\n\t}\n\t/**\n\t* Asserts that this result is Ok and returns the value.\n\t* Throws if the result is NotOk.\n\t*/\n\tassertOk() {\n\t\tif (!this.ok) throw new InternalError(\"Expected Ok result but got NotOk\");\n\t\treturn this.value;\n\t}\n\t/**\n\t* Asserts that this result is NotOk and returns the failure.\n\t* Throws if the result is Ok.\n\t*/\n\tassertNotOk() {\n\t\tif (this.ok) throw new InternalError(\"Expected NotOk result but got Ok\");\n\t\treturn this.failure;\n\t}\n};\n/**\n* Creates a successful result.\n*/\nfunction ok(value) {\n\treturn ResultImpl.ok(value);\n}\n/**\n* Creates an unsuccessful result.\n*/\nfunction notOk(failure) {\n\treturn ResultImpl.notOk(failure);\n}\n/**\n* Singleton for void success results.\n* Use this for validation checks that don't produce a value.\n*/\nconst OK_VOID = ResultImpl.ok(void 0);\n/**\n* Returns a successful void result.\n* Use this for validation checks that don't produce a value.\n*/\nfunction okVoid() {\n\treturn OK_VOID;\n}\n//#endregion\nexport { notOk, ok, okVoid };\n\n//# sourceMappingURL=result.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,IAAI,aAAa,MAAM,WAAW;CACjC;CACA;CACA;CACA,YAAY,IAAI,gBAAgB;EAC/B,KAAK,KAAK;EACV,IAAI,IAAI,KAAK,SAAS;OACjB,KAAK,WAAW;EACrB,OAAO,OAAO,IAAI;CACnB;CACA,IAAI,QAAQ;EACX,IAAI,CAAC,KAAK,IAAI,MAAM,IAAI,cAAc,qCAAqC;EAC3E,OAAO,KAAK;CACb;CACA,IAAI,UAAU;EACb,IAAI,KAAK,IAAI,MAAM,IAAI,cAAc,oCAAoC;EACzE,OAAO,KAAK;CACb;;;;CAIA,OAAO,GAAG,OAAO;EAChB,OAAO,UAAU,IAAI,WAAW,MAAM,KAAK,CAAC;CAC7C;;;;CAIA,OAAO,MAAM,SAAS;EACrB,OAAO,UAAU,IAAI,WAAW,OAAO,OAAO,CAAC;CAChD;;;;;CAKA,WAAW;EACV,IAAI,CAAC,KAAK,IAAI,MAAM,IAAI,cAAc,kCAAkC;EACxE,OAAO,KAAK;CACb;;;;;CAKA,cAAc;EACb,IAAI,KAAK,IAAI,MAAM,IAAI,cAAc,kCAAkC;EACvE,OAAO,KAAK;CACb;AACD;;;;AAIA,SAAS,GAAG,OAAO;CAClB,OAAO,WAAW,GAAG,KAAK;AAC3B;;;;AAIA,SAAS,MAAM,SAAS;CACvB,OAAO,WAAW,MAAM,OAAO;AAChC;;;;;AAKA,MAAM,UAAU,WAAW,GAAG,KAAK,CAAC;;;;;AAKpC,SAAS,SAAS;CACjB,OAAO;AACR"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as CodecCallContext } from "./codec-types-
|
|
1
|
+
import { G as PlanMeta } from "./domain-envelope-CENjHN4U-BIIt9bl4.mjs";
|
|
2
|
+
import { r as CodecCallContext } from "./codec-types-nVMtogur-CYBdUQUH.mjs";
|
|
3
3
|
//#region ../../../1-framework/1-core/framework-components/dist/runtime.d.mts
|
|
4
4
|
//#region src/annotations.d.ts
|
|
5
5
|
/**
|
|
@@ -976,6 +976,68 @@ declare abstract class RuntimeCore<TPlan extends QueryPlan, TExec extends Execut
|
|
|
976
976
|
execute(plan: TPlan, options?: RuntimeExecuteOptions): Promise<RuntimeStatementStats>;
|
|
977
977
|
}
|
|
978
978
|
//#endregion
|
|
979
|
+
//#region src/execution/shape.d.ts
|
|
980
|
+
/**
|
|
981
|
+
* Phantom key an emitted model type carries to name its relation properties.
|
|
982
|
+
* Never present at runtime; `Scalars` and `Shape` read it to tell relations from fields.
|
|
983
|
+
*/
|
|
984
|
+
declare const RelationKeys: unique symbol;
|
|
985
|
+
/**
|
|
986
|
+
* The relation names an emitted model type declares.
|
|
987
|
+
*/
|
|
988
|
+
type RelationNamesOf<M> = Rel<M>;
|
|
989
|
+
/**
|
|
990
|
+
* Without `exactOptionalPropertyTypes` the optional phantom infers `R | undefined`, so the
|
|
991
|
+
* inferred type is filtered rather than constrained: `infer R extends string` would fall back to
|
|
992
|
+
* `string` there.
|
|
993
|
+
*/
|
|
994
|
+
type Rel<M> = M extends {
|
|
995
|
+
readonly [RelationKeys]?: infer R;
|
|
996
|
+
} ? Extract<R, string> : never;
|
|
997
|
+
/**
|
|
998
|
+
* The scalar row of a model: every field, no relations, no phantom.
|
|
999
|
+
* Distributes over a union, so the row of a polymorphic `Any<Base>` is the union of its variants' rows.
|
|
1000
|
+
*/
|
|
1001
|
+
type Scalars<M> = M extends {
|
|
1002
|
+
readonly [RelationKeys]?: unknown;
|
|
1003
|
+
} ? Omit<M, Rel<M> | typeof RelationKeys> : M;
|
|
1004
|
+
/**
|
|
1005
|
+
* An application data structure derived from a model.
|
|
1006
|
+
*
|
|
1007
|
+
* At every level of `Spec`: `'+'` names scalars and relations to keep, and narrows the scalars only
|
|
1008
|
+
* when it names one; `'-'` names scalars to drop; any other key is a relation whose value is a spec
|
|
1009
|
+
* that narrows the related model. A relation named in `'+'` comes with all of its scalars and none of
|
|
1010
|
+
* its relations. Relations are absent unless asked for; cardinality and nullability come from the
|
|
1011
|
+
* model. Distributes over a union, so each variant of `Any<Base>` keeps only its own relations.
|
|
1012
|
+
*/
|
|
1013
|
+
type Shape<M, Spec extends ShapeSpec<M, Spec> = Record<never, never>> = ShapeOf<M, Spec>;
|
|
1014
|
+
/**
|
|
1015
|
+
* The constraint a `Shape` spec satisfies. A generic that forwards a spec needs it:
|
|
1016
|
+
* `type Response<S extends ShapeSpec<User, S>> = Shape<User, S>`.
|
|
1017
|
+
*/
|
|
1018
|
+
type ShapeSpec<M, Spec> = { readonly [K in keyof Spec]: K extends '+' ? Exclude<PlusNames<M, Spec>, keyof Spec> : K extends '-' ? ScalarNamesOf<M> : K extends RelationNamesOf<M> ? ShapeSpec<RelatedModel<M, K>, Spec[K]> : UnknownSpecKey<M, K>; };
|
|
1019
|
+
type PlusNames<M, Spec> = '-' extends keyof Spec ? RelationNamesOf<M> : ScalarNamesOf<M> | RelationNamesOf<M>;
|
|
1020
|
+
type UnknownSpecKey<M, K> = [RelationNamesOf<M>] extends [never] ? `'${K & string}' is not a relation of the model, which has none; try '+' or '-'` : `'${K & string}' is not a relation of the model; try '+', '-', or '${RelationNamesOf<M>}'`;
|
|
1021
|
+
type ScalarNamesOf<M> = M extends unknown ? keyof Scalars<M> & string : never;
|
|
1022
|
+
type RelatedModel<M, K> = M extends unknown ? K extends keyof M ? UnwrapRelation<M[K]> : never : never;
|
|
1023
|
+
type UnwrapRelation<V> = V extends (infer Item)[] ? Item : NonNullable<V>;
|
|
1024
|
+
type ShapeOf<M, Spec> = ShapeOfEach<M, Spec, PlusNamesAScalar<M, Spec>>;
|
|
1025
|
+
type PlusNamesAScalar<M, Spec> = Spec extends {
|
|
1026
|
+
readonly '+': infer Keep;
|
|
1027
|
+
} ? [Extract<Keep, ScalarNamesOf<M>>] extends [never] ? false : true : false;
|
|
1028
|
+
type ShapeOfEach<M, Spec, Narrow extends boolean> = M extends unknown ? Flatten<KeptScalars<M, Spec, Narrow> & { [K in IncludedRelations<M, Spec>]: WrapLike<M[K], ShapeOf<RelatedModel<M, K>, NestedSpec<Spec, K>>>; }> : never;
|
|
1029
|
+
type KeptScalars<M, Spec, Narrow extends boolean> = Narrow extends true ? Spec extends {
|
|
1030
|
+
readonly '+': infer Keep;
|
|
1031
|
+
} ? Pick<Scalars<M>, Extract<Keep, keyof Scalars<M>>> : never : Spec extends {
|
|
1032
|
+
readonly '-': infer Drop extends PropertyKey;
|
|
1033
|
+
} ? Omit<Scalars<M>, Drop> : Scalars<M>;
|
|
1034
|
+
type IncludedRelations<M, Spec> = Extract<keyof Spec | (Spec extends {
|
|
1035
|
+
readonly '+': infer Keep;
|
|
1036
|
+
} ? Keep : never), RelationNamesOf<M> & keyof M>;
|
|
1037
|
+
type NestedSpec<Spec, K> = K extends keyof Spec ? Spec[K] : Record<never, never>;
|
|
1038
|
+
type WrapLike<V, R> = V extends unknown[] ? R[] : null extends V ? R | null : R;
|
|
1039
|
+
type Flatten<T> = { [K in keyof T]: T[K]; };
|
|
1040
|
+
//#endregion
|
|
979
1041
|
//#region src/meta-builder.d.ts
|
|
980
1042
|
/**
|
|
981
1043
|
* Per-terminal meta configurator handed to user callbacks. The terminal's
|
|
@@ -1034,5 +1096,5 @@ interface LaneMetaBuilder<K extends OperationKind> extends MetaBuilder<K> {
|
|
|
1034
1096
|
*/
|
|
1035
1097
|
declare function createMetaBuilder<K extends OperationKind>(kind: K, terminalName: string): LaneMetaBuilder<K>;
|
|
1036
1098
|
//#endregion
|
|
1037
|
-
export {
|
|
1038
|
-
//# sourceMappingURL=runtime-
|
|
1099
|
+
export { Scalars as A, raceAgainstAbort as B, RuntimeErrorEnvelope as C, RuntimeMiddleware as D, RuntimeLog as E, checkAborted as F, runtimeAborted as G, runBeforeQueryChain as H, checkMiddlewareCompatibility as I, runtimeError as K, createMetaBuilder as L, ShapeSpec as M, ValidAnnotations as N, RuntimeMiddlewareContext as O, assertAnnotationsApplicable as P, defineAnnotation as R, RuntimeCoreOptions as S, RuntimeExecutor as T, runExecuteWithMiddleware as U, runBeforeExecuteChain as V, runQueryWithMiddleware as W, RelationKeys as _, AsyncIterableResult as a, RuntimeAbortedPhase as b, ExecuteInterceptResult as c, MetaBuilder as d, OperationKind as f, RUNTIME_ABORTED as g, QueryPlan as h, AnnotationValue as i, Shape as j, RuntimeStatementStats as k, ExecutionPlan as l, QueryInterceptResult as m, AfterQueryResult as n, CrossFamilyMiddleware as o, ParamRefMutator as p, AnnotationHandle as r, DefineAnnotationOptions as s, AfterExecuteResult as t, LaneMetaBuilder as u, RelationNamesOf as v, RuntimeExecuteOptions as w, RuntimeCore as x, ResultType as y, isRuntimeError as z };
|
|
1100
|
+
//# sourceMappingURL=runtime-DOHhUPFx.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-
|
|
1
|
+
{"version":3,"file":"runtime-DOHhUPFx.d.mts","names":[],"sources":["../../../../1-framework/1-core/framework-components/dist/runtime.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;KAoBK;;;;;;;;;;;;UAYK,gBAAgB,SAAS,cAAc;WACtC;WACA;WACA,OAAO;WACP,cAAc,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA2C3B,iBAAiB,SAAS,cAAc;GAC/C,OAAO,UAAU,gBAAgB,SAAS;WAClC;WACA,cAAc,YAAY;EACnC,KAAK;aACM;eACE,cAAc;;MAEvB;;;;;;;;;;;;;;;;;;;;;;;;UAwBI,wBAAwB,cAAc;WACrC;WACA,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuCjB,iBAAiB,mBAAmB,cAAc,eAAe,SAAS,wBAAwB,WAAW,iBAAiB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsDnJ,iBAAiB,UAAU,eAAe,oBAAoB,yBAAyB,gCAAgC,WAAW,KAAK,GAAG,WAAW,sBAAsB,SAAS,SAAS,UAAU,QAAQ,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;iBAwBtN,4BAA4B,sBAAsB,yBAAyB,kBAAkB,MAAM,eAA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AAU,uBAAuB,YAAY;WAC5D,aAAa,oBAAoB,yBAAyB;;;;;;;;;;;iBAWpD,kBAAkB,UAAU,eAAe,MAAM,GAAG,uBAAuB,gBAAgB"}
|
|
@@ -634,6 +634,11 @@ function checkMiddlewareCompatibility(middleware, runtimeFamilyId, runtimeTarget
|
|
|
634
634
|
runtimeTargetId
|
|
635
635
|
});
|
|
636
636
|
}
|
|
637
|
+
/**
|
|
638
|
+
* Phantom key an emitted model type carries to name its relation properties.
|
|
639
|
+
* Never present at runtime; `Scalars` and `Shape` read it to tell relations from fields.
|
|
640
|
+
*/
|
|
641
|
+
const RelationKeys = Symbol("RelationKeys");
|
|
637
642
|
var MetaBuilderImpl = class {
|
|
638
643
|
#kind;
|
|
639
644
|
#terminalName;
|
|
@@ -665,6 +670,6 @@ function createMetaBuilder(kind, terminalName) {
|
|
|
665
670
|
return new MetaBuilderImpl(kind, terminalName);
|
|
666
671
|
}
|
|
667
672
|
//#endregion
|
|
668
|
-
export {
|
|
673
|
+
export { assertAnnotationsApplicable as a, createMetaBuilder as c, runBeforeExecuteChain as d, runBeforeQueryChain as f, runtimeAborted as h, RuntimeCore as i, defineAnnotation as l, runQueryWithMiddleware as m, RUNTIME_ABORTED as n, checkAborted as o, runExecuteWithMiddleware as p, RelationKeys as r, checkMiddlewareCompatibility as s, AsyncIterableResult as t, raceAgainstAbort as u };
|
|
669
674
|
|
|
670
|
-
//# sourceMappingURL=runtime-
|
|
675
|
+
//# sourceMappingURL=runtime-DXmHIbAr.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-BqzioOmU.mjs","names":["#kind","#terminalName","#annotations"],"sources":["../../../../1-framework/1-core/framework-components/dist/runtime.mjs"],"sourcesContent":["import { n as runtimeError, t as isRuntimeError } from \"./runtime-error-BA9d7XjZ.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/execution/runtime-error.ts\n/**\n* Stable code emitted by the runtime when an in-flight `execute()`\n* is cancelled via the per-query `AbortSignal`. The envelope's\n* `details.phase` distinguishes where the abort was observed:\n*\n* - `'encode'` — abort fired during `encodeParams` (SQL) or\n* `resolveValue` (Mongo).\n* - `'decode'` — abort fired during `decodeRow` / `decodeField`.\n* - `'stream'` — abort fired between rows or before any codec call\n* (already-aborted at entry).\n* - `'beforeQuery'` / `'beforeExecute'` / `'afterQuery'` /\n* `'afterExecute'` / `'onRow'` — abort fired on entry to or during\n* the corresponding middleware phase\n* (cooperative cancellation per the param-transform seam).\n*/\nconst RUNTIME_ABORTED = \"RUNTIME.ABORTED\";\n/**\n* Construct a `RUNTIME.ABORTED` envelope. Phase distinguishes where the\n* abort was observed — codec call sites (`encode` / `decode` / `stream`)\n* or operation-specific middleware seams, as\n* enumerated on {@link RuntimeAbortedPhase}. Cause carries\n* `signal.reason` verbatim from the platform — native abort produces a\n* `DOMException`, explicit `controller.abort(reason)` produces whatever\n* the caller passed. No synthesis happens here.\n*/\nfunction runtimeAborted(phase, cause) {\n\tconst envelope = runtimeError(RUNTIME_ABORTED, `Operation aborted during ${phase}`, { phase });\n\treturn Object.assign(envelope, { cause });\n}\n//#endregion\n//#region src/annotations.ts\n/**\n* Defines a typed annotation handle.\n*\n* Two-step call form. The first step takes the `Payload` type argument\n* (TypeScript cannot infer `Payload` from anything in the options, so it\n* must be supplied explicitly); the second step takes the runtime options\n* and infers `Kinds` from the `applicableTo` array via a `const` type\n* parameter, so the operation kinds appear exactly once at the call site.\n*\n* @example\n* ```typescript\n* // Read-only annotation. Lane terminals like `db.User.first(...)` accept\n* // it; `db.User.create(...)` rejects it at the type level.\n* const cacheAnnotation = defineAnnotation<{ ttl?: number; skip?: boolean }>()({\n* namespace: 'cache',\n* applicableTo: ['read'],\n* }); // Kinds inferred as 'read'\n*\n* // Write-only annotation. Mirror image.\n* const auditAnnotation = defineAnnotation<{ actor: string }>()({\n* namespace: 'audit',\n* applicableTo: ['write'],\n* }); // Kinds inferred as 'write'\n*\n* // Annotation applicable to both kinds (e.g. tracing).\n* const otelAnnotation = defineAnnotation<{ traceId: string }>()({\n* namespace: 'otel',\n* applicableTo: ['read', 'write'],\n* }); // Kinds inferred as 'read' | 'write'\n* ```\n*\n* **Reserved namespaces.** See `DefineAnnotationOptions.namespace` for the\n* list of framework-internal namespaces (`codecs`, target-specific keys).\n* `defineAnnotation` does not structurally prevent a user from naming a\n* reserved namespace, but the framework makes no compatibility guarantee\n* about handles that do.\n*/\nfunction defineAnnotation() {\n\treturn (options) => {\n\t\tconst namespace = options.namespace;\n\t\tconst applicableTo = Object.freeze(new Set(options.applicableTo));\n\t\tfunction handle(value) {\n\t\t\treturn Object.freeze({\n\t\t\t\t__annotation: true,\n\t\t\t\tnamespace,\n\t\t\t\tvalue,\n\t\t\t\tapplicableTo\n\t\t\t});\n\t\t}\n\t\tfunction read(plan) {\n\t\t\tconst stored = plan.meta.annotations?.[namespace];\n\t\t\tif (!isAnnotationValue(stored)) return;\n\t\t\tif (stored.namespace !== namespace) return;\n\t\t\treturn stored.value;\n\t\t}\n\t\treturn Object.freeze(Object.assign(handle, {\n\t\t\tnamespace,\n\t\t\tapplicableTo,\n\t\t\tread\n\t\t}));\n\t};\n}\n/**\n* Runtime applicability gate. Throws `RUNTIME.ANNOTATION_INAPPLICABLE` if\n* any annotation in `annotations` declares an `applicableTo` set that does\n* not include `kind`. Used by lane terminals (SQL DSL builders' `.build()`,\n* ORM `Collection` terminals) to fail closed when the type-level\n* `ValidAnnotations` gate is bypassed via cast / `any` / dynamic\n* invocation.\n*\n* Passes silently on:\n* - empty arrays\n* - annotations whose `applicableTo` includes `kind`\n*\n* Throws on:\n* - any annotation whose `applicableTo` does not include `kind`. The\n* error names the offending annotation's `namespace` and the\n* `terminalName` so users can locate the misuse.\n*\n* @example\n* ```typescript\n* // Inside an ORM read terminal:\n* assertAnnotationsApplicable(annotations, 'read', 'first');\n* ```\n*/\nfunction assertAnnotationsApplicable(annotations, kind, terminalName) {\n\tfor (const annotation of annotations) if (!annotation.applicableTo.has(kind)) throw runtimeError(\"RUNTIME.ANNOTATION_INAPPLICABLE\", `Annotation '${annotation.namespace}' is not applicable to '${kind}' operations (terminal: '${terminalName}'). The annotation declares applicableTo = [${Array.from(annotation.applicableTo).map((k) => `'${k}'`).join(\", \")}].`, {\n\t\tnamespace: annotation.namespace,\n\t\tterminalName,\n\t\tkind,\n\t\tapplicableTo: Array.from(annotation.applicableTo)\n\t});\n}\n/**\n* Type guard for branded annotation values stored in `plan.meta.annotations`.\n*\n* Internal — used by `AnnotationHandle.read` to distinguish user\n* annotations (created by calling a handle returned from\n* `defineAnnotation(...)`) from framework-internal metadata that may\n* happen to live under the same namespace key.\n*/\nfunction isAnnotationValue(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\treturn value.__annotation === true;\n}\n//#endregion\n//#region src/execution/async-iterable-result.ts\nvar AsyncIterableResult = class {\n\tgenerator;\n\tconsumed = false;\n\tconsumedBy;\n\tbufferedArrayPromise;\n\tconstructor(generator) {\n\t\tthis.generator = generator;\n\t}\n\t[Symbol.asyncIterator]() {\n\t\tif (this.consumed) throw runtimeError(\"RUNTIME.ITERATOR_CONSUMED\", `AsyncIterableResult iterator has already been consumed via ${this.consumedBy === \"bufferedArray\" ? \"toArray()/then()\" : \"for-await loop\"}. Each AsyncIterableResult can only be iterated once.`, {\n\t\t\tconsumedBy: this.consumedBy,\n\t\t\tsuggestion: this.consumedBy === \"bufferedArray\" ? \"If you need to iterate multiple times, store the results from toArray() in a variable and reuse that.\" : \"If you need to iterate multiple times, use toArray() to collect all results first.\"\n\t\t});\n\t\tthis.consumed = true;\n\t\tthis.consumedBy = \"iterator\";\n\t\treturn this.generator;\n\t}\n\ttoArray() {\n\t\tif (this.consumedBy === \"iterator\") return Promise.reject(runtimeError(\"RUNTIME.ITERATOR_CONSUMED\", \"AsyncIterableResult iterator has already been consumed via for-await loop. Each AsyncIterableResult can only be iterated once.\", {\n\t\t\tconsumedBy: this.consumedBy,\n\t\t\tsuggestion: \"The iterator was already consumed by a for-await loop. Use toArray() or await the result before iterating.\"\n\t\t}));\n\t\tif (this.bufferedArrayPromise) return this.bufferedArrayPromise;\n\t\tthis.consumed = true;\n\t\tthis.consumedBy = \"bufferedArray\";\n\t\tthis.bufferedArrayPromise = (async () => {\n\t\t\tconst out = [];\n\t\t\tfor await (const item of this.generator) out.push(item);\n\t\t\treturn out;\n\t\t})();\n\t\treturn this.bufferedArrayPromise;\n\t}\n\tasync first() {\n\t\treturn (await this.toArray())[0] ?? null;\n\t}\n\tasync firstOrThrow() {\n\t\tconst row = await this.first();\n\t\tif (row === null) throw runtimeError(\"RUNTIME.NO_ROWS\", \"Expected at least one row, but none were returned\", {});\n\t\treturn row;\n\t}\n\tthen(onfulfilled, onrejected) {\n\t\treturn this.toArray().then(onfulfilled, onrejected);\n\t}\n};\n//#endregion\n//#region src/execution/race-against-abort.ts\n/**\n* Throw a phase-tagged `RUNTIME.ABORTED` envelope if the supplied\n* context is already aborted at the precheck site. Centralises the\n* `if (ctx.signal?.aborted) throw runtimeAborted(...)` pattern that\n* every codec dispatch site (and the `beforeExecute` middleware phase)\n* repeats. Accepts both the framework `CodecCallContext` and the\n* `RuntimeMiddlewareContext`; both expose `signal?: AbortSignal`.\n*/\nfunction checkAborted(ctx, phase) {\n\tif (ctx.signal?.aborted) throw runtimeAborted(phase, ctx.signal.reason);\n}\n/**\n* Race a per-cell `Promise.all` (or any other in-flight work promise) against\n* the supplied abort signal so the runtime returns `RUNTIME.ABORTED` promptly\n* even when codec bodies ignore the signal. In-flight bodies that ignore the\n* signal are abandoned and run to completion in the background — the\n* cooperative-cancellation contract documented in ADR 204.\n*\n* Call sites still SHOULD pre-check `signal.aborted` and short-circuit with\n* a phase-tagged `RUNTIME.ABORTED` envelope before invoking this helper —\n* that path is the canonical \"aborted at entry\" surface and avoids\n* scheduling the work promise. As a defensive belt-and-braces, this helper\n* also handles the already-aborted case internally: `AbortSignal` does not\n* replay past abort events to listeners registered after the abort, so we\n* inspect `signal.aborted` synchronously and reject with the sentinel\n* before installing the listener. The rejection is still attributed to the\n* abort path via the sentinel-identity check.\n*\n* Distinguishing the rejection source is load-bearing for AC-ERR4\n* (`RUNTIME.ENCODE_FAILED` / `RUNTIME.DECODE_FAILED` pass through unchanged).\n* The semantically equivalent `abortable(signal)` helper in\n* `@internal/utils` rejects with `signal.reason ?? new DOMException(...)`,\n* which is not stably distinguishable from a codec-thrown error by identity\n* alone (a fresh fallback DOMException is allocated per call). We instead\n* track abort attribution with a unique sentinel: only the `onAbort` listener\n* installed here ever rejects with the sentinel, so an `error === sentinel`\n* identity check after the race is unambiguous.\n*\n* Lives in `framework-components` (rather than the SQL family, where it\n* originated in m2) so every family runtime that needs cooperative\n* cancellation around a codec-dispatch `Promise.all` (SQL encode + decode\n* today, Mongo encode in m3) shares the same attribution logic.\n*/\nasync function raceAgainstAbort(work, signal, phase) {\n\tif (signal === void 0) return await work;\n\tconst sentinel = { reason: void 0 };\n\tlet onAbort;\n\tconst abortPromise = new Promise((_, reject) => {\n\t\tif (signal.aborted) {\n\t\t\tsentinel.reason = signal.reason;\n\t\t\treject(sentinel);\n\t\t\treturn;\n\t\t}\n\t\tonAbort = () => {\n\t\t\tsentinel.reason = signal.reason;\n\t\t\treject(sentinel);\n\t\t};\n\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t});\n\ttry {\n\t\treturn await Promise.race([work, abortPromise]);\n\t} catch (error) {\n\t\tif (error === sentinel) throw runtimeAborted(phase, sentinel.reason);\n\t\tthrow error;\n\t} finally {\n\t\tif (onAbort) signal.removeEventListener(\"abort\", onAbort);\n\t}\n}\n//#endregion\n//#region src/execution/before-execute-chain.ts\n/**\n* Runs every middleware's `beforeQuery` hook in registration order,\n* threading through the (optional) family-specific `paramsMutator`.\n*\n* Why this lives outside {@link runQueryWithMiddleware}: middleware that\n* mutates parameter values (e.g. cipherstash's bulk-encrypt SDK\n* round-trip) must run *before* the family runtime encodes those\n* parameters to driver wire format. Family runtimes call\n* `runBeforeQueryChain` between the AST → plan lowering step and\n* the parameter encode step; the encode then observes the mutator's\n* `currentParams()` view. `runQueryWithMiddleware` retains the rest of\n* the query lifecycle (`interceptQuery`, driver/row source loop, `onRow`,\n* `afterQuery`) but no longer fires `beforeQuery` itself.\n*\n* Lifecycle within this helper:\n*\n* 1. For each middleware in registration order, if `beforeQuery`\n* is implemented:\n* - `checkAborted(ctx, 'beforeQuery')` short-circuits if the\n* caller already aborted at entry.\n* - The hook is invoked with `(plan, ctx, paramsMutator)`. A\n* middleware body that ignores the mutator stays compatible —\n* JavaScript allows extra positional arguments.\n* - If the hook returns a Promise, it is raced against\n* `ctx.signal` via {@link raceAgainstAbort} so cooperative\n* cancellation surfaces a `RUNTIME.ABORTED { phase:\n* 'beforeQuery' }` envelope even when the body itself\n* ignores the signal.\n*\n* Error propagation: any error thrown by a `beforeQuery` body\n* (or surfaced by the abort race) propagates out of this helper\n* unchanged. Family runtime entry points await this helper before invoking\n* `runQueryWithMiddleware`, so a rejection prevents the runner and its\n* `afterQuery` hook from running.\n*\n* Relationship to {@link runQueryWithMiddleware}: the framework's\n* `RuntimeCore.query` template calls this helper between\n* `lower(plan)` and `runQueryWithMiddleware(...)`. Family runtimes that\n* override query preparation (e.g. SQL, which inlines lower + encode for\n* direct mutator threading) call this helper themselves at the\n* equivalent point — between the family's AST → draft-plan\n* lowering and the parameter-encode step.\n*\n* Intercept ordering: this helper fires unconditionally before\n* `runQueryWithMiddleware`. `interceptQuery` (inside\n* `runQueryWithMiddleware`) therefore observes the post-`beforeQuery`\n* plan — mutator mutations are visible in the params interceptors see.\n* The trade-off is documented on `RuntimeMiddleware.interceptQuery`.\n*/\nfunction runBeforeQueryChain(plan, middleware, ctx, paramsMutator) {\n\treturn runBeforeChain(plan, middleware, ctx, paramsMutator, \"beforeQuery\", (mw) => mw.beforeQuery);\n}\n/**\n* Runs every middleware's `beforeExecute` hook in registration order,\n* threading through the (optional) family-specific `paramsMutator`.\n*\n* Why this lives outside {@link runExecuteWithMiddleware}: middleware that\n* mutates parameter values (e.g. cipherstash's bulk-encrypt SDK\n* round-trip) must run *before* the family runtime encodes those\n* parameters to driver wire format. Family runtimes call\n* `runBeforeExecuteChain` between the AST → plan lowering step and\n* the parameter encode step; the encode then observes the mutator's\n* `currentParams()` view. `runExecuteWithMiddleware` retains the rest of\n* the execute lifecycle (`interceptExecute`, driver statistics execution,\n* `afterExecute`) but no longer fires `beforeExecute` itself.\n*\n* Lifecycle within this helper:\n*\n* 1. For each middleware in registration order, if `beforeExecute`\n* is implemented:\n* - `checkAborted(ctx, 'beforeExecute')` short-circuits if the\n* caller already aborted at entry.\n* - The hook is invoked with `(plan, ctx, paramsMutator)`. A\n* middleware body that ignores the mutator stays compatible —\n* JavaScript allows extra positional arguments.\n* - If the hook returns a Promise, it is raced against\n* `ctx.signal` via {@link raceAgainstAbort} so cooperative\n* cancellation surfaces a `RUNTIME.ABORTED { phase:\n* 'beforeExecute' }` envelope even when the body itself\n* ignores the signal.\n*\n* Error propagation: any error thrown by a `beforeExecute` body\n* (or surfaced by the abort race) propagates out of this helper\n* unchanged. Family runtime entry points await this helper before invoking\n* `runExecuteWithMiddleware`, so a rejection prevents the runner and its\n* `afterExecute` hook from running.\n*\n* Relationship to {@link runExecuteWithMiddleware}: the framework's\n* `RuntimeCore.execute` template calls this helper between\n* `lower(plan)` and `runExecuteWithMiddleware(...)`. Family runtimes that\n* override execute (e.g. SQL, which inlines lower + encode for\n* direct mutator threading) call this helper themselves at the\n* equivalent point — between the family's AST → draft-plan\n* lowering and the parameter-encode step.\n*\n* Intercept ordering: this helper fires unconditionally before\n* `runExecuteWithMiddleware`. `interceptExecute` (inside\n* `runExecuteWithMiddleware`) therefore observes the post-`beforeExecute`\n* plan — mutator mutations are visible in the params interceptors see.\n* The trade-off is documented on `RuntimeMiddleware.interceptExecute`.\n*/\nfunction runBeforeExecuteChain(plan, middleware, ctx, paramsMutator) {\n\treturn runBeforeChain(plan, middleware, ctx, paramsMutator, \"beforeExecute\", (mw) => mw.beforeExecute);\n}\nasync function runBeforeChain(plan, middleware, ctx, paramsMutator, phase, selectHook) {\n\tfor (const mw of middleware) {\n\t\tconst hook = selectHook(mw);\n\t\tif (hook === void 0) continue;\n\t\tcheckAborted(ctx, phase);\n\t\tconst work = hook(plan, ctx, paramsMutator);\n\t\tif (work !== void 0) await raceAgainstAbort(Promise.resolve(work), ctx.signal, phase);\n\t}\n}\n//#endregion\n//#region src/execution/run-with-middleware.ts\n/**\n* Drives a single query execution of `runDriver()` through the middleware\n* lifecycle's `interceptQuery` + row-source + termination phases.\n*\n* Lifecycle, in order:\n* 1. For each middleware in registration order: `interceptQuery(exec, ctx)`.\n* The first non-`undefined` result wins; subsequent middleware's\n* `interceptQuery` does not fire. On a hit, the runtime emits a\n* `middleware.interceptQuery` debug event naming the winning middleware,\n* switches the row source to the intercepted rows, and proceeds with\n* `source: 'middleware'`. On all-passthrough (every `interceptQuery`\n* returns `undefined` or is omitted), `source: 'driver'` is used and the\n* row source is `runDriver()`.\n* 2. Iterate the row source. On the driver path, for each row, for each\n* middleware in registration order: `onRow(row, exec, ctx)`; then yield\n* the row. On the intercepted hit path, `onRow` is skipped — intercepted\n* rows did not originate from a driver row stream — but rows are still\n* yielded to the consumer in order.\n* 3. On successful completion: for each middleware in registration order:\n* `afterQuery(exec, { rowCount, latencyMs, completed: true, source },\n* ctx)`.\n* 4. On any error thrown during steps 1–2: for each middleware in\n* registration order: `afterQuery(exec, { rowCount, latencyMs,\n* completed: false, source }, ctx)`. Errors thrown by `afterQuery`\n* during the error path are swallowed so they do not mask the original\n* error. The original error is then rethrown.\n*\n* `beforeQuery` is **not** fired here — see\n* {@link runBeforeQueryChain} in `before-execute-chain.ts`. Family runtimes\n* call that helper between the AST → plan lowering step and the parameter\n* encode step so middleware that mutates ParamRef values can have its\n* mutations visible to encode. `runQueryWithMiddleware` operates on the\n* fully-encoded plan; interceptors therefore observe a fully-mutated,\n* encoded plan.\n*\n* The `source` field on `AfterQueryResult` lets observers (telemetry, lints,\n* budgets) distinguish driver-served from middleware-served executions\n* without needing their own out-of-band signal.\n*\n* This helper is the single canonical implementation of the\n* intercept-and-row-source loop; family runtimes should not reimplement it.\n*/\nfunction runQueryWithMiddleware(exec, middleware, ctx, runDriver) {\n\tconst iterator = async function* () {\n\t\tconst startedAt = Date.now();\n\t\tlet rowCount = 0;\n\t\tlet completed = false;\n\t\tlet source = \"driver\";\n\t\tlet rowSource;\n\t\ttry {\n\t\t\tfor (const mw of middleware) {\n\t\t\t\tif (!mw.interceptQuery) continue;\n\t\t\t\tsource = \"middleware\";\n\t\t\t\tconst result = await mw.interceptQuery(exec, ctx);\n\t\t\t\tif (result === void 0) {\n\t\t\t\t\tsource = \"driver\";\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tctx.log.debug?.({\n\t\t\t\t\tevent: \"middleware.interceptQuery\",\n\t\t\t\t\tmiddleware: mw.name\n\t\t\t\t});\n\t\t\t\trowSource = blindCast(result.rows);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (source === \"driver\") rowSource = runDriver();\n\t\t\tfor await (const row of rowSource) {\n\t\t\t\tif (source === \"driver\") {\n\t\t\t\t\tfor (const mw of middleware) if (mw.onRow) await mw.onRow(row, exec, ctx);\n\t\t\t\t}\n\t\t\t\trowCount++;\n\t\t\t\tyield row;\n\t\t\t}\n\t\t\tcompleted = true;\n\t\t} catch (error) {\n\t\t\tawait notifyQueryCompletion(middleware, exec, ctx, {\n\t\t\t\trowCount,\n\t\t\t\tlatencyMs: Date.now() - startedAt,\n\t\t\t\tcompleted,\n\t\t\t\tsource\n\t\t\t}, true);\n\t\t\tthrow error;\n\t\t}\n\t\tawait notifyQueryCompletion(middleware, exec, ctx, {\n\t\t\trowCount,\n\t\t\tlatencyMs: Date.now() - startedAt,\n\t\t\tcompleted,\n\t\t\tsource\n\t\t}, false);\n\t};\n\treturn new AsyncIterableResult(iterator());\n}\n/**\n* Drives a single execute operation through the middleware\n* `interceptExecute` + statistics + termination phases.\n*\n* Lifecycle, in order:\n* 1. For each middleware in registration order: `interceptExecute(exec, ctx)`.\n* The first non-`undefined` result wins; subsequent middleware's\n* `interceptExecute` does not fire. On a hit, the runtime emits a\n* `middleware.interceptExecute` debug event naming the winning middleware,\n* uses the returned `stats`, and proceeds with `source: 'middleware'`.\n* On all-passthrough (every `interceptExecute` returns `undefined` or is\n* omitted), `source: 'driver'` is used and `runDriver()` supplies the\n* statistics.\n* 2. Execute operations return eager statistics. There is no row stream and\n* `onRow` does not fire.\n* 3. On successful completion: for each middleware in registration order:\n* `afterExecute(exec, { stats, latencyMs, completed: true, source }, ctx)`.\n* 4. On any error thrown during steps 1–2: for each middleware in\n* registration order: `afterExecute(exec, { latencyMs, completed: false,\n* source }, ctx)`. Errors thrown by `afterExecute` during the error path\n* are swallowed so they do not mask the original error. The original\n* error is then rethrown.\n*\n* `beforeExecute` is **not** fired here — see\n* {@link runBeforeExecuteChain} in `before-execute-chain.ts`. Family runtimes\n* call that helper between the AST → plan lowering step and the parameter\n* encode step so middleware that mutates ParamRef values can have its\n* mutations visible to encode. `runExecuteWithMiddleware` operates on the\n* fully-encoded plan; interceptors therefore observe a fully-mutated,\n* encoded plan.\n*\n* The `source` field on `AfterExecuteResult` lets observers (telemetry, lints,\n* budgets) distinguish driver-served from middleware-served executions\n* without needing their own out-of-band signal.\n*/\nasync function runExecuteWithMiddleware(exec, middleware, ctx, runDriver) {\n\tconst startedAt = Date.now();\n\tlet source = \"driver\";\n\tlet stats;\n\ttry {\n\t\tfor (const mw of middleware) {\n\t\t\tif (!mw.interceptExecute) continue;\n\t\t\tsource = \"middleware\";\n\t\t\tconst result = await mw.interceptExecute(exec, ctx);\n\t\t\tif (result === void 0) {\n\t\t\t\tsource = \"driver\";\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tctx.log.debug?.({\n\t\t\t\tevent: \"middleware.interceptExecute\",\n\t\t\t\tmiddleware: mw.name\n\t\t\t});\n\t\t\tstats = result.stats;\n\t\t\tbreak;\n\t\t}\n\t\tif (stats === void 0) stats = await runDriver();\n\t} catch (error) {\n\t\tconst latencyMs = Date.now() - startedAt;\n\t\tfor (const mw of middleware) {\n\t\t\tif (!mw.afterExecute) continue;\n\t\t\ttry {\n\t\t\t\tawait mw.afterExecute(exec, {\n\t\t\t\t\tlatencyMs,\n\t\t\t\t\tcompleted: false,\n\t\t\t\t\tsource\n\t\t\t\t}, ctx);\n\t\t\t} catch {}\n\t\t}\n\t\tthrow error;\n\t}\n\tconst latencyMs = Date.now() - startedAt;\n\tfor (const mw of middleware) if (mw.afterExecute) await mw.afterExecute(exec, {\n\t\tstats,\n\t\tlatencyMs,\n\t\tcompleted: true,\n\t\tsource\n\t}, ctx);\n\treturn stats;\n}\nasync function notifyQueryCompletion(middleware, exec, ctx, result, swallowErrors) {\n\tfor (const mw of middleware) {\n\t\tif (!mw.afterQuery) continue;\n\t\tif (swallowErrors) try {\n\t\t\tawait mw.afterQuery(exec, result, ctx);\n\t\t} catch {}\n\t\telse await mw.afterQuery(exec, result, ctx);\n\t}\n}\n//#endregion\n//#region src/execution/runtime-core.ts\n/**\n* Family-agnostic abstract runtime base.\n*\n* Defines the shared operation-specific middleware lifecycles:\n*\n* 1. `runBeforeCompile(plan)` — concrete; defaults to identity. SQL overrides\n* this to run its shared `beforeCompile` middleware-hook chain.\n* 2. `lower(plan)` — abstract. Each family produces its `*ExecutionPlan`\n* (SQL via `lowerSqlPlan`, Mongo via `adapter.lower`).\n* 3. Queries run `beforeQuery`; statements run `beforeExecute`. Both chains\n* run after lowering and before their matching driver terminal. Family\n* runtimes that expose a params mutator to downstream encoding override\n* the operation and call the matching helper at the pre-encode point.\n* 4. The matching runner processes `interceptQuery` or `interceptExecute`\n* before invoking the driver. Queries then fire `onRow` and `afterQuery`;\n* statements fire `afterExecute`.\n*\n* Concrete subclasses must implement `lower`, `runDriver`, `runExecute`, and\n* `close`.\n*\n* The class is generic over:\n* - `TPlan` — the family's pre-lowering plan type.\n* - `TExec` — the family's post-lowering (executable) plan type.\n* - `TMiddleware` — the family's middleware type. Constrained to\n* `RuntimeMiddleware<TExec>` because the operation-specific runners invoke\n* hooks with the lowered `TExec`. Middleware therefore sees the\n* post-lowering plan.\n*/\nvar RuntimeCore = class {\n\tmiddleware;\n\tctx;\n\tconstructor(options) {\n\t\tthis.middleware = options.middleware;\n\t\tthis.ctx = options.ctx;\n\t}\n\t/**\n\t* Pre-lowering hook for plan rewriting. Defaults to identity. Subclasses\n\t* may override to run a `beforeCompile` middleware chain (SQL does this\n\t* to support typed AST rewrites — see `before-compile-chain.ts`).\n\t*/\n\trunBeforeCompile(plan) {\n\t\treturn plan;\n\t}\n\tquery(plan, options) {\n\t\tconst self = this;\n\t\tconst signal = options?.signal;\n\t\tconst codecCtx = signal === void 0 ? {} : { signal };\n\t\tconst execCtx = {\n\t\t\t...self.ctx,\n\t\t\t...codecCtx,\n\t\t\tscope: options?.scope ?? self.ctx.scope,\n\t\t\tplanExecutionId: crypto.randomUUID()\n\t\t};\n\t\tasync function* generator() {\n\t\t\tcheckAborted(codecCtx, \"stream\");\n\t\t\tconst compiled = await self.runBeforeCompile(plan);\n\t\t\tconst exec = await self.lower(compiled, codecCtx);\n\t\t\tawait runBeforeQueryChain(exec, self.middleware, execCtx);\n\t\t\tyield* runQueryWithMiddleware(exec, self.middleware, execCtx, () => self.runDriver(exec));\n\t\t}\n\t\treturn new AsyncIterableResult(generator());\n\t}\n\tasync execute(plan, options) {\n\t\tconst signal = options?.signal;\n\t\tconst codecCtx = signal === void 0 ? {} : { signal };\n\t\tconst execCtx = {\n\t\t\t...this.ctx,\n\t\t\t...codecCtx,\n\t\t\tscope: options?.scope ?? this.ctx.scope,\n\t\t\tplanExecutionId: crypto.randomUUID()\n\t\t};\n\t\tcheckAborted(codecCtx, \"stream\");\n\t\tconst compiled = await this.runBeforeCompile(plan);\n\t\tconst exec = await this.lower(compiled, codecCtx);\n\t\tawait runBeforeExecuteChain(exec, this.middleware, execCtx);\n\t\treturn runExecuteWithMiddleware(exec, this.middleware, execCtx, () => this.runExecute(exec));\n\t}\n};\n//#endregion\n//#region src/execution/runtime-middleware.ts\nfunction checkMiddlewareCompatibility(middleware, runtimeFamilyId, runtimeTargetId) {\n\tif (middleware.targetId !== void 0 && middleware.familyId === void 0) throw runtimeError(\"RUNTIME.MIDDLEWARE_INCOMPATIBLE\", `Middleware '${middleware.name}' specifies targetId '${middleware.targetId}' without familyId`, {\n\t\tmiddleware: middleware.name,\n\t\ttargetId: middleware.targetId\n\t});\n\tif (middleware.familyId !== void 0 && middleware.familyId !== runtimeFamilyId) throw runtimeError(\"RUNTIME.MIDDLEWARE_FAMILY_MISMATCH\", `Middleware '${middleware.name}' requires family '${middleware.familyId}' but the runtime is configured for family '${runtimeFamilyId}'`, {\n\t\tmiddleware: middleware.name,\n\t\tmiddlewareFamilyId: middleware.familyId,\n\t\truntimeFamilyId\n\t});\n\tif (middleware.targetId !== void 0 && middleware.targetId !== runtimeTargetId) throw runtimeError(\"RUNTIME.MIDDLEWARE_TARGET_MISMATCH\", `Middleware '${middleware.name}' requires target '${middleware.targetId}' but the runtime is configured for target '${runtimeTargetId}'`, {\n\t\tmiddleware: middleware.name,\n\t\tmiddlewareTargetId: middleware.targetId,\n\t\truntimeTargetId\n\t});\n}\n//#endregion\n//#region src/meta-builder.ts\nvar MetaBuilderImpl = class {\n\t#kind;\n\t#terminalName;\n\t#annotations = /* @__PURE__ */ new Map();\n\tconstructor(kind, terminalName) {\n\t\tthis.#kind = kind;\n\t\tthis.#terminalName = terminalName;\n\t}\n\tget annotations() {\n\t\treturn this.#annotations;\n\t}\n\tannotate(annotation) {\n\t\tconst value = annotation;\n\t\tassertAnnotationsApplicable([value], this.#kind, this.#terminalName);\n\t\tthis.#annotations.set(value.namespace, value);\n\t\treturn this;\n\t}\n};\n/**\n* Construct a lane-side meta builder for a terminal of operation kind `K`.\n*\n* Lane terminals call this with their `kind` (`'read'` or `'write'`) and a\n* `terminalName` for error messages, hand the resulting builder to the\n* user-supplied configurator callback (typed as `MetaBuilder<K>`, the\n* narrower public view), and read `meta.annotations` afterwards to thread\n* the recorded values into `plan.meta.annotations`.\n*/\nfunction createMetaBuilder(kind, terminalName) {\n\treturn new MetaBuilderImpl(kind, terminalName);\n}\n//#endregion\nexport { AsyncIterableResult, RUNTIME_ABORTED, RuntimeCore, assertAnnotationsApplicable, checkAborted, checkMiddlewareCompatibility, createMetaBuilder, defineAnnotation, isRuntimeError, raceAgainstAbort, runBeforeExecuteChain, runBeforeQueryChain, runExecuteWithMiddleware, runQueryWithMiddleware, runtimeAborted, runtimeError };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAM,kBAAkB;;;;;;;;;;AAUxB,SAAS,eAAe,OAAO,OAAO;CACrC,MAAM,WAAW,aAAa,iBAAiB,4BAA4B,SAAS,EAAE,MAAM,CAAC;CAC7F,OAAO,OAAO,OAAO,UAAU,EAAE,MAAM,CAAC;AACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAS,mBAAmB;CAC3B,QAAQ,YAAY;EACnB,MAAM,YAAY,QAAQ;EAC1B,MAAM,eAAe,OAAO,OAAO,IAAI,IAAI,QAAQ,YAAY,CAAC;EAChE,SAAS,OAAO,OAAO;GACtB,OAAO,OAAO,OAAO;IACpB,cAAc;IACd;IACA;IACA;GACD,CAAC;EACF;EACA,SAAS,KAAK,MAAM;GACnB,MAAM,SAAS,KAAK,KAAK,cAAc;GACvC,IAAI,CAAC,kBAAkB,MAAM,GAAG;GAChC,IAAI,OAAO,cAAc,WAAW;GACpC,OAAO,OAAO;EACf;EACA,OAAO,OAAO,OAAO,OAAO,OAAO,QAAQ;GAC1C;GACA;GACA;EACD,CAAC,CAAC;CACH;AACD;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAS,4BAA4B,aAAa,MAAM,cAAc;CACrE,KAAK,MAAM,cAAc,aAAa,IAAI,CAAC,WAAW,aAAa,IAAI,IAAI,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AS,6BAA6B,YAAY,iBAAiB,iBAAiB;CACnF,IAAI,WAAW,aAAa,KAAK,KAAK,WAAW,aAAa,KAAK,GAAG,MAAM,aAAa,mCAAmC,eAAe,WAAW,KAAK,wBAAwB,WAAW,SAAS,qBAAqB;EAC3N,YAAY,WAAW;EACvB,UAAU,WAAW;CACtB,CAAC;CACD,IAAI,WAAW,aAAa,KAAK,KAAK,WAAW,aAAa,iBAAiB,MAAM,aAAa,sCAAsC,eAAe,WAAW,KAAK,qBAAqB,WAAW,SAAS,8CAA8C,gBAAgB,IAAI;EACjR,YAAY,WAAW;EACvB,oBAAoB,WAAW;EAC/B;CACD,CAAC;CACD,IAAI,WAAW,aAAa,KAAK,KAAK,WAAW,aAAa,iBAAiB,MAAM,aAAa,sCAAsC,eAAe,WAAW,KAAK,qBAAqB,WAAW,SAAS,8CAA8C,gBAAgB,IAAI;EACjR,YAAY,WAAW;EACvB,oBAAoB,WAAW;EAC/B;CACD,CAAC;AACF;AAGA,IAAI,kBAAkB,MAAM;CAC3B;CACA;CACA,+BAA+B,IAAI,IAAI;CACvC,YAAY,MAAM,cAAc;EAC/B,KAAKA,QAAQ;EACb,KAAKC,gBAAgB;CACtB;CACA,IAAI,cAAc;EACjB,OAAO,KAAKC;CACb;CACA,SAAS,YAAY;EACpB,MAAM,QAAQ;EACd,4BAA4B,CAAC,KAAK,GAAG,KAAKF,OAAO,KAAKC,aAAa;EACnE,KAAKC,aAAa,IAAI,MAAM,WAAW,KAAK;EAC5C,OAAO;CACR;AACD;;;;;;;;;;AAUA,SAAS,kBAAkB,MAAM,cAAc;CAC9C,OAAO,IAAI,gBAAgB,MAAM,YAAY;AAC9C"}
|
|
1
|
+
{"version":3,"file":"runtime-DXmHIbAr.mjs","names":["#kind","#terminalName","#annotations"],"sources":["../../../../1-framework/1-core/framework-components/dist/runtime.mjs"],"sourcesContent":["import { n as runtimeError, t as isRuntimeError } from \"./runtime-error-BA9d7XjZ.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/execution/runtime-error.ts\n/**\n* Stable code emitted by the runtime when an in-flight `execute()`\n* is cancelled via the per-query `AbortSignal`. The envelope's\n* `details.phase` distinguishes where the abort was observed:\n*\n* - `'encode'` — abort fired during `encodeParams` (SQL) or\n* `resolveValue` (Mongo).\n* - `'decode'` — abort fired during `decodeRow` / `decodeField`.\n* - `'stream'` — abort fired between rows or before any codec call\n* (already-aborted at entry).\n* - `'beforeQuery'` / `'beforeExecute'` / `'afterQuery'` /\n* `'afterExecute'` / `'onRow'` — abort fired on entry to or during\n* the corresponding middleware phase\n* (cooperative cancellation per the param-transform seam).\n*/\nconst RUNTIME_ABORTED = \"RUNTIME.ABORTED\";\n/**\n* Construct a `RUNTIME.ABORTED` envelope. Phase distinguishes where the\n* abort was observed — codec call sites (`encode` / `decode` / `stream`)\n* or operation-specific middleware seams, as\n* enumerated on {@link RuntimeAbortedPhase}. Cause carries\n* `signal.reason` verbatim from the platform — native abort produces a\n* `DOMException`, explicit `controller.abort(reason)` produces whatever\n* the caller passed. No synthesis happens here.\n*/\nfunction runtimeAborted(phase, cause) {\n\tconst envelope = runtimeError(RUNTIME_ABORTED, `Operation aborted during ${phase}`, { phase });\n\treturn Object.assign(envelope, { cause });\n}\n//#endregion\n//#region src/annotations.ts\n/**\n* Defines a typed annotation handle.\n*\n* Two-step call form. The first step takes the `Payload` type argument\n* (TypeScript cannot infer `Payload` from anything in the options, so it\n* must be supplied explicitly); the second step takes the runtime options\n* and infers `Kinds` from the `applicableTo` array via a `const` type\n* parameter, so the operation kinds appear exactly once at the call site.\n*\n* @example\n* ```typescript\n* // Read-only annotation. Lane terminals like `db.User.first(...)` accept\n* // it; `db.User.create(...)` rejects it at the type level.\n* const cacheAnnotation = defineAnnotation<{ ttl?: number; skip?: boolean }>()({\n* namespace: 'cache',\n* applicableTo: ['read'],\n* }); // Kinds inferred as 'read'\n*\n* // Write-only annotation. Mirror image.\n* const auditAnnotation = defineAnnotation<{ actor: string }>()({\n* namespace: 'audit',\n* applicableTo: ['write'],\n* }); // Kinds inferred as 'write'\n*\n* // Annotation applicable to both kinds (e.g. tracing).\n* const otelAnnotation = defineAnnotation<{ traceId: string }>()({\n* namespace: 'otel',\n* applicableTo: ['read', 'write'],\n* }); // Kinds inferred as 'read' | 'write'\n* ```\n*\n* **Reserved namespaces.** See `DefineAnnotationOptions.namespace` for the\n* list of framework-internal namespaces (`codecs`, target-specific keys).\n* `defineAnnotation` does not structurally prevent a user from naming a\n* reserved namespace, but the framework makes no compatibility guarantee\n* about handles that do.\n*/\nfunction defineAnnotation() {\n\treturn (options) => {\n\t\tconst namespace = options.namespace;\n\t\tconst applicableTo = Object.freeze(new Set(options.applicableTo));\n\t\tfunction handle(value) {\n\t\t\treturn Object.freeze({\n\t\t\t\t__annotation: true,\n\t\t\t\tnamespace,\n\t\t\t\tvalue,\n\t\t\t\tapplicableTo\n\t\t\t});\n\t\t}\n\t\tfunction read(plan) {\n\t\t\tconst stored = plan.meta.annotations?.[namespace];\n\t\t\tif (!isAnnotationValue(stored)) return;\n\t\t\tif (stored.namespace !== namespace) return;\n\t\t\treturn stored.value;\n\t\t}\n\t\treturn Object.freeze(Object.assign(handle, {\n\t\t\tnamespace,\n\t\t\tapplicableTo,\n\t\t\tread\n\t\t}));\n\t};\n}\n/**\n* Runtime applicability gate. Throws `RUNTIME.ANNOTATION_INAPPLICABLE` if\n* any annotation in `annotations` declares an `applicableTo` set that does\n* not include `kind`. Used by lane terminals (SQL DSL builders' `.build()`,\n* ORM `Collection` terminals) to fail closed when the type-level\n* `ValidAnnotations` gate is bypassed via cast / `any` / dynamic\n* invocation.\n*\n* Passes silently on:\n* - empty arrays\n* - annotations whose `applicableTo` includes `kind`\n*\n* Throws on:\n* - any annotation whose `applicableTo` does not include `kind`. The\n* error names the offending annotation's `namespace` and the\n* `terminalName` so users can locate the misuse.\n*\n* @example\n* ```typescript\n* // Inside an ORM read terminal:\n* assertAnnotationsApplicable(annotations, 'read', 'first');\n* ```\n*/\nfunction assertAnnotationsApplicable(annotations, kind, terminalName) {\n\tfor (const annotation of annotations) if (!annotation.applicableTo.has(kind)) throw runtimeError(\"RUNTIME.ANNOTATION_INAPPLICABLE\", `Annotation '${annotation.namespace}' is not applicable to '${kind}' operations (terminal: '${terminalName}'). The annotation declares applicableTo = [${Array.from(annotation.applicableTo).map((k) => `'${k}'`).join(\", \")}].`, {\n\t\tnamespace: annotation.namespace,\n\t\tterminalName,\n\t\tkind,\n\t\tapplicableTo: Array.from(annotation.applicableTo)\n\t});\n}\n/**\n* Type guard for branded annotation values stored in `plan.meta.annotations`.\n*\n* Internal — used by `AnnotationHandle.read` to distinguish user\n* annotations (created by calling a handle returned from\n* `defineAnnotation(...)`) from framework-internal metadata that may\n* happen to live under the same namespace key.\n*/\nfunction isAnnotationValue(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\treturn value.__annotation === true;\n}\n//#endregion\n//#region src/execution/async-iterable-result.ts\nvar AsyncIterableResult = class {\n\tgenerator;\n\tconsumed = false;\n\tconsumedBy;\n\tbufferedArrayPromise;\n\tconstructor(generator) {\n\t\tthis.generator = generator;\n\t}\n\t[Symbol.asyncIterator]() {\n\t\tif (this.consumed) throw runtimeError(\"RUNTIME.ITERATOR_CONSUMED\", `AsyncIterableResult iterator has already been consumed via ${this.consumedBy === \"bufferedArray\" ? \"toArray()/then()\" : \"for-await loop\"}. Each AsyncIterableResult can only be iterated once.`, {\n\t\t\tconsumedBy: this.consumedBy,\n\t\t\tsuggestion: this.consumedBy === \"bufferedArray\" ? \"If you need to iterate multiple times, store the results from toArray() in a variable and reuse that.\" : \"If you need to iterate multiple times, use toArray() to collect all results first.\"\n\t\t});\n\t\tthis.consumed = true;\n\t\tthis.consumedBy = \"iterator\";\n\t\treturn this.generator;\n\t}\n\ttoArray() {\n\t\tif (this.consumedBy === \"iterator\") return Promise.reject(runtimeError(\"RUNTIME.ITERATOR_CONSUMED\", \"AsyncIterableResult iterator has already been consumed via for-await loop. Each AsyncIterableResult can only be iterated once.\", {\n\t\t\tconsumedBy: this.consumedBy,\n\t\t\tsuggestion: \"The iterator was already consumed by a for-await loop. Use toArray() or await the result before iterating.\"\n\t\t}));\n\t\tif (this.bufferedArrayPromise) return this.bufferedArrayPromise;\n\t\tthis.consumed = true;\n\t\tthis.consumedBy = \"bufferedArray\";\n\t\tthis.bufferedArrayPromise = (async () => {\n\t\t\tconst out = [];\n\t\t\tfor await (const item of this.generator) out.push(item);\n\t\t\treturn out;\n\t\t})();\n\t\treturn this.bufferedArrayPromise;\n\t}\n\tasync first() {\n\t\treturn (await this.toArray())[0] ?? null;\n\t}\n\tasync firstOrThrow() {\n\t\tconst row = await this.first();\n\t\tif (row === null) throw runtimeError(\"RUNTIME.NO_ROWS\", \"Expected at least one row, but none were returned\", {});\n\t\treturn row;\n\t}\n\tthen(onfulfilled, onrejected) {\n\t\treturn this.toArray().then(onfulfilled, onrejected);\n\t}\n};\n//#endregion\n//#region src/execution/race-against-abort.ts\n/**\n* Throw a phase-tagged `RUNTIME.ABORTED` envelope if the supplied\n* context is already aborted at the precheck site. Centralises the\n* `if (ctx.signal?.aborted) throw runtimeAborted(...)` pattern that\n* every codec dispatch site (and the `beforeExecute` middleware phase)\n* repeats. Accepts both the framework `CodecCallContext` and the\n* `RuntimeMiddlewareContext`; both expose `signal?: AbortSignal`.\n*/\nfunction checkAborted(ctx, phase) {\n\tif (ctx.signal?.aborted) throw runtimeAborted(phase, ctx.signal.reason);\n}\n/**\n* Race a per-cell `Promise.all` (or any other in-flight work promise) against\n* the supplied abort signal so the runtime returns `RUNTIME.ABORTED` promptly\n* even when codec bodies ignore the signal. In-flight bodies that ignore the\n* signal are abandoned and run to completion in the background — the\n* cooperative-cancellation contract documented in ADR 204.\n*\n* Call sites still SHOULD pre-check `signal.aborted` and short-circuit with\n* a phase-tagged `RUNTIME.ABORTED` envelope before invoking this helper —\n* that path is the canonical \"aborted at entry\" surface and avoids\n* scheduling the work promise. As a defensive belt-and-braces, this helper\n* also handles the already-aborted case internally: `AbortSignal` does not\n* replay past abort events to listeners registered after the abort, so we\n* inspect `signal.aborted` synchronously and reject with the sentinel\n* before installing the listener. The rejection is still attributed to the\n* abort path via the sentinel-identity check.\n*\n* Distinguishing the rejection source is load-bearing for AC-ERR4\n* (`RUNTIME.ENCODE_FAILED` / `RUNTIME.DECODE_FAILED` pass through unchanged).\n* The semantically equivalent `abortable(signal)` helper in\n* `@internal/utils` rejects with `signal.reason ?? new DOMException(...)`,\n* which is not stably distinguishable from a codec-thrown error by identity\n* alone (a fresh fallback DOMException is allocated per call). We instead\n* track abort attribution with a unique sentinel: only the `onAbort` listener\n* installed here ever rejects with the sentinel, so an `error === sentinel`\n* identity check after the race is unambiguous.\n*\n* Lives in `framework-components` (rather than the SQL family, where it\n* originated in m2) so every family runtime that needs cooperative\n* cancellation around a codec-dispatch `Promise.all` (SQL encode + decode\n* today, Mongo encode in m3) shares the same attribution logic.\n*/\nasync function raceAgainstAbort(work, signal, phase) {\n\tif (signal === void 0) return await work;\n\tconst sentinel = { reason: void 0 };\n\tlet onAbort;\n\tconst abortPromise = new Promise((_, reject) => {\n\t\tif (signal.aborted) {\n\t\t\tsentinel.reason = signal.reason;\n\t\t\treject(sentinel);\n\t\t\treturn;\n\t\t}\n\t\tonAbort = () => {\n\t\t\tsentinel.reason = signal.reason;\n\t\t\treject(sentinel);\n\t\t};\n\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t});\n\ttry {\n\t\treturn await Promise.race([work, abortPromise]);\n\t} catch (error) {\n\t\tif (error === sentinel) throw runtimeAborted(phase, sentinel.reason);\n\t\tthrow error;\n\t} finally {\n\t\tif (onAbort) signal.removeEventListener(\"abort\", onAbort);\n\t}\n}\n//#endregion\n//#region src/execution/before-execute-chain.ts\n/**\n* Runs every middleware's `beforeQuery` hook in registration order,\n* threading through the (optional) family-specific `paramsMutator`.\n*\n* Why this lives outside {@link runQueryWithMiddleware}: middleware that\n* mutates parameter values (e.g. cipherstash's bulk-encrypt SDK\n* round-trip) must run *before* the family runtime encodes those\n* parameters to driver wire format. Family runtimes call\n* `runBeforeQueryChain` between the AST → plan lowering step and\n* the parameter encode step; the encode then observes the mutator's\n* `currentParams()` view. `runQueryWithMiddleware` retains the rest of\n* the query lifecycle (`interceptQuery`, driver/row source loop, `onRow`,\n* `afterQuery`) but no longer fires `beforeQuery` itself.\n*\n* Lifecycle within this helper:\n*\n* 1. For each middleware in registration order, if `beforeQuery`\n* is implemented:\n* - `checkAborted(ctx, 'beforeQuery')` short-circuits if the\n* caller already aborted at entry.\n* - The hook is invoked with `(plan, ctx, paramsMutator)`. A\n* middleware body that ignores the mutator stays compatible —\n* JavaScript allows extra positional arguments.\n* - If the hook returns a Promise, it is raced against\n* `ctx.signal` via {@link raceAgainstAbort} so cooperative\n* cancellation surfaces a `RUNTIME.ABORTED { phase:\n* 'beforeQuery' }` envelope even when the body itself\n* ignores the signal.\n*\n* Error propagation: any error thrown by a `beforeQuery` body\n* (or surfaced by the abort race) propagates out of this helper\n* unchanged. Family runtime entry points await this helper before invoking\n* `runQueryWithMiddleware`, so a rejection prevents the runner and its\n* `afterQuery` hook from running.\n*\n* Relationship to {@link runQueryWithMiddleware}: the framework's\n* `RuntimeCore.query` template calls this helper between\n* `lower(plan)` and `runQueryWithMiddleware(...)`. Family runtimes that\n* override query preparation (e.g. SQL, which inlines lower + encode for\n* direct mutator threading) call this helper themselves at the\n* equivalent point — between the family's AST → draft-plan\n* lowering and the parameter-encode step.\n*\n* Intercept ordering: this helper fires unconditionally before\n* `runQueryWithMiddleware`. `interceptQuery` (inside\n* `runQueryWithMiddleware`) therefore observes the post-`beforeQuery`\n* plan — mutator mutations are visible in the params interceptors see.\n* The trade-off is documented on `RuntimeMiddleware.interceptQuery`.\n*/\nfunction runBeforeQueryChain(plan, middleware, ctx, paramsMutator) {\n\treturn runBeforeChain(plan, middleware, ctx, paramsMutator, \"beforeQuery\", (mw) => mw.beforeQuery);\n}\n/**\n* Runs every middleware's `beforeExecute` hook in registration order,\n* threading through the (optional) family-specific `paramsMutator`.\n*\n* Why this lives outside {@link runExecuteWithMiddleware}: middleware that\n* mutates parameter values (e.g. cipherstash's bulk-encrypt SDK\n* round-trip) must run *before* the family runtime encodes those\n* parameters to driver wire format. Family runtimes call\n* `runBeforeExecuteChain` between the AST → plan lowering step and\n* the parameter encode step; the encode then observes the mutator's\n* `currentParams()` view. `runExecuteWithMiddleware` retains the rest of\n* the execute lifecycle (`interceptExecute`, driver statistics execution,\n* `afterExecute`) but no longer fires `beforeExecute` itself.\n*\n* Lifecycle within this helper:\n*\n* 1. For each middleware in registration order, if `beforeExecute`\n* is implemented:\n* - `checkAborted(ctx, 'beforeExecute')` short-circuits if the\n* caller already aborted at entry.\n* - The hook is invoked with `(plan, ctx, paramsMutator)`. A\n* middleware body that ignores the mutator stays compatible —\n* JavaScript allows extra positional arguments.\n* - If the hook returns a Promise, it is raced against\n* `ctx.signal` via {@link raceAgainstAbort} so cooperative\n* cancellation surfaces a `RUNTIME.ABORTED { phase:\n* 'beforeExecute' }` envelope even when the body itself\n* ignores the signal.\n*\n* Error propagation: any error thrown by a `beforeExecute` body\n* (or surfaced by the abort race) propagates out of this helper\n* unchanged. Family runtime entry points await this helper before invoking\n* `runExecuteWithMiddleware`, so a rejection prevents the runner and its\n* `afterExecute` hook from running.\n*\n* Relationship to {@link runExecuteWithMiddleware}: the framework's\n* `RuntimeCore.execute` template calls this helper between\n* `lower(plan)` and `runExecuteWithMiddleware(...)`. Family runtimes that\n* override execute (e.g. SQL, which inlines lower + encode for\n* direct mutator threading) call this helper themselves at the\n* equivalent point — between the family's AST → draft-plan\n* lowering and the parameter-encode step.\n*\n* Intercept ordering: this helper fires unconditionally before\n* `runExecuteWithMiddleware`. `interceptExecute` (inside\n* `runExecuteWithMiddleware`) therefore observes the post-`beforeExecute`\n* plan — mutator mutations are visible in the params interceptors see.\n* The trade-off is documented on `RuntimeMiddleware.interceptExecute`.\n*/\nfunction runBeforeExecuteChain(plan, middleware, ctx, paramsMutator) {\n\treturn runBeforeChain(plan, middleware, ctx, paramsMutator, \"beforeExecute\", (mw) => mw.beforeExecute);\n}\nasync function runBeforeChain(plan, middleware, ctx, paramsMutator, phase, selectHook) {\n\tfor (const mw of middleware) {\n\t\tconst hook = selectHook(mw);\n\t\tif (hook === void 0) continue;\n\t\tcheckAborted(ctx, phase);\n\t\tconst work = hook(plan, ctx, paramsMutator);\n\t\tif (work !== void 0) await raceAgainstAbort(Promise.resolve(work), ctx.signal, phase);\n\t}\n}\n//#endregion\n//#region src/execution/run-with-middleware.ts\n/**\n* Drives a single query execution of `runDriver()` through the middleware\n* lifecycle's `interceptQuery` + row-source + termination phases.\n*\n* Lifecycle, in order:\n* 1. For each middleware in registration order: `interceptQuery(exec, ctx)`.\n* The first non-`undefined` result wins; subsequent middleware's\n* `interceptQuery` does not fire. On a hit, the runtime emits a\n* `middleware.interceptQuery` debug event naming the winning middleware,\n* switches the row source to the intercepted rows, and proceeds with\n* `source: 'middleware'`. On all-passthrough (every `interceptQuery`\n* returns `undefined` or is omitted), `source: 'driver'` is used and the\n* row source is `runDriver()`.\n* 2. Iterate the row source. On the driver path, for each row, for each\n* middleware in registration order: `onRow(row, exec, ctx)`; then yield\n* the row. On the intercepted hit path, `onRow` is skipped — intercepted\n* rows did not originate from a driver row stream — but rows are still\n* yielded to the consumer in order.\n* 3. On successful completion: for each middleware in registration order:\n* `afterQuery(exec, { rowCount, latencyMs, completed: true, source },\n* ctx)`.\n* 4. On any error thrown during steps 1–2: for each middleware in\n* registration order: `afterQuery(exec, { rowCount, latencyMs,\n* completed: false, source }, ctx)`. Errors thrown by `afterQuery`\n* during the error path are swallowed so they do not mask the original\n* error. The original error is then rethrown.\n*\n* `beforeQuery` is **not** fired here — see\n* {@link runBeforeQueryChain} in `before-execute-chain.ts`. Family runtimes\n* call that helper between the AST → plan lowering step and the parameter\n* encode step so middleware that mutates ParamRef values can have its\n* mutations visible to encode. `runQueryWithMiddleware` operates on the\n* fully-encoded plan; interceptors therefore observe a fully-mutated,\n* encoded plan.\n*\n* The `source` field on `AfterQueryResult` lets observers (telemetry, lints,\n* budgets) distinguish driver-served from middleware-served executions\n* without needing their own out-of-band signal.\n*\n* This helper is the single canonical implementation of the\n* intercept-and-row-source loop; family runtimes should not reimplement it.\n*/\nfunction runQueryWithMiddleware(exec, middleware, ctx, runDriver) {\n\tconst iterator = async function* () {\n\t\tconst startedAt = Date.now();\n\t\tlet rowCount = 0;\n\t\tlet completed = false;\n\t\tlet source = \"driver\";\n\t\tlet rowSource;\n\t\ttry {\n\t\t\tfor (const mw of middleware) {\n\t\t\t\tif (!mw.interceptQuery) continue;\n\t\t\t\tsource = \"middleware\";\n\t\t\t\tconst result = await mw.interceptQuery(exec, ctx);\n\t\t\t\tif (result === void 0) {\n\t\t\t\t\tsource = \"driver\";\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tctx.log.debug?.({\n\t\t\t\t\tevent: \"middleware.interceptQuery\",\n\t\t\t\t\tmiddleware: mw.name\n\t\t\t\t});\n\t\t\t\trowSource = blindCast(result.rows);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (source === \"driver\") rowSource = runDriver();\n\t\t\tfor await (const row of rowSource) {\n\t\t\t\tif (source === \"driver\") {\n\t\t\t\t\tfor (const mw of middleware) if (mw.onRow) await mw.onRow(row, exec, ctx);\n\t\t\t\t}\n\t\t\t\trowCount++;\n\t\t\t\tyield row;\n\t\t\t}\n\t\t\tcompleted = true;\n\t\t} catch (error) {\n\t\t\tawait notifyQueryCompletion(middleware, exec, ctx, {\n\t\t\t\trowCount,\n\t\t\t\tlatencyMs: Date.now() - startedAt,\n\t\t\t\tcompleted,\n\t\t\t\tsource\n\t\t\t}, true);\n\t\t\tthrow error;\n\t\t}\n\t\tawait notifyQueryCompletion(middleware, exec, ctx, {\n\t\t\trowCount,\n\t\t\tlatencyMs: Date.now() - startedAt,\n\t\t\tcompleted,\n\t\t\tsource\n\t\t}, false);\n\t};\n\treturn new AsyncIterableResult(iterator());\n}\n/**\n* Drives a single execute operation through the middleware\n* `interceptExecute` + statistics + termination phases.\n*\n* Lifecycle, in order:\n* 1. For each middleware in registration order: `interceptExecute(exec, ctx)`.\n* The first non-`undefined` result wins; subsequent middleware's\n* `interceptExecute` does not fire. On a hit, the runtime emits a\n* `middleware.interceptExecute` debug event naming the winning middleware,\n* uses the returned `stats`, and proceeds with `source: 'middleware'`.\n* On all-passthrough (every `interceptExecute` returns `undefined` or is\n* omitted), `source: 'driver'` is used and `runDriver()` supplies the\n* statistics.\n* 2. Execute operations return eager statistics. There is no row stream and\n* `onRow` does not fire.\n* 3. On successful completion: for each middleware in registration order:\n* `afterExecute(exec, { stats, latencyMs, completed: true, source }, ctx)`.\n* 4. On any error thrown during steps 1–2: for each middleware in\n* registration order: `afterExecute(exec, { latencyMs, completed: false,\n* source }, ctx)`. Errors thrown by `afterExecute` during the error path\n* are swallowed so they do not mask the original error. The original\n* error is then rethrown.\n*\n* `beforeExecute` is **not** fired here — see\n* {@link runBeforeExecuteChain} in `before-execute-chain.ts`. Family runtimes\n* call that helper between the AST → plan lowering step and the parameter\n* encode step so middleware that mutates ParamRef values can have its\n* mutations visible to encode. `runExecuteWithMiddleware` operates on the\n* fully-encoded plan; interceptors therefore observe a fully-mutated,\n* encoded plan.\n*\n* The `source` field on `AfterExecuteResult` lets observers (telemetry, lints,\n* budgets) distinguish driver-served from middleware-served executions\n* without needing their own out-of-band signal.\n*/\nasync function runExecuteWithMiddleware(exec, middleware, ctx, runDriver) {\n\tconst startedAt = Date.now();\n\tlet source = \"driver\";\n\tlet stats;\n\ttry {\n\t\tfor (const mw of middleware) {\n\t\t\tif (!mw.interceptExecute) continue;\n\t\t\tsource = \"middleware\";\n\t\t\tconst result = await mw.interceptExecute(exec, ctx);\n\t\t\tif (result === void 0) {\n\t\t\t\tsource = \"driver\";\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tctx.log.debug?.({\n\t\t\t\tevent: \"middleware.interceptExecute\",\n\t\t\t\tmiddleware: mw.name\n\t\t\t});\n\t\t\tstats = result.stats;\n\t\t\tbreak;\n\t\t}\n\t\tif (stats === void 0) stats = await runDriver();\n\t} catch (error) {\n\t\tconst latencyMs = Date.now() - startedAt;\n\t\tfor (const mw of middleware) {\n\t\t\tif (!mw.afterExecute) continue;\n\t\t\ttry {\n\t\t\t\tawait mw.afterExecute(exec, {\n\t\t\t\t\tlatencyMs,\n\t\t\t\t\tcompleted: false,\n\t\t\t\t\tsource\n\t\t\t\t}, ctx);\n\t\t\t} catch {}\n\t\t}\n\t\tthrow error;\n\t}\n\tconst latencyMs = Date.now() - startedAt;\n\tfor (const mw of middleware) if (mw.afterExecute) await mw.afterExecute(exec, {\n\t\tstats,\n\t\tlatencyMs,\n\t\tcompleted: true,\n\t\tsource\n\t}, ctx);\n\treturn stats;\n}\nasync function notifyQueryCompletion(middleware, exec, ctx, result, swallowErrors) {\n\tfor (const mw of middleware) {\n\t\tif (!mw.afterQuery) continue;\n\t\tif (swallowErrors) try {\n\t\t\tawait mw.afterQuery(exec, result, ctx);\n\t\t} catch {}\n\t\telse await mw.afterQuery(exec, result, ctx);\n\t}\n}\n//#endregion\n//#region src/execution/runtime-core.ts\n/**\n* Family-agnostic abstract runtime base.\n*\n* Defines the shared operation-specific middleware lifecycles:\n*\n* 1. `runBeforeCompile(plan)` — concrete; defaults to identity. SQL overrides\n* this to run its shared `beforeCompile` middleware-hook chain.\n* 2. `lower(plan)` — abstract. Each family produces its `*ExecutionPlan`\n* (SQL via `lowerSqlPlan`, Mongo via `adapter.lower`).\n* 3. Queries run `beforeQuery`; statements run `beforeExecute`. Both chains\n* run after lowering and before their matching driver terminal. Family\n* runtimes that expose a params mutator to downstream encoding override\n* the operation and call the matching helper at the pre-encode point.\n* 4. The matching runner processes `interceptQuery` or `interceptExecute`\n* before invoking the driver. Queries then fire `onRow` and `afterQuery`;\n* statements fire `afterExecute`.\n*\n* Concrete subclasses must implement `lower`, `runDriver`, `runExecute`, and\n* `close`.\n*\n* The class is generic over:\n* - `TPlan` — the family's pre-lowering plan type.\n* - `TExec` — the family's post-lowering (executable) plan type.\n* - `TMiddleware` — the family's middleware type. Constrained to\n* `RuntimeMiddleware<TExec>` because the operation-specific runners invoke\n* hooks with the lowered `TExec`. Middleware therefore sees the\n* post-lowering plan.\n*/\nvar RuntimeCore = class {\n\tmiddleware;\n\tctx;\n\tconstructor(options) {\n\t\tthis.middleware = options.middleware;\n\t\tthis.ctx = options.ctx;\n\t}\n\t/**\n\t* Pre-lowering hook for plan rewriting. Defaults to identity. Subclasses\n\t* may override to run a `beforeCompile` middleware chain (SQL does this\n\t* to support typed AST rewrites — see `before-compile-chain.ts`).\n\t*/\n\trunBeforeCompile(plan) {\n\t\treturn plan;\n\t}\n\tquery(plan, options) {\n\t\tconst self = this;\n\t\tconst signal = options?.signal;\n\t\tconst codecCtx = signal === void 0 ? {} : { signal };\n\t\tconst execCtx = {\n\t\t\t...self.ctx,\n\t\t\t...codecCtx,\n\t\t\tscope: options?.scope ?? self.ctx.scope,\n\t\t\tplanExecutionId: crypto.randomUUID()\n\t\t};\n\t\tasync function* generator() {\n\t\t\tcheckAborted(codecCtx, \"stream\");\n\t\t\tconst compiled = await self.runBeforeCompile(plan);\n\t\t\tconst exec = await self.lower(compiled, codecCtx);\n\t\t\tawait runBeforeQueryChain(exec, self.middleware, execCtx);\n\t\t\tyield* runQueryWithMiddleware(exec, self.middleware, execCtx, () => self.runDriver(exec));\n\t\t}\n\t\treturn new AsyncIterableResult(generator());\n\t}\n\tasync execute(plan, options) {\n\t\tconst signal = options?.signal;\n\t\tconst codecCtx = signal === void 0 ? {} : { signal };\n\t\tconst execCtx = {\n\t\t\t...this.ctx,\n\t\t\t...codecCtx,\n\t\t\tscope: options?.scope ?? this.ctx.scope,\n\t\t\tplanExecutionId: crypto.randomUUID()\n\t\t};\n\t\tcheckAborted(codecCtx, \"stream\");\n\t\tconst compiled = await this.runBeforeCompile(plan);\n\t\tconst exec = await this.lower(compiled, codecCtx);\n\t\tawait runBeforeExecuteChain(exec, this.middleware, execCtx);\n\t\treturn runExecuteWithMiddleware(exec, this.middleware, execCtx, () => this.runExecute(exec));\n\t}\n};\n//#endregion\n//#region src/execution/runtime-middleware.ts\nfunction checkMiddlewareCompatibility(middleware, runtimeFamilyId, runtimeTargetId) {\n\tif (middleware.targetId !== void 0 && middleware.familyId === void 0) throw runtimeError(\"RUNTIME.MIDDLEWARE_INCOMPATIBLE\", `Middleware '${middleware.name}' specifies targetId '${middleware.targetId}' without familyId`, {\n\t\tmiddleware: middleware.name,\n\t\ttargetId: middleware.targetId\n\t});\n\tif (middleware.familyId !== void 0 && middleware.familyId !== runtimeFamilyId) throw runtimeError(\"RUNTIME.MIDDLEWARE_FAMILY_MISMATCH\", `Middleware '${middleware.name}' requires family '${middleware.familyId}' but the runtime is configured for family '${runtimeFamilyId}'`, {\n\t\tmiddleware: middleware.name,\n\t\tmiddlewareFamilyId: middleware.familyId,\n\t\truntimeFamilyId\n\t});\n\tif (middleware.targetId !== void 0 && middleware.targetId !== runtimeTargetId) throw runtimeError(\"RUNTIME.MIDDLEWARE_TARGET_MISMATCH\", `Middleware '${middleware.name}' requires target '${middleware.targetId}' but the runtime is configured for target '${runtimeTargetId}'`, {\n\t\tmiddleware: middleware.name,\n\t\tmiddlewareTargetId: middleware.targetId,\n\t\truntimeTargetId\n\t});\n}\n//#endregion\n//#region src/execution/shape.ts\n/**\n* Phantom key an emitted model type carries to name its relation properties.\n* Never present at runtime; `Scalars` and `Shape` read it to tell relations from fields.\n*/\nconst RelationKeys = Symbol(\"RelationKeys\");\n//#endregion\n//#region src/meta-builder.ts\nvar MetaBuilderImpl = class {\n\t#kind;\n\t#terminalName;\n\t#annotations = /* @__PURE__ */ new Map();\n\tconstructor(kind, terminalName) {\n\t\tthis.#kind = kind;\n\t\tthis.#terminalName = terminalName;\n\t}\n\tget annotations() {\n\t\treturn this.#annotations;\n\t}\n\tannotate(annotation) {\n\t\tconst value = annotation;\n\t\tassertAnnotationsApplicable([value], this.#kind, this.#terminalName);\n\t\tthis.#annotations.set(value.namespace, value);\n\t\treturn this;\n\t}\n};\n/**\n* Construct a lane-side meta builder for a terminal of operation kind `K`.\n*\n* Lane terminals call this with their `kind` (`'read'` or `'write'`) and a\n* `terminalName` for error messages, hand the resulting builder to the\n* user-supplied configurator callback (typed as `MetaBuilder<K>`, the\n* narrower public view), and read `meta.annotations` afterwards to thread\n* the recorded values into `plan.meta.annotations`.\n*/\nfunction createMetaBuilder(kind, terminalName) {\n\treturn new MetaBuilderImpl(kind, terminalName);\n}\n//#endregion\nexport { AsyncIterableResult, RUNTIME_ABORTED, RelationKeys, RuntimeCore, assertAnnotationsApplicable, checkAborted, checkMiddlewareCompatibility, createMetaBuilder, defineAnnotation, isRuntimeError, raceAgainstAbort, runBeforeExecuteChain, runBeforeQueryChain, runExecuteWithMiddleware, runQueryWithMiddleware, runtimeAborted, runtimeError };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAM,kBAAkB;;;;;;;;;;AAUxB,SAAS,eAAe,OAAO,OAAO;CACrC,MAAM,WAAW,aAAa,iBAAiB,4BAA4B,SAAS,EAAE,MAAM,CAAC;CAC7F,OAAO,OAAO,OAAO,UAAU,EAAE,MAAM,CAAC;AACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAS,mBAAmB;CAC3B,QAAQ,YAAY;EACnB,MAAM,YAAY,QAAQ;EAC1B,MAAM,eAAe,OAAO,OAAO,IAAI,IAAI,QAAQ,YAAY,CAAC;EAChE,SAAS,OAAO,OAAO;GACtB,OAAO,OAAO,OAAO;IACpB,cAAc;IACd;IACA;IACA;GACD,CAAC;EACF;EACA,SAAS,KAAK,MAAM;GACnB,MAAM,SAAS,KAAK,KAAK,cAAc;GACvC,IAAI,CAAC,kBAAkB,MAAM,GAAG;GAChC,IAAI,OAAO,cAAc,WAAW;GACpC,OAAO,OAAO;EACf;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,cAAc;CAC9C,OAAO,IAAI,gBAAgB,MAAM,YAAY;AAC9C"}
|
|
@@ -25,12 +25,12 @@ function structuredError(code, message, options) {
|
|
|
25
25
|
...ifDefined("docsUrl", options?.docsUrl)
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
const DOCS_ERRORS_VERSION = "
|
|
29
|
-
const DOCS_BASE = `https://docs.prisma.io/docs/orm
|
|
28
|
+
const DOCS_ERRORS_VERSION = "v8";
|
|
29
|
+
const DOCS_BASE = `https://docs.prisma.io/docs/orm/v8/reference/error-reference`;
|
|
30
30
|
function docsUrlFor(code) {
|
|
31
31
|
return `${DOCS_BASE}#${code}`;
|
|
32
32
|
}
|
|
33
33
|
//#endregion
|
|
34
34
|
export { isStructuredErrorCode as a, isStructuredError as i, DOCS_ERRORS_VERSION as n, structuredError as o, docsUrlFor as r, DOCS_BASE as t };
|
|
35
35
|
|
|
36
|
-
//# sourceMappingURL=structured-error-
|
|
36
|
+
//# sourceMappingURL=structured-error-BXbihKQ-.mjs.map
|