@prisma/orm-target-postgres 8.0.0-rc.21-dev.13 → 8.0.0-rc.21-dev.15
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/{adapter-BdL6nOY0.d.mts → adapter-B52C9G6y.d.mts} +3 -3
- package/dist/{adapter-BdL6nOY0.d.mts.map → adapter-B52C9G6y.d.mts.map} +1 -1
- package/dist/{adapter-t3IEEEbY-BKJyNGtz.mjs → adapter-DJoHcCZV-CWdrs4yI.mjs} +3 -3
- package/dist/{adapter-t3IEEEbY-BKJyNGtz.mjs.map → adapter-DJoHcCZV-CWdrs4yI.mjs.map} +1 -1
- package/dist/adapter.d.mts +7 -7
- package/dist/adapter.mjs +2 -2
- package/dist/adapter__adapter.d.mts +1 -1
- package/dist/adapter__adapter.mjs +2 -2
- package/dist/adapter__control.d.mts +1 -1
- package/dist/adapter__control.mjs +2 -2
- package/dist/adapter__control.mjs.map +1 -1
- package/dist/adapter__runtime.d.mts +1 -1
- package/dist/adapter__runtime.mjs +2 -2
- package/dist/adapter__runtime.mjs.map +1 -1
- package/dist/adapter__sql-renderer.d.mts +1 -1
- package/dist/adapter__types.d.mts +3 -3
- package/dist/{authoring-D7EAP1iG-DlpkOeVt.mjs → authoring-BFb5LVsK-CkHmM-aP.mjs} +50 -3
- package/dist/authoring-BFb5LVsK-CkHmM-aP.mjs.map +1 -0
- package/dist/{authoring-DWd5pnnV-BBX7P1wT.d.mts → authoring-BRqyCnBa-CAzlQNHw.d.mts} +5 -4
- package/dist/{authoring-DWd5pnnV-BBX7P1wT.d.mts.map → authoring-BRqyCnBa-CAzlQNHw.d.mts.map} +1 -1
- package/dist/{contract-contributions-CbLCF8jV-BOZHg83r.mjs → contract-contributions-DS1YZqxl-CipEzWQj.mjs} +17 -5
- package/dist/contract-contributions-DS1YZqxl-CipEzWQj.mjs.map +1 -0
- package/dist/{contract-free-B6-wuc6M.d.mts → contract-free-DcaYH2c5.d.mts} +6 -2
- package/dist/contract-free-DcaYH2c5.d.mts.map +1 -0
- package/dist/{contract-free-DtJ1gJxN.mjs → contract-free-DmNEp1_Y.mjs} +3 -3
- package/dist/contract-free-DmNEp1_Y.mjs.map +1 -0
- package/dist/{control-DKpIWFg_.d.mts → control-2DHRXqEz.d.mts} +5 -3
- package/dist/{control-DKpIWFg_.d.mts.map → control-2DHRXqEz.d.mts.map} +1 -1
- package/dist/{control-policy-DZzwyc3L-_Bf4iEaW.mjs → control-policy-DYDR6FhY-CPBeYqu5.mjs} +45 -10
- package/dist/control-policy-DYDR6FhY-CPBeYqu5.mjs.map +1 -0
- package/dist/{ddl-URS0VlHr--s2jpN6c.mjs → ddl-qu-IzeH4-CFpSpY0X.mjs} +11 -4
- package/dist/ddl-qu-IzeH4-CFpSpY0X.mjs.map +1 -0
- package/dist/{descriptor-meta-BPjw5dIw-DSlWgzbV.mjs → descriptor-meta-5gncreHF-BD1kpxJu.mjs} +3 -3
- package/dist/{descriptor-meta-BPjw5dIw-DSlWgzbV.mjs.map → descriptor-meta-5gncreHF-BD1kpxJu.mjs.map} +1 -1
- package/dist/{descriptor-meta-DokyxrzY-D2S-BLI0.mjs → descriptor-meta-CszCf4Hs-DVGeuxNv.mjs} +4 -4
- package/dist/{descriptor-meta-DokyxrzY-D2S-BLI0.mjs.map → descriptor-meta-CszCf4Hs-DVGeuxNv.mjs.map} +1 -1
- package/dist/{diff-database-schema-BxzhZaVN.d.mts → diff-database-schema-COp7SqEI.d.mts} +5 -3
- package/dist/{diff-database-schema-BxzhZaVN.d.mts.map → diff-database-schema-COp7SqEI.d.mts.map} +1 -1
- package/dist/{diff-database-schema-DrOE5ahI-BfrNtMDu.mjs → diff-database-schema-DyoCp8VS-BKtXp-eB.mjs} +30 -8
- package/dist/diff-database-schema-DyoCp8VS-BKtXp-eB.mjs.map +1 -0
- package/dist/{infer-psl-contract-Du026CJo-sRmqBsId.mjs → infer-psl-contract-BP2DgxTx-BqV8gUu4.mjs} +45 -6
- package/dist/infer-psl-contract-BP2DgxTx-BqV8gUu4.mjs.map +1 -0
- package/dist/{issue-planner-BLiMn8iP.d.mts → issue-planner-BUo9S9Ge.d.mts} +3 -3
- package/dist/{issue-planner-BLiMn8iP.d.mts.map → issue-planner-BUo9S9Ge.d.mts.map} +1 -1
- package/dist/migration-Be_iuIpn.mjs.map +1 -1
- package/dist/{migration-cnT6b-9x.d.mts → migration-Drs_EeiM.d.mts} +10 -3
- package/dist/migration-Drs_EeiM.d.mts.map +1 -0
- package/dist/op-factory-call-D2HXLJQJ.d.mts +1 -0
- package/dist/{op-factory-call-DsQATX-o-BHcqPXrs.mjs → op-factory-call-DyQO1ZdB-CnbOJIf8.mjs} +115 -20
- package/dist/op-factory-call-DyQO1ZdB-CnbOJIf8.mjs.map +1 -0
- package/dist/{op-factory-call-DeaoFqMW-XAP00c7U.d.mts → op-factory-call-L1gqYhhk-DMnspvjf.d.mts} +30 -6
- package/dist/{op-factory-call-DeaoFqMW-XAP00c7U.d.mts.map → op-factory-call-L1gqYhhk-DMnspvjf.d.mts.map} +1 -1
- package/dist/{pack-CjVhjxir.d.mts → pack-DhZHVCZj.d.mts} +26 -3
- package/dist/{pack-CjVhjxir.d.mts.map → pack-DhZHVCZj.d.mts.map} +1 -1
- package/dist/{planner-RW8za3Vm.d.mts → planner-Bl3kIyMG.d.mts} +4 -4
- package/dist/{planner-RW8za3Vm.d.mts.map → planner-Bl3kIyMG.d.mts.map} +1 -1
- package/dist/{planner-CNoNH9bo-3g7WX476.mjs → planner-D1mzh6Cb-B1Z2YTiQ.mjs} +19 -13
- package/dist/planner-D1mzh6Cb-B1Z2YTiQ.mjs.map +1 -0
- package/dist/{planner-produced-postgres-migration-DnAk6KxF-Vj31eyEf.mjs → planner-produced-postgres-migration-Cw8gbwED-tyj9TLlB.mjs} +4 -4
- package/dist/{planner-produced-postgres-migration-DnAk6KxF-Vj31eyEf.mjs.map → planner-produced-postgres-migration-Cw8gbwED-tyj9TLlB.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-DtjZyo7p-CQxcHWwC.d.mts → planner-produced-postgres-migration-Cx9bERx3-DRNnR16E.d.mts} +3 -3
- package/dist/planner-produced-postgres-migration-Cx9bERx3-DRNnR16E.d.mts.map +1 -0
- package/dist/planner-produced-postgres-migration-DRPVY4iL.d.mts +1 -0
- package/dist/{planner-sql-checks-CvI80tt0-B5bKCucD.mjs → planner-sql-checks-FU4T7wgu-C-tIJOH-.mjs} +3 -3
- package/dist/{planner-sql-checks-CvI80tt0-B5bKCucD.mjs.map → planner-sql-checks-FU4T7wgu-C-tIJOH-.mjs.map} +1 -1
- package/dist/{postgres-contract-view-CRy_3BMc-60fosJRZ.mjs → postgres-contract-view-iwNgaXQw-QzVSakJT.mjs} +30 -4
- package/dist/postgres-contract-view-iwNgaXQw-QzVSakJT.mjs.map +1 -0
- package/dist/{postgres-database-schema-node-Cv8usVNX-BmvGozi4.d.mts → postgres-database-schema-node-BjmJ6_Cs-LyZ0n9oj.d.mts} +33 -5
- package/dist/postgres-database-schema-node-BjmJ6_Cs-LyZ0n9oj.d.mts.map +1 -0
- package/dist/{postgres-migration-CSU_fUlQ-C5TNpgq4.mjs → postgres-migration-BhijSOgq-CP_oflub.mjs} +29 -11
- package/dist/postgres-migration-BhijSOgq-CP_oflub.mjs.map +1 -0
- package/dist/{postgres-migration-CDPlleMc-B4JQjDcN.d.mts → postgres-migration-DNnmFBsR-BJU9865a.d.mts} +19 -2
- package/dist/{postgres-migration-CDPlleMc-B4JQjDcN.d.mts.map → postgres-migration-DNnmFBsR-BJU9865a.d.mts.map} +1 -1
- package/dist/{postgres-role-schema-node-B8Z5i5D--BzOKm4N1.mjs → postgres-role-schema-node-DuljIQWp-D6Q5JyEs.mjs} +12 -5
- package/dist/postgres-role-schema-node-DuljIQWp-D6Q5JyEs.mjs.map +1 -0
- package/dist/{postgres-schema-osNZNX0D-BpKJDg4M.mjs → postgres-schema-BBWgs4fX-DWdYxNi8.mjs} +35 -4
- package/dist/postgres-schema-BBWgs4fX-DWdYxNi8.mjs.map +1 -0
- package/dist/{postgres-schema-Xsjt3RKO-bis-SVSB.d.mts → postgres-schema-CJvUnBU9-Bvn7zbr1.d.mts} +21 -3
- package/dist/postgres-schema-CJvUnBU9-Bvn7zbr1.d.mts.map +1 -0
- package/dist/{postgres-table-schema-node-BBkitBQh-Dll8iaZT.mjs → postgres-table-schema-node-nY6II-Uv-Bj-lgmSi.mjs} +50 -6
- package/dist/postgres-table-schema-node-nY6II-Uv-Bj-lgmSi.mjs.map +1 -0
- package/dist/{prisma7-binding-DiHnmsNq.d.mts → prisma7-binding-C99OHIsY.d.mts} +47 -3
- package/dist/{prisma7-binding-DiHnmsNq.d.mts.map → prisma7-binding-C99OHIsY.d.mts.map} +1 -1
- package/dist/{prisma7-binding-CPcA6N3v.mjs → prisma7-binding-DWW3L3C4.mjs} +26 -5
- package/dist/{prisma7-binding-CPcA6N3v.mjs.map → prisma7-binding-DWW3L3C4.mjs.map} +1 -1
- package/dist/{render-ops-Cj7mog0v-DPzODjA0.mjs → render-ops-5VMQY7FM-Cdil7oOP.mjs} +3 -3
- package/dist/{render-ops-Cj7mog0v-DPzODjA0.mjs.map → render-ops-5VMQY7FM-Cdil7oOP.mjs.map} +1 -1
- package/dist/{resolve-ddl-schema-uDXEVepU-COWNfVPC.mjs → resolve-ddl-schema-BZzteXH1-C57Iavtu.mjs} +3 -3
- package/dist/{resolve-ddl-schema-uDXEVepU-COWNfVPC.mjs.map → resolve-ddl-schema-BZzteXH1-C57Iavtu.mjs.map} +1 -1
- package/dist/{runtime-DMle_B4T.d.mts → runtime-BJetnmVm.d.mts} +2 -1
- package/dist/runtime-BJetnmVm.d.mts.map +1 -0
- package/dist/{runtime-R_BCXCp_.d.mts → runtime-K2strEv6.d.mts} +3 -3
- package/dist/{runtime-R_BCXCp_.d.mts.map → runtime-K2strEv6.d.mts.map} +1 -1
- package/dist/{schema-node-kinds-C52Bb1ve-DmxQRPPS.d.mts → schema-node-kinds-Baf4tcly-CI3SyVG4.d.mts} +3 -2
- package/dist/schema-node-kinds-Baf4tcly-CI3SyVG4.d.mts.map +1 -0
- package/dist/{sql-renderer-BnO2fkSf.d.mts → sql-renderer-PT6pQ66O.d.mts} +3 -3
- package/dist/{sql-renderer-BnO2fkSf.d.mts.map → sql-renderer-PT6pQ66O.d.mts.map} +1 -1
- package/dist/target.d.mts +18 -18
- package/dist/target.mjs +18 -18
- package/dist/target__contract-free.d.mts +2 -2
- package/dist/target__contract-free.mjs +4 -4
- package/dist/target__control.mjs +44 -18
- package/dist/target__control.mjs.map +1 -1
- package/dist/target__diff-database-schema.d.mts +1 -1
- package/dist/target__diff-database-schema.mjs +1 -1
- package/dist/target__issue-planner.d.mts +1 -1
- package/dist/target__issue-planner.mjs +1 -1
- package/dist/target__migration.d.mts +2 -2
- package/dist/target__migration.mjs +2 -2
- package/dist/target__op-factory-call.d.mts +3 -3
- package/dist/target__op-factory-call.mjs +2 -2
- package/dist/target__pack.d.mts +1 -1
- package/dist/target__pack.mjs +1 -1
- package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
- package/dist/target__planner-produced-postgres-migration.mjs +1 -1
- package/dist/target__planner-sql-checks.mjs +1 -1
- package/dist/target__planner.d.mts +1 -1
- package/dist/target__planner.mjs +2 -2
- package/dist/target__prisma7-binding.d.mts +1 -1
- package/dist/target__prisma7-binding.mjs +1 -1
- package/dist/target__render-ops.mjs +1 -1
- package/dist/target__runtime.d.mts +1 -1
- package/dist/target__runtime.mjs +1 -1
- package/dist/target__runtime.mjs.map +1 -1
- package/dist/target__schema-ir-annotations.mjs +1 -1
- package/dist/target__types.d.mts +5 -5
- package/dist/target__types.mjs +4 -4
- package/dist/{types-D6lgKhE5-BrgAgVCq.d.mts → types-D6lgKhE5-DVHMZPbP.d.mts} +2 -2
- package/dist/{types-D6lgKhE5-BrgAgVCq.d.mts.map → types-D6lgKhE5-DVHMZPbP.d.mts.map} +1 -1
- package/dist/{types-D-U10Lyo.d.mts → types-D6p1198n.d.mts} +4 -4
- package/dist/{types-D-U10Lyo.d.mts.map → types-D6p1198n.d.mts.map} +1 -1
- package/dist/types-oaZIR8i0.d.mts +2 -0
- package/package.json +9 -9
- package/dist/authoring-D7EAP1iG-DlpkOeVt.mjs.map +0 -1
- package/dist/contract-contributions-CbLCF8jV-BOZHg83r.mjs.map +0 -1
- package/dist/contract-free-B6-wuc6M.d.mts.map +0 -1
- package/dist/contract-free-DtJ1gJxN.mjs.map +0 -1
- package/dist/control-policy-DZzwyc3L-_Bf4iEaW.mjs.map +0 -1
- package/dist/ddl-URS0VlHr--s2jpN6c.mjs.map +0 -1
- package/dist/diff-database-schema-DrOE5ahI-BfrNtMDu.mjs.map +0 -1
- package/dist/infer-psl-contract-Du026CJo-sRmqBsId.mjs.map +0 -1
- package/dist/migration-cnT6b-9x.d.mts.map +0 -1
- package/dist/op-factory-call-D9O6cXRE.d.mts +0 -1
- package/dist/op-factory-call-DsQATX-o-BHcqPXrs.mjs.map +0 -1
- package/dist/planner-CNoNH9bo-3g7WX476.mjs.map +0 -1
- package/dist/planner-produced-postgres-migration-DtjZyo7p-CQxcHWwC.d.mts.map +0 -1
- package/dist/planner-produced-postgres-migration-JI4uclWQ.d.mts +0 -1
- package/dist/postgres-contract-view-CRy_3BMc-60fosJRZ.mjs.map +0 -1
- package/dist/postgres-database-schema-node-Cv8usVNX-BmvGozi4.d.mts.map +0 -1
- package/dist/postgres-migration-CSU_fUlQ-C5TNpgq4.mjs.map +0 -1
- package/dist/postgres-role-schema-node-B8Z5i5D--BzOKm4N1.mjs.map +0 -1
- package/dist/postgres-schema-Xsjt3RKO-bis-SVSB.d.mts.map +0 -1
- package/dist/postgres-schema-osNZNX0D-BpKJDg4M.mjs.map +0 -1
- package/dist/postgres-table-schema-node-BBkitBQh-Dll8iaZT.mjs.map +0 -1
- package/dist/runtime-DMle_B4T.d.mts.map +0 -1
- package/dist/schema-node-kinds-C52Bb1ve-DmxQRPPS.d.mts.map +0 -1
- package/dist/types-DNbQLBpx.d.mts +0 -2
package/dist/target__control.mjs
CHANGED
|
@@ -5,22 +5,22 @@ import { t as DEFAULT_NAMESPACE_ID } from "./namespace-ids-xtp_ZY86-Cxc0dBbO.mjs
|
|
|
5
5
|
import { t as PostgresNativeEnum } from "./postgres-native-enum-CdP3b_-R-DgG3pi5p.mjs";
|
|
6
6
|
import { G as setFallbackTemporal, c as decodePostgresListText, u as parsePostgresListText } from "./codecs-BtalD4yQ-BVQxal3w.mjs";
|
|
7
7
|
import { s as fullTextIndexDefinitionOf } from "./full-text-index-definition-MfjtL-x7-ImaTAFMs.mjs";
|
|
8
|
-
import {
|
|
8
|
+
import { c as PostgresRole, i as PostgresRlsEnablement, o as PostgresRlsPolicy, t as PostgresExtension } from "./postgres-schema-BBWgs4fX-DWdYxNi8.mjs";
|
|
9
9
|
import { r as computeContentHash } from "./canonicalize-RdxoUHao-FTTkizfe.mjs";
|
|
10
|
-
import { c as postgresScalarAndNativeTypeConstructors, l as postgresScalarAuthoringTypes, s as postgresNativeAuthoringTypes, t as POLICY_BLOCK_KEYWORDS } from "./authoring-
|
|
10
|
+
import { c as postgresScalarAndNativeTypeConstructors, l as postgresScalarAuthoringTypes, s as postgresNativeAuthoringTypes, t as POLICY_BLOCK_KEYWORDS } from "./authoring-BFb5LVsK-CkHmM-aP.mjs";
|
|
11
11
|
import { t as postgresRenderCheckExpressions } from "./check-expressions-DL9WtMO5-CUcbN2JG.mjs";
|
|
12
12
|
import { u as postgresNowGeneratorControlDescriptors } from "./date-time-now-generators-CEqbD2GP-B95xid7h.mjs";
|
|
13
|
-
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-
|
|
14
|
-
import { a as
|
|
15
|
-
import { t as PostgresDatabaseSchemaNode } from "./postgres-role-schema-node-
|
|
16
|
-
import { i as qualifyTableName } from "./planner-sql-checks-
|
|
17
|
-
import {
|
|
18
|
-
import { r as diffPostgresSchema } from "./diff-database-schema-
|
|
19
|
-
import { t as PostgresContractSerializer } from "./postgres-contract-view-
|
|
20
|
-
import { o as postgresContractToSchema } from "./postgres-migration-
|
|
21
|
-
import { n as keepRowsEdit, t as createPostgresMigrationPlanner } from "./planner-
|
|
13
|
+
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-CszCf4Hs-DVGeuxNv.mjs";
|
|
14
|
+
import { a as postgresDiffSubjectEntityKind, o as postgresDiffSubjectGranularity } from "./postgres-table-schema-node-nY6II-Uv-Bj-lgmSi.mjs";
|
|
15
|
+
import { t as PostgresDatabaseSchemaNode } from "./postgres-role-schema-node-DuljIQWp-D6Q5JyEs.mjs";
|
|
16
|
+
import { i as qualifyTableName } from "./planner-sql-checks-FU4T7wgu-C-tIJOH-.mjs";
|
|
17
|
+
import { $ as schemaContentsOf, Q as schemaBlockingObjects, et as schemaObjectsSummary, q as dropCheckConstraintId, z as SCHEMA_OBJECTS_SQL } from "./op-factory-call-DyQO1ZdB-CnbOJIf8.mjs";
|
|
18
|
+
import { r as diffPostgresSchema } from "./diff-database-schema-DyoCp8VS-BKtXp-eB.mjs";
|
|
19
|
+
import { t as PostgresContractSerializer } from "./postgres-contract-view-iwNgaXQw-QzVSakJT.mjs";
|
|
20
|
+
import { o as postgresContractToSchema } from "./postgres-migration-BhijSOgq-CP_oflub.mjs";
|
|
21
|
+
import { n as keepRowsEdit, t as createPostgresMigrationPlanner } from "./planner-D1mzh6Cb-B1Z2YTiQ.mjs";
|
|
22
22
|
import { n as MARKER_LOCK_SQL, t as MARKER_LOCK_KEY } from "./marker-lock-DFc1Tfv5-BkBKBRE3.mjs";
|
|
23
|
-
import { _ as
|
|
23
|
+
import { _ as positionalArg, a as buildFullTextIndexAttribute, c as buildModelConstraintAttribute, f as inferPostgresPslContract, g as parseDefaultAttributeString, i as buildExtensionBlock, l as buildNativeEnumBlock, n as buildAttribute, o as buildIndexAttribute, p as namedArg, r as buildCheckAttribute, s as buildMapAttribute, t as SYNTHETIC_SPAN, v as typeArgument } from "./infer-psl-contract-BP2DgxTx-BqV8gUu4.mjs";
|
|
24
24
|
import { dataTypeParams, requiredParamKeys, validateCodecTypeParams } from "@prisma/orm-framework/components/codec";
|
|
25
25
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
26
26
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
@@ -1218,6 +1218,14 @@ function refuseNativeEnumControl(namespaceId, nativeEnum) {
|
|
|
1218
1218
|
control: nativeEnum.control
|
|
1219
1219
|
});
|
|
1220
1220
|
}
|
|
1221
|
+
function refuseExtensionControl(namespaceId, extension) {
|
|
1222
|
+
if (extension.control === void 0) return;
|
|
1223
|
+
throw unsupported(`extension "${extension.name}" in namespace "${namespaceId}" carries its own control policy "${extension.control}", which cannot be written in Prisma 8 PSL.`, "An `extension` block has no control attribute.", "Drop the policy from the extension, or keep authoring this contract in its current source.", {
|
|
1224
|
+
namespaceId,
|
|
1225
|
+
name: extension.name,
|
|
1226
|
+
control: extension.control
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1221
1229
|
/**
|
|
1222
1230
|
* Refuses a storage or domain namespace the PSL source would not create again: one holding nothing
|
|
1223
1231
|
* the printer writes. The PSL source creates the default namespace in both planes, a storage
|
|
@@ -1330,9 +1338,10 @@ function refuseRoleOutsideUnbound(namespaceId, name) {
|
|
|
1330
1338
|
}
|
|
1331
1339
|
const FILED_UNDER = {
|
|
1332
1340
|
rls: "The PSL source files the row-level security setting written as `@@rls` under the name of the table.",
|
|
1333
|
-
role: "The PSL source files a role under the name its block is written with."
|
|
1341
|
+
role: "The PSL source files a role under the name its block is written with.",
|
|
1342
|
+
extension: "The PSL source files an extension under the name its block is written with."
|
|
1334
1343
|
};
|
|
1335
|
-
/** Refuses a row-level security setting or
|
|
1344
|
+
/** Refuses a row-level security setting, role or extension filed under a key the PSL source would not use. */
|
|
1336
1345
|
function refuseEntryFiledUnderAnotherName(input) {
|
|
1337
1346
|
if (input.name === input.readsBackAs) return;
|
|
1338
1347
|
throw unsupported(`namespace "${input.namespaceId}" has a "${input.kind}" entry "${input.name}" that would read back as "${input.readsBackAs}", so it cannot be written in Prisma 8 PSL.`, FILED_UNDER[input.kind], KEEP_SOURCE, {
|
|
@@ -1384,14 +1393,15 @@ const PRINTED_ENTRY_KINDS = /* @__PURE__ */ new Set([
|
|
|
1384
1393
|
"native_enum",
|
|
1385
1394
|
"rls",
|
|
1386
1395
|
"policy",
|
|
1387
|
-
"role"
|
|
1396
|
+
"role",
|
|
1397
|
+
"extension"
|
|
1388
1398
|
]);
|
|
1389
1399
|
function refuseUnprintedEntryKinds(namespaceId, entries) {
|
|
1390
1400
|
for (const [kind, entities] of Object.entries(entries)) {
|
|
1391
1401
|
if (PRINTED_ENTRY_KINDS.has(kind)) continue;
|
|
1392
1402
|
const names = Object.keys(entities ?? {});
|
|
1393
1403
|
if (names.length === 0) continue;
|
|
1394
|
-
throw unsupported(`namespace "${namespaceId}" declares ${names.length} "${kind}" ${names.length === 1 ? "entity" : "entities"} (${names.join(", ")}), which the Postgres printer cannot write.`, "The printer writes tables, value sets, value objects, native enums, row-level security settings, policies and
|
|
1404
|
+
throw unsupported(`namespace "${namespaceId}" declares ${names.length} "${kind}" ${names.length === 1 ? "entity" : "entities"} (${names.join(", ")}), which the Postgres printer cannot write.`, "The printer writes tables, value sets, value objects, native enums, row-level security settings, policies, roles and extensions, and no other entity kind.", KEEP_SOURCE, {
|
|
1395
1405
|
namespaceId,
|
|
1396
1406
|
kind,
|
|
1397
1407
|
names
|
|
@@ -1680,6 +1690,21 @@ function buildNativeEnumBlocksForNamespace(input) {
|
|
|
1680
1690
|
derivedValueSets
|
|
1681
1691
|
};
|
|
1682
1692
|
}
|
|
1693
|
+
/** One `extension` block per extension a namespace declares. */
|
|
1694
|
+
function buildExtensionBlocks(namespaceId, entries) {
|
|
1695
|
+
return Object.entries(entries ?? {}).map(([name, entity]) => {
|
|
1696
|
+
invariant(PostgresExtension.is(entity), `"extension" entry "${name}" in namespace "${namespaceId}" is not an extension`);
|
|
1697
|
+
refuseExtensionControl(namespaceId, entity);
|
|
1698
|
+
refuseEntryFiledUnderAnotherName({
|
|
1699
|
+
namespaceId,
|
|
1700
|
+
kind: "extension",
|
|
1701
|
+
name,
|
|
1702
|
+
readsBackAs: entity.name
|
|
1703
|
+
});
|
|
1704
|
+
refuseUnwritableName("extension", entity.name);
|
|
1705
|
+
return buildExtensionBlock(entity.name);
|
|
1706
|
+
});
|
|
1707
|
+
}
|
|
1683
1708
|
/**
|
|
1684
1709
|
* The checks the PSL source derives itself for a table, keyed by name, so
|
|
1685
1710
|
* they are not also written as `@@check`. A table that is not managed derives
|
|
@@ -2506,8 +2531,8 @@ function buildModel(all, entry, enums, rlsTables) {
|
|
|
2506
2531
|
};
|
|
2507
2532
|
}
|
|
2508
2533
|
/**
|
|
2509
|
-
* The namespace block of one storage namespace: its models, value objects, enum blocks,
|
|
2510
|
-
* policies. `undefined` when the namespace holds none of them.
|
|
2534
|
+
* The namespace block of one storage namespace: its models, value objects, extensions, enum blocks,
|
|
2535
|
+
* roles and policies. `undefined` when the namespace holds none of them.
|
|
2511
2536
|
*/
|
|
2512
2537
|
function buildNamespace(all, namespaceId, namespace) {
|
|
2513
2538
|
const { contract, models, variants } = all;
|
|
@@ -2537,6 +2562,7 @@ function buildNamespace(all, namespaceId, namespace) {
|
|
|
2537
2562
|
const modelNameForTable = (tableName) => models.find((entry) => entry.namespaceId === namespaceId && entry.tableName === tableName && variants.get(entry)?.singleTable !== true)?.name;
|
|
2538
2563
|
for (const tableName of rlsTables) if (modelNameForTable(tableName) === void 0) refuseRlsWithoutModel(namespaceId, tableName);
|
|
2539
2564
|
const blocks = [
|
|
2565
|
+
...buildExtensionBlocks(namespaceId, namespace.entries["extension"]),
|
|
2540
2566
|
...enums.blocks,
|
|
2541
2567
|
...buildRoleBlocks(namespaceId, namespace.entries["role"]),
|
|
2542
2568
|
...buildPolicyBlocks({
|