@prisma-next/adapter-postgres 0.16.0-dev.32 → 0.16.0-dev.34

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/README.md CHANGED
@@ -159,6 +159,10 @@ flowchart TD
159
159
 
160
160
  ## Usage
161
161
 
162
+ ### Custom codec descriptors
163
+
164
+ `createPostgresAdapter({ codecDescriptors })` accepts PostgreSQL-target descriptors and appends them to the built-ins before constructing one structurally validated registry. Stack-based runtime and control construction consume the same descriptors from `types.codecTypes.codecDescriptors`. See the [target-owned SQL codec descriptor guide](../../../../docs/reference/codec-authoring-guide.md#target-owned-sql-codec-descriptors); do not inject separate generic and PostgreSQL lookups.
165
+
162
166
  ### Runtime
163
167
 
164
168
  ```typescript
@@ -1,4 +1,4 @@
1
- import { i as adapterError, n as renderLoweredSql, r as createPostgresBuiltinCodecLookup, t as PostgresControlAdapter } from "./control-adapter-BXXNf5j0.mjs";
1
+ import { a as createPostgresCodecRegistryWithBuiltins, n as renderLoweredSql, o as adapterError, t as PostgresControlAdapter } from "./control-adapter-DyFEWery.mjs";
2
2
  import { APP_SPACE_ID } from "@prisma-next/framework-components/control";
3
3
  import { isDdlNode } from "@prisma-next/sql-relational-core/ast";
4
4
  //#region src/core/adapter.ts
@@ -23,12 +23,12 @@ var PostgresAdapterImpl = class {
23
23
  familyId = "sql";
24
24
  targetId = "postgres";
25
25
  profile;
26
- codecLookup;
27
- constructor(options) {
28
- this.codecLookup = options?.codecLookup ?? createPostgresBuiltinCodecLookup();
29
- const controlAdapter = new PostgresControlAdapter(this.codecLookup);
26
+ codecRegistry;
27
+ constructor(codecRegistry, profileId) {
28
+ this.codecRegistry = codecRegistry;
29
+ const controlAdapter = new PostgresControlAdapter(codecRegistry);
30
30
  this.profile = Object.freeze({
31
- id: options?.profileId ?? "postgres/default@1",
31
+ id: profileId ?? "postgres/default@1",
32
32
  target: "postgres",
33
33
  capabilities: defaultCapabilities,
34
34
  readMarker: (queryable) => controlAdapter.readMarkerDiscriminated({
@@ -43,7 +43,7 @@ var PostgresAdapterImpl = class {
43
43
  }
44
44
  lower(ast, context) {
45
45
  if (isDdlNode(ast)) throw adapterError("RUNTIME.DDL_UNSUPPORTED", "lower() does not lower DDL on the runtime adapter — DDL lowering is a control-plane concern handled by the control adapter.", { meta: { surface: "runtime-adapter" } });
46
- return renderLoweredSql(ast, context.contract, this.codecLookup);
46
+ return renderLoweredSql(ast, context.contract, this.codecRegistry);
47
47
  }
48
48
  };
49
49
  /** Codec-id lookup for bare-literal interpolations used by `fns.raw` on a postgres client. Contributed as the descriptor's static `rawCodecInferer` slot. */
@@ -58,9 +58,13 @@ const postgresRawCodecInferer = { inferCodec(value) {
58
58
  throw adapterError("RUNTIME.RAW_SQL_UNSUPPORTED_INTERPOLATION", "unsupported JS value type for raw-SQL interpolation: wrap this value in `param(...)` with an explicit codec", { meta: { valueType: typeof value } });
59
59
  } };
60
60
  function createPostgresAdapter(options) {
61
- return Object.freeze(new PostgresAdapterImpl(options));
61
+ const codecRegistry = createPostgresCodecRegistryWithBuiltins(options?.codecDescriptors);
62
+ return Object.freeze(new PostgresAdapterImpl(codecRegistry, options?.profileId));
63
+ }
64
+ function createPostgresAdapterWithCodecRegistry(codecRegistry) {
65
+ return Object.freeze(new PostgresAdapterImpl(codecRegistry));
62
66
  }
63
67
  //#endregion
64
- export { postgresRawCodecInferer as n, createPostgresAdapter as t };
68
+ export { createPostgresAdapterWithCodecRegistry as n, postgresRawCodecInferer as r, createPostgresAdapter as t };
65
69
 
66
- //# sourceMappingURL=adapter-CZfCp5TH.mjs.map
70
+ //# sourceMappingURL=adapter-CyErVYXZ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-CyErVYXZ.mjs","names":[],"sources":["../src/core/adapter.ts"],"sourcesContent":["import { APP_SPACE_ID } from '@prisma-next/framework-components/control';\nimport type {\n Adapter,\n AdapterProfile,\n AnyQueryAst,\n LowererContext,\n RawSqlLiteral,\n SqlQueryable,\n} from '@prisma-next/sql-relational-core/ast';\nimport { isDdlNode } from '@prisma-next/sql-relational-core/ast';\nimport type { RawCodecInferer } from '@prisma-next/sql-relational-core/expression';\nimport type { PostgresDdlNode } from '@prisma-next/target-postgres/ddl';\nimport { adapterError } from './adapter-errors';\nimport { createPostgresCodecRegistryWithBuiltins } from './codec-lookup';\nimport { PostgresControlAdapter } from './control-adapter';\nimport { renderLoweredSql } from './sql-renderer';\nimport type {\n PostgresAdapterOptions,\n PostgresCodecRegistry,\n PostgresContract,\n PostgresLoweredStatement,\n} from './types';\n\nconst defaultCapabilities = Object.freeze({\n postgres: {\n orderBy: true,\n limit: true,\n lateral: true,\n jsonAgg: true,\n returning: true,\n distinctOn: true,\n },\n sql: {\n enums: true,\n returning: true,\n defaultInInsert: true,\n lateral: true,\n scalarList: true,\n },\n});\n\nclass PostgresAdapterImpl\n implements Adapter<AnyQueryAst, PostgresContract, PostgresLoweredStatement>\n{\n // These fields make the adapter instance structurally compatible with RuntimeAdapterInstance<'sql', 'postgres'> without introducing a runtime-plane dependency.\n readonly familyId = 'sql' as const;\n readonly targetId = 'postgres' as const;\n\n readonly profile: AdapterProfile<'postgres'>;\n private readonly codecRegistry: PostgresCodecRegistry;\n\n constructor(codecRegistry: PostgresCodecRegistry, profileId?: string) {\n this.codecRegistry = codecRegistry;\n const controlAdapter = new PostgresControlAdapter(codecRegistry);\n this.profile = Object.freeze({\n id: profileId ?? 'postgres/default@1',\n target: 'postgres',\n capabilities: defaultCapabilities,\n readMarker: (queryable: SqlQueryable) =>\n controlAdapter.readMarkerDiscriminated(\n {\n familyId: 'sql',\n targetId: 'postgres',\n query: async <Row = Record<string, unknown>>(\n sql: string,\n params?: readonly unknown[],\n ) => {\n const result = await queryable.query<Row>(sql, params);\n return { rows: [...result.rows] };\n },\n close: async () => {},\n },\n APP_SPACE_ID,\n ),\n });\n }\n\n lower(\n ast: AnyQueryAst | PostgresDdlNode,\n context: LowererContext<PostgresContract>,\n ): PostgresLoweredStatement {\n if (isDdlNode(ast)) {\n throw adapterError(\n 'RUNTIME.DDL_UNSUPPORTED',\n 'lower() does not lower DDL on the runtime adapter — DDL lowering is a control-plane concern handled by the control adapter.',\n { meta: { surface: 'runtime-adapter' } },\n );\n }\n return renderLoweredSql(ast, context.contract, this.codecRegistry);\n }\n}\n\n/** Codec-id lookup for bare-literal interpolations used by `fns.raw` on a postgres client. Contributed as the descriptor's static `rawCodecInferer` slot. */\nexport const postgresRawCodecInferer: RawCodecInferer = {\n inferCodec(value: RawSqlLiteral): string {\n switch (typeof value) {\n case 'number':\n return Number.isSafeInteger(value) && value % 1 === 0 ? 'pg/int4' : 'pg/float8';\n case 'bigint':\n return 'pg/int8';\n case 'string':\n return 'pg/text';\n case 'boolean':\n return 'pg/bool';\n case 'object':\n if (value instanceof Uint8Array) return 'pg/bytea';\n }\n throw adapterError(\n 'RUNTIME.RAW_SQL_UNSUPPORTED_INTERPOLATION',\n 'unsupported JS value type for raw-SQL interpolation: wrap this value in `param(...)` with an explicit codec',\n { meta: { valueType: typeof value } },\n );\n },\n};\n\nexport function createPostgresAdapter(options?: PostgresAdapterOptions) {\n const codecRegistry = createPostgresCodecRegistryWithBuiltins(options?.codecDescriptors);\n return Object.freeze(new PostgresAdapterImpl(codecRegistry, options?.profileId));\n}\n\nexport function createPostgresAdapterWithCodecRegistry(codecRegistry: PostgresCodecRegistry) {\n return Object.freeze(new PostgresAdapterImpl(codecRegistry));\n}\n"],"mappings":";;;;AAuBA,MAAM,sBAAsB,OAAO,OAAO;CACxC,UAAU;EACR,SAAS;EACT,OAAO;EACP,SAAS;EACT,SAAS;EACT,WAAW;EACX,YAAY;CACd;CACA,KAAK;EACH,OAAO;EACP,WAAW;EACX,iBAAiB;EACjB,SAAS;EACT,YAAY;CACd;AACF,CAAC;AAED,IAAM,sBAAN,MAEA;CAEE,WAAoB;CACpB,WAAoB;CAEpB;CACA;CAEA,YAAY,eAAsC,WAAoB;EACpE,KAAK,gBAAgB;EACrB,MAAM,iBAAiB,IAAI,uBAAuB,aAAa;EAC/D,KAAK,UAAU,OAAO,OAAO;GAC3B,IAAI,aAAa;GACjB,QAAQ;GACR,cAAc;GACd,aAAa,cACX,eAAe,wBACb;IACE,UAAU;IACV,UAAU;IACV,OAAO,OACL,KACA,WACG;KAEH,OAAO,EAAE,MAAM,CAAC,IAAG,MADE,UAAU,MAAW,KAAK,MAAM,EAAA,CAC3B,IAAI,EAAE;IAClC;IACA,OAAO,YAAY,CAAC;GACtB,GACA,YACF;EACJ,CAAC;CACH;CAEA,MACE,KACA,SAC0B;EAC1B,IAAI,UAAU,GAAG,GACf,MAAM,aACJ,2BACA,+HACA,EAAE,MAAM,EAAE,SAAS,kBAAkB,EAAE,CACzC;EAEF,OAAO,iBAAiB,KAAK,QAAQ,UAAU,KAAK,aAAa;CACnE;AACF;;AAGA,MAAa,0BAA2C,EACtD,WAAW,OAA8B;CACvC,QAAQ,OAAO,OAAf;EACE,KAAK,UACH,OAAO,OAAO,cAAc,KAAK,KAAK,QAAQ,MAAM,IAAI,YAAY;EACtE,KAAK,UACH,OAAO;EACT,KAAK,UACH,OAAO;EACT,KAAK,WACH,OAAO;EACT,KAAK,UACH,IAAI,iBAAiB,YAAY,OAAO;CAC5C;CACA,MAAM,aACJ,6CACA,+GACA,EAAE,MAAM,EAAE,WAAW,OAAO,MAAM,EAAE,CACtC;AACF,EACF;AAEA,SAAgB,sBAAsB,SAAkC;CACtE,MAAM,gBAAgB,wCAAwC,SAAS,gBAAgB;CACvF,OAAO,OAAO,OAAO,IAAI,oBAAoB,eAAe,SAAS,SAAS,CAAC;AACjF;AAEA,SAAgB,uCAAuC,eAAsC;CAC3F,OAAO,OAAO,OAAO,IAAI,oBAAoB,aAAa,CAAC;AAC7D"}
@@ -1,4 +1,4 @@
1
- import { c as PostgresContract, l as PostgresLoweredStatement, s as PostgresAdapterOptions } from "./types-DyNEvnRB.mjs";
1
+ import { c as PostgresCodecRegistry, l as PostgresContract, s as PostgresAdapterOptions, u as PostgresLoweredStatement } from "./types-BcBENDAr.mjs";
2
2
  import { Adapter, AdapterProfile, AnyQueryAst, LowererContext } from "@prisma-next/sql-relational-core/ast";
3
3
  import { RawCodecInferer } from "@prisma-next/sql-relational-core/expression";
4
4
  import { PostgresDdlNode } from "@prisma-next/target-postgres/ddl";
@@ -7,8 +7,8 @@ declare class PostgresAdapterImpl implements Adapter<AnyQueryAst, PostgresContra
7
7
  readonly familyId: "sql";
8
8
  readonly targetId: "postgres";
9
9
  readonly profile: AdapterProfile<'postgres'>;
10
- private readonly codecLookup;
11
- constructor(options?: PostgresAdapterOptions);
10
+ private readonly codecRegistry;
11
+ constructor(codecRegistry: PostgresCodecRegistry, profileId?: string);
12
12
  lower(ast: AnyQueryAst | PostgresDdlNode, context: LowererContext<PostgresContract>): PostgresLoweredStatement;
13
13
  }
14
14
  /** Codec-id lookup for bare-literal interpolations used by `fns.raw` on a postgres client. Contributed as the descriptor's static `rawCodecInferer` slot. */
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.mts","names":[],"sources":["../src/core/adapter.ts"],"mappings":";;;;;cAqCM,+BACO,QAAQ,aAAa,kBAAkB;WAGzC;WACA;WAEA,SAAS;mBACD;cAEL,UAAU;EA0BtB,MACE,KAAK,cAAc,iBACnB,SAAS,eAAe,oBACvB;;;cAaQ,yBAAyB;iBAsBtB,sBAAsB,UAAU,yBAAsB,SAAA"}
1
+ {"version":3,"file":"adapter.d.mts","names":[],"sources":["../src/core/adapter.ts"],"mappings":";;;;;cAyCM,+BACO,QAAQ,aAAa,kBAAkB;WAGzC;WACA;WAEA,SAAS;mBACD;cAEL,eAAe,uBAAuB;EA0BlD,MACE,KAAK,cAAc,iBACnB,SAAS,eAAe,oBACvB;;;cAaQ,yBAAyB;iBAsBtB,sBAAsB,UAAU,yBAAsB,SAAA"}
package/dist/adapter.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as postgresRawCodecInferer, t as createPostgresAdapter } from "./adapter-CZfCp5TH.mjs";
1
+ import { r as postgresRawCodecInferer, t as createPostgresAdapter } from "./adapter-CyErVYXZ.mjs";
2
2
  export { createPostgresAdapter, postgresRawCodecInferer };
@@ -1,7 +1,8 @@
1
1
  import { APP_SPACE_ID, extractCodecLookup } from "@prisma-next/framework-components/control";
2
2
  import { LiteralExpr, RawExpr, collectOrderedParamRefs, isDdlNode } from "@prisma-next/sql-relational-core/ast";
3
3
  import { structuredError } from "@prisma-next/utils/structured-error";
4
- import { isPgEnumParams, postgresCodecRegistry } from "@prisma-next/target-postgres/codecs";
4
+ import { buildPostgresCodecDescriptorRegistry } from "@prisma-next/target-postgres/codec-descriptor";
5
+ import { isPgEnumParams, postgresCodecDescriptorRegistry, postgresCodecRegistry } from "@prisma-next/target-postgres/codecs";
5
6
  import { parseMarkerRowSafely, rethrowMarkerReadError, withMarkerReadErrorHandling } from "@prisma-next/errors/execution";
6
7
  import { parseContractMarkerRow } from "@prisma-next/family-sql/verify";
7
8
  import { UNBOUND_NAMESPACE_ID } from "@prisma-next/framework-components/ir";
@@ -26,18 +27,31 @@ function adapterError(code, message, options) {
26
27
  }
27
28
  //#endregion
28
29
  //#region src/core/codec-lookup.ts
30
+ function buildPostgresCodecRegistry(descriptors) {
31
+ const descriptorRegistry = buildPostgresCodecDescriptorRegistry(descriptors);
32
+ const registry = {
33
+ ...extractCodecLookup([{
34
+ id: "postgres-codecs",
35
+ types: { codecTypes: { codecDescriptors: Array.from(descriptorRegistry.values()) } }
36
+ }]),
37
+ descriptorFor: (codecId) => descriptorRegistry.descriptorFor(codecId),
38
+ values: () => descriptorRegistry.values()
39
+ };
40
+ return Object.freeze(registry);
41
+ }
42
+ function assemblePostgresCodecRegistry(components) {
43
+ return buildPostgresCodecRegistry(components.flatMap((component) => component.types?.codecTypes?.codecDescriptors ?? []));
44
+ }
45
+ function createPostgresCodecRegistryWithBuiltins(codecDescriptors = []) {
46
+ return buildPostgresCodecRegistry([...postgresCodecDescriptorRegistry.values(), ...codecDescriptors]);
47
+ }
29
48
  /**
30
- * Build a {@link CodecRegistry} populated with the Postgres-builtin codec definitions only.
31
- *
32
- * This is the default registry used by `createPostgresAdapter()` and `new PostgresControlAdapter()` when called without a stack-derived registry (e.g. from tests, or one-off scripts that don't compose a full stack).
49
+ * Build a coherent PostgreSQL codec registry populated with built-in descriptors only.
33
50
  *
34
- * Extension codecs (e.g. `pg/vector@1` from `@prisma-next/extension-pgvector`) are intentionally NOT included here: a bare adapter cannot see extensions. Stack-composed paths (`SqlControlAdapterDescriptor.create(stack)` / `SqlRuntimeAdapterDescriptor.create(stack)`) supply the broader, extension-inclusive registry at construction time.
51
+ * The returned registry supports both ordinary codec materialization and PostgreSQL target behavior. Stack-composed paths build the same combined registry from their complete ordered descriptor contributions.
35
52
  */
36
53
  function createPostgresBuiltinCodecLookup() {
37
- return extractCodecLookup([{
38
- id: "postgres-builtin-codecs",
39
- types: { codecTypes: { codecDescriptors: Array.from(postgresCodecRegistry.values()) } }
40
- }]);
54
+ return createPostgresCodecRegistryWithBuiltins();
41
55
  }
42
56
  //#endregion
43
57
  //#region ../../../1-framework/3-tooling/migration/dist/exports/ledger-origin.mjs
@@ -142,11 +156,11 @@ async function execute(lower, driver, query) {
142
156
  //#endregion
143
157
  //#region src/core/sql-renderer.ts
144
158
  /**
145
- * Postgres native types whose unknown-OID parameter inference is reliable in arbitrary expression positions. Parameters bound to a codec whose `meta.db.sql.postgres.nativeType` falls in this set are emitted as plain `$N`; everything else (including `json`, `jsonb`, extension types like `vector`, and unknown user types) is emitted as `$N::<nativeType>` so the planner picks an unambiguous overload.
159
+ * Postgres native types whose unknown-OID parameter inference is reliable in arbitrary expression positions. Parameters bound to a descriptor whose `nativeTypeFor` result falls in this set are emitted as plain `$N`; everything else (including `json`, `jsonb`, extension types like `vector`, and unknown user types) is emitted as `$N::<nativeType>` so the planner picks an unambiguous overload.
146
160
  *
147
161
  * `json` / `jsonb` are intentionally excluded despite being Postgres builtins: their operator overloads make context inference unreliable in expression positions (e.g. `$1 -> 'key'` is ambiguous between the two).
148
162
  *
149
- * Spellings match the on-disk `meta.db.sql.postgres.nativeType` values in `@prisma-next/target-postgres`'s codec definitions, not the `udt_name` abbreviations that ADR 205 used as illustrative shorthand. The lookup-based cast policy compares against these strings directly.
163
+ * Spellings match the target descriptors' `nativeTypeFor` results, not the `udt_name` abbreviations that ADR 205 used as illustrative shorthand. The registry-based cast policy compares against these strings directly.
150
164
  */
151
165
  const POSTGRES_INFERRABLE_NATIVE_TYPES = /* @__PURE__ */ new Set([
152
166
  "integer",
@@ -168,25 +182,21 @@ const POSTGRES_INFERRABLE_NATIVE_TYPES = /* @__PURE__ */ new Set([
168
182
  "bit",
169
183
  "bit varying"
170
184
  ]);
171
- function renderTypedParam(index, codecId, codecLookup, many, typeParams) {
185
+ function renderTypedParam(index, codecId, codecDescriptorRegistry, many, typeParams) {
172
186
  if (codecId === void 0) return `$${index}`;
173
- const meta = codecLookup.metaFor(codecId, typeParams);
174
- if (!(codecLookup.get(codecId) !== void 0 || meta !== void 0 || codecLookup.targetTypesFor(codecId) !== void 0)) throw adapterError("RUNTIME.PARAM_REF_MISSING_CODEC", `Postgres lowering: ParamRef carries codecId "${codecId}" but the assembled codec lookup has no entry for it. This usually indicates a missing extension pack in the runtime stack — register the pack that contributes this codec (e.g. \`extensions: [pgvectorRuntime]\`), or use the codec directly from \`@prisma-next/target-postgres/codecs\` if it's a builtin.`, { meta: { codecId } });
175
- const dbRecord = meta?.db;
176
- const sqlBlock = isRecord(dbRecord) ? dbRecord["sql"] : void 0;
177
- const dialectBlock = isRecord(sqlBlock) ? sqlBlock["postgres"] : void 0;
178
- const nativeType = isRecord(dialectBlock) ? dialectBlock["nativeType"] : void 0;
179
- if (typeof nativeType === "string") {
180
- const arraySuffix = many ? "[]" : "";
181
- if (isPgEnumParams(typeParams)) return `$${index}::${quoteQualifiedName(nativeType)}${arraySuffix}`;
182
- if (!POSTGRES_INFERRABLE_NATIVE_TYPES.has(nativeType)) return `$${index}::${nativeType}${arraySuffix}`;
183
- if (many) return `$${index}::${nativeType}${arraySuffix}`;
184
- }
187
+ const descriptor = codecDescriptorRegistry.descriptorFor(codecId);
188
+ if (descriptor === void 0) throw adapterError("RUNTIME.PARAM_REF_MISSING_CODEC", `Postgres lowering: ParamRef carries codecId "${codecId}" but the validated PostgreSQL codec registry has no entry for it. This usually indicates a missing extension pack in the runtime stack — register the pack that contributes this codec (e.g. \`extensions: [pgvectorRuntime]\`), or use the codec directly from \`@prisma-next/target-postgres/codecs\` if it's a builtin.`, { meta: { codecId } });
189
+ const ref = {
190
+ codecId,
191
+ ...ifDefined("many", many),
192
+ ...ifDefined("typeParams", typeParams)
193
+ };
194
+ const nativeType = descriptor.nativeTypeFor(ref);
195
+ const arraySuffix = many ? "[]" : "";
196
+ if (isPgEnumParams(typeParams)) return `$${index}::${quoteQualifiedName(nativeType)}${arraySuffix}`;
197
+ if (!POSTGRES_INFERRABLE_NATIVE_TYPES.has(nativeType) || many) return `$${index}::${nativeType}${arraySuffix}`;
185
198
  return `$${index}`;
186
199
  }
