@prisma-next/target-postgres 0.14.0-dev.6 → 0.14.0-dev.60

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.
Files changed (253) hide show
  1. package/dist/authoring-WkqG_MkU.mjs +419 -0
  2. package/dist/authoring-WkqG_MkU.mjs.map +1 -0
  3. package/dist/canonicalize-CAbXtVtB.d.mts +37 -0
  4. package/dist/canonicalize-CAbXtVtB.d.mts.map +1 -0
  5. package/dist/{codec-ids-CnXu9Qy3.d.mts → codec-ids-BzrFF-I4.d.mts} +3 -2
  6. package/dist/codec-ids-BzrFF-I4.d.mts.map +1 -0
  7. package/dist/{codec-ids-BvytN2P8.mjs → codec-ids-C_-Hj6bL.mjs} +3 -2
  8. package/dist/codec-ids-C_-Hj6bL.mjs.map +1 -0
  9. package/dist/codec-ids.d.mts +2 -2
  10. package/dist/codec-ids.mjs +2 -2
  11. package/dist/{codec-types-DHCkwPKE.d.mts → codec-types-BiIWziRO.d.mts} +3 -2
  12. package/dist/codec-types-BiIWziRO.d.mts.map +1 -0
  13. package/dist/codec-types.d.mts +1 -1
  14. package/dist/codecs-CkVQrZ4G.mjs +913 -0
  15. package/dist/codecs-CkVQrZ4G.mjs.map +1 -0
  16. package/dist/{codecs--0A5_4Bq.d.mts → codecs-Cm-nS4mQ.d.mts} +111 -4
  17. package/dist/codecs-Cm-nS4mQ.d.mts.map +1 -0
  18. package/dist/codecs.d.mts +2 -2
  19. package/dist/codecs.mjs +3 -757
  20. package/dist/codecs.mjs.map +1 -1
  21. package/dist/contract-free.d.mts +33 -3
  22. package/dist/contract-free.d.mts.map +1 -1
  23. package/dist/contract-free.mjs +4 -4
  24. package/dist/control-policy-Co_13Hxa.mjs +1128 -0
  25. package/dist/control-policy-Co_13Hxa.mjs.map +1 -0
  26. package/dist/control.d.mts +2 -2
  27. package/dist/control.d.mts.map +1 -1
  28. package/dist/control.mjs +900 -35
  29. package/dist/control.mjs.map +1 -1
  30. package/dist/data-transform-BOWpliq8.mjs.map +1 -1
  31. package/dist/{data-transform-DDgWdB5o.d.mts → data-transform-DPzwBMhW.d.mts} +3 -3
  32. package/dist/{data-transform-DDgWdB5o.d.mts.map → data-transform-DPzwBMhW.d.mts.map} +1 -1
  33. package/dist/data-transform.d.mts +1 -1
  34. package/dist/{ddl-QDyOSeLc.mjs → ddl-B-krEXY1.mjs} +77 -6
  35. package/dist/ddl-B-krEXY1.mjs.map +1 -0
  36. package/dist/ddl.d.mts +3 -2
  37. package/dist/ddl.mjs +2 -2
  38. package/dist/default-normalizer.d.mts +1 -1
  39. package/dist/default-normalizer.d.mts.map +1 -1
  40. package/dist/default-normalizer.mjs +247 -1
  41. package/dist/default-normalizer.mjs.map +1 -0
  42. package/dist/descriptor-meta-BOcKPaLE.mjs +22 -0
  43. package/dist/descriptor-meta-BOcKPaLE.mjs.map +1 -0
  44. package/dist/descriptor-meta-runtime-UwYdV8fD.mjs +12 -0
  45. package/dist/descriptor-meta-runtime-UwYdV8fD.mjs.map +1 -0
  46. package/dist/diff-database-schema-BOsDnH64.mjs +266 -0
  47. package/dist/diff-database-schema-BOsDnH64.mjs.map +1 -0
  48. package/dist/diff-database-schema.d.mts +46 -0
  49. package/dist/diff-database-schema.d.mts.map +1 -0
  50. package/dist/diff-database-schema.mjs +2 -0
  51. package/dist/errors-DO-w0EUS.mjs +35 -0
  52. package/dist/errors-DO-w0EUS.mjs.map +1 -0
  53. package/dist/errors.d.mts +11 -9
  54. package/dist/errors.d.mts.map +1 -1
  55. package/dist/errors.mjs +1 -1
  56. package/dist/issue-planner.d.mts +35 -11
  57. package/dist/issue-planner.d.mts.map +1 -1
  58. package/dist/issue-planner.mjs +2 -2
  59. package/dist/migration.d.mts +5 -5
  60. package/dist/migration.d.mts.map +1 -1
  61. package/dist/migration.mjs +4 -4
  62. package/dist/namespace-ids-xtp_ZY86.mjs +7 -0
  63. package/dist/namespace-ids-xtp_ZY86.mjs.map +1 -0
  64. package/dist/native-type-normalizer.mjs +37 -1
  65. package/dist/native-type-normalizer.mjs.map +1 -0
  66. package/dist/nodes-B815pj_X.mjs +162 -0
  67. package/dist/nodes-B815pj_X.mjs.map +1 -0
  68. package/dist/nodes-BtQyZha6.d.mts +146 -0
  69. package/dist/nodes-BtQyZha6.d.mts.map +1 -0
  70. package/dist/{op-factory-call-DmQEc3XV.d.mts → op-factory-call-D6_7-7Vc.d.mts} +68 -15
  71. package/dist/op-factory-call-D6_7-7Vc.d.mts.map +1 -0
  72. package/dist/{op-factory-call-D_p5vxwt.mjs → op-factory-call-DxNNKUeZ.mjs} +300 -31
  73. package/dist/op-factory-call-DxNNKUeZ.mjs.map +1 -0
  74. package/dist/op-factory-call.d.mts +2 -2
  75. package/dist/op-factory-call.mjs +2 -2
  76. package/dist/pack.d.mts +144 -3
  77. package/dist/pack.d.mts.map +1 -1
  78. package/dist/pack.mjs +1 -1
  79. package/dist/planner-CNrc1Odu.mjs +422 -0
  80. package/dist/planner-CNrc1Odu.mjs.map +1 -0
  81. package/dist/{planner-ddl-builders-B2wOwLqI.mjs → planner-ddl-builders-B8Nn6nHN.mjs} +12 -27
  82. package/dist/planner-ddl-builders-B8Nn6nHN.mjs.map +1 -0
  83. package/dist/planner-ddl-builders.d.mts +4 -6
  84. package/dist/planner-ddl-builders.d.mts.map +1 -1
  85. package/dist/planner-ddl-builders.mjs +2 -2
  86. package/dist/planner-identity-values-CJPha2Sz.mjs.map +1 -1
  87. package/dist/planner-identity-values.d.mts +8 -2
  88. package/dist/planner-identity-values.d.mts.map +1 -1
  89. package/dist/planner-identity-values.mjs +2 -2
  90. package/dist/{planner-produced-postgres-migration-Cji5vxUf.mjs → planner-produced-postgres-migration-NI-oGKcw.mjs} +3 -3
  91. package/dist/{planner-produced-postgres-migration-Cji5vxUf.mjs.map → planner-produced-postgres-migration-NI-oGKcw.mjs.map} +1 -1
  92. package/dist/{planner-produced-postgres-migration-QqHa2C2l.d.mts → planner-produced-postgres-migration-a-tjfKsA.d.mts} +4 -4
  93. package/dist/{planner-produced-postgres-migration-QqHa2C2l.d.mts.map → planner-produced-postgres-migration-a-tjfKsA.d.mts.map} +1 -1
  94. package/dist/planner-produced-postgres-migration.d.mts +1 -1
  95. package/dist/planner-produced-postgres-migration.mjs +1 -1
  96. package/dist/{planner-sql-checks-jqUUGyQR.mjs → planner-sql-checks-AXoxB1Jl.mjs} +2 -2
  97. package/dist/{planner-sql-checks-jqUUGyQR.mjs.map → planner-sql-checks-AXoxB1Jl.mjs.map} +1 -1
  98. package/dist/planner-sql-checks.d.mts +2 -2
  99. package/dist/planner-sql-checks.d.mts.map +1 -1
  100. package/dist/planner-sql-checks.mjs +1 -1
  101. package/dist/{planner-target-details-CIY6tLeo.d.mts → planner-target-details-HkP4RrRO.d.mts} +2 -2
  102. package/dist/planner-target-details-HkP4RrRO.d.mts.map +1 -0
  103. package/dist/planner-target-details.d.mts +1 -1
  104. package/dist/planner.d.mts +72 -17
  105. package/dist/planner.d.mts.map +1 -1
  106. package/dist/planner.mjs +3 -2
  107. package/dist/postgres-contract-view-C9j5cqP0.d.mts +34 -0
  108. package/dist/postgres-contract-view-C9j5cqP0.d.mts.map +1 -0
  109. package/dist/{postgres-contract-serializer-k3TAcPMY.mjs → postgres-contract-view-Dg-N7KA7.mjs} +45 -41
  110. package/dist/postgres-contract-view-Dg-N7KA7.mjs.map +1 -0
  111. package/dist/postgres-database-schema-node-CfdTY-Qs.d.mts +218 -0
  112. package/dist/postgres-database-schema-node-CfdTY-Qs.d.mts.map +1 -0
  113. package/dist/{postgres-migration-Y4YBJqkS.d.mts → postgres-migration-Bzzi0Asr.d.mts} +28 -9
  114. package/dist/postgres-migration-Bzzi0Asr.d.mts.map +1 -0
  115. package/dist/{postgres-migration-B5jKrXv3.mjs → postgres-migration-ChyRsWvE.mjs} +53 -45
  116. package/dist/postgres-migration-ChyRsWvE.mjs.map +1 -0
  117. package/dist/postgres-native-enum-xdiqmBf_.mjs +41 -0
  118. package/dist/postgres-native-enum-xdiqmBf_.mjs.map +1 -0
  119. package/dist/postgres-rls-policy--CSddvMR.d.mts +52 -0
  120. package/dist/postgres-rls-policy--CSddvMR.d.mts.map +1 -0
  121. package/dist/postgres-role-schema-node-BiSTCTNg.mjs +195 -0
  122. package/dist/postgres-role-schema-node-BiSTCTNg.mjs.map +1 -0
  123. package/dist/postgres-schema-CU4gF6QZ.d.mts +257 -0
  124. package/dist/postgres-schema-CU4gF6QZ.d.mts.map +1 -0
  125. package/dist/{postgres-schema-COGZ1ark.mjs → postgres-schema-DTLA_aRi.mjs} +171 -10
  126. package/dist/postgres-schema-DTLA_aRi.mjs.map +1 -0
  127. package/dist/postgres-table-schema-node-9FCtCUz2.mjs +153 -0
  128. package/dist/postgres-table-schema-node-9FCtCUz2.mjs.map +1 -0
  129. package/dist/render-ops.d.mts +1 -1
  130. package/dist/{render-typescript-KMgosran.mjs → render-typescript-7yqILcwr.mjs} +45 -16
  131. package/dist/render-typescript-7yqILcwr.mjs.map +1 -0
  132. package/dist/render-typescript.mjs +1 -1
  133. package/dist/resolve-ddl-schema-Ca88Tg6W.mjs +22 -0
  134. package/dist/resolve-ddl-schema-Ca88Tg6W.mjs.map +1 -0
  135. package/dist/rls-canonicalize.d.mts +20 -0
  136. package/dist/rls-canonicalize.d.mts.map +1 -0
  137. package/dist/rls-canonicalize.mjs +2 -0
  138. package/dist/runtime.d.mts +6 -8
  139. package/dist/runtime.d.mts.map +1 -1
  140. package/dist/runtime.mjs +3 -3
  141. package/dist/runtime.mjs.map +1 -1
  142. package/dist/schema-ir-annotations.d.mts +15 -0
  143. package/dist/schema-ir-annotations.d.mts.map +1 -0
  144. package/dist/schema-ir-annotations.mjs +2 -0
  145. package/dist/types.d.mts +4 -140
  146. package/dist/types.mjs +5 -2
  147. package/dist/wire-name-rHHtr1h0.mjs +75 -0
  148. package/dist/wire-name-rHHtr1h0.mjs.map +1 -0
  149. package/package.json +23 -17
  150. package/src/contract-free/checks.ts +73 -0
  151. package/src/contract-free/ddl.ts +71 -1
  152. package/src/core/authoring.ts +356 -2
  153. package/src/core/codec-ids.ts +1 -0
  154. package/src/core/codec-type-map.ts +2 -0
  155. package/src/core/codecs.ts +180 -1
  156. package/src/core/ddl/nodes.ts +141 -2
  157. package/src/core/default-normalizer.ts +122 -2
  158. package/src/core/descriptor-meta.ts +10 -1
  159. package/src/core/entity-kinds.ts +41 -0
  160. package/src/core/errors.ts +14 -12
  161. package/src/core/migrations/bound-schema.ts +10 -0
  162. package/src/core/migrations/column-ddl-rendering.ts +117 -0
  163. package/src/core/migrations/contract-to-postgres-database-schema-node.ts +160 -0
  164. package/src/core/migrations/control-policy.ts +99 -46
  165. package/src/core/migrations/diff-database-schema.ts +217 -0
  166. package/src/core/migrations/issue-planner.ts +692 -652
  167. package/src/core/migrations/op-factory-call.ts +189 -21
  168. package/src/core/migrations/operations/columns.ts +24 -12
  169. package/src/core/migrations/operations/constraints.ts +1 -1
  170. package/src/core/migrations/operations/data-transform.ts +6 -0
  171. package/src/core/migrations/operations/dependencies.ts +2 -1
  172. package/src/core/migrations/operations/rls.ts +187 -0
  173. package/src/core/migrations/operations/shared.ts +0 -30
  174. package/src/core/migrations/planner-ddl-builders.ts +20 -58
  175. package/src/core/migrations/planner-identity-values.ts +1 -1
  176. package/src/core/migrations/planner-recipes.ts +31 -13
  177. package/src/core/migrations/planner-sql-checks.ts +1 -1
  178. package/src/core/migrations/planner-strategies.ts +248 -216
  179. package/src/core/migrations/planner-target-details.ts +3 -1
  180. package/src/core/migrations/planner.ts +381 -59
  181. package/src/core/migrations/postgres-migration.ts +70 -86
  182. package/src/core/migrations/render-typescript.ts +42 -15
  183. package/src/core/migrations/resolve-ddl-schema.ts +26 -0
  184. package/src/core/migrations/runner.ts +10 -16
  185. package/src/core/migrations/verify-postgres-namespaces.ts +47 -31
  186. package/src/core/namespace-ids.ts +3 -0
  187. package/src/core/postgres-contract-serializer.ts +46 -71
  188. package/src/core/postgres-contract-view.ts +48 -0
  189. package/src/core/postgres-native-enum.ts +51 -0
  190. package/src/core/postgres-rls-enablement.ts +34 -0
  191. package/src/core/postgres-rls-policy.ts +64 -0
  192. package/src/core/postgres-role.ts +37 -0
  193. package/src/core/postgres-schema-verifier.ts +10 -7
  194. package/src/core/postgres-schema.ts +64 -15
  195. package/src/core/postgres-validators.ts +33 -0
  196. package/src/core/psl-infer/infer-psl-contract.ts +1325 -0
  197. package/src/core/psl-infer/postgres-default-mapping.ts +16 -0
  198. package/src/core/psl-infer/postgres-type-map.ts +128 -0
  199. package/src/core/rls/canonicalize.ts +48 -0
  200. package/src/core/rls/wire-name.ts +33 -0
  201. package/src/core/schema-ir/postgres-database-schema-node.ts +60 -0
  202. package/src/core/schema-ir/postgres-namespace-schema-node.ts +79 -0
  203. package/src/core/schema-ir/postgres-policy-schema-node.ts +90 -0
  204. package/src/core/schema-ir/postgres-role-schema-node.ts +63 -0
  205. package/src/core/schema-ir/postgres-table-schema-node.ts +140 -0
  206. package/src/core/schema-ir/schema-node-kinds.ts +106 -0
  207. package/src/exports/codecs.ts +3 -0
  208. package/src/exports/contract-free.ts +11 -1
  209. package/src/exports/control.ts +27 -33
  210. package/src/exports/ddl.ts +6 -0
  211. package/src/exports/diff-database-schema.ts +7 -0
  212. package/src/exports/issue-planner.ts +1 -1
  213. package/src/exports/migration.ts +1 -0
  214. package/src/exports/op-factory-call.ts +1 -0
  215. package/src/exports/planner-ddl-builders.ts +0 -2
  216. package/src/exports/planner-identity-values.ts +4 -1
  217. package/src/exports/planner.ts +1 -0
  218. package/src/exports/rls-canonicalize.ts +7 -0
  219. package/src/exports/runtime.ts +1 -0
  220. package/src/exports/schema-ir-annotations.ts +1 -0
  221. package/src/exports/types.ts +34 -0
  222. package/dist/codec-ids-BvytN2P8.mjs.map +0 -1
  223. package/dist/codec-ids-CnXu9Qy3.d.mts.map +0 -1
  224. package/dist/codec-types-DHCkwPKE.d.mts.map +0 -1
  225. package/dist/codecs--0A5_4Bq.d.mts.map +0 -1
  226. package/dist/ddl-QDyOSeLc.mjs.map +0 -1
  227. package/dist/default-normalizer-DyyCHQWs.mjs +0 -131
  228. package/dist/default-normalizer-DyyCHQWs.mjs.map +0 -1
  229. package/dist/descriptor-meta-CpGygXpI.mjs +0 -140
  230. package/dist/descriptor-meta-CpGygXpI.mjs.map +0 -1
  231. package/dist/errors-CUk87ByX.mjs +0 -33
  232. package/dist/errors-CUk87ByX.mjs.map +0 -1
  233. package/dist/issue-planner-DL6g3CmE.mjs +0 -824
  234. package/dist/issue-planner-DL6g3CmE.mjs.map +0 -1
  235. package/dist/native-type-normalizer-Bc9XJzWC.mjs +0 -38
  236. package/dist/native-type-normalizer-Bc9XJzWC.mjs.map +0 -1
  237. package/dist/nodes-Bbhs2rwj.mjs +0 -76
  238. package/dist/nodes-Bbhs2rwj.mjs.map +0 -1
  239. package/dist/nodes-pLeLgdis.d.mts +0 -67
  240. package/dist/nodes-pLeLgdis.d.mts.map +0 -1
  241. package/dist/op-factory-call-D_p5vxwt.mjs.map +0 -1
  242. package/dist/op-factory-call-DmQEc3XV.d.mts.map +0 -1
  243. package/dist/planner-Bs_baQax.mjs +0 -324
  244. package/dist/planner-Bs_baQax.mjs.map +0 -1
  245. package/dist/planner-ddl-builders-B2wOwLqI.mjs.map +0 -1
  246. package/dist/planner-target-details-CIY6tLeo.d.mts.map +0 -1
  247. package/dist/postgres-contract-serializer-k3TAcPMY.mjs.map +0 -1
  248. package/dist/postgres-migration-B5jKrXv3.mjs.map +0 -1
  249. package/dist/postgres-migration-Y4YBJqkS.d.mts.map +0 -1
  250. package/dist/postgres-schema-COGZ1ark.mjs.map +0 -1
  251. package/dist/render-typescript-KMgosran.mjs.map +0 -1
  252. package/dist/types.d.mts.map +0 -1
  253. package/src/core/postgres-enum-type-schema.ts +0 -17
