@prisma-next/target-postgres 0.15.0-dev.9 → 0.16.0-dev.1

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 (176) hide show
  1. package/dist/{authoring-BtsOWgI3.mjs → authoring-34L18kA1.mjs} +18 -8
  2. package/dist/authoring-34L18kA1.mjs.map +1 -0
  3. package/dist/canonicalize-D1F4vUnP.d.mts.map +1 -1
  4. package/dist/{codec-ids-CI144z7g.d.mts → codec-ids-BswpvvND.d.mts} +3 -3
  5. package/dist/codec-ids-BswpvvND.d.mts.map +1 -0
  6. package/dist/{codec-ids-B10ZZHzw.mjs → codec-ids-D3G8K0YM.mjs} +3 -2
  7. package/dist/codec-ids-D3G8K0YM.mjs.map +1 -0
  8. package/dist/codec-ids.d.mts +2 -2
  9. package/dist/codec-ids.mjs +2 -2
  10. package/dist/{codec-types-CTfT4U4O.d.mts → codec-types-CQ07nOz-.d.mts} +4 -5
  11. package/dist/codec-types-CQ07nOz-.d.mts.map +1 -0
  12. package/dist/codec-types.d.mts +1 -1
  13. package/dist/{codecs-D7W9O0Xx.d.mts → codecs-G4DTY0F_.d.mts} +35 -7
  14. package/dist/codecs-G4DTY0F_.d.mts.map +1 -0
  15. package/dist/{codecs-DRbb26Or.mjs → codecs-TCsGgW-Y.mjs} +77 -5
  16. package/dist/codecs-TCsGgW-Y.mjs.map +1 -0
  17. package/dist/codecs.d.mts +2 -3
  18. package/dist/codecs.d.mts.map +1 -1
  19. package/dist/codecs.mjs +2 -2
  20. package/dist/contract-free.d.mts +2 -3
  21. package/dist/contract-free.d.mts.map +1 -1
  22. package/dist/contract-free.mjs +3 -3
  23. package/dist/{control-policy-UPteqwtU.mjs → control-policy-CZKdMztu.mjs} +4 -4
  24. package/dist/{control-policy-UPteqwtU.mjs.map → control-policy-CZKdMztu.mjs.map} +1 -1
  25. package/dist/control.d.mts +0 -1
  26. package/dist/control.d.mts.map +1 -1
  27. package/dist/control.mjs +74 -24
  28. package/dist/control.mjs.map +1 -1
  29. package/dist/data-transform-BOWpliq8.mjs.map +1 -1
  30. package/dist/{data-transform-DPzwBMhW.d.mts → data-transform-CGvE8yGx.d.mts} +1 -2
  31. package/dist/data-transform-CGvE8yGx.d.mts.map +1 -0
  32. package/dist/data-transform.d.mts +1 -1
  33. package/dist/{ddl-GTTOvjx_.mjs → ddl-DHXKzQ99.mjs} +3 -3
  34. package/dist/{ddl-GTTOvjx_.mjs.map → ddl-DHXKzQ99.mjs.map} +1 -1
  35. package/dist/ddl.d.mts +1 -1
  36. package/dist/default-normalizer-B9ZUiyUE.mjs +264 -0
  37. package/dist/default-normalizer-B9ZUiyUE.mjs.map +1 -0
  38. package/dist/default-normalizer.d.mts +14 -2
  39. package/dist/default-normalizer.d.mts.map +1 -1
  40. package/dist/default-normalizer.mjs +2 -248
  41. package/dist/{descriptor-meta-CFQKLXl_.mjs → descriptor-meta-qubYaxQA.mjs} +9 -4
  42. package/dist/descriptor-meta-qubYaxQA.mjs.map +1 -0
  43. package/dist/{diff-database-schema-47526Pv2.mjs → diff-database-schema-C-hnJ5mr.mjs} +9 -6
  44. package/dist/diff-database-schema-C-hnJ5mr.mjs.map +1 -0
  45. package/dist/diff-database-schema.d.mts +3 -3
  46. package/dist/diff-database-schema.d.mts.map +1 -1
  47. package/dist/diff-database-schema.mjs +1 -1
  48. package/dist/{errors-DO-w0EUS.mjs → errors-ByDS0xJL.mjs} +6 -6
  49. package/dist/errors-ByDS0xJL.mjs.map +1 -0
  50. package/dist/errors.d.mts +4 -4
  51. package/dist/errors.d.mts.map +1 -1
  52. package/dist/errors.mjs +1 -1
  53. package/dist/issue-planner.d.mts +1 -2
  54. package/dist/issue-planner.d.mts.map +1 -1
  55. package/dist/issue-planner.mjs +1 -1
  56. package/dist/migration.d.mts +3 -4
  57. package/dist/migration.d.mts.map +1 -1
  58. package/dist/migration.mjs +2 -2
  59. package/dist/native-type-normalizer.d.mts.map +1 -1
  60. package/dist/{nodes-Dv5eCSq9.d.mts → nodes-CQzM2hR0.d.mts} +1 -2
  61. package/dist/nodes-CQzM2hR0.d.mts.map +1 -0
  62. package/dist/{op-factory-call-Bn9zDx4_.d.mts → op-factory-call-DT7kdjVP.d.mts} +10 -7
  63. package/dist/op-factory-call-DT7kdjVP.d.mts.map +1 -0
  64. package/dist/{op-factory-call-C38NzvQD.mjs → op-factory-call-DuRj7WXX.mjs} +37 -16
  65. package/dist/{op-factory-call-C38NzvQD.mjs.map → op-factory-call-DuRj7WXX.mjs.map} +1 -1
  66. package/dist/op-factory-call.d.mts +2 -2
  67. package/dist/op-factory-call.mjs +2 -2
  68. package/dist/pack.d.mts +122 -6
  69. package/dist/pack.d.mts.map +1 -1
  70. package/dist/pack.mjs +1 -1
  71. package/dist/{planner-uHcFFWkx.mjs → planner-DPGxFcXo.mjs} +7 -7
  72. package/dist/{planner-uHcFFWkx.mjs.map → planner-DPGxFcXo.mjs.map} +1 -1
  73. package/dist/planner-ddl-builders.d.mts +1 -2
  74. package/dist/planner-ddl-builders.d.mts.map +1 -1
  75. package/dist/planner-identity-values.d.mts +0 -1
  76. package/dist/planner-identity-values.d.mts.map +1 -1
  77. package/dist/{planner-produced-postgres-migration-BEY1T0Xm.d.mts → planner-produced-postgres-migration-C-dwGdb2.d.mts} +2 -3
  78. package/dist/planner-produced-postgres-migration-C-dwGdb2.d.mts.map +1 -0
  79. package/dist/{planner-produced-postgres-migration-D7y-PEHK.mjs → planner-produced-postgres-migration-CFDpqWWE.mjs} +2 -2
  80. package/dist/planner-produced-postgres-migration-CFDpqWWE.mjs.map +1 -0
  81. package/dist/planner-produced-postgres-migration.d.mts +1 -1
  82. package/dist/planner-produced-postgres-migration.mjs +1 -1
  83. package/dist/planner-schema-lookup.d.mts +0 -1
  84. package/dist/planner-schema-lookup.d.mts.map +1 -1
  85. package/dist/{planner-sql-checks-zqNfs2XZ.mjs → planner-sql-checks-BuB877wH.mjs} +2 -2
  86. package/dist/{planner-sql-checks-zqNfs2XZ.mjs.map → planner-sql-checks-BuB877wH.mjs.map} +1 -1
  87. package/dist/planner-sql-checks.d.mts +0 -1
  88. package/dist/planner-sql-checks.d.mts.map +1 -1
  89. package/dist/planner-sql-checks.mjs +1 -1
  90. package/dist/planner-target-details-HkP4RrRO.d.mts.map +1 -1
  91. package/dist/planner.d.mts +3 -4
  92. package/dist/planner.d.mts.map +1 -1
  93. package/dist/planner.mjs +2 -2
  94. package/dist/{postgres-contract-view-C9j5cqP0.d.mts → postgres-contract-view-CeU7FJjW.d.mts} +4 -3
  95. package/dist/postgres-contract-view-CeU7FJjW.d.mts.map +1 -0
  96. package/dist/{postgres-contract-view-DM8sN1Ot.mjs → postgres-contract-view-DebHMqGR.mjs} +4 -4
  97. package/dist/{postgres-contract-view-DM8sN1Ot.mjs.map → postgres-contract-view-DebHMqGR.mjs.map} +1 -1
  98. package/dist/{postgres-database-schema-node-DJOTywwQ.d.mts → postgres-database-schema-node-DMXsIwAb.d.mts} +2 -3
  99. package/dist/postgres-database-schema-node-DMXsIwAb.d.mts.map +1 -0
  100. package/dist/{postgres-migration-arMSWU9b.mjs → postgres-migration-C_OPFhIF.mjs} +22 -6
  101. package/dist/postgres-migration-C_OPFhIF.mjs.map +1 -0
  102. package/dist/{postgres-migration-DbckK1su.d.mts → postgres-migration-DLIvzHjX.d.mts} +31 -7
  103. package/dist/postgres-migration-DLIvzHjX.d.mts.map +1 -0
  104. package/dist/{postgres-rls-policy--CSddvMR.d.mts → postgres-rls-policy-CYXdqG9B.d.mts} +1 -2
  105. package/dist/postgres-rls-policy-CYXdqG9B.d.mts.map +1 -0
  106. package/dist/{postgres-schema-Cm4DtiGA.mjs → postgres-schema-CewLYHB7.mjs} +2 -2
  107. package/dist/{postgres-schema-Cm4DtiGA.mjs.map → postgres-schema-CewLYHB7.mjs.map} +1 -1
  108. package/dist/{postgres-schema-DKq6s1P3.d.mts → postgres-schema-FdKRwe7X.d.mts} +3 -4
  109. package/dist/postgres-schema-FdKRwe7X.d.mts.map +1 -0
  110. package/dist/render-ops.d.mts +0 -1
  111. package/dist/render-ops.d.mts.map +1 -1
  112. package/dist/render-typescript.d.mts +0 -1
  113. package/dist/render-typescript.d.mts.map +1 -1
  114. package/dist/{resolve-ddl-schema-XyBaaenM.mjs → resolve-ddl-schema-D0wi_P9Q.mjs} +2 -2
  115. package/dist/{resolve-ddl-schema-XyBaaenM.mjs.map → resolve-ddl-schema-D0wi_P9Q.mjs.map} +1 -1
  116. package/dist/rls-canonicalize.d.mts +0 -1
  117. package/dist/rls-canonicalize.d.mts.map +1 -1
  118. package/dist/runtime.d.mts +1 -2
  119. package/dist/runtime.d.mts.map +1 -1
  120. package/dist/runtime.mjs +1 -1
  121. package/dist/schema-ir-annotations.d.mts +0 -1
  122. package/dist/schema-ir-annotations.d.mts.map +1 -1
  123. package/dist/schema-ir-annotations.mjs +1 -1
  124. package/dist/{schema-node-kinds-CrYzCR1i.d.mts → schema-node-kinds-DxvWh2Ic.d.mts} +1 -2
  125. package/dist/schema-node-kinds-DxvWh2Ic.d.mts.map +1 -0
  126. package/dist/sql-utils.d.mts.map +1 -1
  127. package/dist/{table-source-BvFo7gVs.d.mts → table-source-D5c2fxAQ.d.mts} +1 -2
  128. package/dist/table-source-D5c2fxAQ.d.mts.map +1 -0
  129. package/dist/{types-BDKkx8MA.d.mts → types-D2MLzLBD.d.mts} +1 -2
  130. package/dist/types-D2MLzLBD.d.mts.map +1 -0
  131. package/dist/types.d.mts +5 -5
  132. package/dist/types.mjs +1 -1
  133. package/package.json +21 -21
  134. package/src/core/authoring.ts +18 -5
  135. package/src/core/codec-helpers.ts +53 -1
  136. package/src/core/codec-ids.ts +1 -0
  137. package/src/core/codecs.ts +56 -3
  138. package/src/core/default-normalizer.ts +22 -0
  139. package/src/core/descriptor-meta.ts +2 -0
  140. package/src/core/errors.ts +5 -5
  141. package/src/core/index-types.ts +15 -0
  142. package/src/core/migrations/diff-database-schema.ts +3 -0
  143. package/src/core/migrations/op-factory-call.ts +40 -16
  144. package/src/core/migrations/operations/data-transform.ts +1 -1
  145. package/src/core/migrations/planner-produced-postgres-migration.ts +1 -1
  146. package/src/core/migrations/postgres-migration.ts +62 -2
  147. package/src/core/migrations/runner.ts +12 -11
  148. package/src/core/psl-infer/infer-psl-contract.ts +130 -12
  149. package/src/exports/codecs.ts +2 -0
  150. package/src/exports/control.ts +2 -0
  151. package/src/exports/default-normalizer.ts +1 -1
  152. package/src/exports/op-factory-call.ts +5 -0
  153. package/dist/authoring-BtsOWgI3.mjs.map +0 -1
  154. package/dist/codec-ids-B10ZZHzw.mjs.map +0 -1
  155. package/dist/codec-ids-CI144z7g.d.mts.map +0 -1
  156. package/dist/codec-types-CTfT4U4O.d.mts.map +0 -1
  157. package/dist/codecs-D7W9O0Xx.d.mts.map +0 -1
  158. package/dist/codecs-DRbb26Or.mjs.map +0 -1
  159. package/dist/data-transform-DPzwBMhW.d.mts.map +0 -1
  160. package/dist/default-normalizer.mjs.map +0 -1
  161. package/dist/descriptor-meta-CFQKLXl_.mjs.map +0 -1
  162. package/dist/diff-database-schema-47526Pv2.mjs.map +0 -1
  163. package/dist/errors-DO-w0EUS.mjs.map +0 -1
  164. package/dist/nodes-Dv5eCSq9.d.mts.map +0 -1
  165. package/dist/op-factory-call-Bn9zDx4_.d.mts.map +0 -1
  166. package/dist/planner-produced-postgres-migration-BEY1T0Xm.d.mts.map +0 -1
  167. package/dist/planner-produced-postgres-migration-D7y-PEHK.mjs.map +0 -1
  168. package/dist/postgres-contract-view-C9j5cqP0.d.mts.map +0 -1
  169. package/dist/postgres-database-schema-node-DJOTywwQ.d.mts.map +0 -1
  170. package/dist/postgres-migration-DbckK1su.d.mts.map +0 -1
  171. package/dist/postgres-migration-arMSWU9b.mjs.map +0 -1
  172. package/dist/postgres-rls-policy--CSddvMR.d.mts.map +0 -1
  173. package/dist/postgres-schema-DKq6s1P3.d.mts.map +0 -1
  174. package/dist/schema-node-kinds-CrYzCR1i.d.mts.map +0 -1
  175. package/dist/table-source-BvFo7gVs.d.mts.map +0 -1
  176. package/dist/types-BDKkx8MA.d.mts.map +0 -1
