@prisma-next/target-postgres 0.5.0-dev.9 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{codec-ids-CojIXVf9.mjs → codec-ids-C5qzBqus.mjs} +4 -4
- package/dist/{codec-ids-CojIXVf9.mjs.map → codec-ids-C5qzBqus.mjs.map} +1 -1
- package/dist/codec-ids-CplrEfmx.d.mts +29 -0
- package/dist/codec-ids-CplrEfmx.d.mts.map +1 -0
- package/dist/codec-ids.d.mts +2 -28
- package/dist/codec-ids.mjs +2 -3
- package/dist/codec-types-lrsb3N07.d.mts +79 -0
- package/dist/codec-types-lrsb3N07.d.mts.map +1 -0
- package/dist/codec-types.d.mts +2 -42
- package/dist/codec-types.mjs +1 -3
- package/dist/codecs-Cue97Xqf.d.mts +558 -0
- package/dist/codecs-Cue97Xqf.d.mts.map +1 -0
- package/dist/codecs.d.mts +13 -2
- package/dist/codecs.d.mts.map +1 -0
- package/dist/codecs.mjs +738 -2
- package/dist/codecs.mjs.map +1 -0
- package/dist/control.d.mts +1 -1
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +132 -96
- package/dist/control.mjs.map +1 -1
- package/dist/{data-transform-VfEGzXWt.mjs → data-transform-DKWXdHuZ.mjs} +25 -7
- package/dist/data-transform-DKWXdHuZ.mjs.map +1 -0
- package/dist/data-transform-bIeAcZIJ.d.mts +38 -0
- package/dist/data-transform-bIeAcZIJ.d.mts.map +1 -0
- package/dist/data-transform.d.mts +1 -1
- package/dist/data-transform.mjs +2 -3
- package/dist/{default-normalizer-DNOpRoOF.mjs → default-normalizer-C8XyZj85.mjs} +2 -2
- package/dist/{default-normalizer-DNOpRoOF.mjs.map → default-normalizer-C8XyZj85.mjs.map} +1 -1
- package/dist/default-normalizer.d.mts +0 -1
- package/dist/default-normalizer.d.mts.map +1 -1
- package/dist/default-normalizer.mjs +2 -3
- package/dist/descriptor-meta-Dde_BS3K.mjs +99 -0
- package/dist/descriptor-meta-Dde_BS3K.mjs.map +1 -0
- package/dist/{errors-AFvEPZ1R.mjs → errors-Chm2bKcS.mjs} +2 -3
- package/dist/{errors-AFvEPZ1R.mjs.map → errors-Chm2bKcS.mjs.map} +1 -1
- package/dist/errors.d.mts +0 -1
- package/dist/errors.d.mts.map +1 -1
- package/dist/errors.mjs +2 -3
- package/dist/{issue-planner-CFjB0_oO.mjs → issue-planner-DQ6WJkad.mjs} +24 -91
- package/dist/issue-planner-DQ6WJkad.mjs.map +1 -0
- package/dist/issue-planner.d.mts +4 -7
- package/dist/issue-planner.d.mts.map +1 -1
- package/dist/issue-planner.mjs +2 -3
- package/dist/migration.d.mts +29 -5
- package/dist/migration.d.mts.map +1 -1
- package/dist/migration.mjs +5 -6
- package/dist/migration.mjs.map +1 -1
- package/dist/{native-type-normalizer-CInai_oY.mjs → native-type-normalizer-Cry4QoLf.mjs} +2 -2
- package/dist/native-type-normalizer-Cry4QoLf.mjs.map +1 -0
- package/dist/native-type-normalizer.d.mts.map +1 -1
- package/dist/native-type-normalizer.mjs +2 -3
- package/dist/{op-factory-call-BKlruaiC.mjs → op-factory-call-DeaFxa8_.mjs} +27 -10
- package/dist/op-factory-call-DeaFxa8_.mjs.map +1 -0
- package/dist/{op-factory-call-C3bWXKSP.d.mts → op-factory-call-UFpUPJL6.d.mts} +11 -8
- package/dist/op-factory-call-UFpUPJL6.d.mts.map +1 -0
- package/dist/op-factory-call.d.mts +1 -2
- package/dist/op-factory-call.mjs +2 -3
- package/dist/pack.d.mts +28 -9
- package/dist/pack.d.mts.map +1 -1
- package/dist/pack.mjs +2 -3
- package/dist/{planner-CLUvVhUN.mjs → planner-CYtKhLYa.mjs} +22 -16
- package/dist/planner-CYtKhLYa.mjs.map +1 -0
- package/dist/{planner-ddl-builders-Dxvw1LHw.mjs → planner-ddl-builders-CLB7Umhh.mjs} +4 -5
- package/dist/planner-ddl-builders-CLB7Umhh.mjs.map +1 -0
- package/dist/planner-ddl-builders.d.mts +1 -1
- package/dist/planner-ddl-builders.d.mts.map +1 -1
- package/dist/planner-ddl-builders.mjs +2 -3
- package/dist/{planner-identity-values-Dju-o5GF.mjs → planner-identity-values-DTx0gePL.mjs} +2 -3
- package/dist/{planner-identity-values-Dju-o5GF.mjs.map → planner-identity-values-DTx0gePL.mjs.map} +1 -1
- package/dist/planner-identity-values.d.mts +0 -1
- package/dist/planner-identity-values.d.mts.map +1 -1
- package/dist/planner-identity-values.mjs +2 -3
- package/dist/{planner-produced-postgres-migration-CRRTno6Z.d.mts → planner-produced-postgres-migration-CjxWIVgh.d.mts} +11 -7
- package/dist/planner-produced-postgres-migration-CjxWIVgh.d.mts.map +1 -0
- package/dist/{planner-produced-postgres-migration-DSSPq8QS.mjs → planner-produced-postgres-migration-DphktB2N.mjs} +16 -8
- package/dist/planner-produced-postgres-migration-DphktB2N.mjs.map +1 -0
- package/dist/planner-produced-postgres-migration.d.mts +1 -4
- package/dist/planner-produced-postgres-migration.mjs +2 -3
- package/dist/{planner-schema-lookup-B7lkypwn.mjs → planner-schema-lookup-B1ags8ys.mjs} +2 -2
- package/dist/{planner-schema-lookup-B7lkypwn.mjs.map → planner-schema-lookup-B1ags8ys.mjs.map} +1 -1
- package/dist/planner-schema-lookup.d.mts +0 -1
- package/dist/planner-schema-lookup.d.mts.map +1 -1
- package/dist/planner-schema-lookup.mjs +2 -3
- package/dist/{planner-sql-checks-7jkgm9TX.mjs → planner-sql-checks-DwZvGlV4.mjs} +3 -5
- package/dist/planner-sql-checks-DwZvGlV4.mjs.map +1 -0
- package/dist/planner-sql-checks.d.mts.map +1 -1
- package/dist/planner-sql-checks.mjs +2 -3
- package/dist/{planner-target-details-DH-azLu-.d.mts → planner-target-details-bVVcanWh.d.mts} +1 -1
- package/dist/planner-target-details-bVVcanWh.d.mts.map +1 -0
- package/dist/planner-target-details.d.mts +1 -1
- package/dist/planner-target-details.mjs +1 -1
- package/dist/planner.d.mts +21 -12
- package/dist/planner.d.mts.map +1 -1
- package/dist/planner.mjs +2 -4
- package/dist/{postgres-migration-qtmtbONe.mjs → postgres-migration-Bkv140RW.mjs} +4 -5
- package/dist/postgres-migration-Bkv140RW.mjs.map +1 -0
- package/dist/{postgres-migration-BjA3Zmts.d.mts → postgres-migration-UkcHfZAA.d.mts} +6 -6
- package/dist/postgres-migration-UkcHfZAA.d.mts.map +1 -0
- package/dist/render-ops--1nnfNus.mjs +23 -0
- package/dist/render-ops--1nnfNus.mjs.map +1 -0
- package/dist/render-ops.d.mts +3 -4
- package/dist/render-ops.d.mts.map +1 -1
- package/dist/render-ops.mjs +2 -3
- package/dist/{render-typescript-1rF_SB4g.mjs → render-typescript-D3doH-vX.mjs} +2 -14
- package/dist/render-typescript-D3doH-vX.mjs.map +1 -0
- package/dist/render-typescript.d.mts +3 -6
- package/dist/render-typescript.d.mts.map +1 -1
- package/dist/render-typescript.mjs +2 -3
- package/dist/runtime.d.mts +5 -9
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +7 -14
- package/dist/runtime.mjs.map +1 -1
- package/dist/{shared-Bxkt8pNO.d.mts → shared-MpwjwAjM.d.mts} +2 -2
- package/dist/shared-MpwjwAjM.d.mts.map +1 -0
- package/dist/{sql-utils-r-Lw535w.mjs → sql-utils-CggjWNij.mjs} +4 -2
- package/dist/sql-utils-CggjWNij.mjs.map +1 -0
- package/dist/sql-utils.d.mts.map +1 -1
- package/dist/sql-utils.mjs +2 -3
- package/dist/{statement-builders-BPnmt6wx.mjs → statement-builders-BT889jV0.mjs} +28 -13
- package/dist/statement-builders-BT889jV0.mjs.map +1 -0
- package/dist/statement-builders.d.mts +31 -3
- package/dist/statement-builders.d.mts.map +1 -1
- package/dist/statement-builders.mjs +2 -3
- package/dist/{tables-BmdW_FWO.mjs → tables-DgYIXjUt.mjs} +53 -14
- package/dist/tables-DgYIXjUt.mjs.map +1 -0
- package/dist/{types-ClK03Ojd.d.mts → types-CTqpysRY.d.mts} +1 -1
- package/dist/types-CTqpysRY.d.mts.map +1 -0
- package/dist/types.d.mts +1 -1
- package/dist/types.mjs +1 -1
- package/package.json +21 -19
- package/src/core/authoring.ts +5 -11
- package/src/core/codec-helpers.ts +135 -0
- package/src/core/codec-ids.ts +1 -0
- package/src/core/codec-type-map.ts +81 -0
- package/src/core/codecs.ts +941 -547
- package/src/core/descriptor-meta.ts +1 -1
- package/src/core/migrations/issue-planner.ts +23 -35
- package/src/core/migrations/op-factory-call.ts +26 -5
- package/src/core/migrations/operations/data-transform.ts +86 -21
- package/src/core/migrations/operations/dependencies.ts +52 -0
- package/src/core/migrations/operations/indexes.ts +27 -2
- package/src/core/migrations/planner-produced-postgres-migration.ts +17 -5
- package/src/core/migrations/planner-strategies.ts +4 -86
- package/src/core/migrations/planner.ts +62 -20
- package/src/core/migrations/postgres-migration.ts +3 -6
- package/src/core/migrations/render-ops.ts +26 -3
- package/src/core/migrations/render-typescript.ts +5 -9
- package/src/core/migrations/runner.ts +172 -151
- package/src/core/migrations/statement-builders.ts +49 -10
- package/src/core/registry.ts +11 -0
- package/src/exports/codec-types.ts +4 -13
- package/src/exports/codecs.ts +49 -2
- package/src/exports/control.ts +0 -1
- package/src/exports/migration.ts +5 -1
- package/src/exports/runtime.ts +6 -11
- package/src/exports/statement-builders.ts +2 -1
- package/dist/codec-ids.d.mts.map +0 -1
- package/dist/codec-types.d.mts.map +0 -1
- package/dist/codecs-BQEm9_oo.d.mts +0 -319
- package/dist/codecs-BQEm9_oo.d.mts.map +0 -1
- package/dist/codecs-BoahtY_Q.mjs +0 -385
- package/dist/codecs-BoahtY_Q.mjs.map +0 -1
- package/dist/data-transform-CxFRBIUp.d.mts +0 -32
- package/dist/data-transform-CxFRBIUp.d.mts.map +0 -1
- package/dist/data-transform-VfEGzXWt.mjs.map +0 -1
- package/dist/descriptor-meta-BVoVtyp-.mjs +0 -120
- package/dist/descriptor-meta-BVoVtyp-.mjs.map +0 -1
- package/dist/issue-planner-CFjB0_oO.mjs.map +0 -1
- package/dist/native-type-normalizer-CInai_oY.mjs.map +0 -1
- package/dist/op-factory-call-BKlruaiC.mjs.map +0 -1
- package/dist/op-factory-call-C3bWXKSP.d.mts.map +0 -1
- package/dist/planner-CLUvVhUN.mjs.map +0 -1
- package/dist/planner-ddl-builders-Dxvw1LHw.mjs.map +0 -1
- package/dist/planner-produced-postgres-migration-CRRTno6Z.d.mts.map +0 -1
- package/dist/planner-produced-postgres-migration-DSSPq8QS.mjs.map +0 -1
- package/dist/planner-sql-checks-7jkgm9TX.mjs.map +0 -1
- package/dist/planner-target-details-DH-azLu-.d.mts.map +0 -1
- package/dist/postgres-migration-BjA3Zmts.d.mts.map +0 -1
- package/dist/postgres-migration-qtmtbONe.mjs.map +0 -1
- package/dist/render-ops-D6_DHdOK.mjs +0 -8
- package/dist/render-ops-D6_DHdOK.mjs.map +0 -1
- package/dist/render-typescript-1rF_SB4g.mjs.map +0 -1
- package/dist/shared-Bxkt8pNO.d.mts.map +0 -1
- package/dist/sql-utils-r-Lw535w.mjs.map +0 -1
- package/dist/statement-builders-BPnmt6wx.mjs.map +0 -1
- package/dist/tables-BmdW_FWO.mjs.map +0 -1
- package/dist/types-ClK03Ojd.d.mts.map +0 -1
- package/src/core/json-schema-type-expression.ts +0 -131
|
@@ -0,0 +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_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_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\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];\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,OAAO,IAAI,CAAC,OAAO,UAAU,OAAO,EACrF,MAAM,IAAI,MACR,iEAAiE,SAAS,QAAQ,OAAO,OAAO,GACjG;CAEH,OAAO,GAAG,SAAS,GAAG,OAAO;;AAG/B,SAAgB,gBAAgB,UAAkB,YAA6C;CAC7F,MAAM,YAAY,WAAW;CAC7B,IAAI,cAAc,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AI,mBAAmB;AAExD,MAAa,sBACX,OAAO,kBAAkB,SAAS,EAAE,kBAAkB,SAAS,KAAA,GAAW,SAAS;;;;;;;;ACj+BrF,MAAa,wBACX,6BAA6B;CDu+B7B;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;CCngC6B,CAAiB"}
|
package/dist/control.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PostgresPlanTargetDetails } from "./planner-target-details-
|
|
1
|
+
import { t as PostgresPlanTargetDetails } from "./planner-target-details-bVVcanWh.mjs";
|
|
2
2
|
import { SqlControlTargetDescriptor } from "@prisma-next/family-sql/control";
|
|
3
3
|
import { ColumnDefault } from "@prisma-next/contract/types";
|
|
4
4
|
import { StorageColumn } from "@prisma-next/sql-contract/types";
|
package/dist/control.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/exports/control.ts"],"
|
|
1
|
+
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/exports/control.ts"],"mappings":";;;;;;iBA6CgB,qBAAA,CAAsB,GAAA,EAAK,aAAA,EAAe,MAAA,EAAQ,aAAA;AAAA,cAO5D,wBAAA,EAA0B,0BAAA,aAAuC,yBAAA"}
|
package/dist/control.mjs
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-
|
|
2
|
-
import { t as parsePostgresDefault } from "./default-normalizer-
|
|
3
|
-
import { t as normalizeSchemaNativeType } from "./native-type-normalizer-
|
|
4
|
-
import { o as renderDefaultLiteral } from "./planner-ddl-builders-
|
|
5
|
-
import "./
|
|
6
|
-
import {
|
|
7
|
-
import { a as ensurePrismaContractSchemaStatement, i as ensureMarkerTableStatement, n as buildWriteMarkerStatements, r as ensureLedgerTableStatement, t as buildLedgerInsertStatement } from "./statement-builders-BPnmt6wx.mjs";
|
|
8
|
-
import { ifDefined } from "@prisma-next/utils/defined";
|
|
1
|
+
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-Dde_BS3K.mjs";
|
|
2
|
+
import { t as parsePostgresDefault } from "./default-normalizer-C8XyZj85.mjs";
|
|
3
|
+
import { t as normalizeSchemaNativeType } from "./native-type-normalizer-Cry4QoLf.mjs";
|
|
4
|
+
import { o as renderDefaultLiteral } from "./planner-ddl-builders-CLB7Umhh.mjs";
|
|
5
|
+
import { t as createPostgresMigrationPlanner } from "./planner-CYtKhLYa.mjs";
|
|
6
|
+
import { a as ensureMarkerTableStatement, i as ensureLedgerTableStatement, n as buildLedgerInsertStatement, o as ensurePrismaContractSchemaStatement, r as buildMergeMarkerStatements } from "./statement-builders-BT889jV0.mjs";
|
|
9
7
|
import { contractToSchemaIR, extractCodecControlHooks, runnerFailure, runnerSuccess } from "@prisma-next/family-sql/control";
|
|
8
|
+
import { ifDefined } from "@prisma-next/utils/defined";
|
|
10
9
|
import { verifySqlSchema } from "@prisma-next/family-sql/schema-verify";
|
|
11
|
-
import { ok, okVoid } from "@prisma-next/utils/result";
|
|
12
|
-
import {
|
|
10
|
+
import { notOk, ok, okVoid } from "@prisma-next/utils/result";
|
|
11
|
+
import { APP_SPACE_ID } from "@prisma-next/framework-components/control";
|
|
13
12
|
import { SqlQueryError } from "@prisma-next/sql-errors";
|
|
14
|
-
|
|
15
13
|
//#region src/core/migrations/runner.ts
|
|
16
14
|
const DEFAULT_CONFIG = { defaultSchema: "public" };
|
|
17
15
|
const LOCK_DOMAIN = "prisma_next.contract.marker";
|
|
18
|
-
function isDataTransformOperation(op) {
|
|
19
|
-
return typeof op === "object" && op !== null && "operationClass" in op && op.operationClass === "data" && "name" in op && "check" in op && "run" in op;
|
|
20
|
-
}
|
|
21
16
|
/**
|
|
22
17
|
* Deep clones and freezes a record object to prevent mutation.
|
|
23
18
|
* Recursively clones nested objects and arrays to ensure complete isolation.
|
|
@@ -37,14 +32,14 @@ function createPostgresMigrationRunner(family, config = {}) {
|
|
|
37
32
|
});
|
|
38
33
|
}
|
|
39
34
|
var PostgresMigrationRunner = class {
|
|
35
|
+
family;
|
|
36
|
+
config;
|
|
40
37
|
constructor(family, config) {
|
|
41
38
|
this.family = family;
|
|
42
39
|
this.config = config;
|
|
43
40
|
}
|
|
44
41
|
async execute(options) {
|
|
45
|
-
const schema = options.schemaName ?? this.config.defaultSchema;
|
|
46
42
|
const driver = options.driver;
|
|
47
|
-
const lockKey = `${LOCK_DOMAIN}:${schema}`;
|
|
48
43
|
const destinationCheck = this.ensurePlanMatchesDestinationContract(options.plan.destination, options.destinationContract);
|
|
49
44
|
if (!destinationCheck.ok) return destinationCheck;
|
|
50
45
|
const policyCheck = this.enforcePolicyCompatibility(options.policy, options.plan.operations);
|
|
@@ -52,22 +47,54 @@ var PostgresMigrationRunner = class {
|
|
|
52
47
|
await this.beginTransaction(driver);
|
|
53
48
|
let committed = false;
|
|
54
49
|
try {
|
|
55
|
-
await this.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
50
|
+
const result = await this.executeOnConnection(options);
|
|
51
|
+
if (!result.ok) return result;
|
|
52
|
+
await this.commitTransaction(driver);
|
|
53
|
+
committed = true;
|
|
54
|
+
return result;
|
|
55
|
+
} finally {
|
|
56
|
+
if (!committed) await this.rollbackTransaction(driver);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Body of the migration runner without transaction management. The
|
|
61
|
+
* caller (single-space `execute(...)` above, or the multi-space
|
|
62
|
+
* outer-tx orchestrator at the SQL family level) owns the
|
|
63
|
+
* `BEGIN`/`COMMIT`/`ROLLBACK` lifecycle.
|
|
64
|
+
*/
|
|
65
|
+
async executeOnConnection(options) {
|
|
66
|
+
const schema = options.schemaName ?? this.config.defaultSchema;
|
|
67
|
+
const driver = options.driver;
|
|
68
|
+
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})`);
|
|
69
|
+
const space = options.plan.spaceId;
|
|
70
|
+
const lockKey = `${LOCK_DOMAIN}:${schema}:${space}`;
|
|
71
|
+
const destinationCheck = this.ensurePlanMatchesDestinationContract(options.plan.destination, options.destinationContract);
|
|
72
|
+
if (!destinationCheck.ok) return destinationCheck;
|
|
73
|
+
const policyCheck = this.enforcePolicyCompatibility(options.policy, options.plan.operations);
|
|
74
|
+
if (!policyCheck.ok) return policyCheck;
|
|
75
|
+
await this.acquireLock(driver, lockKey);
|
|
76
|
+
const ensureResult = await this.ensureControlTables(driver);
|
|
77
|
+
if (!ensureResult.ok) return ensureResult;
|
|
78
|
+
const existingMarker = await this.family.readMarker({
|
|
79
|
+
driver,
|
|
80
|
+
space
|
|
81
|
+
});
|
|
82
|
+
const markerCheck = this.ensureMarkerCompatibility(existingMarker, options.plan);
|
|
83
|
+
if (!markerCheck.ok) return markerCheck;
|
|
84
|
+
const markerAtDestination = this.markerMatchesDestination(existingMarker, options.plan);
|
|
85
|
+
const isSelfEdge = options.plan.origin?.storageHash === options.plan.destination.storageHash;
|
|
86
|
+
const skipOperations = markerAtDestination && options.plan.origin != null && !isSelfEdge;
|
|
87
|
+
let applyValue;
|
|
88
|
+
if (skipOperations) applyValue = {
|
|
89
|
+
operationsExecuted: 0,
|
|
90
|
+
executedOperations: []
|
|
91
|
+
};
|
|
92
|
+
else {
|
|
93
|
+
const applyResult = await this.applyPlan(driver, options);
|
|
94
|
+
if (!applyResult.ok) return applyResult;
|
|
95
|
+
applyValue = applyResult.value;
|
|
96
|
+
}
|
|
97
|
+
if (space === APP_SPACE_ID) {
|
|
71
98
|
const schemaIR = await this.family.introspect({
|
|
72
99
|
driver,
|
|
73
100
|
contract: options.destinationContract
|
|
@@ -86,14 +113,46 @@ var PostgresMigrationRunner = class {
|
|
|
86
113
|
why: "The resulting database schema does not satisfy the destination contract.",
|
|
87
114
|
meta: { issues: schemaVerifyResult.schema.issues }
|
|
88
115
|
});
|
|
89
|
-
|
|
116
|
+
}
|
|
117
|
+
const incomingInvariants = options.plan.providedInvariants ?? [];
|
|
118
|
+
const existingInvariants = new Set(existingMarker?.invariants ?? []);
|
|
119
|
+
const incomingIsSubsetOfExisting = incomingInvariants.every((id) => existingInvariants.has(id));
|
|
120
|
+
if (!(isSelfEdge && applyValue.operationsExecuted === 0 && incomingIsSubsetOfExisting)) {
|
|
121
|
+
await this.upsertMarker(driver, options, existingMarker, space);
|
|
90
122
|
await this.recordLedgerEntry(driver, options, existingMarker, applyValue.executedOperations);
|
|
123
|
+
}
|
|
124
|
+
return runnerSuccess({
|
|
125
|
+
operationsPlanned: options.plan.operations.length,
|
|
126
|
+
operationsExecuted: applyValue.operationsExecuted
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
async executeAcrossSpaces(options) {
|
|
130
|
+
const driver = options.driver;
|
|
131
|
+
const perSpaceOptions = options.perSpaceOptions;
|
|
132
|
+
if (perSpaceOptions.length === 0) return ok({ perSpaceResults: [] });
|
|
133
|
+
await this.beginTransaction(driver);
|
|
134
|
+
let committed = false;
|
|
135
|
+
try {
|
|
136
|
+
const perSpaceResults = [];
|
|
137
|
+
for (const spaceOptions of perSpaceOptions) {
|
|
138
|
+
const space = spaceOptions.space ?? spaceOptions.plan.spaceId;
|
|
139
|
+
const result = await this.executeOnConnection({
|
|
140
|
+
...spaceOptions,
|
|
141
|
+
driver,
|
|
142
|
+
space
|
|
143
|
+
});
|
|
144
|
+
if (!result.ok) return notOk({
|
|
145
|
+
...result.failure,
|
|
146
|
+
failingSpace: space
|
|
147
|
+
});
|
|
148
|
+
perSpaceResults.push({
|
|
149
|
+
space,
|
|
150
|
+
value: result.value
|
|
151
|
+
});
|
|
152
|
+
}
|
|
91
153
|
await this.commitTransaction(driver);
|
|
92
154
|
committed = true;
|
|
93
|
-
return
|
|
94
|
-
operationsPlanned: options.plan.operations.length,
|
|
95
|
-
operationsExecuted: applyValue.operationsExecuted
|
|
96
|
-
});
|
|
155
|
+
return ok({ perSpaceResults });
|
|
97
156
|
} finally {
|
|
98
157
|
if (!committed) await this.rollbackTransaction(driver);
|
|
99
158
|
}
|
|
@@ -108,13 +167,6 @@ var PostgresMigrationRunner = class {
|
|
|
108
167
|
for (const operation of options.plan.operations) {
|
|
109
168
|
options.callbacks?.onOperationStart?.(operation);
|
|
110
169
|
try {
|
|
111
|
-
if (operation.operationClass === "data" && isDataTransformOperation(operation)) {
|
|
112
|
-
const dtResult = await this.executeDataTransform(driver, operation, { runIdempotency });
|
|
113
|
-
if (!dtResult.ok) return dtResult;
|
|
114
|
-
executedOperations.push(operation);
|
|
115
|
-
operationsExecuted += 1;
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
170
|
if (runPostchecks && runIdempotency) {
|
|
119
171
|
if (await this.expectationsAreSatisfied(driver, operation.postcheck)) {
|
|
120
172
|
executedOperations.push(this.createPostcheckPreSatisfiedSkipRecord(operation));
|
|
@@ -142,54 +194,30 @@ var PostgresMigrationRunner = class {
|
|
|
142
194
|
executedOperations
|
|
143
195
|
});
|
|
144
196
|
}
|
|
145
|
-
/**
|
|
146
|
-
* Executes a data transform operation with the check → (skip or run) → check lifecycle.
|
|
147
|
-
*
|
|
148
|
-
* 1. If check is a query AST: render to SQL, execute. Empty result = already applied (skip).
|
|
149
|
-
* 2. If check is `true`: always skip. If `false`: always run.
|
|
150
|
-
* 3. Execute run ASTs (rendered to SQL) sequentially.
|
|
151
|
-
* 4. Re-execute check as post-run validation. If violations remain, fail.
|
|
152
|
-
*/
|
|
153
|
-
async executeDataTransform(driver, op, options) {
|
|
154
|
-
if (op.check === true) return okVoid();
|
|
155
|
-
if (options.runIdempotency && op.check !== null && op.check !== false) {
|
|
156
|
-
if ((await driver.query(op.check.sql, op.check.params)).rows.length === 0) return okVoid();
|
|
157
|
-
}
|
|
158
|
-
if (op.run) for (const plan of op.run) try {
|
|
159
|
-
await driver.query(plan.sql, plan.params);
|
|
160
|
-
} catch (error) {
|
|
161
|
-
if (SqlQueryError.is(error)) return runnerFailure("EXECUTION_FAILED", `Data transform "${op.name}" failed: ${error.message}`, {
|
|
162
|
-
why: error.message,
|
|
163
|
-
meta: {
|
|
164
|
-
operationId: op.id,
|
|
165
|
-
dataTransformName: op.name,
|
|
166
|
-
sql: plan.sql,
|
|
167
|
-
sqlState: error.sqlState
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
throw error;
|
|
171
|
-
}
|
|
172
|
-
if (op.check !== null && op.check !== false) {
|
|
173
|
-
const checkResult = await driver.query(op.check.sql, op.check.params);
|
|
174
|
-
if (checkResult.rows.length > 0) return runnerFailure("POSTCHECK_FAILED", `Data transform "${op.name}" did not resolve all violations (${checkResult.rows.length} remaining)`, {
|
|
175
|
-
why: `After executing the data transform, the check query still returns ${checkResult.rows.length} violation(s).`,
|
|
176
|
-
meta: {
|
|
177
|
-
operationId: op.id,
|
|
178
|
-
dataTransformName: op.name,
|
|
179
|
-
remainingViolations: checkResult.rows.length
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
return okVoid();
|
|
184
|
-
}
|
|
185
197
|
async ensureControlTables(driver) {
|
|
186
198
|
await this.executeStatement(driver, ensurePrismaContractSchemaStatement);
|
|
199
|
+
const legacyDetection = await this.detectLegacyMarkerShape(driver);
|
|
200
|
+
if (!legacyDetection.ok) return legacyDetection;
|
|
187
201
|
await this.executeStatement(driver, ensureMarkerTableStatement);
|
|
188
202
|
await this.executeStatement(driver, ensureLedgerTableStatement);
|
|
203
|
+
return okVoid();
|
|
204
|
+
}
|
|
205
|
+
async detectLegacyMarkerShape(driver) {
|
|
206
|
+
const result = await driver.query(`select column_name
|
|
207
|
+
from information_schema.columns
|
|
208
|
+
where table_schema = 'prisma_contract'
|
|
209
|
+
and table_name = 'marker'`);
|
|
210
|
+
if (result.rows.length === 0) return okVoid();
|
|
211
|
+
const columns = new Set(result.rows.map((row) => row.column_name));
|
|
212
|
+
if (columns.has("space")) return okVoid();
|
|
213
|
+
return runnerFailure("LEGACY_MARKER_SHAPE", "Legacy marker-table shape detected on prisma_contract.marker (no `space` column). Prisma Next is in pre-1.0; the previous transitional auto-migration to the per-space-row schema has been removed. Drop `prisma_contract.marker` and re-run `dbInit` to reinitialise from a clean baseline.", { meta: {
|
|
214
|
+
table: "prisma_contract.marker",
|
|
215
|
+
columns: [...columns].sort()
|
|
216
|
+
} });
|
|
189
217
|
}
|
|
190
218
|
async runExpectationSteps(driver, steps, operation, phase) {
|
|
191
219
|
for (const step of steps) {
|
|
192
|
-
const result = await driver.query(step.sql);
|
|
220
|
+
const result = await driver.query(step.sql, step.params ?? []);
|
|
193
221
|
if (!this.stepResultIsTrue(result.rows)) return runnerFailure(phase === "precheck" ? "PRECHECK_FAILED" : "POSTCHECK_FAILED", `Operation ${operation.id} failed during ${phase}: ${step.description}`, { meta: {
|
|
194
222
|
operationId: operation.id,
|
|
195
223
|
phase,
|
|
@@ -200,7 +228,7 @@ var PostgresMigrationRunner = class {
|
|
|
200
228
|
}
|
|
201
229
|
async runExecuteSteps(driver, steps, operation) {
|
|
202
230
|
for (const step of steps) try {
|
|
203
|
-
await driver.query(step.sql);
|
|
231
|
+
await driver.query(step.sql, step.params ?? []);
|
|
204
232
|
} catch (error) {
|
|
205
233
|
if (SqlQueryError.is(error)) return runnerFailure("EXECUTION_FAILED", `Operation ${operation.id} failed during execution: ${step.description}`, {
|
|
206
234
|
why: error.message,
|
|
@@ -236,7 +264,7 @@ var PostgresMigrationRunner = class {
|
|
|
236
264
|
async expectationsAreSatisfied(driver, steps) {
|
|
237
265
|
if (steps.length === 0) return false;
|
|
238
266
|
for (const step of steps) {
|
|
239
|
-
const result = await driver.query(step.sql);
|
|
267
|
+
const result = await driver.query(step.sql, step.params ?? []);
|
|
240
268
|
if (!this.stepResultIsTrue(result.rows)) return false;
|
|
241
269
|
}
|
|
242
270
|
return true;
|
|
@@ -307,13 +335,16 @@ var PostgresMigrationRunner = class {
|
|
|
307
335
|
} });
|
|
308
336
|
return okVoid();
|
|
309
337
|
}
|
|
310
|
-
async upsertMarker(driver, options, existingMarker) {
|
|
311
|
-
const
|
|
338
|
+
async upsertMarker(driver, options, existingMarker, space) {
|
|
339
|
+
const incomingInvariants = options.plan.providedInvariants ?? [];
|
|
340
|
+
const writeStatements = buildMergeMarkerStatements({
|
|
341
|
+
space,
|
|
312
342
|
storageHash: options.plan.destination.storageHash,
|
|
313
343
|
profileHash: options.plan.destination.profileHash ?? options.destinationContract.profileHash ?? options.plan.destination.storageHash,
|
|
314
344
|
contractJson: options.destinationContract,
|
|
315
345
|
canonicalVersion: null,
|
|
316
|
-
meta: {}
|
|
346
|
+
meta: {},
|
|
347
|
+
invariants: incomingInvariants
|
|
317
348
|
});
|
|
318
349
|
const statement = existingMarker ? writeStatements.update : writeStatements.insert;
|
|
319
350
|
await this.executeStatement(driver, statement);
|
|
@@ -350,7 +381,6 @@ var PostgresMigrationRunner = class {
|
|
|
350
381
|
await driver.query(statement.sql);
|
|
351
382
|
}
|
|
352
383
|
};
|
|
353
|
-
|
|
354
384
|
//#endregion
|
|
355
385
|
//#region src/exports/control.ts
|
|
356
386
|
function buildNativeTypeExpander(frameworkComponents) {
|
|
@@ -381,8 +411,7 @@ const postgresTargetDescriptor = {
|
|
|
381
411
|
return contractToSchemaIR(contract, {
|
|
382
412
|
annotationNamespace: "pg",
|
|
383
413
|
...ifDefined("expandNativeType", buildNativeTypeExpander(frameworkComponents)),
|
|
384
|
-
renderDefault: postgresRenderDefault
|
|
385
|
-
frameworkComponents: frameworkComponents ?? []
|
|
414
|
+
renderDefault: postgresRenderDefault
|
|
386
415
|
});
|
|
387
416
|
}
|
|
388
417
|
},
|
|
@@ -392,15 +421,22 @@ const postgresTargetDescriptor = {
|
|
|
392
421
|
targetId: "postgres"
|
|
393
422
|
};
|
|
394
423
|
},
|
|
424
|
+
/**
|
|
425
|
+
* Direct method for SQL-specific usage.
|
|
426
|
+
* @deprecated Use migrations.createPlanner() for CLI compatibility.
|
|
427
|
+
*/
|
|
395
428
|
createPlanner(_family) {
|
|
396
429
|
return createPostgresMigrationPlanner();
|
|
397
430
|
},
|
|
431
|
+
/**
|
|
432
|
+
* Direct method for SQL-specific usage.
|
|
433
|
+
* @deprecated Use migrations.createRunner() for CLI compatibility.
|
|
434
|
+
*/
|
|
398
435
|
createRunner(family) {
|
|
399
436
|
return createPostgresMigrationRunner(family);
|
|
400
437
|
}
|
|
401
438
|
};
|
|
402
|
-
var control_default = postgresTargetDescriptor;
|
|
403
|
-
|
|
404
439
|
//#endregion
|
|
405
|
-
export {
|
|
440
|
+
export { postgresTargetDescriptor as default, postgresRenderDefault };
|
|
441
|
+
|
|
406
442
|
//# sourceMappingURL=control.mjs.map
|