@@ -0,0 +1,419 @@
1
+ import { a as PG_ENUM_CODEC_ID } from "./codec-ids-C_-Hj6bL.mjs";
2
+ import { t as PostgresNativeEnum } from "./postgres-native-enum-xdiqmBf_.mjs";
3
+ import { d as PostgresRlsEnablementSchema, f as PostgresRlsPolicySchema, g as PostgresRlsEnablement, h as PostgresRlsPolicy, m as PostgresRole, p as PostgresRoleSchema, u as PostgresNativeEnumSchema } from "./postgres-schema-DTLA_aRi.mjs";
4
+ import { i as normalizePredicate, r as computeContentHash, t as formatRlsPolicyWireName } from "./wire-name-rHHtr1h0.mjs";
5
+ import { temporalAuthoringPresets } from "@prisma-next/family-sql/control";
6
+ import { modelAttribute } from "@prisma-next/psl-parser";
7
+ //#region src/core/authoring.ts
8
+ /**
9
+ * `pg.enum(<ref>)` registers as an ordinary type constructor whose sole
10
+ * positional argument names a `native_enum` entity instead of carrying a
11
+ * literal value. The interpreter resolves the ref to the `native_enum`
12
+ * entity generically (driven by `entityRefArg`); the `pg/enum@1` codec
13
+ * descriptor's `columnFromEntity` hook (see `codecs.ts`) converts that
14
+ * entity into the column's `typeParams` and native type.
15
+ */
16
+ const postgresAuthoringTypes = { pg: { enum: {
17
+ kind: "typeConstructor",
18
+ entityRefArg: {
19
+ index: 0,
20
+ entityKind: "native_enum"
21
+ },
22
+ output: { codecId: PG_ENUM_CODEC_ID }
23
+ } } };
24
+ function readRefParam(block, key) {
25
+ const param = block.parameters[key];
26
+ return param?.kind === "ref" ? param.identifier : void 0;
27
+ }
28
+ function readValueParam(block, key) {
29
+ const param = block.parameters[key];
30
+ return param?.kind === "value" ? param.raw : void 0;
31
+ }
32
+ function readListRefParams(block, key) {
33
+ const param = block.parameters[key];
34
+ if (param?.kind !== "list") return [];
35
+ return param.items.flatMap((item) => item.kind === "ref" ? [item.identifier] : []);
36
+ }
37
+ /**
38
+ * Unwraps a quoted PSL string argument, inverting the printer's
39
+ * `escapePslString` escapes (`\\`, `\"`, `\n`, `\r`). An unknown escape
40
+ * sequence is kept verbatim, matching the printer-side `unescapePslString`
41
+ * convention.
42
+ */
43
+ function unwrapQuotedString(raw) {
44
+ if (!(raw.startsWith("\"") && raw.endsWith("\"") && raw.length >= 2)) return raw;
45
+ const inner = raw.slice(1, -1);
46
+ let result = "";
47
+ for (let i = 0; i < inner.length; i++) {
48
+ if (inner[i] !== "\\" || i + 1 >= inner.length) {
49
+ result += inner[i];
50
+ continue;
51
+ }
52
+ const next = inner[i + 1];
53
+ if (next === "\\" || next === "\"") result += next;
54
+ else if (next === "n") result += "\n";
55
+ else if (next === "r") result += "\r";
56
+ else {
57
+ result += "\\";
58
+ result += next;
59
+ }
60
+ i++;
61
+ }
62
+ return result;
63
+ }
64
+ function lowerRlsPolicyFromBlock(block, _ctx) {
65
+ const prefix = block.name;
66
+ const targetModelName = readRefParam(block, "target") ?? "";
67
+ const tableName = targetModelName.charAt(0).toLowerCase() + targetModelName.slice(1);
68
+ const roles = [...readListRefParams(block, "roles")].sort();
69
+ const using = unwrapQuotedString(readValueParam(block, "using") ?? "");
70
+ return new PostgresRlsPolicy({
71
+ name: formatRlsPolicyWireName(prefix, computeContentHash({
72
+ using: normalizePredicate(using),
73
+ roles,
74
+ operation: "select",
75
+ permissive: true
76
+ })),
77
+ prefix,
78
+ tableName,
79
+ namespaceId: block.namespaceId,
80
+ operation: "select",
81
+ roles,
82
+ using,
83
+ permissive: true
84
+ });
85
+ }
86
+ /**
87
+ * Lowers a `native_enum { memberName = "value" … @@map("type_name") }` block
88
+ * into a {@link PostgresNativeEnum}. Members must be authored as explicit
89
+ * `key = "value"` pairs — a bare (value-less) member is a diagnostic, not
90
+ * accepted (authoring-design.md §2.1). The parsed `memberName` is only used
91
+ * to duplicate-check and report diagnostics; the lowered entity carries just
92
+ * the member values (a native enum is value-only — the member "name" isn't
93
+ * a separate authoring concept from the value). `typeName` comes from
94
+ * `@@map` or defaults to the block name verbatim.
95
+ */
96
+ function lowerNativeEnumFromBlock(block, ctx) {
97
+ const sourceId = ctx.sourceId ?? "unknown";
98
+ const diagnostics = ctx.diagnostics;
99
+ const mapAttr = block.blockAttributes.find((a) => a.name === "map");
100
+ let typeName = block.name;
101
+ if (mapAttr) {
102
+ const rawArg = mapAttr.args[0]?.value;
103
+ const mapped = rawArg !== void 0 ? unwrapQuotedString(rawArg) : void 0;
104
+ if (mapped === void 0) {
105
+ diagnostics?.push({
106
+ code: "PSL_NATIVE_ENUM_INVALID_MAP",
107
+ message: `native_enum "${block.name}" @@map attribute must have a quoted type-name argument`,
108
+ sourceId,
109
+ span: mapAttr.span
110
+ });
111
+ return;
112
+ }
113
+ typeName = mapped;
114
+ }
115
+ let memberError = false;
116
+ const seenValues = /* @__PURE__ */ new Set();
117
+ const members = [];
118
+ for (const [memberName, paramValue] of Object.entries(block.parameters)) {
119
+ if (paramValue.kind === "bare") {
120
+ diagnostics?.push({
121
+ code: "PSL_NATIVE_ENUM_BARE_MEMBER",
122
+ message: `native_enum "${block.name}" member "${memberName}" has no value; members must be authored as "${memberName} = \\"value\\""`,
123
+ sourceId,
124
+ span: paramValue.span
125
+ });
126
+ memberError = true;
127
+ continue;
128
+ }
129
+ if (paramValue.kind !== "value") continue;
130
+ let jsonValue;
131
+ try {
132
+ jsonValue = JSON.parse(paramValue.raw);
133
+ } catch {
134
+ diagnostics?.push({
135
+ code: "PSL_EXTENSION_INVALID_VALUE",
136
+ message: `native_enum "${block.name}" member "${memberName}" value "${paramValue.raw}" is not valid JSON`,
137
+ sourceId,
138
+ span: paramValue.span
139
+ });
140
+ memberError = true;
141
+ continue;
142
+ }
143
+ if (typeof jsonValue !== "string") {
144
+ diagnostics?.push({
145
+ code: "PSL_EXTENSION_INVALID_VALUE",
146
+ message: `native_enum "${block.name}" member "${memberName}" value must be a string`,
147
+ sourceId,
148
+ span: paramValue.span
149
+ });
150
+ memberError = true;
151
+ continue;
152
+ }
153
+ if (seenValues.has(jsonValue)) {
154
+ diagnostics?.push({
155
+ code: "PSL_NATIVE_ENUM_DUPLICATE_MEMBER_VALUE",
156
+ message: `native_enum "${block.name}": duplicate member value "${jsonValue}"`,
157
+ sourceId,
158
+ span: paramValue.span
159
+ });
160
+ memberError = true;
161
+ continue;
162
+ }
163
+ seenValues.add(jsonValue);
164
+ members.push(jsonValue);
165
+ }
166
+ if (memberError) return void 0;
167
+ if (members.length === 0) {
168
+ diagnostics?.push({
169
+ code: "PSL_NATIVE_ENUM_MISSING_MEMBERS",
170
+ message: `native_enum "${block.name}" must have at least one member`,
171
+ sourceId,
172
+ span: block.span
173
+ });
174
+ return;
175
+ }
176
+ return new PostgresNativeEnum({
177
+ typeName,
178
+ members
179
+ });
180
+ }
181
+ const postgresAuthoringEntityTypes = {
182
+ role: {
183
+ kind: "entity",
184
+ discriminator: "role",
185
+ validatorSchema: PostgresRoleSchema,
186
+ output: { factory: (input) => new PostgresRole(input) }
187
+ },
188
+ rls: {
189
+ kind: "entity",
190
+ discriminator: "rls",
191
+ validatorSchema: PostgresRlsEnablementSchema,
192
+ output: { factory: (input) => new PostgresRlsEnablement(input) }
193
+ },
194
+ policy: {
195
+ kind: "entity",
196
+ discriminator: "policy",
197
+ validatorSchema: PostgresRlsPolicySchema,
198
+ output: { factory: lowerRlsPolicyFromBlock }
199
+ },
200
+ native_enum: {
201
+ kind: "entity",
202
+ discriminator: "native_enum",
203
+ validatorSchema: PostgresNativeEnumSchema,
204
+ output: {
205
+ factory: lowerNativeEnumFromBlock,
206
+ deriveValueSet: (entity) => ({
207
+ kind: "valueSet",
208
+ values: [...entity.members]
209
+ })
210
+ }
211
+ }
212
+ };
213
+ /**
214
+ * Field presets contributed by the Postgres target pack.
215
+ *
216
+ * These mirror the PSL scalar-to-codec mapping used by the Postgres adapter
217
+ * (see `createPostgresPslScalarTypeDescriptors`), so that authoring a field
218
+ * via the TS callback surface (e.g. `field.int()`) and via the PSL scalar
219
+ * surface (e.g. `Int`) lowers to byte-identical contracts.
220
+ *
221
+ * The `uuidNative` / `id.uuidv4Native` / `id.uuidv7Native` presets use the
222
+ * native Postgres `uuid` type (codecId `pg/uuid@1`). For cross-target
223
+ * portability use `uuidString` / `id.uuidv4String` / `id.uuidv7String` from
224
+ * the family pack instead.
225
+ */
226
+ /**
227
+ * PSL block descriptor for `policy_select`.
228
+ *
229
+ * The parser learns the block shape from this descriptor; lowering from
230
+ * `PslExtensionBlock` to `PostgresRlsPolicy` is wired in the PSL
231
+ * interpreter (a later dispatch). The `discriminator` matches
232
+ * `PostgresRlsPolicy.kind` so the parsed block node carries the same
233
+ * discriminant as the IR class it will lower to.
234
+ *
235
+ * The `roles` list uses `scope:'cross-space'` because same-namespace
236
+ * role ref resolution requires PSL namespace entries keyed by `refKind`
237
+ * (i.e. `'role'`), which in turn requires the role block discriminator to
238
+ * equal `'role'`. Aligning discriminator with refKind is tracked for
239
+ * slice 4 (cross-space roles). Until then cross-space passes validation
240
+ * unconditionally and the authored role names flow through unchanged.
241
+ */
242
+ const postgresAuthoringPslBlockDescriptors = {
243
+ policy_select: {
244
+ kind: "pslBlock",
245
+ keyword: "policy_select",
246
+ discriminator: "policy",
247
+ name: { required: true },
248
+ parameters: {
249
+ target: {
250
+ kind: "ref",
251
+ refKind: "model",
252
+ scope: "same-namespace",
253
+ required: true
254
+ },
255
+ roles: {
256
+ kind: "list",
257
+ of: {
258
+ kind: "ref",
259
+ refKind: "role",
260
+ scope: "cross-space"
261
+ }
262
+ },
263
+ using: {
264
+ kind: "value",
265
+ codecId: "pg/text@1",
266
+ required: true
267
+ }
268
+ },
269
+ requiresModelAttribute: {
270
+ parameter: "target",
271
+ attribute: "rls"
272
+ }
273
+ },
274
+ /**
275
+ * PSL block descriptor for `native_enum`.
276
+ *
277
+ * Reuses the existing variadic-block mechanism (the same shape the SQL
278
+ * family's `enum` block ships): the body is an open `memberName = "value"`
279
+ * list. `variadicParameters: true` opens the block to arbitrary keys
280
+ * beyond the declared (empty) `parameters` set — the lowering factory
281
+ * (`lowerNativeEnumFromBlock`) turns the variadic entries into ordered
282
+ * members and rejects a bare (value-less) member.
283
+ */
284
+ native_enum: {
285
+ kind: "pslBlock",
286
+ keyword: "native_enum",
287
+ discriminator: "native_enum",
288
+ name: { required: true },
289
+ parameters: {},
290
+ variadicParameters: true
291
+ }
292
+ };
293
+ /**
294
+ * `@@` model attributes contributed by the Postgres target pack.
295
+ *
296
+ * `@@rls` is argument-less: presence marks the model's table
297
+ * RLS-controlled. It lowers to a {@link PostgresRlsEnablement} marker in
298
+ * the namespace's `entries.rls`, keyed by the model's table name — the
299
+ * marker (never the policy set) is what drives
300
+ * `ENABLE`/`DISABLE ROW LEVEL SECURITY` planning.
301
+ */
302
+ const postgresAuthoringModelAttributes = { rls: {
303
+ kind: "modelAttribute",
304
+ attribute: "rls",
305
+ spec: modelAttribute("rls", {}),
306
+ lower: (_parsed, ctx) => ({
307
+ key: ctx.storageName,
308
+ entity: new PostgresRlsEnablement({
309
+ tableName: ctx.storageName,
310
+ namespaceId: ctx.namespaceId
311
+ })
312
+ })
313
+ } };
314
+ const postgresAuthoringFieldPresets = {
315
+ text: {
316
+ kind: "fieldPreset",
317
+ output: {
318
+ codecId: "pg/text@1",
319
+ nativeType: "text"
320
+ }
321
+ },
322
+ int: {
323
+ kind: "fieldPreset",
324
+ output: {
325
+ codecId: "pg/int4@1",
326
+ nativeType: "int4"
327
+ }
328
+ },
329
+ bigint: {
330
+ kind: "fieldPreset",
331
+ output: {
332
+ codecId: "pg/int8@1",
333
+ nativeType: "int8"
334
+ }
335
+ },
336
+ float: {
337
+ kind: "fieldPreset",
338
+ output: {
339
+ codecId: "pg/float8@1",
340
+ nativeType: "float8"
341
+ }
342
+ },
343
+ decimal: {
344
+ kind: "fieldPreset",
345
+ output: {
346
+ codecId: "pg/numeric@1",
347
+ nativeType: "numeric"
348
+ }
349
+ },
350
+ boolean: {
351
+ kind: "fieldPreset",
352
+ output: {
353
+ codecId: "pg/bool@1",
354
+ nativeType: "bool"
355
+ }
356
+ },
357
+ json: {
358
+ kind: "fieldPreset",
359
+ output: {
360
+ codecId: "pg/jsonb@1",
361
+ nativeType: "jsonb"
362
+ }
363
+ },
364
+ bytes: {
365
+ kind: "fieldPreset",
366
+ output: {
367
+ codecId: "pg/bytea@1",
368
+ nativeType: "bytea"
369
+ }
370
+ },
371
+ dateTime: {
372
+ kind: "fieldPreset",
373
+ output: {
374
+ codecId: "pg/timestamptz@1",
375
+ nativeType: "timestamptz"
376
+ }
377
+ },
378
+ temporal: /* @__PURE__ */ temporalAuthoringPresets({
379
+ codecId: "pg/timestamptz@1",
380
+ nativeType: "timestamptz"
381
+ }),
382
+ uuidNative: {
383
+ kind: "fieldPreset",
384
+ output: {
385
+ codecId: "pg/uuid@1",
386
+ nativeType: "uuid"
387
+ }
388
+ },
389
+ id: {
390
+ uuidv4Native: {
391
+ kind: "fieldPreset",
392
+ output: {
393
+ codecId: "pg/uuid@1",
394
+ nativeType: "uuid",
395
+ executionDefaults: { onCreate: {
396
+ kind: "generator",
397
+ id: "uuidv4"
398
+ } },
399
+ id: true
400
+ }
401
+ },
402
+ uuidv7Native: {
403
+ kind: "fieldPreset",
404
+ output: {
405
+ codecId: "pg/uuid@1",
406
+ nativeType: "uuid",
407
+ executionDefaults: { onCreate: {
408
+ kind: "generator",
409
+ id: "uuidv7"
410
+ } },
411
+ id: true
412
+ }
413
+ }
414
+ }
415
+ };
416
+ //#endregion
417
+ export { postgresAuthoringTypes as a, postgresAuthoringPslBlockDescriptors as i, postgresAuthoringFieldPresets as n, postgresAuthoringModelAttributes as r, postgresAuthoringEntityTypes as t };
418
+
419
+ //# sourceMappingURL=authoring-WkqG_MkU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authoring-WkqG_MkU.mjs","names":[],"sources":["../src/core/authoring.ts"],"sourcesContent":["import { temporalAuthoringPresets } from '@prisma-next/family-sql/control';\nimport type {\n AuthoringEntityContext,\n AuthoringEntityTypeFactoryOutput,\n AuthoringEntityTypeNamespace,\n AuthoringFieldNamespace,\n AuthoringModelAttributeContext,\n AuthoringModelAttributeDescriptorNamespace,\n AuthoringPslBlockDescriptorNamespace,\n AuthoringTypeNamespace,\n PslExtensionBlock,\n} from '@prisma-next/framework-components/authoring';\nimport { modelAttribute } from '@prisma-next/psl-parser';\nimport type { SqlValueSetDerivingEntityTypeOutput } from '@prisma-next/sql-contract/value-set-derivation-hook';\nimport { PG_ENUM_CODEC_ID } from './codec-ids';\nimport { PostgresNativeEnum } from './postgres-native-enum';\nimport { PostgresRlsEnablement, type PostgresRlsEnablementInput } from './postgres-rls-enablement';\nimport { PostgresRlsPolicy } from './postgres-rls-policy';\nimport { PostgresRole, type PostgresRoleInput } from './postgres-role';\nimport {\n PostgresNativeEnumSchema,\n PostgresRlsEnablementSchema,\n PostgresRlsPolicySchema,\n PostgresRoleSchema,\n} from './postgres-validators';\nimport { computeContentHash, normalizePredicate } from './rls/canonicalize';\nimport { formatRlsPolicyWireName } from './rls/wire-name';\n\n/**\n * `pg.enum(<ref>)` registers as an ordinary type constructor whose sole\n * positional argument names a `native_enum` entity instead of carrying a\n * literal value. The interpreter resolves the ref to the `native_enum`\n * entity generically (driven by `entityRefArg`); the `pg/enum@1` codec\n * descriptor's `columnFromEntity` hook (see `codecs.ts`) converts that\n * entity into the column's `typeParams` and native type.\n */\nexport const postgresAuthoringTypes = {\n pg: {\n enum: {\n kind: 'typeConstructor',\n entityRefArg: { index: 0, entityKind: 'native_enum' },\n output: {\n codecId: PG_ENUM_CODEC_ID,\n },\n },\n },\n} as const satisfies AuthoringTypeNamespace;\n\nexport interface RlsPolicyExtensionBlock extends PslExtensionBlock {\n readonly namespaceId: string;\n}\n\nfunction readRefParam(block: PslExtensionBlock, key: string): string | undefined {\n const param = block.parameters[key];\n return param?.kind === 'ref' ? param.identifier : undefined;\n}\n\nfunction readValueParam(block: PslExtensionBlock, key: string): string | undefined {\n const param = block.parameters[key];\n return param?.kind === 'value' ? param.raw : undefined;\n}\n\nfunction readListRefParams(block: PslExtensionBlock, key: string): string[] {\n const param = block.parameters[key];\n if (param?.kind !== 'list') return [];\n return param.items.flatMap((item) => (item.kind === 'ref' ? [item.identifier] : []));\n}\n\n/**\n * Unwraps a quoted PSL string argument, inverting the printer's\n * `escapePslString` escapes (`\\\\`, `\\\"`, `\\n`, `\\r`). An unknown escape\n * sequence is kept verbatim, matching the printer-side `unescapePslString`\n * convention.\n */\nfunction unwrapQuotedString(raw: string): string {\n if (!(raw.startsWith('\"') && raw.endsWith('\"') && raw.length >= 2)) {\n return raw;\n }\n const inner = raw.slice(1, -1);\n let result = '';\n for (let i = 0; i < inner.length; i++) {\n if (inner[i] !== '\\\\' || i + 1 >= inner.length) {\n result += inner[i];\n continue;\n }\n const next = inner[i + 1];\n if (next === '\\\\' || next === '\"') {\n result += next;\n } else if (next === 'n') {\n result += '\\n';\n } else if (next === 'r') {\n result += '\\r';\n } else {\n result += '\\\\';\n result += next;\n }\n i++;\n }\n return result;\n}\n\nfunction lowerRlsPolicyFromBlock(\n block: RlsPolicyExtensionBlock,\n _ctx: AuthoringEntityContext,\n): PostgresRlsPolicy {\n const prefix = block.name;\n const targetModelName = readRefParam(block, 'target') ?? '';\n const tableName = targetModelName.charAt(0).toLowerCase() + targetModelName.slice(1);\n const roles = [...readListRefParams(block, 'roles')].sort();\n const using = unwrapQuotedString(readValueParam(block, 'using') ?? '');\n\n const wireHash = computeContentHash({\n using: normalizePredicate(using),\n roles,\n operation: 'select',\n permissive: true,\n });\n const wireName = formatRlsPolicyWireName(prefix, wireHash);\n\n return new PostgresRlsPolicy({\n name: wireName,\n prefix,\n tableName,\n namespaceId: block.namespaceId,\n operation: 'select',\n roles,\n using,\n permissive: true,\n });\n}\n\n/**\n * Lowers a `native_enum { memberName = \"value\" … @@map(\"type_name\") }` block\n * into a {@link PostgresNativeEnum}. Members must be authored as explicit\n * `key = \"value\"` pairs — a bare (value-less) member is a diagnostic, not\n * accepted (authoring-design.md §2.1). The parsed `memberName` is only used\n * to duplicate-check and report diagnostics; the lowered entity carries just\n * the member values (a native enum is value-only — the member \"name\" isn't\n * a separate authoring concept from the value). `typeName` comes from\n * `@@map` or defaults to the block name verbatim.\n */\nfunction lowerNativeEnumFromBlock(\n block: PslExtensionBlock,\n ctx: AuthoringEntityContext,\n): PostgresNativeEnum | undefined {\n const sourceId = ctx.sourceId ?? 'unknown';\n const diagnostics = ctx.diagnostics;\n\n const mapAttr = block.blockAttributes.find((a) => a.name === 'map');\n let typeName = block.name;\n if (mapAttr) {\n const rawArg = mapAttr.args[0]?.value;\n const mapped = rawArg !== undefined ? unwrapQuotedString(rawArg) : undefined;\n if (mapped === undefined) {\n diagnostics?.push({\n code: 'PSL_NATIVE_ENUM_INVALID_MAP',\n message: `native_enum \"${block.name}\" @@map attribute must have a quoted type-name argument`,\n sourceId,\n span: mapAttr.span,\n });\n return undefined;\n }\n typeName = mapped;\n }\n\n let memberError = false;\n const seenValues = new Set<string>();\n const members: string[] = [];\n for (const [memberName, paramValue] of Object.entries(block.parameters)) {\n if (paramValue.kind === 'bare') {\n diagnostics?.push({\n code: 'PSL_NATIVE_ENUM_BARE_MEMBER',\n message: `native_enum \"${block.name}\" member \"${memberName}\" has no value; members must be authored as \"${memberName} = \\\\\"value\\\\\"\"`,\n sourceId,\n span: paramValue.span,\n });\n memberError = true;\n continue;\n }\n if (paramValue.kind !== 'value') continue;\n\n let jsonValue: unknown;\n try {\n jsonValue = JSON.parse(paramValue.raw);\n } catch {\n diagnostics?.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `native_enum \"${block.name}\" member \"${memberName}\" value \"${paramValue.raw}\" is not valid JSON`,\n sourceId,\n span: paramValue.span,\n });\n memberError = true;\n continue;\n }\n if (typeof jsonValue !== 'string') {\n diagnostics?.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `native_enum \"${block.name}\" member \"${memberName}\" value must be a string`,\n sourceId,\n span: paramValue.span,\n });\n memberError = true;\n continue;\n }\n if (seenValues.has(jsonValue)) {\n diagnostics?.push({\n code: 'PSL_NATIVE_ENUM_DUPLICATE_MEMBER_VALUE',\n message: `native_enum \"${block.name}\": duplicate member value \"${jsonValue}\"`,\n sourceId,\n span: paramValue.span,\n });\n memberError = true;\n continue;\n }\n seenValues.add(jsonValue);\n members.push(jsonValue);\n }\n\n if (memberError) return undefined;\n\n if (members.length === 0) {\n diagnostics?.push({\n code: 'PSL_NATIVE_ENUM_MISSING_MEMBERS',\n message: `native_enum \"${block.name}\" must have at least one member`,\n sourceId,\n span: block.span,\n });\n return undefined;\n }\n\n // `control` stays unset — the effective grade is resolved at read time via `effectiveControlPolicy`, like `StorageTable`/`StorageColumn`.\n return new PostgresNativeEnum({ typeName, members });\n}\n\n/**\n * `native_enum`'s entity-type factory output, checked separately from the assembled\n * `postgresAuthoringEntityTypes` map below: `deriveValueSet` is SQL-family surface\n * ({@link SqlValueSetDerivingEntityTypeOutput}), not part of the framework\n * `AuthoringEntityTypeFactoryOutput` shape, so folding it directly into the map's single\n * `satisfies AuthoringEntityTypeNamespace` check would trip an excess-property error. Checking it\n * here against the intersection of both shapes keeps it structurally valid against each without\n * widening the map's own check.\n */\nconst nativeEnumEntityTypeOutput = {\n factory: lowerNativeEnumFromBlock,\n deriveValueSet: (entity: PostgresNativeEnum) => ({\n kind: 'valueSet' as const,\n values: [...entity.members],\n }),\n} satisfies AuthoringEntityTypeFactoryOutput<PslExtensionBlock, PostgresNativeEnum | undefined> &\n SqlValueSetDerivingEntityTypeOutput;\n\nexport const postgresAuthoringEntityTypes = {\n role: {\n kind: 'entity',\n discriminator: 'role',\n validatorSchema: PostgresRoleSchema,\n output: {\n factory: (input: PostgresRoleInput): PostgresRole => new PostgresRole(input),\n },\n },\n rls: {\n kind: 'entity',\n discriminator: 'rls',\n validatorSchema: PostgresRlsEnablementSchema,\n output: {\n factory: (input: PostgresRlsEnablementInput): PostgresRlsEnablement =>\n new PostgresRlsEnablement(input),\n },\n },\n policy: {\n kind: 'entity',\n discriminator: 'policy',\n validatorSchema: PostgresRlsPolicySchema,\n output: {\n factory: lowerRlsPolicyFromBlock,\n },\n },\n native_enum: {\n kind: 'entity',\n discriminator: 'native_enum',\n validatorSchema: PostgresNativeEnumSchema,\n output: nativeEnumEntityTypeOutput,\n },\n} as const satisfies AuthoringEntityTypeNamespace;\n\n/**\n * Field presets contributed by the Postgres target pack.\n *\n * These mirror the PSL scalar-to-codec mapping used by the Postgres adapter\n * (see `createPostgresPslScalarTypeDescriptors`), so that authoring a field\n * via the TS callback surface (e.g. `field.int()`) and via the PSL scalar\n * surface (e.g. `Int`) lowers to byte-identical contracts.\n *\n * The `uuidNative` / `id.uuidv4Native` / `id.uuidv7Native` presets use the\n * native Postgres `uuid` type (codecId `pg/uuid@1`). For cross-target\n * portability use `uuidString` / `id.uuidv4String` / `id.uuidv7String` from\n * the family pack instead.\n */\n/**\n * PSL block descriptor for `policy_select`.\n *\n * The parser learns the block shape from this descriptor; lowering from\n * `PslExtensionBlock` to `PostgresRlsPolicy` is wired in the PSL\n * interpreter (a later dispatch). The `discriminator` matches\n * `PostgresRlsPolicy.kind` so the parsed block node carries the same\n * discriminant as the IR class it will lower to.\n *\n * The `roles` list uses `scope:'cross-space'` because same-namespace\n * role ref resolution requires PSL namespace entries keyed by `refKind`\n * (i.e. `'role'`), which in turn requires the role block discriminator to\n * equal `'role'`. Aligning discriminator with refKind is tracked for\n * slice 4 (cross-space roles). Until then cross-space passes validation\n * unconditionally and the authored role names flow through unchanged.\n */\nexport const postgresAuthoringPslBlockDescriptors = {\n policy_select: {\n kind: 'pslBlock',\n keyword: 'policy_select',\n discriminator: 'policy',\n name: { required: true },\n parameters: {\n target: { kind: 'ref', refKind: 'model', scope: 'same-namespace', required: true },\n roles: {\n kind: 'list',\n of: { kind: 'ref', refKind: 'role', scope: 'cross-space' },\n },\n using: { kind: 'value', codecId: 'pg/text@1', required: true },\n },\n // A policy may only target an RLS-controlled model: the model named by\n // `target` must declare `@@rls`, or the load fails with a diagnostic\n // naming the model and the policy prefix.\n requiresModelAttribute: { parameter: 'target', attribute: 'rls' },\n },\n /**\n * PSL block descriptor for `native_enum`.\n *\n * Reuses the existing variadic-block mechanism (the same shape the SQL\n * family's `enum` block ships): the body is an open `memberName = \"value\"`\n * list. `variadicParameters: true` opens the block to arbitrary keys\n * beyond the declared (empty) `parameters` set — the lowering factory\n * (`lowerNativeEnumFromBlock`) turns the variadic entries into ordered\n * members and rejects a bare (value-less) member.\n */\n native_enum: {\n kind: 'pslBlock',\n keyword: 'native_enum',\n discriminator: 'native_enum',\n name: { required: true },\n parameters: {},\n variadicParameters: true,\n },\n} as const satisfies AuthoringPslBlockDescriptorNamespace;\n\n/**\n * `@@` model attributes contributed by the Postgres target pack.\n *\n * `@@rls` is argument-less: presence marks the model's table\n * RLS-controlled. It lowers to a {@link PostgresRlsEnablement} marker in\n * the namespace's `entries.rls`, keyed by the model's table name — the\n * marker (never the policy set) is what drives\n * `ENABLE`/`DISABLE ROW LEVEL SECURITY` planning.\n */\nexport const postgresAuthoringModelAttributes = {\n rls: {\n kind: 'modelAttribute',\n attribute: 'rls',\n spec: modelAttribute('rls', {}),\n lower: (_parsed: Record<never, never>, ctx: AuthoringModelAttributeContext) => ({\n key: ctx.storageName,\n entity: new PostgresRlsEnablement({\n tableName: ctx.storageName,\n namespaceId: ctx.namespaceId,\n }),\n }),\n },\n} as const satisfies AuthoringModelAttributeDescriptorNamespace;\n\nexport const postgresAuthoringFieldPresets = {\n text: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/text@1',\n nativeType: 'text',\n },\n },\n int: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/int4@1',\n nativeType: 'int4',\n },\n },\n bigint: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/int8@1',\n nativeType: 'int8',\n },\n },\n float: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/float8@1',\n nativeType: 'float8',\n },\n },\n decimal: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/numeric@1',\n nativeType: 'numeric',\n },\n },\n boolean: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/bool@1',\n nativeType: 'bool',\n },\n },\n json: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/jsonb@1',\n nativeType: 'jsonb',\n },\n },\n bytes: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/bytea@1',\n nativeType: 'bytea',\n },\n },\n dateTime: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/timestamptz@1',\n nativeType: 'timestamptz',\n },\n },\n temporal: /* @__PURE__ */ temporalAuthoringPresets({\n codecId: 'pg/timestamptz@1',\n nativeType: 'timestamptz',\n }),\n uuidNative: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/uuid@1',\n nativeType: 'uuid',\n },\n },\n id: {\n uuidv4Native: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/uuid@1',\n nativeType: 'uuid',\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'uuidv4',\n },\n },\n id: true,\n },\n },\n uuidv7Native: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/uuid@1',\n nativeType: 'uuid',\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'uuidv7',\n },\n },\n id: true,\n },\n },\n },\n} as const satisfies AuthoringFieldNamespace;\n"],"mappings":";;;;;;;;;;;;;;;AAoCA,MAAa,yBAAyB,EACpC,IAAI,EACF,MAAM;CACJ,MAAM;CACN,cAAc;EAAE,OAAO;EAAG,YAAY;CAAc;CACpD,QAAQ,EACN,SAAS,iBACX;AACF,EACF,EACF;AAMA,SAAS,aAAa,OAA0B,KAAiC;CAC/E,MAAM,QAAQ,MAAM,WAAW;CAC/B,OAAO,OAAO,SAAS,QAAQ,MAAM,aAAa,KAAA;AACpD;AAEA,SAAS,eAAe,OAA0B,KAAiC;CACjF,MAAM,QAAQ,MAAM,WAAW;CAC/B,OAAO,OAAO,SAAS,UAAU,MAAM,MAAM,KAAA;AAC/C;AAEA,SAAS,kBAAkB,OAA0B,KAAuB;CAC1E,MAAM,QAAQ,MAAM,WAAW;CAC/B,IAAI,OAAO,SAAS,QAAQ,OAAO,CAAC;CACpC,OAAO,MAAM,MAAM,SAAS,SAAU,KAAK,SAAS,QAAQ,CAAC,KAAK,UAAU,IAAI,CAAC,CAAE;AACrF;;;;;;;AAQA,SAAS,mBAAmB,KAAqB;CAC/C,I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
1
+ //#region src/core/rls/canonicalize.d.ts
2
+ type RlsPolicyOperation = 'select' | 'insert' | 'update' | 'delete' | 'all';
3
+ interface ContentHashParts {
4
+ readonly using?: string;
5
+ readonly withCheck?: string;
6
+ readonly roles: readonly string[];
7
+ readonly operation: RlsPolicyOperation;
8
+ readonly permissive: boolean;
9
+ }
10
+ /**
11
+ * Stabilizes an authored predicate for hashing: trim, and collapse runs of
12
+ * internal whitespace to a single space.
13
+ *
14
+ * This is deliberately minimal. The content hash is the equivalence relation
15
+ * for a policy, and the wire name (prefix + hash) is the only thing ever
16
+ * compared — we never recompute the hash from an introspected policy body, so
17
+ * there is no need to match Postgres's reprinted form. Minimal normalization
18
+ * also protects the no-collision property: aggressive rewriting (lowercasing,
19
+ * paren-stripping, cast-alias folding) risks collapsing two distinct predicates
20
+ * onto one hash. Out-of-band alteration of a hashed policy is unsupported.
21
+ *
22
+ * The normalizer is a stability commitment: any change re-suffixes all wire names.
23
+ */
24
+ declare function normalizePredicate(sql: string): string;
25
+ /**
26
+ * Returns the first 8 lowercase hex characters of the SHA-256 digest over the
27
+ * canonical content tuple for an RLS policy:
28
+ *
29
+ * [normalize(using), normalize(withCheck), sortedRoles, operation, permissive]
30
+ *
31
+ * Schema and table are excluded (they are orthogonal to policy equivalence).
32
+ * Uses `JSON.stringify` for a deterministic encoding.
33
+ */
34
+ declare function computeContentHash(parts: ContentHashParts): string;
35
+ //#endregion
36
+ export { normalizePredicate as i, RlsPolicyOperation as n, computeContentHash as r, ContentHashParts as t };
37
+ //# sourceMappingURL=canonicalize-CAbXtVtB.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonicalize-CAbXtVtB.d.mts","names":[],"sources":["../src/core/rls/canonicalize.ts"],"mappings":";KAEY,kBAAA;AAAA,UAEK,gBAAA;EAAA,SACN,KAAA;EAAA,SACA,SAAA;EAAA,SACA,KAAA;EAAA,SACA,SAAA,EAAW,kBAAkB;EAAA,SAC7B,UAAA;AAAA;;;;;;;;;;AAAU;AAiBrB;;;;iBAAgB,kBAAA,CAAmB,GAAW;AAa9C;;;;AAA0D;;;;;AAA1D,iBAAgB,kBAAA,CAAmB,KAAuB,EAAhB,gBAAgB"}
@@ -3,6 +3,7 @@ import { SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC
3
3
  //#region src/core/codec-ids.d.ts
4
4
  declare const PG_TEXT_CODEC_ID: "pg/text@1";
5
5
  declare const PG_TEXT_ARRAY_CODEC_ID: "pg/text-array@1";
6
+ declare const PG_ENUM_CODEC_ID: "pg/enum@1";
6
7
  declare const PG_CHAR_CODEC_ID: "pg/char@1";
7
8
  declare const PG_VARCHAR_CODEC_ID: "pg/varchar@1";
8
9
  declare const PG_INT_CODEC_ID: "pg/int@1";
@@ -26,5 +27,5 @@ declare const PG_JSONB_CODEC_ID: "pg/jsonb@1";
26
27
  declare const PG_BYTEA_CODEC_ID: "pg/bytea@1";
27
28
  declare const PG_UUID_CODEC_ID: "pg/uuid@1";
28
29
  //#endregion
29
- export { SQL_VARCHAR_CODEC_ID as A, PG_VARBIT_CODEC_ID as C, SQL_INT_CODEC_ID as D, SQL_FLOAT_CODEC_ID as E, SQL_TEXT_CODEC_ID as O, PG_UUID_CODEC_ID as S, SQL_CHAR_CODEC_ID as T, PG_TEXT_CODEC_ID as _, PG_FLOAT4_CODEC_ID as a, PG_TIMETZ_CODEC_ID as b, PG_INT2_CODEC_ID as c, PG_INTERVAL_CODEC_ID as d, PG_INT_CODEC_ID as f, PG_TEXT_ARRAY_CODEC_ID as g, PG_NUMERIC_CODEC_ID as h, PG_CHAR_CODEC_ID as i, SQL_TIMESTAMP_CODEC_ID as k, PG_INT4_CODEC_ID as l, PG_JSON_CODEC_ID as m, PG_BOOL_CODEC_ID as n, PG_FLOAT8_CODEC_ID as o, PG_JSONB_CODEC_ID as p, PG_BYTEA_CODEC_ID as r, PG_FLOAT_CODEC_ID as s, PG_BIT_CODEC_ID as t, PG_INT8_CODEC_ID as u, PG_TIMESTAMPTZ_CODEC_ID as v, PG_VARCHAR_CODEC_ID as w, PG_TIME_CODEC_ID as x, PG_TIMESTAMP_CODEC_ID as y };
30
- //# sourceMappingURL=codec-ids-CnXu9Qy3.d.mts.map
30
+ export { SQL_TIMESTAMP_CODEC_ID as A, PG_UUID_CODEC_ID as C, SQL_FLOAT_CODEC_ID as D, SQL_CHAR_CODEC_ID as E, SQL_INT_CODEC_ID as O, PG_TIME_CODEC_ID as S, PG_VARCHAR_CODEC_ID as T, PG_TEXT_ARRAY_CODEC_ID as _, PG_ENUM_CODEC_ID as a, PG_TIMESTAMP_CODEC_ID as b, PG_FLOAT_CODEC_ID as c, PG_INT8_CODEC_ID as d, PG_INTERVAL_CODEC_ID as f, PG_NUMERIC_CODEC_ID as g, PG_JSON_CODEC_ID as h, PG_CHAR_CODEC_ID as i, SQL_VARCHAR_CODEC_ID as j, SQL_TEXT_CODEC_ID as k, PG_INT2_CODEC_ID as l, PG_JSONB_CODEC_ID as m, PG_BOOL_CODEC_ID as n, PG_FLOAT4_CODEC_ID as o, PG_INT_CODEC_ID as p, PG_BYTEA_CODEC_ID as r, PG_FLOAT8_CODEC_ID as s, PG_BIT_CODEC_ID as t, PG_INT4_CODEC_ID as u, PG_TEXT_CODEC_ID as v, PG_VARBIT_CODEC_ID as w, PG_TIMETZ_CODEC_ID as x, PG_TIMESTAMPTZ_CODEC_ID as y };
31
+ //# sourceMappingURL=codec-ids-BzrFF-I4.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-ids-BzrFF-I4.d.mts","names":[],"sources":["../src/core/codec-ids.ts"],"mappings":";;;cAQa,gBAAA;AAAA,cACA,sBAAA;AAAA,cACA,gBAAA;AAAA,cACA,gBAAA;AAAA,cACA,mBAAA;AAAA,cACA,eAAA;AAAA,cACA,gBAAA;AAAA,cACA,gBAAA;AAAA,cACA,gBAAA;AAAA,cACA,iBAAA;AAAA,cACA,kBAAA;AAAA,cACA,kBAAA;AAAA,cACA,mBAAA;AAAA,cACA,gBAAA;AAAA,cACA,eAAA;AAAA,cACA,kBAAA;AAAA,cACA,qBAAA;AAAA,cACA,uBAAA;AAAA,cACA,gBAAA;AAAA,cACA,kBAAA;AAAA,cACA,oBAAA;AAAA,cACA,gBAAA;AAAA,cACA,iBAAA;AAAA,cACA,iBAAA;AAAA,cACA,gBAAA"}
@@ -2,6 +2,7 @@ import { SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC
2
2
  //#region src/core/codec-ids.ts
3
3
  const PG_TEXT_CODEC_ID = "pg/text@1";
4
4
  const PG_TEXT_ARRAY_CODEC_ID = "pg/text-array@1";
5
+ const PG_ENUM_CODEC_ID = "pg/enum@1";
5
6
  const PG_CHAR_CODEC_ID = "pg/char@1";
6
7
  const PG_VARCHAR_CODEC_ID = "pg/varchar@1";
7
8
  const PG_INT_CODEC_ID = "pg/int@1";
@@ -25,6 +26,6 @@ const PG_JSONB_CODEC_ID = "pg/jsonb@1";
25
26
  const PG_BYTEA_CODEC_ID = "pg/bytea@1";
26
27
  const PG_UUID_CODEC_ID = "pg/uuid@1";
27
28
  //#endregion
28
- export { SQL_VARCHAR_CODEC_ID as A, PG_VARBIT_CODEC_ID as C, SQL_INT_CODEC_ID as D, SQL_FLOAT_CODEC_ID as E, SQL_TEXT_CODEC_ID as O, PG_UUID_CODEC_ID as S, SQL_CHAR_CODEC_ID as T, PG_TEXT_CODEC_ID as _, PG_FLOAT4_CODEC_ID as a, PG_TIMETZ_CODEC_ID as b, PG_INT2_CODEC_ID as c, PG_INTERVAL_CODEC_ID as d, PG_INT_CODEC_ID as f, PG_TEXT_ARRAY_CODEC_ID as g, PG_NUMERIC_CODEC_ID as h, PG_CHAR_CODEC_ID as i, SQL_TIMESTAMP_CODEC_ID as k, PG_INT4_CODEC_ID as l, PG_JSON_CODEC_ID as m, PG_BOOL_CODEC_ID as n, PG_FLOAT8_CODEC_ID as o, PG_JSONB_CODEC_ID as p, PG_BYTEA_CODEC_ID as r, PG_FLOAT_CODEC_ID as s, PG_BIT_CODEC_ID as t, PG_INT8_CODEC_ID as u, PG_TIMESTAMPTZ_CODEC_ID as v, PG_VARCHAR_CODEC_ID as w, PG_TIME_CODEC_ID as x, PG_TIMESTAMP_CODEC_ID as y };
29
+ export { SQL_TIMESTAMP_CODEC_ID as A, PG_UUID_CODEC_ID as C, SQL_FLOAT_CODEC_ID as D, SQL_CHAR_CODEC_ID as E, SQL_INT_CODEC_ID as O, PG_TIME_CODEC_ID as S, PG_VARCHAR_CODEC_ID as T, PG_TEXT_ARRAY_CODEC_ID as _, PG_ENUM_CODEC_ID as a, PG_TIMESTAMP_CODEC_ID as b, PG_FLOAT_CODEC_ID as c, PG_INT8_CODEC_ID as d, PG_INTERVAL_CODEC_ID as f, PG_NUMERIC_CODEC_ID as g, PG_JSON_CODEC_ID as h, PG_CHAR_CODEC_ID as i, SQL_VARCHAR_CODEC_ID as j, SQL_TEXT_CODEC_ID as k, PG_INT2_CODEC_ID as l, PG_JSONB_CODEC_ID as m, PG_BOOL_CODEC_ID as n, PG_FLOAT4_CODEC_ID as o, PG_INT_CODEC_ID as p, PG_BYTEA_CODEC_ID as r, PG_FLOAT8_CODEC_ID as s, PG_BIT_CODEC_ID as t, PG_INT4_CODEC_ID as u, PG_TEXT_CODEC_ID as v, PG_VARBIT_CODEC_ID as w, PG_TIMETZ_CODEC_ID as x, PG_TIMESTAMPTZ_CODEC_ID as y };
29
30
 
30
- //# sourceMappingURL=codec-ids-BvytN2P8.mjs.map
31
+ //# sourceMappingURL=codec-ids-C_-Hj6bL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-ids-C_-Hj6bL.mjs","names":[],"sources":["../src/core/codec-ids.ts"],"sourcesContent":["export {\n SQL_CHAR_CODEC_ID,\n SQL_FLOAT_CODEC_ID,\n SQL_INT_CODEC_ID,\n SQL_TEXT_CODEC_ID,\n SQL_TIMESTAMP_CODEC_ID,\n SQL_VARCHAR_CODEC_ID,\n} from '@prisma-next/sql-relational-core/ast';\nexport const PG_TEXT_CODEC_ID = 'pg/text@1' as const;\nexport const PG_TEXT_ARRAY_CODEC_ID = 'pg/text-array@1' as const;\nexport const PG_ENUM_CODEC_ID = 'pg/enum@1' as const;\nexport const PG_CHAR_CODEC_ID = 'pg/char@1' as const;\nexport const PG_VARCHAR_CODEC_ID = 'pg/varchar@1' as const;\nexport const PG_INT_CODEC_ID = 'pg/int@1' as const;\nexport const PG_INT2_CODEC_ID = 'pg/int2@1' as const;\nexport const PG_INT4_CODEC_ID = 'pg/int4@1' as const;\nexport const PG_INT8_CODEC_ID = 'pg/int8@1' as const;\nexport const PG_FLOAT_CODEC_ID = 'pg/float@1' as const;\nexport const PG_FLOAT4_CODEC_ID = 'pg/float4@1' as const;\nexport const PG_FLOAT8_CODEC_ID = 'pg/float8@1' as const;\nexport const PG_NUMERIC_CODEC_ID = 'pg/numeric@1' as const;\nexport const PG_BOOL_CODEC_ID = 'pg/bool@1' as const;\nexport const PG_BIT_CODEC_ID = 'pg/bit@1' as const;\nexport const PG_VARBIT_CODEC_ID = 'pg/varbit@1' as const;\nexport const PG_TIMESTAMP_CODEC_ID = 'pg/timestamp@1' as const;\nexport const PG_TIMESTAMPTZ_CODEC_ID = 'pg/timestamptz@1' as const;\nexport const PG_TIME_CODEC_ID = 'pg/time@1' as const;\nexport const PG_TIMETZ_CODEC_ID = 'pg/timetz@1' as const;\nexport const PG_INTERVAL_CODEC_ID = 'pg/interval@1' as const;\nexport const PG_JSON_CODEC_ID = 'pg/json@1' as const;\nexport const PG_JSONB_CODEC_ID = 'pg/jsonb@1' as const;\nexport const PG_BYTEA_CODEC_ID = 'pg/bytea@1' as const;\nexport const PG_UUID_CODEC_ID = 'pg/uuid@1' as const;\n"],"mappings":";;AAQA,MAAa,mBAAmB;AAChC,MAAa,yBAAyB;AACtC,MAAa,mBAAmB;AAChC,MAAa,mBAAmB;AAChC,MAAa,sBAAsB;AACnC,MAAa,kBAAkB;AAC/B,MAAa,mBAAmB;AAChC,MAAa,mBAAmB;AAChC,MAAa,mBAAmB;AAChC,MAAa,oBAAoB;AACjC,MAAa,qBAAqB;AAClC,MAAa,qBAAqB;AAClC,MAAa,sBAAsB;AACnC,MAAa,mBAAmB;AAChC,MAAa,kBAAkB;AAC/B,MAAa,qBAAqB;AAClC,MAAa,wBAAwB;AACrC,MAAa,0BAA0B;AACvC,MAAa,mBAAmB;AAChC,MAAa,qBAAqB;AAClC,MAAa,uBAAuB;AACpC,MAAa,mBAAmB;AAChC,MAAa,oBAAoB;AACjC,MAAa,oBAAoB;AACjC,MAAa,mBAAmB"}
@@ -1,2 +1,2 @@
1
- import { A as SQL_VARCHAR_CODEC_ID, C as PG_VARBIT_CODEC_ID, D as SQL_INT_CODEC_ID, E as SQL_FLOAT_CODEC_ID, O as SQL_TEXT_CODEC_ID, S as PG_UUID_CODEC_ID, T as SQL_CHAR_CODEC_ID, _ as PG_TEXT_CODEC_ID, a as PG_FLOAT4_CODEC_ID, b as PG_TIMETZ_CODEC_ID, c as PG_INT2_CODEC_ID, d as PG_INTERVAL_CODEC_ID, f as PG_INT_CODEC_ID, g as PG_TEXT_ARRAY_CODEC_ID, h as PG_NUMERIC_CODEC_ID, i as PG_CHAR_CODEC_ID, k as SQL_TIMESTAMP_CODEC_ID, l as PG_INT4_CODEC_ID, m as PG_JSON_CODEC_ID, n as PG_BOOL_CODEC_ID, o as PG_FLOAT8_CODEC_ID, p as PG_JSONB_CODEC_ID, r as PG_BYTEA_CODEC_ID, s as PG_FLOAT_CODEC_ID, t as PG_BIT_CODEC_ID, u as PG_INT8_CODEC_ID, v as PG_TIMESTAMPTZ_CODEC_ID, w as PG_VARCHAR_CODEC_ID, x as PG_TIME_CODEC_ID, y as PG_TIMESTAMP_CODEC_ID } from "./codec-ids-CnXu9Qy3.mjs";
2
- export { PG_BIT_CODEC_ID, PG_BOOL_CODEC_ID, PG_BYTEA_CODEC_ID, PG_CHAR_CODEC_ID, PG_FLOAT4_CODEC_ID, PG_FLOAT8_CODEC_ID, PG_FLOAT_CODEC_ID, PG_INT2_CODEC_ID, PG_INT4_CODEC_ID, PG_INT8_CODEC_ID, PG_INTERVAL_CODEC_ID, PG_INT_CODEC_ID, PG_JSONB_CODEC_ID, PG_JSON_CODEC_ID, PG_NUMERIC_CODEC_ID, PG_TEXT_ARRAY_CODEC_ID, PG_TEXT_CODEC_ID, PG_TIMESTAMPTZ_CODEC_ID, PG_TIMESTAMP_CODEC_ID, PG_TIMETZ_CODEC_ID, PG_TIME_CODEC_ID, PG_UUID_CODEC_ID, PG_VARBIT_CODEC_ID, PG_VARCHAR_CODEC_ID, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID };
1
+ import { A as SQL_TIMESTAMP_CODEC_ID, C as PG_UUID_CODEC_ID, D as SQL_FLOAT_CODEC_ID, E as SQL_CHAR_CODEC_ID, O as SQL_INT_CODEC_ID, S as PG_TIME_CODEC_ID, T as PG_VARCHAR_CODEC_ID, _ as PG_TEXT_ARRAY_CODEC_ID, a as PG_ENUM_CODEC_ID, b as PG_TIMESTAMP_CODEC_ID, c as PG_FLOAT_CODEC_ID, d as PG_INT8_CODEC_ID, f as PG_INTERVAL_CODEC_ID, g as PG_NUMERIC_CODEC_ID, h as PG_JSON_CODEC_ID, i as PG_CHAR_CODEC_ID, j as SQL_VARCHAR_CODEC_ID, k as SQL_TEXT_CODEC_ID, l as PG_INT2_CODEC_ID, m as PG_JSONB_CODEC_ID, n as PG_BOOL_CODEC_ID, o as PG_FLOAT4_CODEC_ID, p as PG_INT_CODEC_ID, r as PG_BYTEA_CODEC_ID, s as PG_FLOAT8_CODEC_ID, t as PG_BIT_CODEC_ID, u as PG_INT4_CODEC_ID, v as PG_TEXT_CODEC_ID, w as PG_VARBIT_CODEC_ID, x as PG_TIMETZ_CODEC_ID, y as PG_TIMESTAMPTZ_CODEC_ID } from "./codec-ids-BzrFF-I4.mjs";
2
+ export { PG_BIT_CODEC_ID, PG_BOOL_CODEC_ID, PG_BYTEA_CODEC_ID, PG_CHAR_CODEC_ID, PG_ENUM_CODEC_ID, PG_FLOAT4_CODEC_ID, PG_FLOAT8_CODEC_ID, PG_FLOAT_CODEC_ID, PG_INT2_CODEC_ID, PG_INT4_CODEC_ID, PG_INT8_CODEC_ID, PG_INTERVAL_CODEC_ID, PG_INT_CODEC_ID, PG_JSONB_CODEC_ID, PG_JSON_CODEC_ID, PG_NUMERIC_CODEC_ID, PG_TEXT_ARRAY_CODEC_ID, PG_TEXT_CODEC_ID, PG_TIMESTAMPTZ_CODEC_ID, PG_TIMESTAMP_CODEC_ID, PG_TIMETZ_CODEC_ID, PG_TIME_CODEC_ID, PG_UUID_CODEC_ID, PG_VARBIT_CODEC_ID, PG_VARCHAR_CODEC_ID, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID };
@@ -1,2 +1,2 @@
1
- import { A as SQL_VARCHAR_CODEC_ID, C as PG_VARBIT_CODEC_ID, D as SQL_INT_CODEC_ID, E as SQL_FLOAT_CODEC_ID, O as SQL_TEXT_CODEC_ID, S as PG_UUID_CODEC_ID, T as SQL_CHAR_CODEC_ID, _ as PG_TEXT_CODEC_ID, a as PG_FLOAT4_CODEC_ID, b as PG_TIMETZ_CODEC_ID, c as PG_INT2_CODEC_ID, d as PG_INTERVAL_CODEC_ID, f as PG_INT_CODEC_ID, g as PG_TEXT_ARRAY_CODEC_ID, h as PG_NUMERIC_CODEC_ID, i as PG_CHAR_CODEC_ID, k as SQL_TIMESTAMP_CODEC_ID, l as PG_INT4_CODEC_ID, m as PG_JSON_CODEC_ID, n as PG_BOOL_CODEC_ID, o as PG_FLOAT8_CODEC_ID, p as PG_JSONB_CODEC_ID, r as PG_BYTEA_CODEC_ID, s as PG_FLOAT_CODEC_ID, t as PG_BIT_CODEC_ID, u as PG_INT8_CODEC_ID, v as PG_TIMESTAMPTZ_CODEC_ID, w as PG_VARCHAR_CODEC_ID, x as PG_TIME_CODEC_ID, y as PG_TIMESTAMP_CODEC_ID } from "./codec-ids-BvytN2P8.mjs";
2
- export { PG_BIT_CODEC_ID, PG_BOOL_CODEC_ID, PG_BYTEA_CODEC_ID, PG_CHAR_CODEC_ID, PG_FLOAT4_CODEC_ID, PG_FLOAT8_CODEC_ID, PG_FLOAT_CODEC_ID, PG_INT2_CODEC_ID, PG_INT4_CODEC_ID, PG_INT8_CODEC_ID, PG_INTERVAL_CODEC_ID, PG_INT_CODEC_ID, PG_JSONB_CODEC_ID, PG_JSON_CODEC_ID, PG_NUMERIC_CODEC_ID, PG_TEXT_ARRAY_CODEC_ID, PG_TEXT_CODEC_ID, PG_TIMESTAMPTZ_CODEC_ID, PG_TIMESTAMP_CODEC_ID, PG_TIMETZ_CODEC_ID, PG_TIME_CODEC_ID, PG_UUID_CODEC_ID, PG_VARBIT_CODEC_ID, PG_VARCHAR_CODEC_ID, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID };
1
+ import { A as SQL_TIMESTAMP_CODEC_ID, C as PG_UUID_CODEC_ID, D as SQL_FLOAT_CODEC_ID, E as SQL_CHAR_CODEC_ID, O as SQL_INT_CODEC_ID, S as PG_TIME_CODEC_ID, T as PG_VARCHAR_CODEC_ID, _ as PG_TEXT_ARRAY_CODEC_ID, a as PG_ENUM_CODEC_ID, b as PG_TIMESTAMP_CODEC_ID, c as PG_FLOAT_CODEC_ID, d as PG_INT8_CODEC_ID, f as PG_INTERVAL_CODEC_ID, g as PG_NUMERIC_CODEC_ID, h as PG_JSON_CODEC_ID, i as PG_CHAR_CODEC_ID, j as SQL_VARCHAR_CODEC_ID, k as SQL_TEXT_CODEC_ID, l as PG_INT2_CODEC_ID, m as PG_JSONB_CODEC_ID, n as PG_BOOL_CODEC_ID, o as PG_FLOAT4_CODEC_ID, p as PG_INT_CODEC_ID, r as PG_BYTEA_CODEC_ID, s as PG_FLOAT8_CODEC_ID, t as PG_BIT_CODEC_ID, u as PG_INT4_CODEC_ID, v as PG_TEXT_CODEC_ID, w as PG_VARBIT_CODEC_ID, x as PG_TIMETZ_CODEC_ID, y as PG_TIMESTAMPTZ_CODEC_ID } from "./codec-ids-C_-Hj6bL.mjs";
2
+ export { PG_BIT_CODEC_ID, PG_BOOL_CODEC_ID, PG_BYTEA_CODEC_ID, PG_CHAR_CODEC_ID, PG_ENUM_CODEC_ID, PG_FLOAT4_CODEC_ID, PG_FLOAT8_CODEC_ID, PG_FLOAT_CODEC_ID, PG_INT2_CODEC_ID, PG_INT4_CODEC_ID, PG_INT8_CODEC_ID, PG_INTERVAL_CODEC_ID, PG_INT_CODEC_ID, PG_JSONB_CODEC_ID, PG_JSON_CODEC_ID, PG_NUMERIC_CODEC_ID, PG_TEXT_ARRAY_CODEC_ID, PG_TEXT_CODEC_ID, PG_TIMESTAMPTZ_CODEC_ID, PG_TIMESTAMP_CODEC_ID, PG_TIMETZ_CODEC_ID, PG_TIME_CODEC_ID, PG_UUID_CODEC_ID, PG_VARBIT_CODEC_ID, PG_VARCHAR_CODEC_ID, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID };
@@ -1,4 +1,4 @@
1
- import { C as PgVarcharDescriptor, S as PgVarbitDescriptor, _ as PgTimeDescriptor, a as PgFloat4Descriptor, b as PgTimetzDescriptor, c as PgInt2Descriptor, d as PgIntDescriptor, f as PgIntervalDescriptor, g as PgTextDescriptor, h as PgNumericDescriptor, i as PgCharDescriptor, l as PgInt4Descriptor, m as PgJsonbDescriptor, n as PgBoolDescriptor, o as PgFloat8Descriptor, p as PgJsonDescriptor, r as PgByteaDescriptor, s as PgFloatDescriptor, t as PgBitDescriptor, u as PgInt8Descriptor, v as PgTimestampDescriptor, x as PgUuidDescriptor, y as PgTimestamptzDescriptor } from "./codecs--0A5_4Bq.mjs";
1
+ import { C as PgUuidDescriptor, S as PgTimetzDescriptor, T as PgVarcharDescriptor, _ as PgNumericDescriptor, b as PgTimestampDescriptor, c as PgFloat8Descriptor, d as PgInt4Descriptor, f as PgInt8Descriptor, g as PgJsonbDescriptor, h as PgJsonDescriptor, i as PgCharDescriptor, l as PgFloatDescriptor, m as PgIntervalDescriptor, n as PgBoolDescriptor, o as PgEnumDescriptor, p as PgIntDescriptor, r as PgByteaDescriptor, s as PgFloat4Descriptor, t as PgBitDescriptor, u as PgInt2Descriptor, v as PgTextDescriptor, w as PgVarbitDescriptor, x as PgTimestamptzDescriptor, y as PgTimeDescriptor } from "./codecs-Cm-nS4mQ.mjs";
2
2
  import { ExtractCodecTypes } from "@prisma-next/sql-relational-core/ast";
3
3
  import { JsonValue as JsonValue$1 } from "@prisma-next/contract/types";
4
4
 
@@ -11,6 +11,7 @@ declare const codecDescriptorMap: {
11
11
  readonly 'sql-text': import("@prisma-next/sql-relational-core/ast").SqlTextDescriptor;
12
12
  readonly 'sql-timestamp': import("@prisma-next/sql-relational-core/ast").SqlTimestampDescriptor;
13
13
  readonly text: PgTextDescriptor;
14
+ readonly enum: PgEnumDescriptor;
14
15
  readonly character: PgCharDescriptor;
15
16
  readonly 'character varying': PgVarcharDescriptor;
16
17
  readonly integer: PgIntDescriptor;
@@ -75,4 +76,4 @@ type Interval<P extends number | undefined = undefined> = BrandedString<{
75
76
  }>;
76
77
  //#endregion
77
78
  export { JsonValue$1 as a, Timestamp as c, VarBit as d, Varchar as f, Interval as i, Timestamptz as l, Char as n, Numeric as o, CodecTypes as r, Time as s, Bit as t, Timetz as u };
78
- //# sourceMappingURL=codec-types-DHCkwPKE.d.mts.map
79
+ //# sourceMappingURL=codec-types-BiIWziRO.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-types-BiIWziRO.d.mts","names":[],"sources":["../src/core/codec-type-map.ts","../src/exports/codec-types.ts"],"mappings":";;;;;cA6Ca,kBAAA;EAAA;;;;;;iBA+BH,gBAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;KAEE,OAAA,6BAAoC,CAAA,0BAA2B,CAAA,CAAE,CAAA,IAAK,CAAA,CAAE,CAAA,EAAG,CAAA;AAAA,KAE3E,kBAAA,UAA4B,kBAAkB;AAAA,KAE9C,mBAAA,GAAsB,iBAAiB,CAAC,kBAAA;;;KCvExC,UAAA,GAAa,OAAO,CAAC,mBAAA;AAAA,KAI5B,OAAA,kBAAyB,MAAA,qBAA2B,CAAA,0BAClC,KAAA,GAAQ,KAAA,CAAM,CAAA;AAAA,KAGhC,aAAA,eAA4B,MAAA,qBAA2B,OAAA,SAAgB,KAAA;AAAA,KAEhE,IAAA,qBAAyB,aAAa;EAAG,YAAA,EAAc,CAAA;AAAA;AAAA,KACvD,OAAA,qBAA4B,aAAa;EAAG,eAAA,EAAiB,CAAA;AAAA;AAAA,KAC7D,OAAA,+DAAsE,aAAA;EAChF,kBAAA,EAAoB,CAAA;EACpB,cAAA,EAAgB,CAAA;AAAA;AAAA,KAEN,GAAA,qBAAwB,aAAa;EAAG,WAAA,EAAa,CAAA;AAAA;AAAA,KACrD,MAAA,qBAA2B,aAAa;EAAG,cAAA,EAAgB,CAAA;AAAA;AAAA,KAC3D,SAAA,6CAAsD,aAAa;EAC7E,oBAAA,EAAsB,CAAA;AAAA;AAAA,KAEZ,WAAA,6CAAwD,aAAa;EAC/E,sBAAA,EAAwB,CAAA;AAAA;AAAA,KAEd,IAAA,6CAAiD,aAAa;EAAG,eAAA,EAAiB,CAAA;AAAA;AAAA,KAClF,MAAA,6CAAmD,aAAa;EAC1E,iBAAA,EAAmB,CAAA;AAAA;AAAA,KAET,QAAA,6CAAqD,aAAa;EAC5E,mBAAA,EAAqB,CAAA;AAAA"}
@@ -1,2 +1,2 @@
1
- import { a as JsonValue, c as Timestamp, d as VarBit, f as Varchar, i as Interval, l as Timestamptz, n as Char, o as Numeric, r as CodecTypes, s as Time, t as Bit, u as Timetz } from "./codec-types-DHCkwPKE.mjs";
1
+ import { a as JsonValue, c as Timestamp, d as VarBit, f as Varchar, i as Interval, l as Timestamptz, n as Char, o as Numeric, r as CodecTypes, s as Time, t as Bit, u as Timetz } from "./codec-types-BiIWziRO.mjs";
2
2
  export { Bit, Char, CodecTypes, Interval, type JsonValue, Numeric, Time, Timestamp, Timestamptz, Timetz, VarBit, Varchar };