@@ -1,10 +1,10 @@
1
- import { a as PG_ENUM_CODEC_ID } from "./codec-ids-B10ZZHzw.mjs";
1
+ import { o as PG_ENUM_CODEC_ID } from "./codec-ids-D3G8K0YM.mjs";
2
2
  import { t as PostgresNativeEnum } from "./postgres-native-enum-BwVNf0Ku.mjs";
3
- import { _ as PostgresRlsEnablement, d as PostgresRlsEnablementSchema, f as PostgresRlsPolicySchema, g as PostgresRlsPolicy, m as PostgresRole, p as PostgresRoleSchema, u as PostgresNativeEnumSchema } from "./postgres-schema-Cm4DtiGA.mjs";
3
+ import { _ as PostgresRlsEnablement, d as PostgresRlsEnablementSchema, f as PostgresRlsPolicySchema, g as PostgresRlsPolicy, m as PostgresRole, p as PostgresRoleSchema, u as PostgresNativeEnumSchema } from "./postgres-schema-CewLYHB7.mjs";
4
4
  import { a as normalizePredicate, i as computeContentHash, r as POLICY_OPERATION_PREDICATES, t as formatRlsPolicyWireName } from "./wire-name-DbQ9-2RC.mjs";
5
5
  import { UNBOUND_NAMESPACE_ID } from "@prisma-next/framework-components/ir";
6
6
  import { blindCast } from "@prisma-next/utils/casts";
7
- import { temporalAuthoringPresets } from "@prisma-next/family-sql/control";
7
+ import { temporalAuthoringPresets, temporalCodecPresetWithPrecision } from "@prisma-next/family-sql/control";
8
8
  import { ifDefined } from "@prisma-next/utils/defined";
9
9
  import { modelAttribute } from "@prisma-next/psl-parser";
10
10
  import { assertDefined } from "@prisma-next/utils/assertions";
@@ -519,10 +519,20 @@ const postgresAuthoringFieldPresets = {
519
519
  nativeType: "timestamptz"
520
520
  }
521
521
  },