187
- function isRecord(value) {
188
- return typeof value === "object" && value !== null;
189
- }
190
200
  function unreachableKind(value) {
191
201
  const candidate = value;
192
202
  if (typeof candidate === "object" && candidate !== null && "kind" in candidate && typeof candidate.kind === "string") return candidate.kind;
@@ -197,7 +207,7 @@ function unreachableKind(value) {
197
207
  *
198
208
  * Shared between the runtime (`PostgresAdapterImpl.lower`) and control (`PostgresControlAdapter.lower`) entrypoints so emit-time and run-time paths produce byte-identical output for the same AST.
199
209
  */
200
- function renderLoweredSql(ast, contract, codecLookup) {
210
+ function renderLoweredSql(ast, contract, codecDescriptorRegistry) {
201
211
  const orderedRefs = collectOrderedParamRefs(ast);
202
212
  const indexMap = /* @__PURE__ */ new Map();
203
213
  const params = orderedRefs.map((ref, i) => {
@@ -212,7 +222,7 @@ function renderLoweredSql(ast, contract, codecLookup) {
212
222
  });
213
223
  const pim = {
214
224
  indexMap,
215
- codecLookup
225
+ codecDescriptorRegistry
216
226
  };
217
227
  const node = ast;
218
228
  let sql;
@@ -560,12 +570,12 @@ function renderExpr(expr, contract, pim) {
560
570
  function renderParamRef(ref, pim) {
561
571
  const index = pim.indexMap.get(ref);
562
572
  if (index === void 0) throw new InternalError("ParamRef not found in index map");
563
- if (ref.kind === "prepared-param-ref") return renderTypedParam(index, ref.codec.codecId, pim.codecLookup, ref.codec.many, ref.codec.typeParams);
573
+ if (ref.kind === "prepared-param-ref") return renderTypedParam(index, ref.codec.codecId, pim.codecDescriptorRegistry, ref.codec.many, ref.codec.typeParams);
564
574
  if (ref.codec === void 0) throw runtimeError("RUNTIME.PARAM_REF_MISSING_CODEC", "Postgres renderer: ParamRef reached lowering without a bound CodecRef. Every column-bound ParamRef must carry a codec under the AST-bound codec contract. This usually indicates a builder path that constructed a ParamRef without threading the column codec.", {
565
575
  paramIndex: index,
566
576
  ...ifDefined("name", ref.name)
567
577
  });
568
- return renderTypedParam(index, ref.codec.codecId, pim.codecLookup, ref.codec.many, ref.codec.typeParams);
578
+ return renderTypedParam(index, ref.codec.codecId, pim.codecDescriptorRegistry, ref.codec.many, ref.codec.typeParams);
569
579
  }
570
580
  function renderLiteral(expr) {
571
581
  if (typeof expr.value === "string") return `'${escapeLiteral(expr.value)}'`;
@@ -713,9 +723,9 @@ const POSTGRES_LEDGER_TABLE = "prisma_contract.ledger";
713
723
  * Provides target-specific implementations for control-plane domain actions.
714
724
  */
715
725
  var PostgresControlAdapter = class {
726
+ codecRegistry;
716
727
  familyId = "sql";
717
728
  targetId = "postgres";
718
- codecRegistry;
719
729
  constructor(codecRegistry) {
720
730
  this.codecRegistry = codecRegistry;
721
731
  }
@@ -1894,6 +1904,6 @@ async function pgRenderDdlExecuteRequest(ast, codecLookup) {
1894
1904
  });
1895
1905
  }
1896
1906
  //#endregion
1897
- export { adapterError as i, renderLoweredSql as n, createPostgresBuiltinCodecLookup as r, PostgresControlAdapter as t };
1907
+ export { createPostgresCodecRegistryWithBuiltins as a, createPostgresBuiltinCodecLookup as i, renderLoweredSql as n, adapterError as o, assemblePostgresCodecRegistry as r, PostgresControlAdapter as t };
1898
1908
 
1899
- //# sourceMappingURL=control-adapter-BXXNf5j0.mjs.map
1909
+ //# sourceMappingURL=control-adapter-DyFEWery.mjs.map