@prisma/orm-framework 0.16.0-dev.36
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 +114 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
//#region ../../../1-framework/0-foundation/utils/dist/hash-content.d.mts
|
|
2
|
+
//#region src/hash-content.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Hashes a canonical-string representation of an execution into a bounded,
|
|
5
|
+
* opaque cache-key digest.
|
|
6
|
+
*
|
|
7
|
+
* Designed for use as the final step of `RuntimeMiddlewareContext.contentHash`
|
|
8
|
+
* implementations: family runtimes compose a canonical string from
|
|
9
|
+
* `meta.storageHash`, the rendered statement (or wire command), and
|
|
10
|
+
* canonicalized parameters via `canonicalStringify`, then pipe the result
|
|
11
|
+
* through this helper.
|
|
12
|
+
*
|
|
13
|
+
* Why hash the canonical string instead of using it directly as a `Map` key:
|
|
14
|
+
*
|
|
15
|
+
* 1. **Bounded memory.** A raw canonical key includes concrete parameter
|
|
16
|
+
* values, so a query bound to a 10 MB JSON column or binary blob produces
|
|
17
|
+
* a 10 MB cache key. With `maxEntries = 1000`, that scales to gigabytes
|
|
18
|
+
* of cache keys alone. SHA-512 pins per-key cost at a fixed digest
|
|
19
|
+
* length regardless of input size.
|
|
20
|
+
*
|
|
21
|
+
* 2. **Sensitive-data isolation.** The canonical string contains parameter
|
|
22
|
+
* values verbatim. Cache keys flow into debug logs, Redis `KEYS`/`MONITOR`
|
|
23
|
+
* output, persistence dumps, monitoring tools, and any user-supplied
|
|
24
|
+
* `CacheStore` implementation. Hashing prevents PII / credentials /
|
|
25
|
+
* tokens that appear in query parameters from showing up in any of those
|
|
26
|
+
* surfaces.
|
|
27
|
+
*
|
|
28
|
+
* Algorithm choice — SHA-512 (`SHA-512` via the WebCrypto API):
|
|
29
|
+
*
|
|
30
|
+
* - **Portability.** WebCrypto (`globalThis.crypto.subtle`) is available in
|
|
31
|
+
* every modern JavaScript runtime — Node, Deno, Bun, browsers, edge
|
|
32
|
+
* workers — without importing a Node-specific module. This keeps the
|
|
33
|
+
* helper usable in non-Node hosts where `node:crypto` is not available.
|
|
34
|
+
* - **Collision space.** 512 bits of output makes accidental collisions
|
|
35
|
+
* astronomically improbable — far beyond what a cache needs, but the
|
|
36
|
+
* incremental cost over 256-bit output is negligible and the headroom
|
|
37
|
+
* is free.
|
|
38
|
+
* - **No additional dependency.** SHA-512 is part of the WebCrypto standard
|
|
39
|
+
* set of digest algorithms; no third-party package needed.
|
|
40
|
+
*
|
|
41
|
+
* The function is `async` because the WebCrypto digest API is async by
|
|
42
|
+
* design. Callers must await the result.
|
|
43
|
+
*
|
|
44
|
+
* Output format: `sha512:HEXDIGEST` (128-char hex with the algorithm tag
|
|
45
|
+
* prefix). Self-describing so a future migration to a different hash
|
|
46
|
+
* produces visibly distinct keys. This in-memory cache key deliberately
|
|
47
|
+
* keeps its tag — unlike persisted contract hashes, which are bare hex.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const canonical = `${exec.meta.storageHash}|${exec.sql}|${canonicalStringify(exec.params)}`;
|
|
52
|
+
* return await hashContent(canonical);
|
|
53
|
+
* // → 'sha512:8f3...e1c' (always 135 chars: 'sha512:' + 128 hex chars)
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
declare function hashContent(value: string): Promise<string>;
|
|
57
|
+
//#endregion
|
|
58
|
+
export { hashContent as t };
|
|
59
|
+
//# sourceMappingURL=hash-content-DwEUh-Rx.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash-content-DwEUh-Rx.d.mts","names":[],"sources":["../../../../1-framework/0-foundation/utils/dist/hash-content.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsDiB,YAAY,gBAAgB"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { n as castAs, t as blindCast } from "./casts-DpaahrlC-Bd5n2coI.mjs";
|
|
2
|
+
import { t as ifDefined } from "./defined-BQWA85QH-BRSBMULx.mjs";
|
|
3
|
+
import { n as matchesPathPattern } from "./canonicalization-path-match-CNgHuwM_-CCPBeUuk.mjs";
|
|
4
|
+
import { t as isPlainRecord } from "./is-plain-record-CUofyVQ7-DWEzdhIx.mjs";
|
|
5
|
+
import { t as isArrayEqual } from "./array-equal-28xupwIB.mjs";
|
|
6
|
+
import { createHash } from "node:crypto";
|
|
7
|
+
//#region ../../../1-framework/0-foundation/contract/dist/hashing.mjs
|
|
8
|
+
const DOMAIN_NAMESPACE_SLOT_PATTERN = [
|
|
9
|
+
"domain",
|
|
10
|
+
"namespaces",
|
|
11
|
+
"*"
|
|
12
|
+
];
|
|
13
|
+
const DOMAIN_MODELS_CONTAINER_PATTERN = [
|
|
14
|
+
"domain",
|
|
15
|
+
"namespaces",
|
|
16
|
+
"*",
|
|
17
|
+
"models"
|
|
18
|
+
];
|
|
19
|
+
const DOMAIN_MODEL_RELATIONS_PATTERN = [
|
|
20
|
+
"domain",
|
|
21
|
+
"namespaces",
|
|
22
|
+
"*",
|
|
23
|
+
"models",
|
|
24
|
+
"*",
|
|
25
|
+
"relations"
|
|
26
|
+
];
|
|
27
|
+
const DOMAIN_MODEL_STORAGE_PATTERN = [
|
|
28
|
+
"domain",
|
|
29
|
+
"namespaces",
|
|
30
|
+
"*",
|
|
31
|
+
"models",
|
|
32
|
+
"*",
|
|
33
|
+
"storage"
|
|
34
|
+
];
|
|
35
|
+
const STORAGE_NAMESPACE_ENTRIES_PATTERN = [
|
|
36
|
+
"storage",
|
|
37
|
+
"namespaces",
|
|
38
|
+
"*",
|
|
39
|
+
"entries"
|
|
40
|
+
];
|
|
41
|
+
const TOP_LEVEL_ORDER = [
|
|
42
|
+
"schemaVersion",
|
|
43
|
+
"canonicalVersion",
|
|
44
|
+
"targetFamily",
|
|
45
|
+
"target",
|
|
46
|
+
"profileHash",
|
|
47
|
+
"roots",
|
|
48
|
+
"domain",
|
|
49
|
+
"storage",
|
|
50
|
+
"execution",
|
|
51
|
+
"capabilities",
|
|
52
|
+
"extensions",
|
|
53
|
+
"defaultControlPolicy",
|
|
54
|
+
"meta"
|
|
55
|
+
];
|
|
56
|
+
function isDefaultValue(value) {
|
|
57
|
+
if (value === false) return true;
|
|
58
|
+
if (value === null) return false;
|
|
59
|
+
if (Array.isArray(value) && value.length === 0) return true;
|
|
60
|
+
if (typeof value === "object" && value !== null) return Object.keys(value).length === 0;
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
function omitDefaults(obj, path, shouldPreserveEmpty) {
|
|
64
|
+
if (obj === null || typeof obj !== "object") return obj;
|
|
65
|
+
if (Array.isArray(obj)) return obj.map((item) => omitDefaults(item, path, shouldPreserveEmpty));
|
|
66
|
+
const result = {};
|
|
67
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
68
|
+
const currentPath = [...path, key];
|
|
69
|
+
if (key === "_generated") continue;
|
|
70
|
+
if (key === "generated" && value === false) continue;
|
|
71
|
+
if ((key === "onDelete" || key === "onUpdate") && value === "noAction") continue;
|
|
72
|
+
if (isDefaultValue(value)) {
|
|
73
|
+
const isRequiredDomainNamespaces = isArrayEqual(currentPath, ["domain", "namespaces"]);
|
|
74
|
+
const isDomainNamespaceSlot = matchesPathPattern(currentPath, DOMAIN_NAMESPACE_SLOT_PATTERN);
|
|
75
|
+
const isRequiredDomainModels = matchesPathPattern(currentPath, DOMAIN_MODELS_CONTAINER_PATTERN);
|
|
76
|
+
const isRequiredStorageNamespaces = isArrayEqual(currentPath, ["storage", "namespaces"]);
|
|
77
|
+
const isStorageNamespaceEntries = matchesPathPattern(currentPath, STORAGE_NAMESPACE_ENTRIES_PATTERN);
|
|
78
|
+
const isRequiredRoots = isArrayEqual(currentPath, ["roots"]);
|
|
79
|
+
const isRequiredExtensions = isArrayEqual(currentPath, ["extensions"]);
|
|
80
|
+
const isRequiredCapabilities = isArrayEqual(currentPath, ["capabilities"]);
|
|
81
|
+
const isRequiredMeta = isArrayEqual(currentPath, ["meta"]);
|
|
82
|
+
const isRequiredExecutionDefaults = isArrayEqual(currentPath, [
|
|
83
|
+
"execution",
|
|
84
|
+
"mutations",
|
|
85
|
+
"defaults"
|
|
86
|
+
]);
|
|
87
|
+
const isExtensionNamespace = currentPath.length === 2 && currentPath[0] === "extensions";
|
|
88
|
+
const isModelRelations = matchesPathPattern(currentPath, DOMAIN_MODEL_RELATIONS_PATTERN);
|
|
89
|
+
const isModelStorage = matchesPathPattern(currentPath, DOMAIN_MODEL_STORAGE_PATTERN);
|
|
90
|
+
const isNullableField = key === "nullable";
|
|
91
|
+
const isFamilyPreserved = shouldPreserveEmpty?.(currentPath) ?? false;
|
|
92
|
+
if (!isRequiredDomainNamespaces && !isDomainNamespaceSlot && !isRequiredDomainModels && !isRequiredStorageNamespaces && !isStorageNamespaceEntries && !isRequiredRoots && !isRequiredExtensions && !isRequiredCapabilities && !isRequiredMeta && !isRequiredExecutionDefaults && !isExtensionNamespace && !isModelRelations && !isModelStorage && !isNullableField && !isFamilyPreserved) continue;
|
|
93
|
+
}
|
|
94
|
+
result[key] = omitDefaults(value, currentPath, shouldPreserveEmpty);
|
|
95
|
+
}
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
function sortObjectKeys(obj) {
|
|
99
|
+
if (obj === null || typeof obj !== "object") return obj;
|
|
100
|
+
if (Array.isArray(obj)) return obj.map((item) => sortObjectKeys(item));
|
|
101
|
+
const sorted = {};
|
|
102
|
+
const keys = Object.keys(obj).sort();
|
|
103
|
+
for (const key of keys) sorted[key] = sortObjectKeys(obj[key]);
|
|
104
|
+
return sorted;
|
|
105
|
+
}
|
|
106
|
+
function orderTopLevel(obj) {
|
|
107
|
+
const ordered = {};
|
|
108
|
+
const remaining = new Set(Object.keys(obj));
|
|
109
|
+
for (const key of TOP_LEVEL_ORDER) if (remaining.has(key)) {
|
|
110
|
+
ordered[key] = obj[key];
|
|
111
|
+
remaining.delete(key);
|
|
112
|
+
}
|
|
113
|
+
for (const key of Array.from(remaining).sort()) ordered[key] = obj[key];
|
|
114
|
+
return ordered;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Object-form variant of {@link canonicalizeContract}. Exported because the
|
|
118
|
+
* emitter writes the canonical contract through a separate JSON-stringify
|
|
119
|
+
* pass and consumes the structured object directly.
|
|
120
|
+
*/
|
|
121
|
+
function canonicalizeContractToObject(contract, options) {
|
|
122
|
+
const serialized = options.serializeContract(contract);
|
|
123
|
+
const withDefaultsOmitted = omitDefaults({
|
|
124
|
+
...ifDefined("schemaVersion", options.schemaVersion),
|
|
125
|
+
targetFamily: serialized["targetFamily"],
|
|
126
|
+
target: serialized["target"],
|
|
127
|
+
profileHash: serialized["profileHash"],
|
|
128
|
+
roots: serialized["roots"],
|
|
129
|
+
domain: serialized["domain"],
|
|
130
|
+
storage: serialized["storage"],
|
|
131
|
+
...ifDefined("execution", serialized["execution"]),
|
|
132
|
+
extensions: serialized["extensions"],
|
|
133
|
+
capabilities: serialized["capabilities"],
|
|
134
|
+
...ifDefined("defaultControlPolicy", serialized["defaultControlPolicy"]),
|
|
135
|
+
meta: serialized["meta"]
|
|
136
|
+
}, [], options.shouldPreserveEmpty);
|
|
137
|
+
return orderTopLevel(sortObjectKeys(options.sortStorage ? {
|
|
138
|
+
...withDefaultsOmitted,
|
|
139
|
+
storage: options.sortStorage(withDefaultsOmitted["storage"])
|
|
140
|
+
} : withDefaultsOmitted));
|
|
141
|
+
}
|
|
142
|
+
function canonicalizeContract(contract, options) {
|
|
143
|
+
return JSON.stringify(canonicalizeContractToObject(contract, options), null, 2);
|
|
144
|
+
}
|
|
145
|
+
const SCHEMA_VERSION = "1";
|
|
146
|
+
function omitNamespaceKindsForHash(storage) {
|
|
147
|
+
if (!isPlainRecord(storage)) return storage;
|
|
148
|
+
const namespaces = storage["namespaces"];
|
|
149
|
+
if (!isPlainRecord(namespaces)) return storage;
|
|
150
|
+
const stripped = {};
|
|
151
|
+
for (const [nsId, ns] of Object.entries(namespaces)) if (isPlainRecord(ns)) {
|
|
152
|
+
const { kind: _kind, ...rest } = ns;
|
|
153
|
+
stripped[nsId] = rest;
|
|
154
|
+
} else stripped[nsId] = ns;
|
|
155
|
+
return {
|
|
156
|
+
...storage,
|
|
157
|
+
namespaces: stripped
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function sha256(content) {
|
|
161
|
+
const hash = createHash("sha256");
|
|
162
|
+
hash.update(content);
|
|
163
|
+
return hash.digest("hex");
|
|
164
|
+
}
|
|
165
|
+
function hashContract(section) {
|
|
166
|
+
const { shouldPreserveEmpty, sortStorage, ...sectionData } = section;
|
|
167
|
+
const storageForHash = omitNamespaceKindsForHash(sectionData["storage"] ?? {});
|
|
168
|
+
return canonicalizeContract(blindCast({
|
|
169
|
+
targetFamily: sectionData["targetFamily"],
|
|
170
|
+
target: sectionData["target"],
|
|
171
|
+
roots: {},
|
|
172
|
+
domain: { namespaces: {} },
|
|
173
|
+
execution: sectionData["execution"],
|
|
174
|
+
extensions: {},
|
|
175
|
+
capabilities: sectionData["capabilities"] ?? {},
|
|
176
|
+
meta: {},
|
|
177
|
+
profileHash: "",
|
|
178
|
+
...sectionData,
|
|
179
|
+
storage: storageForHash
|
|
180
|
+
}), {
|
|
181
|
+
schemaVersion: SCHEMA_VERSION,
|
|
182
|
+
serializeContract: (c) => castAs(JSON.parse(JSON.stringify(c))),
|
|
183
|
+
...ifDefined("shouldPreserveEmpty", shouldPreserveEmpty),
|
|
184
|
+
...ifDefined("sortStorage", sortStorage)
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
function computeStorageHash(args) {
|
|
188
|
+
return blindCast(sha256(hashContract(args)));
|
|
189
|
+
}
|
|
190
|
+
function computeExecutionHash(args) {
|
|
191
|
+
return blindCast(sha256(hashContract(args)));
|
|
192
|
+
}
|
|
193
|
+
function computeProfileHash(args) {
|
|
194
|
+
return blindCast(sha256(hashContract(args)));
|
|
195
|
+
}
|
|
196
|
+
//#endregion
|
|
197
|
+
export { computeStorageHash as a, computeProfileHash as i, canonicalizeContractToObject as n, computeExecutionHash as r, canonicalizeContract as t };
|
|
198
|
+
|
|
199
|
+
//# sourceMappingURL=hashing-BtIZVNYX.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashing-BtIZVNYX.mjs","names":[],"sources":["../../../../1-framework/0-foundation/contract/dist/hashing.mjs"],"sourcesContent":["import { n as matchesPathPattern } from \"./canonicalization-path-match-CNgHuwM_.mjs\";\nimport { t as isPlainRecord } from \"./is-plain-record-CUofyVQ7.mjs\";\nimport { blindCast, castAs } from \"@internal/utils/casts\";\nimport { isArrayEqual } from \"@internal/utils/array-equal\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { createHash } from \"node:crypto\";\n//#region src/canonicalization.ts\nconst DOMAIN_NAMESPACE_SLOT_PATTERN = [\n\t\"domain\",\n\t\"namespaces\",\n\t\"*\"\n];\nconst DOMAIN_MODELS_CONTAINER_PATTERN = [\n\t\"domain\",\n\t\"namespaces\",\n\t\"*\",\n\t\"models\"\n];\nconst DOMAIN_MODEL_RELATIONS_PATTERN = [\n\t\"domain\",\n\t\"namespaces\",\n\t\"*\",\n\t\"models\",\n\t\"*\",\n\t\"relations\"\n];\nconst DOMAIN_MODEL_STORAGE_PATTERN = [\n\t\"domain\",\n\t\"namespaces\",\n\t\"*\",\n\t\"models\",\n\t\"*\",\n\t\"storage\"\n];\nconst STORAGE_NAMESPACE_ENTRIES_PATTERN = [\n\t\"storage\",\n\t\"namespaces\",\n\t\"*\",\n\t\"entries\"\n];\nconst TOP_LEVEL_ORDER = [\n\t\"schemaVersion\",\n\t\"canonicalVersion\",\n\t\"targetFamily\",\n\t\"target\",\n\t\"profileHash\",\n\t\"roots\",\n\t\"domain\",\n\t\"storage\",\n\t\"execution\",\n\t\"capabilities\",\n\t\"extensions\",\n\t\"defaultControlPolicy\",\n\t\"meta\"\n];\nfunction isDefaultValue(value) {\n\tif (value === false) return true;\n\tif (value === null) return false;\n\tif (Array.isArray(value) && value.length === 0) return true;\n\tif (typeof value === \"object\" && value !== null) return Object.keys(value).length === 0;\n\treturn false;\n}\nfunction omitDefaults(obj, path, shouldPreserveEmpty) {\n\tif (obj === null || typeof obj !== \"object\") return obj;\n\tif (Array.isArray(obj)) return obj.map((item) => omitDefaults(item, path, shouldPreserveEmpty));\n\tconst result = {};\n\tfor (const [key, value] of Object.entries(obj)) {\n\t\tconst currentPath = [...path, key];\n\t\tif (key === \"_generated\") continue;\n\t\tif (key === \"generated\" && value === false) continue;\n\t\tif ((key === \"onDelete\" || key === \"onUpdate\") && value === \"noAction\") continue;\n\t\tif (isDefaultValue(value)) {\n\t\t\tconst isRequiredDomainNamespaces = isArrayEqual(currentPath, [\"domain\", \"namespaces\"]);\n\t\t\tconst isDomainNamespaceSlot = matchesPathPattern(currentPath, DOMAIN_NAMESPACE_SLOT_PATTERN);\n\t\t\tconst isRequiredDomainModels = matchesPathPattern(currentPath, DOMAIN_MODELS_CONTAINER_PATTERN);\n\t\t\tconst isRequiredStorageNamespaces = isArrayEqual(currentPath, [\"storage\", \"namespaces\"]);\n\t\t\tconst isStorageNamespaceEntries = matchesPathPattern(currentPath, STORAGE_NAMESPACE_ENTRIES_PATTERN);\n\t\t\tconst isRequiredRoots = isArrayEqual(currentPath, [\"roots\"]);\n\t\t\tconst isRequiredExtensions = isArrayEqual(currentPath, [\"extensions\"]);\n\t\t\tconst isRequiredCapabilities = isArrayEqual(currentPath, [\"capabilities\"]);\n\t\t\tconst isRequiredMeta = isArrayEqual(currentPath, [\"meta\"]);\n\t\t\tconst isRequiredExecutionDefaults = isArrayEqual(currentPath, [\n\t\t\t\t\"execution\",\n\t\t\t\t\"mutations\",\n\t\t\t\t\"defaults\"\n\t\t\t]);\n\t\t\tconst isExtensionNamespace = currentPath.length === 2 && currentPath[0] === \"extensions\";\n\t\t\tconst isModelRelations = matchesPathPattern(currentPath, DOMAIN_MODEL_RELATIONS_PATTERN);\n\t\t\tconst isModelStorage = matchesPathPattern(currentPath, DOMAIN_MODEL_STORAGE_PATTERN);\n\t\t\tconst isNullableField = key === \"nullable\";\n\t\t\tconst isFamilyPreserved = shouldPreserveEmpty?.(currentPath) ?? false;\n\t\t\tif (!isRequiredDomainNamespaces && !isDomainNamespaceSlot && !isRequiredDomainModels && !isRequiredStorageNamespaces && !isStorageNamespaceEntries && !isRequiredRoots && !isRequiredExtensions && !isRequiredCapabilities && !isRequiredMeta && !isRequiredExecutionDefaults && !isExtensionNamespace && !isModelRelations && !isModelStorage && !isNullableField && !isFamilyPreserved) continue;\n\t\t}\n\t\tresult[key] = omitDefaults(value, currentPath, shouldPreserveEmpty);\n\t}\n\treturn result;\n}\nfunction sortObjectKeys(obj) {\n\tif (obj === null || typeof obj !== \"object\") return obj;\n\tif (Array.isArray(obj)) return obj.map((item) => sortObjectKeys(item));\n\tconst sorted = {};\n\tconst keys = Object.keys(obj).sort();\n\tfor (const key of keys) sorted[key] = sortObjectKeys(obj[key]);\n\treturn sorted;\n}\nfunction orderTopLevel(obj) {\n\tconst ordered = {};\n\tconst remaining = new Set(Object.keys(obj));\n\tfor (const key of TOP_LEVEL_ORDER) if (remaining.has(key)) {\n\t\tordered[key] = obj[key];\n\t\tremaining.delete(key);\n\t}\n\tfor (const key of Array.from(remaining).sort()) ordered[key] = obj[key];\n\treturn ordered;\n}\n/**\n* Object-form variant of {@link canonicalizeContract}. Exported because the\n* emitter writes the canonical contract through a separate JSON-stringify\n* pass and consumes the structured object directly.\n*/\nfunction canonicalizeContractToObject(contract, options) {\n\tconst serialized = options.serializeContract(contract);\n\tconst withDefaultsOmitted = omitDefaults({\n\t\t...ifDefined(\"schemaVersion\", options.schemaVersion),\n\t\ttargetFamily: serialized[\"targetFamily\"],\n\t\ttarget: serialized[\"target\"],\n\t\tprofileHash: serialized[\"profileHash\"],\n\t\troots: serialized[\"roots\"],\n\t\tdomain: serialized[\"domain\"],\n\t\tstorage: serialized[\"storage\"],\n\t\t...ifDefined(\"execution\", serialized[\"execution\"]),\n\t\textensions: serialized[\"extensions\"],\n\t\tcapabilities: serialized[\"capabilities\"],\n\t\t...ifDefined(\"defaultControlPolicy\", serialized[\"defaultControlPolicy\"]),\n\t\tmeta: serialized[\"meta\"]\n\t}, [], options.shouldPreserveEmpty);\n\treturn orderTopLevel(sortObjectKeys(options.sortStorage ? {\n\t\t...withDefaultsOmitted,\n\t\tstorage: options.sortStorage(withDefaultsOmitted[\"storage\"])\n\t} : withDefaultsOmitted));\n}\nfunction canonicalizeContract(contract, options) {\n\treturn JSON.stringify(canonicalizeContractToObject(contract, options), null, 2);\n}\n//#endregion\n//#region src/hashing.ts\nconst SCHEMA_VERSION = \"1\";\nfunction omitNamespaceKindsForHash(storage) {\n\tif (!isPlainRecord(storage)) return storage;\n\tconst namespaces = storage[\"namespaces\"];\n\tif (!isPlainRecord(namespaces)) return storage;\n\tconst stripped = {};\n\tfor (const [nsId, ns] of Object.entries(namespaces)) if (isPlainRecord(ns)) {\n\t\tconst { kind: _kind, ...rest } = ns;\n\t\tstripped[nsId] = rest;\n\t} else stripped[nsId] = ns;\n\treturn {\n\t\t...storage,\n\t\tnamespaces: stripped\n\t};\n}\nfunction sha256(content) {\n\tconst hash = createHash(\"sha256\");\n\thash.update(content);\n\treturn hash.digest(\"hex\");\n}\nfunction hashContract(section) {\n\tconst { shouldPreserveEmpty, sortStorage, ...sectionData } = section;\n\tconst storageForHash = omitNamespaceKindsForHash(sectionData[\"storage\"] ?? {});\n\treturn canonicalizeContract(blindCast({\n\t\ttargetFamily: sectionData[\"targetFamily\"],\n\t\ttarget: sectionData[\"target\"],\n\t\troots: {},\n\t\tdomain: { namespaces: {} },\n\t\texecution: sectionData[\"execution\"],\n\t\textensions: {},\n\t\tcapabilities: sectionData[\"capabilities\"] ?? {},\n\t\tmeta: {},\n\t\tprofileHash: \"\",\n\t\t...sectionData,\n\t\tstorage: storageForHash\n\t}), {\n\t\tschemaVersion: SCHEMA_VERSION,\n\t\tserializeContract: (c) => castAs(JSON.parse(JSON.stringify(c))),\n\t\t...ifDefined(\"shouldPreserveEmpty\", shouldPreserveEmpty),\n\t\t...ifDefined(\"sortStorage\", sortStorage)\n\t});\n}\nfunction computeStorageHash(args) {\n\treturn blindCast(sha256(hashContract(args)));\n}\nfunction computeExecutionHash(args) {\n\treturn blindCast(sha256(hashContract(args)));\n}\nfunction computeProfileHash(args) {\n\treturn blindCast(sha256(hashContract(args)));\n}\n//#endregion\nexport { canonicalizeContract, canonicalizeContractToObject, computeExecutionHash, computeProfileHash, computeStorageHash };\n\n//# sourceMappingURL=hashing.mjs.map"],"mappings":";;;;;;;AAOA,MAAM,gCAAgC;CACrC;CACA;CACA;AACD;AACA,MAAM,kCAAkC;CACvC;CACA;CACA;CACA;AACD;AACA,MAAM,iCAAiC;CACtC;CACA;CACA;CACA;CACA;CACA;AACD;AACA,MAAM,+BAA+B;CACpC;CACA;CACA;CACA;CACA;CACA;AACD;AACA,MAAM,oCAAoC;CACzC;CACA;CACA;CACA;AACD;AACA,MAAM,kBAAkB;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAC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UAAU;EACrC,cAAc,YAAY;EAC1B,QAAQ,YAAY;EACpB,OAAO,CAAC;EACR,QAAQ,EAAE,YAAY,CAAC,EAAE;EACzB,WAAW,YAAY;EACvB,YAAY,CAAC;EACb,cAAc,YAAY,mBAAmB,CAAC;EAC9C,MAAM,CAAC;EACP,aAAa;EACb,GAAG;EACH,SAAS;CACV,CAAC,GAAG;EACH,eAAe;EACf,oBAAoB,MAAM,OAAO,KAAK,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC;EAC9D,GAAG,UAAU,uBAAuB,mBAAmB;EACvD,GAAG,UAAU,eAAe,WAAW;CACxC,CAAC;AACF;AACA,SAAS,mBAAmB,MAAM;CACjC,OAAO,UAAU,OAAO,aAAa,IAAI,CAAC,CAAC;AAC5C;AACA,SAAS,qBAAqB,MAAM;CACnC,OAAO,UAAU,OAAO,aAAa,IAAI,CAAC,CAAC;AAC5C;AACA,SAAS,mBAAmB,MAAM;CACjC,OAAO,UAAU,OAAO,aAAa,IAAI,CAAC,CAAC;AAC5C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { A as ExecutionHashBase, W as ProfileHashBase, X as StorageHashBase } from "./domain-envelope-D6Wn9AmZ-BqZKTT9U.mjs";
|
|
2
|
+
import { i as StorageSort, n as PreserveEmptyPredicate } from "./canonicalization-DFpB09nP-4OdB2nsy.mjs";
|
|
3
|
+
//#region ../../../1-framework/0-foundation/contract/dist/hashing.d.mts
|
|
4
|
+
//#region src/hashing.d.ts
|
|
5
|
+
type ComputeStorageHashArgs = {
|
|
6
|
+
target: string;
|
|
7
|
+
targetFamily: string;
|
|
8
|
+
storage: Record<string, unknown>;
|
|
9
|
+
readonly shouldPreserveEmpty?: PreserveEmptyPredicate;
|
|
10
|
+
readonly sortStorage?: StorageSort;
|
|
11
|
+
};
|
|
12
|
+
declare function computeStorageHash(args: ComputeStorageHashArgs): StorageHashBase<string>;
|
|
13
|
+
declare function computeExecutionHash(args: {
|
|
14
|
+
target: string;
|
|
15
|
+
targetFamily: string;
|
|
16
|
+
execution: Record<string, unknown>;
|
|
17
|
+
}): ExecutionHashBase<string>;
|
|
18
|
+
declare function computeProfileHash(args: {
|
|
19
|
+
target: string;
|
|
20
|
+
targetFamily: string;
|
|
21
|
+
capabilities: Record<string, Record<string, boolean>>;
|
|
22
|
+
}): ProfileHashBase<string>;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { computeProfileHash as n, computeStorageHash as r, computeExecutionHash as t };
|
|
25
|
+
//# sourceMappingURL=hashing-CccSPELN.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashing-CccSPELN.d.mts","names":[],"sources":["../../../../1-framework/0-foundation/contract/dist/hashing.d.mts"],"mappings":";;;;KAGK;EACH;EACA;EACA,SAAS;WACA,sBAAsB;WACtB,cAAc;;iBAER,mBAAmB,MAAM,yBAAyB;iBAClD,qBAAqB;EACpC;EACA;EACA,WAAW;IACT;iBACa,mBAAmB;EAClC;EACA;EACA,cAAc,eAAe;IAC3B"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { t as isPlainRecord } from "./is-plain-record-CUofyVQ7-DWEzdhIx.mjs";
|
|
2
|
+
//#region ../../../1-framework/0-foundation/contract/dist/hashing-utils.mjs
|
|
3
|
+
function compareCodeUnits(a, b) {
|
|
4
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
5
|
+
}
|
|
6
|
+
function compareByNameProperty(a, b) {
|
|
7
|
+
return compareCodeUnits(isPlainRecord(a) && typeof a["name"] === "string" ? a["name"] : "", isPlainRecord(b) && typeof b["name"] === "string" ? b["name"] : "");
|
|
8
|
+
}
|
|
9
|
+
function sortArrayKeysOnRecord(record, arrayKeys, compare) {
|
|
10
|
+
const sorted = { ...record };
|
|
11
|
+
for (const key of arrayKeys) {
|
|
12
|
+
const value = record[key];
|
|
13
|
+
if (Array.isArray(value)) sorted[key] = [...value].sort(compare);
|
|
14
|
+
}
|
|
15
|
+
return sorted;
|
|
16
|
+
}
|
|
17
|
+
function walkAndSort(node, pathSegments, arrayKeys, compare) {
|
|
18
|
+
if (pathSegments.length === 0) {
|
|
19
|
+
if (!isPlainRecord(node)) return node;
|
|
20
|
+
return sortArrayKeysOnRecord(node, arrayKeys, compare);
|
|
21
|
+
}
|
|
22
|
+
if (!isPlainRecord(node)) return node;
|
|
23
|
+
const [head, ...rest] = pathSegments;
|
|
24
|
+
if (head === void 0) return node;
|
|
25
|
+
if (head === "*") {
|
|
26
|
+
const sorted = { ...node };
|
|
27
|
+
for (const key of Object.keys(node)) sorted[key] = walkAndSort(node[key], rest, arrayKeys, compare);
|
|
28
|
+
return sorted;
|
|
29
|
+
}
|
|
30
|
+
const child = node[head];
|
|
31
|
+
if (child === void 0) return node;
|
|
32
|
+
return {
|
|
33
|
+
...node,
|
|
34
|
+
[head]: walkAndSort(child, rest, arrayKeys, compare)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function createStorageSort(targets, compare = compareByNameProperty) {
|
|
38
|
+
return (storage) => {
|
|
39
|
+
if (!isPlainRecord(storage)) return storage;
|
|
40
|
+
let result = storage;
|
|
41
|
+
for (const target of targets) result = walkAndSort(result, target.path, target.arrayKeys, compare);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { createStorageSort as n, compareByNameProperty as t };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=hashing-utils-DQgS3nOe.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashing-utils-DQgS3nOe.mjs","names":[],"sources":["../../../../1-framework/0-foundation/contract/dist/hashing-utils.mjs"],"sourcesContent":["import { n as matchesPathPattern, t as createPreserveEmptyPredicate } from \"./canonicalization-path-match-CNgHuwM_.mjs\";\nimport { t as isPlainRecord } from \"./is-plain-record-CUofyVQ7.mjs\";\n//#region src/canonicalization-storage-sort.ts\nfunction compareCodeUnits(a, b) {\n\treturn a < b ? -1 : a > b ? 1 : 0;\n}\nfunction compareByNameProperty(a, b) {\n\treturn compareCodeUnits(isPlainRecord(a) && typeof a[\"name\"] === \"string\" ? a[\"name\"] : \"\", isPlainRecord(b) && typeof b[\"name\"] === \"string\" ? b[\"name\"] : \"\");\n}\nfunction sortArrayKeysOnRecord(record, arrayKeys, compare) {\n\tconst sorted = { ...record };\n\tfor (const key of arrayKeys) {\n\t\tconst value = record[key];\n\t\tif (Array.isArray(value)) sorted[key] = [...value].sort(compare);\n\t}\n\treturn sorted;\n}\nfunction walkAndSort(node, pathSegments, arrayKeys, compare) {\n\tif (pathSegments.length === 0) {\n\t\tif (!isPlainRecord(node)) return node;\n\t\treturn sortArrayKeysOnRecord(node, arrayKeys, compare);\n\t}\n\tif (!isPlainRecord(node)) return node;\n\tconst [head, ...rest] = pathSegments;\n\tif (head === void 0) return node;\n\tif (head === \"*\") {\n\t\tconst sorted = { ...node };\n\t\tfor (const key of Object.keys(node)) sorted[key] = walkAndSort(node[key], rest, arrayKeys, compare);\n\t\treturn sorted;\n\t}\n\tconst child = node[head];\n\tif (child === void 0) return node;\n\treturn {\n\t\t...node,\n\t\t[head]: walkAndSort(child, rest, arrayKeys, compare)\n\t};\n}\nfunction createStorageSort(targets, compare = compareByNameProperty) {\n\treturn (storage) => {\n\t\tif (!isPlainRecord(storage)) return storage;\n\t\tlet result = storage;\n\t\tfor (const target of targets) result = walkAndSort(result, target.path, target.arrayKeys, compare);\n\t\treturn result;\n\t};\n}\n//#endregion\nexport { compareByNameProperty, createPreserveEmptyPredicate, createStorageSort, matchesPathPattern };\n\n//# sourceMappingURL=hashing-utils.mjs.map"],"mappings":";;AAGA,SAAS,iBAAiB,GAAG,GAAG;CAC/B,OAAO,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI;AACjC;AACA,SAAS,sBAAsB,GAAG,GAAG;CACpC,OAAO,iBAAiB,cAAc,CAAC,KAAK,OAAO,EAAE,YAAY,WAAW,EAAE,UAAU,IAAI,cAAc,CAAC,K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../1-framework/0-foundation/contract/dist/hashing-utils.d.mts
|
|
3
|
+
//#region src/canonicalization-path-match.d.ts
|
|
4
|
+
type PathSegment = string | '*' | readonly string[];
|
|
5
|
+
type PathPattern = readonly PathSegment[];
|
|
6
|
+
declare function matchesPathPattern(path: readonly string[], pattern: PathPattern): boolean;
|
|
7
|
+
declare function createPreserveEmptyPredicate(patterns: readonly PathPattern[]): PreserveEmptyPredicate;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/canonicalization-storage-sort.d.ts
|
|
10
|
+
type PathSegment$1 = string | '*';
|
|
11
|
+
interface NamedArraySortTarget {
|
|
12
|
+
readonly path: readonly PathSegment$1[];
|
|
13
|
+
readonly arrayKeys: readonly string[];
|
|
14
|
+
}
|
|
15
|
+
declare function compareByNameProperty(a: unknown, b: unknown): number;
|
|
16
|
+
declare function createStorageSort(targets: readonly NamedArraySortTarget[], compare?: (a: unknown, b: unknown) => number): StorageSort;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { compareByNameProperty as a, matchesPathPattern as c, PathSegment$1 as i, PathPattern as n, createPreserveEmptyPredicate as o, PathSegment as r, createStorageSort as s, NamedArraySortTarget as t };
|
|
19
|
+
//# sourceMappingURL=hashing-utils-qKu59RSC.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashing-utils-qKu59RSC.d.mts","names":[],"sources":["../../../../1-framework/0-foundation/contract/dist/hashing-utils.d.mts"],"mappings":";;;KAEK;KACA,uBAAuB;iBACX,mBAAmB,yBAAyB,SAAS;iBACrD,6BAA6B,mBAAmB,gBAAgB;;;KAG5E;UACK;WACC,eAAe;WACf;;iBAEM,sBAAsB,YAAY;iBAClC,kBAAkB,kBAAkB,wBAAwB,WAAW,YAAY,wBAAwB"}
|
package/dist/ids.d.mts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { N as ExecutionMutationDefaultValue } from "./domain-envelope-D6Wn9AmZ-BqZKTT9U.mjs";
|
|
2
|
+
import { a as ColumnTypeDescriptor } from "./codec-D3GVAkR_.mjs";
|
|
3
|
+
import { cuid2 as cuid2$1 } from "uniku/cuid2";
|
|
4
|
+
import { ksuid as ksuid$1 } from "uniku/ksuid";
|
|
5
|
+
import { nanoid as nanoid$1 } from "uniku/nanoid";
|
|
6
|
+
import { ulid as ulid$1 } from "uniku/ulid";
|
|
7
|
+
import { uuidv4 as uuidv4$1 } from "uniku/uuid/v4";
|
|
8
|
+
import { uuidv7 as uuidv7$1 } from "uniku/uuid/v7";
|
|
9
|
+
//#region ../../../1-framework/2-authoring/ids/dist/index.d.mts
|
|
10
|
+
//#region src/generator-ids.d.ts
|
|
11
|
+
declare const builtinGeneratorIds: readonly ["ulid", "nanoid", "uuidv7", "uuidv4", "cuid2", "ksuid"];
|
|
12
|
+
type BuiltinGeneratorId = (typeof builtinGeneratorIds)[number];
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/generators.d.ts
|
|
15
|
+
type FirstArg<TFunction> = TFunction extends ((...args: infer TArgs) => unknown) ? TArgs extends [] ? undefined : TArgs[0] : never;
|
|
16
|
+
type IdGeneratorOptionsById = {
|
|
17
|
+
readonly ulid: FirstArg<typeof ulid$1>;
|
|
18
|
+
readonly nanoid: FirstArg<typeof nanoid$1>;
|
|
19
|
+
readonly uuidv7: FirstArg<typeof uuidv7$1>;
|
|
20
|
+
readonly uuidv4: FirstArg<typeof uuidv4$1>;
|
|
21
|
+
readonly cuid2: FirstArg<typeof cuid2$1>;
|
|
22
|
+
readonly ksuid: FirstArg<typeof ksuid$1>;
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/index.d.ts
|
|
26
|
+
declare const builtinGeneratorRegistryMetadata: ReadonlyArray<{
|
|
27
|
+
readonly id: BuiltinGeneratorId;
|
|
28
|
+
readonly applicableCodecIds: readonly string[];
|
|
29
|
+
}>;
|
|
30
|
+
type GeneratedColumnSpec<TCodecId extends string = string> = {
|
|
31
|
+
readonly type: ColumnTypeDescriptor<TCodecId>;
|
|
32
|
+
readonly nullable?: false;
|
|
33
|
+
readonly typeParams?: Record<string, unknown>;
|
|
34
|
+
readonly generated: ExecutionMutationDefaultValue;
|
|
35
|
+
};
|
|
36
|
+
declare const ulid: (options?: IdGeneratorOptionsById["ulid"]) => GeneratedColumnSpec<"sql/char@1">;
|
|
37
|
+
declare const nanoid: (options?: IdGeneratorOptionsById["nanoid"]) => GeneratedColumnSpec<"sql/char@1">;
|
|
38
|
+
declare const uuidv7: (options?: IdGeneratorOptionsById["uuidv7"]) => GeneratedColumnSpec<"sql/char@1">;
|
|
39
|
+
declare const uuidv4: (options?: IdGeneratorOptionsById["uuidv4"]) => GeneratedColumnSpec<"sql/char@1">;
|
|
40
|
+
declare const cuid2: (options?: IdGeneratorOptionsById["cuid2"]) => GeneratedColumnSpec<"sql/char@1">;
|
|
41
|
+
declare const ksuid: (options?: IdGeneratorOptionsById["ksuid"]) => GeneratedColumnSpec<"sql/char@1">;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { GeneratedColumnSpec, builtinGeneratorIds, builtinGeneratorRegistryMetadata, cuid2, ksuid, nanoid, ulid, uuidv4, uuidv7 };
|
|
44
|
+
//# sourceMappingURL=ids.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.d.mts","names":[],"sources":["../../../../1-framework/2-authoring/ids/dist/index.d.mts"],"mappings":";;;;;;;;;;cASc;KACT,6BAA6B;;;KAG7B,SAAS,aAAa,uBAAuB,YAAY,qBAAqB,+BAA+B;KAC7G;WACM,MAAM,gBAAgB;WACtB,QAAQ,gBAAgB;WACxB,QAAQ,gBAAgB;WACxB,QAAQ,gBAAgB;WACxB,OAAO,gBAAgB;WACvB,OAAO,gBAAgB;;;;cAIpB,kCAAkC;WACrC,IAAI;WACJ;;KAEN,oBAAoB;WACd,MAAM,qBAAqB;WAC3B;WACA,aAAa;WACb,WAAW;;cAER,OAAO,UAAU,mCAAmC;cACpD,SAAS,UAAU,qCAAqC;cACxD,SAAS,UAAU,qCAAqC;cACxD,SAAS,UAAU,qCAAqC;cACxD,QAAQ,UAAU,oCAAoC;cACtD,QAAQ,UAAU,oCAAoC"}
|
package/dist/ids.mjs
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { t as ifDefined } from "./defined-BQWA85QH-BRSBMULx.mjs";
|
|
2
|
+
import { a as structuredError } from "./structured-error-H6WU9Kjt.mjs";
|
|
3
|
+
//#region ../../../1-framework/2-authoring/ids/dist/index.mjs
|
|
4
|
+
function contractError(code, message, options) {
|
|
5
|
+
return structuredError(code, message, options);
|
|
6
|
+
}
|
|
7
|
+
const builtinGeneratorIds = [
|
|
8
|
+
"ulid",
|
|
9
|
+
"nanoid",
|
|
10
|
+
"uuidv7",
|
|
11
|
+
"uuidv4",
|
|
12
|
+
"cuid2",
|
|
13
|
+
"ksuid"
|
|
14
|
+
];
|
|
15
|
+
const GENERATED_CHAR_TYPE = {
|
|
16
|
+
codecId: "sql/char@1",
|
|
17
|
+
nativeType: "character"
|
|
18
|
+
};
|
|
19
|
+
function charStorage(length) {
|
|
20
|
+
return {
|
|
21
|
+
type: GENERATED_CHAR_TYPE,
|
|
22
|
+
typeParams: { length }
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function nanoidStorage(params) {
|
|
26
|
+
const rawSize = params?.["size"];
|
|
27
|
+
if (rawSize === void 0) return charStorage(21);
|
|
28
|
+
if (typeof rawSize !== "number" || !Number.isInteger(rawSize) || rawSize < 2 || rawSize > 255) throw contractError("CONTRACT.ARGUMENT_INVALID", "nanoid size must be an integer between 2 and 255", { meta: {
|
|
29
|
+
helperPath: "nanoid",
|
|
30
|
+
paramName: "size",
|
|
31
|
+
received: rawSize
|
|
32
|
+
} });
|
|
33
|
+
return charStorage(rawSize);
|
|
34
|
+
}
|
|
35
|
+
const builtinGeneratorMetadataById = {
|
|
36
|
+
ulid: {
|
|
37
|
+
applicableCodecIds: ["pg/text@1", "sql/char@1"],
|
|
38
|
+
generatedStorage: () => charStorage(26)
|
|
39
|
+
},
|
|
40
|
+
nanoid: {
|
|
41
|
+
applicableCodecIds: ["pg/text@1", "sql/char@1"],
|
|
42
|
+
generatedStorage: nanoidStorage
|
|
43
|
+
},
|
|
44
|
+
uuidv7: {
|
|
45
|
+
applicableCodecIds: [
|
|
46
|
+
"pg/text@1",
|
|
47
|
+
"sql/char@1",
|
|
48
|
+
"pg/uuid@1"
|
|
49
|
+
],
|
|
50
|
+
generatedStorage: () => charStorage(36)
|
|
51
|
+
},
|
|
52
|
+
uuidv4: {
|
|
53
|
+
applicableCodecIds: [
|
|
54
|
+
"pg/text@1",
|
|
55
|
+
"sql/char@1",
|
|
56
|
+
"pg/uuid@1"
|
|
57
|
+
],
|
|
58
|
+
generatedStorage: () => charStorage(36)
|
|
59
|
+
},
|
|
60
|
+
cuid2: {
|
|
61
|
+
applicableCodecIds: ["pg/text@1", "sql/char@1"],
|
|
62
|
+
generatedStorage: () => charStorage(24)
|
|
63
|
+
},
|
|
64
|
+
ksuid: {
|
|
65
|
+
applicableCodecIds: ["pg/text@1", "sql/char@1"],
|
|
66
|
+
generatedStorage: () => charStorage(27)
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const builtinGeneratorRegistryMetadata = builtinGeneratorIds.map((id) => ({
|
|
70
|
+
id,
|
|
71
|
+
applicableCodecIds: builtinGeneratorMetadataById[id].applicableCodecIds
|
|
72
|
+
}));
|
|
73
|
+
function createGeneratedSpec(id, options) {
|
|
74
|
+
const params = options;
|
|
75
|
+
const storage = builtinGeneratorMetadataById[id].generatedStorage(params);
|
|
76
|
+
return {
|
|
77
|
+
type: storage.type,
|
|
78
|
+
nullable: false,
|
|
79
|
+
typeParams: storage.typeParams,
|
|
80
|
+
generated: {
|
|
81
|
+
kind: "generator",
|
|
82
|
+
id,
|
|
83
|
+
...ifDefined("params", params)
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const ulid = (options) => createGeneratedSpec("ulid", options);
|
|
88
|
+
const nanoid = (options) => createGeneratedSpec("nanoid", options);
|
|
89
|
+
const uuidv7 = (options) => createGeneratedSpec("uuidv7", options);
|
|
90
|
+
const uuidv4 = (options) => createGeneratedSpec("uuidv4", options);
|
|
91
|
+
const cuid2 = (options) => createGeneratedSpec("cuid2", options);
|
|
92
|
+
const ksuid = (options) => createGeneratedSpec("ksuid", options);
|
|
93
|
+
//#endregion
|
|
94
|
+
export { builtinGeneratorIds, builtinGeneratorRegistryMetadata, cuid2, ksuid, nanoid, ulid, uuidv4, uuidv7 };
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=ids.mjs.map
|
package/dist/ids.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.mjs","names":[],"sources":["../../../../1-framework/2-authoring/ids/dist/index.mjs"],"sourcesContent":["import { ifDefined } from \"@internal/utils/defined\";\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/generator-ids.ts\nconst builtinGeneratorIds = [\n\t\"ulid\",\n\t\"nanoid\",\n\t\"uuidv7\",\n\t\"uuidv4\",\n\t\"cuid2\",\n\t\"ksuid\"\n];\n//#endregion\n//#region src/index.ts\nconst GENERATED_CHAR_TYPE = {\n\tcodecId: \"sql/char@1\",\n\tnativeType: \"character\"\n};\nfunction charStorage(length) {\n\treturn {\n\t\ttype: GENERATED_CHAR_TYPE,\n\t\ttypeParams: { length }\n\t};\n}\nfunction nanoidStorage(params) {\n\tconst rawSize = params?.[\"size\"];\n\tif (rawSize === void 0) return charStorage(21);\n\tif (typeof rawSize !== \"number\" || !Number.isInteger(rawSize) || rawSize < 2 || rawSize > 255) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", \"nanoid size must be an integer between 2 and 255\", { meta: {\n\t\thelperPath: \"nanoid\",\n\t\tparamName: \"size\",\n\t\treceived: rawSize\n\t} });\n\treturn charStorage(rawSize);\n}\nconst builtinGeneratorMetadataById = {\n\tulid: {\n\t\tapplicableCodecIds: [\"pg/text@1\", \"sql/char@1\"],\n\t\tgeneratedStorage: () => charStorage(26)\n\t},\n\tnanoid: {\n\t\tapplicableCodecIds: [\"pg/text@1\", \"sql/char@1\"],\n\t\tgeneratedStorage: nanoidStorage\n\t},\n\tuuidv7: {\n\t\tapplicableCodecIds: [\n\t\t\t\"pg/text@1\",\n\t\t\t\"sql/char@1\",\n\t\t\t\"pg/uuid@1\"\n\t\t],\n\t\tgeneratedStorage: () => charStorage(36)\n\t},\n\tuuidv4: {\n\t\tapplicableCodecIds: [\n\t\t\t\"pg/text@1\",\n\t\t\t\"sql/char@1\",\n\t\t\t\"pg/uuid@1\"\n\t\t],\n\t\tgeneratedStorage: () => charStorage(36)\n\t},\n\tcuid2: {\n\t\tapplicableCodecIds: [\"pg/text@1\", \"sql/char@1\"],\n\t\tgeneratedStorage: () => charStorage(24)\n\t},\n\tksuid: {\n\t\tapplicableCodecIds: [\"pg/text@1\", \"sql/char@1\"],\n\t\tgeneratedStorage: () => charStorage(27)\n\t}\n};\nconst builtinGeneratorRegistryMetadata = builtinGeneratorIds.map((id) => ({\n\tid,\n\tapplicableCodecIds: builtinGeneratorMetadataById[id].applicableCodecIds\n}));\nfunction createGeneratedSpec(id, options) {\n\tconst params = options;\n\tconst storage = builtinGeneratorMetadataById[id].generatedStorage(params);\n\treturn {\n\t\ttype: storage.type,\n\t\tnullable: false,\n\t\ttypeParams: storage.typeParams,\n\t\tgenerated: {\n\t\t\tkind: \"generator\",\n\t\t\tid,\n\t\t\t...ifDefined(\"params\", params)\n\t\t}\n\t};\n}\nconst ulid = (options) => createGeneratedSpec(\"ulid\", options);\nconst nanoid = (options) => createGeneratedSpec(\"nanoid\", options);\nconst uuidv7 = (options) => createGeneratedSpec(\"uuidv7\", options);\nconst uuidv4 = (options) => createGeneratedSpec(\"uuidv4\", options);\nconst cuid2 = (options) => createGeneratedSpec(\"cuid2\", options);\nconst ksuid = (options) => createGeneratedSpec(\"ksuid\", options);\n//#endregion\nexport { builtinGeneratorIds, builtinGeneratorRegistryMetadata, cuid2, ksuid, nanoid, ulid, uuidv4, uuidv7 };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;AAGA,SAAS,cAAc,MAAM,SAAS,SAAS;CAC9C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;AAGA,MAAM,sBAAsB;CAC3B;CACA;CACA;CACA;CACA;CACA;AACD;AAGA,MAAM,sBAAsB;CAC3B,SAAS;CACT,YAAY;AACb;AACA,SAAS,YAAY,QAAQ;CAC5B,OAAO;EACN,MAAM;EACN,YAAY,EAAE,OAAO;CACtB;AACD;AACA,SAAS,cAAc,QAAQ;CAC9B,MAAM,UAAU,SAAS;CACzB,IAAI,YAAY,KAAK,GAAG,OAAO,YAAY,EAAE;CAC7C,IAAI,OAAO,YAAY,YAAY,CAAC,OAAO,UAAU,OAAO,KAAK,UAAU,KAAK,UAAU,KAAK,MAAM,cAAc,6BAA6B,oDAAoD,EAAE,MAAM;EAC3M,YAAY;EACZ,WAAW;EACX,UAAU;CACX,EAAE,CAAC;CACH,OAAO,YAAY,OAAO;AAC3B;AACA,MAAM,+BAA+B;CACpC,MAAM;EACL,oBAAoB,CAAC,aAAa,YAAY;EAC9C,wBAAwB,YAAY,EAAE;CACvC;CACA,QAAQ;EACP,oBAAoB,CAAC,aAAa,YAAY;EAC9C,kBAAkB;CACnB;CACA,QAAQ;EACP,oBAAoB;GACnB;GACA;GACA;EACD;EACA,wBAAwB,YAAY,EAAE;CACvC;CACA,QAAQ;EACP,oBAAoB;GACnB;GACA;GACA;EACD;EACA,wBAAwB,YAAY,EAAE;CACvC;CACA,OAAO;EACN,oBAAoB,CAAC,aAAa,YAAY;EAC9C,wBAAwB,YAAY,EAAE;CACvC;CACA,OAAO;EACN,oBAAoB,CAAC,aAAa,YAAY;EAC9C,wBAAwB,YAAY,EAAE;CACvC;AACD;AACA,MAAM,mCAAmC,oBAAoB,KAAK,QAAQ;CACzE;CACA,oBAAoB,6BAA6B,GAAG,CAAC;AACtD,EAAE;AACF,SAAS,oBAAoB,IAAI,SAAS;CACzC,MAAM,SAAS;CACf,MAAM,UAAU,6BAA6B,GAAG,CAAC,iBAAiB,MAAM;CACxE,OAAO;EACN,MAAM,QAAQ;EACd,UAAU;EACV,YAAY,QAAQ;EACpB,WAAW;GACV,MAAM;GACN;GACA,GAAG,UAAU,UAAU,MAAM;EAC9B;CACD;AACD;AACA,MAAM,QAAQ,YAAY,oBAAoB,QAAQ,OAAO;AAC7D,MAAM,UAAU,YAAY,oBAAoB,UAAU,OAAO;AACjE,MAAM,UAAU,YAAY,oBAAoB,UAAU,OAAO;AACjE,MAAM,UAAU,YAAY,oBAAoB,UAAU,OAAO;AACjE,MAAM,SAAS,YAAY,oBAAoB,SAAS,OAAO;AAC/D,MAAM,SAAS,YAAY,oBAAoB,SAAS,OAAO"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { L as GeneratedValueSpec } from "./domain-envelope-D6Wn9AmZ-BqZKTT9U.mjs";
|
|
2
|
+
//#region ../../../1-framework/2-authoring/ids/dist/runtime.d.mts
|
|
3
|
+
//#region src/runtime.d.ts
|
|
4
|
+
declare function generateId(spec: GeneratedValueSpec): string;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { generateId };
|
|
7
|
+
//# sourceMappingURL=ids__runtime.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids__runtime.d.mts","names":[],"sources":["../../../../1-framework/2-authoring/ids/dist/runtime.d.mts"],"mappings":";;;iBAEiB,WAAW,MAAM"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { t as InternalError } from "./internal-error-BIc-ehme-ouBQPoEL.mjs";
|
|
2
|
+
import { cuid2 } from "uniku/cuid2";
|
|
3
|
+
import { ksuid } from "uniku/ksuid";
|
|
4
|
+
import { nanoid } from "uniku/nanoid";
|
|
5
|
+
import { ulid } from "uniku/ulid";
|
|
6
|
+
import { uuidv4 } from "uniku/uuid/v4";
|
|
7
|
+
import { uuidv7 } from "uniku/uuid/v7";
|
|
8
|
+
//#region ../../../1-framework/2-authoring/ids/dist/runtime.mjs
|
|
9
|
+
function invokeGenerator(generator, params) {
|
|
10
|
+
if (params === void 0) return generator();
|
|
11
|
+
return generator(params);
|
|
12
|
+
}
|
|
13
|
+
const idGenerators = {
|
|
14
|
+
ulid: (params) => invokeGenerator(ulid, params),
|
|
15
|
+
nanoid: (params) => invokeGenerator(nanoid, params),
|
|
16
|
+
uuidv7: (params) => invokeGenerator(uuidv7, params),
|
|
17
|
+
uuidv4: (params) => invokeGenerator(uuidv4, params),
|
|
18
|
+
cuid2: (params) => invokeGenerator(cuid2, params),
|
|
19
|
+
ksuid: (params) => invokeGenerator(ksuid, params)
|
|
20
|
+
};
|
|
21
|
+
function isBuiltinGeneratorId(id) {
|
|
22
|
+
return Object.hasOwn(idGenerators, id);
|
|
23
|
+
}
|
|
24
|
+
function generateId(spec) {
|
|
25
|
+
if (!isBuiltinGeneratorId(spec.id)) throw new InternalError(`Unknown built-in ID generator "${spec.id}".`);
|
|
26
|
+
return idGenerators[spec.id](spec.params);
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { generateId };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=ids__runtime.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids__runtime.mjs","names":[],"sources":["../../../../1-framework/2-authoring/ids/dist/runtime.mjs"],"sourcesContent":["import { InternalError } from \"@internal/utils/internal-error\";\nimport { cuid2 } from \"uniku/cuid2\";\nimport { ksuid } from \"uniku/ksuid\";\nimport { nanoid } from \"uniku/nanoid\";\nimport { ulid } from \"uniku/ulid\";\nimport { uuidv4 } from \"uniku/uuid/v4\";\nimport { uuidv7 } from \"uniku/uuid/v7\";\n//#region src/generators.ts\nfunction invokeGenerator(generator, params) {\n\tif (params === void 0) return generator();\n\treturn generator(params);\n}\nconst idGenerators = {\n\tulid: (params) => invokeGenerator(ulid, params),\n\tnanoid: (params) => invokeGenerator(nanoid, params),\n\tuuidv7: (params) => invokeGenerator(uuidv7, params),\n\tuuidv4: (params) => invokeGenerator(uuidv4, params),\n\tcuid2: (params) => invokeGenerator(cuid2, params),\n\tksuid: (params) => invokeGenerator(ksuid, params)\n};\n//#endregion\n//#region src/runtime.ts\nfunction isBuiltinGeneratorId(id) {\n\treturn Object.hasOwn(idGenerators, id);\n}\nfunction generateId(spec) {\n\tif (!isBuiltinGeneratorId(spec.id)) throw new InternalError(`Unknown built-in ID generator \"${spec.id}\".`);\n\treturn idGenerators[spec.id](spec.params);\n}\n//#endregion\nexport { generateId };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,gBAAgB,WAAW,QAAQ;CAC3C,IAAI,WAAW,KAAK,GAAG,OAAO,UAAU;CACxC,OAAO,UAAU,MAAM;AACxB;AACA,MAAM,eAAe;CACpB,OAAO,WAAW,gBAAgB,MAAM,MAAM;CAC9C,SAAS,WAAW,gBAAgB,QAAQ,MAAM;CAClD,SAAS,WAAW,gBAAgB,QAAQ,MAAM;CAClD,SAAS,WAAW,gBAAgB,QAAQ,MAAM;CAClD,QAAQ,WAAW,gBAAgB,OAAO,MAAM;CAChD,QAAQ,WAAW,gBAAgB,OAAO,MAAM;AACjD;AAGA,SAAS,qBAAqB,IAAI;CACjC,OAAO,OAAO,OAAO,cAAc,EAAE;AACtC;AACA,SAAS,WAAW,MAAM;CACzB,IAAI,CAAC,qBAAqB,KAAK,EAAE,GAAG,MAAM,IAAI,cAAc,kCAAkC,KAAK,GAAG,GAAG;CACzG,OAAO,aAAa,KAAK,GAAG,CAAC,KAAK,MAAM;AACzC"}
|