@prisma-next/target-postgres 0.13.0-dev.3 → 0.13.0-dev.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{codec-ids-CTikp1if.mjs → codec-ids-BvytN2P8.mjs} +3 -3
- package/dist/codec-ids-BvytN2P8.mjs.map +1 -0
- package/dist/{codec-ids-B1vOchLE.d.mts → codec-ids-CnXu9Qy3.d.mts} +3 -3
- package/dist/codec-ids-CnXu9Qy3.d.mts.map +1 -0
- package/dist/codec-ids.d.mts +2 -2
- package/dist/codec-ids.mjs +2 -2
- package/dist/{codec-types-CnFiNML4.d.mts → codec-types-DHCkwPKE.d.mts} +3 -3
- package/dist/{codec-types-CnFiNML4.d.mts.map → codec-types-DHCkwPKE.d.mts.map} +1 -1
- package/dist/codec-types.d.mts +1 -1
- package/dist/{codecs-CBpEv4s5.d.mts → codecs--0A5_4Bq.d.mts} +26 -23
- package/dist/codecs--0A5_4Bq.d.mts.map +1 -0
- package/dist/codecs.d.mts +2 -2
- package/dist/codecs.mjs +28 -35
- package/dist/codecs.mjs.map +1 -1
- package/dist/contract-free.d.mts +17 -2
- package/dist/contract-free.d.mts.map +1 -1
- package/dist/contract-free.mjs +3 -3
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +21 -27
- package/dist/control.mjs.map +1 -1
- package/dist/{data-transform-D25tLeYU.mjs → data-transform-BOWpliq8.mjs} +9 -17
- package/dist/data-transform-BOWpliq8.mjs.map +1 -0
- package/dist/{data-transform-DGOqcLrf.d.mts → data-transform-DDgWdB5o.d.mts} +2 -2
- package/dist/data-transform-DDgWdB5o.d.mts.map +1 -0
- package/dist/data-transform.d.mts +1 -1
- package/dist/data-transform.mjs +1 -1
- package/dist/{ddl-77SyXgFt.mjs → ddl-DY2R_Yqz.mjs} +18 -3
- package/dist/ddl-DY2R_Yqz.mjs.map +1 -0
- package/dist/ddl.d.mts +2 -2
- package/dist/ddl.mjs +2 -2
- package/dist/{descriptor-meta-DKmj-IMN.mjs → descriptor-meta-BKma_hQ5.mjs} +2 -2
- package/dist/{descriptor-meta-DKmj-IMN.mjs.map → descriptor-meta-BKma_hQ5.mjs.map} +1 -1
- package/dist/descriptor-meta-runtime-e5f2tscJ.mjs +131 -0
- package/dist/descriptor-meta-runtime-e5f2tscJ.mjs.map +1 -0
- package/dist/{issue-planner-Br0pt1Ea.mjs → issue-planner-DsjB7xDj.mjs} +48 -252
- package/dist/issue-planner-DsjB7xDj.mjs.map +1 -0
- package/dist/issue-planner.d.mts +8 -11
- package/dist/issue-planner.d.mts.map +1 -1
- package/dist/issue-planner.mjs +1 -1
- package/dist/migration.d.mts +4 -15
- package/dist/migration.d.mts.map +1 -1
- package/dist/migration.mjs +4 -4
- package/dist/{nodes-DZk2JZG3.mjs → nodes-Bbhs2rwj.mjs} +31 -2
- package/dist/nodes-Bbhs2rwj.mjs.map +1 -0
- package/dist/{nodes-779hmCfL.d.mts → nodes-pLeLgdis.d.mts} +30 -3
- package/dist/nodes-pLeLgdis.d.mts.map +1 -0
- package/dist/{op-factory-call-DMA86_2D.d.mts → op-factory-call-CdtMyrlU.d.mts} +12 -56
- package/dist/op-factory-call-CdtMyrlU.d.mts.map +1 -0
- package/dist/{op-factory-call-D2aAUhmS.mjs → op-factory-call-CjR846f7.mjs} +70 -198
- package/dist/op-factory-call-CjR846f7.mjs.map +1 -0
- package/dist/op-factory-call.d.mts +2 -2
- package/dist/op-factory-call.mjs +2 -2
- package/dist/pack.d.mts +36 -15
- package/dist/pack.d.mts.map +1 -1
- package/dist/pack.mjs +1 -1
- package/dist/{planner-CAYPJObw.mjs → planner-_FOL4I21.mjs} +25 -45
- package/dist/planner-_FOL4I21.mjs.map +1 -0
- package/dist/{planner-ddl-builders-Cw2n2llW.mjs → planner-ddl-builders-B2wOwLqI.mjs} +2 -2
- package/dist/planner-ddl-builders-B2wOwLqI.mjs.map +1 -0
- package/dist/planner-ddl-builders.d.mts +4 -4
- package/dist/planner-ddl-builders.d.mts.map +1 -1
- package/dist/planner-ddl-builders.mjs +1 -1
- package/dist/{planner-identity-values-BIpa5p2I.mjs → planner-identity-values-CJPha2Sz.mjs} +3 -9
- package/dist/planner-identity-values-CJPha2Sz.mjs.map +1 -0
- package/dist/planner-identity-values.d.mts +1 -1
- package/dist/planner-identity-values.d.mts.map +1 -1
- package/dist/planner-identity-values.mjs +1 -1
- package/dist/{planner-produced-postgres-migration-NSEhWL0L.mjs → planner-produced-postgres-migration-BmCpyWLJ.mjs} +6 -4
- package/dist/planner-produced-postgres-migration-BmCpyWLJ.mjs.map +1 -0
- package/dist/{planner-produced-postgres-migration-B4EDvLdz.d.mts → planner-produced-postgres-migration-wLhnJMMA.d.mts} +5 -6
- package/dist/planner-produced-postgres-migration-wLhnJMMA.d.mts.map +1 -0
- package/dist/planner-produced-postgres-migration.d.mts +1 -1
- package/dist/planner-produced-postgres-migration.mjs +1 -1
- package/dist/{planner-sql-checks-DAdhnI2c.mjs → planner-sql-checks-CJJtPfDH.mjs} +3 -3
- package/dist/planner-sql-checks-CJJtPfDH.mjs.map +1 -0
- package/dist/planner-sql-checks.d.mts +2 -2
- package/dist/planner-sql-checks.d.mts.map +1 -1
- package/dist/planner-sql-checks.mjs +1 -1
- package/dist/{planner-type-resolution-836DExFN.mjs → planner-type-resolution-Bt2f_q-F.mjs} +1 -6
- package/dist/planner-type-resolution-Bt2f_q-F.mjs.map +1 -0
- package/dist/planner.d.mts +4 -4
- package/dist/planner.d.mts.map +1 -1
- package/dist/planner.mjs +1 -1
- package/dist/{postgres-contract-serializer-DYTyXjPf.mjs → postgres-contract-serializer-CyAe8ZFv.mjs} +27 -37
- package/dist/postgres-contract-serializer-CyAe8ZFv.mjs.map +1 -0
- package/dist/{postgres-migration-DZ_gLUOW.d.mts → postgres-migration-DLXL0GBf.d.mts} +10 -5
- package/dist/postgres-migration-DLXL0GBf.d.mts.map +1 -0
- package/dist/{postgres-migration-COore9Mz.mjs → postgres-migration-dG-J0aI8.mjs} +7 -3
- package/dist/postgres-migration-dG-J0aI8.mjs.map +1 -0
- package/dist/{postgres-schema-BuxCxbvB.mjs → postgres-schema-CTKYiTHu.mjs} +30 -13
- package/dist/postgres-schema-CTKYiTHu.mjs.map +1 -0
- package/dist/{render-ops-BpjstrKQ.mjs → render-ops-BREh1kHe.mjs} +10 -5
- package/dist/render-ops-BREh1kHe.mjs.map +1 -0
- package/dist/render-ops.d.mts +2 -2
- package/dist/render-ops.d.mts.map +1 -1
- package/dist/render-ops.mjs +1 -1
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +2 -2
- package/dist/{shared-DarONYBZ.d.mts → shared-jcsbXxiW.d.mts} +2 -20
- package/dist/shared-jcsbXxiW.d.mts.map +1 -0
- package/dist/types.d.mts +8 -13
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +2 -3
- package/package.json +17 -18
- package/src/contract-free/ddl.ts +28 -1
- package/src/core/authoring.ts +43 -44
- package/src/core/codec-helpers.ts +0 -17
- package/src/core/codec-ids.ts +1 -1
- package/src/core/codec-type-map.ts +2 -2
- package/src/core/codecs.ts +43 -48
- package/src/core/ddl/nodes.ts +59 -1
- package/src/core/migrations/control-policy.ts +17 -47
- package/src/core/migrations/issue-planner.ts +34 -70
- package/src/core/migrations/op-factory-call.ts +89 -142
- package/src/core/migrations/operations/data-transform.ts +15 -18
- package/src/core/migrations/planner-ddl-builders.ts +3 -4
- package/src/core/migrations/planner-identity-values.ts +4 -28
- package/src/core/migrations/planner-produced-postgres-migration.ts +15 -7
- package/src/core/migrations/planner-recipes.ts +2 -6
- package/src/core/migrations/planner-sql-checks.ts +2 -6
- package/src/core/migrations/planner-strategies.ts +51 -376
- package/src/core/migrations/planner-type-resolution.ts +2 -20
- package/src/core/migrations/planner.ts +6 -6
- package/src/core/migrations/postgres-migration.ts +19 -4
- package/src/core/migrations/render-ops.ts +26 -13
- package/src/core/migrations/runner.ts +26 -20
- package/src/core/postgres-contract-serializer.ts +32 -54
- package/src/core/postgres-enum-type-schema.ts +17 -0
- package/src/core/postgres-schema.ts +56 -34
- package/src/exports/codecs.ts +2 -2
- package/src/exports/contract-free.ts +1 -1
- package/src/exports/control.ts +0 -22
- package/src/exports/ddl.ts +4 -0
- package/src/exports/migration.ts +0 -7
- package/src/exports/op-factory-call.ts +0 -4
- package/src/exports/types.ts +0 -1
- package/dist/codec-ids-B1vOchLE.d.mts.map +0 -1
- package/dist/codec-ids-CTikp1if.mjs.map +0 -1
- package/dist/codecs-CBpEv4s5.d.mts.map +0 -1
- package/dist/data-transform-D25tLeYU.mjs.map +0 -1
- package/dist/data-transform-DGOqcLrf.d.mts.map +0 -1
- package/dist/ddl-77SyXgFt.mjs.map +0 -1
- package/dist/descriptor-meta-runtime-My8_s4cs.mjs +0 -130
- package/dist/descriptor-meta-runtime-My8_s4cs.mjs.map +0 -1
- package/dist/enum-planning-BCyvlFHk.mjs +0 -0
- package/dist/enum-planning-BCyvlFHk.mjs.map +0 -1
- package/dist/enum-planning.d.mts +0 -86
- package/dist/enum-planning.d.mts.map +0 -1
- package/dist/enum-planning.mjs +0 -2
- package/dist/issue-planner-Br0pt1Ea.mjs.map +0 -1
- package/dist/nodes-779hmCfL.d.mts.map +0 -1
- package/dist/nodes-DZk2JZG3.mjs.map +0 -1
- package/dist/op-factory-call-D2aAUhmS.mjs.map +0 -1
- package/dist/op-factory-call-DMA86_2D.d.mts.map +0 -1
- package/dist/planner-CAYPJObw.mjs.map +0 -1
- package/dist/planner-ddl-builders-Cw2n2llW.mjs.map +0 -1
- package/dist/planner-identity-values-BIpa5p2I.mjs.map +0 -1
- package/dist/planner-produced-postgres-migration-B4EDvLdz.d.mts.map +0 -1
- package/dist/planner-produced-postgres-migration-NSEhWL0L.mjs.map +0 -1
- package/dist/planner-sql-checks-DAdhnI2c.mjs.map +0 -1
- package/dist/planner-type-resolution-836DExFN.mjs.map +0 -1
- package/dist/postgres-contract-serializer-DYTyXjPf.mjs.map +0 -1
- package/dist/postgres-enum-type-BVn63a89.d.mts +0 -72
- package/dist/postgres-enum-type-BVn63a89.d.mts.map +0 -1
- package/dist/postgres-enum-type-DPKqCBem.mjs +0 -62
- package/dist/postgres-enum-type-DPKqCBem.mjs.map +0 -1
- package/dist/postgres-migration-COore9Mz.mjs.map +0 -1
- package/dist/postgres-migration-DZ_gLUOW.d.mts.map +0 -1
- package/dist/postgres-schema-BuxCxbvB.mjs.map +0 -1
- package/dist/render-ops-BpjstrKQ.mjs.map +0 -1
- package/dist/shared-DarONYBZ.d.mts.map +0 -1
- package/src/core/migrations/enum-planning.ts +0 -213
- package/src/core/migrations/operations/enums.ts +0 -114
- package/src/core/postgres-enum-type.ts +0 -89
- package/src/exports/enum-planning.ts +0 -11
package/dist/codecs.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codecs.mjs","names":["arktype"],"sources":["../src/core/codec-helpers.ts","../src/core/codecs.ts","../src/core/registry.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';\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 new Error(\n `renderOutputType: expected integer \"length\" in typeParams for ${typeName}, got ${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 new Error(\n `renderOutputType: expected integer \"precision\" in typeParams for ${typeName}, got ${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 new Error(\n `renderOutputType: expected integer \"precision\" in typeParams for Numeric, got ${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 new Error(\n `renderOutputType: expected integer \"scale\" in typeParams for Numeric, got ${String(scale)}`,\n );\n }\n return `Numeric<${precision}, ${scale}>`;\n};\n\n// ISO 8601 UTC: `YYYY-MM-DDTHH:MM:SS[.mmm…]Z`. Trailing `Z` is required; fractional seconds are optional. Other `Date`-parseable formats (`January 15, 2024`, `01/15/2024`, etc.) are intentionally rejected because those formats are implementation-defined and not the documented contract for `pg/timestamp@1` / `pg/timestamptz@1`.\nconst ISO_8601_UTC = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?Z$/;\n\nexport const pgTimestampEncodeJson = (value: Date): JsonValue => value.toISOString();\nexport const pgTimestampDecodeJson = (json: JsonValue): Date => {\n if (typeof json !== 'string') {\n throw new Error(`Expected ISO date string for pg/timestamp@1, got ${typeof json}`);\n }\n if (!ISO_8601_UTC.test(json)) {\n throw new Error(`Invalid ISO date string for pg/timestamp@1: ${json}`);\n }\n const date = new Date(json);\n if (Number.isNaN(date.getTime())) {\n throw new Error(`Invalid ISO date string for pg/timestamp@1: ${json}`);\n }\n return date;\n};\n\nexport const pgTimestamptzEncodeJson = (value: Date): JsonValue => value.toISOString();\nexport const pgTimestamptzDecodeJson = (json: JsonValue): Date => {\n if (typeof json !== 'string') {\n throw new Error(`Expected ISO date string for pg/timestamptz@1, got ${typeof json}`);\n }\n if (!ISO_8601_UTC.test(json)) {\n throw new Error(`Invalid ISO date string for pg/timestamptz@1: ${json}`);\n }\n const date = new Date(json);\n if (Number.isNaN(date.getTime())) {\n throw new Error(`Invalid ISO date string for pg/timestamptz@1: ${json}`);\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 pgEnumRenderOutputType = (typeParams: {\n readonly values?: readonly unknown[];\n}): string => {\n const values = typeParams.values;\n if (!Array.isArray(values)) {\n throw new Error(\n `renderOutputType: expected array \"values\" in typeParams for enum, got ${typeof values}`,\n );\n }\n if (!values.every((v): v is string => typeof v === 'string')) {\n throw new Error(`renderOutputType: expected string[] \"values\" in typeParams for enum`);\n }\n return values\n .map((value) => `'${value.replace(/\\\\/g, '\\\\\\\\').replace(/'/g, \"\\\\'\")}'`)\n .join(' | ');\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 {@link 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 ColumnHelperFor,\n type ColumnHelperForStrict,\n column,\n voidParamsSchema,\n} from '@prisma-next/framework-components/codec';\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 type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { type as arktype } from 'arktype';\nimport {\n pgEnumRenderOutputType,\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_ENUM_CODEC_ID,\n PG_FLOAT_CODEC_ID,\n PG_FLOAT4_CODEC_ID,\n PG_FLOAT8_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_VARBIT_CODEC_ID,\n PG_VARCHAR_CODEC_ID,\n} from './codec-ids';\n\ntype LengthParams = { readonly length?: number };\ntype PrecisionParams = { readonly precision?: number };\ntype NumericParams = { readonly precision: number; readonly scale?: number };\ntype EnumParams = { readonly values?: readonly string[] };\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_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 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 * 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 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 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 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 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 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 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 return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\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\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 Buffer.from(value).toString('base64');\n }\n decodeJson(json: JsonValue): Uint8Array {\n if (typeof json !== 'string') {\n throw new Error(`Expected base64 string for pg/bytea@1, got ${typeof json}`);\n }\n const decoded = Buffer.from(json, 'base64');\n if (decoded.toString('base64') !== json) {\n throw new Error(`Invalid base64 string for pg/bytea@1 (length: ${json.length})`);\n }\n return new Uint8Array(decoded);\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\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\nconst enumParamsSchema = arktype({\n 'values?': 'string[]',\n});\n\nexport class PgEnumCodec extends CodecImpl<\n typeof PG_ENUM_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 PgEnumDescriptor extends CodecDescriptorImpl<EnumParams> {\n override readonly codecId = PG_ENUM_CODEC_ID;\n override readonly traits = ['equality', 'order'] as const;\n override readonly targetTypes = ['enum'] as const;\n override readonly paramsSchema = enumParamsSchema satisfies StandardSchemaV1<EnumParams>;\n override renderOutputType(params: EnumParams): string | undefined {\n return pgEnumRenderOutputType(params);\n }\n override factory(_params: EnumParams): (ctx: CodecInstanceContext) => PgEnumCodec {\n return () => new PgEnumCodec(this);\n }\n}\n\nexport const pgEnumDescriptor = new PgEnumDescriptor();\n\nexport const pgEnumColumn = (params: EnumParams = {}) =>\n column(pgEnumDescriptor.factory(params), pgEnumDescriptor.codecId, params, 'enum');\n\npgEnumColumn satisfies ColumnHelperFor<PgEnumDescriptor>;\npgEnumColumn satisfies ColumnHelperForStrict<PgEnumDescriptor>;\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 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 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 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 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 pgCharDescriptor,\n pgVarcharDescriptor,\n pgIntDescriptor,\n pgFloatDescriptor,\n pgInt4Descriptor,\n pgInt2Descriptor,\n pgInt8Descriptor,\n pgFloat4Descriptor,\n pgFloat8Descriptor,\n pgNumericDescriptor,\n pgTimestampDescriptor,\n pgTimestamptzDescriptor,\n pgTimeDescriptor,\n pgTimetzDescriptor,\n pgBoolDescriptor,\n pgBitDescriptor,\n pgVarbitDescriptor,\n pgByteaDescriptor,\n pgIntervalDescriptor,\n pgEnumDescriptor,\n pgJsonDescriptor,\n pgJsonbDescriptor,\n pgTextArrayDescriptor,\n];\n","import { buildCodecDescriptorRegistry } from '@prisma-next/sql-relational-core/codec-descriptor-registry';\nimport type { CodecDescriptorRegistry } from '@prisma-next/sql-relational-core/query-lane-context';\nimport { codecDescriptors } from './codecs';\n\n/**\n * Registry of every codec descriptor shipped by `@prisma-next/target-postgres`.\n *\n * Public consumer surface for the postgres codec set: the postgres adapter and any other consumer that needs to enumerate or look up a postgres codec by id consumes this rather than the raw descriptor array. See ADR 208.\n */\nexport const postgresCodecRegistry: CodecDescriptorRegistry =\n buildCodecDescriptorRegistry(codecDescriptors);\n"],"mappings":";;;;;;AAUA,SAAgB,aACd,UACA,YACoB;CACpB,MAAM,SAAS,WAAW;CAC1B,IAAI,WAAW,KAAA,GACb;CAEF,IAAI,OAAO,WAAW,YAAY,CAAC,OAAO,SAAS,MAAM,KAAK,CAAC,OAAO,UAAU,MAAM,GACpF,MAAM,IAAI,MACR,iEAAiE,SAAS,QAAQ,OAAO,MAAM,GACjG;CAEF,OAAO,GAAG,SAAS,GAAG,OAAO;AAC/B;AAEA,SAAgB,gBAAgB,UAAkB,YAA6C;CAC7F,MAAM,YAAY,WAAW;CAC7B,IAAI,cAAc,KAAA,GAChB,OAAO;CAET,IACE,OAAO,cAAc,YACrB,CAAC,OAAO,SAAS,SAAS,KAC1B,CAAC,OAAO,UAAU,SAAS,GAE3B,MAAM,IAAI,MACR,oEAAoE,SAAS,QAAQ,OAAO,SAAS,GACvG;CAEF,OAAO,GAAG,SAAS,GAAG,UAAU;AAClC;AAEA,MAAa,mBAAmB,SAAkC;CAChE,IAAI,OAAO,SAAS,UAAU,OAAO,OAAO,IAAI;CAChD,OAAO;AACT;AAEA,MAAa,6BAA6B,eAGhB;CACxB,MAAM,YAAY,WAAW;CAC7B,IAAI,cAAc,KAAA,GAAW,OAAO,KAAA;CACpC,IACE,OAAO,cAAc,YACrB,CAAC,OAAO,SAAS,SAAS,KAC1B,CAAC,OAAO,UAAU,SAAS,GAE3B,MAAM,IAAI,MACR,iFAAiF,OAAO,SAAS,GACnG;CAEF,MAAM,QAA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gB,IAAI;CACvC;AACF;AAEA,MAAa,sBAAsB,IAAI,oBAAoB;AAE3D,MAAa,mBAAmB,SAAuB,CAAC,MACtD,OACE,oBAAoB,QAAQ,MAAM,GAClC,oBAAoB,SACpB,QACA,mBACF;AAIF,IAAa,kBAAb,cAAqC,oBAA0B;CAC7D,UAA4B;CAC5B,cAAgC,CAAC,MAAM;CACvC,OAAyB;CACzB,SAA2B,iBAAiB;CAC5C,eAAiC,iBAAiB;CAClD,UAA+D;EAC7D,aAAa,IAAI,YAAY,IAAI;CACnC;AACF;AAEA,MAAa,kBAAkB,IAAI,gBAAgB;AAEnD,MAAa,oBACX,OAAO,gBAAgB,QAAQ,GAAG,gBAAgB,SAAS,KAAA,GAAW,MAAM;AAI9E,IAAa,oBAAb,cAAuC,oBAA0B;CAC/D,UAA4B;CAC5B,cAAgC,CAAC,QAAQ;CACzC,OAAyB;CACzB,SAA2B,mBAAmB;CAC9C,eAAiC,mBAAmB;CACpD,UAAiE;EAC/D,aAAa,IAAI,cAAc,IAAI;CACrC;AACF;AAEA,MAAa,oBAAoB,IAAI,kBAAkB;AAEvD,MAAa,sBACX,OAAO,kBAAkB,QAAQ,GAAG,kBAAkB,SAAS,KAAA,GAAW,QAAQ;;;;;;;;AC5gCpF,MAAa,wBACX,6BAA6B;CDkhC7B;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;CACA;CACA;CACA;AC/iC6B,CAAgB"}
|
|
1
|
+
{"version":3,"file":"codecs.mjs","names":["arktype"],"sources":["../src/core/codec-helpers.ts","../src/core/codecs.ts","../src/core/registry.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';\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 new Error(\n `renderOutputType: expected integer \"length\" in typeParams for ${typeName}, got ${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 new Error(\n `renderOutputType: expected integer \"precision\" in typeParams for ${typeName}, got ${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 new Error(\n `renderOutputType: expected integer \"precision\" in typeParams for Numeric, got ${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 new Error(\n `renderOutputType: expected integer \"scale\" in typeParams for Numeric, got ${String(scale)}`,\n );\n }\n return `Numeric<${precision}, ${scale}>`;\n};\n\n// ISO 8601 UTC: `YYYY-MM-DDTHH:MM:SS[.mmm…]Z`. Trailing `Z` is required; fractional seconds are optional. Other `Date`-parseable formats (`January 15, 2024`, `01/15/2024`, etc.) are intentionally rejected because those formats are implementation-defined and not the documented contract for `pg/timestamp@1` / `pg/timestamptz@1`.\nconst ISO_8601_UTC = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?Z$/;\n\nexport const pgTimestampEncodeJson = (value: Date): JsonValue => value.toISOString();\nexport const pgTimestampDecodeJson = (json: JsonValue): Date => {\n if (typeof json !== 'string') {\n throw new Error(`Expected ISO date string for pg/timestamp@1, got ${typeof json}`);\n }\n if (!ISO_8601_UTC.test(json)) {\n throw new Error(`Invalid ISO date string for pg/timestamp@1: ${json}`);\n }\n const date = new Date(json);\n if (Number.isNaN(date.getTime())) {\n throw new Error(`Invalid ISO date string for pg/timestamp@1: ${json}`);\n }\n return date;\n};\n\nexport const pgTimestamptzEncodeJson = (value: Date): JsonValue => value.toISOString();\nexport const pgTimestamptzDecodeJson = (json: JsonValue): Date => {\n if (typeof json !== 'string') {\n throw new Error(`Expected ISO date string for pg/timestamptz@1, got ${typeof json}`);\n }\n if (!ISO_8601_UTC.test(json)) {\n throw new Error(`Invalid ISO date string for pg/timestamptz@1: ${json}`);\n }\n const date = new Date(json);\n if (Number.isNaN(date.getTime())) {\n throw new Error(`Invalid ISO date string for pg/timestamptz@1: ${json}`);\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 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 {@link 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 ColumnHelperFor,\n type ColumnHelperForStrict,\n column,\n voidParamsSchema,\n} from '@prisma-next/framework-components/codec';\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 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_FLOAT_CODEC_ID,\n PG_FLOAT4_CODEC_ID,\n PG_FLOAT8_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';\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_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 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 * 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 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 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 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 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 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 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 return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\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\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 Buffer.from(value).toString('base64');\n }\n decodeJson(json: JsonValue): Uint8Array {\n if (typeof json !== 'string') {\n throw new Error(`Expected base64 string for pg/bytea@1, got ${typeof json}`);\n }\n const decoded = Buffer.from(json, 'base64');\n if (decoded.toString('base64') !== json) {\n throw new Error(`Invalid base64 string for pg/bytea@1 (length: ${json.length})`);\n }\n return new Uint8Array(decoded);\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\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 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 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 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 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 pgCharDescriptor,\n pgVarcharDescriptor,\n pgIntDescriptor,\n pgFloatDescriptor,\n pgInt4Descriptor,\n pgInt2Descriptor,\n pgInt8Descriptor,\n pgFloat4Descriptor,\n pgFloat8Descriptor,\n pgNumericDescriptor,\n pgTimestampDescriptor,\n pgTimestamptzDescriptor,\n pgTimeDescriptor,\n pgTimetzDescriptor,\n pgBoolDescriptor,\n pgBitDescriptor,\n pgVarbitDescriptor,\n pgByteaDescriptor,\n pgUuidDescriptor,\n pgIntervalDescriptor,\n pgJsonDescriptor,\n pgJsonbDescriptor,\n pgTextArrayDescriptor,\n];\n","import { buildCodecDescriptorRegistry } from '@prisma-next/sql-relational-core/codec-descriptor-registry';\nimport type { CodecDescriptorRegistry } from '@prisma-next/sql-relational-core/query-lane-context';\nimport { codecDescriptors } from './codecs';\n\n/**\n * Registry of every codec descriptor shipped by `@prisma-next/target-postgres`.\n *\n * Public consumer surface for the postgres codec set: the postgres adapter and any other consumer that needs to enumerate or look up a postgres codec by id consumes this rather than the raw descriptor array. See ADR 208.\n */\nexport const postgresCodecRegistry: CodecDescriptorRegistry =\n buildCodecDescriptorRegistry(codecDescriptors);\n"],"mappings":";;;;;;;AAUA,SAAgB,aACd,UACA,YACoB;CACpB,MAAM,SAAS,WAAW;CAC1B,IAAI,WAAW,KAAA,GACb;CAEF,IAAI,OAAO,WAAW,YAAY,CAAC,OAAO,SAAS,MAAM,KAAK,CAAC,OAAO,UAAU,MAAM,GACpF,MAAM,IAAI,MACR,iEAAiE,SAAS,QAAQ,OAAO,MAAM,GACjG;CAEF,OAAO,GAAG,SAAS,GAAG,OAAO;AAC/B;AAEA,SAAgB,gBAAgB,UAAkB,YAA6C;CAC7F,MAAM,YAAY,WAAW;CAC7B,IAAI,cAAc,KAAA,GAChB,OAAO;CAET,IACE,OAAO,cAAc,YACrB,CAAC,OAAO,SAAS,SAAS,KAC1B,CAAC,OAAO,UAAU,SAAS,GAE3B,MAAM,IAAI,MACR,oEAAoE,SAAS,QAAQ,OAAO,SAAS,GACvG;CAEF,OAAO,GAAG,SAAS,GAAG,UAAU;AAClC;AAEA,MAAa,mBAAmB,SAAkC;CAChE,IAAI,OAAO,SAAS,UAAU,OAAO,OAAO,IAAI;CAChD,OAAO;AACT;AAEA,MAAa,6BAA6B,eAGhB;CACxB,MAAM,YAAY,WAAW;CAC7B,IAAI,cAAc,KAAA,GAAW,OAAO,KAAA;CACpC,IACE,OAAO,cAAc,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;CACzB,SAA2B,iBAAiB;CAC5C,eAAiC,iBAAiB;CAClD,UAA+D;EAC7D,aAAa,IAAI,YAAY,IAAI;CACnC;AACF;AAEA,MAAa,kBAAkB,IAAI,gBAAgB;AAEnD,MAAa,oBACX,OAAO,gBAAgB,QAAQ,GAAG,gBAAgB,SAAS,KAAA,GAAW,MAAM;AAI9E,IAAa,oBAAb,cAAuC,oBAA0B;CAC/D,UAA4B;CAC5B,cAAgC,CAAC,QAAQ;CACzC,OAAyB;CACzB,SAA2B,mBAAmB;CAC9C,eAAiC,mBAAmB;CACpD,UAAiE;EAC/D,aAAa,IAAI,cAAc,IAAI;CACrC;AACF;AAEA,MAAa,oBAAoB,IAAI,kBAAkB;AAEvD,MAAa,sBACX,OAAO,kBAAkB,QAAQ,GAAG,kBAAkB,SAAS,KAAA,GAAW,QAAQ;;;;;;;;ACvgCpF,MAAa,wBACX,6BAA6B;CD6gC7B;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;CACA;CACA;CACA;AC1iC6B,CAAgB"}
|
package/dist/contract-free.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as PostgresAlterTable, o as PostgresCreateSchema, r as AnyAlterTableAction, s as PostgresCreateTable, t as AddColumnAction } from "./nodes-pLeLgdis.mjs";
|
|
2
2
|
import { AnyFromSource, AstRewriter, DdlColumn, DdlNode, DdlTableConstraint, TableSource } from "@prisma-next/sql-relational-core/ast";
|
|
3
3
|
import { ColumnDescriptor, ColumnSchema, TableHandle } from "@prisma-next/sql-relational-core/contract-free";
|
|
4
4
|
|
|
@@ -64,6 +64,21 @@ declare function createSchema(options: {
|
|
|
64
64
|
readonly schema: string;
|
|
65
65
|
readonly ifNotExists?: boolean;
|
|
66
66
|
}): PostgresCreateSchema;
|
|
67
|
+
/**
|
|
68
|
+
* Build an `ADD COLUMN` action for use inside {@link alterTable}.
|
|
69
|
+
* The column is a structured `DdlColumn` so codec-encoded defaults flow
|
|
70
|
+
* through the adapter's `pgRenderDdlColumn` → `pgRenderDdlColumnDefault` path.
|
|
71
|
+
*/
|
|
72
|
+
declare function addColumnAction(column: DdlColumn): AddColumnAction;
|
|
73
|
+
/**
|
|
74
|
+
* Build a Postgres `ALTER TABLE` query node carrying one or more actions.
|
|
75
|
+
* See {@link addColumnAction} for building actions.
|
|
76
|
+
*/
|
|
77
|
+
declare function alterTable(options: {
|
|
78
|
+
readonly table: string;
|
|
79
|
+
readonly schema?: string;
|
|
80
|
+
readonly actions: readonly AnyAlterTableAction[];
|
|
81
|
+
}): PostgresAlterTable;
|
|
67
82
|
//#endregion
|
|
68
83
|
//#region src/core/ast/table-source.d.ts
|
|
69
84
|
declare class PostgresTableSource extends TableSource {
|
|
@@ -76,5 +91,5 @@ declare class PostgresTableSource extends TableSource {
|
|
|
76
91
|
rewrite(rewriter: AstRewriter): AnyFromSource;
|
|
77
92
|
}
|
|
78
93
|
//#endregion
|
|
79
|
-
export { PostgresTableSource, buildControlTableBootstrapQueries, buildSignMarkerBootstrapQueries, createSchema, createTable, int4, int8, jsonb, pgTable, text, textArray, timestamptz };
|
|
94
|
+
export { PostgresTableSource, addColumnAction, alterTable, buildControlTableBootstrapQueries, buildSignMarkerBootstrapQueries, createSchema, createTable, int4, int8, jsonb, pgTable, text, textArray, timestamptz };
|
|
80
95
|
//# sourceMappingURL=contract-free.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-free.d.mts","names":[],"sources":["../src/contract-free/columns.ts","../src/contract-free/control-bootstrap.ts","../src/contract-free/ddl.ts","../src/core/ast/table-source.ts"],"mappings":";;;;;KAgBK,OAAA;EAAA,SAAqB,QAAQ;AAAA;AAAA,cAOrB,IAAA,GAAQ,IAAA,GAAO,OAAA,KAAU,gBAAgD;AAAA,cACzE,IAAA,GAAQ,IAAA,GAAO,OAAA,KAAU,gBAAgD;AAAA,cACzE,IAAA,GAAQ,IAAA,GAAO,OAAA,KAAU,gBAAgD;AAAA,cACzE,KAAA,GAAS,IAAA,GAAO,OAAA,KAAU,gBAAiD;AAAA,cAC3E,SAAA,GAAa,IAAA,GAAO,OAAA,KAAU,gBAAsD;AAAA,cACpF,WAAA,GAAe,IAAA,GAAO,OAAA,KAAU,gBACR;AANrC;;;;;;;;AAAsF;AACtF;;;AADA,iBAoBgB,OAAA,gBAAuB,YAAA,EACrC,MAAA;EAAA,SAAmB,IAAA;EAAA,SAAuB,MAAA;EAAA,SAA0B,KAAA;AAAA,GACpE,OAAA,EAAS,MAAA,GACR,WAAA,CAAY,MAAA;;;iBCEC,+BAAA,aAA4C,OAAO;AAAA,iBAInD,iCAAA,aAA8C,OAAO;;;;;;AD/Cb;;;;AAWtB;AAOlC;;;;;;
|
|
1
|
+
{"version":3,"file":"contract-free.d.mts","names":[],"sources":["../src/contract-free/columns.ts","../src/contract-free/control-bootstrap.ts","../src/contract-free/ddl.ts","../src/core/ast/table-source.ts"],"mappings":";;;;;KAgBK,OAAA;EAAA,SAAqB,QAAQ;AAAA;AAAA,cAOrB,IAAA,GAAQ,IAAA,GAAO,OAAA,KAAU,gBAAgD;AAAA,cACzE,IAAA,GAAQ,IAAA,GAAO,OAAA,KAAU,gBAAgD;AAAA,cACzE,IAAA,GAAQ,IAAA,GAAO,OAAA,KAAU,gBAAgD;AAAA,cACzE,KAAA,GAAS,IAAA,GAAO,OAAA,KAAU,gBAAiD;AAAA,cAC3E,SAAA,GAAa,IAAA,GAAO,OAAA,KAAU,gBAAsD;AAAA,cACpF,WAAA,GAAe,IAAA,GAAO,OAAA,KAAU,gBACR;AANrC;;;;;;;;AAAsF;AACtF;;;AADA,iBAoBgB,OAAA,gBAAuB,YAAA,EACrC,MAAA;EAAA,SAAmB,IAAA;EAAA,SAAuB,MAAA;EAAA,SAA0B,KAAA;AAAA,GACpE,OAAA,EAAS,MAAA,GACR,WAAA,CAAY,MAAA;;;iBCEC,+BAAA,aAA4C,OAAO;AAAA,iBAInD,iCAAA,aAA8C,OAAO;;;;;;AD/Cb;;;;AAWtB;AAOlC;;;;;;iBEAgB,WAAA,CAAY,OAAA;EAAA,SACjB,KAAA;EAAA,SACA,MAAA;EAAA,SACA,WAAA;EAAA,SACA,OAAA,WAAkB,SAAA;EAAA,SAClB,WAAA,YAAuB,kBAAA;AAAA,IAC9B,mBAAA;;;;;iBAQY,YAAA,CAAa,OAAA;EAAA,SAClB,MAAA;EAAA,SACA,WAAA;AAAA,IACP,oBAAoB;;;;;;iBASR,eAAA,CAAgB,MAAA,EAAQ,SAAA,GAAY,eAAe;AFvBnE;;;;AAAA,iBE+BgB,UAAA,CAAW,OAAA;EAAA,SAChB,KAAA;EAAA,SACA,MAAA;EAAA,SACA,OAAA,WAAkB,mBAAA;AAAA,IACzB,kBAAkB;;;cCvDT,mBAAA,SAA4B,WAAA;EAAA,SAC9B,MAAA;cAEG,OAAA;IAAA,SACD,IAAA;IAAA,SACA,MAAA;IAAA,SACA,KAAA;EAAA;EAOF,OAAA,CAAQ,QAAA,EAAU,WAAA,GAAc,aAAA;AAAA"}
|
package/dist/contract-free.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import {
|
|
1
|
+
import { _ as PG_TEXT_CODEC_ID, g as PG_TEXT_ARRAY_CODEC_ID, l as PG_INT4_CODEC_ID, p as PG_JSONB_CODEC_ID, u as PG_INT8_CODEC_ID, v as PG_TIMESTAMPTZ_CODEC_ID } from "./codec-ids-BvytN2P8.mjs";
|
|
2
|
+
import { i as createTable, n as alterTable, r as createSchema, t as addColumnAction } from "./ddl-DY2R_Yqz.mjs";
|
|
3
3
|
import { TableSource } from "@prisma-next/sql-relational-core/ast";
|
|
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";
|
|
@@ -112,6 +112,6 @@ function buildControlTableBootstrapQueries() {
|
|
|
112
112
|
];
|
|
113
113
|
}
|
|
114
114
|
//#endregion
|
|
115
|
-
export { PostgresTableSource, buildControlTableBootstrapQueries, buildSignMarkerBootstrapQueries, createSchema, createTable, int4, int8, jsonb, pgTable, text, textArray, timestamptz };
|
|
115
|
+
export { PostgresTableSource, addColumnAction, alterTable, buildControlTableBootstrapQueries, buildSignMarkerBootstrapQueries, createSchema, createTable, int4, int8, jsonb, pgTable, text, textArray, timestamptz };
|
|
116
116
|
|
|
117
117
|
//# sourceMappingURL=contract-free.mjs.map
|
package/dist/control.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/exports/control.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/exports/control.ts"],"mappings":";;;;;;iBAuCgB,qBAAA,CAAsB,GAAA,EAAK,aAAA,EAAe,MAAA,EAAQ,aAAa;AAAA,cAOzE,wBAAA,EAA0B,0BAA0B,aAAa,yBAAA"}
|
package/dist/control.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-
|
|
2
|
-
import { r as enumStorageCompoundKey, s as resolveDdlSchemaForNamespaceStorage, t as createResolveExistingEnumValues } from "./enum-planning-BCyvlFHk.mjs";
|
|
1
|
+
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-BKma_hQ5.mjs";
|
|
3
2
|
import { t as parsePostgresDefault } from "./default-normalizer-DyyCHQWs.mjs";
|
|
4
3
|
import { t as normalizeSchemaNativeType } from "./native-type-normalizer-Bc9XJzWC.mjs";
|
|
5
|
-
import { t as createPostgresMigrationPlanner } from "./planner-
|
|
6
|
-
import { a as renderDefaultLiteral } from "./planner-ddl-builders-
|
|
7
|
-
import { t as PostgresContractSerializer } from "./postgres-contract-serializer-
|
|
4
|
+
import { t as createPostgresMigrationPlanner } from "./planner-_FOL4I21.mjs";
|
|
5
|
+
import { a as renderDefaultLiteral } from "./planner-ddl-builders-B2wOwLqI.mjs";
|
|
6
|
+
import { t as PostgresContractSerializer } from "./postgres-contract-serializer-CyAe8ZFv.mjs";
|
|
7
|
+
import { blindCast } from "@prisma-next/utils/casts";
|
|
8
8
|
import { contractToSchemaIR, extractCodecControlHooks, runnerFailure, runnerSuccess } from "@prisma-next/family-sql/control";
|
|
9
9
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
10
|
-
import { UNBOUND_NAMESPACE_ID } from "@prisma-next/framework-components/ir";
|
|
11
10
|
import { verifySqlSchema } from "@prisma-next/family-sql/schema-verify";
|
|
11
|
+
import { UNBOUND_NAMESPACE_ID } from "@prisma-next/framework-components/ir";
|
|
12
12
|
import { notOk, ok, okVoid } from "@prisma-next/utils/result";
|
|
13
13
|
import { APP_SPACE_ID } from "@prisma-next/framework-components/control";
|
|
14
14
|
import { SqlQueryError } from "@prisma-next/sql-errors";
|
|
@@ -46,9 +46,10 @@ var PostgresMigrationRunner = class {
|
|
|
46
46
|
if (options.space !== void 0 && options.space !== options.plan.spaceId) throw new Error(`SqlMigrationRunner: options.space (${options.space}) does not match plan.spaceId (${options.plan.spaceId})`);
|
|
47
47
|
const space = options.plan.spaceId;
|
|
48
48
|
const lockKey = `${LOCK_DOMAIN}:${schema}:${space}`;
|
|
49
|
+
const planOps = blindCast(await Promise.all(options.plan.operations));
|
|
49
50
|
const destinationCheck = this.ensurePlanMatchesDestinationContract(options.plan.destination, options.destinationContract);
|
|
50
51
|
if (!destinationCheck.ok) return destinationCheck;
|
|
51
|
-
const policyCheck = this.enforcePolicyCompatibility(options.policy,
|
|
52
|
+
const policyCheck = this.enforcePolicyCompatibility(options.policy, planOps);
|
|
52
53
|
if (!policyCheck.ok) return policyCheck;
|
|
53
54
|
await this.acquireLock(driver, lockKey);
|
|
54
55
|
const ensureResult = await this.ensureControlTables(driver, options.destinationContract);
|
|
@@ -68,7 +69,7 @@ var PostgresMigrationRunner = class {
|
|
|
68
69
|
executedOperations: []
|
|
69
70
|
};
|
|
70
71
|
else {
|
|
71
|
-
const applyResult = await this.applyPlan(driver, options);
|
|
72
|
+
const applyResult = await this.applyPlan(driver, options, planOps);
|
|
72
73
|
if (!applyResult.ok) return applyResult;
|
|
73
74
|
applyValue = applyResult.value;
|
|
74
75
|
}
|
|
@@ -85,8 +86,7 @@ var PostgresMigrationRunner = class {
|
|
|
85
86
|
typeMetadataRegistry: this.family.typeMetadataRegistry,
|
|
86
87
|
frameworkComponents: options.frameworkComponents,
|
|
87
88
|
normalizeDefault: parsePostgresDefault,
|
|
88
|
-
normalizeNativeType: normalizeSchemaNativeType
|
|
89
|
-
resolveExistingEnumValues: createResolveExistingEnumValues(options.destinationContract.storage)
|
|
89
|
+
normalizeNativeType: normalizeSchemaNativeType
|
|
90
90
|
});
|
|
91
91
|
if (!schemaVerifyResult.ok) return runnerFailure("SCHEMA_VERIFY_FAILED", schemaVerifyResult.summary, {
|
|
92
92
|
why: "The resulting database schema does not satisfy the destination contract.",
|
|
@@ -99,10 +99,10 @@ var PostgresMigrationRunner = class {
|
|
|
99
99
|
if (!(isSelfEdge && applyValue.operationsExecuted === 0 && incomingIsSubsetOfExisting)) {
|
|
100
100
|
const markerResult = await this.upsertMarker(driver, options, existingMarker, space);
|
|
101
101
|
if (!markerResult.ok) return markerResult;
|
|
102
|
-
await this.recordLedgerEntries(driver, options, applyValue.executedOperations);
|
|
102
|
+
await this.recordLedgerEntries(driver, options, applyValue.executedOperations, planOps.length);
|
|
103
103
|
}
|
|
104
104
|
return runnerSuccess({
|
|
105
|
-
operationsPlanned:
|
|
105
|
+
operationsPlanned: planOps.length,
|
|
106
106
|
operationsExecuted: applyValue.operationsExecuted
|
|
107
107
|
});
|
|
108
108
|
}
|
|
@@ -137,14 +137,14 @@ var PostgresMigrationRunner = class {
|
|
|
137
137
|
if (!committed) await this.rollbackTransaction(driver);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
async applyPlan(driver, options) {
|
|
140
|
+
async applyPlan(driver, options, ops) {
|
|
141
141
|
const checks = options.executionChecks;
|
|
142
142
|
const runPrechecks = checks?.prechecks !== false;
|
|
143
143
|
const runPostchecks = checks?.postchecks !== false;
|
|
144
144
|
const runIdempotency = checks?.idempotencyChecks !== false;
|
|
145
145
|
let operationsExecuted = 0;
|
|
146
146
|
const executedOperations = [];
|
|
147
|
-
for (const operation of
|
|
147
|
+
for (const operation of ops) {
|
|
148
148
|
options.callbacks?.onOperationStart?.(operation);
|
|
149
149
|
try {
|
|
150
150
|
if (runPostchecks && runIdempotency) {
|
|
@@ -178,10 +178,10 @@ var PostgresMigrationRunner = class {
|
|
|
178
178
|
const lowererContext = { contract };
|
|
179
179
|
const [schemaQuery, ...tableQueries] = this.family.bootstrapControlTableQueries();
|
|
180
180
|
if (schemaQuery === void 0) throw new Error("Postgres control-table bootstrap must include CREATE SCHEMA");
|
|
181
|
-
await this.executeStatement(driver, this.family.lowerAst(schemaQuery, lowererContext));
|
|
181
|
+
await this.executeStatement(driver, await this.family.lowerAst(schemaQuery, lowererContext));
|
|
182
182
|
const legacyDetection = await this.detectLegacyMarkerShape(driver);
|
|
183
183
|
if (!legacyDetection.ok) return legacyDetection;
|
|
184
|
-
for (const query of tableQueries) await this.executeStatement(driver, this.family.lowerAst(query, lowererContext));
|
|
184
|
+
for (const query of tableQueries) await this.executeStatement(driver, await this.family.lowerAst(query, lowererContext));
|
|
185
185
|
return okVoid();
|
|
186
186
|
}
|
|
187
187
|
async detectLegacyMarkerShape(driver) {
|
|
@@ -343,12 +343,11 @@ var PostgresMigrationRunner = class {
|
|
|
343
343
|
} });
|
|
344
344
|
return okVoid();
|
|
345
345
|
}
|
|
346
|
-
async recordLedgerEntries(driver, options, executedOperations) {
|
|
347
|
-
const
|
|
348
|
-
const space = plan.spaceId;
|
|
346
|
+
async recordLedgerEntries(driver, options, executedOperations, planOpsLength) {
|
|
347
|
+
const space = options.plan.spaceId;
|
|
349
348
|
const edges = options.migrationEdges;
|
|
350
349
|
const totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);
|
|
351
|
-
if (totalEdgeOps !==
|
|
350
|
+
if (totalEdgeOps !== planOpsLength) throw new Error(`Ledger write: plan.operations length (${planOpsLength}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`);
|
|
352
351
|
let offset = 0;
|
|
353
352
|
for (const edge of edges) {
|
|
354
353
|
const edgeOps = executedOperations.slice(offset, offset + edge.operationCount);
|
|
@@ -380,11 +379,7 @@ var PostgresMigrationRunner = class {
|
|
|
380
379
|
await driver.query("ROLLBACK");
|
|
381
380
|
}
|
|
382
381
|
async executeStatement(driver, statement) {
|
|
383
|
-
|
|
384
|
-
await driver.query(statement.sql, statement.params);
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
await driver.query(statement.sql);
|
|
382
|
+
await driver.query(statement.sql, statement.params);
|
|
388
383
|
}
|
|
389
384
|
};
|
|
390
385
|
//#endregion
|
|
@@ -444,8 +439,7 @@ const postgresTargetDescriptor = {
|
|
|
444
439
|
return contractToSchemaIR(contract, {
|
|
445
440
|
annotationNamespace: "pg",
|
|
446
441
|
...ifDefined("expandNativeType", buildNativeTypeExpander(frameworkComponents)),
|
|
447
|
-
renderDefault: postgresRenderDefault
|
|
448
|
-
resolveEnumStorageKey: (storage, namespaceId, nativeType) => enumStorageCompoundKey(resolveDdlSchemaForNamespaceStorage(storage, namespaceId, void 0), nativeType)
|
|
442
|
+
renderDefault: postgresRenderDefault
|
|
449
443
|
});
|
|
450
444
|
}
|
|
451
445
|
},
|