@prisma-next/target-postgres 0.16.0-dev.3 → 0.16.0-dev.31

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 (166) hide show
  1. package/README.md +1 -1
  2. package/dist/{authoring-34L18kA1.mjs → authoring-DnO1B0N9.mjs} +29 -18
  3. package/dist/authoring-DnO1B0N9.mjs.map +1 -0
  4. package/dist/canonicalize-C7zKHw8m.mjs +59 -0
  5. package/dist/canonicalize-C7zKHw8m.mjs.map +1 -0
  6. package/dist/{canonicalize-D1F4vUnP.d.mts → canonicalize-CQlxSR4D.d.mts} +3 -18
  7. package/dist/canonicalize-CQlxSR4D.d.mts.map +1 -0
  8. package/dist/{codec-types-CQ07nOz-.d.mts → codec-types-DdoPc2dy.d.mts} +3 -2
  9. package/dist/codec-types-DdoPc2dy.d.mts.map +1 -0
  10. package/dist/codec-types.d.mts +1 -1
  11. package/dist/{codecs-G4DTY0F_.d.mts → codecs-CGE5dh94.d.mts} +7 -2
  12. package/dist/codecs-CGE5dh94.d.mts.map +1 -0
  13. package/dist/{codecs-TCsGgW-Y.mjs → codecs-Deand7sy.mjs} +84 -26
  14. package/dist/codecs-Deand7sy.mjs.map +1 -0
  15. package/dist/codecs.d.mts +2 -2
  16. package/dist/codecs.mjs +2 -2
  17. package/dist/contract-free.d.mts +1 -1
  18. package/dist/contract-free.d.mts.map +1 -1
  19. package/dist/contract-free.mjs +2 -2
  20. package/dist/{control-policy-CZKdMztu.mjs → control-policy-DEwdS3oK.mjs} +29 -29
  21. package/dist/control-policy-DEwdS3oK.mjs.map +1 -0
  22. package/dist/control.mjs +91 -239
  23. package/dist/control.mjs.map +1 -1
  24. package/dist/data-transform-BOWpliq8.mjs.map +1 -1
  25. package/dist/{ddl-DHXKzQ99.mjs → ddl-BQC6u-L9.mjs} +28 -4
  26. package/dist/{ddl-DHXKzQ99.mjs.map → ddl-BQC6u-L9.mjs.map} +1 -1
  27. package/dist/ddl.d.mts +3 -3
  28. package/dist/ddl.mjs +2 -2
  29. package/dist/{descriptor-meta-qubYaxQA.mjs → descriptor-meta-DGlJurgA.mjs} +4 -4
  30. package/dist/{descriptor-meta-qubYaxQA.mjs.map → descriptor-meta-DGlJurgA.mjs.map} +1 -1
  31. package/dist/{diff-database-schema-C-hnJ5mr.mjs → diff-database-schema-qRPwuYBH.mjs} +37 -15
  32. package/dist/diff-database-schema-qRPwuYBH.mjs.map +1 -0
  33. package/dist/diff-database-schema.mjs +1 -1
  34. package/dist/{errors-ByDS0xJL.mjs → errors-DBSNx7EJ.mjs} +6 -2
  35. package/dist/errors-DBSNx7EJ.mjs.map +1 -0
  36. package/dist/errors.d.mts +4 -1
  37. package/dist/errors.d.mts.map +1 -1
  38. package/dist/errors.mjs +2 -2
  39. package/dist/issue-planner.d.mts +2 -2
  40. package/dist/issue-planner.d.mts.map +1 -1
  41. package/dist/issue-planner.mjs +1 -1
  42. package/dist/migration.d.mts +2 -2
  43. package/dist/migration.mjs +2 -2
  44. package/dist/{nodes-DJC5B8Id.mjs → nodes-04EILM-z.mjs} +65 -2
  45. package/dist/nodes-04EILM-z.mjs.map +1 -0
  46. package/dist/{nodes-CQzM2hR0.d.mts → nodes-DjCsN-uv.d.mts} +69 -4
  47. package/dist/nodes-DjCsN-uv.d.mts.map +1 -0
  48. package/dist/{op-factory-call-DT7kdjVP.d.mts → op-factory-call-0TB5XNij.d.mts} +46 -8
  49. package/dist/op-factory-call-0TB5XNij.d.mts.map +1 -0
  50. package/dist/{op-factory-call-DuRj7WXX.mjs → op-factory-call-CIaPDDUc.mjs} +147 -64
  51. package/dist/op-factory-call-CIaPDDUc.mjs.map +1 -0
  52. package/dist/op-factory-call.d.mts +2 -2
  53. package/dist/op-factory-call.mjs +2 -2
  54. package/dist/pack.d.mts +2 -2
  55. package/dist/pack.d.mts.map +1 -1
  56. package/dist/pack.mjs +1 -1
  57. package/dist/{planner-DPGxFcXo.mjs → planner-BhnkIJX-.mjs} +121 -13
  58. package/dist/planner-BhnkIJX-.mjs.map +1 -0
  59. package/dist/{planner-ddl-builders-BKlmGDJl.mjs → planner-ddl-builders-CVo3L7Nd.mjs} +12 -7
  60. package/dist/planner-ddl-builders-CVo3L7Nd.mjs.map +1 -0
  61. package/dist/planner-ddl-builders.d.mts.map +1 -1
  62. package/dist/planner-ddl-builders.mjs +1 -1
  63. package/dist/{planner-produced-postgres-migration-CFDpqWWE.mjs → planner-produced-postgres-migration-BE3EJIRK.mjs} +9 -6
  64. package/dist/planner-produced-postgres-migration-BE3EJIRK.mjs.map +1 -0
  65. package/dist/{planner-produced-postgres-migration-C-dwGdb2.d.mts → planner-produced-postgres-migration-CRAHl6ak.d.mts} +3 -3
  66. package/dist/planner-produced-postgres-migration-CRAHl6ak.d.mts.map +1 -0
  67. package/dist/planner-produced-postgres-migration.d.mts +1 -1
  68. package/dist/planner-produced-postgres-migration.mjs +1 -1
  69. package/dist/{planner-schema-lookup-CiVaAQP-.mjs → planner-schema-lookup-D3Y_OL-C.mjs} +3 -3
  70. package/dist/planner-schema-lookup-D3Y_OL-C.mjs.map +1 -0
  71. package/dist/planner-schema-lookup.mjs +1 -1
  72. package/dist/{planner-sql-checks-BuB877wH.mjs → planner-sql-checks-CmiQ6Nei.mjs} +3 -3
  73. package/dist/{planner-sql-checks-BuB877wH.mjs.map → planner-sql-checks-CmiQ6Nei.mjs.map} +1 -1
  74. package/dist/planner-sql-checks.mjs +1 -1
  75. package/dist/planner.d.mts +27 -1
  76. package/dist/planner.d.mts.map +1 -1
  77. package/dist/planner.mjs +2 -2
  78. package/dist/{postgres-contract-view-DebHMqGR.mjs → postgres-contract-view-BeIEyZfD.mjs} +3 -3
  79. package/dist/{postgres-contract-view-DebHMqGR.mjs.map → postgres-contract-view-BeIEyZfD.mjs.map} +1 -1
  80. package/dist/{postgres-migration-C_OPFhIF.mjs → postgres-migration--BzvpA92.mjs} +9 -6
  81. package/dist/postgres-migration--BzvpA92.mjs.map +1 -0
  82. package/dist/{postgres-migration-DLIvzHjX.d.mts → postgres-migration-BXelnqHO.d.mts} +15 -10
  83. package/dist/postgres-migration-BXelnqHO.d.mts.map +1 -0
  84. package/dist/{postgres-schema-CewLYHB7.mjs → postgres-schema-CTplQZDK.mjs} +2 -2
  85. package/dist/{postgres-schema-CewLYHB7.mjs.map → postgres-schema-CTplQZDK.mjs.map} +1 -1
  86. package/dist/{render-ops-BREh1kHe.mjs → render-ops-TcY9XEkz.mjs} +7 -2
  87. package/dist/render-ops-TcY9XEkz.mjs.map +1 -0
  88. package/dist/render-ops.d.mts.map +1 -1
  89. package/dist/render-ops.mjs +1 -1
  90. package/dist/{render-typescript-7yqILcwr.mjs → render-typescript-Ta7_6CGf.mjs} +20 -8
  91. package/dist/render-typescript-Ta7_6CGf.mjs.map +1 -0
  92. package/dist/render-typescript.d.mts +2 -0
  93. package/dist/render-typescript.d.mts.map +1 -1
  94. package/dist/render-typescript.mjs +1 -1
  95. package/dist/{resolve-ddl-schema-D0wi_P9Q.mjs → resolve-ddl-schema-BAsJEKW8.mjs} +2 -2
  96. package/dist/{resolve-ddl-schema-D0wi_P9Q.mjs.map → resolve-ddl-schema-BAsJEKW8.mjs.map} +1 -1
  97. package/dist/rls-canonicalize.d.mts +2 -26
  98. package/dist/rls-canonicalize.mjs +2 -2
  99. package/dist/runtime.mjs +1 -1
  100. package/dist/schema-ir-annotations.mjs +1 -1
  101. package/dist/{sql-utils-SU4FDvIV.mjs → sql-utils-B2lzkKfP.mjs} +22 -19
  102. package/dist/sql-utils-B2lzkKfP.mjs.map +1 -0
  103. package/dist/sql-utils.d.mts +4 -9
  104. package/dist/sql-utils.d.mts.map +1 -1
  105. package/dist/sql-utils.mjs +2 -2
  106. package/dist/types.mjs +1 -1
  107. package/package.json +20 -20
  108. package/src/contract-free/ddl.ts +47 -0
  109. package/src/core/authoring.ts +35 -26
  110. package/src/core/codec-helpers.ts +69 -16
  111. package/src/core/codec-type-map.ts +2 -0
  112. package/src/core/codecs.ts +29 -14
  113. package/src/core/ddl/nodes.ts +104 -0
  114. package/src/core/errors.ts +30 -0
  115. package/src/core/migrations/column-ddl-rendering.ts +2 -1
  116. package/src/core/migrations/contract-to-postgres-database-schema-node.ts +38 -14
  117. package/src/core/migrations/issue-planner.ts +40 -13
  118. package/src/core/migrations/op-factory-call.ts +189 -44
  119. package/src/core/migrations/operations/constraints.ts +3 -2
  120. package/src/core/migrations/operations/data-transform.ts +1 -1
  121. package/src/core/migrations/operations/indexes.ts +80 -32
  122. package/src/core/migrations/operations/rls.ts +4 -1
  123. package/src/core/migrations/planner-ddl-builders.ts +16 -6
  124. package/src/core/migrations/planner-produced-postgres-migration.ts +8 -1
  125. package/src/core/migrations/planner-schema-lookup.ts +2 -2
  126. package/src/core/migrations/planner.ts +163 -5
  127. package/src/core/migrations/postgres-migration.ts +26 -8
  128. package/src/core/migrations/render-ops.ts +4 -1
  129. package/src/core/migrations/render-typescript.ts +20 -8
  130. package/src/core/migrations/runner.ts +7 -3
  131. package/src/core/psl-infer/infer-psl-contract.ts +36 -185
  132. package/src/core/psl-infer/postgres-type-map.ts +43 -65
  133. package/src/core/rls/canonicalize.ts +4 -21
  134. package/src/core/sql-utils.ts +16 -27
  135. package/src/exports/codecs.ts +2 -0
  136. package/src/exports/ddl.ts +4 -0
  137. package/src/exports/errors.ts +1 -1
  138. package/src/exports/op-factory-call.ts +1 -0
  139. package/src/exports/rls-canonicalize.ts +0 -6
  140. package/src/exports/sql-utils.ts +0 -1
  141. package/dist/authoring-34L18kA1.mjs.map +0 -1
  142. package/dist/canonicalize-D1F4vUnP.d.mts.map +0 -1
  143. package/dist/codec-types-CQ07nOz-.d.mts.map +0 -1
  144. package/dist/codecs-G4DTY0F_.d.mts.map +0 -1
  145. package/dist/codecs-TCsGgW-Y.mjs.map +0 -1
  146. package/dist/control-policy-CZKdMztu.mjs.map +0 -1
  147. package/dist/diff-database-schema-C-hnJ5mr.mjs.map +0 -1
  148. package/dist/errors-ByDS0xJL.mjs.map +0 -1
  149. package/dist/nodes-CQzM2hR0.d.mts.map +0 -1
  150. package/dist/nodes-DJC5B8Id.mjs.map +0 -1
  151. package/dist/op-factory-call-DT7kdjVP.d.mts.map +0 -1
  152. package/dist/op-factory-call-DuRj7WXX.mjs.map +0 -1
  153. package/dist/planner-DPGxFcXo.mjs.map +0 -1
  154. package/dist/planner-ddl-builders-BKlmGDJl.mjs.map +0 -1
  155. package/dist/planner-produced-postgres-migration-C-dwGdb2.d.mts.map +0 -1
  156. package/dist/planner-produced-postgres-migration-CFDpqWWE.mjs.map +0 -1
  157. package/dist/planner-schema-lookup-CiVaAQP-.mjs.map +0 -1
  158. package/dist/postgres-migration-C_OPFhIF.mjs.map +0 -1
  159. package/dist/postgres-migration-DLIvzHjX.d.mts.map +0 -1
  160. package/dist/render-ops-BREh1kHe.mjs.map +0 -1
  161. package/dist/render-typescript-7yqILcwr.mjs.map +0 -1
  162. package/dist/rls-canonicalize.d.mts.map +0 -1
  163. package/dist/sql-utils-SU4FDvIV.mjs.map +0 -1
  164. package/dist/wire-name-DbQ9-2RC.mjs +0 -104
  165. package/dist/wire-name-DbQ9-2RC.mjs.map +0 -1
  166. package/src/core/rls/wire-name.ts +0 -33
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codecs-Deand7sy.mjs","names":["arktype"],"sources":["../src/core/codec-helpers.ts","../src/core/codecs.ts"],"sourcesContent":["/**\n * Shared encode/decode/render constants for the Postgres target codecs.\n *\n * The codec implementations live in `codecs.ts` (TML-2357). This file retains the conversion helpers + emit-path type renderers that the codec methods compose with — keeping a single source of truth for non-trivial conversions while the codec methods provide the framework-required `Promise<…>` boundary.\n *\n * Trivial identity passthroughs are inlined directly in the codec methods; only conversions with shape (custom JSON round-trip, decode normalisation, parameterised renderers) live here.\n */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\nimport { postgresError } from './errors';\n\nexport function renderLength(\n typeName: string,\n typeParams: Record<string, unknown>,\n): string | undefined {\n const length = typeParams['length'];\n if (length === undefined) {\n return undefined;\n }\n if (typeof length !== 'number' || !Number.isFinite(length) || !Number.isInteger(length)) {\n throw postgresError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `renderOutputType: expected integer \"length\" in typeParams for ${typeName}, got ${String(length)}`,\n { meta: { nativeType: typeName, param: 'length', received: String(length) } },\n );\n }\n return `${typeName}<${length}>`;\n}\n\nexport function renderPrecision(typeName: string, typeParams: Record<string, unknown>): string {\n const precision = typeParams['precision'];\n if (precision === undefined) {\n return typeName;\n }\n if (\n typeof precision !== 'number' ||\n !Number.isFinite(precision) ||\n !Number.isInteger(precision)\n ) {\n throw postgresError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `renderOutputType: expected integer \"precision\" in typeParams for ${typeName}, got ${String(precision)}`,\n { meta: { nativeType: typeName, param: 'precision', received: String(precision) } },\n );\n }\n return `${typeName}<${precision}>`;\n}\n\nexport const pgNumericDecode = (wire: string | number): string => {\n if (typeof wire === 'number') return String(wire);\n return wire;\n};\n\nexport const pgNumericRenderOutputType = (typeParams: {\n readonly precision?: number;\n readonly scale?: number;\n}): string | undefined => {\n const precision = typeParams.precision;\n if (precision === undefined) return undefined;\n if (\n typeof precision !== 'number' ||\n !Number.isFinite(precision) ||\n !Number.isInteger(precision)\n ) {\n throw postgresError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `renderOutputType: expected integer \"precision\" in typeParams for Numeric, got ${String(precision)}`,\n { meta: { nativeType: 'Numeric', param: 'precision', received: String(precision) } },\n );\n }\n const scale = typeParams.scale;\n if (scale === undefined) return `Numeric<${precision}>`;\n if (typeof scale !== 'number' || !Number.isFinite(scale) || !Number.isInteger(scale)) {\n throw postgresError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `renderOutputType: expected integer \"scale\" in typeParams for Numeric, got ${String(scale)}`,\n { meta: { nativeType: 'Numeric', param: 'scale', received: String(scale) } },\n );\n }\n return `Numeric<${precision}, ${scale}>`;\n};\n\nconst ISO_8601_TIMESTAMP = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?$/;\nconst ISO_8601_TIMESTAMPTZ =\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?(?:Z|[+-]\\d{2}:\\d{2})$/;\n\nexport const pgTimestampEncodeJson = (value: Date): JsonValue => value.toISOString().slice(0, -1);\nexport const pgTimestampDecodeJson = (json: JsonValue): Date => {\n if (typeof json !== 'string') {\n throw postgresError(\n 'RUNTIME.DECODE_FAILED',\n `Expected ISO date string for pg/timestamp@1, got ${typeof json}`,\n { meta: { codecId: 'pg/timestamp@1', received: typeof json } },\n );\n }\n if (!ISO_8601_TIMESTAMP.test(json)) {\n throw postgresError(\n 'RUNTIME.DECODE_FAILED',\n `Invalid ISO date string for pg/timestamp@1: ${json}`,\n { meta: { codecId: 'pg/timestamp@1', received: json } },\n );\n }\n const date = new Date(`${json}Z`);\n if (Number.isNaN(date.getTime())) {\n throw postgresError(\n 'RUNTIME.DECODE_FAILED',\n `Invalid ISO date string for pg/timestamp@1: ${json}`,\n { meta: { codecId: 'pg/timestamp@1', received: json } },\n );\n }\n return date;\n};\n\nexport const pgTimestamptzEncodeJson = (value: Date): JsonValue =>\n value.toISOString().replace(/Z$/, '+00:00');\nexport const pgTimestamptzDecodeJson = (json: JsonValue): Date => {\n if (typeof json !== 'string') {\n throw postgresError(\n 'RUNTIME.DECODE_FAILED',\n `Expected ISO date string for pg/timestamptz@1, got ${typeof json}`,\n { meta: { codecId: 'pg/timestamptz@1', received: typeof json } },\n );\n }\n if (!ISO_8601_TIMESTAMPTZ.test(json)) {\n throw postgresError(\n 'RUNTIME.DECODE_FAILED',\n `Invalid ISO date string for pg/timestamptz@1: ${json}`,\n { meta: { codecId: 'pg/timestamptz@1', received: json } },\n );\n }\n const date = new Date(json);\n if (Number.isNaN(date.getTime())) {\n throw postgresError(\n 'RUNTIME.DECODE_FAILED',\n `Invalid ISO date string for pg/timestamptz@1: ${json}`,\n { meta: { codecId: 'pg/timestamptz@1', received: json } },\n );\n }\n return date;\n};\n\nconst ISO_8601_DATE = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\n\nfunction formatDateOnly(year: number, month: number, day: number): string {\n return `${String(year).padStart(4, '0')}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`;\n}\n\n/**\n * A Postgres `date` has no time-of-day or timezone component, so `pg/date@1`\n * canonicalizes its JS-level value as a `Date` at UTC midnight\n * (`Date.UTC(y, m, d)`), independent of the process's local timezone.\n *\n * `pgDateEncode` reads the calendar date via UTC getters (matching that\n * canonical form) and formats it as `YYYY-MM-DD` directly, bypassing the pg\n * driver's own `Date` serialization (`dateToString`), which reads *local*\n * getters and would shift the calendar day near midnight in negative-UTC-offset\n * environments.\n */\nexport const pgDateEncode = (value: Date): string =>\n formatDateOnly(value.getUTCFullYear(), value.getUTCMonth() + 1, value.getUTCDate());\n\n/**\n * Normalizes the pg driver's already-parsed `Date` for a `date` column into\n * the canonical UTC-midnight form. The driver (via `postgres-date`) builds\n * that `Date` at *local* midnight from the wire text; reading it back with the\n * same (local) getters recovers the exact calendar date the driver parsed,\n * and reconstructing via `Date.UTC` makes the result's instant independent of\n * the process's timezone.\n */\nexport const pgDateDecode = (wire: Date): Date =>\n new Date(Date.UTC(wire.getFullYear(), wire.getMonth(), wire.getDate()));\n\nexport const pgDateEncodeJson = (value: Date): JsonValue => pgDateEncode(value);\n\nexport const pgDateDecodeJson = (json: JsonValue): Date => {\n if (typeof json !== 'string') {\n throw postgresError(\n 'RUNTIME.DECODE_FAILED',\n `Expected date string for pg/date@1, got ${typeof json}`,\n { meta: { codecId: 'pg/date@1', received: typeof json } },\n );\n }\n const match = ISO_8601_DATE.exec(json);\n if (!match) {\n throw postgresError('RUNTIME.DECODE_FAILED', `Invalid date string for pg/date@1: ${json}`, {\n meta: { codecId: 'pg/date@1', received: json },\n });\n }\n const [, yearText, monthText, dayText] = match;\n const year = Number(yearText);\n const month = Number(monthText) - 1;\n const day = Number(dayText);\n const date = new Date(Date.UTC(year, month, day));\n if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) {\n throw postgresError('RUNTIME.DECODE_FAILED', `Invalid date string for pg/date@1: ${json}`, {\n meta: { codecId: 'pg/date@1', received: json },\n });\n }\n return date;\n};\n\nexport const pgIntervalDecode = (wire: string | Record<string, unknown>): string => {\n if (typeof wire === 'string') return wire;\n return JSON.stringify(wire);\n};\n\nexport const pgByteaEncodeJson = (value: Uint8Array): JsonValue =>\n `\\\\x${Buffer.from(value).toString('hex')}`;\n\nexport const pgByteaDecodeJson = (value: JsonValue): Uint8Array => {\n if (typeof value !== 'string' || !value.startsWith('\\\\x')) {\n throw postgresError(\n 'RUNTIME.DECODE_FAILED',\n `Expected Postgres bytea hex text to start with \"\\\\x\"`,\n { meta: { codecId: 'pg/bytea@1' } },\n );\n }\n\n const hex = value.slice(2);\n if (hex.length % 2 !== 0) {\n throw postgresError(\n 'RUNTIME.DECODE_FAILED',\n `Invalid Postgres bytea hex text length: ${hex.length}`,\n { meta: { codecId: 'pg/bytea@1', received: hex.length } },\n );\n }\n\n const bytes = new Uint8Array(hex.length / 2);\n for (let offset = 0; offset < hex.length; offset += 2) {\n const pair = hex.slice(offset, offset + 2);\n if (!/^[0-9a-fA-F]{2}$/.test(pair)) {\n throw postgresError(\n 'RUNTIME.DECODE_FAILED',\n `Invalid Postgres bytea hex pair \"${pair}\" at offset ${offset}`,\n { meta: { codecId: 'pg/bytea@1', received: pair } },\n );\n }\n bytes[offset / 2] = Number.parseInt(pair, 16);\n }\n return bytes;\n};\n\nexport const pgJsonEncode = (value: string | JsonValue): string => JSON.stringify(value);\nexport const pgJsonDecode = (wire: string | JsonValue): JsonValue =>\n typeof wire === 'string' ? JSON.parse(wire) : wire;\n\nexport const pgJsonbEncode = (value: string | JsonValue): string => JSON.stringify(value);\nexport const pgJsonbDecode = (wire: string | JsonValue): JsonValue =>\n typeof wire === 'string' ? JSON.parse(wire) : wire;\n","/**\n * Native Postgres target codecs (TML-2357). Mirrors the SQL base codec form in `packages/2-sql/4-lanes/relational-core/src/ast/sql-codecs.ts`.\n *\n * Each codec ships as three artifacts:\n *\n * 1. A `PgXCodec` class extending {@link CodecImpl} that wraps the module-level encode/decode/encodeJson/decodeJson constants exported from `codec-helpers.ts` (the single source of truth for non-trivial runtime conversions; trivial identity passthroughs are inlined). 2. A `PgXDescriptor` class extending {@link CodecDescriptorImpl} declaring the codec id, traits, target types, params schema, meta, and (where applicable)\n * the emit-path `renderOutputType`. 3. A per-codec column helper (`pgXColumn`) that calls `descriptor.factory(...)` directly and packages the result into a framework `ColumnSpec` via the framework {@link column} packager. The helper is tied to its descriptor with `satisfies ColumnHelperFor` (and `ColumnHelperForStrict` where the resolved codec type is well-defined).\n *\n * After TML-2357 this is the canonical source of Postgres codec metadata and runtime behaviour — the legacy `mkCodec` / `defineCodec` carriers (and the parallel `byScalar`/`codecDescriptorDefinitions`/ `codecDescriptorList` collection exports) retired with the deletion sweep.\n *\n * Audit (parameterized codecs): every parameterized codec in this file is **parameter-stateless** — the params (`length`, `precision`, `precision`+`scale`, `values`) only inform the emit-path `renderOutputType` renderer or stay as JSON metadata. None of the runtime encode/decode/encodeJson/decodeJson conversions thread params into their behavior, so each `factory(_params)` returns a fresh codec constructed solely from\n * `this` (the descriptor).\n */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\nimport {\n type AnyCodecDescriptor,\n type CodecCallContext,\n CodecDescriptorImpl,\n CodecImpl,\n type CodecInstanceContext,\n type CodecMeta,\n type ColumnHelperFor,\n type ColumnHelperForStrict,\n column,\n renderTsLiteral,\n voidParamsSchema,\n} from '@prisma-next/framework-components/codec';\nimport { UNBOUND_NAMESPACE_ID } from '@prisma-next/framework-components/ir';\nimport {\n SqlCharCodec,\n SqlFloatCodec,\n SqlIntCodec,\n SqlVarcharCodec,\n sqlCharDescriptor,\n sqlFloatDescriptor,\n sqlIntDescriptor,\n sqlTextDescriptor,\n sqlTimestampDescriptor,\n sqlVarcharDescriptor,\n} from '@prisma-next/sql-relational-core/ast';\nimport { blindCast } from '@prisma-next/utils/casts';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { type as arktype } from 'arktype';\nimport {\n pgByteaDecodeJson,\n pgByteaEncodeJson,\n pgDateDecode,\n pgDateDecodeJson,\n pgDateEncode,\n pgDateEncodeJson,\n pgIntervalDecode,\n pgJsonbDecode,\n pgJsonbEncode,\n pgJsonDecode,\n pgJsonEncode,\n pgNumericDecode,\n pgNumericRenderOutputType,\n pgTimestampDecodeJson,\n pgTimestampEncodeJson,\n pgTimestamptzDecodeJson,\n pgTimestamptzEncodeJson,\n renderLength,\n renderPrecision,\n} from './codec-helpers';\nimport {\n PG_BIT_CODEC_ID,\n PG_BOOL_CODEC_ID,\n PG_BYTEA_CODEC_ID,\n PG_CHAR_CODEC_ID,\n PG_DATE_CODEC_ID,\n PG_ENUM_CODEC_ID,\n PG_FLOAT_CODEC_ID,\n PG_FLOAT4_CODEC_ID,\n PG_FLOAT8_CODEC_ID,\n PG_INET_CODEC_ID,\n PG_INT_CODEC_ID,\n PG_INT2_CODEC_ID,\n PG_INT4_CODEC_ID,\n PG_INT8_CODEC_ID,\n PG_INTERVAL_CODEC_ID,\n PG_JSON_CODEC_ID,\n PG_JSONB_CODEC_ID,\n PG_NUMERIC_CODEC_ID,\n PG_TEXT_ARRAY_CODEC_ID,\n PG_TEXT_CODEC_ID,\n PG_TIME_CODEC_ID,\n PG_TIMESTAMP_CODEC_ID,\n PG_TIMESTAMPTZ_CODEC_ID,\n PG_TIMETZ_CODEC_ID,\n PG_UUID_CODEC_ID,\n PG_VARBIT_CODEC_ID,\n PG_VARCHAR_CODEC_ID,\n} from './codec-ids';\nimport { postgresError } from './errors';\nimport { DEFAULT_NAMESPACE_ID } from './namespace-ids';\nimport { PostgresNativeEnum } from './postgres-native-enum';\n\ntype LengthParams = { readonly length?: number };\ntype PrecisionParams = { readonly precision?: number };\ntype NumericParams = { readonly precision?: number; readonly scale?: number };\n\nconst lengthParamsSchema = arktype({\n 'length?': 'number.integer > 0',\n}) satisfies StandardSchemaV1<LengthParams>;\n\nconst numericParamsSchema = arktype({\n 'precision?': 'number.integer > 0 & number.integer <= 1000',\n 'scale?': 'number.integer >= 0',\n}) satisfies StandardSchemaV1<NumericParams>;\n\nconst precisionParamsSchema = arktype({\n 'precision?': 'number.integer >= 0 & number.integer <= 6',\n}) satisfies StandardSchemaV1<PrecisionParams>;\n\nconst PG_TEXT_META = { db: { sql: { postgres: { nativeType: 'text' } } } } as const;\nconst PG_TEXT_ARRAY_META = { db: { sql: { postgres: { nativeType: 'text[]' } } } } as const;\nconst PG_INT4_META = { db: { sql: { postgres: { nativeType: 'integer' } } } } as const;\nconst PG_INT2_META = { db: { sql: { postgres: { nativeType: 'smallint' } } } } as const;\nconst PG_INT8_META = { db: { sql: { postgres: { nativeType: 'bigint' } } } } as const;\nconst PG_FLOAT4_META = { db: { sql: { postgres: { nativeType: 'real' } } } } as const;\nconst PG_FLOAT8_META = { db: { sql: { postgres: { nativeType: 'double precision' } } } } as const;\nconst PG_NUMERIC_META = { db: { sql: { postgres: { nativeType: 'numeric' } } } } as const;\nconst PG_DATE_META = { db: { sql: { postgres: { nativeType: 'date' } } } } as const;\nconst PG_TIMESTAMP_META = {\n db: { sql: { postgres: { nativeType: 'timestamp without time zone' } } },\n} as const;\nconst PG_TIMESTAMPTZ_META = {\n db: { sql: { postgres: { nativeType: 'timestamp with time zone' } } },\n} as const;\nconst PG_TIME_META = { db: { sql: { postgres: { nativeType: 'time' } } } } as const;\nconst PG_TIMETZ_META = { db: { sql: { postgres: { nativeType: 'timetz' } } } } as const;\nconst PG_BOOL_META = { db: { sql: { postgres: { nativeType: 'boolean' } } } } as const;\nconst PG_BIT_META = { db: { sql: { postgres: { nativeType: 'bit' } } } } as const;\nconst PG_VARBIT_META = { db: { sql: { postgres: { nativeType: 'bit varying' } } } } as const;\nconst PG_BYTEA_META = { db: { sql: { postgres: { nativeType: 'bytea' } } } } as const;\nconst PG_INTERVAL_META = { db: { sql: { postgres: { nativeType: 'interval' } } } } as const;\nconst PG_JSON_META = { db: { sql: { postgres: { nativeType: 'json' } } } } as const;\nconst PG_JSONB_META = { db: { sql: { postgres: { nativeType: 'jsonb' } } } } as const;\n\nexport class PgTextCodec extends CodecImpl<\n typeof PG_TEXT_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return value;\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return wire;\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\n }\n}\n\nexport class PgTextDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = PG_TEXT_CODEC_ID;\n override readonly traits = ['equality', 'order', 'textual'] as const;\n override readonly targetTypes = ['text'] as const;\n override readonly meta = PG_TEXT_META;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override renderValueLiteral(value: JsonValue): string | undefined {\n return renderTsLiteral(value);\n }\n override factory(): (ctx: CodecInstanceContext) => PgTextCodec {\n return () => new PgTextCodec(this);\n }\n}\n\nexport const pgTextDescriptor = new PgTextDescriptor();\n\nexport const pgTextColumn = () =>\n column(pgTextDescriptor.factory(), pgTextDescriptor.codecId, undefined, 'text');\n\npgTextColumn satisfies ColumnHelperFor<PgTextDescriptor>;\npgTextColumn satisfies ColumnHelperForStrict<PgTextDescriptor>;\n\n/**\n * Codec for a `pg.enum(Ref)` column bound to a native Postgres enum type.\n * Text passthrough, identical to `pg/text@1` — encode/decode do not carry the\n * enum's member values; membership is enforced by the native type itself, not\n * by this codec. `renderValueLiteral` renders a member value as its TS\n * literal, which is what drives the column's typed value-union (via\n * `renderValueSetType` reading the column's `valueSet` ref) — the codec\n * itself carries no params of its own; typing comes entirely from the\n * column's value-set, not from `pg/enum@1`.\n *\n * A distinct codec id (rather than reusing `pg/text@1` on a plain text\n * column) keeps native-enum columns independently identifiable — from a\n * column's `codecId` alone, without also inspecting `nativeType` — which\n * the managed (DDL) phase needs to target `CREATE TYPE`/`ALTER TYPE`\n * operations at exactly the columns that use one.\n */\nexport class PgEnumCodec extends CodecImpl<\n typeof PG_ENUM_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return value;\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return wire;\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return blindCast<\n string,\n 'text codec: a native-enum member value is stored as its wire string form'\n >(json);\n }\n}\n\nexport type PgEnumParams = { readonly typeName: string };\n\n/**\n * Narrows codec `typeParams` to {@link PgEnumParams} — the shape that binds a\n * column to a named database type (a native enum's `CREATE TYPE` name).\n */\nexport function isPgEnumParams(value: unknown): value is PgEnumParams {\n return (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n 'typeName' in value &&\n typeof value.typeName === 'string'\n );\n}\n\nconst pgEnumParamsSchema = arktype({\n typeName: 'string',\n}) satisfies StandardSchemaV1<PgEnumParams>;\n\nexport class PgEnumDescriptor extends CodecDescriptorImpl<PgEnumParams> {\n override readonly codecId = PG_ENUM_CODEC_ID;\n override readonly traits = ['equality', 'order', 'textual'] as const;\n override readonly targetTypes = ['text'] as const;\n override readonly meta = PG_TEXT_META;\n override readonly paramsSchema = pgEnumParamsSchema satisfies StandardSchemaV1<PgEnumParams>;\n override renderValueLiteral(value: JsonValue): string | undefined {\n return renderTsLiteral(value);\n }\n override metaFor(typeParams: JsonValue | undefined): CodecMeta | undefined {\n return isPgEnumParams(typeParams)\n ? { db: { sql: { postgres: { nativeType: typeParams.typeName } } } }\n : this.meta;\n }\n override factory(_params: PgEnumParams): (ctx: CodecInstanceContext) => PgEnumCodec {\n return () => new PgEnumCodec(this);\n }\n\n /**\n * Authoring-time hook a `pg.enum(<ref>)` type constructor calls once it has\n * resolved its ref argument to the referenced `native_enum` entity:\n * produces this codec's per-column `typeParams` and native type from the\n * entity's bare type name. Schema-qualification (`auth.aal_level` for a\n * named non-default schema) is not this hook's concern — the field's\n * namespace isn't known at this call site for every authoring path (the TS\n * builder resolves a column before it knows its model's namespace), so it is\n * applied later, at contract construction, by {@link qualifyNativeType} via\n * the target's `authoring.qualifyColumnType` hook. `nativeType` mirrors\n * `typeParams.typeName` — the same value {@link metaFor} derives at render\n * time — so the column's declared native type and the render-time cast\n * agree. Returns `undefined` if `entity` is not a `PostgresNativeEnum` (a\n * contributor bug, not a user-schema error — the caller decides how to\n * report it).\n */\n columnFromEntity(\n entity: object,\n ): { readonly typeParams: PgEnumParams; readonly nativeType: string } | undefined {\n if (!PostgresNativeEnum.is(entity)) return undefined;\n return { typeParams: { typeName: entity.typeName }, nativeType: entity.typeName };\n }\n\n /**\n * Schema-qualifies this native enum type's name for the namespace the\n * consuming column lives in: `${namespaceId}.${typeName}` for a named\n * non-default schema, bare for the target's default schema (`public`) or\n * the late-bound unbound sentinel (whose schema `search_path` resolves at\n * runtime). Postgres's `format_type()` reports the bare name for a\n * public-schema type, so a public column's declared native type must stay\n * bare to match. Owned here because the codec owns its native type.\n */\n qualifyNativeType(typeName: string, namespaceId: string): string {\n return namespaceId === DEFAULT_NAMESPACE_ID || namespaceId === UNBOUND_NAMESPACE_ID\n ? typeName\n : `${namespaceId}.${typeName}`;\n }\n}\n\nexport const pgEnumDescriptor = new PgEnumDescriptor();\n\n/**\n * Contract-construction-time column-type qualifier the Postgres target\n * contributes through `authoring.qualifyColumnType`.\n * `buildSqlContractFromDefinition` calls this for every column as it is\n * constructed, passing the column's bare type info and its owning\n * `namespaceId`; a native-enum column (`pg/enum@1`) gets its type name\n * schema-qualified for that namespace (via\n * {@link PgEnumDescriptor.qualifyNativeType}), keeping `nativeType` and\n * `typeParams.typeName` in sync. Every other codec passes through unchanged.\n * Both the PSL `pg.enum(Ref)` path and the TS `pg.enum(handle)` path route\n * through here — the dispatch keys off the codec id, not authoring surface.\n */\nexport function postgresQualifyColumnType(\n input: {\n readonly codecId: string;\n readonly nativeType: string;\n readonly typeParams?: Record<string, unknown>;\n },\n namespaceId: string,\n): { readonly nativeType: string; readonly typeParams?: Record<string, unknown> } {\n if (input.codecId !== PG_ENUM_CODEC_ID) return input;\n const bareTypeName = input.typeParams?.['typeName'];\n if (typeof bareTypeName !== 'string') return input;\n const qualified = pgEnumDescriptor.qualifyNativeType(bareTypeName, namespaceId);\n return { nativeType: qualified, typeParams: { ...input.typeParams, typeName: qualified } };\n}\n\n/**\n * Postgres `text[]` codec. Encode is an identity pass-through: the pg wire\n * driver serialises a JS `string[]` to a Postgres array literal under the\n * `$N::text[]` cast the renderer emits from this codec's `text[]` native type,\n * and decode reads it back as a JS array. Used by the control plane to write\n * the marker's `invariants` column. Not a user-facing scalar — it is not part\n * of the authorable `CodecTypes` surface, only the runtime codec registry.\n */\nexport class PgTextArrayCodec extends CodecImpl<\n typeof PG_TEXT_ARRAY_CODEC_ID,\n readonly ['equality'],\n readonly string[],\n readonly string[]\n> {\n async encode(value: readonly string[], _ctx: CodecCallContext): Promise<readonly string[]> {\n return value;\n }\n async decode(wire: readonly string[], _ctx: CodecCallContext): Promise<readonly string[]> {\n return wire;\n }\n encodeJson(value: readonly string[]): JsonValue {\n return [...value];\n }\n decodeJson(json: JsonValue): readonly string[] {\n return Array.isArray(json) ? json.map((entry) => String(entry)) : [];\n }\n}\n\nexport class PgTextArrayDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = PG_TEXT_ARRAY_CODEC_ID;\n override readonly traits = ['equality'] as const;\n override readonly targetTypes = ['text[]'] as const;\n override readonly meta = PG_TEXT_ARRAY_META;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => PgTextArrayCodec {\n return () => new PgTextArrayCodec(this);\n }\n}\n\nexport const pgTextArrayDescriptor = new PgTextArrayDescriptor();\n\nexport class PgInt4Codec extends CodecImpl<\n typeof PG_INT4_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number,\n number\n> {\n async encode(value: number, _ctx: CodecCallContext): Promise<number> {\n return value;\n }\n async decode(wire: number, _ctx: CodecCallContext): Promise<number> {\n return wire;\n }\n encodeJson(value: number): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): number {\n return json as number;\n }\n}\n\nexport class PgInt4Descriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = PG_INT4_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['int4'] as const;\n override readonly meta = PG_INT4_META;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override renderValueLiteral(value: JsonValue): string | undefined {\n return renderTsLiteral(value);\n }\n override factory(): (ctx: CodecInstanceContext) => PgInt4Codec {\n return () => new PgInt4Codec(this);\n }\n}\n\nexport const pgInt4Descriptor = new PgInt4Descriptor();\n\nexport const pgInt4Column = () =>\n column(pgInt4Descriptor.factory(), pgInt4Descriptor.codecId, undefined, 'int4');\n\npgInt4Column satisfies ColumnHelperFor<PgInt4Descriptor>;\npgInt4Column satisfies ColumnHelperForStrict<PgInt4Descriptor>;\n\nexport class PgInt2Codec extends CodecImpl<\n typeof PG_INT2_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number,\n number\n> {\n async encode(value: number, _ctx: CodecCallContext): Promise<number> {\n return value;\n }\n async decode(wire: number, _ctx: CodecCallContext): Promise<number> {\n return wire;\n }\n encodeJson(value: number): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): number {\n return json as number;\n }\n}\n\nexport class PgInt2Descriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = PG_INT2_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['int2'] as const;\n override readonly meta = PG_INT2_META;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override renderValueLiteral(value: JsonValue): string | undefined {\n return renderTsLiteral(value);\n }\n override factory(): (ctx: CodecInstanceContext) => PgInt2Codec {\n return () => new PgInt2Codec(this);\n }\n}\n\nexport const pgInt2Descriptor = new PgInt2Descriptor();\n\nexport const pgInt2Column = () =>\n column(pgInt2Descriptor.factory(), pgInt2Descriptor.codecId, undefined, 'int2');\n\npgInt2Column satisfies ColumnHelperFor<PgInt2Descriptor>;\npgInt2Column satisfies ColumnHelperForStrict<PgInt2Descriptor>;\n\nexport class PgInt8Codec extends CodecImpl<\n typeof PG_INT8_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number,\n number\n> {\n async encode(value: number, _ctx: CodecCallContext): Promise<number> {\n return value;\n }\n async decode(wire: number, _ctx: CodecCallContext): Promise<number> {\n return wire;\n }\n encodeJson(value: number): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): number {\n return json as number;\n }\n}\n\nexport class PgInt8Descriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = PG_INT8_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['int8'] as const;\n override readonly meta = PG_INT8_META;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override renderValueLiteral(value: JsonValue): string | undefined {\n return renderTsLiteral(value);\n }\n override factory(): (ctx: CodecInstanceContext) => PgInt8Codec {\n return () => new PgInt8Codec(this);\n }\n}\n\nexport const pgInt8Descriptor = new PgInt8Descriptor();\n\nexport const pgInt8Column = () =>\n column(pgInt8Descriptor.factory(), pgInt8Descriptor.codecId, undefined, 'int8');\n\npgInt8Column satisfies ColumnHelperFor<PgInt8Descriptor>;\npgInt8Column satisfies ColumnHelperForStrict<PgInt8Descriptor>;\n\nexport class PgFloat4Codec extends CodecImpl<\n typeof PG_FLOAT4_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number,\n number\n> {\n async encode(value: number, _ctx: CodecCallContext): Promise<number> {\n return value;\n }\n async decode(wire: number, _ctx: CodecCallContext): Promise<number> {\n return wire;\n }\n encodeJson(value: number): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): number {\n return json as number;\n }\n}\n\nexport class PgFloat4Descriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = PG_FLOAT4_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['float4'] as const;\n override readonly meta = PG_FLOAT4_META;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override renderValueLiteral(value: JsonValue): string | undefined {\n return renderTsLiteral(value);\n }\n override factory(): (ctx: CodecInstanceContext) => PgFloat4Codec {\n return () => new PgFloat4Codec(this);\n }\n}\n\nexport const pgFloat4Descriptor = new PgFloat4Descriptor();\n\nexport const pgFloat4Column = () =>\n column(pgFloat4Descriptor.factory(), pgFloat4Descriptor.codecId, undefined, 'float4');\n\npgFloat4Column satisfies ColumnHelperFor<PgFloat4Descriptor>;\npgFloat4Column satisfies ColumnHelperForStrict<PgFloat4Descriptor>;\n\nexport class PgFloat8Codec extends CodecImpl<\n typeof PG_FLOAT8_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number,\n number\n> {\n async encode(value: number, _ctx: CodecCallContext): Promise<number> {\n return value;\n }\n async decode(wire: number, _ctx: CodecCallContext): Promise<number> {\n return wire;\n }\n encodeJson(value: number): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): number {\n return json as number;\n }\n}\n\nexport class PgFloat8Descriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = PG_FLOAT8_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['float8'] as const;\n override readonly meta = PG_FLOAT8_META;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override renderValueLiteral(value: JsonValue): string | undefined {\n return renderTsLiteral(value);\n }\n override factory(): (ctx: CodecInstanceContext) => PgFloat8Codec {\n return () => new PgFloat8Codec(this);\n }\n}\n\nexport const pgFloat8Descriptor = new PgFloat8Descriptor();\n\nexport const pgFloat8Column = () =>\n column(pgFloat8Descriptor.factory(), pgFloat8Descriptor.codecId, undefined, 'float8');\n\npgFloat8Column satisfies ColumnHelperFor<PgFloat8Descriptor>;\npgFloat8Column satisfies ColumnHelperForStrict<PgFloat8Descriptor>;\n\nexport class PgBoolCodec extends CodecImpl<\n typeof PG_BOOL_CODEC_ID,\n readonly ['equality', 'boolean'],\n boolean,\n boolean\n> {\n async encode(value: boolean, _ctx: CodecCallContext): Promise<boolean> {\n return value;\n }\n async decode(wire: boolean, _ctx: CodecCallContext): Promise<boolean> {\n return wire;\n }\n encodeJson(value: boolean): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): boolean {\n return json as boolean;\n }\n}\n\nexport class PgBoolDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = PG_BOOL_CODEC_ID;\n override readonly traits = ['equality', 'boolean'] as const;\n override readonly targetTypes = ['bool'] as const;\n override readonly meta = PG_BOOL_META;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override renderValueLiteral(value: JsonValue): string | undefined {\n return renderTsLiteral(value);\n }\n override factory(): (ctx: CodecInstanceContext) => PgBoolCodec {\n return () => new PgBoolCodec(this);\n }\n}\n\nexport const pgBoolDescriptor = new PgBoolDescriptor();\n\nexport const pgBoolColumn = () =>\n column(pgBoolDescriptor.factory(), pgBoolDescriptor.codecId, undefined, 'bool');\n\npgBoolColumn satisfies ColumnHelperFor<PgBoolDescriptor>;\npgBoolColumn satisfies ColumnHelperForStrict<PgBoolDescriptor>;\n\nexport class PgNumericCodec extends CodecImpl<\n typeof PG_NUMERIC_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n string | number,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return value;\n }\n async decode(wire: string | number, _ctx: CodecCallContext): Promise<string> {\n return pgNumericDecode(wire);\n }\n encodeJson(value: string): JsonValue {\n const number = Number(value);\n if (!Number.isFinite(number)) {\n throw postgresError(\n 'RUNTIME.ENCODE_FAILED',\n 'pg/numeric@1 database JSON value must be a finite number',\n { meta: { codecId: 'pg/numeric@1', received: value } },\n );\n }\n return number;\n }\n decodeJson(json: JsonValue): string {\n if (typeof json !== 'number') {\n throw postgresError(\n 'RUNTIME.DECODE_FAILED',\n 'pg/numeric@1 database JSON value must be a number',\n { meta: { codecId: 'pg/numeric@1', received: typeof json } },\n );\n }\n return pgNumericDecode(json);\n }\n}\n\nexport class PgNumericDescriptor extends CodecDescriptorImpl<NumericParams> {\n override readonly codecId = PG_NUMERIC_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['numeric', 'decimal'] as const;\n override readonly meta = PG_NUMERIC_META;\n override readonly paramsSchema = numericParamsSchema satisfies StandardSchemaV1<NumericParams>;\n override renderOutputType(params: NumericParams): string | undefined {\n return pgNumericRenderOutputType(params);\n }\n override factory(_params: NumericParams): (ctx: CodecInstanceContext) => PgNumericCodec {\n return () => new PgNumericCodec(this);\n }\n}\n\nexport const pgNumericDescriptor = new PgNumericDescriptor();\n\nexport const pgNumericColumn = (params: NumericParams = {}) =>\n column(pgNumericDescriptor.factory(params), pgNumericDescriptor.codecId, params, 'numeric');\n\npgNumericColumn satisfies ColumnHelperFor<PgNumericDescriptor>;\npgNumericColumn satisfies ColumnHelperForStrict<PgNumericDescriptor>;\n\n/**\n * A Postgres `date` has no time-of-day or timezone component. This codec\n * canonicalizes its JS-level value as a `Date` at UTC midnight, so its\n * round-trip is independent of the process's local timezone — see\n * `pgDateEncode`/`pgDateDecode` in `codec-helpers.ts`.\n */\nexport class PgDateCodec extends CodecImpl<\n typeof PG_DATE_CODEC_ID,\n readonly ['equality', 'order'],\n Date | string,\n Date\n> {\n async encode(value: Date, _ctx: CodecCallContext): Promise<string> {\n return pgDateEncode(value);\n }\n async decode(wire: Date, _ctx: CodecCallContext): Promise<Date> {\n return pgDateDecode(wire);\n }\n encodeJson(value: Date): JsonValue {\n return pgDateEncodeJson(value);\n }\n decodeJson(json: JsonValue): Date {\n return pgDateDecodeJson(json);\n }\n}\n\nexport class PgDateDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = PG_DATE_CODEC_ID;\n override readonly traits = ['equality', 'order'] as const;\n override readonly targetTypes = ['date'] as const;\n override readonly meta = PG_DATE_META;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => PgDateCodec {\n return () => new PgDateCodec(this);\n }\n}\n\nexport const pgDateDescriptor = new PgDateDescriptor();\n\nexport const pgDateColumn = () =>\n column(pgDateDescriptor.factory(), pgDateDescriptor.codecId, undefined, 'date');\n\npgDateColumn satisfies ColumnHelperFor<PgDateDescriptor>;\npgDateColumn satisfies ColumnHelperForStrict<PgDateDescriptor>;\n\nexport class PgTimestampCodec extends CodecImpl<\n typeof PG_TIMESTAMP_CODEC_ID,\n readonly ['equality', 'order'],\n Date,\n Date\n> {\n async encode(value: Date, _ctx: CodecCallContext): Promise<Date> {\n return value;\n }\n async decode(wire: Date, _ctx: CodecCallContext): Promise<Date> {\n return wire;\n }\n encodeJson(value: Date): JsonValue {\n return pgTimestampEncodeJson(value);\n }\n decodeJson(json: JsonValue): Date {\n return pgTimestampDecodeJson(json);\n }\n}\n\nexport class PgTimestampDescriptor extends CodecDescriptorImpl<PrecisionParams> {\n override readonly codecId = PG_TIMESTAMP_CODEC_ID;\n override readonly traits = ['equality', 'order'] as const;\n override readonly targetTypes = ['timestamp'] as const;\n override readonly meta = PG_TIMESTAMP_META;\n override readonly paramsSchema =\n precisionParamsSchema satisfies StandardSchemaV1<PrecisionParams>;\n override renderOutputType(params: PrecisionParams): string | undefined {\n return renderPrecision('Timestamp', params as Record<string, unknown>);\n }\n override factory(_params: PrecisionParams): (ctx: CodecInstanceContext) => PgTimestampCodec {\n return () => new PgTimestampCodec(this);\n }\n}\n\nexport const pgTimestampDescriptor = new PgTimestampDescriptor();\n\nexport const pgTimestampColumn = (params: PrecisionParams = {}) =>\n column(pgTimestampDescriptor.factory(params), pgTimestampDescriptor.codecId, params, 'timestamp');\n\npgTimestampColumn satisfies ColumnHelperFor<PgTimestampDescriptor>;\npgTimestampColumn satisfies ColumnHelperForStrict<PgTimestampDescriptor>;\n\nexport class PgTimestamptzCodec extends CodecImpl<\n typeof PG_TIMESTAMPTZ_CODEC_ID,\n readonly ['equality', 'order'],\n Date,\n Date\n> {\n async encode(value: Date, _ctx: CodecCallContext): Promise<Date> {\n return value;\n }\n async decode(wire: Date, _ctx: CodecCallContext): Promise<Date> {\n return wire;\n }\n encodeJson(value: Date): JsonValue {\n return pgTimestamptzEncodeJson(value);\n }\n decodeJson(json: JsonValue): Date {\n return pgTimestamptzDecodeJson(json);\n }\n}\n\nexport class PgTimestamptzDescriptor extends CodecDescriptorImpl<PrecisionParams> {\n override readonly codecId = PG_TIMESTAMPTZ_CODEC_ID;\n override readonly traits = ['equality', 'order'] as const;\n override readonly targetTypes = ['timestamptz'] as const;\n override readonly meta = PG_TIMESTAMPTZ_META;\n override readonly paramsSchema =\n precisionParamsSchema satisfies StandardSchemaV1<PrecisionParams>;\n override renderOutputType(params: PrecisionParams): string | undefined {\n return renderPrecision('Timestamptz', params as Record<string, unknown>);\n }\n override factory(_params: PrecisionParams): (ctx: CodecInstanceContext) => PgTimestamptzCodec {\n return () => new PgTimestamptzCodec(this);\n }\n}\n\nexport const pgTimestamptzDescriptor = new PgTimestamptzDescriptor();\n\nexport const pgTimestamptzColumn = (params: PrecisionParams = {}) =>\n column(\n pgTimestamptzDescriptor.factory(params),\n pgTimestamptzDescriptor.codecId,\n params,\n 'timestamptz',\n );\n\npgTimestamptzColumn satisfies ColumnHelperFor<PgTimestamptzDescriptor>;\npgTimestamptzColumn satisfies ColumnHelperForStrict<PgTimestamptzDescriptor>;\n\nexport class PgTimeCodec extends CodecImpl<\n typeof PG_TIME_CODEC_ID,\n readonly ['equality', 'order'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return value;\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return wire;\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\n }\n}\n\nexport class PgTimeDescriptor extends CodecDescriptorImpl<PrecisionParams> {\n override readonly codecId = PG_TIME_CODEC_ID;\n override readonly traits = ['equality', 'order'] as const;\n override readonly targetTypes = ['time'] as const;\n override readonly meta = PG_TIME_META;\n override readonly paramsSchema =\n precisionParamsSchema satisfies StandardSchemaV1<PrecisionParams>;\n override renderOutputType(params: PrecisionParams): string | undefined {\n return renderPrecision('Time', params as Record<string, unknown>);\n }\n override factory(_params: PrecisionParams): (ctx: CodecInstanceContext) => PgTimeCodec {\n return () => new PgTimeCodec(this);\n }\n}\n\nexport const pgTimeDescriptor = new PgTimeDescriptor();\n\nexport const pgTimeColumn = (params: PrecisionParams = {}) =>\n column(pgTimeDescriptor.factory(params), pgTimeDescriptor.codecId, params, 'time');\n\npgTimeColumn satisfies ColumnHelperFor<PgTimeDescriptor>;\npgTimeColumn satisfies ColumnHelperForStrict<PgTimeDescriptor>;\n\nexport class PgTimetzCodec extends CodecImpl<\n typeof PG_TIMETZ_CODEC_ID,\n readonly ['equality', 'order'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return value;\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return wire;\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\n }\n}\n\nexport class PgTimetzDescriptor extends CodecDescriptorImpl<PrecisionParams> {\n override readonly codecId = PG_TIMETZ_CODEC_ID;\n override readonly traits = ['equality', 'order'] as const;\n override readonly targetTypes = ['timetz'] as const;\n override readonly meta = PG_TIMETZ_META;\n override readonly paramsSchema =\n precisionParamsSchema satisfies StandardSchemaV1<PrecisionParams>;\n override renderOutputType(params: PrecisionParams): string | undefined {\n return renderPrecision('Timetz', params as Record<string, unknown>);\n }\n override factory(_params: PrecisionParams): (ctx: CodecInstanceContext) => PgTimetzCodec {\n return () => new PgTimetzCodec(this);\n }\n}\n\nexport const pgTimetzDescriptor = new PgTimetzDescriptor();\n\nexport const pgTimetzColumn = (params: PrecisionParams = {}) =>\n column(pgTimetzDescriptor.factory(params), pgTimetzDescriptor.codecId, params, 'timetz');\n\npgTimetzColumn satisfies ColumnHelperFor<PgTimetzDescriptor>;\npgTimetzColumn satisfies ColumnHelperForStrict<PgTimetzDescriptor>;\n\nexport class PgBitCodec extends CodecImpl<\n typeof PG_BIT_CODEC_ID,\n readonly ['equality', 'order'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return value;\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return wire;\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\n }\n}\n\nexport class PgBitDescriptor extends CodecDescriptorImpl<LengthParams> {\n override readonly codecId = PG_BIT_CODEC_ID;\n override readonly traits = ['equality', 'order'] as const;\n override readonly targetTypes = ['bit'] as const;\n override readonly meta = PG_BIT_META;\n override readonly paramsSchema = lengthParamsSchema satisfies StandardSchemaV1<LengthParams>;\n override renderOutputType(params: LengthParams): string | undefined {\n return renderLength('Bit', params as Record<string, unknown>);\n }\n override factory(_params: LengthParams): (ctx: CodecInstanceContext) => PgBitCodec {\n return () => new PgBitCodec(this);\n }\n}\n\nexport const pgBitDescriptor = new PgBitDescriptor();\n\nexport const pgBitColumn = (params: LengthParams = {}) =>\n column(pgBitDescriptor.factory(params), pgBitDescriptor.codecId, params, 'bit');\n\npgBitColumn satisfies ColumnHelperFor<PgBitDescriptor>;\npgBitColumn satisfies ColumnHelperForStrict<PgBitDescriptor>;\n\nexport class PgVarbitCodec extends CodecImpl<\n typeof PG_VARBIT_CODEC_ID,\n readonly ['equality', 'order'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return value;\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return wire;\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\n }\n}\n\nexport class PgVarbitDescriptor extends CodecDescriptorImpl<LengthParams> {\n override readonly codecId = PG_VARBIT_CODEC_ID;\n override readonly traits = ['equality', 'order'] as const;\n override readonly targetTypes = ['bit varying'] as const;\n override readonly meta = PG_VARBIT_META;\n override readonly paramsSchema = lengthParamsSchema satisfies StandardSchemaV1<LengthParams>;\n override renderOutputType(params: LengthParams): string | undefined {\n return renderLength('VarBit', params as Record<string, unknown>);\n }\n override factory(_params: LengthParams): (ctx: CodecInstanceContext) => PgVarbitCodec {\n return () => new PgVarbitCodec(this);\n }\n}\n\nexport const pgVarbitDescriptor = new PgVarbitDescriptor();\n\nexport const pgVarbitColumn = (params: LengthParams = {}) =>\n column(pgVarbitDescriptor.factory(params), pgVarbitDescriptor.codecId, params, 'bit varying');\n\npgVarbitColumn satisfies ColumnHelperFor<PgVarbitDescriptor>;\npgVarbitColumn satisfies ColumnHelperForStrict<PgVarbitDescriptor>;\n\nexport class PgByteaCodec extends CodecImpl<\n typeof PG_BYTEA_CODEC_ID,\n readonly ['equality'],\n Uint8Array,\n Uint8Array\n> {\n async encode(value: Uint8Array, _ctx: CodecCallContext): Promise<Uint8Array> {\n return value;\n }\n async decode(wire: Uint8Array, _ctx: CodecCallContext): Promise<Uint8Array> {\n // Postgres node drivers commonly return Buffer instances (which extend Uint8Array) — normalize to a plain Uint8Array view so engine-agnostic consumers don't accidentally observe Buffer-specific APIs.\n return wire instanceof Uint8Array && wire.constructor === Uint8Array\n ? wire\n : new Uint8Array(wire.buffer, wire.byteOffset, wire.byteLength);\n }\n encodeJson(value: Uint8Array): JsonValue {\n return pgByteaEncodeJson(value);\n }\n decodeJson(json: JsonValue): Uint8Array {\n return pgByteaDecodeJson(json);\n }\n}\n\nexport class PgByteaDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = PG_BYTEA_CODEC_ID;\n override readonly traits = ['equality'] as const;\n override readonly targetTypes = ['bytea'] as const;\n override readonly meta = PG_BYTEA_META;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => PgByteaCodec {\n return () => new PgByteaCodec(this);\n }\n}\n\nexport const pgByteaDescriptor = new PgByteaDescriptor();\n\nexport const pgByteaColumn = () =>\n column(pgByteaDescriptor.factory(), pgByteaDescriptor.codecId, undefined, 'bytea');\n\npgByteaColumn satisfies ColumnHelperFor<PgByteaDescriptor>;\npgByteaColumn satisfies ColumnHelperForStrict<PgByteaDescriptor>;\n\nconst PG_UUID_META = { db: { sql: { postgres: { nativeType: 'uuid' } } } } as const;\n\nexport class PgUuidCodec extends CodecImpl<\n typeof PG_UUID_CODEC_ID,\n readonly ['equality', 'order'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return value;\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return wire;\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return blindCast<string, 'uuid columns serialize to JSON as their wire string form'>(json);\n }\n}\n\nexport class PgUuidDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = PG_UUID_CODEC_ID;\n override readonly traits = ['equality', 'order'] as const;\n override readonly targetTypes = ['uuid'] as const;\n override readonly meta = PG_UUID_META;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => PgUuidCodec {\n return () => new PgUuidCodec(this);\n }\n}\n\nexport const pgUuidDescriptor = new PgUuidDescriptor();\n\nexport const pgUuidColumn = () =>\n column(pgUuidDescriptor.factory(), pgUuidDescriptor.codecId, undefined, 'uuid');\n\npgUuidColumn satisfies ColumnHelperFor<PgUuidDescriptor>;\npgUuidColumn satisfies ColumnHelperForStrict<PgUuidDescriptor>;\n\nconst PG_INET_META = { db: { sql: { postgres: { nativeType: 'inet' } } } } as const;\n\nexport class PgInetCodec extends CodecImpl<\n typeof PG_INET_CODEC_ID,\n readonly ['equality', 'order'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return value;\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return wire;\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return blindCast<string, 'inet columns serialize to JSON as their wire string form'>(json);\n }\n}\n\nexport class PgInetDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = PG_INET_CODEC_ID;\n override readonly traits = ['equality', 'order'] as const;\n override readonly targetTypes = ['inet'] as const;\n override readonly meta = PG_INET_META;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => PgInetCodec {\n return () => new PgInetCodec(this);\n }\n}\n\nexport const pgInetDescriptor = new PgInetDescriptor();\n\nexport const pgInetColumn = () =>\n column(pgInetDescriptor.factory(), pgInetDescriptor.codecId, undefined, 'inet');\n\npgInetColumn satisfies ColumnHelperFor<PgInetDescriptor>;\npgInetColumn satisfies ColumnHelperForStrict<PgInetDescriptor>;\n\nexport class PgIntervalCodec extends CodecImpl<\n typeof PG_INTERVAL_CODEC_ID,\n readonly ['equality', 'order'],\n string | Record<string, unknown>,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return value;\n }\n async decode(wire: string | Record<string, unknown>, _ctx: CodecCallContext): Promise<string> {\n return pgIntervalDecode(wire);\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\n }\n}\n\nexport class PgIntervalDescriptor extends CodecDescriptorImpl<PrecisionParams> {\n override readonly codecId = PG_INTERVAL_CODEC_ID;\n override readonly traits = ['equality', 'order'] as const;\n override readonly targetTypes = ['interval'] as const;\n override readonly meta = PG_INTERVAL_META;\n override readonly paramsSchema =\n precisionParamsSchema satisfies StandardSchemaV1<PrecisionParams>;\n override renderOutputType(params: PrecisionParams): string | undefined {\n return renderPrecision('Interval', params as Record<string, unknown>);\n }\n override factory(_params: PrecisionParams): (ctx: CodecInstanceContext) => PgIntervalCodec {\n return () => new PgIntervalCodec(this);\n }\n}\n\nexport const pgIntervalDescriptor = new PgIntervalDescriptor();\n\nexport const pgIntervalColumn = (params: PrecisionParams = {}) =>\n column(pgIntervalDescriptor.factory(params), pgIntervalDescriptor.codecId, params, 'interval');\n\npgIntervalColumn satisfies ColumnHelperFor<PgIntervalDescriptor>;\npgIntervalColumn satisfies ColumnHelperForStrict<PgIntervalDescriptor>;\n\nexport class PgJsonCodec extends CodecImpl<\n typeof PG_JSON_CODEC_ID,\n readonly [],\n string | JsonValue,\n JsonValue\n> {\n async encode(value: JsonValue, _ctx: CodecCallContext): Promise<string> {\n return pgJsonEncode(value);\n }\n async decode(wire: string | JsonValue, _ctx: CodecCallContext): Promise<JsonValue> {\n return pgJsonDecode(wire);\n }\n encodeJson(value: JsonValue): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): JsonValue {\n return json;\n }\n}\n\nexport class PgJsonDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = PG_JSON_CODEC_ID;\n override readonly traits = [] as const;\n override readonly targetTypes = ['json'] as const;\n override readonly meta = PG_JSON_META;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => PgJsonCodec {\n return () => new PgJsonCodec(this);\n }\n}\n\nexport const pgJsonDescriptor = new PgJsonDescriptor();\n\nexport const pgJsonColumn = () =>\n column(pgJsonDescriptor.factory(), pgJsonDescriptor.codecId, undefined, 'json');\n\npgJsonColumn satisfies ColumnHelperFor<PgJsonDescriptor>;\npgJsonColumn satisfies ColumnHelperForStrict<PgJsonDescriptor>;\n\nexport class PgJsonbCodec extends CodecImpl<\n typeof PG_JSONB_CODEC_ID,\n readonly ['equality'],\n string | JsonValue,\n JsonValue\n> {\n async encode(value: JsonValue, _ctx: CodecCallContext): Promise<string> {\n return pgJsonbEncode(value);\n }\n async decode(wire: string | JsonValue, _ctx: CodecCallContext): Promise<JsonValue> {\n return pgJsonbDecode(wire);\n }\n encodeJson(value: JsonValue): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): JsonValue {\n return json;\n }\n}\n\nexport class PgJsonbDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = PG_JSONB_CODEC_ID;\n override readonly traits = ['equality'] as const;\n override readonly targetTypes = ['jsonb'] as const;\n override readonly meta = PG_JSONB_META;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => PgJsonbCodec {\n return () => new PgJsonbCodec(this);\n }\n}\n\nexport const pgJsonbDescriptor = new PgJsonbDescriptor();\n\nexport const pgJsonbColumn = () =>\n column(pgJsonbDescriptor.factory(), pgJsonbDescriptor.codecId, undefined, 'jsonb');\n\npgJsonbColumn satisfies ColumnHelperFor<PgJsonbDescriptor>;\npgJsonbColumn satisfies ColumnHelperForStrict<PgJsonbDescriptor>;\n\n// `meta`. The factories instantiate the SQL-base codec class (`SqlCharCodec` etc.) passing `this` (the pg-alias descriptor) so `codec.id` resolves to the pg-alias codec id via `CodecImpl`'s `descriptor.codecId` proxy. ---------------------------------------------------------------------------\n\nconst PG_CHAR_META = { db: { sql: { postgres: { nativeType: 'character' } } } } as const;\nconst PG_VARCHAR_META = {\n db: { sql: { postgres: { nativeType: 'character varying' } } },\n} as const;\nconst PG_INT_META = { db: { sql: { postgres: { nativeType: 'integer' } } } } as const;\nconst PG_FLOAT_META = { db: { sql: { postgres: { nativeType: 'double precision' } } } } as const;\n\nexport class PgCharDescriptor extends CodecDescriptorImpl<LengthParams> {\n override readonly codecId = PG_CHAR_CODEC_ID;\n override readonly targetTypes = ['character'] as const;\n override readonly meta = PG_CHAR_META;\n override readonly traits = sqlCharDescriptor.traits;\n override readonly paramsSchema = sqlCharDescriptor.paramsSchema;\n override renderOutputType(params: LengthParams): string | undefined {\n return sqlCharDescriptor.renderOutputType(params);\n }\n override renderValueLiteral(value: JsonValue): string | undefined {\n return renderTsLiteral(value);\n }\n override factory(_params: LengthParams): (ctx: CodecInstanceContext) => SqlCharCodec {\n return () => new SqlCharCodec(this);\n }\n}\n\nexport const pgCharDescriptor = new PgCharDescriptor();\n\nexport const pgCharColumn = (params: LengthParams = {}) =>\n column(pgCharDescriptor.factory(params), pgCharDescriptor.codecId, params, 'character');\n\npgCharColumn satisfies ColumnHelperFor<PgCharDescriptor>;\n\nexport class PgVarcharDescriptor extends CodecDescriptorImpl<LengthParams> {\n override readonly codecId = PG_VARCHAR_CODEC_ID;\n override readonly targetTypes = ['character varying'] as const;\n override readonly meta = PG_VARCHAR_META;\n override readonly traits = sqlVarcharDescriptor.traits;\n override readonly paramsSchema = sqlVarcharDescriptor.paramsSchema;\n override renderOutputType(params: LengthParams): string | undefined {\n return sqlVarcharDescriptor.renderOutputType(params);\n }\n override renderValueLiteral(value: JsonValue): string | undefined {\n return renderTsLiteral(value);\n }\n override factory(_params: LengthParams): (ctx: CodecInstanceContext) => SqlVarcharCodec {\n return () => new SqlVarcharCodec(this);\n }\n}\n\nexport const pgVarcharDescriptor = new PgVarcharDescriptor();\n\nexport const pgVarcharColumn = (params: LengthParams = {}) =>\n column(\n pgVarcharDescriptor.factory(params),\n pgVarcharDescriptor.codecId,\n params,\n 'character varying',\n );\n\npgVarcharColumn satisfies ColumnHelperFor<PgVarcharDescriptor>;\n\nexport class PgIntDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = PG_INT_CODEC_ID;\n override readonly targetTypes = ['int4'] as const;\n override readonly meta = PG_INT_META;\n override readonly traits = sqlIntDescriptor.traits;\n override readonly paramsSchema = sqlIntDescriptor.paramsSchema;\n override renderValueLiteral(value: JsonValue): string | undefined {\n return renderTsLiteral(value);\n }\n override factory(): (ctx: CodecInstanceContext) => SqlIntCodec {\n return () => new SqlIntCodec(this);\n }\n}\n\nexport const pgIntDescriptor = new PgIntDescriptor();\n\nexport const pgIntColumn = () =>\n column(pgIntDescriptor.factory(), pgIntDescriptor.codecId, undefined, 'int4');\n\npgIntColumn satisfies ColumnHelperFor<PgIntDescriptor>;\n\nexport class PgFloatDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = PG_FLOAT_CODEC_ID;\n override readonly targetTypes = ['float8'] as const;\n override readonly meta = PG_FLOAT_META;\n override readonly traits = sqlFloatDescriptor.traits;\n override readonly paramsSchema = sqlFloatDescriptor.paramsSchema;\n override renderValueLiteral(value: JsonValue): string | undefined {\n return renderTsLiteral(value);\n }\n override factory(): (ctx: CodecInstanceContext) => SqlFloatCodec {\n return () => new SqlFloatCodec(this);\n }\n}\n\nexport const pgFloatDescriptor = new PgFloatDescriptor();\n\nexport const pgFloatColumn = () =>\n column(pgFloatDescriptor.factory(), pgFloatDescriptor.codecId, undefined, 'float8');\n\npgFloatColumn satisfies ColumnHelperFor<PgFloatDescriptor>;\n\n// `ExtractCodecTypes` to derive `CodecTypes`. ---------------------------------------------------------------------------\n\nexport const codecDescriptors: readonly AnyCodecDescriptor[] = [\n sqlCharDescriptor,\n sqlVarcharDescriptor,\n sqlIntDescriptor,\n sqlFloatDescriptor,\n sqlTextDescriptor,\n sqlTimestampDescriptor,\n pgTextDescriptor,\n pgEnumDescriptor,\n pgCharDescriptor,\n pgVarcharDescriptor,\n pgIntDescriptor,\n pgFloatDescriptor,\n pgInt4Descriptor,\n pgInt2Descriptor,\n pgInt8Descriptor,\n pgFloat4Descriptor,\n pgFloat8Descriptor,\n pgNumericDescriptor,\n // PSL `Date` pins this codec by ID rather than activating a second target-type mapping.\n pgDateDescriptor,\n pgTimestampDescriptor,\n pgTimestamptzDescriptor,\n pgTimeDescriptor,\n pgTimetzDescriptor,\n pgBoolDescriptor,\n pgBitDescriptor,\n pgVarbitDescriptor,\n pgByteaDescriptor,\n pgUuidDescriptor,\n pgInetDescriptor,\n pgIntervalDescriptor,\n pgJsonDescriptor,\n pgJsonbDescriptor,\n pgTextArrayDescriptor,\n];\n"],"mappings":";;;;;;;;;;AAWA,SAAgB,aACd,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AA,GAAW,QAAQ;AAMpF,MAAa,mBAAkD;CAC7D;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
package/dist/codecs.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as pgCharColumn, B as pgIntColumn, C as PgTimestamptzDescriptor, D as PgVarcharDescriptor, E as PgVarbitDescriptor, F as pgFloatColumn, G as pgTextColumn, H as pgJsonColumn, I as pgInetColumn, J as pgTimestamptzColumn, K as pgTimeColumn, L as pgInt2Column, M as pgEnumDescriptor, N as pgFloat4Column, O as pgBitColumn, P as pgFloat8Column, Q as pgVarcharColumn, R as pgInt4Column, S as PgTimestampDescriptor, T as PgUuidDescriptor, U as pgJsonbColumn, V as pgIntervalColumn, W as pgNumericColumn, X as pgUuidColumn, Y as pgTimetzColumn, Z as pgVarbitColumn, _ as PgJsonDescriptor, a as PgDateDescriptor, b as PgTextDescriptor, c as PgFloat4Descriptor, d as PgInetDescriptor, f as PgInt2Descriptor, g as PgIntervalDescriptor, h as PgIntDescriptor, i as PgCharDescriptor, j as pgDateColumn, k as pgBoolColumn, l as PgFloat8Descriptor, m as PgInt8Descriptor, n as PgBoolDescriptor, o as PgEnumCodec, p as PgInt4Descriptor, q as pgTimestampColumn, s as PgEnumDescriptor, t as PgBitDescriptor, u as PgFloatDescriptor, v as PgJsonbDescriptor, w as PgTimetzDescriptor, x as PgTimeDescriptor, y as PgNumericDescriptor, z as pgInt8Column } from "./codecs-G4DTY0F_.mjs";
1
+ import { $ as pgVarbitColumn, A as pgBitColumn, B as pgInt4Column, C as PgTimestampDescriptor, D as PgVarbitDescriptor, E as PgUuidDescriptor, F as pgFloat4Column, G as pgJsonbColumn, H as pgIntColumn, I as pgFloat8Column, J as pgTimeColumn, K as pgNumericColumn, L as pgFloatColumn, M as pgCharColumn, N as pgDateColumn, O as PgVarcharDescriptor, P as pgEnumDescriptor, Q as pgUuidColumn, R as pgInetColumn, S as PgTimeDescriptor, T as PgTimetzDescriptor, U as pgIntervalColumn, V as pgInt8Column, W as pgJsonColumn, X as pgTimestamptzColumn, Y as pgTimestampColumn, Z as pgTimetzColumn, _ as PgIntervalDescriptor, a as PgDateDescriptor, b as PgNumericDescriptor, c as PgEnumParams, d as PgFloatDescriptor, et as pgVarcharColumn, f as PgInetDescriptor, g as PgIntDescriptor, h as PgInt8Descriptor, i as PgCharDescriptor, j as pgBoolColumn, k as isPgEnumParams, l as PgFloat4Descriptor, m as PgInt4Descriptor, n as PgBoolDescriptor, o as PgEnumCodec, p as PgInt2Descriptor, q as pgTextColumn, s as PgEnumDescriptor, t as PgBitDescriptor, u as PgFloat8Descriptor, v as PgJsonDescriptor, w as PgTimestamptzDescriptor, x as PgTextDescriptor, y as PgJsonbDescriptor, z as pgInt2Column } from "./codecs-CGE5dh94.mjs";
2
2
  import { CodecDescriptorRegistry } from "@prisma-next/sql-relational-core/query-lane-context";
3
3
  //#region src/core/registry.d.ts
4
4
  /**
@@ -8,5 +8,5 @@ import { CodecDescriptorRegistry } from "@prisma-next/sql-relational-core/query-
8
8
  */
9
9
  declare const postgresCodecRegistry: CodecDescriptorRegistry;
10
10
  //#endregion
11
- export { type PgBitDescriptor, type PgBoolDescriptor, type PgCharDescriptor, type PgDateDescriptor, type PgEnumCodec, type PgEnumDescriptor, type PgFloat4Descriptor, type PgFloat8Descriptor, type PgFloatDescriptor, type PgInetDescriptor, type PgInt2Descriptor, type PgInt4Descriptor, type PgInt8Descriptor, type PgIntDescriptor, type PgIntervalDescriptor, type PgJsonDescriptor, type PgJsonbDescriptor, type PgNumericDescriptor, type PgTextDescriptor, type PgTimeDescriptor, type PgTimestampDescriptor, type PgTimestamptzDescriptor, type PgTimetzDescriptor, type PgUuidDescriptor, type PgVarbitDescriptor, type PgVarcharDescriptor, pgBitColumn, pgBoolColumn, pgCharColumn, pgDateColumn, pgEnumDescriptor, pgFloat4Column, pgFloat8Column, pgFloatColumn, pgInetColumn, pgInt2Column, pgInt4Column, pgInt8Column, pgIntColumn, pgIntervalColumn, pgJsonColumn, pgJsonbColumn, pgNumericColumn, pgTextColumn, pgTimeColumn, pgTimestampColumn, pgTimestamptzColumn, pgTimetzColumn, pgUuidColumn, pgVarbitColumn, pgVarcharColumn, postgresCodecRegistry };
11
+ export { type PgBitDescriptor, type PgBoolDescriptor, type PgCharDescriptor, type PgDateDescriptor, type PgEnumCodec, type PgEnumDescriptor, type PgEnumParams, type PgFloat4Descriptor, type PgFloat8Descriptor, type PgFloatDescriptor, type PgInetDescriptor, type PgInt2Descriptor, type PgInt4Descriptor, type PgInt8Descriptor, type PgIntDescriptor, type PgIntervalDescriptor, type PgJsonDescriptor, type PgJsonbDescriptor, type PgNumericDescriptor, type PgTextDescriptor, type PgTimeDescriptor, type PgTimestampDescriptor, type PgTimestamptzDescriptor, type PgTimetzDescriptor, type PgUuidDescriptor, type PgVarbitDescriptor, type PgVarcharDescriptor, isPgEnumParams, pgBitColumn, pgBoolColumn, pgCharColumn, pgDateColumn, pgEnumDescriptor, pgFloat4Column, pgFloat8Column, pgFloatColumn, pgInetColumn, pgInt2Column, pgInt4Column, pgInt8Column, pgIntColumn, pgIntervalColumn, pgJsonColumn, pgJsonbColumn, pgNumericColumn, pgTextColumn, pgTimeColumn, pgTimestampColumn, pgTimestamptzColumn, pgTimetzColumn, pgUuidColumn, pgVarbitColumn, pgVarcharColumn, postgresCodecRegistry };
12
12
  //# sourceMappingURL=codecs.d.mts.map
package/dist/codecs.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { C as pgTimetzColumn, E as pgVarcharColumn, S as pgTimestamptzColumn, T as pgVarbitColumn, _ as pgJsonbColumn, a as pgDateColumn, b as pgTimeColumn, c as pgFloat8Column, d as pgInt2Column, f as pgInt4Column, g as pgJsonColumn, h as pgIntervalColumn, i as pgCharColumn, l as pgFloatColumn, m as pgIntColumn, n as pgBitColumn, o as pgEnumDescriptor, p as pgInt8Column, r as pgBoolColumn, s as pgFloat4Column, t as codecDescriptors, u as pgInetColumn, v as pgNumericColumn, w as pgUuidColumn, x as pgTimestampColumn, y as pgTextColumn } from "./codecs-TCsGgW-Y.mjs";
1
+ import { C as pgTimestamptzColumn, D as pgVarcharColumn, E as pgVarbitColumn, S as pgTimestampColumn, T as pgUuidColumn, _ as pgJsonColumn, a as pgCharColumn, b as pgTextColumn, c as pgFloat4Column, d as pgInetColumn, f as pgInt2Column, g as pgIntervalColumn, h as pgIntColumn, i as pgBoolColumn, l as pgFloat8Column, m as pgInt8Column, n as isPgEnumParams, o as pgDateColumn, p as pgInt4Column, r as pgBitColumn, s as pgEnumDescriptor, t as codecDescriptors, u as pgFloatColumn, v as pgJsonbColumn, w as pgTimetzColumn, x as pgTimeColumn, y as pgNumericColumn } from "./codecs-Deand7sy.mjs";
2
2
  import { buildCodecDescriptorRegistry } from "@prisma-next/sql-relational-core/codec-descriptor-registry";
3
3
  //#region src/core/registry.ts
4
4
  /**
@@ -8,6 +8,6 @@ import { buildCodecDescriptorRegistry } from "@prisma-next/sql-relational-core/c
8
8
  */
9
9
  const postgresCodecRegistry = buildCodecDescriptorRegistry(codecDescriptors);
10
10
  //#endregion
11
- export { pgBitColumn, pgBoolColumn, pgCharColumn, pgDateColumn, pgEnumDescriptor, pgFloat4Column, pgFloat8Column, pgFloatColumn, pgInetColumn, pgInt2Column, pgInt4Column, pgInt8Column, pgIntColumn, pgIntervalColumn, pgJsonColumn, pgJsonbColumn, pgNumericColumn, pgTextColumn, pgTimeColumn, pgTimestampColumn, pgTimestamptzColumn, pgTimetzColumn, pgUuidColumn, pgVarbitColumn, pgVarcharColumn, postgresCodecRegistry };
11
+ export { isPgEnumParams, pgBitColumn, pgBoolColumn, pgCharColumn, pgDateColumn, pgEnumDescriptor, pgFloat4Column, pgFloat8Column, pgFloatColumn, pgInetColumn, pgInt2Column, pgInt4Column, pgInt8Column, pgIntColumn, pgIntervalColumn, pgJsonColumn, pgJsonbColumn, pgNumericColumn, pgTextColumn, pgTimeColumn, pgTimestampColumn, pgTimestamptzColumn, pgTimetzColumn, pgUuidColumn, pgVarbitColumn, pgVarcharColumn, postgresCodecRegistry };
12
12
 
13
13
  //# sourceMappingURL=codecs.mjs.map
@@ -1,4 +1,4 @@
1
- import { a as DropDefaultAction, l as PostgresCreateSchema, r as AnyAlterTableAction, s as PostgresAlterTable, t as AddColumnAction, u as PostgresCreateTable } from "./nodes-CQzM2hR0.mjs";
1
+ import { f as PostgresCreateSchema, l as PostgresAlterTable, o as DropDefaultAction, p as PostgresCreateTable, r as AnyAlterTableAction, t as AddColumnAction } from "./nodes-DjCsN-uv.mjs";
2
2
  import { t as PostgresTableSource } from "./table-source-D5c2fxAQ.mjs";
3
3
  import { DdlColumn, DdlNode, DdlTableConstraint, SelectAst } from "@prisma-next/sql-relational-core/ast";
4
4
  import { CfExpr, ColumnDescriptor, ColumnSchema, TableHandle } from "@prisma-next/sql-relational-core/contract-free";
@@ -1 +1 @@
1
- {"version":3,"file":"contract-free.d.mts","names":[],"sources":["../src/contract-free/checks.ts","../src/contract-free/columns.ts","../src/contract-free/control-bootstrap.ts","../src/contract-free/ddl.ts"],"mappings":";;;;;;;;;;iBAiBgB,WAAW,wBAAwB;UASlC;EACf,eAAe;EACf,gBAAgB;;;;;;;;;;;iBAYF,eAAe,gBAAgB,gBAAgB;UAW9C;EACf,qBAAqB;EACrB,oBAAoB;;;;;;;;;;;;;;;;iBAiBN,oBAAoB;WACzB;WACA;WACA;IACP;UAuDa;EACf,iBAAiB;EACjB,gBAAgB;;;;;;;iBAQF,gBAAgB;WACrB;WACA;WACA;IACP;;;;;iBAYY,qBAAqB;WAC1B;WACA;WACA;WACA;IACP;UAUa;EACf,kBAAkB;EAClB,iBAAiB;EACjB,aAAa;;;;;;;;iBASC,iBAAiB;WACtB;WACA;WACA;IACP;;;;;;iBAuBY,cAAc;WACnB;WACA;WACA;WACA;IACP;UAiCa;EACf,aAAa;EACb,YAAY;;;;;;;iBAQE,mBAAmB;WACxB;WACA;WACA;IACP;;;;;;iBAyCY,gBAAgB,gBAAgB,gBAAgB;;;;;iBAYhD,gBAAgB;WACrB;WACA;WACA;IACP;UAQa;EACf,oBAAoB;EACpB,mBAAmB;;;;;;iBAOL,mBAAmB,wBAAwB;UAY1C;EACf,iBAAiB;EACjB,gBAAgB;;;;;;;;iBASF,mBAAmB;WACxB;WACA;WACA;IACP;UAkBa;EACf,cAAc;EACd,eAAe;;;;;;;iBAQD,cAAc,gBAAgB,gBAAgB;UA8B7C;EACf,gBAAgB;EAChB,eAAe;;;;;;iBAOD,eAAe,gBAAgB,oBAAoB;;;KC7Z9D;WAAqB;;cAOb,OAAQ,OAAO,YAAU;cACzB,OAAQ,OAAO,YAAU;cACzB,OAAQ,OAAO,YAAU;cACzB,QAAS,OAAO,YAAU;cAC1B,YAAa,OAAO,YAAU;cAC9B,cAAe,OAAO,YAAU;;;;;;;;;;;;;iBAe7B,QAAQ,eAAe,cACrC;WAAmB;WAAuB;WAA0B;GACpE,SAAS,SACR,YAAY;;;iBCmBC,4CAA4C;iBAI5C,8CAA8C;;;;;;;;;;;;;;;;;iBCtC9C,YAAY;WACjB;WACA;WACA;WACA,kBAAkB;WAClB,uBAAuB;IAC9B;;;;;iBAQY,aAAa;WAClB;WACA;IACP;;;;;;iBAkCY,gBAAgB,QAAQ,YAAY;;;;;iBAQpC,kBAAkB,qBAAqB;;;;;iBAQvC,WAAW;WAChB;WACA;WACA,kBAAkB;IACzB"}
1
+ {"version":3,"file":"contract-free.d.mts","names":[],"sources":["../src/contract-free/checks.ts","../src/contract-free/columns.ts","../src/contract-free/control-bootstrap.ts","../src/contract-free/ddl.ts"],"mappings":";;;;;;;;;;iBAiBgB,WAAW,wBAAwB;UASlC;EACf,eAAe;EACf,gBAAgB;;;;;;;;;;;iBAYF,eAAe,gBAAgB,gBAAgB;UAW9C;EACf,qBAAqB;EACrB,oBAAoB;;;;;;;;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AW;WAChB;WACA;WACA,kBAAkB;IACzB"}
@@ -1,6 +1,6 @@
1
1
  import { b as PG_TEXT_CODEC_ID, f as PG_INT4_CODEC_ID, g as PG_JSONB_CODEC_ID, p as PG_INT8_CODEC_ID, x as PG_TIMESTAMPTZ_CODEC_ID, y as PG_TEXT_ARRAY_CODEC_ID } from "./codec-ids-D3G8K0YM.mjs";
2
- import { l as PostgresTableSource } from "./postgres-schema-CewLYHB7.mjs";
3
- import { C as rlsPolicyExistsAst, D as toRegclass, E as tablePrimaryKeyAst, S as rlsEnabledAst, T as tableIsEmptyAst, _ as extensionExistsAst, a as createSchema, f as columnDefaultAst, g as constraintExistsAst, h as columnTypeAst, l as dropDefaultAction, m as columnNullabilityAst, o as createTable, p as columnExistsAst, r as alterTable, t as addColumnAction, v as indexExistsAst, w as tableExistsAst, x as noNullValuesAst } from "./ddl-DHXKzQ99.mjs";
2
+ import { l as PostgresTableSource } from "./postgres-schema-CTplQZDK.mjs";
3
+ import { A as toRegclass, D as tableExistsAst, E as rlsPolicyExistsAst, O as tableIsEmptyAst, T as rlsEnabledAst, _ as columnNullabilityAst, b as extensionExistsAst, c as createTable, d as dropDefaultAction, g as columnExistsAst, h as columnDefaultAst, i as alterTable, k as tablePrimaryKeyAst, s as createSchema, t as addColumnAction, v as columnTypeAst, w as noNullValuesAst, x as indexExistsAst, y as constraintExistsAst } from "./ddl-BQC6u-L9.mjs";
4
4
  import { col, fn, lit, table } from "@prisma-next/sql-relational-core/contract-free";
5
5
  import { APP_SPACE_ID } from "@prisma-next/framework-components/control";
6
6
  //#region src/contract-free/columns.ts
@@ -1,11 +1,11 @@
1
- import { r as isPostgresSchema } from "./postgres-schema-CewLYHB7.mjs";
2
- import { i as quoteIdentifier } from "./sql-utils-SU4FDvIV.mjs";
1
+ import { r as isPostgresSchema } from "./postgres-schema-CTplQZDK.mjs";
2
+ import { r as quoteIdentifier } from "./sql-utils-B2lzkKfP.mjs";
3
3
  import { n as PostgresNativeEnumSchemaNode, o as postgresNodeEntityKind, r as PostgresSchemaNodeKind, t as PostgresTableSchemaNode } from "./postgres-table-schema-node-D6LvInCe.mjs";
4
- import { A as SetDefaultCall, C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, M as postgresDefaultToDdlColumnDefault, N as buildTargetDetails, O as RawSqlCall, S as DropIndexCall, _ as DisableRowLevelSecurityCall, a as AddNotNullColumnDirectCall, b as DropConstraintCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, g as DataTransformCall, h as CreateTableCall, i as AddNativeEnumValueCall, j as SetNotNullCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, o as AddNotNullColumnWithTempDefaultCall, r as AddForeignKeyCall, s as AddPrimaryKeyCall, t as AddCheckConstraintCall, v as DropCheckConstraintCall, w as DropNotNullCall, x as DropDefaultCall, y as DropColumnCall } from "./op-factory-call-DuRj7WXX.mjs";
5
- import { t as buildExpectedFormatType } from "./planner-sql-checks-BuB877wH.mjs";
6
- import { n as buildColumnTypeSql, t as buildColumnDefaultSql } from "./planner-ddl-builders-BKlmGDJl.mjs";
4
+ import { C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, M as SetNotNullCall, N as postgresDefaultToDdlColumnDefault, O as RawSqlCall, P as buildTargetDetails, S as DropIndexCall, _ as DisableRowLevelSecurityCall, a as AddNotNullColumnDirectCall, b as DropConstraintCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, g as DataTransformCall, h as CreateTableCall, i as AddNativeEnumValueCall, j as SetDefaultCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, o as AddNotNullColumnWithTempDefaultCall, r as AddForeignKeyCall, s as AddPrimaryKeyCall, t as AddCheckConstraintCall, v as DropCheckConstraintCall, w as DropNotNullCall, x as DropDefaultCall, y as DropColumnCall } from "./op-factory-call-CIaPDDUc.mjs";
5
+ import { t as buildExpectedFormatType } from "./planner-sql-checks-CmiQ6Nei.mjs";
6
+ import { n as buildColumnTypeSql, t as buildColumnDefaultSql } from "./planner-ddl-builders-CVo3L7Nd.mjs";
7
7
  import { n as resolveIdentityValue } from "./planner-identity-values-CJPha2Sz.mjs";
8
- import { i as hasUniqueConstraint, n as hasForeignKey, t as buildSchemaLookupMap } from "./planner-schema-lookup-CiVaAQP-.mjs";
8
+ import { i as hasUniqueConstraint, n as hasForeignKey, t as buildSchemaLookupMap } from "./planner-schema-lookup-D3Y_OL-C.mjs";
9
9
  import { UNBOUND_NAMESPACE_ID, entityAt } from "@prisma-next/framework-components/ir";
10
10
  import { blindCast } from "@prisma-next/utils/casts";
11
11
  import { StorageTable } from "@prisma-next/sql-contract/types";
@@ -14,8 +14,8 @@ import { ifDefined } from "@prisma-next/utils/defined";
14
14
  import * as contractFree from "@prisma-next/sql-relational-core/contract-free";
15
15
  import { RelationalSchemaNodeKind, SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
16
16
  import { issueOutcome, orderIssuesByDependencies } from "@prisma-next/framework-components/control";
17
- import { defaultIndexName } from "@prisma-next/sql-schema-ir/naming";
18
17
  import { notOk, ok } from "@prisma-next/utils/result";
18
+ import { InternalError } from "@prisma-next/utils/internal-error";
19
19
  //#region src/core/schema-ir/node-storage-coordinate.ts
20
20
  /**
21
21
  * The storage-`entries` coordinate `(entityKind, entityName)` a Postgres diff
@@ -55,7 +55,7 @@ function postgresNodeStorageCoordinate(node) {
55
55
  * false `typeRef` hit against an unrelated storage type.
56
56
  */
57
57
  function columnLike(column) {
58
- if (column.codecRef === void 0 || column.codecBaseNativeType === void 0) throw new Error(`columnLike: expected column "${column.name}" carries no codec identity — the expected tree must be derived via contractToSchemaIR for planning`);
58
+ if (column.codecRef === void 0 || column.codecBaseNativeType === void 0) throw new InternalError(`columnLike: expected column "${column.name}" carries no codec identity — the expected tree must be derived via contractToSchemaIR for planning`);
59
59
  return {
60
60
  nativeType: column.codecBaseNativeType,
61
61
  codecId: column.codecRef.codecId,
@@ -598,7 +598,8 @@ function classifyCall(call) {
598
598
  case "setDefault": return "alter";
599
599
  case "addPrimaryKey": return "primaryKey";
600
600
  case "addUnique": return "unique";
601
- case "createIndex": return "index";
601
+ case "createIndex":
602
+ case "renameIndex": return "index";
602
603
  case "addForeignKey": return "foreignKey";
603
604
  case "rawSql":
604
605
  if (call.op?.target?.details?.objectType === "type") return "dep";
@@ -623,6 +624,7 @@ function conflictKindForCall(call) {
623
624
  case "addForeignKey":
624
625
  case "dropConstraint": return "foreignKeyConflict";
625
626
  case "createIndex":
627
+ case "renameIndex":
626
628
  case "dropIndex": return "indexIncompatible";
627
629
  default: return "missingButNonAdditive";
628
630
  }
@@ -639,6 +641,7 @@ function locationForCall(call) {
639
641
  }
640
642
  if (anyCall.columnName) location.column = anyCall.columnName;
641
643
  if (anyCall.indexName) location.index = anyCall.indexName;
644
+ else if (anyCall.newIndexName) location.index = anyCall.newIndexName;
642
645
  if (anyCall.constraintName) location.constraint = anyCall.constraintName;
643
646
  return Object.keys(location).length > 0 ? location : void 0;
644
647
  }
@@ -749,13 +752,7 @@ function buildCreateTableCallsFromNode(schemaName, ddlSchemaName, table, codecHo
749
752
  const elementNonNullChecks = Object.values(table.columns).filter((c) => isManyColumn(c)).map((c) => contractFree.checkExpression(elementNonNullCheckName(table.name, c.name), elementNonNullCheckExpression(c.name)));
750
753
  const allTableConstraints = [...primaryKeyConstraints, ...elementNonNullChecks];
751
754
  const calls = [new CreateTableCall(schemaName, table.name, ddlColumns, allTableConstraints.length > 0 ? allTableConstraints : void 0)];
752
- for (const index of table.indexes) {
753
- const indexName = index.name ?? defaultIndexName(table.name, index.columns);
754
- const extras = {};
755
- if (index.type !== void 0) extras.type = index.type;
756
- if (index.options !== void 0) extras.options = index.options;
757
- calls.push(new CreateIndexCall(schemaName, table.name, indexName, [...index.columns], extras));
758
- }
755
+ for (const index of table.indexes) calls.push(createIndexCallFromNode(index, schemaName, table.name));
759
756
  for (const fk of table.foreignKeys) calls.push(new AddForeignKeyCall(schemaName, table.name, fkSpecFromNode(fk, table.name)));
760
757
  for (const unique of table.uniques) {
761
758
  const constraintName = unique.name ?? `${table.name}_${unique.columns.join("_")}_key`;
@@ -877,19 +874,22 @@ function mapUniqueNodeIssue(issue, schemaName, tableName) {
877
874
  }
878
875
  return notOk(nodeConflict("indexIncompatible", issue.path.join("/")));
879
876
  }
877
+ /**
878
+ * The CreateIndexCall for a name-identified index node: the node's own name
879
+ * verbatim, its element list (column tuple or opaque expression), and the
880
+ * unique/type/options/where attributes carried through.
881
+ */
882
+ function createIndexCallFromNode(index, schemaName, tableName) {
883
+ const extras = {};
884
+ if (index.type !== void 0) extras.type = index.type;
885
+ if (index.options !== void 0) extras.options = index.options;
886
+ if (index.where !== void 0) extras.where = index.where;
887
+ if (index.unique) extras.unique = true;
888
+ return new CreateIndexCall(schemaName, tableName, index.name, index.columns !== void 0 ? { columns: [...index.columns] } : { expression: index.expression ?? "" }, extras);
889
+ }
880
890
  function mapIndexNodeIssue(issue, schemaName, tableName) {
881
- if (issueOutcome(issue) === "not-found") {
882
- const index = blindCast(issue.expected);
883
- const indexName = index.name ?? defaultIndexName(tableName, index.columns);
884
- const extras = {};
885
- if (index.type !== void 0) extras.type = index.type;
886
- if (index.options !== void 0) extras.options = index.options;
887
- return ok([new CreateIndexCall(schemaName, tableName, indexName, [...index.columns], extras)]);
888
- }
889
- if (issueOutcome(issue) === "not-expected") {
890
- const index = blindCast(issue.actual);
891
- return ok([new DropIndexCall(schemaName, tableName, index.name ?? defaultIndexName(tableName, index.columns))]);
892
- }
891
+ if (issueOutcome(issue) === "not-found") return ok([createIndexCallFromNode(blindCast(issue.expected), schemaName, tableName)]);
892
+ if (issueOutcome(issue) === "not-expected") return ok([new DropIndexCall(schemaName, tableName, blindCast(issue.actual).name)]);
893
893
  return notOk(nodeConflict("indexIncompatible", issue.path.join("/")));
894
894
  }
895
895
  function mapCheckNodeIssue(issue, schemaName, tableName) {
@@ -1251,4 +1251,4 @@ function resolvePostgresNodeIssueControlPolicySubject(issue, contract) {
1251
1251
  //#endregion
1252
1252
  export { resolvePostgresNodeIssueCreationFactoryName as a, issueSchemaName as c, postgresNodeStorageCoordinate as d, resolvePostgresNodeIssueControlPolicySubject as i, planIssues as l, resolveNamespaceIdForDdlSchema as n, coalesceSubtreeIssues as o, resolvePostgresCallControlPolicySubject as r, issueNode as s, renderPostgresSuppression as t, postgresPlannerStrategies as u };
1253
1253
 
1254
- //# sourceMappingURL=control-policy-CZKdMztu.mjs.map
1254
+ //# sourceMappingURL=control-policy-DEwdS3oK.mjs.map