@prisma/orm-family-sql 8.0.0-rc.21-dev.6 → 8.0.0-rc.21-dev.7
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/dist/{attribute-specs-CM_fC-TC.d.mts → attribute-specs-DDpSUaG9.d.mts} +3 -3
- package/dist/{attribute-specs-CM_fC-TC.d.mts.map → attribute-specs-DDpSUaG9.d.mts.map} +1 -1
- package/dist/{authoring-entity-types-CgKIgWq5--Hjkn72Y.d.mts → authoring-entity-types-CgKIgWq5-BqRjoPFF.d.mts} +2 -2
- package/dist/{authoring-entity-types-CgKIgWq5--Hjkn72Y.d.mts.map → authoring-entity-types-CgKIgWq5-BqRjoPFF.d.mts.map} +1 -1
- package/dist/{config-types-BvmmK8D-.mjs → config-types-BCXwEBZH.mjs} +2 -2
- package/dist/{config-types-BvmmK8D-.mjs.map → config-types-BCXwEBZH.mjs.map} +1 -1
- package/dist/{contract-builder-Bk-Co792.mjs → contract-builder-D50r41BU.mjs} +112 -47
- package/dist/contract-builder-D50r41BU.mjs.map +1 -0
- package/dist/{contract-builder-B8oDZ4aU.d.mts → contract-builder-D6JuOGA6.d.mts} +43 -4
- package/dist/{contract-builder-B8oDZ4aU.d.mts.map → contract-builder-D6JuOGA6.d.mts.map} +1 -1
- package/dist/contract-prisma7__provider.d.mts +3 -1
- package/dist/contract-prisma7__provider.d.mts.map +1 -1
- package/dist/contract-prisma7__provider.mjs +60 -24
- package/dist/contract-prisma7__provider.mjs.map +1 -1
- package/dist/contract-psl.d.mts +1 -1
- package/dist/contract-psl.mjs +1 -1
- package/dist/contract-psl__attribute-specs.d.mts +1 -1
- package/dist/contract-psl__attribute-specs.mjs +1 -1
- package/dist/contract-psl__diagnostics.mjs +1 -1
- package/dist/contract-psl__provider.mjs +2 -2
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/contract-ts.d.mts +1 -1
- package/dist/contract-ts.mjs +3 -3
- package/dist/contract-ts__config-types.mjs +1 -1
- package/dist/contract-ts__contract-builder.d.mts +1 -1
- package/dist/contract-ts__contract-builder.mjs +2 -2
- package/dist/contract.d.mts +2 -2
- package/dist/contract.mjs +3 -3
- package/dist/contract__data-type.d.mts +2 -2
- package/dist/contract__data-type.mjs +2 -2
- package/dist/contract__validators.mjs +1 -1
- package/dist/{control-B2CeDfVO.d.mts → control-BE7gXqZF.d.mts} +3 -3
- package/dist/{control-B2CeDfVO.d.mts.map → control-BE7gXqZF.d.mts.map} +1 -1
- package/dist/{control-C1EjGUVq.mjs → control-DPCrkpMS.mjs} +10 -11
- package/dist/control-DPCrkpMS.mjs.map +1 -0
- package/dist/{control-adapter-SlQkTEwT.mjs → control-adapter-BetaUm2y.mjs} +2 -2
- package/dist/{control-adapter-SlQkTEwT.mjs.map → control-adapter-BetaUm2y.mjs.map} +1 -1
- package/dist/{data-type-CR0gi2GQ.d.mts → data-type-B-Do6RMA.d.mts} +13 -5
- package/dist/data-type-B-Do6RMA.d.mts.map +1 -0
- package/dist/{data-type-BFSpaotu.mjs → data-type-BfA5F0Qf.mjs} +2 -2
- package/dist/{data-type-BFSpaotu.mjs.map → data-type-BfA5F0Qf.mjs.map} +1 -1
- package/dist/{default-mapping-CAOONlKQ-CIg7JCfF.d.mts → default-mapping-CEISdj2g-B50Ag_F_.d.mts} +5 -11
- package/dist/default-mapping-CEISdj2g-B50Ag_F_.d.mts.map +1 -0
- package/dist/{derived-checks-BuTkSE9l-gyx0d0dX.mjs → derived-checks-D__agoFB-Boa1MHcA.mjs} +4 -4
- package/dist/{derived-checks-BuTkSE9l-gyx0d0dX.mjs.map → derived-checks-D__agoFB-Boa1MHcA.mjs.map} +1 -1
- package/dist/{diagnostics-C7jR1Jyf.mjs → diagnostics-CoM0OFuR.mjs} +40 -30
- package/dist/diagnostics-CoM0OFuR.mjs.map +1 -0
- package/dist/family.d.mts +7 -7
- package/dist/family.mjs +9 -9
- package/dist/family__control-adapter.mjs +1 -1
- package/dist/family__control.d.mts +1 -1
- package/dist/family__control.mjs +3 -3
- package/dist/family__diff.mjs +1 -1
- package/dist/family__ir.mjs +1 -1
- package/dist/family__pack.d.mts +1 -1
- package/dist/family__pack.mjs +2 -2
- package/dist/family__psl-build.d.mts +3 -3
- package/dist/family__psl-build.mjs +2 -2
- package/dist/family__psl-infer.d.mts +1 -1
- package/dist/family__runtime.d.mts +1 -1
- package/dist/family__runtime.mjs +1 -1
- package/dist/{generator-functions-Hy4pDDr9-BUHOsofo.mjs → generator-functions-Hy4pDDr9-CMfJOBtv.mjs} +2 -2
- package/dist/{generator-functions-Hy4pDDr9-BUHOsofo.mjs.map → generator-functions-Hy4pDDr9-CMfJOBtv.mjs.map} +1 -1
- package/dist/{interpreter-CrQFtK4p-CM5k_t4g.mjs → interpreter-ChvVEijY-FeJngsog.mjs} +16 -6
- package/dist/interpreter-ChvVEijY-FeJngsog.mjs.map +1 -0
- package/dist/{pack-BPbz6RVm.d.mts → pack-DKM1hv1E.d.mts} +3 -3
- package/dist/{pack-BPbz6RVm.d.mts.map → pack-DKM1hv1E.d.mts.map} +1 -1
- package/dist/psl-build-BA0Ndi1v.mjs +268 -0
- package/dist/psl-build-BA0Ndi1v.mjs.map +1 -0
- package/dist/{psl-build-CNncjpsa.d.mts → psl-build-DCZaF5g4.d.mts} +44 -15
- package/dist/psl-build-DCZaF5g4.d.mts.map +1 -0
- package/dist/{psl-column-resolution-djGEITmJ-DfEOkjPf.d.mts → psl-column-resolution-djGEITmJ-C0LSpwl4.d.mts} +2 -2
- package/dist/{psl-column-resolution-djGEITmJ-DfEOkjPf.d.mts.map → psl-column-resolution-djGEITmJ-C0LSpwl4.d.mts.map} +1 -1
- package/dist/{psl-field-resolution-Bvhx79fP-CuyYFk8z.mjs → psl-field-resolution-BW2_FOb9-DxqR43fo.mjs} +67 -37
- package/dist/psl-field-resolution-BW2_FOb9-DxqR43fo.mjs.map +1 -0
- package/dist/{psl-infer-BkkoyXmM.d.mts → psl-infer-Cr9AeccU.d.mts} +2 -2
- package/dist/{psl-infer-BkkoyXmM.d.mts.map → psl-infer-Cr9AeccU.d.mts.map} +1 -1
- package/dist/{runtime-BrBva2ta.d.mts → runtime-CSDcwOEG.d.mts} +4 -3
- package/dist/{runtime-BrBva2ta.d.mts.map → runtime-CSDcwOEG.d.mts.map} +1 -1
- package/dist/{runtime-CCzfa1mY.mjs → runtime-DkUiQi00.mjs} +12 -4
- package/dist/runtime-DkUiQi00.mjs.map +1 -0
- package/dist/{schema-verify-C3wbdviw-mlPO4NkT.mjs → schema-verify-C3wbdviw-nQ4tG9N7.mjs} +2 -2
- package/dist/{schema-verify-C3wbdviw-mlPO4NkT.mjs.map → schema-verify-C3wbdviw-nQ4tG9N7.mjs.map} +1 -1
- package/dist/{sql-contract-serializer-sMY3prTx-aQd4v3fE.mjs → sql-contract-serializer-sMY3prTx-CBHrlt9O.mjs} +2 -2
- package/dist/{sql-contract-serializer-sMY3prTx-aQd4v3fE.mjs.map → sql-contract-serializer-sMY3prTx-CBHrlt9O.mjs.map} +1 -1
- package/dist/{sql-data-type-D7M-YTTY-D2vRqDxn.mjs → sql-data-type-LVBldu1a-Bq203xWX.mjs} +13 -7
- package/dist/sql-data-type-LVBldu1a-Bq203xWX.mjs.map +1 -0
- package/dist/{validators-CnQqLEIi.mjs → validators-qcQteqs2.mjs} +2 -2
- package/dist/{validators-CnQqLEIi.mjs.map → validators-qcQteqs2.mjs.map} +1 -1
- package/package.json +18 -18
- package/dist/contract-builder-Bk-Co792.mjs.map +0 -1
- package/dist/control-C1EjGUVq.mjs.map +0 -1
- package/dist/data-type-CR0gi2GQ.d.mts.map +0 -1
- package/dist/default-mapping-CAOONlKQ-CIg7JCfF.d.mts.map +0 -1
- package/dist/diagnostics-C7jR1Jyf.mjs.map +0 -1
- package/dist/interpreter-CrQFtK4p-CM5k_t4g.mjs.map +0 -1
- package/dist/psl-build-CNncjpsa.d.mts.map +0 -1
- package/dist/psl-build-DqqYhOsa.mjs +0 -426
- package/dist/psl-build-DqqYhOsa.mjs.map +0 -1
- package/dist/psl-field-resolution-Bvhx79fP-CuyYFk8z.mjs.map +0 -1
- package/dist/runtime-CCzfa1mY.mjs.map +0 -1
- package/dist/sql-data-type-D7M-YTTY-D2vRqDxn.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./contract-builder-
|
|
2
|
-
import "./psl-column-resolution-djGEITmJ-
|
|
1
|
+
import "./contract-builder-D6JuOGA6.mjs";
|
|
2
|
+
import "./psl-column-resolution-djGEITmJ-C0LSpwl4.mjs";
|
|
3
3
|
import { DataTypeSupport } from "@prisma/orm-framework/components/authoring";
|
|
4
4
|
import "@prisma/orm-framework/contract/types";
|
|
5
5
|
import { PslSources } from "@prisma/orm-framework/psl-parser/syntax";
|
|
@@ -112,4 +112,4 @@ declare const sqlAttributeSpecs: {
|
|
|
112
112
|
declare function describeUnsupportedSqlAttribute(sources: PslSources): DescribeUnsupportedAttribute;
|
|
113
113
|
//#endregion
|
|
114
114
|
export { EnumMemberListDefault as a, sqlAttributeSpecs as c, EnumMemberDefault as i, DefaultFunctionCall as n, ParsedNullLiteral as o, DefaultFunctionSignature as r, defaultFunctionCall as s, describeUnsupportedSqlAttribute as t };
|
|
115
|
-
//# sourceMappingURL=attribute-specs-
|
|
115
|
+
//# sourceMappingURL=attribute-specs-DDpSUaG9.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attribute-specs-
|
|
1
|
+
{"version":3,"file":"attribute-specs-DDpSUaG9.d.mts","names":[],"sources":["../../../../2-sql-family/2-authoring/contract-psl/dist/sql-attribute-specs-CK9iRCBj.d.mts","../../../../2-sql-family/2-authoring/contract-psl/dist/attribute-specs.d.mts"],"mappings":";;;;;;;;;;UAOU;WACC;WACA;;;UAGD;WACC;WACA,MAAM;;;UAGP;WACC;WACA,oBAAoB,oBAAoB;;;UAGzC;WACC;WACA,MAAM;;KAEZ,kBAAkB,sBAAsB,oBAAoB,kBAAkB,sBAAsB,qBAAqB,sBAAsB,oBAAoB;;KAEnK,2BAA2B,gBAAgB,WAAW,oBAAoB;;;;iBAI9D,oBAAoB,cAAc,OAAO,6BAA6B,WAAW,kBAAkB,QAAQ,eAAe;iBAC1H,eAAe,KAAK,uBAAuB;EAC1D;WACS,4CAA4C;WAC5C,uCAAuC;WACvC;WACA;WACA;WACA;WACA,UAAU;GAClB;iBACc,eAAe,KAAK,uBAAuB;WACjD,2CAA2C;WAC3C;WACA;GACR;;cAEW;WACH;aACE,MAAM,MAAM,yBAAyB;MAC5C;OACC;aACM,KAAK,MAAM,yBAAyB;MAC3C;eACS;OACR;aACM,SAAS,MAAM,yBAAyB;MAC/C;eACS;OACR;aACM,cAAc;aACd,cAAc;aACd,UAAU,MAAM,yBAAyB;MAChD;OACC;aACM,gBAAgB,MAAM,yBAAyB;MACtD;OACC;aACM,OAAO,MAAM,yBAAyB;MAC7C,qCAAqC,wBAAwB;MAC7D,OAAO;OACN;;WAEI;aACE,MAAM,MAAM,8BAA8B;MACjD;OACC;aACM,KAAK,MAAM,8BAA8B;eACvC;OACR;aACM,SAAS,MAAM,8BAA8B;eAC3C;OACR;aACM,WAAW,MAAM,8BAA8B;MACtD;eACS;eACA;eACA;eACA;eACA;eACA;OACR;aACM,UAAU,KAAK,8BAA8B;MACpD,OAAO;OACN;aACM,WAAW,KAAK,8BAA8B;MACrD,OAAO;OACN;aACM,WAAW,KAAK,8BAA8B;MACrD,OAAO;OACN;;;;;;iBC3FU,gCAAgC,SAAS,aAAa"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./contract-builder-
|
|
1
|
+
import "./contract-builder-D6JuOGA6.mjs";
|
|
2
2
|
import "@prisma/orm-framework/components/authoring";
|
|
3
3
|
import "@prisma/orm-framework/psl-parser";
|
|
4
4
|
//#region ../../../2-sql-family/9-family/dist/authoring-entity-types-CgKIgWq5.d.mts
|
|
@@ -6,4 +6,4 @@ import "@prisma/orm-framework/psl-parser";
|
|
|
6
6
|
declare function sqlFamilyEnumSpec(): import("@prisma/orm-framework/psl-parser").MapBlockSpec<Record<string, string | number | boolean | import("@prisma/orm-framework/components/authoring").WrittenScalar | (string | number | boolean | import("@prisma/orm-framework/components/authoring").WrittenScalar)[] | undefined>>;
|
|
7
7
|
//#endregion
|
|
8
8
|
export { sqlFamilyEnumSpec as t };
|
|
9
|
-
//# sourceMappingURL=authoring-entity-types-CgKIgWq5
|
|
9
|
+
//# sourceMappingURL=authoring-entity-types-CgKIgWq5-BqRjoPFF.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authoring-entity-types-CgKIgWq5
|
|
1
|
+
{"version":3,"file":"authoring-entity-types-CgKIgWq5-BqRjoPFF.d.mts","names":[],"sources":["../../../../2-sql-family/9-family/dist/authoring-entity-types-CgKIgWq5.d.mts"],"mappings":";;;;;iBAIiB,oDAAoD,aAAa,8FAA8F,gGAAgG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as buildSqlContractFromDefinition, r as contractError, t as applySqlSpecifierControlPolicy } from "./derived-checks-
|
|
1
|
+
import { n as buildSqlContractFromDefinition, r as contractError, t as applySqlSpecifierControlPolicy } from "./derived-checks-D__agoFB-Boa1MHcA.mjs";
|
|
2
2
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
3
3
|
import { createDataTypeLookup, emptyCodecLookup } from "@prisma/orm-framework/components/codec";
|
|
4
4
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
@@ -65,4 +65,4 @@ function typescriptContractFromPath(contractPath, output, options) {
|
|
|
65
65
|
//#endregion
|
|
66
66
|
export { typescriptContract as n, typescriptContractFromPath as r, emptyContract as t };
|
|
67
67
|
|
|
68
|
-
//# sourceMappingURL=config-types-
|
|
68
|
+
//# sourceMappingURL=config-types-BCXwEBZH.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-types-
|
|
1
|
+
{"version":3,"file":"config-types-BCXwEBZH.mjs","names":[],"sources":["../../../../2-sql-family/2-authoring/contract-ts/dist/config-types.mjs"],"sourcesContent":["import { n as buildSqlContractFromDefinition, s as contractError, t as applySqlSpecifierControlPolicy } from \"./derived-checks-D__agoFB.mjs\";\nimport { createDataTypeLookup, emptyCodecLookup } from \"@internal/framework-components/codec\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { pathToFileURL } from \"node:url\";\nimport { ok } from \"@internal/utils/result\";\nimport { extname } from \"pathe\";\n//#region src/config-types.ts\n/**\n* Derives the emit output path from the TS contract input so artefacts land\n* colocated with the source (e.g. `prisma/contract.ts` →\n* `prisma/contract.json`). Mirrors the same default-derivation logic in\n* `@internal/sql-contract-psl/provider`.\n*/\nfunction defaultOutputFromContractPath(contractPath) {\n\tconst ext = extname(contractPath);\n\tif (ext.length === 0) return `${contractPath}.json`;\n\treturn `${contractPath.slice(0, -ext.length)}.json`;\n}\nfunction emptyContract(options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"typescript\",\n\t\t\tload: async () => {\n\t\t\t\treturn ok(applySqlSpecifierControlPolicy(buildSqlContractFromDefinition({\n\t\t\t\t\twarnings: void 0,\n\t\t\t\t\ttarget: options.target,\n\t\t\t\t\tcreateNamespace: options.createNamespace,\n\t\t\t\t\tmodels: []\n\t\t\t\t}, {\n\t\t\t\t\t...emptyCodecLookup,\n\t\t\t\t\tdescriptorFor: () => void 0\n\t\t\t\t}, createDataTypeLookup([])), options.defaultControlPolicy, options.createNamespace));\n\t\t\t}\n\t\t},\n\t\t...ifDefined(\"output\", options.output)\n\t};\n}\nfunction typescriptContract(contract, output, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"typescript\",\n\t\t\tload: async () => ok(options === void 0 ? contract : applySqlSpecifierControlPolicy(contract, options.defaultControlPolicy, options.createNamespace))\n\t\t},\n\t\t...ifDefined(\"output\", output)\n\t};\n}\nfunction typescriptContractFromPath(contractPath, output, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"typescript\",\n\t\t\tinputs: [contractPath],\n\t\t\tload: async (context) => {\n\t\t\t\tconst [absolutePath] = context.resolvedInputs;\n\t\t\t\tif (absolutePath === void 0) throw new InternalError(\"typescriptContractFromPath: context.resolvedInputs is empty. The CLI config loader should populate it from source.inputs.\");\n\t\t\t\tconst mod = await import(pathToFileURL(absolutePath).href);\n\t\t\t\tconst contract = mod.default ?? mod.contract;\n\t\t\t\tif (contract === void 0) throw contractError(\"CONTRACT.MODULE_EXPORT_MISSING\", `typescriptContractFromPath: module at \"${absolutePath}\" has no \"default\" or \"contract\" export.`, { meta: { path: absolutePath } });\n\t\t\t\treturn ok(options === void 0 ? contract : applySqlSpecifierControlPolicy(contract, options.defaultControlPolicy, options.createNamespace));\n\t\t\t}\n\t\t},\n\t\toutput: output ?? defaultOutputFromContractPath(contractPath)\n\t};\n}\n//#endregion\nexport { emptyContract, typescriptContract, typescriptContractFromPath };\n\n//# sourceMappingURL=config-types.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,8BAA8B,cAAc;CACpD,MAAM,MAAM,QAAQ,YAAY;CAChC,IAAI,IAAI,WAAW,GAAG,OAAO,GAAG,aAAa;CAC7C,OAAO,GAAG,aAAa,MAAM,GAAG,CAAC,IAAI,MAAM,EAAE;AAC9C;AACA,SAAS,cAAc,SAAS;CAC/B,OAAO;EACN,QAAQ;GACP,QAAQ;GACR,MAAM,YAAY;IACjB,OAAO,GAAG,+BAA+B,+BAA+B;KACvE,UAAU,KAAK;KACf,QAAQ,QAAQ;KAChB,iBAAiB,QAAQ;KACzB,QAAQ,CAAC;IACV,GAAG;KACF,GAAG;KACH,qBAAqB,KAAK;IAC3B,GAAG,qBAAqB,CAAC,CAAC,CAAC,GAAG,QAAQ,sBAAsB,QAAQ,eAAe,CAAC;GACrF;EACD;EACA,GAAG,UAAU,UAAU,QAAQ,MAAM;CACtC;AACD;AACA,SAAS,mBAAmB,UAAU,QAAQ,SAAS;CACtD,OAAO;EACN,QAAQ;GACP,QAAQ;GACR,MAAM,YAAY,GAAG,YAAY,KAAK,IAAI,WAAW,+BAA+B,UAAU,QAAQ,sBAAsB,QAAQ,eAAe,CAAC;EACrJ;EACA,GAAG,UAAU,UAAU,MAAM;CAC9B;AACD;AACA,SAAS,2BAA2B,cAAc,QAAQ,SAAS;CAClE,OAAO;EACN,QAAQ;GACP,QAAQ;GACR,QAAQ,CAAC,YAAY;GACrB,MAAM,OAAO,YAAY;IACxB,MAAM,CAAC,gBAAgB,QAAQ;IAC/B,IAAI,iBAAiB,KAAK,GAAG,MAAM,IAAI,cAAc,2HAA2H;IAChL,MAAM,MAAM,MAAM,OAAO,cAAc,YAAY,CAAC,CAAC;IACrD,MAAM,WAAW,IAAI,WAAW,IAAI;IACpC,IAAI,aAAa,KAAK,GAAG,MAAM,cAAc,kCAAkC,0CAA0C,aAAa,2CAA2C,EAAE,MAAM,EAAE,MAAM,aAAa,EAAE,CAAC;IACjN,OAAO,GAAG,YAAY,KAAK,IAAI,WAAW,+BAA+B,UAAU,QAAQ,sBAAsB,QAAQ,eAAe,CAAC;GAC1I;EACD;EACA,QAAQ,UAAU,8BAA8B,YAAY;CAC7D;AACD"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { d as sqlColumnLength } from "./sql-data-type-
|
|
1
|
+
import { d as sqlColumnLength } from "./sql-data-type-LVBldu1a-Bq203xWX.mjs";
|
|
2
2
|
import { t as providesEntityHandleLowering } from "./entity-handle-lowering-hook-BJZSlVVF.mjs";
|
|
3
3
|
import { n as generatedIdColumnAliases, t as GENERATED_ID_COLUMN_ALIAS_NAMESPACES } from "./generated-id-column-aliases-DPUii1fN.mjs";
|
|
4
4
|
import { a as isSqlExpression, c as requireSqlExpression, r as SqlExpression, s as readSqlExpression } from "./sql-expression-CKgKznXS.mjs";
|
|
5
5
|
import { t as CODEC_INSTANCE_KIND } from "./types-CISwoRED.mjs";
|
|
6
|
-
import { n as checkSqlDefaultText, o as reservedSqlDefaultText } from "./validators-
|
|
7
|
-
import { a as refuseTypesKey, n as buildSqlContractFromDefinition, r as contractError, s as toOneNullabilityContradictionMessage } from "./derived-checks-
|
|
6
|
+
import { n as checkSqlDefaultText, o as reservedSqlDefaultText } from "./validators-qcQteqs2.mjs";
|
|
7
|
+
import { a as refuseTypesKey, n as buildSqlContractFromDefinition, r as contractError, s as toOneNullabilityContradictionMessage } from "./derived-checks-D__agoFB-Boa1MHcA.mjs";
|
|
8
8
|
import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
9
9
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
10
|
-
import { assembleDataTypeSupport, assertNoCrossRegistryCollisions, assertTypeAliasesValid, describeAdmittedForms, instantiateAuthoringTypeAlias, instantiateAuthoringTypeConstructor, isAuthoringEntityTypeDescriptor, isAuthoringTypeAliasDescriptor, isAuthoringTypeConstructorDescriptor, isAuthoringTypeDescriptor, readWrittenValueAs, validateAuthoringHelperArguments, validateAuthoringTypeParams } from "@prisma/orm-framework/components/authoring";
|
|
10
|
+
import { assembleDataTypeSupport, assertNoCrossRegistryCollisions, assertTypeAliasesValid, assertTypeChoicesValid, describeAdmittedForms, instantiateAuthoringTypeAlias, instantiateAuthoringTypeCall, instantiateAuthoringTypeConstructor, isAuthoringEntityTypeDescriptor, isAuthoringTypeAliasDescriptor, isAuthoringTypeChoiceDescriptor, isAuthoringTypeConstructorDescriptor, isAuthoringTypeDescriptor, readWrittenValueAs, resolveAuthoringTypeChoice, typeChoiceArgumentsFromObject, typeConstructorLookup, validateAuthoringHelperArguments, validateAuthoringTypeChoiceParams, validateAuthoringTypeParams } from "@prisma/orm-framework/components/authoring";
|
|
11
11
|
import { isColumnDefault } from "@prisma/orm-framework/contract/types";
|
|
12
12
|
import { dataTypeId, numeralText } from "@prisma/orm-framework/components/codec";
|
|
13
13
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
14
|
-
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
14
|
+
import { InternalError, isInternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
15
15
|
import { assembleGeneratorFunctions, createGeneratorHelpers } from "@prisma/orm-framework/components/components";
|
|
16
16
|
import { answerMissingPropertyReads, assertSafeAuthoringHelperKey, bindEnumType, composePackAuthoringNamespace, createEntityHelpersFromNamespace, enumType, isEnumTypeHandle, member, resolveToOneRelationNullable } from "@prisma/orm-framework/contract-authoring";
|
|
17
17
|
import { UNBOUND_PSL_NAMESPACE_NAME } from "@prisma/orm-framework/components/psl-ast";
|
|
@@ -47,12 +47,12 @@ function readValueArgument(label, value, dataType, dataTypes) {
|
|
|
47
47
|
return read.ok ? read.value.value : refuse(read.failure.message);
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
* The arguments of a type constructor call as the constructor receives them: each `value` argument read as a value of its data type, through the same read and cast as a PSL argument, so both give the same parameters. ADR 129, ADR 254.
|
|
50
|
+
* The arguments of a type constructor or type choice call as the constructor receives them: each `value` argument read as a value of its data type, through the same read and cast as a PSL argument, so both give the same parameters. ADR 129, ADR 254.
|
|
51
51
|
*/
|
|
52
52
|
function readValueArguments(helperPath, descriptors, args, dataTypes) {
|
|
53
53
|
return args.map((value, index) => {
|
|
54
54
|
const descriptor = descriptors?.[index];
|
|
55
|
-
if (descriptor
|
|
55
|
+
if (descriptor?.kind !== "value" || value === void 0) return value;
|
|
56
56
|
return readValueArgument(descriptor.name === void 0 ? `Argument #${index + 1} of ${helperPath}` : `Argument "${descriptor.name}" of ${helperPath}`, value, dataTypeId(descriptor.dataType), dataTypes);
|
|
57
57
|
});
|
|
58
58
|
}
|
|
@@ -76,6 +76,28 @@ function createTypeHelpersFromNamespace(namespace, lookups, path = []) {
|
|
|
76
76
|
};
|
|
77
77
|
continue;
|
|
78
78
|
}
|
|
79
|
+
if (isAuthoringTypeChoiceDescriptor(value)) {
|
|
80
|
+
const helperPath = currentPath.join(".");
|
|
81
|
+
const constructorNamed = typeConstructorLookup(namespace);
|
|
82
|
+
helpers[key] = (...written) => {
|
|
83
|
+
const args = typeChoiceArgumentsFromObject(helperPath, value, written);
|
|
84
|
+
validateAuthoringHelperArguments(helperPath, value.args, args);
|
|
85
|
+
const chosen = resolveAuthoringTypeChoice({
|
|
86
|
+
helperPath,
|
|
87
|
+
descriptor: value,
|
|
88
|
+
args: readValueArguments(helperPath, value.args, args, lookups.dataTypes),
|
|
89
|
+
constructorNamed
|
|
90
|
+
});
|
|
91
|
+
const output = instantiateAuthoringTypeConstructor(chosen.descriptor, chosen.args);
|
|
92
|
+
validateAuthoringTypeChoiceParams(helperPath, value, chosen.descriptor, output.typeParams, lookups.codecLookup.descriptorFor(output.codecId)?.paramsSchema);
|
|
93
|
+
return {
|
|
94
|
+
kind: CODEC_INSTANCE_KIND,
|
|
95
|
+
codecId: output.codecId,
|
|
96
|
+
typeParams: output.typeParams ?? {}
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
79
101
|
if (isAuthoringTypeAliasDescriptor(value)) {
|
|
80
102
|
const helperPath = currentPath.join(".");
|
|
81
103
|
helpers[key] = (...args) => {
|
|
@@ -657,12 +679,29 @@ function applyNaming(name, strategy) {
|
|
|
657
679
|
return result;
|
|
658
680
|
}
|
|
659
681
|
const GUIDE = "The upgrade guide \"Field presets are removed\" lists every rewrite.";
|
|
660
|
-
/** The
|
|
661
|
-
|
|
682
|
+
/** The explicit type constructor at the dotted `path`. */
|
|
683
|
+
const explicit = (path) => ({
|
|
684
|
+
path: path.split("."),
|
|
685
|
+
options: void 0
|
|
686
|
+
});
|
|
687
|
+
/** The type choice at `path`, called with `options`. */
|
|
688
|
+
const choice = (path, options = {}) => ({
|
|
689
|
+
path: path.split("."),
|
|
690
|
+
options
|
|
691
|
+
});
|
|
692
|
+
/** The call to `type` as TypeScript writes it, with `precision` when given: one object of arguments for a type choice, and a positional argument for an explicit type. */
|
|
693
|
+
function typeCall({ path, options }, precision) {
|
|
694
|
+
const name = `type.${path.join(".")}`;
|
|
695
|
+
if (options === void 0) return `${name}(${precision ?? ""})`;
|
|
696
|
+
const members = [...Object.entries(options).map(([option, value]) => `${option}: '${value}'`), ...precision === void 0 ? [] : [`precision: ${precision}`]];
|
|
697
|
+
return members.length === 0 ? `${name}()` : `${name}({ ${members.join(", ")} })`;
|
|
698
|
+
}
|
|
699
|
+
/** The row of a preset whose rewrite is the column of `type`, then `chain`. */
|
|
700
|
+
function writtenAs(type, codecId, chain = "") {
|
|
662
701
|
return [{
|
|
663
|
-
type
|
|
702
|
+
type,
|
|
664
703
|
codecId,
|
|
665
|
-
rewrite
|
|
704
|
+
rewrite: `field.column(${typeCall(type)})${chain}`
|
|
666
705
|
}];
|
|
667
706
|
}
|
|
668
707
|
/** The `type.` prefix of a namespace, such as `sql.` for `['sql']`. */
|
|
@@ -670,7 +709,10 @@ const prefixOf = (namespace) => namespace.map((name) => `${name}.`).join("");
|
|
|
670
709
|
/** The rows of a preset whose rewrite `write` makes from each namespace's `type.` prefix, each named where that namespace has the generated id column alias `alias`. */
|
|
671
710
|
function idAlias(alias, write) {
|
|
672
711
|
return GENERATED_ID_COLUMN_ALIAS_NAMESPACES.map((namespace) => ({
|
|
673
|
-
type:
|
|
712
|
+
type: {
|
|
713
|
+
path: [...namespace, alias],
|
|
714
|
+
options: void 0
|
|
715
|
+
},
|
|
674
716
|
codecId: generatedIdColumnAliases[alias].output.type.codecId,
|
|
675
717
|
rewrite: write(prefixOf(namespace))
|
|
676
718
|
}));
|
|
@@ -679,23 +721,33 @@ const column$1 = (prefix, type) => `field.column(type.${prefix}${type})`;
|
|
|
679
721
|
const id = (columnText, generator) => `${columnText}.id().onCreate(gen.${generator})`;
|
|
680
722
|
const aliasColumn = (alias) => idAlias(alias, (prefix) => column$1(prefix, `${alias}()`));
|
|
681
723
|
const aliasId = (alias, generator) => idAlias(alias, (prefix) => id(column$1(prefix, `${alias}()`), generator));
|
|
682
|
-
const withPhases = (type, codecId, precision) =>
|
|
724
|
+
const withPhases = (type, codecId, precision) => [{
|
|
725
|
+
type,
|
|
726
|
+
codecId,
|
|
727
|
+
rewrite: `field.column(${typeCall(type, precision ? "p" : void 0)}), with .onCreate(gen.now()) and .onUpdate(gen.now()) for the phases the preset set${precision ? `, and without ${type.options === void 0 ? "p" : "precision: p"} when it set no precision` : ""}`
|
|
728
|
+
}];
|
|
729
|
+
const SQLITE_DATETIME = "sqlite/datetime@1";
|
|
730
|
+
const CREATED = ".onCreate(gen.now())";
|
|
731
|
+
const UPDATED = ".onCreate(gen.now()).onUpdate(gen.now())";
|
|
732
|
+
const TEMPORAL_DATE_TIME = choice("DateTime", { as: "temporal" });
|
|
733
|
+
const STRING_DATE_TIME = choice("DateTime", { as: "string" });
|
|
734
|
+
/** Each removed SQL preset and its rewrites. A date and time preset is written with the convenience call that gives the explicit type it stored, where one does (ADR 279). */
|
|
683
735
|
const PRESETS = {
|
|
684
736
|
uuidString: aliasColumn("UuidString"),
|
|
685
737
|
ulid: aliasColumn("Ulid"),
|
|
686
738
|
nanoid: idAlias("Nanoid", (prefix) => `${column$1(prefix, "Nanoid()")}, or ${column$1(prefix, "Char(n)")} for nanoid({ size: n })`),
|
|
687
739
|
cuid2: aliasColumn("Cuid2"),
|
|
688
740
|
ksuid: aliasColumn("Ksuid"),
|
|
689
|
-
text: writtenAs("
|
|
690
|
-
int: writtenAs("
|
|
691
|
-
bigint: writtenAs("
|
|
692
|
-
float: writtenAs("
|
|
693
|
-
decimal: writtenAs("
|
|
694
|
-
boolean: writtenAs("
|
|
695
|
-
json: writtenAs("
|
|
696
|
-
bytes: writtenAs("
|
|
697
|
-
dateTime: writtenAs(
|
|
698
|
-
uuidNative: writtenAs("
|
|
741
|
+
text: writtenAs(explicit("String"), "pg/text@1"),
|
|
742
|
+
int: writtenAs(explicit("Int"), "pg/int4@1"),
|
|
743
|
+
bigint: writtenAs(explicit("BigInt"), "pg/int8@1"),
|
|
744
|
+
float: writtenAs(explicit("Float"), "pg/float8@1"),
|
|
745
|
+
decimal: writtenAs(explicit("Decimal"), "pg/numeric@1"),
|
|
746
|
+
boolean: writtenAs(explicit("Boolean"), "pg/bool@1"),
|
|
747
|
+
json: writtenAs(explicit("Jsonb"), "pg/jsonb@1"),
|
|
748
|
+
bytes: writtenAs(explicit("Bytes"), "pg/bytea@1"),
|
|
749
|
+
dateTime: writtenAs(TEMPORAL_DATE_TIME, "pg/timestamptz-temporal@1"),
|
|
750
|
+
uuidNative: writtenAs(explicit("Uuid"), "pg/uuid@1"),
|
|
699
751
|
generated: idAlias("UuidString", (prefix) => `${column$1(prefix, "Char(n)")}.onCreate(gen.fn()), such as ${column$1(prefix, "UuidString()")}.onCreate(gen.uuid()) for field.generated(uuidv4())`),
|
|
700
752
|
"id.uuidv4String": aliasId("UuidString", "uuid()"),
|
|
701
753
|
"id.uuidv7String": aliasId("UuidString", "uuid(7)"),
|
|
@@ -703,38 +755,50 @@ const PRESETS = {
|
|
|
703
755
|
"id.nanoid": idAlias("Nanoid", (prefix) => `${id(column$1(prefix, "Nanoid()"), "nanoid()")}, or ${id(column$1(prefix, "Char(n)"), "nanoid(n)")} for id.nanoid({ size: n })`),
|
|
704
756
|
"id.cuid2": aliasId("Cuid2", "cuid(2)"),
|
|
705
757
|
"id.ksuid": aliasId("Ksuid", "ksuid()"),
|
|
706
|
-
"id.uuidv4Native": writtenAs(
|
|
707
|
-
"id.uuidv7Native": writtenAs(
|
|
708
|
-
"temporal.createdAt": writtenAs("
|
|
709
|
-
"temporal.updatedAt": writtenAs("
|
|
710
|
-
"temporal.createdAtString": writtenAs("
|
|
711
|
-
"temporal.updatedAtString": writtenAs("
|
|
712
|
-
"temporal.createdAtJsDate": writtenAs("
|
|
713
|
-
"temporal.updatedAtJsDate": writtenAs("
|
|
714
|
-
"temporal.timestamp": withPhases("TimestampTemporal", "pg/timestamp-temporal@1", true),
|
|
715
|
-
"temporal.timestamptz": withPhases(
|
|
716
|
-
"temporal.timestampString": withPhases("
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
"temporal.
|
|
721
|
-
"temporal.
|
|
722
|
-
"temporal.
|
|
723
|
-
"temporal.
|
|
724
|
-
"temporal.
|
|
758
|
+
"id.uuidv4Native": writtenAs(explicit("Uuid"), "pg/uuid@1", ".id().onCreate(gen.uuid())"),
|
|
759
|
+
"id.uuidv7Native": writtenAs(explicit("Uuid"), "pg/uuid@1", ".id().onCreate(gen.uuid(7))"),
|
|
760
|
+
"temporal.createdAt": [...writtenAs(TEMPORAL_DATE_TIME, "pg/timestamptz-temporal@1", CREATED), ...writtenAs(explicit("temporal.CreatedAt"), SQLITE_DATETIME)],
|
|
761
|
+
"temporal.updatedAt": [...writtenAs(TEMPORAL_DATE_TIME, "pg/timestamptz-temporal@1", UPDATED), ...writtenAs(explicit("temporal.UpdatedAt"), SQLITE_DATETIME)],
|
|
762
|
+
"temporal.createdAtString": writtenAs(STRING_DATE_TIME, "pg/timestamptz-string@1", CREATED),
|
|
763
|
+
"temporal.updatedAtString": writtenAs(STRING_DATE_TIME, "pg/timestamptz-string@1", UPDATED),
|
|
764
|
+
"temporal.createdAtJsDate": writtenAs(explicit("TimestamptzJsDate"), "pg/timestamptz-date@1", CREATED),
|
|
765
|
+
"temporal.updatedAtJsDate": writtenAs(explicit("TimestamptzJsDate"), "pg/timestamptz-date@1", UPDATED),
|
|
766
|
+
"temporal.timestamp": withPhases(explicit("TimestampTemporal"), "pg/timestamp-temporal@1", true),
|
|
767
|
+
"temporal.timestamptz": withPhases(TEMPORAL_DATE_TIME, "pg/timestamptz-temporal@1", true),
|
|
768
|
+
"temporal.timestampString": withPhases(choice("DateTime", {
|
|
769
|
+
as: "string",
|
|
770
|
+
storage: "timestamp"
|
|
771
|
+
}), "pg/timestamp-string@1", true),
|
|
772
|
+
"temporal.timestamptzString": withPhases(STRING_DATE_TIME, "pg/timestamptz-string@1", true),
|
|
773
|
+
"temporal.timestamptzJsDate": withPhases(explicit("TimestamptzJsDate"), "pg/timestamptz-date@1", true),
|
|
774
|
+
"temporal.date": withPhases(choice("Date", { as: "temporal" }), "pg/date-temporal@1", false),
|
|
775
|
+
"temporal.dateString": withPhases(choice("Date"), "pg/date-string@1", false),
|
|
776
|
+
"temporal.time": withPhases(choice("Time", { as: "temporal" }), "pg/time-temporal@1", true),
|
|
777
|
+
"temporal.timeString": withPhases(choice("Time"), "pg/time-string@1", true),
|
|
778
|
+
"temporal.timetz": withPhases(choice("Time", { storage: "timetz" }), "pg/timetz@1", true),
|
|
779
|
+
"temporal.datetime": withPhases(explicit("DateTime"), SQLITE_DATETIME, false)
|
|
725
780
|
};
|
|
726
|
-
|
|
781
|
+
/** The codec a column of `type` is stored with in `types`, a type choice resolved with its options as a column resolves it; `undefined` when `types` has no such type or the options choose none. */
|
|
782
|
+
function codecIdAt(types, path, options) {
|
|
727
783
|
const [name, ...rest] = path;
|
|
728
784
|
if (name === void 0 || !Object.hasOwn(types, name)) return void 0;
|
|
729
785
|
const value = types[name];
|
|
730
786
|
if (value === void 0) return void 0;
|
|
731
|
-
if (!isAuthoringTypeDescriptor(value)) return codecIdAt(value, rest);
|
|
787
|
+
if (!isAuthoringTypeDescriptor(value)) return codecIdAt(value, rest, options);
|
|
732
788
|
if (rest.length > 0) return void 0;
|
|
789
|
+
if (isAuthoringTypeChoiceDescriptor(value)) {
|
|
790
|
+
const args = value.args.map((argument) => argument.name !== void 0 && options !== void 0 && Object.hasOwn(options, argument.name) ? options[argument.name] : void 0);
|
|
791
|
+
try {
|
|
792
|
+
return instantiateAuthoringTypeCall(types, name, args).codecId;
|
|
793
|
+
} catch (error) {
|
|
794
|
+
if (isInternalError(error) || !(error instanceof Error)) throw error;
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
}
|
|
733
798
|
return isAuthoringTypeAliasDescriptor(value) ? value.output.type.codecId : value.output.codecId;
|
|
734
799
|
}
|
|
735
800
|
function appliesTo(preset, types) {
|
|
736
|
-
|
|
737
|
-
return codecId !== void 0 && (preset.codecId === void 0 || codecId === preset.codecId);
|
|
801
|
+
return codecIdAt(types, preset.type.path, preset.type.options) === preset.codecId;
|
|
738
802
|
}
|
|
739
803
|
function refuse(path, types) {
|
|
740
804
|
const helper = `field.${path}`;
|
|
@@ -791,6 +855,7 @@ function createComposedAuthoringHelpers(options) {
|
|
|
791
855
|
const entityNamespace = composeEntityNamespace(components);
|
|
792
856
|
assertNoCrossRegistryCollisions(typeNamespace, entityNamespace);
|
|
793
857
|
assertNoBuiltInEntityCollisions(entityNamespace);
|
|
858
|
+
for (const component of components) assertTypeChoicesValid(component.authoring?.type ?? {}, component.id ?? "<unknown>");
|
|
794
859
|
const { support } = assembleDataTypeSupport(components, (codecId) => options.codecLookup.descriptorFor(codecId)?.dataType);
|
|
795
860
|
const helperLookups = {
|
|
796
861
|
codecLookup: options.codecLookup,
|
|
@@ -1865,4 +1930,4 @@ function autoincrement() {
|
|
|
1865
1930
|
//#endregion
|
|
1866
1931
|
export { check as a, enumType as c, member as d, model as f, buildContractDefinition as i, extensionModel as l, rel as m, bindEnumType as n, createComposedAuthoringHelpers as o, now as p, buildBoundContract as r, defineContract as s, autoincrement as t, field as u };
|
|
1867
1932
|
|
|
1868
|
-
//# sourceMappingURL=contract-builder-
|
|
1933
|
+
//# sourceMappingURL=contract-builder-D50r41BU.mjs.map
|