@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-parser.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { t as blindCast } from "./casts-DpaahrlC-Bd5n2coI.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { t as InternalError } from "./internal-error-ChGYPVpq-DhUD05u0.mjs";
|
|
3
|
+
import { n as ok, t as notOk } from "./result-C0NUq1Ok.mjs";
|
|
4
|
+
import { h as isAuthoringPslBlockDescriptor, m as isAuthoringModelAttributeDescriptor } from "./framework-authoring-BvxZnsPY-DlD1nwU5.mjs";
|
|
4
5
|
import { a as makePslNamespace, c as validateExtensionBlock, i as flatPslModels, n as UNSPECIFIED_PSL_NAMESPACE_ID, o as makePslNamespaceEntries, s as namespacePslExtensionBlocks } from "./psl-ast-DUCvVXbB.mjs";
|
|
5
6
|
import { E as TypesBlockAst, N as printSyntax, _ as NumberLiteralExprAst, a as CompositeTypeDeclarationAst, d as IdentifierAst, g as NamespaceDeclarationAst, i as BooleanLiteralExprAst, l as FunctionCallAst, m as ModelDeclarationAst, t as ArrayLiteralAst, u as GenericBlockDeclarationAst, x as StringLiteralExprAst, y as ObjectLiteralExprAst } from "./declarations-DR6To8_k-BFwkCGeP.mjs";
|
|
6
7
|
//#region ../../../1-framework/2-authoring/psl-parser/dist/index.mjs
|
|
@@ -12,6 +13,37 @@ function parseQuotedStringLiteral(value) {
|
|
|
12
13
|
if (!match) return void 0;
|
|
13
14
|
return match[2] ?? "";
|
|
14
15
|
}
|
|
16
|
+
function* modelAttributeDescriptors(namespace) {
|
|
17
|
+
for (const value of Object.values(namespace)) {
|
|
18
|
+
if (isAuthoringModelAttributeDescriptor(value)) {
|
|
19
|
+
yield value;
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
yield* modelAttributeDescriptors(value);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function assembleAttributeSpecs(contributions) {
|
|
26
|
+
const entries = Object.entries(contributions.attributeSpecs.model);
|
|
27
|
+
const claimed = new Set(entries.map(([attribute]) => attribute));
|
|
28
|
+
for (const descriptor of modelAttributeDescriptors(contributions.modelAttributes)) {
|
|
29
|
+
if (claimed.has(descriptor.attribute)) throw new InternalError(`Duplicate attribute spec registration for "${descriptor.attribute}". Each model attribute name may be registered once across family built-ins and model-attribute descriptors.`);
|
|
30
|
+
claimed.add(descriptor.attribute);
|
|
31
|
+
entries.push([descriptor.attribute, descriptor.spec]);
|
|
32
|
+
}
|
|
33
|
+
return Object.freeze(blindCast({
|
|
34
|
+
model: Object.freeze(Object.fromEntries(entries)),
|
|
35
|
+
field: Object.freeze({ ...contributions.attributeSpecs.field })
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
function blockAttribute(name, config) {
|
|
39
|
+
return {
|
|
40
|
+
level: "block",
|
|
41
|
+
name,
|
|
42
|
+
positional: config.positional ?? [],
|
|
43
|
+
named: config.named ?? {},
|
|
44
|
+
...config.refine !== void 0 ? { refine: config.refine } : {}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
15
47
|
function readResolvedAttribute(attribute, sourceFile) {
|
|
16
48
|
return {
|
|
17
49
|
name: attributeName(attribute.name()),
|
|
@@ -99,8 +131,9 @@ function bool() {
|
|
|
99
131
|
kind: "bool",
|
|
100
132
|
label: "boolean",
|
|
101
133
|
parse: (arg, ctx) => {
|
|
102
|
-
|
|
103
|
-
|
|
134
|
+
const literal = BooleanLiteralExprAst.cast(arg.syntax);
|
|
135
|
+
if (literal !== void 0) {
|
|
136
|
+
const value = literal.value();
|
|
104
137
|
if (value !== void 0) return ok(value);
|
|
105
138
|
}
|
|
106
139
|
return notOk([leafDiagnostic(ctx, arg, "Expected a boolean literal")]);
|
|
@@ -112,26 +145,34 @@ function entityRef() {
|
|
|
112
145
|
kind: "entityRef",
|
|
113
146
|
label: "model name",
|
|
114
147
|
parse: (arg, ctx) => {
|
|
115
|
-
|
|
116
|
-
|
|
148
|
+
const identifier = IdentifierAst.cast(arg.syntax);
|
|
149
|
+
if (identifier === void 0) return notOk([leafDiagnostic(ctx, arg, "Expected a model name")]);
|
|
150
|
+
const name = identifier.name();
|
|
117
151
|
if (name === void 0) return notOk([leafDiagnostic(ctx, arg, "Expected a model name")]);
|
|
118
152
|
return ok(name);
|
|
119
153
|
}
|
|
120
154
|
};
|
|
121
155
|
}
|
|
122
|
-
function
|
|
156
|
+
function parseFieldName(arg, ctx, model) {
|
|
157
|
+
const identifier = IdentifierAst.cast(arg.syntax);
|
|
158
|
+
if (identifier === void 0) return notOk([leafDiagnostic(ctx, arg, "Expected a field name")]);
|
|
159
|
+
const name = identifier.name();
|
|
160
|
+
if (name === void 0) return notOk([leafDiagnostic(ctx, arg, "Expected a field name")]);
|
|
161
|
+
if (model !== void 0 && !Object.hasOwn(model.fields, name)) return notOk([leafDiagnostic(ctx, arg, `Field "${name}" does not exist on model "${model.name}"`)]);
|
|
162
|
+
return ok(name);
|
|
163
|
+
}
|
|
164
|
+
function fieldRef() {
|
|
123
165
|
return {
|
|
124
166
|
kind: "fieldRef",
|
|
125
167
|
label: "field name",
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
168
|
+
parse: (arg, ctx) => parseFieldName(arg, ctx, ctx.selfModel)
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function referencedFieldRef() {
|
|
172
|
+
return {
|
|
173
|
+
kind: "referencedFieldRef",
|
|
174
|
+
label: "field name",
|
|
175
|
+
parse: (arg, ctx) => parseFieldName(arg, ctx, ctx.resolveReferencedModel())
|
|
135
176
|
};
|
|
136
177
|
}
|
|
137
178
|
function interpretArgs(args, spec, ctx, span) {
|
|
@@ -229,7 +270,9 @@ function diagnostic(message, ctx, span) {
|
|
|
229
270
|
function funcCall(name, sig) {
|
|
230
271
|
return {
|
|
231
272
|
kind: "funcCall",
|
|
232
|
-
label:
|
|
273
|
+
label: `${name}()`,
|
|
274
|
+
name,
|
|
275
|
+
signature: sig,
|
|
233
276
|
parse: (arg, ctx) => {
|
|
234
277
|
const guard = matchCallee(arg, name, ctx);
|
|
235
278
|
if (!guard.ok) return guard;
|
|
@@ -249,20 +292,23 @@ function funcCall(name, sig) {
|
|
|
249
292
|
};
|
|
250
293
|
}
|
|
251
294
|
function matchCallee(arg, name, ctx) {
|
|
252
|
-
|
|
253
|
-
|
|
295
|
+
const call = FunctionCallAst.cast(arg.syntax);
|
|
296
|
+
if (call === void 0) return notOk([leafDiagnostic(ctx, arg, "Expected a function call")]);
|
|
297
|
+
const qname = call.name();
|
|
254
298
|
if (qname === void 0 || qname.dot() !== void 0 || qname.colon() !== void 0) return notOk([leafDiagnostic(ctx, arg, "Expected a function call")]);
|
|
255
299
|
const calleeName = qname.identifier()?.token()?.text;
|
|
256
300
|
if (calleeName === void 0) return notOk([leafDiagnostic(ctx, arg, "Expected a function call")]);
|
|
257
301
|
if (calleeName !== name) return notOk([leafDiagnostic(ctx, arg, `Expected ${name}()`)]);
|
|
258
|
-
return ok(
|
|
302
|
+
return ok(call);
|
|
259
303
|
}
|
|
260
304
|
function identifier(name) {
|
|
261
305
|
return {
|
|
262
306
|
kind: "identifier",
|
|
263
307
|
label: name,
|
|
308
|
+
name,
|
|
264
309
|
parse: (arg, ctx) => {
|
|
265
|
-
|
|
310
|
+
const identifier = IdentifierAst.cast(arg.syntax);
|
|
311
|
+
if (identifier !== void 0 && identifier.name() === name) return ok(name);
|
|
266
312
|
return notOk([leafDiagnostic(ctx, arg, `Expected ${name}`)]);
|
|
267
313
|
}
|
|
268
314
|
};
|
|
@@ -273,9 +319,12 @@ function int(opts) {
|
|
|
273
319
|
return {
|
|
274
320
|
kind: "int",
|
|
275
321
|
label: "integer",
|
|
322
|
+
...min === void 0 ? {} : { min },
|
|
323
|
+
...max === void 0 ? {} : { max },
|
|
276
324
|
parse: (arg, ctx) => {
|
|
277
|
-
|
|
278
|
-
|
|
325
|
+
const literal = NumberLiteralExprAst.cast(arg.syntax);
|
|
326
|
+
if (literal !== void 0) {
|
|
327
|
+
const value = literal.value();
|
|
279
328
|
if (value !== void 0 && Number.isInteger(value)) {
|
|
280
329
|
if ((min === void 0 || value >= min) && (max === void 0 || value <= max)) return ok(value);
|
|
281
330
|
return notOk([leafDiagnostic(ctx, arg, rangeMessage(min, max))]);
|
|
@@ -290,16 +339,43 @@ function rangeMessage(min, max) {
|
|
|
290
339
|
if (min !== void 0) return `Expected an integer greater than or equal to ${min}`;
|
|
291
340
|
return `Expected an integer less than or equal to ${max}`;
|
|
292
341
|
}
|
|
342
|
+
/**
|
|
343
|
+
* Reads an opaque JSON object from a quoted JSON string — the ADR's one text-encoded surface
|
|
344
|
+
* exception (e.g. an index `filter` / `weights` argument). The string is decoded by the parser,
|
|
345
|
+
* then JSON-parsed; a non-object (array/scalar) or invalid JSON is a diagnostic.
|
|
346
|
+
*/
|
|
347
|
+
function json() {
|
|
348
|
+
return {
|
|
349
|
+
kind: "json",
|
|
350
|
+
label: "JSON object",
|
|
351
|
+
parse: (arg, ctx) => {
|
|
352
|
+
const literal = StringLiteralExprAst.cast(arg.syntax);
|
|
353
|
+
if (literal === void 0) return notOk([leafDiagnostic(ctx, arg, "Expected a JSON object string")]);
|
|
354
|
+
const raw = literal.value();
|
|
355
|
+
if (raw !== void 0) try {
|
|
356
|
+
const parsed = JSON.parse(raw);
|
|
357
|
+
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) return ok(blindCast(parsed));
|
|
358
|
+
} catch {}
|
|
359
|
+
return notOk([leafDiagnostic(ctx, arg, "Expected a valid JSON object")]);
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
}
|
|
293
363
|
function list(of, opts) {
|
|
364
|
+
const allowEmpty = opts?.allowEmpty ?? true;
|
|
365
|
+
const unique = opts?.unique ?? false;
|
|
294
366
|
return {
|
|
295
367
|
kind: "list",
|
|
296
368
|
label: `${of.label}[]`,
|
|
369
|
+
of,
|
|
370
|
+
allowEmpty,
|
|
371
|
+
unique,
|
|
297
372
|
parse: (arg, ctx) => {
|
|
298
|
-
|
|
373
|
+
const literal = ArrayLiteralAst.cast(arg.syntax);
|
|
374
|
+
if (literal === void 0) return notOk([leafDiagnostic(ctx, arg, `Expected a list of ${of.label}`)]);
|
|
299
375
|
const diagnostics = [];
|
|
300
376
|
const parsed = [];
|
|
301
377
|
let count = 0;
|
|
302
|
-
for (const element of
|
|
378
|
+
for (const element of literal.elements()) {
|
|
303
379
|
count += 1;
|
|
304
380
|
const result = of.parse(element, ctx);
|
|
305
381
|
if (result.ok) parsed.push({
|
|
@@ -308,8 +384,8 @@ function list(of, opts) {
|
|
|
308
384
|
});
|
|
309
385
|
else diagnostics.push(...result.failure);
|
|
310
386
|
}
|
|
311
|
-
if (
|
|
312
|
-
if (
|
|
387
|
+
if (!allowEmpty && count === 0) diagnostics.push(leafDiagnostic(ctx, arg, "Expected a non-empty list"));
|
|
388
|
+
if (unique) {
|
|
313
389
|
const seen = /* @__PURE__ */ new Set();
|
|
314
390
|
for (const { node, value } of parsed) if (seen.has(value)) diagnostics.push(leafDiagnostic(ctx, node, "Duplicate list entry"));
|
|
315
391
|
else seen.add(value);
|
|
@@ -320,15 +396,29 @@ function list(of, opts) {
|
|
|
320
396
|
};
|
|
321
397
|
}
|
|
322
398
|
function num(value) {
|
|
399
|
+
if (value === void 0) return {
|
|
400
|
+
kind: "num",
|
|
401
|
+
label: "number",
|
|
402
|
+
value: void 0,
|
|
403
|
+
parse: (arg, ctx) => {
|
|
404
|
+
const literal = NumberLiteralExprAst.cast(arg.syntax);
|
|
405
|
+
if (literal !== void 0) {
|
|
406
|
+
const parsed = literal.value();
|
|
407
|
+
if (parsed !== void 0) return ok(parsed);
|
|
408
|
+
}
|
|
409
|
+
return notOk([leafDiagnostic(ctx, arg, "Expected a number literal")]);
|
|
410
|
+
}
|
|
411
|
+
};
|
|
323
412
|
return {
|
|
324
413
|
kind: "num",
|
|
325
|
-
label:
|
|
414
|
+
label: String(value),
|
|
415
|
+
value,
|
|
326
416
|
parse: (arg, ctx) => {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
if (
|
|
417
|
+
const literal = NumberLiteralExprAst.cast(arg.syntax);
|
|
418
|
+
if (literal !== void 0) {
|
|
419
|
+
if (literal.value() === value) return ok(value);
|
|
330
420
|
}
|
|
331
|
-
return notOk([leafDiagnostic(ctx, arg,
|
|
421
|
+
return notOk([leafDiagnostic(ctx, arg, `Expected ${value}`)]);
|
|
332
422
|
}
|
|
333
423
|
};
|
|
334
424
|
}
|
|
@@ -337,9 +427,10 @@ function oneOf(...alts) {
|
|
|
337
427
|
return {
|
|
338
428
|
kind: "oneOf",
|
|
339
429
|
label,
|
|
430
|
+
alternatives: alts,
|
|
340
431
|
parse: (arg, ctx) => {
|
|
341
432
|
for (const alt of alts) {
|
|
342
|
-
const result = alt.parse(arg, ctx);
|
|
433
|
+
const result = blindCast(alt.parse)(arg, ctx);
|
|
343
434
|
if (result.ok) return ok(blindCast(result.value));
|
|
344
435
|
}
|
|
345
436
|
return notOk([leafDiagnostic(ctx, arg, `Expected one of: ${label}`)]);
|
|
@@ -350,11 +441,14 @@ function record(of) {
|
|
|
350
441
|
return {
|
|
351
442
|
kind: "record",
|
|
352
443
|
label: `{ [key]: ${of.label} }`,
|
|
444
|
+
of,
|
|
353
445
|
parse: (arg, ctx) => {
|
|
354
|
-
|
|
446
|
+
const literal = ObjectLiteralExprAst.cast(arg.syntax);
|
|
447
|
+
if (literal === void 0) return notOk([leafDiagnostic(ctx, arg, "Expected an object literal")]);
|
|
355
448
|
const diagnostics = [];
|
|
356
|
-
const
|
|
357
|
-
|
|
449
|
+
const entries = [];
|
|
450
|
+
const keys = /* @__PURE__ */ new Set();
|
|
451
|
+
for (const field of Array.from(literal.fields())) {
|
|
358
452
|
const key = field.keyName();
|
|
359
453
|
if (key === void 0) {
|
|
360
454
|
diagnostics.push(leafDiagnostic(ctx, field, "Expected a key"));
|
|
@@ -370,29 +464,44 @@ function record(of) {
|
|
|
370
464
|
diagnostics.push(...parsed.failure);
|
|
371
465
|
continue;
|
|
372
466
|
}
|
|
373
|
-
if (
|
|
467
|
+
if (keys.has(key)) {
|
|
374
468
|
diagnostics.push(leafDiagnostic(ctx, field, `Duplicate key "${key}"`));
|
|
375
469
|
continue;
|
|
376
470
|
}
|
|
377
|
-
|
|
471
|
+
keys.add(key);
|
|
472
|
+
entries.push([key, parsed.value]);
|
|
378
473
|
}
|
|
379
474
|
if (diagnostics.length > 0) return notOk(diagnostics);
|
|
380
|
-
return ok(
|
|
475
|
+
return ok(Object.fromEntries(entries));
|
|
381
476
|
}
|
|
382
477
|
};
|
|
383
478
|
}
|
|
384
|
-
function str() {
|
|
385
|
-
return {
|
|
479
|
+
function str(value) {
|
|
480
|
+
if (value === void 0) return {
|
|
386
481
|
kind: "str",
|
|
387
482
|
label: "string",
|
|
483
|
+
value: void 0,
|
|
388
484
|
parse: (arg, ctx) => {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
485
|
+
const literal = StringLiteralExprAst.cast(arg.syntax);
|
|
486
|
+
if (literal !== void 0) {
|
|
487
|
+
const parsed = literal.value();
|
|
488
|
+
if (parsed !== void 0) return ok(parsed);
|
|
392
489
|
}
|
|
393
490
|
return notOk([leafDiagnostic(ctx, arg, "Expected a string literal")]);
|
|
394
491
|
}
|
|
395
492
|
};
|
|
493
|
+
return {
|
|
494
|
+
kind: "str",
|
|
495
|
+
label: JSON.stringify(value),
|
|
496
|
+
value,
|
|
497
|
+
parse: (arg, ctx) => {
|
|
498
|
+
const literal = StringLiteralExprAst.cast(arg.syntax);
|
|
499
|
+
if (literal !== void 0) {
|
|
500
|
+
if (literal.value() === value) return ok(value);
|
|
501
|
+
}
|
|
502
|
+
return notOk([leafDiagnostic(ctx, arg, `Expected ${JSON.stringify(value)}`)]);
|
|
503
|
+
}
|
|
504
|
+
};
|
|
396
505
|
}
|
|
397
506
|
function fieldAttribute(name, config) {
|
|
398
507
|
return {
|
|
@@ -480,6 +589,7 @@ function findOwnerNamespaceName(symbolTable, block) {
|
|
|
480
589
|
for (const namespace of Object.values(symbolTable.topLevel.namespaces)) if (Object.values(namespace.blocks).some((candidate) => candidate === block)) return namespace.name;
|
|
481
590
|
return UNSPECIFIED_PSL_NAMESPACE_ID;
|
|
482
591
|
}
|
|
592
|
+
const BLOCK_ATTRIBUTE_SOURCE_ID = "unknown";
|
|
483
593
|
/**
|
|
484
594
|
* Descriptor-free and unknown parameters become `value` stubs so validation can
|
|
485
595
|
* report them via key-set comparison. Duplicate member names are first-wins.
|
|
@@ -488,6 +598,8 @@ function reconstructExtensionBlock(node, descriptor, sourceFile, diagnostics) {
|
|
|
488
598
|
const keyword = node.keyword()?.text ?? "";
|
|
489
599
|
const blockName = node.name()?.name() ?? "";
|
|
490
600
|
const blockAttributes = [];
|
|
601
|
+
const attributes = {};
|
|
602
|
+
const seenAttributeNames = /* @__PURE__ */ new Set();
|
|
491
603
|
for (const attribute of node.attributes()) {
|
|
492
604
|
const name = attribute.name()?.path().join(".") ?? "";
|
|
493
605
|
const args = Array.from(attribute.argList()?.args() ?? [], (arg) => {
|
|
@@ -498,11 +610,16 @@ function reconstructExtensionBlock(node, descriptor, sourceFile, diagnostics) {
|
|
|
498
610
|
span: nodePslSpan(arg.syntax, sourceFile)
|
|
499
611
|
};
|
|
500
612
|
});
|
|
613
|
+
const span = nodePslSpan(attribute.syntax, sourceFile);
|
|
501
614
|
blockAttributes.push({
|
|
502
615
|
name,
|
|
503
616
|
args,
|
|
504
|
-
span
|
|
617
|
+
span
|
|
505
618
|
});
|
|
619
|
+
if (descriptor === void 0) continue;
|
|
620
|
+
const parsed = parseBlockAttribute(attribute, name, span, descriptor, seenAttributeNames, keyword, blockName, sourceFile);
|
|
621
|
+
if (parsed.ok) attributes[name] = parsed.value;
|
|
622
|
+
else diagnostics.push(...parsed.diagnostics);
|
|
506
623
|
}
|
|
507
624
|
const parameters = {};
|
|
508
625
|
for (const entry of node.entries()) {
|
|
@@ -528,9 +645,59 @@ function reconstructExtensionBlock(node, descriptor, sourceFile, diagnostics) {
|
|
|
528
645
|
name: blockName,
|
|
529
646
|
parameters,
|
|
530
647
|
blockAttributes,
|
|
648
|
+
attributes,
|
|
531
649
|
span: nodePslSpan(node.syntax, sourceFile)
|
|
532
650
|
};
|
|
533
651
|
}
|
|
652
|
+
function parseBlockAttribute(attribute, name, span, descriptor, seenNames, keyword, blockName, sourceFile) {
|
|
653
|
+
const range = pslSpanToRange(span, sourceFile);
|
|
654
|
+
const declared = descriptor.attributes ?? {};
|
|
655
|
+
if (!Object.hasOwn(declared, name)) return {
|
|
656
|
+
ok: false,
|
|
657
|
+
diagnostics: [{
|
|
658
|
+
code: "PSL_EXTENSION_UNKNOWN_BLOCK_ATTRIBUTE",
|
|
659
|
+
message: `Unknown attribute "@@${name}" in "${keyword}" block "${blockName}"`,
|
|
660
|
+
range
|
|
661
|
+
}]
|
|
662
|
+
};
|
|
663
|
+
if (seenNames.has(name)) return {
|
|
664
|
+
ok: false,
|
|
665
|
+
diagnostics: [{
|
|
666
|
+
code: "PSL_INVALID_EXTENSION_BLOCK_ATTRIBUTE",
|
|
667
|
+
message: `Duplicate attribute "@@${name}" in "${keyword}" block "${blockName}"; first occurrence wins`,
|
|
668
|
+
range
|
|
669
|
+
}]
|
|
670
|
+
};
|
|
671
|
+
seenNames.add(name);
|
|
672
|
+
const result = interpretAttribute(attribute, blindCast(declared[name])(), {
|
|
673
|
+
sourceId: BLOCK_ATTRIBUTE_SOURCE_ID,
|
|
674
|
+
sourceFile
|
|
675
|
+
});
|
|
676
|
+
if (!result.ok) return {
|
|
677
|
+
ok: false,
|
|
678
|
+
diagnostics: result.failure.map((diagnostic) => toParseDiagnostic(diagnostic, sourceFile))
|
|
679
|
+
};
|
|
680
|
+
return {
|
|
681
|
+
ok: true,
|
|
682
|
+
value: {
|
|
683
|
+
args: result.value,
|
|
684
|
+
span
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
function toParseDiagnostic(diagnostic, sourceFile) {
|
|
689
|
+
return {
|
|
690
|
+
code: diagnostic.code,
|
|
691
|
+
message: diagnostic.message,
|
|
692
|
+
range: pslSpanToRange(diagnostic.span, sourceFile)
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
function pslSpanToRange(span, sourceFile) {
|
|
696
|
+
return {
|
|
697
|
+
start: sourceFile.positionAt(span.start.offset),
|
|
698
|
+
end: sourceFile.positionAt(span.end.offset)
|
|
699
|
+
};
|
|
700
|
+
}
|
|
534
701
|
function reconstructParamValue(entry, param, span, sourceFile, diagnostics) {
|
|
535
702
|
const value = entry.value();
|
|
536
703
|
if (value === void 0) return {
|
|
@@ -799,6 +966,6 @@ function nodeRange(node, sourceFile) {
|
|
|
799
966
|
};
|
|
800
967
|
}
|
|
801
968
|
//#endregion
|
|
802
|
-
export { bool, buildSymbolTable, entityRef, fieldAttribute, fieldRef, findBlockDescriptor, flatPslModels, funcCall, getPositionalArgument, identifier, int, interpretArgs, interpretAttribute, keywordPslSpan, leafDiagnostic, list, modelAttribute, namespacePslExtensionBlocks, nodePslSpan, num, oneOf, optional, parseQuotedStringLiteral, rangeToPslSpan, readResolvedAttribute, readResolvedAttributes, readResolvedConstructorCall, record, str, validateExtensionBlockFromSymbol };
|
|
969
|
+
export { assembleAttributeSpecs, blockAttribute, bool, buildSymbolTable, entityRef, fieldAttribute, fieldRef, findBlockDescriptor, flatPslModels, funcCall, getPositionalArgument, identifier, int, interpretArgs, interpretAttribute, json, keywordPslSpan, leafDiagnostic, list, modelAttribute, namespacePslExtensionBlocks, nodePslSpan, num, oneOf, optional, parseQuotedStringLiteral, rangeToPslSpan, readResolvedAttribute, readResolvedAttributes, readResolvedConstructorCall, record, referencedFieldRef, str, validateExtensionBlockFromSymbol };
|
|
803
970
|
|
|
804
971
|
//# sourceMappingURL=psl-parser.mjs.map
|