@prisma/orm-framework 0.16.0
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/LICENSE +201 -0
- package/README.md +27 -0
- package/dist/abortable-CQO6uG9F.mjs +39 -0
- package/dist/abortable-CQO6uG9F.mjs.map +1 -0
- package/dist/abortable-DBbAaT_4.d.mts +29 -0
- package/dist/abortable-DBbAaT_4.d.mts.map +1 -0
- package/dist/apply-specifier-default-control-policy-CAxiXxKg.d.mts +7 -0
- package/dist/apply-specifier-default-control-policy-CAxiXxKg.d.mts.map +1 -0
- package/dist/apply-specifier-default-control-policy-CsYHsfTF.mjs +12 -0
- package/dist/apply-specifier-default-control-policy-CsYHsfTF.mjs.map +1 -0
- package/dist/array-equal-28xupwIB.mjs +26 -0
- package/dist/array-equal-28xupwIB.mjs.map +1 -0
- package/dist/array-equal-dUd-VPlk.d.mts +22 -0
- package/dist/array-equal-dUd-VPlk.d.mts.map +1 -0
- package/dist/assertions-BEQnOIQd.d.mts +31 -0
- package/dist/assertions-BEQnOIQd.d.mts.map +1 -0
- package/dist/assertions-Cz-GWH8P.mjs +36 -0
- package/dist/assertions-Cz-GWH8P.mjs.map +1 -0
- package/dist/authoring-Dd7p6pTS.d.mts +1 -0
- package/dist/canonical-stringify-Bl6agy_g.d.mts +51 -0
- package/dist/canonical-stringify-Bl6agy_g.d.mts.map +1 -0
- package/dist/canonical-stringify-DY4NaAJi.mjs +104 -0
- package/dist/canonical-stringify-DY4NaAJi.mjs.map +1 -0
- package/dist/canonicalization-DFpB09nP-4OdB2nsy.d.mts +69 -0
- package/dist/canonicalization-DFpB09nP-4OdB2nsy.d.mts.map +1 -0
- package/dist/canonicalization-path-match-CNgHuwM_-CCPBeUuk.mjs +25 -0
- package/dist/canonicalization-path-match-CNgHuwM_-CCPBeUuk.mjs.map +1 -0
- package/dist/capabilities-CPj7MfXO-GRkp0Q_D.mjs +64 -0
- package/dist/capabilities-CPj7MfXO-GRkp0Q_D.mjs.map +1 -0
- package/dist/capabilities-Cupq4-1--C71ORI3N.d.mts +34 -0
- package/dist/capabilities-Cupq4-1--C71ORI3N.d.mts.map +1 -0
- package/dist/casts-D29CHGrr.d.mts +78 -0
- package/dist/casts-D29CHGrr.d.mts.map +1 -0
- package/dist/casts-DpaahrlC-Bd5n2coI.mjs +82 -0
- package/dist/casts-DpaahrlC-Bd5n2coI.mjs.map +1 -0
- package/dist/codec-Cly9VPoA.mjs +78 -0
- package/dist/codec-Cly9VPoA.mjs.map +1 -0
- package/dist/codec-D3GVAkR_.d.mts +116 -0
- package/dist/codec-D3GVAkR_.d.mts.map +1 -0
- package/dist/codec-types-XJO6eC9U-B_K2q0zm.d.mts +221 -0
- package/dist/codec-types-XJO6eC9U-B_K2q0zm.d.mts.map +1 -0
- package/dist/components-CawuxTia.d.mts +1 -0
- package/dist/components.d.mts +20 -0
- package/dist/components.mjs +15 -0
- package/dist/components__authoring.d.mts +3 -0
- package/dist/components__authoring.mjs +2 -0
- package/dist/components__codec.d.mts +3 -0
- package/dist/components__codec.mjs +3 -0
- package/dist/components__components.d.mts +4 -0
- package/dist/components__components.mjs +3 -0
- package/dist/components__control.d.mts +4 -0
- package/dist/components__control.mjs +2 -0
- package/dist/components__emission.d.mts +4 -0
- package/dist/components__emission.mjs +2 -0
- package/dist/components__execution.d.mts +2 -0
- package/dist/components__execution.mjs +2 -0
- package/dist/components__ir.d.mts +3 -0
- package/dist/components__ir.mjs +3 -0
- package/dist/components__psl-ast.d.mts +4 -0
- package/dist/components__psl-ast.mjs +2 -0
- package/dist/components__runtime.d.mts +2 -0
- package/dist/components__runtime.mjs +3 -0
- package/dist/components__utils.d.mts +2 -0
- package/dist/components__utils.mjs +2 -0
- package/dist/config-errors-CBdiX587-DwIyJIX9.mjs +9 -0
- package/dist/config-errors-CBdiX587-DwIyJIX9.mjs.map +1 -0
- package/dist/config-types-Cf9lVsHR.mjs +62 -0
- package/dist/config-types-Cf9lVsHR.mjs.map +1 -0
- package/dist/config-types-W-87vhZ4-BgYaH8YO.d.mts +162 -0
- package/dist/config-types-W-87vhZ4-BgYaH8YO.d.mts.map +1 -0
- package/dist/config-types-zrHI32Om.d.mts +1 -0
- package/dist/config-validation-ByGTw6zQ.mjs +99 -0
- package/dist/config-validation-ByGTw6zQ.mjs.map +1 -0
- package/dist/config-validation-DXggMTZf.d.mts +14 -0
- package/dist/config-validation-DXggMTZf.d.mts.map +1 -0
- package/dist/config.d.mts +4 -0
- package/dist/config.mjs +3 -0
- package/dist/config__config-types.d.mts +3 -0
- package/dist/config__config-types.mjs +2 -0
- package/dist/config__config-validation.d.mts +2 -0
- package/dist/config__config-validation.mjs +2 -0
- package/dist/contract-authoring.d.mts +213 -0
- package/dist/contract-authoring.d.mts.map +1 -0
- package/dist/contract-authoring.mjs +133 -0
- package/dist/contract-authoring.mjs.map +1 -0
- package/dist/contract-types-CkdMH7F7-9EHXSwbH.d.mts +77 -0
- package/dist/contract-types-CkdMH7F7-9EHXSwbH.d.mts.map +1 -0
- package/dist/contract-validation-error-DEiWp_EI-CRwtUgRw.mjs +14 -0
- package/dist/contract-validation-error-DEiWp_EI-CRwtUgRw.mjs.map +1 -0
- package/dist/contract-validation-error-R7cMoK04.d.mts +11 -0
- package/dist/contract-validation-error-R7cMoK04.d.mts.map +1 -0
- package/dist/contract.d.mts +14 -0
- package/dist/contract.mjs +13 -0
- package/dist/contract__apply-specifier-default-control-policy.d.mts +2 -0
- package/dist/contract__apply-specifier-default-control-policy.mjs +2 -0
- package/dist/contract__contract-validation-error.d.mts +2 -0
- package/dist/contract__contract-validation-error.mjs +2 -0
- package/dist/contract__default-namespace.d.mts +2 -0
- package/dist/contract__default-namespace.mjs +2 -0
- package/dist/contract__enum-accessor.d.mts +2 -0
- package/dist/contract__enum-accessor.mjs +2 -0
- package/dist/contract__hashing-utils.d.mts +2 -0
- package/dist/contract__hashing-utils.mjs +3 -0
- package/dist/contract__hashing.d.mts +3 -0
- package/dist/contract__hashing.mjs +2 -0
- package/dist/contract__is-plain-record.d.mts +2 -0
- package/dist/contract__is-plain-record.mjs +2 -0
- package/dist/contract__resolve-domain-model.d.mts +2 -0
- package/dist/contract__resolve-domain-model.mjs +2 -0
- package/dist/contract__types.d.mts +6 -0
- package/dist/contract__types.mjs +5 -0
- package/dist/contract__validate-domain.d.mts +2 -0
- package/dist/contract__validate-domain.mjs +2 -0
- package/dist/control-B87KWI_K-C_R8WfEr.d.mts +213 -0
- package/dist/control-B87KWI_K-C_R8WfEr.d.mts.map +1 -0
- package/dist/control-CBvTj7Ia.d.mts +1383 -0
- package/dist/control-CBvTj7Ia.d.mts.map +1 -0
- package/dist/control-DTouE89s.mjs +621 -0
- package/dist/control-DTouE89s.mjs.map +1 -0
- package/dist/control-Ftiau058-CCeJcAVQ.mjs +284 -0
- package/dist/control-Ftiau058-CCeJcAVQ.mjs.map +1 -0
- package/dist/declarations-DR6To8_k-BFwkCGeP.mjs +1046 -0
- package/dist/declarations-DR6To8_k-BFwkCGeP.mjs.map +1 -0
- package/dist/default-namespace-D4vCwkXg-BaiW8LNK.mjs +39 -0
- package/dist/default-namespace-D4vCwkXg-BaiW8LNK.mjs.map +1 -0
- package/dist/default-namespace-D5X_k6hJ-GH8P1ror.d.mts +26 -0
- package/dist/default-namespace-D5X_k6hJ-GH8P1ror.d.mts.map +1 -0
- package/dist/defined-BQWA85QH-BRSBMULx.mjs +31 -0
- package/dist/defined-BQWA85QH-BRSBMULx.mjs.map +1 -0
- package/dist/defined-BSXuxrnl.d.mts +28 -0
- package/dist/defined-BSXuxrnl.d.mts.map +1 -0
- package/dist/domain-envelope-D6Wn9AmZ-BqZKTT9U.d.mts +359 -0
- package/dist/domain-envelope-D6Wn9AmZ-BqZKTT9U.d.mts.map +1 -0
- package/dist/emission-CeoAV9mj.mjs +26 -0
- package/dist/emission-CeoAV9mj.mjs.map +1 -0
- package/dist/emission-DeoQufVd.d.mts +1 -0
- package/dist/emission-types-hfRVB_Yw-DpQ3hISB.d.mts +75 -0
- package/dist/emission-types-hfRVB_Yw-DpQ3hISB.d.mts.map +1 -0
- package/dist/enum-accessor-Db5DaTNX.mjs +35 -0
- package/dist/enum-accessor-Db5DaTNX.mjs.map +1 -0
- package/dist/enum-accessor-PH5vjghI.d.mts +85 -0
- package/dist/enum-accessor-PH5vjghI.d.mts.map +1 -0
- package/dist/errors.d.mts +4 -0
- package/dist/errors.mjs +4 -0
- package/dist/errors__control.d.mts +2 -0
- package/dist/errors__control.mjs +2 -0
- package/dist/errors__execution.d.mts +2 -0
- package/dist/errors__execution.mjs +2 -0
- package/dist/errors__migration.d.mts +2 -0
- package/dist/errors__migration.mjs +2 -0
- package/dist/execution-BNwBzmRd.mjs +40 -0
- package/dist/execution-BNwBzmRd.mjs.map +1 -0
- package/dist/execution-BbOD4GyR.mjs +164 -0
- package/dist/execution-BbOD4GyR.mjs.map +1 -0
- package/dist/execution-Bo5Bu2Ys.d.mts +79 -0
- package/dist/execution-Bo5Bu2Ys.d.mts.map +1 -0
- package/dist/execution-MOde1lmD.d.mts +98 -0
- package/dist/execution-MOde1lmD.d.mts.map +1 -0
- package/dist/framework-authoring-7YMP9TwM-C9P-N6_a.d.mts +777 -0
- package/dist/framework-authoring-7YMP9TwM-C9P-N6_a.d.mts.map +1 -0
- package/dist/framework-authoring-CDEvlouU-mlMWSksD.mjs +698 -0
- package/dist/framework-authoring-CDEvlouU-mlMWSksD.mjs.map +1 -0
- package/dist/framework-components-D6j4Y5K7-RW9H184y.mjs +27 -0
- package/dist/framework-components-D6j4Y5K7-RW9H184y.mjs.map +1 -0
- package/dist/framework-components-MFoo0sYx-G_6k9jt4.d.mts +388 -0
- package/dist/framework-components-MFoo0sYx-G_6k9jt4.d.mts.map +1 -0
- package/dist/hash-content-Bugg_nZn.mjs +63 -0
- package/dist/hash-content-Bugg_nZn.mjs.map +1 -0
- package/dist/hash-content-DwEUh-Rx.d.mts +59 -0
- package/dist/hash-content-DwEUh-Rx.d.mts.map +1 -0
- package/dist/hashing-BtIZVNYX.mjs +199 -0
- package/dist/hashing-BtIZVNYX.mjs.map +1 -0
- package/dist/hashing-CccSPELN.d.mts +25 -0
- package/dist/hashing-CccSPELN.d.mts.map +1 -0
- package/dist/hashing-utils-DQgS3nOe.mjs +48 -0
- package/dist/hashing-utils-DQgS3nOe.mjs.map +1 -0
- package/dist/hashing-utils-qKu59RSC.d.mts +19 -0
- package/dist/hashing-utils-qKu59RSC.d.mts.map +1 -0
- package/dist/ids.d.mts +44 -0
- package/dist/ids.d.mts.map +1 -0
- package/dist/ids.mjs +96 -0
- package/dist/ids.mjs.map +1 -0
- package/dist/ids__runtime.d.mts +7 -0
- package/dist/ids__runtime.d.mts.map +1 -0
- package/dist/ids__runtime.mjs +31 -0
- package/dist/ids__runtime.mjs.map +1 -0
- package/dist/index-GY2oGH9L.d.mts +120 -0
- package/dist/index-GY2oGH9L.d.mts.map +1 -0
- package/dist/internal-error-BIc-ehme-ouBQPoEL.mjs +24 -0
- package/dist/internal-error-BIc-ehme-ouBQPoEL.mjs.map +1 -0
- package/dist/internal-error-kK8QvlDE.d.mts +19 -0
- package/dist/internal-error-kK8QvlDE.d.mts.map +1 -0
- package/dist/ir-BvE7L9FK.d.mts +359 -0
- package/dist/ir-BvE7L9FK.d.mts.map +1 -0
- package/dist/ir-ChmSSAhX.mjs +200 -0
- package/dist/ir-ChmSSAhX.mjs.map +1 -0
- package/dist/is-plain-record-C9BWiqcw.d.mts +12 -0
- package/dist/is-plain-record-C9BWiqcw.d.mts.map +1 -0
- package/dist/is-plain-record-CUofyVQ7-DWEzdhIx.mjs +16 -0
- package/dist/is-plain-record-CUofyVQ7-DWEzdhIx.mjs.map +1 -0
- package/dist/json-Dkqr3say.d.mts +26 -0
- package/dist/json-Dkqr3say.d.mts.map +1 -0
- package/dist/migration-4VOHVEzx.mjs +118 -0
- package/dist/migration-4VOHVEzx.mjs.map +1 -0
- package/dist/migration-DKbDzBwy.d.mts +74 -0
- package/dist/migration-DKbDzBwy.d.mts.map +1 -0
- package/dist/namespace-id-asbWpwMw-3yxn-tRe.mjs +9 -0
- package/dist/namespace-id-asbWpwMw-3yxn-tRe.mjs.map +1 -0
- package/dist/operations.d.mts +46 -0
- package/dist/operations.d.mts.map +1 -0
- package/dist/operations.mjs +28 -0
- package/dist/operations.mjs.map +1 -0
- package/dist/parse-0ZJjj_2N-WZZ1nlrv.d.mts +427 -0
- package/dist/parse-0ZJjj_2N-WZZ1nlrv.d.mts.map +1 -0
- package/dist/parse-GbZGfMUj-BFSrD2AN.mjs +621 -0
- package/dist/parse-GbZGfMUj-BFSrD2AN.mjs.map +1 -0
- package/dist/promise-D8meygPf.mjs +13 -0
- package/dist/promise-D8meygPf.mjs.map +1 -0
- package/dist/promise-DHJWZv49.d.mts +11 -0
- package/dist/promise-DHJWZv49.d.mts.map +1 -0
- package/dist/psl-ast-BEwO80EH.d.mts +37 -0
- package/dist/psl-ast-BEwO80EH.d.mts.map +1 -0
- package/dist/psl-ast-Chgi8e4o-rSlBk1UV.d.mts +259 -0
- package/dist/psl-ast-Chgi8e4o-rSlBk1UV.d.mts.map +1 -0
- package/dist/psl-ast-DUCvVXbB.mjs +239 -0
- package/dist/psl-ast-DUCvVXbB.mjs.map +1 -0
- package/dist/psl-parser.d.mts +158 -0
- package/dist/psl-parser.d.mts.map +1 -0
- package/dist/psl-parser.mjs +804 -0
- package/dist/psl-parser.mjs.map +1 -0
- package/dist/psl-parser__format.d.mts +12 -0
- package/dist/psl-parser__format.d.mts.map +1 -0
- package/dist/psl-parser__format.mjs +464 -0
- package/dist/psl-parser__format.mjs.map +1 -0
- package/dist/psl-parser__interpret.d.mts +40 -0
- package/dist/psl-parser__interpret.d.mts.map +1 -0
- package/dist/psl-parser__interpret.mjs +25 -0
- package/dist/psl-parser__interpret.mjs.map +1 -0
- package/dist/psl-parser__syntax.d.mts +31 -0
- package/dist/psl-parser__syntax.d.mts.map +1 -0
- package/dist/psl-parser__syntax.mjs +43 -0
- package/dist/psl-parser__syntax.mjs.map +1 -0
- package/dist/psl-parser__tokenizer.d.mts +2 -0
- package/dist/psl-parser__tokenizer.mjs +2 -0
- package/dist/psl-printer.d.mts +37 -0
- package/dist/psl-printer.d.mts.map +1 -0
- package/dist/psl-printer.mjs +393 -0
- package/dist/psl-printer.mjs.map +1 -0
- package/dist/redact-db-url-BlaloOwt.d.mts +22 -0
- package/dist/redact-db-url-BlaloOwt.d.mts.map +1 -0
- package/dist/redact-db-url-CRWJWdB1.mjs +26 -0
- package/dist/redact-db-url-CRWJWdB1.mjs.map +1 -0
- package/dist/resolve-codec-BZF8TZh_-D-xORT9Q.mjs +59 -0
- package/dist/resolve-codec-BZF8TZh_-D-xORT9Q.mjs.map +1 -0
- package/dist/resolve-domain-model-BVSb5wS5-C6Yq0dsD.d.mts +17 -0
- package/dist/resolve-domain-model-BVSb5wS5-C6Yq0dsD.d.mts.map +1 -0
- package/dist/resolve-domain-model-BovPAsW2-8rwyzjxp.mjs +20 -0
- package/dist/resolve-domain-model-BovPAsW2-8rwyzjxp.mjs.map +1 -0
- package/dist/result-Bpupv5vO.d.mts +54 -0
- package/dist/result-Bpupv5vO.d.mts.map +1 -0
- package/dist/result-CBZ8X9mU.mjs +92 -0
- package/dist/result-CBZ8X9mU.mjs.map +1 -0
- package/dist/runtime--RZXG1zP.d.mts +901 -0
- package/dist/runtime--RZXG1zP.d.mts.map +1 -0
- package/dist/runtime-DYTFHGwh.mjs +516 -0
- package/dist/runtime-DYTFHGwh.mjs.map +1 -0
- package/dist/runtime-error-BA9d7XjZ-BlT8t6LB.mjs +40 -0
- package/dist/runtime-error-BA9d7XjZ-BlT8t6LB.mjs.map +1 -0
- package/dist/simplify-deep-Dw9I_ZUl.d.mts +6 -0
- package/dist/simplify-deep-Dw9I_ZUl.d.mts.map +1 -0
- package/dist/structured-error-BVmv2aPB.d.mts +34 -0
- package/dist/structured-error-BVmv2aPB.d.mts.map +1 -0
- package/dist/structured-error-H6WU9Kjt.mjs +31 -0
- package/dist/structured-error-H6WU9Kjt.mjs.map +1 -0
- package/dist/symbol-table-CZ7EVCTL-oYQtrmzq.d.mts +125 -0
- package/dist/symbol-table-CZ7EVCTL-oYQtrmzq.d.mts.map +1 -0
- package/dist/tokenizer-1hAHZzmp-QGPORvmA.mjs +228 -0
- package/dist/tokenizer-1hAHZzmp-QGPORvmA.mjs.map +1 -0
- package/dist/tokenizer-DcYI0Xrq-C-nNE9mE.d.mts +16 -0
- package/dist/tokenizer-DcYI0Xrq-C-nNE9mE.d.mts.map +1 -0
- package/dist/ts-render.d.mts +2 -0
- package/dist/ts-render.mjs +240 -0
- package/dist/ts-render.mjs.map +1 -0
- package/dist/types-ByeQhU9p.d.mts +17 -0
- package/dist/types-ByeQhU9p.d.mts.map +1 -0
- package/dist/types-DGxlljKG.d.mts +7 -0
- package/dist/types-DGxlljKG.d.mts.map +1 -0
- package/dist/types-DgdgskBY.mjs +96 -0
- package/dist/types-DgdgskBY.mjs.map +1 -0
- package/dist/types-import-spec-DRKzrJ20-WYwyCtil.d.mts +14 -0
- package/dist/types-import-spec-DRKzrJ20-WYwyCtil.d.mts.map +1 -0
- package/dist/utils-DMAM0unR.mjs +20 -0
- package/dist/utils-DMAM0unR.mjs.map +1 -0
- package/dist/utils-DeWL_zD9.d.mts +11 -0
- package/dist/utils-DeWL_zD9.d.mts.map +1 -0
- package/dist/utils.d.mts +16 -0
- package/dist/utils.mjs +13 -0
- package/dist/utils__abortable.d.mts +2 -0
- package/dist/utils__abortable.mjs +2 -0
- package/dist/utils__array-equal.d.mts +2 -0
- package/dist/utils__array-equal.mjs +2 -0
- package/dist/utils__assertions.d.mts +2 -0
- package/dist/utils__assertions.mjs +2 -0
- package/dist/utils__canonical-stringify.d.mts +2 -0
- package/dist/utils__canonical-stringify.mjs +2 -0
- package/dist/utils__casts.d.mts +2 -0
- package/dist/utils__casts.mjs +2 -0
- package/dist/utils__defined.d.mts +2 -0
- package/dist/utils__defined.mjs +2 -0
- package/dist/utils__hash-content.d.mts +2 -0
- package/dist/utils__hash-content.mjs +2 -0
- package/dist/utils__internal-error.d.mts +2 -0
- package/dist/utils__internal-error.mjs +2 -0
- package/dist/utils__json.d.mts +2 -0
- package/dist/utils__json.mjs +1 -0
- package/dist/utils__promise.d.mts +2 -0
- package/dist/utils__promise.mjs +2 -0
- package/dist/utils__redact-db-url.d.mts +2 -0
- package/dist/utils__redact-db-url.mjs +2 -0
- package/dist/utils__result.d.mts +2 -0
- package/dist/utils__result.mjs +2 -0
- package/dist/utils__simplify-deep.d.mts +2 -0
- package/dist/utils__simplify-deep.mjs +1 -0
- package/dist/utils__structured-error.d.mts +2 -0
- package/dist/utils__structured-error.mjs +2 -0
- package/dist/utils__types.d.mts +2 -0
- package/dist/utils__types.mjs +1 -0
- package/dist/validate-domain-BNBs-TVv.d.mts +22 -0
- package/dist/validate-domain-BNBs-TVv.d.mts.map +1 -0
- package/dist/validate-domain-BkvFlY3B.mjs +143 -0
- package/dist/validate-domain-BkvFlY3B.mjs.map +1 -0
- package/package.json +109 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { t as Contract } from "./contract-types-CkdMH7F7-9EHXSwbH.mjs";
|
|
2
|
+
import { r as Result } from "./result-Bpupv5vO.mjs";
|
|
3
|
+
import { c as ContractSourceProvider, m as PslContractSourceProvider, n as ContractSourceContext, o as ContractSourceDiagnostics, r as ContractSourceDiagnostic } from "./config-types-W-87vhZ4-BgYaH8YO.mjs";
|
|
4
|
+
import "./config-types-zrHI32Om.mjs";
|
|
5
|
+
import { I as SourceFile, d as DocumentAst } from "./parse-0ZJjj_2N-WZZ1nlrv.mjs";
|
|
6
|
+
import { f as SymbolTable } from "./symbol-table-CZ7EVCTL-oYQtrmzq.mjs";
|
|
7
|
+
//#region ../../../1-framework/2-authoring/psl-parser/dist/interpret.d.mts
|
|
8
|
+
//#region src/interpret.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Lets editor tooling that already parses incrementally (e.g. the language
|
|
11
|
+
* server) hand cached artifacts to the interpreter instead of forcing a
|
|
12
|
+
* disk re-parse.
|
|
13
|
+
*/
|
|
14
|
+
interface PslInterpretInput {
|
|
15
|
+
readonly document: DocumentAst;
|
|
16
|
+
readonly sourceFile: SourceFile;
|
|
17
|
+
readonly symbolTable: SymbolTable;
|
|
18
|
+
readonly sourceId: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Declared here — the authoring layer that owns `DocumentAst` / `SourceFile` /
|
|
22
|
+
* `SymbolTable` — because `@internal/config` (core) cannot name authoring
|
|
23
|
+
* types. `interpret` must not read disk or `context.resolvedInputs` — those
|
|
24
|
+
* are load-path concerns.
|
|
25
|
+
*/
|
|
26
|
+
interface PslInterpretCapable extends PslContractSourceProvider {
|
|
27
|
+
interpret(input: PslInterpretInput, context: ContractSourceContext): Result<Contract, ContractSourceDiagnostics>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Merges caller-side diagnostics (e.g. parse / symbol-table findings) into an
|
|
31
|
+
* interpretation result. The authored headline is deliberately uniform — it
|
|
32
|
+
* reports how many errors the schema has, never which pipeline stage found
|
|
33
|
+
* them.
|
|
34
|
+
*/
|
|
35
|
+
declare function withSeedDiagnostics(result: Result<Contract, ContractSourceDiagnostics>, seedDiagnostics: readonly ContractSourceDiagnostic[]): Result<Contract, ContractSourceDiagnostics>;
|
|
36
|
+
/** The single seam that narrows a contract source to the interpret capability. */
|
|
37
|
+
declare function hasPslInterpreter(source: ContractSourceProvider): source is PslInterpretCapable;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { type PslInterpretCapable, type PslInterpretInput, hasPslInterpreter, withSeedDiagnostics };
|
|
40
|
+
//# sourceMappingURL=psl-parser__interpret.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"psl-parser__interpret.d.mts","names":[],"sources":["../../../../1-framework/2-authoring/psl-parser/dist/interpret.d.mts"],"mappings":";;;;;;;;;;;;;UAWU;WACC,UAAU;WACV,YAAY;WACZ,aAAa;WACb;;;;;;;;UAQD,4BAA4B;EACpC,UAAU,OAAO,mBAAmB,SAAS,wBAAwB,OAAO,UAAU;;;;;;;;iBAQvE,oBAAoB,QAAQ,OAAO,UAAU,4BAA4B,0BAA0B,6BAA6B,OAAO,UAAU;;iBAEjJ,kBAAkB,QAAQ,yBAAyB,UAAU"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { t as notOk } from "./result-CBZ8X9mU.mjs";
|
|
2
|
+
//#region ../../../1-framework/2-authoring/psl-parser/dist/interpret.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Merges caller-side diagnostics (e.g. parse / symbol-table findings) into an
|
|
5
|
+
* interpretation result. The authored headline is deliberately uniform — it
|
|
6
|
+
* reports how many errors the schema has, never which pipeline stage found
|
|
7
|
+
* them.
|
|
8
|
+
*/
|
|
9
|
+
function withSeedDiagnostics(result, seedDiagnostics) {
|
|
10
|
+
if (seedDiagnostics.length === 0) return result;
|
|
11
|
+
const diagnostics = result.ok ? seedDiagnostics : [...seedDiagnostics, ...result.failure.diagnostics];
|
|
12
|
+
return notOk({
|
|
13
|
+
summary: `Schema has ${diagnostics.length} error${diagnostics.length === 1 ? "" : "s"}`,
|
|
14
|
+
diagnostics,
|
|
15
|
+
...result.ok || result.failure.meta === void 0 ? {} : { meta: result.failure.meta }
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/** The single seam that narrows a contract source to the interpret capability. */
|
|
19
|
+
function hasPslInterpreter(source) {
|
|
20
|
+
return source.format === "psl" && "interpret" in source && typeof source.interpret === "function";
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { hasPslInterpreter, withSeedDiagnostics };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=psl-parser__interpret.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"psl-parser__interpret.mjs","names":[],"sources":["../../../../1-framework/2-authoring/psl-parser/dist/interpret.mjs"],"sourcesContent":["import { notOk } from \"@internal/utils/result\";\n//#region src/interpret.ts\n/**\n* Merges caller-side diagnostics (e.g. parse / symbol-table findings) into an\n* interpretation result. The authored headline is deliberately uniform — it\n* reports how many errors the schema has, never which pipeline stage found\n* them.\n*/\nfunction withSeedDiagnostics(result, seedDiagnostics) {\n\tif (seedDiagnostics.length === 0) return result;\n\tconst diagnostics = result.ok ? seedDiagnostics : [...seedDiagnostics, ...result.failure.diagnostics];\n\treturn notOk({\n\t\tsummary: `Schema has ${diagnostics.length} error${diagnostics.length === 1 ? \"\" : \"s\"}`,\n\t\tdiagnostics,\n\t\t...result.ok || result.failure.meta === void 0 ? {} : { meta: result.failure.meta }\n\t});\n}\n/** The single seam that narrows a contract source to the interpret capability. */\nfunction hasPslInterpreter(source) {\n\treturn source.format === \"psl\" && \"interpret\" in source && typeof source.interpret === \"function\";\n}\n//#endregion\nexport { hasPslInterpreter, withSeedDiagnostics };\n\n//# sourceMappingURL=interpret.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,oBAAoB,QAAQ,iBAAiB;CACrD,IAAI,gBAAgB,WAAW,GAAG,OAAO;CACzC,MAAM,cAAc,OAAO,KAAK,kBAAkB,CAAC,GAAG,iBAAiB,GAAG,OAAO,QAAQ,WAAW;CACpG,OAAO,MAAM;EACZ,SAAS,cAAc,YAAY,OAAO,QAAQ,YAAY,WAAW,IAAI,KAAK;EAClF;EACA,GAAG,OAAO,MAAM,OAAO,QAAQ,SAAS,KAAK,IAAI,CAAC,IAAI,EAAE,MAAM,OAAO,QAAQ,KAAK;CACnF,CAAC;AACF;;AAEA,SAAS,kBAAkB,QAAQ;CAClC,OAAO,OAAO,WAAW,SAAS,eAAe,UAAU,OAAO,OAAO,cAAc;AACxF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { n as TokenKind } from "./tokenizer-DcYI0Xrq-C-nNE9mE.mjs";
|
|
2
|
+
import { $ as parse, A as ObjectLiteralExprAst, B as SyntaxNode, C as ModelAttributeAst, D as NamespaceMemberAst, E as NamespaceDeclarationAst, F as Range, G as any, H as TokenAtOffset, I as SourceFile, J as filterChildren, K as castExpression, L as StringLiteralExprAst, M as ParseResult, N as Position, O as NumberLiteralExprAst, P as QualifiedNameAst, Q as greenToken, R as SyntaxElement, S as KeyValuePairAst, T as NamedTypeDeclarationAst, U as TypeAnnotationAst, V as SyntaxToken, W as TypesBlockAst, X as findFirstChild, Y as findChildToken, Z as greenNode, _ as GenericBlockMemberAst, a as AttributeAst, b as GreenToken, c as BracedBlock, d as DocumentAst, et as printSyntax, f as ExpressionAst, g as GenericBlockDeclarationAst, h as FunctionCallAst, i as AttributeArgListAst, j as ParseDiagnostic, k as ObjectFieldAst, l as CompositeTypeDeclarationAst, m as FieldDeclarationAst, n as AstNode, o as BlockMemberAst, p as FieldAttributeAst, q as createSyntaxTree, r as AttributeArgAst, s as BooleanLiteralExprAst, t as ArrayLiteralAst, u as DeclarationAst, v as GreenElement, w as ModelDeclarationAst, x as IdentifierAst, y as GreenNode, z as SyntaxKind } from "./parse-0ZJjj_2N-WZZ1nlrv.mjs";
|
|
3
|
+
//#region ../../../1-framework/2-authoring/psl-parser/dist/syntax.d.mts
|
|
4
|
+
//#region src/syntax/green-builder.d.ts
|
|
5
|
+
declare class GreenNodeBuilder {
|
|
6
|
+
#private;
|
|
7
|
+
startNode(kind: SyntaxKind): void;
|
|
8
|
+
token(kind: TokenKind, text: string): void;
|
|
9
|
+
finishNode(): GreenNode;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/syntax/navigation.d.ts
|
|
13
|
+
/** Direction of a sibling/token walk. */
|
|
14
|
+
type Direction = 'next' | 'prev';
|
|
15
|
+
/** Whether a token kind is trivia (whitespace, newline, or comment). */
|
|
16
|
+
declare function isTriviaKind(kind: TokenKind): boolean;
|
|
17
|
+
/** Whether a token is trivia. */
|
|
18
|
+
declare function isTrivia(token: SyntaxToken): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The first non-trivia token at or beyond `token` in `direction`. Returns
|
|
21
|
+
* `token` itself when it is already significant.
|
|
22
|
+
*/
|
|
23
|
+
declare function skipTriviaToken(token: SyntaxToken, direction: Direction): SyntaxToken | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* The nearest sibling of `element` (within the same parent) in `direction` that
|
|
26
|
+
* is not a trivia token. Nodes are always significant.
|
|
27
|
+
*/
|
|
28
|
+
declare function nonTriviaSibling(element: SyntaxElement, direction: Direction): SyntaxElement | undefined;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { ArrayLiteralAst, type AstNode, AttributeArgAst, AttributeArgListAst, type AttributeAst, type BlockMemberAst, BooleanLiteralExprAst, type BracedBlock, CompositeTypeDeclarationAst, type DeclarationAst, type Direction, DocumentAst, type ExpressionAst, FieldAttributeAst, FieldDeclarationAst, FunctionCallAst, GenericBlockDeclarationAst, type GenericBlockMemberAst, type GreenElement, type GreenNode, GreenNodeBuilder, type GreenToken, IdentifierAst, KeyValuePairAst, ModelAttributeAst, ModelDeclarationAst, NamedTypeDeclarationAst, NamespaceDeclarationAst, type NamespaceMemberAst, NumberLiteralExprAst, ObjectFieldAst, ObjectLiteralExprAst, type ParseDiagnostic, type ParseResult, type Position, QualifiedNameAst, type Range, SourceFile, StringLiteralExprAst, type SyntaxElement, type SyntaxKind, SyntaxNode, SyntaxToken, TokenAtOffset, TypeAnnotationAst, TypesBlockAst, any, castExpression, createSyntaxTree, filterChildren, findChildToken, findFirstChild, greenNode, greenToken, isTrivia, isTriviaKind, nonTriviaSibling, parse, printSyntax, skipTriviaToken };
|
|
31
|
+
//# sourceMappingURL=psl-parser__syntax.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"psl-parser__syntax.d.mts","names":[],"sources":["../../../../1-framework/2-authoring/psl-parser/dist/syntax.d.mts"],"mappings":";;;;cAGc;;EAEZ,UAAU,MAAM;EAChB,MAAM,MAAM,WAAW;EACvB,cAAc;;;;;KAKX;;iBAEY,aAAa,MAAM;;iBAEnB,SAAS,OAAO;;;;;iBAKhB,gBAAgB,OAAO,aAAa,WAAW,YAAY;;;;;iBAK3D,iBAAiB,SAAS,eAAe,WAAW,YAAY"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { A as filterChildren, C as SyntaxToken, D as any, E as TypesBlockAst, M as findFirstChild, N as printSyntax, O as castExpression, S as SyntaxNode, T as TypeAnnotationAst, _ as NumberLiteralExprAst, a as CompositeTypeDeclarationAst, b as QualifiedNameAst, c as FieldDeclarationAst, d as IdentifierAst, f as KeyValuePairAst, g as NamespaceDeclarationAst, h as NamedTypeDeclarationAst, i as BooleanLiteralExprAst, j as findChildToken, k as createSyntaxTree, l as FunctionCallAst, m as ModelDeclarationAst, n as AttributeArgAst, o as DocumentAst, p as ModelAttributeAst, r as AttributeArgListAst, s as FieldAttributeAst, t as ArrayLiteralAst, u as GenericBlockDeclarationAst, v as ObjectFieldAst, w as TokenAtOffset, x as StringLiteralExprAst, y as ObjectLiteralExprAst } from "./declarations-DR6To8_k-BFwkCGeP.mjs";
|
|
2
|
+
import { a as parse, i as greenToken, n as SourceFile, r as greenNode, t as GreenNodeBuilder } from "./parse-GbZGfMUj-BFSrD2AN.mjs";
|
|
3
|
+
//#region ../../../1-framework/2-authoring/psl-parser/dist/syntax.mjs
|
|
4
|
+
const TRIVIA_KINDS = /* @__PURE__ */ new Set([
|
|
5
|
+
"Whitespace",
|
|
6
|
+
"Newline",
|
|
7
|
+
"Comment"
|
|
8
|
+
]);
|
|
9
|
+
/** Whether a token kind is trivia (whitespace, newline, or comment). */
|
|
10
|
+
function isTriviaKind(kind) {
|
|
11
|
+
return TRIVIA_KINDS.has(kind);
|
|
12
|
+
}
|
|
13
|
+
/** Whether a token is trivia. */
|
|
14
|
+
function isTrivia(token) {
|
|
15
|
+
return isTriviaKind(token.kind);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The first non-trivia token at or beyond `token` in `direction`. Returns
|
|
19
|
+
* `token` itself when it is already significant.
|
|
20
|
+
*/
|
|
21
|
+
function skipTriviaToken(token, direction) {
|
|
22
|
+
let current = token;
|
|
23
|
+
while (current !== void 0 && isTrivia(current)) current = direction === "next" ? current.nextToken : current.prevToken;
|
|
24
|
+
return current;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The nearest sibling of `element` (within the same parent) in `direction` that
|
|
28
|
+
* is not a trivia token. Nodes are always significant.
|
|
29
|
+
*/
|
|
30
|
+
function nonTriviaSibling(element, direction) {
|
|
31
|
+
let sibling = step(element, direction);
|
|
32
|
+
while (sibling !== void 0) {
|
|
33
|
+
if (!(sibling instanceof SyntaxToken) || !isTrivia(sibling)) return sibling;
|
|
34
|
+
sibling = step(sibling, direction);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function step(element, direction) {
|
|
38
|
+
return direction === "next" ? element.nextSiblingOrToken : element.prevSiblingOrToken;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { ArrayLiteralAst, AttributeArgAst, AttributeArgListAst, BooleanLiteralExprAst, CompositeTypeDeclarationAst, DocumentAst, FieldAttributeAst, FieldDeclarationAst, FunctionCallAst, GenericBlockDeclarationAst, GreenNodeBuilder, IdentifierAst, KeyValuePairAst, ModelAttributeAst, ModelDeclarationAst, NamedTypeDeclarationAst, NamespaceDeclarationAst, NumberLiteralExprAst, ObjectFieldAst, ObjectLiteralExprAst, QualifiedNameAst, SourceFile, StringLiteralExprAst, SyntaxNode, SyntaxToken, TokenAtOffset, TypeAnnotationAst, TypesBlockAst, any, castExpression, createSyntaxTree, filterChildren, findChildToken, findFirstChild, greenNode, greenToken, isTrivia, isTriviaKind, nonTriviaSibling, parse, printSyntax, skipTriviaToken };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=psl-parser__syntax.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"psl-parser__syntax.mjs","names":[],"sources":["../../../../1-framework/2-authoring/psl-parser/dist/syntax.mjs"],"sourcesContent":["import { A as SyntaxNode, C as QualifiedNameAst, D as findChildToken, E as filterChildren, M as TokenAtOffset, N as createSyntaxTree, O as findFirstChild, S as castExpression, T as any, _ as FunctionCallAst, a as KeyValuePairAst, b as ObjectLiteralExprAst, c as NamespaceDeclarationAst, d as AttributeArgListAst, f as FieldAttributeAst, g as BooleanLiteralExprAst, h as AttributeArgAst, i as GenericBlockDeclarationAst, j as SyntaxToken, k as printSyntax, l as TypesBlockAst, m as ArrayLiteralAst, n as DocumentAst, o as ModelDeclarationAst, p as ModelAttributeAst, r as FieldDeclarationAst, s as NamedTypeDeclarationAst, t as CompositeTypeDeclarationAst, u as TypeAnnotationAst, v as NumberLiteralExprAst, w as IdentifierAst, x as StringLiteralExprAst, y as ObjectFieldAst } from \"./declarations-DR6To8_k.mjs\";\nimport { a as SourceFile, i as greenToken, n as GreenNodeBuilder, r as greenNode, t as parse } from \"./parse-GbZGfMUj.mjs\";\n//#region src/syntax/navigation.ts\nconst TRIVIA_KINDS = /* @__PURE__ */ new Set([\n\t\"Whitespace\",\n\t\"Newline\",\n\t\"Comment\"\n]);\n/** Whether a token kind is trivia (whitespace, newline, or comment). */\nfunction isTriviaKind(kind) {\n\treturn TRIVIA_KINDS.has(kind);\n}\n/** Whether a token is trivia. */\nfunction isTrivia(token) {\n\treturn isTriviaKind(token.kind);\n}\n/**\n* The first non-trivia token at or beyond `token` in `direction`. Returns\n* `token` itself when it is already significant.\n*/\nfunction skipTriviaToken(token, direction) {\n\tlet current = token;\n\twhile (current !== void 0 && isTrivia(current)) current = direction === \"next\" ? current.nextToken : current.prevToken;\n\treturn current;\n}\n/**\n* The nearest sibling of `element` (within the same parent) in `direction` that\n* is not a trivia token. Nodes are always significant.\n*/\nfunction nonTriviaSibling(element, direction) {\n\tlet sibling = step(element, direction);\n\twhile (sibling !== void 0) {\n\t\tif (!(sibling instanceof SyntaxToken) || !isTrivia(sibling)) return sibling;\n\t\tsibling = step(sibling, direction);\n\t}\n}\nfunction step(element, direction) {\n\treturn direction === \"next\" ? element.nextSiblingOrToken : element.prevSiblingOrToken;\n}\n//#endregion\nexport { ArrayLiteralAst, AttributeArgAst, AttributeArgListAst, BooleanLiteralExprAst, CompositeTypeDeclarationAst, DocumentAst, FieldAttributeAst, FieldDeclarationAst, FunctionCallAst, GenericBlockDeclarationAst, GreenNodeBuilder, IdentifierAst, KeyValuePairAst, ModelAttributeAst, ModelDeclarationAst, NamedTypeDeclarationAst, NamespaceDeclarationAst, NumberLiteralExprAst, ObjectFieldAst, ObjectLiteralExprAst, QualifiedNameAst, SourceFile, StringLiteralExprAst, SyntaxNode, SyntaxToken, TokenAtOffset, TypeAnnotationAst, TypesBlockAst, any, castExpression, createSyntaxTree, filterChildren, findChildToken, findFirstChild, greenNode, greenToken, isTrivia, isTriviaKind, nonTriviaSibling, parse, printSyntax, skipTriviaToken };\n\n//# sourceMappingURL=syntax.mjs.map"],"mappings":";;;AAGA,MAAM,+BAA+B,IAAI,IAAI;CAC5C;CACA;CACA;AACD,CAAC;;AAED,SAAS,aAAa,MAAM;CAC3B,OAAO,aAAa,IAAI,IAAI;AAC7B;;AAEA,SAAS,SAAS,OAAO;CACxB,OAAO,aAAa,MAAM,IAAI;AAC/B;;;;;AAKA,SAAS,gBAAgB,OAAO,WAAW;CAC1C,IAAI,UAAU;CACd,OAAO,YAAY,KAAK,KAAK,SAAS,OAAO,GAAG,UAAU,cAAc,SAAS,QAAQ,YAAY,QAAQ;CAC7G,OAAO;AACR;;;;;AAKA,SAAS,iBAAiB,SAAS,WAAW;CAC7C,IAAI,UAAU,KAAK,SAAS,SAAS;CACrC,OAAO,YAAY,KAAK,GAAG;EAC1B,IAAI,EAAE,mBAAmB,gBAAgB,CAAC,SAAS,OAAO,GAAG,OAAO;EACpE,UAAU,KAAK,SAAS,SAAS;CAClC;AACD;AACA,SAAS,KAAK,SAAS,WAAW;CACjC,OAAO,cAAc,SAAS,QAAQ,qBAAqB,QAAQ;AACpE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { c as CodecLookup } from "./codec-types-XJO6eC9U-B_K2q0zm.mjs";
|
|
2
|
+
import { b as AuthoringPslBlockDescriptorNamespace } from "./framework-authoring-7YMP9TwM-C9P-N6_a.mjs";
|
|
3
|
+
import "./authoring-Dd7p6pTS.mjs";
|
|
4
|
+
import "./codec-D3GVAkR_.mjs";
|
|
5
|
+
import { m as PslDocumentAst } from "./psl-ast-Chgi8e4o-rSlBk1UV.mjs";
|
|
6
|
+
import "./psl-ast-BEwO80EH.mjs";
|
|
7
|
+
//#region ../../../1-framework/2-authoring/psl-printer/dist/index.d.mts
|
|
8
|
+
//#region src/print-psl.d.ts
|
|
9
|
+
type PslBlockDescriptorsNamespace = AuthoringPslBlockDescriptorNamespace;
|
|
10
|
+
interface PrintPslOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Extension-contributed PSL block descriptors, indexed by user-facing path.
|
|
13
|
+
* Typically an `AssembledAuthoringContributions.pslBlockDescriptors` namespace
|
|
14
|
+
* produced by `assembleAuthoringContributions`. Phase 2 of the printer indexes
|
|
15
|
+
* into this namespace by each extension-contributed AST node's `kind`
|
|
16
|
+
* discriminator and renders the block generically from the descriptor's
|
|
17
|
+
* `parameters` map.
|
|
18
|
+
*
|
|
19
|
+
* When absent, an AST that contains extension-contributed blocks throws —
|
|
20
|
+
* silently dropping blocks would lose user-authored content without a
|
|
21
|
+
* diagnostic. ASTs that contain only framework-parsed blocks print without
|
|
22
|
+
* any `pslBlockDescriptors` argument, which is what existing call sites do today.
|
|
23
|
+
*/
|
|
24
|
+
readonly pslBlockDescriptors?: PslBlockDescriptorsNamespace;
|
|
25
|
+
/**
|
|
26
|
+
* Codec lookup used to print `value`-kind block parameters. The codec's JSON
|
|
27
|
+
* medium (`encodeJson`/`decodeJson`) validates and normalizes each value param.
|
|
28
|
+
* Required alongside `pslBlockDescriptors` when the AST contains `value`-kind
|
|
29
|
+
* parameters. When absent, the raw PSL literal stored in the AST node is
|
|
30
|
+
* emitted as-is.
|
|
31
|
+
*/
|
|
32
|
+
readonly codecLookup?: CodecLookup;
|
|
33
|
+
}
|
|
34
|
+
declare function printPslFromAst(ast: PslDocumentAst, options?: PrintPslOptions): string;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { printPslFromAst as printPsl };
|
|
37
|
+
//# sourceMappingURL=psl-printer.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"psl-printer.d.mts","names":[],"sources":["../../../../1-framework/2-authoring/psl-printer/dist/index.d.mts"],"mappings":";;;;;;;;KAIK,+BAA+B;UAC1B;;;;;;;;;;;;;;WAcC,sBAAsB;;;;;;;;WAQtB,cAAc;;iBAER,gBAAgB,KAAK,gBAAgB,UAAU"}
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import { t as blindCast } from "./casts-DpaahrlC-Bd5n2coI.mjs";
|
|
2
|
+
import { t as ifDefined } from "./defined-BQWA85QH-BRSBMULx.mjs";
|
|
3
|
+
import { a as structuredError } from "./structured-error-H6WU9Kjt.mjs";
|
|
4
|
+
import { h as isAuthoringPslBlockDescriptor } from "./framework-authoring-CDEvlouU-mlMWSksD.mjs";
|
|
5
|
+
import { i as flatPslModels, s as namespacePslExtensionBlocks } from "./psl-ast-DUCvVXbB.mjs";
|
|
6
|
+
//#region ../../../1-framework/2-authoring/psl-printer/dist/index.mjs
|
|
7
|
+
function contractError(code, message, options) {
|
|
8
|
+
return structuredError(code, message, options);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Indent unit used for PSL block bodies and namespace nesting.
|
|
12
|
+
*/
|
|
13
|
+
const PSL_INDENT_UNIT = " ";
|
|
14
|
+
function buildPslBlockDispatchMap(namespace) {
|
|
15
|
+
const byKeyword = /* @__PURE__ */ new Map();
|
|
16
|
+
if (namespace) collectBlockDescriptors(namespace, byKeyword);
|
|
17
|
+
return { byKeyword };
|
|
18
|
+
}
|
|
19
|
+
function collectBlockDescriptors(namespace, byKeyword) {
|
|
20
|
+
for (const value of Object.values(namespace)) {
|
|
21
|
+
if (isAuthoringPslBlockDescriptor(value)) {
|
|
22
|
+
byKeyword.set(value.keyword, value);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) collectBlockDescriptors(value, byKeyword);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function escapePslString(value) {
|
|
29
|
+
return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
|
|
30
|
+
}
|
|
31
|
+
function serializePrintDocument(doc, options = {}) {
|
|
32
|
+
const sections = [];
|
|
33
|
+
sections.push(doc.headerComment);
|
|
34
|
+
const namedTypeEntries = [...doc.namedTypes].sort((a, b) => a.name.localeCompare(b.name));
|
|
35
|
+
if (namedTypeEntries.length > 0) sections.push(serializeTypesBlock(namedTypeEntries));
|
|
36
|
+
const blockDispatchMap = buildPslBlockDispatchMap(options.pslBlockDescriptors);
|
|
37
|
+
for (const namespace of doc.namespaces) {
|
|
38
|
+
const namespaceSections = serializeNamespaceContents(namespace, blockDispatchMap, options.codecLookup);
|
|
39
|
+
if (namespaceSections.length === 0) continue;
|
|
40
|
+
if (namespace.name === "__unspecified__") sections.push(...namespaceSections);
|
|
41
|
+
else sections.push(wrapNamespaceBlock(namespace.name, namespaceSections));
|
|
42
|
+
}
|
|
43
|
+
return `${sections.join("\n\n")}\n`;
|
|
44
|
+
}
|
|
45
|
+
function serializeNamespaceContents(namespace, blockDispatchMap, codecLookup) {
|
|
46
|
+
const sections = [];
|
|
47
|
+
for (const model of namespace.models) sections.push(serializeModel(model));
|
|
48
|
+
for (const extensionBlock of namespace.extensionBlocks) sections.push(serializeExtensionBlock(extensionBlock, blockDispatchMap, codecLookup));
|
|
49
|
+
return sections;
|
|
50
|
+
}
|
|
51
|
+
function serializeExtensionBlock(extensionBlock, blockDispatchMap, codecLookup) {
|
|
52
|
+
const descriptor = blockDispatchMap.byKeyword.get(extensionBlock.keyword);
|
|
53
|
+
if (!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: {
|
|
54
|
+
reason: "block-descriptor-missing",
|
|
55
|
+
keyword: extensionBlock.keyword
|
|
56
|
+
} });
|
|
57
|
+
if (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: {
|
|
58
|
+
reason: "block-descriptor-kind-mismatch",
|
|
59
|
+
keyword: extensionBlock.keyword,
|
|
60
|
+
descriptorDiscriminator: descriptor.discriminator,
|
|
61
|
+
blockKind: extensionBlock.kind
|
|
62
|
+
} });
|
|
63
|
+
const lines = [`${extensionBlock.keyword} ${extensionBlock.name} {`];
|
|
64
|
+
for (const [paramName, paramDescriptor] of Object.entries(descriptor.parameters)) {
|
|
65
|
+
const paramValue = extensionBlock.parameters[paramName];
|
|
66
|
+
if (paramValue === void 0) continue;
|
|
67
|
+
const rendered = renderParamValue(paramValue, paramDescriptor, codecLookup, paramName);
|
|
68
|
+
lines.push(`${PSL_INDENT_UNIT}${paramName} = ${rendered}`);
|
|
69
|
+
}
|
|
70
|
+
if (descriptor.variadicParameters) for (const [paramName, paramValue] of Object.entries(extensionBlock.parameters)) {
|
|
71
|
+
if (Object.hasOwn(descriptor.parameters, paramName)) continue;
|
|
72
|
+
lines.push(`${PSL_INDENT_UNIT}${renderVariadicParam(paramName, paramValue)}`);
|
|
73
|
+
}
|
|
74
|
+
for (const attr of extensionBlock.blockAttributes ?? []) {
|
|
75
|
+
const args = attr.args.map((arg) => arg.value).join(", ");
|
|
76
|
+
lines.push(`${PSL_INDENT_UNIT}@@${attr.name}${args.length > 0 ? `(${args})` : ""}`);
|
|
77
|
+
}
|
|
78
|
+
lines.push("}");
|
|
79
|
+
return lines.join("\n");
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Renders one undeclared parameter of a `variadicParameters` block (e.g. a
|
|
83
|
+
* `native_enum` member line). Variadic entries have no per-parameter
|
|
84
|
+
* descriptor, so there is no codec to round-trip a `value` through — the raw
|
|
85
|
+
* PSL literal is emitted verbatim. A `bare` entry is just its key.
|
|
86
|
+
*/
|
|
87
|
+
function renderVariadicParam(paramName, paramValue) {
|
|
88
|
+
if (paramValue.kind === "bare") return paramName;
|
|
89
|
+
return `${paramName} = ${renderVariadicValue(paramValue)}`;
|
|
90
|
+
}
|
|
91
|
+
function renderVariadicValue(paramValue) {
|
|
92
|
+
switch (paramValue.kind) {
|
|
93
|
+
case "bare": return "";
|
|
94
|
+
case "value": return paramValue.raw;
|
|
95
|
+
case "ref": return paramValue.identifier;
|
|
96
|
+
case "option": return paramValue.token;
|
|
97
|
+
case "list": return `[${paramValue.items.map(renderVariadicValue).join(", ")}]`;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function renderParamValue(paramValue, descriptor, codecLookup, paramName) {
|
|
101
|
+
switch (descriptor.kind) {
|
|
102
|
+
case "ref":
|
|
103
|
+
if (paramValue.kind !== "ref") throw paramKindMismatchError(paramName, "ref", paramValue.kind);
|
|
104
|
+
return paramValue.identifier;
|
|
105
|
+
case "value":
|
|
106
|
+
if (paramValue.kind !== "value") throw paramKindMismatchError(paramName, "value", paramValue.kind);
|
|
107
|
+
return renderValueParam(paramValue.raw, descriptor.codecId, codecLookup, paramName);
|
|
108
|
+
case "option":
|
|
109
|
+
if (paramValue.kind !== "option") throw paramKindMismatchError(paramName, "option", paramValue.kind);
|
|
110
|
+
return paramValue.token;
|
|
111
|
+
case "list":
|
|
112
|
+
if (paramValue.kind !== "list") throw paramKindMismatchError(paramName, "list", paramValue.kind);
|
|
113
|
+
return `[${paramValue.items.map((item) => renderParamValue(item, descriptor.of, codecLookup, paramName)).join(", ")}]`;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function paramKindMismatchError(paramName, descriptorKind, valueKind) {
|
|
117
|
+
return contractError("CONTRACT.PACK_CONTRIBUTION_INVALID", `Extension block parameter "${paramName}": descriptor is "${descriptorKind}" but AST node has kind "${valueKind}"`, { meta: {
|
|
118
|
+
reason: "param-kind-mismatch",
|
|
119
|
+
paramName,
|
|
120
|
+
descriptorKind,
|
|
121
|
+
valueKind
|
|
122
|
+
} });
|
|
123
|
+
}
|
|
124
|
+
function renderValueParam(raw, codecId, codecLookup, paramName) {
|
|
125
|
+
if (!codecLookup) return raw;
|
|
126
|
+
const codec = codecLookup.get(codecId);
|
|
127
|
+
if (!codec) throw contractError("CONTRACT.PACK_CONTRIBUTION_INVALID", `Extension block parameter "${paramName}": no codec registered for id "${codecId}"`, { meta: {
|
|
128
|
+
reason: "codec-unregistered",
|
|
129
|
+
paramName,
|
|
130
|
+
codecId
|
|
131
|
+
} });
|
|
132
|
+
let parsedJson;
|
|
133
|
+
try {
|
|
134
|
+
parsedJson = JSON.parse(raw);
|
|
135
|
+
} catch (e) {
|
|
136
|
+
throw contractError("CONTRACT.PACK_CONTRIBUTION_INVALID", `Extension block parameter "${paramName}": codec "${codecId}" — raw literal is not valid JSON: ${String(e)}`, {
|
|
137
|
+
meta: {
|
|
138
|
+
reason: "raw-literal-invalid-json",
|
|
139
|
+
paramName,
|
|
140
|
+
codecId
|
|
141
|
+
},
|
|
142
|
+
cause: e
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
return JSON.stringify(codec.encodeJson(codec.decodeJson(blindCast(parsedJson))));
|
|
146
|
+
}
|
|
147
|
+
function wrapNamespaceBlock(name, innerSections) {
|
|
148
|
+
return `namespace ${name} {\n${innerSections.map((section) => section.split("\n").map((line) => line.length > 0 ? ` ${line}` : line).join("\n")).join("\n\n")}\n}`;
|
|
149
|
+
}
|
|
150
|
+
function serializeTypesBlock(namedTypes) {
|
|
151
|
+
const lines = ["types {"];
|
|
152
|
+
for (const nt of namedTypes) {
|
|
153
|
+
const attrStr = nt.attributes.length > 0 ? ` ${nt.attributes.join(" ")}` : "";
|
|
154
|
+
lines.push(` ${nt.name} = ${nt.baseType}${attrStr}`);
|
|
155
|
+
}
|
|
156
|
+
lines.push("}");
|
|
157
|
+
return lines.join("\n");
|
|
158
|
+
}
|
|
159
|
+
function serializeModel(model) {
|
|
160
|
+
const lines = [];
|
|
161
|
+
if (model.comment) lines.push(model.comment);
|
|
162
|
+
lines.push(`model ${model.name} {`);
|
|
163
|
+
const idFields = model.fields.filter((f) => f.isId);
|
|
164
|
+
const scalarFields = model.fields.filter((f) => !f.isId && !f.isRelation);
|
|
165
|
+
const relationFields = model.fields.filter((f) => f.isRelation);
|
|
166
|
+
const allOrderedFields = [
|
|
167
|
+
...idFields,
|
|
168
|
+
...scalarFields,
|
|
169
|
+
...relationFields
|
|
170
|
+
];
|
|
171
|
+
if (allOrderedFields.length > 0) {
|
|
172
|
+
const maxNameLen = Math.max(...allOrderedFields.map((f) => f.name.length));
|
|
173
|
+
const maxTypeLen = Math.max(...allOrderedFields.map((f) => formatFieldType(f).length));
|
|
174
|
+
for (const field of allOrderedFields) {
|
|
175
|
+
const typePart = formatFieldType(field);
|
|
176
|
+
const paddedName = field.name.padEnd(maxNameLen);
|
|
177
|
+
const paddedType = typePart.padEnd(maxTypeLen);
|
|
178
|
+
if (field.comment) lines.push(` ${field.comment}`);
|
|
179
|
+
const attrStr = field.attributes.length > 0 ? ` ${field.attributes.join(" ")}` : "";
|
|
180
|
+
lines.push(` ${paddedName} ${paddedType}${attrStr}`.trimEnd());
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (model.modelAttributes.length > 0) {
|
|
184
|
+
if (allOrderedFields.length > 0) lines.push("");
|
|
185
|
+
for (const attr of model.modelAttributes) lines.push(` ${attr}`);
|
|
186
|
+
}
|
|
187
|
+
lines.push("}");
|
|
188
|
+
return lines.join("\n");
|
|
189
|
+
}
|
|
190
|
+
function formatFieldType(field) {
|
|
191
|
+
let type = field.typeName;
|
|
192
|
+
if (field.list) type += "[]";
|
|
193
|
+
else if (field.optional) type += "?";
|
|
194
|
+
return type;
|
|
195
|
+
}
|
|
196
|
+
const DEFAULT_AST_PRINT_HEADER = "// use prisma-next\n// Contract inferred from the live database schema. Edit as needed, then run `prisma-next contract emit`.";
|
|
197
|
+
function astDocumentToPrintDocument(ast) {
|
|
198
|
+
const allModels = flatPslModels(ast);
|
|
199
|
+
const sortedModels = topologicalSortModels(allModels, buildModelFkDeps(allModels, new Set(allModels.map((m) => m.name))));
|
|
200
|
+
const modelNamespaceIndex = /* @__PURE__ */ new Map();
|
|
201
|
+
for (const namespace of ast.namespaces) for (const model of namespace.models) modelNamespaceIndex.set(model.name, namespace.name);
|
|
202
|
+
const namedTypes = ast.types ? ast.types.declarations.map(namedTypeDeclarationToPrinterNamedType) : [];
|
|
203
|
+
const namespaceSections = ast.namespaces.map((namespace) => {
|
|
204
|
+
const printerModels = sortedModels.filter((model) => modelNamespaceIndex.get(model.name) === namespace.name).map((m) => modelToPrinterModel(m));
|
|
205
|
+
return {
|
|
206
|
+
name: namespace.name,
|
|
207
|
+
models: printerModels,
|
|
208
|
+
extensionBlocks: namespacePslExtensionBlocks(namespace)
|
|
209
|
+
};
|
|
210
|
+
});
|
|
211
|
+
namespaceSections.sort((a, b) => {
|
|
212
|
+
if (a.name === b.name) return 0;
|
|
213
|
+
if (a.name === "__unspecified__") return -1;
|
|
214
|
+
if (b.name === "__unspecified__") return 1;
|
|
215
|
+
return a.name.localeCompare(b.name);
|
|
216
|
+
});
|
|
217
|
+
return {
|
|
218
|
+
headerComment: DEFAULT_AST_PRINT_HEADER,
|
|
219
|
+
namedTypes,
|
|
220
|
+
namespaces: namespaceSections
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
function renderPslAttribute(attr) {
|
|
224
|
+
const prefix = attr.target === "model" || attr.target === "enum" ? "@@" : "@";
|
|
225
|
+
if (attr.args.length === 0) return `${prefix}${attr.name}`;
|
|
226
|
+
const inner = attr.args.map(renderAttributeArgument).join(", ");
|
|
227
|
+
return `${prefix}${attr.name}(${inner})`;
|
|
228
|
+
}
|
|
229
|
+
function renderAttributeArgument(arg) {
|
|
230
|
+
if (arg.kind === "positional") return arg.value;
|
|
231
|
+
return `${arg.name}: ${arg.value}`;
|
|
232
|
+
}
|
|
233
|
+
function namedTypeDeclarationToPrinterNamedType(decl) {
|
|
234
|
+
const base = decl.baseType ?? (decl.typeConstructor !== void 0 ? formatTypeConstructor(decl.typeConstructor) : "");
|
|
235
|
+
const attributes = decl.attributes.map(renderPslAttribute);
|
|
236
|
+
return {
|
|
237
|
+
name: decl.name,
|
|
238
|
+
baseType: base,
|
|
239
|
+
attributes
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
function formatTypeConstructor(tc) {
|
|
243
|
+
const path = tc.path.join(".");
|
|
244
|
+
if (tc.args.length === 0) return path;
|
|
245
|
+
return `${path}(${tc.args.map(renderAttributeArgument).join(", ")})`;
|
|
246
|
+
}
|
|
247
|
+
function getPositionalStringArg(attr, index) {
|
|
248
|
+
const raw = attr.args.filter((a) => a.kind === "positional")[index]?.value.trim();
|
|
249
|
+
if (!raw) return void 0;
|
|
250
|
+
const m = raw.match(/^(['"])(.*)\1$/);
|
|
251
|
+
if (!m) return void 0;
|
|
252
|
+
return unescapePslString(m[2]);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Inverse of `escapePslString`. The parser stores quoted-literal arguments with
|
|
256
|
+
* their PSL escape sequences (`\\`, `\"`, `\n`, `\r`) intact; when we round-trip
|
|
257
|
+
* a value through `getPositionalStringArg` and re-render via `escapePslString`,
|
|
258
|
+
* we must decode it once on extraction to avoid double-escaping the same
|
|
259
|
+
* sequences on output.
|
|
260
|
+
*/
|
|
261
|
+
function unescapePslString(value) {
|
|
262
|
+
let result = "";
|
|
263
|
+
for (let i = 0; i < value.length; i++) {
|
|
264
|
+
if (value.charCodeAt(i) !== 92 || i + 1 >= value.length) {
|
|
265
|
+
result += value[i];
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
const next = value[i + 1];
|
|
269
|
+
if (next === "\\" || next === "\"" || next === "'") result += next;
|
|
270
|
+
else if (next === "n") result += "\n";
|
|
271
|
+
else if (next === "r") result += "\r";
|
|
272
|
+
else {
|
|
273
|
+
result += "\\";
|
|
274
|
+
result += next;
|
|
275
|
+
}
|
|
276
|
+
i++;
|
|
277
|
+
}
|
|
278
|
+
return result;
|
|
279
|
+
}
|
|
280
|
+
function modelToPrinterModel(model) {
|
|
281
|
+
let mapName;
|
|
282
|
+
const modelAttrStrings = [];
|
|
283
|
+
for (const a of model.attributes) {
|
|
284
|
+
if (a.name === "map" && a.target === "model") {
|
|
285
|
+
mapName = getPositionalStringArg(a, 0) ?? mapName;
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
modelAttrStrings.push(renderPslAttribute(a));
|
|
289
|
+
}
|
|
290
|
+
if (mapName !== void 0) modelAttrStrings.push(`@@map("${escapePslString(mapName)}")`);
|
|
291
|
+
const printerFields = model.fields.map((f) => fieldToPrinterField(f));
|
|
292
|
+
return {
|
|
293
|
+
name: model.name,
|
|
294
|
+
mapName,
|
|
295
|
+
fields: printerFields,
|
|
296
|
+
modelAttributes: modelAttrStrings,
|
|
297
|
+
comment: model.comment
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Assembles the qualified type name string for a field type reference.
|
|
302
|
+
*
|
|
303
|
+
* Handles all four forms:
|
|
304
|
+
* - `space:ns.Name` — typeContractSpaceId + typeNamespaceId + typeName
|
|
305
|
+
* - `space:Name` — typeContractSpaceId + typeName (no namespace)
|
|
306
|
+
* - `ns.Name` — typeNamespaceId + typeName (no space); fixes TML-2459 printer gap
|
|
307
|
+
* - `Name` — typeName only (no qualifier)
|
|
308
|
+
*/
|
|
309
|
+
function assembleQualifiedTypeName(field) {
|
|
310
|
+
const { typeName, typeNamespaceId, typeContractSpaceId } = field;
|
|
311
|
+
const dotted = typeNamespaceId !== void 0 ? `${typeNamespaceId}.${typeName}` : typeName;
|
|
312
|
+
return typeContractSpaceId !== void 0 ? `${typeContractSpaceId}:${dotted}` : dotted;
|
|
313
|
+
}
|
|
314
|
+
function fieldToPrinterField(field) {
|
|
315
|
+
const typeName = field.typeConstructor !== void 0 ? formatTypeConstructor(field.typeConstructor) : assembleQualifiedTypeName(field);
|
|
316
|
+
let mapName;
|
|
317
|
+
const attrStrings = [];
|
|
318
|
+
for (const a of field.attributes) {
|
|
319
|
+
if (a.name === "map" && a.target === "field") {
|
|
320
|
+
mapName = getPositionalStringArg(a, 0) ?? mapName;
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
attrStrings.push(renderPslAttribute(a));
|
|
324
|
+
}
|
|
325
|
+
if (mapName !== void 0) attrStrings.push(`@map("${escapePslString(mapName)}")`);
|
|
326
|
+
const isRelation = field.attributes.some((a) => a.name === "relation" && a.target === "field");
|
|
327
|
+
const isUnsupported = typeName.startsWith("Unsupported(");
|
|
328
|
+
const isId = field.attributes.some((a) => a.name === "id" && a.target === "field");
|
|
329
|
+
return {
|
|
330
|
+
name: field.name,
|
|
331
|
+
typeName,
|
|
332
|
+
optional: field.optional,
|
|
333
|
+
list: field.list,
|
|
334
|
+
attributes: attrStrings,
|
|
335
|
+
mapName,
|
|
336
|
+
isId,
|
|
337
|
+
isRelation,
|
|
338
|
+
isUnsupported,
|
|
339
|
+
comment: void 0
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
function buildModelFkDeps(models, modelNames) {
|
|
343
|
+
const deps = /* @__PURE__ */ new Map();
|
|
344
|
+
for (const m of models) deps.set(m.name, /* @__PURE__ */ new Set());
|
|
345
|
+
for (const m of models) for (const field of m.fields) {
|
|
346
|
+
const refModel = relationReferencedModel(field, modelNames);
|
|
347
|
+
if (!refModel || refModel === m.name) continue;
|
|
348
|
+
if (!hasFullRelation(field)) continue;
|
|
349
|
+
deps.get(m.name).add(refModel);
|
|
350
|
+
}
|
|
351
|
+
return deps;
|
|
352
|
+
}
|
|
353
|
+
function hasFullRelation(field) {
|
|
354
|
+
const rel = field.attributes.find((a) => a.name === "relation" && a.target === "field");
|
|
355
|
+
if (!rel) return false;
|
|
356
|
+
const named = Object.fromEntries(rel.args.filter((a) => a.kind === "named").map((a) => [a.name, a.value.trim()]));
|
|
357
|
+
return named["fields"] !== void 0 && named["references"] !== void 0;
|
|
358
|
+
}
|
|
359
|
+
function relationReferencedModel(field, modelNames) {
|
|
360
|
+
const raw = field.typeConstructor?.path[0] ?? field.typeName.replace(/\?$/, "").replace(/\[\]$/, "");
|
|
361
|
+
if (raw.length === 0) return;
|
|
362
|
+
return modelNames.has(raw) ? raw : void 0;
|
|
363
|
+
}
|
|
364
|
+
function topologicalSortModels(models, deps) {
|
|
365
|
+
const byName = new Map(models.map((m) => [m.name, m]));
|
|
366
|
+
const result = [];
|
|
367
|
+
const visited = /* @__PURE__ */ new Set();
|
|
368
|
+
const visiting = /* @__PURE__ */ new Set();
|
|
369
|
+
const sortedNames = [...deps.keys()].sort();
|
|
370
|
+
function visit(name) {
|
|
371
|
+
if (visited.has(name)) return;
|
|
372
|
+
if (visiting.has(name)) return;
|
|
373
|
+
visiting.add(name);
|
|
374
|
+
const sortedDeps = [...deps.get(name) ?? /* @__PURE__ */ new Set()].sort();
|
|
375
|
+
for (const dep of sortedDeps) visit(dep);
|
|
376
|
+
visiting.delete(name);
|
|
377
|
+
visited.add(name);
|
|
378
|
+
const model = byName.get(name);
|
|
379
|
+
if (model) result.push(model);
|
|
380
|
+
}
|
|
381
|
+
for (const name of sortedNames) visit(name);
|
|
382
|
+
return result;
|
|
383
|
+
}
|
|
384
|
+
function printPslFromAst(ast, options = {}) {
|
|
385
|
+
return serializePrintDocument(astDocumentToPrintDocument(ast), {
|
|
386
|
+
...ifDefined("pslBlockDescriptors", options.pslBlockDescriptors),
|
|
387
|
+
...ifDefined("codecLookup", options.codecLookup)
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
//#endregion
|
|
391
|
+
export { printPslFromAst as printPsl };
|
|
392
|
+
|
|
393
|
+
//# sourceMappingURL=psl-printer.mjs.map
|