522
- temporal: /* @__PURE__ */ temporalAuthoringPresets({
523
- codecId: "pg/timestamptz@1",
524
- nativeType: "timestamptz"
525
- }),
522
+ temporal: {
523
+ .../* @__PURE__ */ temporalAuthoringPresets({
524
+ codecId: "pg/timestamptz@1",
525
+ nativeType: "timestamptz"
526
+ }),
527
+ timestamp: /* @__PURE__ */ temporalCodecPresetWithPrecision({
528
+ codecId: "pg/timestamp@1",
529
+ nativeType: "timestamp"
530
+ }),
531
+ timestamptz: /* @__PURE__ */ temporalCodecPresetWithPrecision({
532
+ codecId: "pg/timestamptz@1",
533
+ nativeType: "timestamptz"
534
+ })
535
+ },
526
536
  uuidNative: {
527
537
  kind: "fieldPreset",
528
538
  output: {
@@ -671,4 +681,4 @@ function postgresLowerEntityHandles(input) {
671
681
  //#endregion
672
682
  export { postgresAuthoringTypes as a, postgresAuthoringPslBlockDescriptors as i, postgresAuthoringFieldPresets as n, postgresLowerEntityHandles as o, postgresAuthoringModelAttributes as r, postgresAuthoringEntityTypes as t };
673
683
 
674
- //# sourceMappingURL=authoring-BtsOWgI3.mjs.map
684
+ //# sourceMappingURL=authoring-34L18kA1.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authoring-34L18kA1.mjs","names":[],"sources":["../src/core/authoring.ts"],"sourcesContent":["import {\n temporalAuthoringPresets,\n temporalCodecPresetWithPrecision,\n} 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 { UNBOUND_NAMESPACE_ID } from '@prisma-next/framework-components/ir';\nimport { modelAttribute } from '@prisma-next/psl-parser';\nimport type {\n EntityHandleLoweringInput,\n LoweredPackEntity,\n ResolvedEntityHandleRef,\n ResolvedPslModelRefs,\n} from '@prisma-next/sql-contract/entity-handle-lowering-hook';\nimport type { SqlValueSetDerivingEntityTypeOutput } from '@prisma-next/sql-contract/value-set-derivation-hook';\nimport { assertDefined } from '@prisma-next/utils/assertions';\nimport { blindCast } from '@prisma-next/utils/casts';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { PG_ENUM_CODEC_ID } from './codec-ids';\nimport { PostgresNativeEnum } from './postgres-native-enum';\nimport { PostgresRlsEnablement, type PostgresRlsEnablementInput } from './postgres-rls-enablement';\nimport { PostgresRlsPolicy, type RlsPolicyOperation } from './postgres-rls-policy';\nimport { PostgresRole } from './postgres-role';\nimport {\n PostgresNativeEnumSchema,\n PostgresRlsEnablementSchema,\n PostgresRlsPolicySchema,\n PostgresRoleSchema,\n} from './postgres-validators';\nimport {\n computeContentHash,\n normalizePredicate,\n POLICY_OPERATION_PREDICATES,\n} 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 * Model refs the family interpreter resolved from the block's descriptor-\n * declared `refKind: 'model'` parameters before invoking this factory\n * (keyed by parameter name). An unresolved required ref is the\n * interpreter's diagnostic; the factory is never called with one missing.\n */\n readonly resolvedModelRefs?: ResolvedPslModelRefs;\n}\n\n/** A parsed `role` block annotated with its lexical namespace id by the interpreter. */\nexport interface RoleExtensionBlock extends PslExtensionBlock {\n readonly namespaceId: string;\n}\n\n/**\n * Maps a `policy_<op>` keyword to the RLS operation it authors. The keyword\n * IS the operation (per the project's rejection of a `policy { operation = … }`\n * conditional block).\n */\nconst POLICY_KEYWORD_OPERATION: Readonly<Record<string, RlsPolicyOperation>> = {\n policy_select: 'select',\n policy_insert: 'insert',\n policy_update: 'update',\n policy_delete: 'delete',\n policy_all: 'all',\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\n/**\n * Assembles a {@link PostgresRlsPolicy} from lowered inputs: normalizes the\n * predicates, computes the content-hash wire name, and constructs the frozen\n * entity. The single hash-assembly body shared by the PSL block lowering\n * ({@link lowerRlsPolicyFromBlock}) and the TS entity-handle lowering\n * ({@link postgresLowerEntityHandles}) so the two surfaces cannot drift.\n */\nfunction buildRlsPolicyEntity(input: {\n readonly prefix: string;\n readonly tableName: string;\n readonly namespaceId: string;\n readonly operation: RlsPolicyOperation;\n readonly roles: readonly string[];\n readonly using?: string;\n readonly withCheck?: string;\n}): PostgresRlsPolicy {\n const wireHash = computeContentHash({\n ...ifDefined('using', input.using !== undefined ? normalizePredicate(input.using) : undefined),\n ...ifDefined(\n 'withCheck',\n input.withCheck !== undefined ? normalizePredicate(input.withCheck) : undefined,\n ),\n roles: input.roles,\n operation: input.operation,\n permissive: true,\n });\n\n return new PostgresRlsPolicy({\n name: formatRlsPolicyWireName(input.prefix, wireHash),\n prefix: input.prefix,\n tableName: input.tableName,\n namespaceId: input.namespaceId,\n operation: input.operation,\n roles: input.roles,\n ...ifDefined('using', input.using),\n ...ifDefined('withCheck', input.withCheck),\n permissive: true,\n });\n}\n\nfunction lowerRlsPolicyFromBlock(\n block: RlsPolicyExtensionBlock,\n ctx: AuthoringEntityContext,\n): PostgresRlsPolicy | undefined {\n const prefix = block.name;\n const operation = POLICY_KEYWORD_OPERATION[block.keyword] ?? 'select';\n // The interpreter resolves the descriptor-declared `target` model ref to\n // its storage table name before invoking this factory (an unresolved or\n // missing required ref is the interpreter's diagnostic), so a lookup miss\n // here is structurally impossible.\n const tableName = block.resolvedModelRefs?.['target']?.tableName;\n assertDefined(\n tableName,\n `lowerRlsPolicyFromBlock: policy \"${block.name}\" reached the factory without a resolved \\`target\\` ref; the interpreter resolves same-namespace model refs before invoking entity factories.`,\n );\n const roles = [...readListRefParams(block, 'roles')].sort();\n\n const usingRaw = readValueParam(block, 'using');\n const withCheckRaw = readValueParam(block, 'withCheck');\n\n // Reject a predicate the operation does not take (e.g. `using` on INSERT, or\n // `withCheck` on SELECT/DELETE). The descriptor's param set already omits it,\n // but the generic descriptor validator is not wired into the SQL-family\n // interpreter, so the lowering enforces the per-operation predicate matrix\n // directly — a wrong predicate is a load-time diagnostic, not a silent drop.\n const support = POLICY_OPERATION_PREDICATES[operation];\n const rejectPredicate = (predicate: 'using' | 'withCheck'): undefined => {\n ctx.diagnostics?.push({\n code: 'PSL_RLS_PREDICATE_NOT_FOR_OPERATION',\n message: `\\`${block.keyword}\\` policy \"${block.name}\" does not take a \\`${predicate}\\` predicate; the ${operation.toUpperCase()} operation uses ${support.using ? '`using`' : '`withCheck`'}${support.using && support.withCheck ? ' and `withCheck`' : ' only'}.`,\n sourceId: ctx.sourceId ?? 'unknown',\n span: block.parameters[predicate]?.span ?? block.span,\n });\n return undefined;\n };\n if (usingRaw !== undefined && !support.using) return rejectPredicate('using');\n if (withCheckRaw !== undefined && !support.withCheck) return rejectPredicate('withCheck');\n\n const using = usingRaw !== undefined ? unwrapQuotedString(usingRaw) : undefined;\n const withCheck = withCheckRaw !== undefined ? unwrapQuotedString(withCheckRaw) : undefined;\n\n return buildRlsPolicyEntity({\n prefix,\n tableName,\n namespaceId: block.namespaceId,\n operation,\n roles,\n ...ifDefined('using', using),\n ...ifDefined('withCheck', withCheck),\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\n/**\n * Lowers a `role <name> {}` block into a {@link PostgresRole}. Roles are\n * cluster-scoped in Postgres, so the block must be declared inside\n * `namespace unbound { … }` — any other lexical namespace (a named schema,\n * or the default bucket top-level declarations resolve to) is a load-time\n * diagnostic. The lowered entity carries the unbound coordinate.\n */\nfunction lowerRoleFromBlock(\n block: RoleExtensionBlock,\n ctx: AuthoringEntityContext,\n): PostgresRole | undefined {\n if (block.namespaceId !== UNBOUND_NAMESPACE_ID) {\n ctx.diagnostics?.push({\n code: 'PSL_ROLE_BLOCK_OUTSIDE_UNBOUND_NAMESPACE',\n message: `\\`role\\` block \"${block.name}\" must be declared inside \\`namespace unbound { }\\`, not in namespace \"${block.namespaceId}\"`,\n sourceId: ctx.sourceId ?? 'unknown',\n span: block.span,\n });\n return undefined;\n }\n return new PostgresRole({ name: block.name, namespaceId: UNBOUND_NAMESPACE_ID });\n}\n\nexport const postgresAuthoringEntityTypes = {\n role: {\n kind: 'entity',\n discriminator: 'role',\n validatorSchema: PostgresRoleSchema,\n output: {\n factory: lowerRoleFromBlock,\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 * Shared parameter descriptors for the five `policy_<op>` PSL block\n * keywords. All five share the `policy` discriminator — the parser\n * dispatches by keyword (see the framework's PSL-block SPI), and every\n * keyword's factory lowers to `PostgresRlsPolicy` via `lowerRlsPolicyFromBlock`.\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 */\nconst policyTargetParam = {\n kind: 'ref',\n refKind: 'model',\n scope: 'same-namespace',\n required: true,\n} as const;\nconst policyRolesParam = {\n kind: 'list',\n of: { kind: 'ref', refKind: 'role', scope: 'cross-space' },\n} as const;\nconst policyPredicateParam = { kind: 'value', codecId: 'pg/text@1', required: true } as const;\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 naming\n// the model and the policy prefix.\nconst policyRequiresRls = { parameter: 'target', attribute: 'rls' } as const;\n\nexport const postgresAuthoringPslBlockDescriptors = {\n // The predicate param set per keyword mirrors Postgres: SELECT/DELETE take\n // USING only; INSERT takes WITH CHECK only; UPDATE/ALL take both. The\n // per-operation predicate matrix is enforced in `lowerRlsPolicyFromBlock`\n // (a wrong predicate for the operation is a load-time diagnostic there),\n // since the generic descriptor validator is not wired into the SQL-family\n // interpreter.\n policy_select: {\n kind: 'pslBlock',\n keyword: 'policy_select',\n discriminator: 'policy',\n name: { required: true },\n parameters: { target: policyTargetParam, roles: policyRolesParam, using: policyPredicateParam },\n requiresModelAttribute: policyRequiresRls,\n },\n policy_delete: {\n kind: 'pslBlock',\n keyword: 'policy_delete',\n discriminator: 'policy',\n name: { required: true },\n parameters: { target: policyTargetParam, roles: policyRolesParam, using: policyPredicateParam },\n requiresModelAttribute: policyRequiresRls,\n },\n policy_insert: {\n kind: 'pslBlock',\n keyword: 'policy_insert',\n discriminator: 'policy',\n name: { required: true },\n parameters: {\n target: policyTargetParam,\n roles: policyRolesParam,\n withCheck: policyPredicateParam,\n },\n requiresModelAttribute: policyRequiresRls,\n },\n policy_update: {\n kind: 'pslBlock',\n keyword: 'policy_update',\n discriminator: 'policy',\n name: { required: true },\n parameters: {\n target: policyTargetParam,\n roles: policyRolesParam,\n using: policyPredicateParam,\n withCheck: policyPredicateParam,\n },\n requiresModelAttribute: policyRequiresRls,\n },\n policy_all: {\n kind: 'pslBlock',\n keyword: 'policy_all',\n discriminator: 'policy',\n name: { required: true },\n parameters: {\n target: policyTargetParam,\n roles: policyRolesParam,\n using: policyPredicateParam,\n withCheck: policyPredicateParam,\n },\n requiresModelAttribute: policyRequiresRls,\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 /**\n * PSL block descriptor for `role` (e.g. `role anon {}`). Name-only, no\n * parameters and no body content. Declared inside `namespace unbound { }`\n * — see {@link lowerRoleFromBlock} for the placement check and the\n * coordinate the lowered entity carries.\n */\n role: {\n kind: 'pslBlock',\n keyword: 'role',\n discriminator: 'role',\n name: { required: true },\n parameters: {},\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: {\n .../* @__PURE__ */ temporalAuthoringPresets({\n codecId: 'pg/timestamptz@1',\n nativeType: 'timestamptz',\n }),\n timestamp: /* @__PURE__ */ temporalCodecPresetWithPrecision({\n codecId: 'pg/timestamp@1',\n nativeType: 'timestamp',\n }),\n timestamptz: /* @__PURE__ */ temporalCodecPresetWithPrecision({\n codecId: 'pg/timestamptz@1',\n nativeType: 'timestamptz',\n }),\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\n/**\n * Postgres identifiers cap at 63 characters and the wire name appends a\n * 9-character `_<8hex>` suffix, so the authored prefix is bounded at 54.\n */\nconst RLS_POLICY_PREFIX_MAX_LENGTH = 54;\n\ninterface RlsRoleHandleShape {\n readonly entityKind: 'role';\n readonly name: string;\n}\n\ninterface RlsPolicyHandleShape {\n readonly entityKind: 'policy';\n readonly operation: RlsPolicyOperation;\n readonly name: string;\n readonly roles: readonly { readonly name: string }[];\n readonly using?: string;\n readonly withCheck?: string;\n}\n\ninterface RlsTargetCoordinate {\n readonly namespaceId: string;\n readonly tableName: string;\n}\n\n/**\n * Resolves an entity handle's `target` ref to a table coordinate of this\n * contract, or throws the load-time diagnostic naming the handle: a\n * cross-space target is rejected (you cannot CREATE POLICY on a table\n * another space owns) and an unresolved target names the model.\n */\nfunction requireLocalTarget(\n refs: Readonly<Record<string, ResolvedEntityHandleRef>>,\n subject: string,\n): RlsTargetCoordinate {\n const target = refs['target'];\n if (target !== undefined && target.kind === 'resolved') {\n return { namespaceId: target.namespaceId, tableName: target.tableName };\n }\n if (target !== undefined && target.kind === 'cross-space') {\n throw new Error(\n `defineContract: ${subject} targets model \"${target.modelName ?? target.tableName}\", which lives in another contract space. Policies and rlsEnabled entries must target a model declared in this contract.`,\n );\n }\n throw new Error(\n `defineContract: ${subject} targets model \"${target?.modelName ?? '<anonymous>'}\", which is not in the contract's models. Add the model to \\`models\\`.`,\n );\n}\n\n/**\n * The SQL-family entity-handle batch lowering hook for the Postgres pack\n * (`SqlEntityHandleLoweringContribution`). Receives every `entities` handle\n * whose kind this pack registered — batch, so the cross-entity diagnostics\n * (duplicate prefix, policy without rlsEnabled, duplicate role) can see\n * sibling handles — and lowers them with the same keying and hash assembly\n * as the PSL path: `policy` keyed by prefix (wire name via\n * {@link buildRlsPolicyEntity}), `rls` keyed by table name, `role` keyed by\n * name and filed under the default namespace (roles are declared\n * contract-wide; PSL has no role block to set a precedent).\n */\nexport function postgresLowerEntityHandles(\n input: EntityHandleLoweringInput,\n): readonly LoweredPackEntity[] {\n const enablements = new Map<\n string,\n { coordinate: RlsTargetCoordinate; entity: PostgresRlsEnablement }\n >();\n const roles = new Map<string, PostgresRole>();\n const policies: {\n readonly handle: RlsPolicyHandleShape;\n readonly refs: Readonly<Record<string, ResolvedEntityHandleRef>>;\n }[] = [];\n const coordinateKey = (coordinate: RlsTargetCoordinate): string =>\n `${coordinate.namespaceId} ${coordinate.tableName}`;\n\n for (const { handle, refs } of input.handles) {\n switch (handle.entityKind) {\n case 'rls': {\n const coordinate = requireLocalTarget(refs, 'an rlsEnabled entry');\n const key = coordinateKey(coordinate);\n if (!enablements.has(key)) {\n enablements.set(key, {\n coordinate,\n entity: new PostgresRlsEnablement({\n tableName: coordinate.tableName,\n namespaceId: coordinate.namespaceId,\n }),\n });\n }\n break;\n }\n case 'role': {\n const roleHandle = blindCast<\n RlsRoleHandleShape,\n 'role handles are constructed only by the postgres contract-builder role() constructor, which enforces this shape'\n >(handle);\n if (roles.has(roleHandle.name)) {\n throw new Error(\n `defineContract: role \"${roleHandle.name}\" is declared more than once in the entities list.`,\n );\n }\n // Roles are cluster-scoped in Postgres, so they always land in the\n // `__unbound__` namespace — identical to a PSL `role` block\n // (`lowerRoleFromBlock`) and matching the `PostgresRole` class's own\n // contract. The declaring surface (TS entities vs PSL) does not move\n // the slot.\n roles.set(\n roleHandle.name,\n new PostgresRole({ name: roleHandle.name, namespaceId: UNBOUND_NAMESPACE_ID }),\n );\n break;\n }\n case 'policy': {\n const policyHandle = blindCast<\n RlsPolicyHandleShape,\n 'policy handles are constructed only by the postgres contract-builder policy*() constructors, which enforce this shape'\n >(handle);\n policies.push({ handle: policyHandle, refs });\n break;\n }\n default:\n throw new Error(\n `defineContract: the postgres pack does not lower \"${handle.entityKind}\" handles from the entities list.`,\n );\n }\n }\n\n const rows: LoweredPackEntity[] = [];\n const seenPrefixes = new Set<string>();\n\n for (const { handle: policy, refs } of policies) {\n const prefix = policy.name;\n if (prefix.length > RLS_POLICY_PREFIX_MAX_LENGTH) {\n throw new Error(\n `defineContract: policy prefix \"${prefix}\" exceeds the ${RLS_POLICY_PREFIX_MAX_LENGTH}-character maximum (Postgres identifiers cap at 63 characters and the wire name appends a 9-character hash suffix).`,\n );\n }\n const coordinate = requireLocalTarget(refs, `policy \"${prefix}\"`);\n if (!enablements.has(coordinateKey(coordinate))) {\n const target = refs['target'];\n throw new Error(\n `defineContract: policy \"${prefix}\" targets model \"${target?.modelName ?? coordinate.tableName}\", whose table is not RLS-enabled. Add rlsEnabled(<model>) to the entities list.`,\n );\n }\n const prefixKey = `${coordinate.namespaceId} ${prefix}`;\n if (seenPrefixes.has(prefixKey)) {\n throw new Error(\n `defineContract: policy prefix \"${prefix}\" is declared more than once in namespace \"${coordinate.namespaceId}\". Policy prefixes must be unique per namespace.`,\n );\n }\n seenPrefixes.add(prefixKey);\n\n const roleNames = [...new Set(policy.roles.map((roleHandle) => roleHandle.name))].sort();\n rows.push({\n namespaceId: coordinate.namespaceId,\n entityKind: 'policy',\n key: prefix,\n entity: buildRlsPolicyEntity({\n prefix,\n tableName: coordinate.tableName,\n namespaceId: coordinate.namespaceId,\n operation: policy.operation,\n roles: roleNames,\n ...ifDefined('using', policy.using),\n ...ifDefined('withCheck', policy.withCheck),\n }),\n });\n }\n\n for (const { coordinate, entity } of enablements.values()) {\n rows.push({\n namespaceId: coordinate.namespaceId,\n entityKind: 'rls',\n key: coordinate.tableName,\n entity,\n });\n }\n for (const [name, entity] of roles) {\n rows.push({ namespaceId: UNBOUND_NAMESPACE_ID, entityKind: 'role', key: name, entity });\n }\n return rows;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqDA,MAAa,yBAAyB,EACpC,IAAI,EACF,MAAM;CACJ,MAAM;CACN,cAAc;EAAE,OAAO;EAAG,YAAY;CAAc;CACpD,QAAQ,EACN,SAAS,iBACX;AACF,EACF,EACF;;;;;;AAuBA,MAAM,2BAAyE;CAC7E,eAAe;CACf,eAAe;CACf,eAAe;CACf,eAAe;CACf,YAAY;AACd;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,IAAI,EAAE,IAAI,WAAW,IAAG,KAAK,IAAI,SAAS,IAAG,KAAK,IAAI,UAAU,IAC9D,OAAO;CAET,MAAM,QAAQ,IAAI,MAAM,GAAG,EAAE;CAC7B,IAAI,SAAS;CACb,K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A,SACN,KAAA;EAAA,SACA,SAAA;EAAA,SACA,KAAA;EAAA,SACA,SAAA,EAAW,kBAAkB;EAAA,SAC7B,UAAA;AAAA;;AAd+D;AAS1E;;;;;;;;;;;AAKqB;iBAiBL,kBAAA,CAAmB,GAAW;;;;AAAA;AAa9C;;;;AAA0D;iBAA1C,kBAAA,CAAmB,KAAuB,EAAhB,gBAAgB"}
1
+ {"version":3,"file":"canonicalize-D1F4vUnP.d.mts","names":[],"sources":["../src/core/rls/canonicalize.ts"],"mappings":";KAEY;;;;;;;;cASC,6BAA6B,SACxC,OAAO;WAA+B;WAAyB;;UAShD;WACN;WACA;WACA;WACA,WAAW;WACX;;;;;;;;;;;;;;;;iBAiBK,mBAAmB;;;;;;;;;;iBAanB,mBAAmB,OAAO"}
@@ -1,5 +1,4 @@
1
1
  import { SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID } from "@prisma-next/sql-relational-core/ast";
2
-
3
2
  //#region src/core/codec-ids.d.ts
4
3
  declare const PG_TEXT_CODEC_ID: "pg/text@1";
5
4
  declare const PG_TEXT_ARRAY_CODEC_ID: "pg/text-array@1";
@@ -17,6 +16,7 @@ declare const PG_NUMERIC_CODEC_ID: "pg/numeric@1";
17
16
  declare const PG_BOOL_CODEC_ID: "pg/bool@1";
18
17
  declare const PG_BIT_CODEC_ID: "pg/bit@1";
19
18
  declare const PG_VARBIT_CODEC_ID: "pg/varbit@1";
19
+ declare const PG_DATE_CODEC_ID: "pg/date@1";
20
20
  declare const PG_TIMESTAMP_CODEC_ID: "pg/timestamp@1";
21
21
  declare const PG_TIMESTAMPTZ_CODEC_ID: "pg/timestamptz@1";
22
22
  declare const PG_TIME_CODEC_ID: "pg/time@1";
@@ -28,5 +28,5 @@ declare const PG_BYTEA_CODEC_ID: "pg/bytea@1";
28
28
  declare const PG_UUID_CODEC_ID: "pg/uuid@1";
29
29
  declare const PG_INET_CODEC_ID: "pg/inet@1";
30
30
  //#endregion
31
- export { SQL_TEXT_CODEC_ID as A, PG_TIME_CODEC_ID as C, SQL_CHAR_CODEC_ID as D, PG_VARCHAR_CODEC_ID as E, SQL_VARCHAR_CODEC_ID as M, SQL_FLOAT_CODEC_ID as O, PG_TIMETZ_CODEC_ID as S, PG_VARBIT_CODEC_ID as T, PG_NUMERIC_CODEC_ID as _, PG_ENUM_CODEC_ID as a, PG_TIMESTAMPTZ_CODEC_ID as b, PG_FLOAT_CODEC_ID as c, PG_INT4_CODEC_ID as d, PG_INT8_CODEC_ID as f, PG_JSON_CODEC_ID as g, PG_JSONB_CODEC_ID as h, PG_CHAR_CODEC_ID as i, SQL_TIMESTAMP_CODEC_ID as j, SQL_INT_CODEC_ID as k, PG_INET_CODEC_ID as l, PG_INT_CODEC_ID as m, PG_BOOL_CODEC_ID as n, PG_FLOAT4_CODEC_ID as o, PG_INTERVAL_CODEC_ID as p, PG_BYTEA_CODEC_ID as r, PG_FLOAT8_CODEC_ID as s, PG_BIT_CODEC_ID as t, PG_INT2_CODEC_ID as u, PG_TEXT_ARRAY_CODEC_ID as v, PG_UUID_CODEC_ID as w, PG_TIMESTAMP_CODEC_ID as x, PG_TEXT_CODEC_ID as y };
32
- //# sourceMappingURL=codec-ids-CI144z7g.d.mts.map
31
+ export { SQL_INT_CODEC_ID as A, PG_TIMETZ_CODEC_ID as C, PG_VARCHAR_CODEC_ID as D, PG_VARBIT_CODEC_ID as E, SQL_TIMESTAMP_CODEC_ID as M, SQL_VARCHAR_CODEC_ID as N, SQL_CHAR_CODEC_ID as O, PG_TIMESTAMP_CODEC_ID as S, PG_UUID_CODEC_ID as T, PG_JSON_CODEC_ID as _, PG_DATE_CODEC_ID as a, PG_TEXT_CODEC_ID as b, PG_FLOAT8_CODEC_ID as c, PG_INT2_CODEC_ID as d, PG_INT4_CODEC_ID as f, PG_JSONB_CODEC_ID as g, PG_INT_CODEC_ID as h, PG_CHAR_CODEC_ID as i, SQL_TEXT_CODEC_ID as j, SQL_FLOAT_CODEC_ID as k, PG_FLOAT_CODEC_ID as l, PG_INTERVAL_CODEC_ID as m, PG_BOOL_CODEC_ID as n, PG_ENUM_CODEC_ID as o, PG_INT8_CODEC_ID as p, PG_BYTEA_CODEC_ID as r, PG_FLOAT4_CODEC_ID as s, PG_BIT_CODEC_ID as t, PG_INET_CODEC_ID as u, PG_NUMERIC_CODEC_ID as v, PG_TIME_CODEC_ID as w, PG_TIMESTAMPTZ_CODEC_ID as x, PG_TEXT_ARRAY_CODEC_ID as y };
32
+ //# sourceMappingURL=codec-ids-BswpvvND.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-ids-BswpvvND.d.mts","names":[],"sources":["../src/core/codec-ids.ts"],"mappings":";;cAQa;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA"}
@@ -16,6 +16,7 @@ const PG_NUMERIC_CODEC_ID = "pg/numeric@1";
16
16
  const PG_BOOL_CODEC_ID = "pg/bool@1";
17
17
  const PG_BIT_CODEC_ID = "pg/bit@1";
18
18
  const PG_VARBIT_CODEC_ID = "pg/varbit@1";
19
+ const PG_DATE_CODEC_ID = "pg/date@1";
19
20
  const PG_TIMESTAMP_CODEC_ID = "pg/timestamp@1";
20
21
  const PG_TIMESTAMPTZ_CODEC_ID = "pg/timestamptz@1";
21
22
  const PG_TIME_CODEC_ID = "pg/time@1";
@@ -27,6 +28,6 @@ const PG_BYTEA_CODEC_ID = "pg/bytea@1";
27
28
  const PG_UUID_CODEC_ID = "pg/uuid@1";
28
29
  const PG_INET_CODEC_ID = "pg/inet@1";
29
30
  //#endregion
30
- export { SQL_TEXT_CODEC_ID as A, PG_TIME_CODEC_ID as C, SQL_CHAR_CODEC_ID as D, PG_VARCHAR_CODEC_ID as E, SQL_VARCHAR_CODEC_ID as M, SQL_FLOAT_CODEC_ID as O, PG_TIMETZ_CODEC_ID as S, PG_VARBIT_CODEC_ID as T, PG_NUMERIC_CODEC_ID as _, PG_ENUM_CODEC_ID as a, PG_TIMESTAMPTZ_CODEC_ID as b, PG_FLOAT_CODEC_ID as c, PG_INT4_CODEC_ID as d, PG_INT8_CODEC_ID as f, PG_JSON_CODEC_ID as g, PG_JSONB_CODEC_ID as h, PG_CHAR_CODEC_ID as i, SQL_TIMESTAMP_CODEC_ID as j, SQL_INT_CODEC_ID as k, PG_INET_CODEC_ID as l, PG_INT_CODEC_ID as m, PG_BOOL_CODEC_ID as n, PG_FLOAT4_CODEC_ID as o, PG_INTERVAL_CODEC_ID as p, PG_BYTEA_CODEC_ID as r, PG_FLOAT8_CODEC_ID as s, PG_BIT_CODEC_ID as t, PG_INT2_CODEC_ID as u, PG_TEXT_ARRAY_CODEC_ID as v, PG_UUID_CODEC_ID as w, PG_TIMESTAMP_CODEC_ID as x, PG_TEXT_CODEC_ID as y };
31
+ export { SQL_INT_CODEC_ID as A, PG_TIMETZ_CODEC_ID as C, PG_VARCHAR_CODEC_ID as D, PG_VARBIT_CODEC_ID as E, SQL_TIMESTAMP_CODEC_ID as M, SQL_VARCHAR_CODEC_ID as N, SQL_CHAR_CODEC_ID as O, PG_TIMESTAMP_CODEC_ID as S, PG_UUID_CODEC_ID as T, PG_JSON_CODEC_ID as _, PG_DATE_CODEC_ID as a, PG_TEXT_CODEC_ID as b, PG_FLOAT8_CODEC_ID as c, PG_INT2_CODEC_ID as d, PG_INT4_CODEC_ID as f, PG_JSONB_CODEC_ID as g, PG_INT_CODEC_ID as h, PG_CHAR_CODEC_ID as i, SQL_TEXT_CODEC_ID as j, SQL_FLOAT_CODEC_ID as k, PG_FLOAT_CODEC_ID as l, PG_INTERVAL_CODEC_ID as m, PG_BOOL_CODEC_ID as n, PG_ENUM_CODEC_ID as o, PG_INT8_CODEC_ID as p, PG_BYTEA_CODEC_ID as r, PG_FLOAT4_CODEC_ID as s, PG_BIT_CODEC_ID as t, PG_INET_CODEC_ID as u, PG_NUMERIC_CODEC_ID as v, PG_TIME_CODEC_ID as w, PG_TIMESTAMPTZ_CODEC_ID as x, PG_TEXT_ARRAY_CODEC_ID as y };
31
32
 
32
- //# sourceMappingURL=codec-ids-B10ZZHzw.mjs.map
33
+ //# sourceMappingURL=codec-ids-D3G8K0YM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-ids-D3G8K0YM.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_DATE_CODEC_ID = 'pg/date@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;\nexport const PG_INET_CODEC_ID = 'pg/inet@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,mBAAmB;AAChC,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;AAChC,MAAa,mBAAmB"}
@@ -1,2 +1,2 @@
1
- import { A as SQL_TEXT_CODEC_ID, C as PG_TIME_CODEC_ID, D as SQL_CHAR_CODEC_ID, E as PG_VARCHAR_CODEC_ID, M as SQL_VARCHAR_CODEC_ID, O as SQL_FLOAT_CODEC_ID, S as PG_TIMETZ_CODEC_ID, T as PG_VARBIT_CODEC_ID, _ as PG_NUMERIC_CODEC_ID, a as PG_ENUM_CODEC_ID, b as PG_TIMESTAMPTZ_CODEC_ID, c as PG_FLOAT_CODEC_ID, d as PG_INT4_CODEC_ID, f as PG_INT8_CODEC_ID, g as PG_JSON_CODEC_ID, h as PG_JSONB_CODEC_ID, i as PG_CHAR_CODEC_ID, j as SQL_TIMESTAMP_CODEC_ID, k as SQL_INT_CODEC_ID, l as PG_INET_CODEC_ID, m as PG_INT_CODEC_ID, n as PG_BOOL_CODEC_ID, o as PG_FLOAT4_CODEC_ID, p as PG_INTERVAL_CODEC_ID, r as PG_BYTEA_CODEC_ID, s as PG_FLOAT8_CODEC_ID, t as PG_BIT_CODEC_ID, u as PG_INT2_CODEC_ID, v as PG_TEXT_ARRAY_CODEC_ID, w as PG_UUID_CODEC_ID, x as PG_TIMESTAMP_CODEC_ID, y as PG_TEXT_CODEC_ID } from "./codec-ids-CI144z7g.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_INET_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_INT_CODEC_ID, C as PG_TIMETZ_CODEC_ID, D as PG_VARCHAR_CODEC_ID, E as PG_VARBIT_CODEC_ID, M as SQL_TIMESTAMP_CODEC_ID, N as SQL_VARCHAR_CODEC_ID, O as SQL_CHAR_CODEC_ID, S as PG_TIMESTAMP_CODEC_ID, T as PG_UUID_CODEC_ID, _ as PG_JSON_CODEC_ID, a as PG_DATE_CODEC_ID, b as PG_TEXT_CODEC_ID, c as PG_FLOAT8_CODEC_ID, d as PG_INT2_CODEC_ID, f as PG_INT4_CODEC_ID, g as PG_JSONB_CODEC_ID, h as PG_INT_CODEC_ID, i as PG_CHAR_CODEC_ID, j as SQL_TEXT_CODEC_ID, k as SQL_FLOAT_CODEC_ID, l as PG_FLOAT_CODEC_ID, m as PG_INTERVAL_CODEC_ID, n as PG_BOOL_CODEC_ID, o as PG_ENUM_CODEC_ID, p as PG_INT8_CODEC_ID, r as PG_BYTEA_CODEC_ID, s as PG_FLOAT4_CODEC_ID, t as PG_BIT_CODEC_ID, u as PG_INET_CODEC_ID, v as PG_NUMERIC_CODEC_ID, w as PG_TIME_CODEC_ID, x as PG_TIMESTAMPTZ_CODEC_ID, y as PG_TEXT_ARRAY_CODEC_ID } from "./codec-ids-BswpvvND.mjs";
2
+ export { PG_BIT_CODEC_ID, PG_BOOL_CODEC_ID, PG_BYTEA_CODEC_ID, PG_CHAR_CODEC_ID, PG_DATE_CODEC_ID, PG_ENUM_CODEC_ID, PG_FLOAT4_CODEC_ID, PG_FLOAT8_CODEC_ID, PG_FLOAT_CODEC_ID, PG_INET_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_TEXT_CODEC_ID, C as PG_TIME_CODEC_ID, D as SQL_CHAR_CODEC_ID, E as PG_VARCHAR_CODEC_ID, M as SQL_VARCHAR_CODEC_ID, O as SQL_FLOAT_CODEC_ID, S as PG_TIMETZ_CODEC_ID, T as PG_VARBIT_CODEC_ID, _ as PG_NUMERIC_CODEC_ID, a as PG_ENUM_CODEC_ID, b as PG_TIMESTAMPTZ_CODEC_ID, c as PG_FLOAT_CODEC_ID, d as PG_INT4_CODEC_ID, f as PG_INT8_CODEC_ID, g as PG_JSON_CODEC_ID, h as PG_JSONB_CODEC_ID, i as PG_CHAR_CODEC_ID, j as SQL_TIMESTAMP_CODEC_ID, k as SQL_INT_CODEC_ID, l as PG_INET_CODEC_ID, m as PG_INT_CODEC_ID, n as PG_BOOL_CODEC_ID, o as PG_FLOAT4_CODEC_ID, p as PG_INTERVAL_CODEC_ID, r as PG_BYTEA_CODEC_ID, s as PG_FLOAT8_CODEC_ID, t as PG_BIT_CODEC_ID, u as PG_INT2_CODEC_ID, v as PG_TEXT_ARRAY_CODEC_ID, w as PG_UUID_CODEC_ID, x as PG_TIMESTAMP_CODEC_ID, y as PG_TEXT_CODEC_ID } from "./codec-ids-B10ZZHzw.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_INET_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_INT_CODEC_ID, C as PG_TIMETZ_CODEC_ID, D as PG_VARCHAR_CODEC_ID, E as PG_VARBIT_CODEC_ID, M as SQL_TIMESTAMP_CODEC_ID, N as SQL_VARCHAR_CODEC_ID, O as SQL_CHAR_CODEC_ID, S as PG_TIMESTAMP_CODEC_ID, T as PG_UUID_CODEC_ID, _ as PG_JSON_CODEC_ID, a as PG_DATE_CODEC_ID, b as PG_TEXT_CODEC_ID, c as PG_FLOAT8_CODEC_ID, d as PG_INT2_CODEC_ID, f as PG_INT4_CODEC_ID, g as PG_JSONB_CODEC_ID, h as PG_INT_CODEC_ID, i as PG_CHAR_CODEC_ID, j as SQL_TEXT_CODEC_ID, k as SQL_FLOAT_CODEC_ID, l as PG_FLOAT_CODEC_ID, m as PG_INTERVAL_CODEC_ID, n as PG_BOOL_CODEC_ID, o as PG_ENUM_CODEC_ID, p as PG_INT8_CODEC_ID, r as PG_BYTEA_CODEC_ID, s as PG_FLOAT4_CODEC_ID, t as PG_BIT_CODEC_ID, u as PG_INET_CODEC_ID, v as PG_NUMERIC_CODEC_ID, w as PG_TIME_CODEC_ID, x as PG_TIMESTAMPTZ_CODEC_ID, y as PG_TEXT_ARRAY_CODEC_ID } from "./codec-ids-D3G8K0YM.mjs";
2
+ export { PG_BIT_CODEC_ID, PG_BOOL_CODEC_ID, PG_BYTEA_CODEC_ID, PG_CHAR_CODEC_ID, PG_DATE_CODEC_ID, PG_ENUM_CODEC_ID, PG_FLOAT4_CODEC_ID, PG_FLOAT8_CODEC_ID, PG_FLOAT_CODEC_ID, PG_INET_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,7 +1,6 @@
1
- import { C as PgTimetzDescriptor, E as PgVarcharDescriptor, S as PgTimestamptzDescriptor, T as PgVarbitDescriptor, _ as PgJsonbDescriptor, b as PgTimeDescriptor, c as PgFloat8Descriptor, d as PgInt2Descriptor, f as PgInt4Descriptor, g as PgJsonDescriptor, h as PgIntervalDescriptor, i as PgCharDescriptor, l as PgFloatDescriptor, m as PgIntDescriptor, n as PgBoolDescriptor, o as PgEnumDescriptor, p as PgInt8Descriptor, r as PgByteaDescriptor, s as PgFloat4Descriptor, t as PgBitDescriptor, u as PgInetDescriptor, v as PgNumericDescriptor, w as PgUuidDescriptor, x as PgTimestampDescriptor, y as PgTextDescriptor } from "./codecs-D7W9O0Xx.mjs";
1
+ import { C as PgTimestamptzDescriptor, D as PgVarcharDescriptor, E as PgVarbitDescriptor, S as PgTimestampDescriptor, T as PgUuidDescriptor, _ as PgJsonDescriptor, b as PgTextDescriptor, c as PgFloat4Descriptor, d as PgInetDescriptor, f as PgInt2Descriptor, g as PgIntervalDescriptor, h as PgIntDescriptor, i as PgCharDescriptor, l as PgFloat8Descriptor, m as PgInt8Descriptor, n as PgBoolDescriptor, p as PgInt4Descriptor, r as PgByteaDescriptor, s as PgEnumDescriptor, t as PgBitDescriptor, u as PgFloatDescriptor, v as PgJsonbDescriptor, w as PgTimetzDescriptor, x as PgTimeDescriptor, y as PgNumericDescriptor } from "./codecs-G4DTY0F_.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
-
5
4
  //#region src/core/codec-type-map.d.ts
6
5
  declare const codecDescriptorMap: {
7
6
  readonly char: import("@prisma-next/sql-relational-core/ast").SqlCharDescriptor;
@@ -36,13 +35,13 @@ declare const codecDescriptorMap: {
36
35
  readonly json: PgJsonDescriptor;
37
36
  readonly jsonb: PgJsonbDescriptor;
38
37
  };
39
- type Resolve<T> = { readonly [K in keyof T]: { readonly [P in keyof T[K]]: T[K][P] } };
38
+ type Resolve<T> = { readonly [K in keyof T]: { readonly [P in keyof T[K]]: T[K][P]; }; };
40
39
  type CodecDescriptorMap = typeof codecDescriptorMap;
41
40
  type ExtractedCodecTypes = ExtractCodecTypes<CodecDescriptorMap>;
42
41
  //#endregion
43
42
  //#region src/exports/codec-types.d.ts
44
43
  type CodecTypes = Resolve<ExtractedCodecTypes>;
45
- type Branded<T, Shape extends Record<string, unknown>> = T & { readonly [K in keyof Shape]: Shape[K] };
44
+ type Branded<T, Shape extends Record<string, unknown>> = T & { readonly [K in keyof Shape]: Shape[K]; };
46
45
  type BrandedString<Shape extends Record<string, unknown>> = Branded<string, Shape>;
47
46
  type Char<N extends number> = BrandedString<{
48
47
  __charLength: N;
@@ -77,4 +76,4 @@ type Interval<P extends number | undefined = undefined> = BrandedString<{
77
76
  }>;
78
77
  //#endregion
79
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 };
80
- //# sourceMappingURL=codec-types-CTfT4U4O.d.mts.map
79
+ //# sourceMappingURL=codec-types-CQ07nOz-.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-types-CQ07nOz-.d.mts","names":[],"sources":["../src/core/codec-type-map.ts","../src/exports/codec-types.ts"],"mappings":";;;;cA8Ca;;;;;;;iBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;KAkCD,QAAQ,iBAAiB,WAAW,gBAAgB,WAAW,EAAE,KAAK,EAAE,GAAG;KAE3E,4BAA4B;KAE5B,sBAAsB,kBAAkB;;;KCzExC,aAAa,QAAQ;KAI5B,QAAQ,GAAG,cAAc,2BAA2B,gBAC7C,WAAW,QAAQ,MAAM;KAGhC,cAAc,cAAc,2BAA2B,gBAAgB;KAEhE,KAAK,oBAAoB;EAAgB,cAAc;;KACvD,QAAQ,oBAAoB;EAAgB,iBAAiB;;KAC7D,QAAQ,kBAAkB,4CAA4C;EAChF,oBAAoB;EACpB,gBAAgB;;KAEN,IAAI,oBAAoB;EAAgB,aAAa;;KACrD,OAAO,oBAAoB;EAAgB,gBAAgB;;KAC3D,UAAU,4CAA4C;EAChE,sBAAsB;;KAEZ,YAAY,4CAA4C;EAClE,wBAAwB;;KAEd,KAAK,4CAA4C;EAAgB,iBAAiB;;KAClF,OAAO,4CAA4C;EAC7D,mBAAmB;;KAET,SAAS,4CAA4C;EAC/D,qBAAqB"}
@@ -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-CTfT4U4O.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-CQ07nOz-.mjs";
2
2
  export { Bit, Char, CodecTypes, Interval, type JsonValue, Numeric, Time, Timestamp, Timestamptz, Timetz, VarBit, Varchar };
@@ -1,9 +1,8 @@
1
- import { C as PG_TIME_CODEC_ID, S as PG_TIMETZ_CODEC_ID, T as PG_VARBIT_CODEC_ID, _ as PG_NUMERIC_CODEC_ID, a as PG_ENUM_CODEC_ID, b as PG_TIMESTAMPTZ_CODEC_ID, d as PG_INT4_CODEC_ID, f as PG_INT8_CODEC_ID, g as PG_JSON_CODEC_ID, h as PG_JSONB_CODEC_ID, l as PG_INET_CODEC_ID, n as PG_BOOL_CODEC_ID, o as PG_FLOAT4_CODEC_ID, p as PG_INTERVAL_CODEC_ID, r as PG_BYTEA_CODEC_ID, s as PG_FLOAT8_CODEC_ID, t as PG_BIT_CODEC_ID, u as PG_INT2_CODEC_ID, w as PG_UUID_CODEC_ID, x as PG_TIMESTAMP_CODEC_ID, y as PG_TEXT_CODEC_ID } from "./codec-ids-CI144z7g.mjs";
1
+ import { C as PG_TIMETZ_CODEC_ID, E as PG_VARBIT_CODEC_ID, S as PG_TIMESTAMP_CODEC_ID, T as PG_UUID_CODEC_ID, _ as PG_JSON_CODEC_ID, a as PG_DATE_CODEC_ID, b as PG_TEXT_CODEC_ID, c as PG_FLOAT8_CODEC_ID, d as PG_INT2_CODEC_ID, f as PG_INT4_CODEC_ID, g as PG_JSONB_CODEC_ID, m as PG_INTERVAL_CODEC_ID, n as PG_BOOL_CODEC_ID, o as PG_ENUM_CODEC_ID, p as PG_INT8_CODEC_ID, r as PG_BYTEA_CODEC_ID, s as PG_FLOAT4_CODEC_ID, t as PG_BIT_CODEC_ID, u as PG_INET_CODEC_ID, v as PG_NUMERIC_CODEC_ID, w as PG_TIME_CODEC_ID, x as PG_TIMESTAMPTZ_CODEC_ID } from "./codec-ids-BswpvvND.mjs";
2
2
  import { SqlCharCodec, SqlFloatCodec, SqlIntCodec, SqlVarcharCodec } from "@prisma-next/sql-relational-core/ast";
3
3
  import { AnyCodecDescriptor, CodecCallContext, CodecDescriptorImpl, CodecImpl, CodecInstanceContext, CodecMeta } from "@prisma-next/framework-components/codec";
4
4
  import { JsonValue } from "@prisma-next/contract/types";
5
5
  import { StandardSchemaV1 } from "@standard-schema/spec";
6
-
7
6
  //#region src/core/codecs.d.ts
8
7
  type LengthParams = {
9
8
  readonly length?: number;
@@ -12,7 +11,7 @@ type PrecisionParams = {
12
11
  readonly precision?: number;
13
12
  };
14
13
  type NumericParams = {
15
- readonly precision: number;
14
+ readonly precision?: number;
16
15
  readonly scale?: number;
17
16
  };
18
17
  declare class PgTextCodec extends CodecImpl<typeof PG_TEXT_CODEC_ID, readonly ['equality', 'order', 'textual'], string, string> {
@@ -299,13 +298,42 @@ declare class PgNumericDescriptor extends CodecDescriptorImpl<NumericParams> {
299
298
  };
300
299
  };
301
300
  readonly paramsSchema: import("arktype/internal/variants/object.ts").ObjectType<{
302
- precision: number;
301
+ precision?: number;
303
302
  scale?: number;
304
303
  }, {}>;
305
304
  renderOutputType(params: NumericParams): string | undefined;
306
305
  factory(_params: NumericParams): (ctx: CodecInstanceContext) => PgNumericCodec;
307
306
  }
308
- declare const pgNumericColumn: (params: NumericParams) => import("@prisma-next/framework-components/codec").ColumnSpec<PgNumericCodec, NumericParams>;
307
+ declare const pgNumericColumn: (params?: NumericParams) => import("@prisma-next/framework-components/codec").ColumnSpec<PgNumericCodec, NumericParams>;
308
+ /**
309
+ * A Postgres `date` has no time-of-day or timezone component. This codec
310
+ * canonicalizes its JS-level value as a `Date` at UTC midnight, so its
311
+ * round-trip is independent of the process's local timezone — see
312
+ * `pgDateEncode`/`pgDateDecode` in `codec-helpers.ts`.
313
+ */
314
+ declare class PgDateCodec extends CodecImpl<typeof PG_DATE_CODEC_ID, readonly ['equality', 'order'], Date | string, Date> {
315
+ encode(value: Date, _ctx: CodecCallContext): Promise<string>;
316
+ decode(wire: Date, _ctx: CodecCallContext): Promise<Date>;
317
+ encodeJson(value: Date): JsonValue;
318
+ decodeJson(json: JsonValue): Date;
319
+ }
320
+ declare class PgDateDescriptor extends CodecDescriptorImpl<void> {
321
+ readonly codecId: "pg/date@1";
322
+ readonly traits: readonly ["equality", "order"];
323
+ readonly targetTypes: readonly ["date"];
324
+ readonly meta: {
325
+ readonly db: {
326
+ readonly sql: {
327
+ readonly postgres: {
328
+ readonly nativeType: "date";
329
+ };
330
+ };
331
+ };
332
+ };
333
+ readonly paramsSchema: StandardSchemaV1<void>;
334
+ factory(): (ctx: CodecInstanceContext) => PgDateCodec;
335
+ }
336
+ declare const pgDateColumn: () => import("@prisma-next/framework-components/codec").ColumnSpec<PgDateCodec, undefined>;
309
337
  declare class PgTimestampCodec extends CodecImpl<typeof PG_TIMESTAMP_CODEC_ID, readonly ['equality', 'order'], Date, Date> {
310
338
  encode(value: Date, _ctx: CodecCallContext): Promise<Date>;
311
339
  decode(wire: Date, _ctx: CodecCallContext): Promise<Date>;
@@ -685,5 +713,5 @@ declare class PgFloatDescriptor extends CodecDescriptorImpl<void> {
685
713
  }
686
714
  declare const pgFloatColumn: () => import("@prisma-next/framework-components/codec").ColumnSpec<SqlFloatCodec, undefined>;
687
715
  //#endregion
688
- export { pgEnumDescriptor as A, pgJsonColumn as B, PgTimetzDescriptor as C, pgBitColumn as D, PgVarcharDescriptor as E, pgInt2Column as F, pgTimestampColumn as G, pgNumericColumn as H, pgInt4Column as I, pgUuidColumn as J, pgTimestamptzColumn as K, pgInt8Column as L, pgFloat8Column as M, pgFloatColumn as N, pgBoolColumn as O, pgInetColumn as P, pgIntColumn as R, PgTimestamptzDescriptor as S, PgVarbitDescriptor as T, pgTextColumn as U, pgJsonbColumn as V, pgTimeColumn as W, pgVarcharColumn as X, pgVarbitColumn as Y, postgresQualifyColumnType as Z, PgJsonbDescriptor as _, PgEnumCodec as a, PgTimeDescriptor as b, PgFloat8Descriptor as c, PgInt2Descriptor as d, PgInt4Descriptor as f, PgJsonDescriptor as g, PgIntervalDescriptor as h, PgCharDescriptor as i, pgFloat4Column as j, pgCharColumn as k, PgFloatDescriptor as l, PgIntDescriptor as m, PgBoolDescriptor as n, PgEnumDescriptor as o, PgInt8Descriptor as p, pgTimetzColumn as q, PgByteaDescriptor as r, PgFloat4Descriptor as s, PgBitDescriptor as t, PgInetDescriptor as u, PgNumericDescriptor as v, PgUuidDescriptor as w, PgTimestampDescriptor as x, PgTextDescriptor as y, pgIntervalColumn as z };
689
- //# sourceMappingURL=codecs-D7W9O0Xx.d.mts.map
716
+ export { postgresQualifyColumnType as $, pgCharColumn as A, pgIntColumn as B, PgTimestamptzDescriptor as C, PgVarcharDescriptor as D, PgVarbitDescriptor as E, pgFloatColumn as F, pgTextColumn as G, pgJsonColumn as H, pgInetColumn as I, pgTimestamptzColumn as J, pgTimeColumn as K, pgInt2Column as L, pgEnumDescriptor as M, pgFloat4Column as N, pgBitColumn as O, pgFloat8Column as P, pgVarcharColumn as Q, pgInt4Column as R, PgTimestampDescriptor as S, PgUuidDescriptor as T, pgJsonbColumn as U, pgIntervalColumn as V, pgNumericColumn as W, pgUuidColumn as X, pgTimetzColumn as Y, pgVarbitColumn as Z, PgJsonDescriptor as _, PgDateDescriptor as a, PgTextDescriptor as b, PgFloat4Descriptor as c, PgInetDescriptor as d, PgInt2Descriptor as f, PgIntervalDescriptor as g, PgIntDescriptor as h, PgCharDescriptor as i, pgDateColumn as j, pgBoolColumn as k, PgFloat8Descriptor as l, PgInt8Descriptor as m, PgBoolDescriptor as n, PgEnumCodec as o, PgInt4Descriptor as p, pgTimestampColumn as q, PgByteaDescriptor as r, PgEnumDescriptor as s, PgBitDescriptor as t, PgFloatDescriptor as u, PgJsonbDescriptor as v, PgTimetzDescriptor as w, PgTimeDescriptor as x, PgNumericDescriptor as y, pgInt8Column as z };
717
+ //# sourceMappingURL=codecs-G4DTY0F_.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codecs-G4DTY0F_.d.mts","names":[],"sources":["../src/core/codecs.ts"],"mappings":";;;;;;KAiGK;WAA0B;;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ID, f as PG_INT8_CODEC_ID, g as PG_JSON_CODEC_ID, h as PG_JSONB_CODEC_ID, i as PG_CHAR_CODEC_ID, l as PG_INET_CODEC_ID, m as PG_INT_CODEC_ID, n as PG_BOOL_CODEC_ID, o as PG_FLOAT4_CODEC_ID, p as PG_INTERVAL_CODEC_ID, r as PG_BYTEA_CODEC_ID, s as PG_FLOAT8_CODEC_ID, t as PG_BIT_CODEC_ID, u as PG_INT2_CODEC_ID, v as PG_TEXT_ARRAY_CODEC_ID, w as PG_UUID_CODEC_ID, x as PG_TIMESTAMP_CODEC_ID, y as PG_TEXT_CODEC_ID } from "./codec-ids-B10ZZHzw.mjs";
1
+ import { C as PG_TIMETZ_CODEC_ID, D as PG_VARCHAR_CODEC_ID, E as PG_VARBIT_CODEC_ID, S as PG_TIMESTAMP_CODEC_ID, T as PG_UUID_CODEC_ID, _ as PG_JSON_CODEC_ID, a as PG_DATE_CODEC_ID, b as PG_TEXT_CODEC_ID, c as PG_FLOAT8_CODEC_ID, d as PG_INT2_CODEC_ID, f as PG_INT4_CODEC_ID, g as PG_JSONB_CODEC_ID, h as PG_INT_CODEC_ID, i as PG_CHAR_CODEC_ID, l as PG_FLOAT_CODEC_ID, m as PG_INTERVAL_CODEC_ID, n as PG_BOOL_CODEC_ID, o as PG_ENUM_CODEC_ID, p as PG_INT8_CODEC_ID, r as PG_BYTEA_CODEC_ID, s as PG_FLOAT4_CODEC_ID, t as PG_BIT_CODEC_ID, u as PG_INET_CODEC_ID, v as PG_NUMERIC_CODEC_ID, w as PG_TIME_CODEC_ID, x as PG_TIMESTAMPTZ_CODEC_ID, y as PG_TEXT_ARRAY_CODEC_ID } from "./codec-ids-D3G8K0YM.mjs";
2
2
  import "./namespace-ids-xtp_ZY86.mjs";
3
3
  import { t as PostgresNativeEnum } from "./postgres-native-enum-BwVNf0Ku.mjs";
4
4
  import { SqlCharCodec, SqlFloatCodec, SqlIntCodec, SqlVarcharCodec, sqlCharDescriptor, sqlFloatDescriptor, sqlIntDescriptor, sqlTextDescriptor, sqlTimestampDescriptor, sqlVarcharDescriptor } from "@prisma-next/sql-relational-core/ast";
@@ -50,6 +50,44 @@ const pgTimestamptzDecodeJson = (json) => {
50
50
  if (Number.isNaN(date.getTime())) throw new Error(`Invalid ISO date string for pg/timestamptz@1: ${json}`);
51
51
  return date;
52
52
  };
53
+ const ISO_8601_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
54
+ function formatDateOnly(year, month, day) {
55
+ return `${String(year).padStart(4, "0")}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
56
+ }
57
+ /**
58
+ * A Postgres `date` has no time-of-day or timezone component, so `pg/date@1`
59
+ * canonicalizes its JS-level value as a `Date` at UTC midnight
60
+ * (`Date.UTC(y, m, d)`), independent of the process's local timezone.
61
+ *
62
+ * `pgDateEncode` reads the calendar date via UTC getters (matching that
63
+ * canonical form) and formats it as `YYYY-MM-DD` directly, bypassing the pg
64
+ * driver's own `Date` serialization (`dateToString`), which reads *local*
65
+ * getters and would shift the calendar day near midnight in negative-UTC-offset
66
+ * environments.
67
+ */
68
+ const pgDateEncode = (value) => formatDateOnly(value.getUTCFullYear(), value.getUTCMonth() + 1, value.getUTCDate());
69
+ /**
70
+ * Normalizes the pg driver's already-parsed `Date` for a `date` column into
71
+ * the canonical UTC-midnight form. The driver (via `postgres-date`) builds
72
+ * that `Date` at *local* midnight from the wire text; reading it back with the
73
+ * same (local) getters recovers the exact calendar date the driver parsed,
74
+ * and reconstructing via `Date.UTC` makes the result's instant independent of
75
+ * the process's timezone.
76
+ */
77
+ const pgDateDecode = (wire) => new Date(Date.UTC(wire.getFullYear(), wire.getMonth(), wire.getDate()));
78
+ const pgDateEncodeJson = (value) => pgDateEncode(value);
79
+ const pgDateDecodeJson = (json) => {
80
+ if (typeof json !== "string") throw new Error(`Expected date string for pg/date@1, got ${typeof json}`);
81
+ const match = ISO_8601_DATE.exec(json);
82
+ if (!match) throw new Error(`Invalid date string for pg/date@1: ${json}`);
83
+ const [, yearText, monthText, dayText] = match;
84
+ const year = Number(yearText);
85
+ const month = Number(monthText) - 1;
86
+ const day = Number(dayText);
87
+ const date = new Date(Date.UTC(year, month, day));
88
+ if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) throw new Error(`Invalid date string for pg/date@1: ${json}`);
89
+ return date;
90
+ };
53
91
  const pgIntervalDecode = (wire) => {
54
92
  if (typeof wire === "string") return wire;
55
93
  return JSON.stringify(wire);
@@ -75,7 +113,7 @@ const pgJsonbDecode = (wire) => typeof wire === "string" ? JSON.parse(wire) : wi
75
113
  //#region src/core/codecs.ts
76
114
  const lengthParamsSchema = type({ "length?": "number.integer > 0" });
77
115
  const numericParamsSchema = type({
78
- precision: "number.integer > 0 & number.integer <= 1000",
116
+ "precision?": "number.integer > 0 & number.integer <= 1000",
79
117
  "scale?": "number.integer >= 0"
80
118
  });
81
119
  const precisionParamsSchema = type({ "precision?": "number.integer >= 0 & number.integer <= 6" });
@@ -87,6 +125,7 @@ const PG_INT8_META = { db: { sql: { postgres: { nativeType: "bigint" } } } };
87
125
  const PG_FLOAT4_META = { db: { sql: { postgres: { nativeType: "real" } } } };
88
126
  const PG_FLOAT8_META = { db: { sql: { postgres: { nativeType: "double precision" } } } };
89
127
  const PG_NUMERIC_META = { db: { sql: { postgres: { nativeType: "numeric" } } } };
128
+ const PG_DATE_META = { db: { sql: { postgres: { nativeType: "date" } } } };
90
129
  const PG_TIMESTAMP_META = { db: { sql: { postgres: { nativeType: "timestamp without time zone" } } } };
91
130
  const PG_TIMESTAMPTZ_META = { db: { sql: { postgres: { nativeType: "timestamp with time zone" } } } };
92
131
  const PG_TIME_META = { db: { sql: { postgres: { nativeType: "time" } } } };
@@ -510,7 +549,39 @@ var PgNumericDescriptor = class extends CodecDescriptorImpl {
510
549
  }
511
550
  };
512
551
  const pgNumericDescriptor = new PgNumericDescriptor();
513
- const pgNumericColumn = (params) => column(pgNumericDescriptor.factory(params), pgNumericDescriptor.codecId, params, "numeric");
552
+ const pgNumericColumn = (params = {}) => column(pgNumericDescriptor.factory(params), pgNumericDescriptor.codecId, params, "numeric");
553
+ /**
554
+ * A Postgres `date` has no time-of-day or timezone component. This codec
555
+ * canonicalizes its JS-level value as a `Date` at UTC midnight, so its
556
+ * round-trip is independent of the process's local timezone — see
557
+ * `pgDateEncode`/`pgDateDecode` in `codec-helpers.ts`.
558
+ */
559
+ var PgDateCodec = class extends CodecImpl {
560
+ async encode(value, _ctx) {
561
+ return pgDateEncode(value);
562
+ }
563
+ async decode(wire, _ctx) {
564
+ return pgDateDecode(wire);
565
+ }
566
+ encodeJson(value) {
567
+ return pgDateEncodeJson(value);
568
+ }
569
+ decodeJson(json) {
570
+ return pgDateDecodeJson(json);
571
+ }
572
+ };
573
+ var PgDateDescriptor = class extends CodecDescriptorImpl {
574
+ codecId = PG_DATE_CODEC_ID;
575
+ traits = ["equality", "order"];
576
+ targetTypes = ["date"];
577
+ meta = PG_DATE_META;
578
+ paramsSchema = voidParamsSchema;
579
+ factory() {
580
+ return () => new PgDateCodec(this);
581
+ }
582
+ };
583
+ const pgDateDescriptor = new PgDateDescriptor();
584
+ const pgDateColumn = () => column(pgDateDescriptor.factory(), pgDateDescriptor.codecId, void 0, "date");
514
585
  var PgTimestampCodec = class extends CodecImpl {
515
586
  async encode(value, _ctx) {
516
587
  return value;
@@ -934,6 +1005,7 @@ const codecDescriptors = [
934
1005
  pgFloat4Descriptor,
935
1006
  pgFloat8Descriptor,
936
1007
  pgNumericDescriptor,
1008
+ pgDateDescriptor,
937
1009
  pgTimestampDescriptor,
938
1010
  pgTimestamptzDescriptor,
939
1011
  pgTimeDescriptor,
@@ -950,6 +1022,6 @@ const codecDescriptors = [
950
1022
  pgTextArrayDescriptor
951
1023
  ];
952
1024
  //#endregion
953
- export { pgUuidColumn as C, postgresQualifyColumnType as E, pgTimetzColumn as S, pgVarcharColumn as T, pgNumericColumn as _, pgEnumDescriptor as a, pgTimestampColumn as b, pgFloatColumn as c, pgInt4Column as d, pgInt8Column as f, pgJsonbColumn as g, pgJsonColumn as h, pgCharColumn as i, pgInetColumn as l, pgIntervalColumn as m, pgBitColumn as n, pgFloat4Column as o, pgIntColumn as p, pgBoolColumn as r, pgFloat8Column as s, codecDescriptors as t, pgInt2Column as u, pgTextColumn as v, pgVarbitColumn as w, pgTimestamptzColumn as x, pgTimeColumn as y };
1025
+ export { pgTimetzColumn as C, postgresQualifyColumnType as D, pgVarcharColumn as E, pgTimestamptzColumn as S, pgVarbitColumn as T, pgJsonbColumn as _, pgDateColumn as a, pgTimeColumn as b, pgFloat8Column as c, pgInt2Column as d, pgInt4Column as f, pgJsonColumn as g, pgIntervalColumn as h, pgCharColumn as i, pgFloatColumn as l, pgIntColumn as m, pgBitColumn as n, pgEnumDescriptor as o, pgInt8Column as p, pgBoolColumn as r, pgFloat4Column as s, codecDescriptors as t, pgInetColumn as u, pgNumericColumn as v, pgUuidColumn as w, pgTimestampColumn as x, pgTextColumn as y };
954
1026
 
955
- //# sourceMappingURL=codecs-DRbb26Or.mjs.map
1027
+ //# sourceMappingURL=codecs-TCsGgW-Y.mjs.map