@prisma-next/adapter-postgres 0.16.0-dev.33 → 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.
@@ -1 +1 @@
1
- {"version":3,"file":"control.mjs","names":[],"sources":["../src/core/control-mutation-defaults.ts","../src/exports/control.ts"],"sourcesContent":["import type { ExecutionMutationDefaultValue } from '@prisma-next/contract/types';\nimport { timestampNowControlDescriptor } from '@prisma-next/family-sql/control';\nimport type { AuthoringTypeNamespace } from '@prisma-next/framework-components/authoring';\nimport type {\n ControlMutationDefaultEntry,\n DefaultFunctionLoweringContext,\n LoweredDefaultResult,\n MutationDefaultGeneratorDescriptor,\n TypedDefaultFunctionCall,\n} from '@prisma-next/framework-components/control';\nimport { builtinGeneratorRegistryMetadata } from '@prisma-next/ids';\nimport type { FuncCallSig } from '@prisma-next/psl-parser';\nimport { int, num, oneOf, optional, str } from '@prisma-next/psl-parser';\n\nfunction invalidArgumentDiagnostic(input: {\n readonly context: DefaultFunctionLoweringContext;\n readonly span: TypedDefaultFunctionCall['span'];\n readonly message: string;\n}): LoweredDefaultResult {\n return {\n ok: false,\n diagnostic: {\n code: 'PSL_INVALID_DEFAULT_FUNCTION_ARGUMENT',\n message: input.message,\n sourceId: input.context.sourceId,\n span: input.span,\n },\n };\n}\n\nfunction executionGenerator(\n id: ExecutionMutationDefaultValue['id'],\n params?: Record<string, unknown>,\n): LoweredDefaultResult {\n return {\n ok: true,\n value: {\n kind: 'execution',\n generated: {\n kind: 'generator',\n id,\n ...(params ? { params } : {}),\n },\n },\n };\n}\n\nfunction lowerAutoincrement(): LoweredDefaultResult {\n return {\n ok: true,\n value: {\n kind: 'storage',\n defaultValue: { kind: 'function', expression: 'autoincrement()' },\n },\n };\n}\n\nfunction lowerNow(): LoweredDefaultResult {\n return {\n ok: true,\n value: {\n kind: 'storage',\n defaultValue: { kind: 'function', expression: 'now()' },\n },\n };\n}\n\nfunction lowerUlid(): LoweredDefaultResult {\n return executionGenerator('ulid');\n}\n\nfunction lowerUuid(input: {\n readonly call: TypedDefaultFunctionCall;\n readonly context: DefaultFunctionLoweringContext;\n}): LoweredDefaultResult {\n return input.call.args['version'] === 7\n ? executionGenerator('uuidv7')\n : executionGenerator('uuidv4');\n}\n\nfunction lowerCuid(): LoweredDefaultResult {\n return executionGenerator('cuid2');\n}\n\nfunction lowerNanoid(input: {\n readonly call: TypedDefaultFunctionCall;\n readonly context: DefaultFunctionLoweringContext;\n}): LoweredDefaultResult {\n const size = input.call.args['size'];\n return typeof size === 'number'\n ? executionGenerator('nanoid', { size })\n : executionGenerator('nanoid');\n}\n\nfunction lowerDbgenerated(input: {\n readonly call: TypedDefaultFunctionCall;\n readonly context: DefaultFunctionLoweringContext;\n}): LoweredDefaultResult {\n const expression = input.call.args['expression'];\n if (typeof expression !== 'string' || expression.trim().length === 0) {\n return invalidArgumentDiagnostic({\n context: input.context,\n span: input.call.span,\n message: 'Default function \"dbgenerated\" argument cannot be empty.',\n });\n }\n return {\n ok: true,\n value: {\n kind: 'storage',\n defaultValue: { kind: 'function', expression },\n },\n };\n}\n\nconst nowSig: FuncCallSig = {};\nconst autoincrementSig: FuncCallSig = {};\nconst ulidSig: FuncCallSig = {};\nconst uuidSig: FuncCallSig = {\n positional: [{ key: 'version', type: optional(oneOf(num(4), num(7))) }],\n};\nconst cuidSig: FuncCallSig = { positional: [{ key: 'version', type: num(2) }] };\nconst nanoidSig: FuncCallSig = {\n positional: [{ key: 'size', type: optional(int({ min: 2, max: 255 })) }],\n};\nconst dbgeneratedSig: FuncCallSig = { positional: [{ key: 'expression', type: str() }] };\n\nconst postgresDefaultFunctionRegistryEntries = [\n [\n 'autoincrement',\n {\n signature: autoincrementSig,\n lower: lowerAutoincrement,\n usageSignatures: ['autoincrement()'],\n },\n ],\n ['now', { signature: nowSig, lower: lowerNow, usageSignatures: ['now()'] }],\n [\n 'uuid',\n { signature: uuidSig, lower: lowerUuid, usageSignatures: ['uuid()', 'uuid(4)', 'uuid(7)'] },\n ],\n ['cuid', { signature: cuidSig, lower: lowerCuid, usageSignatures: ['cuid(2)'] }],\n ['ulid', { signature: ulidSig, lower: lowerUlid, usageSignatures: ['ulid()'] }],\n [\n 'nanoid',\n { signature: nanoidSig, lower: lowerNanoid, usageSignatures: ['nanoid()', 'nanoid(<2-255>)'] },\n ],\n [\n 'dbgenerated',\n { signature: dbgeneratedSig, lower: lowerDbgenerated, usageSignatures: ['dbgenerated(\"...\")'] },\n ],\n] satisfies ReadonlyArray<readonly [string, ControlMutationDefaultEntry]>;\n\n/**\n * The base PSL scalars as zero-arg type constructors in the unified authoring\n * channel, with explicit `nativeType` values pinned to the codec manifests\n * (`codecLookup.targetTypesFor(codecId)[0]`).\n *\n * The type position is the only storage decider: a mutation-default generator\n * (`@default(uuid())`) never re-picks a column's storage.\n */\nexport const postgresScalarAuthoringTypes = {\n String: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/text@1', nativeType: 'text' },\n },\n Boolean: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/bool@1', nativeType: 'bool' },\n },\n Int: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/int4@1', nativeType: 'int4' },\n },\n BigInt: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/int8@1', nativeType: 'int8' },\n },\n Float: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/float8@1', nativeType: 'float8' },\n },\n Decimal: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/numeric@1', nativeType: 'numeric' },\n },\n DateTime: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/timestamptz@1', nativeType: 'timestamptz' },\n },\n Json: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/json@1', nativeType: 'json' },\n },\n Jsonb: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/jsonb@1', nativeType: 'jsonb' },\n },\n Bytes: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/bytea@1', nativeType: 'bytea' },\n },\n} as const satisfies AuthoringTypeNamespace;\n\nexport const postgresNativeAuthoringTypes = {\n VarChar: {\n kind: 'typeConstructor',\n args: [{ kind: 'number', name: 'length', integer: true, minimum: 1, optional: true }],\n output: {\n codecId: 'sql/varchar@1',\n nativeType: 'character varying',\n typeParams: { length: { kind: 'arg', index: 0 } },\n },\n },\n Char: {\n kind: 'typeConstructor',\n args: [{ kind: 'number', name: 'length', integer: true, minimum: 1, optional: true }],\n output: {\n codecId: 'sql/char@1',\n nativeType: 'character',\n typeParams: { length: { kind: 'arg', index: 0 } },\n },\n },\n Numeric: {\n kind: 'typeConstructor',\n args: [\n { kind: 'number', name: 'precision', integer: true, minimum: 1, optional: true },\n { kind: 'number', name: 'scale', integer: true, minimum: 0, optional: true },\n ],\n output: {\n codecId: 'pg/numeric@1',\n nativeType: 'numeric',\n typeParams: {\n precision: { kind: 'arg', index: 0 },\n scale: { kind: 'arg', index: 1 },\n },\n },\n },\n Timestamp: {\n kind: 'typeConstructor',\n args: [{ kind: 'number', name: 'precision', integer: true, minimum: 0, optional: true }],\n output: {\n codecId: 'pg/timestamp@1',\n nativeType: 'timestamp',\n typeParams: { precision: { kind: 'arg', index: 0 } },\n },\n },\n Timestamptz: {\n kind: 'typeConstructor',\n args: [{ kind: 'number', name: 'precision', integer: true, minimum: 0, optional: true }],\n output: {\n codecId: 'pg/timestamptz@1',\n nativeType: 'timestamptz',\n typeParams: { precision: { kind: 'arg', index: 0 } },\n },\n },\n Time: {\n kind: 'typeConstructor',\n args: [{ kind: 'number', name: 'precision', integer: true, minimum: 0, optional: true }],\n output: {\n codecId: 'pg/time@1',\n nativeType: 'time',\n typeParams: { precision: { kind: 'arg', index: 0 } },\n },\n },\n Timetz: {\n kind: 'typeConstructor',\n args: [{ kind: 'number', name: 'precision', integer: true, minimum: 0, optional: true }],\n output: {\n codecId: 'pg/timetz@1',\n nativeType: 'timetz',\n typeParams: { precision: { kind: 'arg', index: 0 } },\n },\n },\n Uuid: { kind: 'typeConstructor', output: { codecId: 'pg/uuid@1', nativeType: 'uuid' } },\n Inet: { kind: 'typeConstructor', output: { codecId: 'pg/inet@1', nativeType: 'inet' } },\n SmallInt: { kind: 'typeConstructor', output: { codecId: 'pg/int2@1', nativeType: 'int2' } },\n Real: { kind: 'typeConstructor', output: { codecId: 'pg/float4@1', nativeType: 'float4' } },\n Date: { kind: 'typeConstructor', output: { codecId: 'pg/date@1', nativeType: 'date' } },\n} as const satisfies AuthoringTypeNamespace;\n\nexport const postgresAuthoringTypes = {\n ...postgresScalarAuthoringTypes,\n ...postgresNativeAuthoringTypes,\n} as const satisfies AuthoringTypeNamespace;\n\nexport function createPostgresDefaultFunctionRegistry(): ReadonlyMap<\n string,\n ControlMutationDefaultEntry\n> {\n return new Map(postgresDefaultFunctionRegistryEntries);\n}\n\nexport function createPostgresMutationDefaultGeneratorDescriptors(): readonly MutationDefaultGeneratorDescriptor[] {\n return [\n ...builtinGeneratorRegistryMetadata.map(\n ({ id, applicableCodecIds }): MutationDefaultGeneratorDescriptor => ({\n id,\n applicableCodecIds,\n }),\n ),\n timestampNowControlDescriptor(),\n ];\n}\n","import type { SqlControlAdapterDescriptor } from '@prisma-next/family-sql/control';\nimport type { SqlControlAdapter } from '@prisma-next/family-sql/control-adapter';\nimport {\n escapeLiteral,\n qualifyName,\n quoteIdentifier,\n} from '@prisma-next/target-postgres/sql-utils';\nimport { PostgresControlAdapter } from '../core/control-adapter';\nimport {\n createPostgresDefaultFunctionRegistry,\n createPostgresMutationDefaultGeneratorDescriptors,\n postgresAuthoringTypes,\n} from '../core/control-mutation-defaults';\nimport { postgresAdapterDescriptorMeta } from '../core/descriptor-meta';\n\nconst postgresAdapterDescriptor: SqlControlAdapterDescriptor<'postgres'> = {\n ...postgresAdapterDescriptorMeta,\n authoring: { type: postgresAuthoringTypes, valueObjectStorageType: 'Jsonb' },\n controlMutationDefaults: {\n defaultFunctionRegistry: createPostgresDefaultFunctionRegistry(),\n generatorDescriptors: createPostgresMutationDefaultGeneratorDescriptors(),\n },\n create(stack): SqlControlAdapter<'postgres'> {\n return new PostgresControlAdapter(stack.codecLookup);\n },\n};\n\nexport default postgresAdapterDescriptor;\n\nexport { parsePostgresDefault } from '@prisma-next/target-postgres/default-normalizer';\nexport { normalizeSchemaNativeType } from '@prisma-next/target-postgres/native-type-normalizer';\nexport { createPostgresBuiltinCodecLookup } from '../core/codec-lookup';\nexport { PostgresControlAdapter } from '../core/control-adapter';\nexport { escapeLiteral, qualifyName, quoteIdentifier };\n"],"mappings":";;;;;;;;;AAcA,SAAS,0BAA0B,OAIV;CACvB,OAAO;EACL,IAAI;EACJ,YAAY;GACV,MAAM;GACN,SAAS,MAAM;GACf,UAAU,MAAM,QAAQ;GACxB,MAAM,MAAM;EACd;CACF;AACF;AAEA,SAAS,mBACP,IACA,QACsB;CACtB,OAAO;EACL,IAAI;EACJ,OAAO;GACL,MAAM;GACN,WAAW;IACT,MAAM;IACN;IACA,GAAI,SAAS,EAAE,OAAO,IAAI,CAAC;GAC7B;EACF;CACF;AACF;AAEA,SAAS,qBAA2C;CAClD,OAAO;EACL,IAAI;EACJ,OAAO;GACL,MAAM;GACN,cAAc;IAAE,MAAM;IAAY,YAAY;GAAkB;EAClE;CACF;AACF;AAEA,SAAS,WAAiC;CACxC,OAAO;EACL,IAAI;EACJ,OAAO;GACL,MAAM;GACN,cAAc;IAAE,MAAM;IAAY,YAAY;GAAQ;EACxD;CACF;AACF;AAEA,SAAS,YAAkC;CACzC,OAAO,mBAAmB,MAAM;AAClC;AAEA,SAAS,UAAU,OAGM;CACvB,OAAO,MAAM,KAAK,KAAK,eAAe,IAClC,mBAAmB,QAAQ,IAC3B,mBAAmB,QAAQ;AACjC;AAEA,SAAS,YAAkC;CACzC,OAAO,mBAAmB,OAAO;AACnC;AAEA,SAAS,YAAY,OAGI;CACvB,MAAM,OAAO,MAAM,KAAK,KAAK;CAC7B,OAAO,OAAO,SAAS,WACnB,mBAAmB,UAAU,EAAE,KAAK,CAAC,IACrC,mBAAmB,QAAQ;AACjC;AAEA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SAAS;GAAM,SAAS;GAAG,UAAU;EAAK,CAAC;EACvF,QAAQ;GACN,SAAS;GACT,YAAY;GACZ,YAAY,EAAE,WAAW;IAAE,MAAM;IAAO,OAAO;GAAE,EAAE;EACrD;CACF;CACA,MAAM;EAAE,MAAM;EAAmB,QAAQ;GAAE,SAAS;GAAa,YAAY;EAAO;CAAE;CACtF,MAAM;EAAE,MAAM;EAAmB,QAAQ;GAAE,SAAS;GAAa,YAAY;EAAO;CAAE;CACtF,UAAU;EAAE,MAAM;EAAmB,QAAQ;GAAE,SAAS;GAAa,YAAY;EAAO;CAAE;CAC1F,MAAM;EAAE,MAAM;EAAmB,QAAQ;GAAE,SAAS;GAAe,YAAY;EAAS;CAAE;CAC1F,MAAM;EAAE,MAAM;EAAmB,QAAQ;GAAE,SAAS;GAAa,YAAY;EAAO;CAAE;AACxF;AAEA,MAAa,yBAAyB;CACpC,GAAG;CACH,GAAG;AACL;AAEA,SAAgB,wCAGd;CACA,OAAO,IAAI,IAAI,sCAAsC;AACvD;AAEA,SAAgB,oDAAmG;CACjH,OAAO,CACL,GAAG,iCAAiC,KACjC,EAAE,IAAI,0BAA8D;EACnE;EACA;CACF,EACF,GACA,8BAA8B,CAChC;AACF;;;AChSA,MAAM,4BAAqE;CACzE,GAAG;CACH,WAAW;EAAE,MAAM;EAAwB,wBAAwB;CAAQ;CAC3E,yBAAyB;EACvB,yBAAyB,sCAAsC;EAC/D,sBAAsB,kDAAkD;CAC1E;CACA,OAAO,OAAsC;EAC3C,OAAO,IAAI,uBAAuB,MAAM,WAAW;CACrD;AACF"}
1
+ {"version":3,"file":"control.mjs","names":[],"sources":["../src/core/control-mutation-defaults.ts","../src/exports/control.ts"],"sourcesContent":["import type { ExecutionMutationDefaultValue } from '@prisma-next/contract/types';\nimport { timestampNowControlDescriptor } from '@prisma-next/family-sql/control';\nimport type { AuthoringTypeNamespace } from '@prisma-next/framework-components/authoring';\nimport type {\n ControlMutationDefaultEntry,\n DefaultFunctionLoweringContext,\n LoweredDefaultResult,\n MutationDefaultGeneratorDescriptor,\n TypedDefaultFunctionCall,\n} from '@prisma-next/framework-components/control';\nimport { builtinGeneratorRegistryMetadata } from '@prisma-next/ids';\nimport type { FuncCallSig } from '@prisma-next/psl-parser';\nimport { int, num, oneOf, optional, str } from '@prisma-next/psl-parser';\n\nfunction invalidArgumentDiagnostic(input: {\n readonly context: DefaultFunctionLoweringContext;\n readonly span: TypedDefaultFunctionCall['span'];\n readonly message: string;\n}): LoweredDefaultResult {\n return {\n ok: false,\n diagnostic: {\n code: 'PSL_INVALID_DEFAULT_FUNCTION_ARGUMENT',\n message: input.message,\n sourceId: input.context.sourceId,\n span: input.span,\n },\n };\n}\n\nfunction executionGenerator(\n id: ExecutionMutationDefaultValue['id'],\n params?: Record<string, unknown>,\n): LoweredDefaultResult {\n return {\n ok: true,\n value: {\n kind: 'execution',\n generated: {\n kind: 'generator',\n id,\n ...(params ? { params } : {}),\n },\n },\n };\n}\n\nfunction lowerAutoincrement(): LoweredDefaultResult {\n return {\n ok: true,\n value: {\n kind: 'storage',\n defaultValue: { kind: 'function', expression: 'autoincrement()' },\n },\n };\n}\n\nfunction lowerNow(): LoweredDefaultResult {\n return {\n ok: true,\n value: {\n kind: 'storage',\n defaultValue: { kind: 'function', expression: 'now()' },\n },\n };\n}\n\nfunction lowerUlid(): LoweredDefaultResult {\n return executionGenerator('ulid');\n}\n\nfunction lowerUuid(input: {\n readonly call: TypedDefaultFunctionCall;\n readonly context: DefaultFunctionLoweringContext;\n}): LoweredDefaultResult {\n return input.call.args['version'] === 7\n ? executionGenerator('uuidv7')\n : executionGenerator('uuidv4');\n}\n\nfunction lowerCuid(): LoweredDefaultResult {\n return executionGenerator('cuid2');\n}\n\nfunction lowerNanoid(input: {\n readonly call: TypedDefaultFunctionCall;\n readonly context: DefaultFunctionLoweringContext;\n}): LoweredDefaultResult {\n const size = input.call.args['size'];\n return typeof size === 'number'\n ? executionGenerator('nanoid', { size })\n : executionGenerator('nanoid');\n}\n\nfunction lowerDbgenerated(input: {\n readonly call: TypedDefaultFunctionCall;\n readonly context: DefaultFunctionLoweringContext;\n}): LoweredDefaultResult {\n const expression = input.call.args['expression'];\n if (typeof expression !== 'string' || expression.trim().length === 0) {\n return invalidArgumentDiagnostic({\n context: input.context,\n span: input.call.span,\n message: 'Default function \"dbgenerated\" argument cannot be empty.',\n });\n }\n return {\n ok: true,\n value: {\n kind: 'storage',\n defaultValue: { kind: 'function', expression },\n },\n };\n}\n\nconst nowSig: FuncCallSig = {};\nconst autoincrementSig: FuncCallSig = {};\nconst ulidSig: FuncCallSig = {};\nconst uuidSig: FuncCallSig = {\n positional: [{ key: 'version', type: optional(oneOf(num(4), num(7))) }],\n};\nconst cuidSig: FuncCallSig = { positional: [{ key: 'version', type: num(2) }] };\nconst nanoidSig: FuncCallSig = {\n positional: [{ key: 'size', type: optional(int({ min: 2, max: 255 })) }],\n};\nconst dbgeneratedSig: FuncCallSig = { positional: [{ key: 'expression', type: str() }] };\n\nconst postgresDefaultFunctionRegistryEntries = [\n [\n 'autoincrement',\n {\n signature: autoincrementSig,\n lower: lowerAutoincrement,\n usageSignatures: ['autoincrement()'],\n },\n ],\n ['now', { signature: nowSig, lower: lowerNow, usageSignatures: ['now()'] }],\n [\n 'uuid',\n { signature: uuidSig, lower: lowerUuid, usageSignatures: ['uuid()', 'uuid(4)', 'uuid(7)'] },\n ],\n ['cuid', { signature: cuidSig, lower: lowerCuid, usageSignatures: ['cuid(2)'] }],\n ['ulid', { signature: ulidSig, lower: lowerUlid, usageSignatures: ['ulid()'] }],\n [\n 'nanoid',\n { signature: nanoidSig, lower: lowerNanoid, usageSignatures: ['nanoid()', 'nanoid(<2-255>)'] },\n ],\n [\n 'dbgenerated',\n { signature: dbgeneratedSig, lower: lowerDbgenerated, usageSignatures: ['dbgenerated(\"...\")'] },\n ],\n] satisfies ReadonlyArray<readonly [string, ControlMutationDefaultEntry]>;\n\n/**\n * The base PSL scalars as zero-arg type constructors in the unified authoring\n * channel, with explicit `nativeType` values pinned to the codec manifests\n * (`codecLookup.targetTypesFor(codecId)[0]`).\n *\n * The type position is the only storage decider: a mutation-default generator\n * (`@default(uuid())`) never re-picks a column's storage.\n */\nexport const postgresScalarAuthoringTypes = {\n String: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/text@1', nativeType: 'text' },\n },\n Boolean: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/bool@1', nativeType: 'bool' },\n },\n Int: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/int4@1', nativeType: 'int4' },\n },\n BigInt: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/int8@1', nativeType: 'int8' },\n },\n Float: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/float8@1', nativeType: 'float8' },\n },\n Decimal: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/numeric@1', nativeType: 'numeric' },\n },\n DateTime: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/timestamptz@1', nativeType: 'timestamptz' },\n },\n Json: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/json@1', nativeType: 'json' },\n },\n Jsonb: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/jsonb@1', nativeType: 'jsonb' },\n },\n Bytes: {\n kind: 'typeConstructor',\n output: { codecId: 'pg/bytea@1', nativeType: 'bytea' },\n },\n} as const satisfies AuthoringTypeNamespace;\n\nexport const postgresNativeAuthoringTypes = {\n VarChar: {\n kind: 'typeConstructor',\n args: [{ kind: 'number', name: 'length', integer: true, minimum: 1, optional: true }],\n output: {\n codecId: 'sql/varchar@1',\n nativeType: 'character varying',\n typeParams: { length: { kind: 'arg', index: 0 } },\n },\n },\n Char: {\n kind: 'typeConstructor',\n args: [{ kind: 'number', name: 'length', integer: true, minimum: 1, optional: true }],\n output: {\n codecId: 'sql/char@1',\n nativeType: 'character',\n typeParams: { length: { kind: 'arg', index: 0 } },\n },\n },\n Numeric: {\n kind: 'typeConstructor',\n args: [\n { kind: 'number', name: 'precision', integer: true, minimum: 1, optional: true },\n { kind: 'number', name: 'scale', integer: true, minimum: 0, optional: true },\n ],\n output: {\n codecId: 'pg/numeric@1',\n nativeType: 'numeric',\n typeParams: {\n precision: { kind: 'arg', index: 0 },\n scale: { kind: 'arg', index: 1 },\n },\n },\n },\n Timestamp: {\n kind: 'typeConstructor',\n args: [{ kind: 'number', name: 'precision', integer: true, minimum: 0, optional: true }],\n output: {\n codecId: 'pg/timestamp@1',\n nativeType: 'timestamp',\n typeParams: { precision: { kind: 'arg', index: 0 } },\n },\n },\n Timestamptz: {\n kind: 'typeConstructor',\n args: [{ kind: 'number', name: 'precision', integer: true, minimum: 0, optional: true }],\n output: {\n codecId: 'pg/timestamptz@1',\n nativeType: 'timestamptz',\n typeParams: { precision: { kind: 'arg', index: 0 } },\n },\n },\n Time: {\n kind: 'typeConstructor',\n args: [{ kind: 'number', name: 'precision', integer: true, minimum: 0, optional: true }],\n output: {\n codecId: 'pg/time@1',\n nativeType: 'time',\n typeParams: { precision: { kind: 'arg', index: 0 } },\n },\n },\n Timetz: {\n kind: 'typeConstructor',\n args: [{ kind: 'number', name: 'precision', integer: true, minimum: 0, optional: true }],\n output: {\n codecId: 'pg/timetz@1',\n nativeType: 'timetz',\n typeParams: { precision: { kind: 'arg', index: 0 } },\n },\n },\n Uuid: { kind: 'typeConstructor', output: { codecId: 'pg/uuid@1', nativeType: 'uuid' } },\n Inet: { kind: 'typeConstructor', output: { codecId: 'pg/inet@1', nativeType: 'inet' } },\n SmallInt: { kind: 'typeConstructor', output: { codecId: 'pg/int2@1', nativeType: 'int2' } },\n Real: { kind: 'typeConstructor', output: { codecId: 'pg/float4@1', nativeType: 'float4' } },\n Date: { kind: 'typeConstructor', output: { codecId: 'pg/date@1', nativeType: 'date' } },\n} as const satisfies AuthoringTypeNamespace;\n\nexport const postgresAuthoringTypes = {\n ...postgresScalarAuthoringTypes,\n ...postgresNativeAuthoringTypes,\n} as const satisfies AuthoringTypeNamespace;\n\nexport function createPostgresDefaultFunctionRegistry(): ReadonlyMap<\n string,\n ControlMutationDefaultEntry\n> {\n return new Map(postgresDefaultFunctionRegistryEntries);\n}\n\nexport function createPostgresMutationDefaultGeneratorDescriptors(): readonly MutationDefaultGeneratorDescriptor[] {\n return [\n ...builtinGeneratorRegistryMetadata.map(\n ({ id, applicableCodecIds }): MutationDefaultGeneratorDescriptor => ({\n id,\n applicableCodecIds,\n }),\n ),\n timestampNowControlDescriptor(),\n ];\n}\n","import type { SqlControlAdapterDescriptor } from '@prisma-next/family-sql/control';\nimport type { SqlControlAdapter } from '@prisma-next/family-sql/control-adapter';\nimport {\n escapeLiteral,\n qualifyName,\n quoteIdentifier,\n} from '@prisma-next/target-postgres/sql-utils';\nimport { assemblePostgresCodecRegistry } from '../core/codec-lookup';\nimport { PostgresControlAdapter } from '../core/control-adapter';\nimport {\n createPostgresDefaultFunctionRegistry,\n createPostgresMutationDefaultGeneratorDescriptors,\n postgresAuthoringTypes,\n} from '../core/control-mutation-defaults';\nimport { postgresAdapterDescriptorMeta } from '../core/descriptor-meta';\n\nconst postgresAdapterDescriptor: SqlControlAdapterDescriptor<'postgres'> = {\n ...postgresAdapterDescriptorMeta,\n authoring: { type: postgresAuthoringTypes, valueObjectStorageType: 'Jsonb' },\n controlMutationDefaults: {\n defaultFunctionRegistry: createPostgresDefaultFunctionRegistry(),\n generatorDescriptors: createPostgresMutationDefaultGeneratorDescriptors(),\n },\n create(stack): SqlControlAdapter<'postgres'> {\n const components = [\n stack.target,\n ...(stack.adapter === undefined ? [] : [stack.adapter]),\n ...stack.extensions,\n ];\n const codecRegistry = assemblePostgresCodecRegistry(components);\n return new PostgresControlAdapter(codecRegistry);\n },\n};\n\nexport default postgresAdapterDescriptor;\n\nexport { parsePostgresDefault } from '@prisma-next/target-postgres/default-normalizer';\nexport { normalizeSchemaNativeType } from '@prisma-next/target-postgres/native-type-normalizer';\nexport {\n createPostgresBuiltinCodecLookup,\n createPostgresCodecRegistryWithBuiltins,\n} from '../core/codec-lookup';\nexport { PostgresControlAdapter } from '../core/control-adapter';\nexport { escapeLiteral, qualifyName, quoteIdentifier };\n"],"mappings":";;;;;;;;;AAcA,SAAS,0BAA0B,OAIV;CACvB,OAAO;EACL,IAAI;EACJ,YAAY;GACV,MAAM;GACN,SAAS,MAAM;GACf,UAAU,MAAM,QAAQ;GACxB,MAAM,MAAM;EACd;CACF;AACF;AAEA,SAAS,mBACP,IACA,QACsB;CACtB,OAAO;EACL,IAAI;EACJ,OAAO;GACL,MAAM;GACN,WAAW;IACT,MAAM;IACN;IACA,GAAI,SAAS,EAAE,OAAO,IAAI,CAAC;GAC7B;EACF;CACF;AACF;AAEA,SAAS,qBAA2C;CAClD,OAAO;EACL,IAAI;EACJ,OAAO;GACL,MAAM;GACN,cAAc;IAAE,MAAM;IAAY,YAAY;GAAkB;EAClE;CACF;AACF;AAEA,SAAS,WAAiC;CACxC,OAAO;EACL,IAAI;EACJ,OAAO;GACL,MAAM;GACN,cAAc;IAAE,MAAM;IAAY,YAAY;GAAQ;EACxD;CACF;AACF;AAEA,SAAS,YAAkC;CACzC,OAAO,mBAAmB,MAAM;AAClC;AAEA,SAAS,UAAU,OAGM;CACvB,OAAO,MAAM,KAAK,KAAK,eAAe,IAClC,mBAAmB,QAAQ,IAC3B,mBAAmB,QAAQ;AACjC;AAEA,SAAS,YAAkC;CACzC,OAAO,mBAAmB,OAAO;AACnC;AAEA,SAAS,YAAY,OAGI;CACvB,MAAM,OAAO,MAAM,KAAK,KAAK;CAC7B,OAAO,OAAO,SAAS,WACnB,mBAAmB,UAAU,EAAE,KAAK,CAAC,IACrC,mBAAmB,QAAQ;AACjC;AAEA,SAAS,iBAAiB,OAGD;CACvB,MAAM,aAAa,MAAM,KAAK,KAAK;CACnC,IAAI,OAAO,eAAe,YAAY,WAAW,KAAK,CAAC,CAAC,WAAW,GACjE,OAAO,0BAA0B;EAC/B,SAAS,MAAM;EACf,MAAM,MAAM,KAAK;EACjB,SAAS;CACX,CAAC;CAEH,OAAO;EACL,IAAI;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,MAAM;EAAE,MAAM;EAAmB,QAAQ;GAAE,SAAS;GAAa,YAAY;EAAO;CAAE;CACtF,UAAU;EAAE,MAAM;EAAmB,QAAQ;GAAE,SAAS;GAAa,YAAY;EAAO;CAAE;CAC1F,MAAM;EAAE,MAAM;EAAmB,QAAQ;GAAE,SAAS;GAAe,YAAY;EAAS;CAAE;CAC1F,MAAM;EAAE,MAAM;EAAmB,QAAQ;GAAE,SAAS;GAAa,YAAY;EAAO;CAAE;AACxF;AAEA,MAAa,yBAAyB;CACpC,GAAG;CACH,GAAG;AACL;AAEA,SAAgB,wCAGd;CACA,OAAO,IAAI,IAAI,sCAAsC;AACvD;AAEA,SAAgB,oDAAmG;CACjH,OAAO,CACL,GAAG,iCAAiC,KACjC,EAAE,IAAI,0BAA8D;EACnE;EACA;CACF,EACF,GACA,8BAA8B,CAChC;AACF;;;AC/RA,MAAM,4BAAqE;CACzE,GAAG;CACH,WAAW;EAAE,MAAM;EAAwB,wBAAwB;CAAQ;CAC3E,yBAAyB;EACvB,yBAAyB,sCAAsC;EAC/D,sBAAsB,kDAAkD;CAC1E;CACA,OAAO,OAAsC;EAO3C,OAAO,IAAI,uBADW,8BAA8B;GAJlD,MAAM;GACN,GAAI,MAAM,YAAY,KAAA,IAAY,CAAC,IAAI,CAAC,MAAM,OAAO;GACrD,GAAG,MAAM;EAEkD,CACf,CAAC;CACjD;AACF"}
@@ -1,4 +1,4 @@
1
- import { i as adapterError } from "./control-adapter-BXXNf5j0.mjs";
1
+ import { o as adapterError } from "./control-adapter-DyFEWery.mjs";
2
2
  import { postgresCodecRegistry } from "@prisma-next/target-postgres/codecs";
3
3
  import { PG_BIT_CODEC_ID, PG_BOOL_CODEC_ID, PG_BYTEA_CODEC_ID, PG_CHAR_CODEC_ID, PG_FLOAT4_CODEC_ID, PG_FLOAT8_CODEC_ID, PG_FLOAT_CODEC_ID, PG_INET_CODEC_ID, PG_INT2_CODEC_ID, PG_INT4_CODEC_ID, PG_INT8_CODEC_ID, PG_INTERVAL_CODEC_ID, PG_INT_CODEC_ID, PG_JSONB_CODEC_ID, PG_JSON_CODEC_ID, PG_NUMERIC_CODEC_ID, PG_TEXT_CODEC_ID, PG_TIMESTAMPTZ_CODEC_ID, PG_TIMESTAMP_CODEC_ID, PG_TIMETZ_CODEC_ID, PG_TIME_CODEC_ID, PG_UUID_CODEC_ID, PG_VARBIT_CODEC_ID, PG_VARCHAR_CODEC_ID, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID } from "@prisma-next/target-postgres/codec-ids";
4
4
  import { buildOperation, toExpr } from "@prisma-next/sql-relational-core/expression";
@@ -348,4 +348,4 @@ const postgresAdapterDescriptorMeta = {
348
348
  //#endregion
349
349
  export { postgresQueryOperations as n, postgresAdapterDescriptorMeta as t };
350
350
 
351
- //# sourceMappingURL=descriptor-meta-Cu9d9eO7.mjs.map
351
+ //# sourceMappingURL=descriptor-meta-B8SNPesh.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"descriptor-meta-Cu9d9eO7.mjs","names":[],"sources":["../src/core/descriptor-meta.ts"],"sourcesContent":["import type { CodecControlHooks, ExpandNativeTypeInput } from '@prisma-next/family-sql/control';\nimport {\n buildOperation,\n type CodecExpression,\n type Expression,\n type TraitExpression,\n toExpr,\n} from '@prisma-next/sql-relational-core/expression';\nimport {\n PG_BIT_CODEC_ID,\n PG_BOOL_CODEC_ID,\n PG_BYTEA_CODEC_ID,\n PG_CHAR_CODEC_ID,\n PG_FLOAT_CODEC_ID,\n PG_FLOAT4_CODEC_ID,\n PG_FLOAT8_CODEC_ID,\n PG_INET_CODEC_ID,\n PG_INT_CODEC_ID,\n PG_INT2_CODEC_ID,\n PG_INT4_CODEC_ID,\n PG_INT8_CODEC_ID,\n PG_INTERVAL_CODEC_ID,\n PG_JSON_CODEC_ID,\n PG_JSONB_CODEC_ID,\n PG_NUMERIC_CODEC_ID,\n PG_TEXT_CODEC_ID,\n PG_TIME_CODEC_ID,\n PG_TIMESTAMP_CODEC_ID,\n PG_TIMESTAMPTZ_CODEC_ID,\n PG_TIMETZ_CODEC_ID,\n PG_UUID_CODEC_ID,\n PG_VARBIT_CODEC_ID,\n PG_VARCHAR_CODEC_ID,\n SQL_CHAR_CODEC_ID,\n SQL_FLOAT_CODEC_ID,\n SQL_INT_CODEC_ID,\n SQL_TEXT_CODEC_ID,\n SQL_TIMESTAMP_CODEC_ID,\n SQL_VARCHAR_CODEC_ID,\n} from '@prisma-next/target-postgres/codec-ids';\nimport { postgresCodecRegistry } from '@prisma-next/target-postgres/codecs';\nimport type { QueryOperationTypes } from '../types/operation-types';\nimport { adapterError } from './adapter-errors';\n\n// ============================================================================ Helper functions for reducing boilerplate ============================================================================\n\n/** Creates a type import spec for codec types */\nconst codecTypeImport = (named: string) =>\n ({\n package: '@prisma-next/target-postgres/codec-types',\n named,\n alias: named,\n }) as const;\n\nfunction isPositiveInteger(value: unknown): value is number {\n return (\n typeof value === 'number' && Number.isFinite(value) && Number.isInteger(value) && value > 0\n );\n}\n\nfunction isNonNegativeInteger(value: unknown): value is number {\n return (\n typeof value === 'number' && Number.isFinite(value) && Number.isInteger(value) && value >= 0\n );\n}\n\nfunction expandLength({ nativeType, typeParams }: ExpandNativeTypeInput): string {\n if (!typeParams || !('length' in typeParams)) {\n return nativeType;\n }\n const length = typeParams['length'];\n if (!isPositiveInteger(length)) {\n throw adapterError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `Invalid \"length\" type parameter for \"${nativeType}\": expected a positive integer, got ${JSON.stringify(length)}`,\n { meta: { nativeType, param: 'length', received: length } },\n );\n }\n return `${nativeType}(${length})`;\n}\n\nfunction expandPrecision({ nativeType, typeParams }: ExpandNativeTypeInput): string {\n if (!typeParams || !('precision' in typeParams)) {\n return nativeType;\n }\n const precision = typeParams['precision'];\n if (!isPositiveInteger(precision)) {\n throw adapterError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `Invalid \"precision\" type parameter for \"${nativeType}\": expected a positive integer, got ${JSON.stringify(precision)}`,\n { meta: { nativeType, param: 'precision', received: precision } },\n );\n }\n return `${nativeType}(${precision})`;\n}\n\nfunction expandNumeric({ nativeType, typeParams }: ExpandNativeTypeInput): string {\n const hasPrecision = typeParams && 'precision' in typeParams;\n const hasScale = typeParams && 'scale' in typeParams;\n\n if (!hasPrecision && !hasScale) {\n return nativeType;\n }\n\n if (!hasPrecision && hasScale) {\n throw adapterError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `Invalid type parameters for \"${nativeType}\": \"scale\" requires \"precision\" to be specified`,\n { meta: { nativeType, param: 'scale' } },\n );\n }\n\n if (hasPrecision) {\n const precision = typeParams['precision'];\n if (!isPositiveInteger(precision)) {\n throw adapterError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `Invalid \"precision\" type parameter for \"${nativeType}\": expected a positive integer, got ${JSON.stringify(precision)}`,\n { meta: { nativeType, param: 'precision', received: precision } },\n );\n }\n if (hasScale) {\n const scale = typeParams['scale'];\n if (!isNonNegativeInteger(scale)) {\n throw adapterError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `Invalid \"scale\" type parameter for \"${nativeType}\": expected a non-negative integer, got ${JSON.stringify(scale)}`,\n { meta: { nativeType, param: 'scale', received: scale } },\n );\n }\n return `${nativeType}(${precision},${scale})`;\n }\n return `${nativeType}(${precision})`;\n }\n\n return nativeType;\n}\n\nconst lengthHooks: CodecControlHooks = { expandNativeType: expandLength };\nconst precisionHooks: CodecControlHooks = { expandNativeType: expandPrecision };\nconst numericHooks: CodecControlHooks = { expandNativeType: expandNumeric };\nconst identityHooks: CodecControlHooks = { expandNativeType: ({ nativeType }) => nativeType };\n\n// ============================================================================ Descriptor metadata ============================================================================\n\ntype CodecTypesBase = Record<string, { readonly input: unknown; readonly output: unknown }>;\n\nexport function postgresQueryOperations<CT extends CodecTypesBase>(): QueryOperationTypes<CT> {\n return {\n ilike: {\n self: { traits: ['textual'] },\n impl: (\n self: TraitExpression<readonly ['textual'], false, CT>,\n pattern: CodecExpression<'pg/text@1', false, CT>,\n ): Expression<{ codecId: 'pg/bool@1'; nullable: false }> => {\n return buildOperation({\n method: 'ilike',\n args: [toExpr(self), toExpr(pattern, { codecId: PG_TEXT_CODEC_ID })],\n returns: { codecId: PG_BOOL_CODEC_ID, nullable: false },\n lowering: { targetFamily: 'sql', strategy: 'infix', template: '{{self}} ILIKE {{arg0}}' },\n });\n },\n },\n };\n}\n\nexport const postgresAdapterDescriptorMeta = {\n kind: 'adapter',\n familyId: 'sql',\n targetId: 'postgres',\n id: 'postgres',\n version: '0.0.1',\n capabilities: {\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 types: {\n codecTypes: {\n codecDescriptors: Array.from(postgresCodecRegistry.values()),\n import: {\n package: '@prisma-next/target-postgres/codec-types',\n named: 'CodecTypes',\n alias: 'PgTypes',\n },\n typeImports: [\n {\n package: '@prisma-next/target-postgres/codec-types',\n named: 'JsonValue',\n alias: 'JsonValue',\n },\n codecTypeImport('Char'),\n codecTypeImport('Varchar'),\n codecTypeImport('Numeric'),\n codecTypeImport('Bit'),\n codecTypeImport('VarBit'),\n codecTypeImport('Timestamp'),\n codecTypeImport('Timestamptz'),\n codecTypeImport('Time'),\n codecTypeImport('Timetz'),\n codecTypeImport('Interval'),\n ],\n controlPlaneHooks: {\n [SQL_CHAR_CODEC_ID]: lengthHooks,\n [SQL_VARCHAR_CODEC_ID]: lengthHooks,\n [SQL_TIMESTAMP_CODEC_ID]: precisionHooks,\n [PG_CHAR_CODEC_ID]: lengthHooks,\n [PG_VARCHAR_CODEC_ID]: lengthHooks,\n [PG_NUMERIC_CODEC_ID]: numericHooks,\n [PG_BIT_CODEC_ID]: lengthHooks,\n [PG_VARBIT_CODEC_ID]: lengthHooks,\n [PG_TIMESTAMP_CODEC_ID]: precisionHooks,\n [PG_TIMESTAMPTZ_CODEC_ID]: precisionHooks,\n [PG_TIME_CODEC_ID]: precisionHooks,\n [PG_TIMETZ_CODEC_ID]: precisionHooks,\n [PG_INTERVAL_CODEC_ID]: precisionHooks,\n [PG_JSON_CODEC_ID]: identityHooks,\n [PG_JSONB_CODEC_ID]: identityHooks,\n [PG_BYTEA_CODEC_ID]: identityHooks,\n [PG_UUID_CODEC_ID]: identityHooks,\n [PG_INET_CODEC_ID]: identityHooks,\n },\n },\n storage: [\n { typeId: PG_TEXT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'text' },\n { typeId: SQL_TEXT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'text' },\n { typeId: SQL_CHAR_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'character' },\n {\n typeId: SQL_VARCHAR_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'character varying',\n },\n { typeId: SQL_INT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'int4' },\n { typeId: SQL_FLOAT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'float8' },\n {\n typeId: SQL_TIMESTAMP_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'timestamp',\n },\n { typeId: PG_CHAR_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'character' },\n {\n typeId: PG_VARCHAR_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'character varying',\n },\n { typeId: PG_INT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'int4' },\n { typeId: PG_FLOAT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'float8' },\n { typeId: PG_INT4_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'int4' },\n { typeId: PG_INT2_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'int2' },\n { typeId: PG_INT8_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'int8' },\n { typeId: PG_FLOAT4_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'float4' },\n { typeId: PG_FLOAT8_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'float8' },\n { typeId: PG_NUMERIC_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'numeric' },\n {\n typeId: PG_TIMESTAMP_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'timestamp',\n },\n {\n typeId: PG_TIMESTAMPTZ_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'timestamptz',\n },\n { typeId: PG_TIME_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'time' },\n { typeId: PG_TIMETZ_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'timetz' },\n { typeId: PG_BOOL_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'bool' },\n { typeId: PG_BIT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'bit' },\n {\n typeId: PG_VARBIT_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'bit varying',\n },\n {\n typeId: PG_INTERVAL_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'interval',\n },\n { typeId: PG_JSON_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'json' },\n { typeId: PG_JSONB_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'jsonb' },\n { typeId: PG_BYTEA_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'bytea' },\n { typeId: PG_UUID_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'uuid' },\n { typeId: PG_INET_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'inet' },\n ],\n queryOperationTypes: {\n import: {\n package: '@prisma-next/adapter-post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;GACxF;IAAE,QAAQ;IAAmB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAQ;GACxF;IAAE,QAAQ;IAAkB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAO;GACtF;IAAE,QAAQ;IAAkB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAO;EACxF;EACA,qBAAqB,EACnB,QAAQ;GACN,SAAS;GACT,OAAO;GACP,OAAO;EACT,EACF;CACF;AACF"}
1
+ {"version":3,"file":"descriptor-meta-B8SNPesh.mjs","names":[],"sources":["../src/core/descriptor-meta.ts"],"sourcesContent":["import type { CodecControlHooks, ExpandNativeTypeInput } from '@prisma-next/family-sql/control';\nimport {\n buildOperation,\n type CodecExpression,\n type Expression,\n type TraitExpression,\n toExpr,\n} from '@prisma-next/sql-relational-core/expression';\nimport {\n PG_BIT_CODEC_ID,\n PG_BOOL_CODEC_ID,\n PG_BYTEA_CODEC_ID,\n PG_CHAR_CODEC_ID,\n PG_FLOAT_CODEC_ID,\n PG_FLOAT4_CODEC_ID,\n PG_FLOAT8_CODEC_ID,\n PG_INET_CODEC_ID,\n PG_INT_CODEC_ID,\n PG_INT2_CODEC_ID,\n PG_INT4_CODEC_ID,\n PG_INT8_CODEC_ID,\n PG_INTERVAL_CODEC_ID,\n PG_JSON_CODEC_ID,\n PG_JSONB_CODEC_ID,\n PG_NUMERIC_CODEC_ID,\n PG_TEXT_CODEC_ID,\n PG_TIME_CODEC_ID,\n PG_TIMESTAMP_CODEC_ID,\n PG_TIMESTAMPTZ_CODEC_ID,\n PG_TIMETZ_CODEC_ID,\n PG_UUID_CODEC_ID,\n PG_VARBIT_CODEC_ID,\n PG_VARCHAR_CODEC_ID,\n SQL_CHAR_CODEC_ID,\n SQL_FLOAT_CODEC_ID,\n SQL_INT_CODEC_ID,\n SQL_TEXT_CODEC_ID,\n SQL_TIMESTAMP_CODEC_ID,\n SQL_VARCHAR_CODEC_ID,\n} from '@prisma-next/target-postgres/codec-ids';\nimport { postgresCodecRegistry } from '@prisma-next/target-postgres/codecs';\nimport type { QueryOperationTypes } from '../types/operation-types';\nimport { adapterError } from './adapter-errors';\n\n// ============================================================================ Helper functions for reducing boilerplate ============================================================================\n\n/** Creates a type import spec for codec types */\nconst codecTypeImport = (named: string) =>\n ({\n package: '@prisma-next/target-postgres/codec-types',\n named,\n alias: named,\n }) as const;\n\nfunction isPositiveInteger(value: unknown): value is number {\n return (\n typeof value === 'number' && Number.isFinite(value) && Number.isInteger(value) && value > 0\n );\n}\n\nfunction isNonNegativeInteger(value: unknown): value is number {\n return (\n typeof value === 'number' && Number.isFinite(value) && Number.isInteger(value) && value >= 0\n );\n}\n\nfunction expandLength({ nativeType, typeParams }: ExpandNativeTypeInput): string {\n if (!typeParams || !('length' in typeParams)) {\n return nativeType;\n }\n const length = typeParams['length'];\n if (!isPositiveInteger(length)) {\n throw adapterError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `Invalid \"length\" type parameter for \"${nativeType}\": expected a positive integer, got ${JSON.stringify(length)}`,\n { meta: { nativeType, param: 'length', received: length } },\n );\n }\n return `${nativeType}(${length})`;\n}\n\nfunction expandPrecision({ nativeType, typeParams }: ExpandNativeTypeInput): string {\n if (!typeParams || !('precision' in typeParams)) {\n return nativeType;\n }\n const precision = typeParams['precision'];\n if (!isPositiveInteger(precision)) {\n throw adapterError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `Invalid \"precision\" type parameter for \"${nativeType}\": expected a positive integer, got ${JSON.stringify(precision)}`,\n { meta: { nativeType, param: 'precision', received: precision } },\n );\n }\n return `${nativeType}(${precision})`;\n}\n\nfunction expandNumeric({ nativeType, typeParams }: ExpandNativeTypeInput): string {\n const hasPrecision = typeParams && 'precision' in typeParams;\n const hasScale = typeParams && 'scale' in typeParams;\n\n if (!hasPrecision && !hasScale) {\n return nativeType;\n }\n\n if (!hasPrecision && hasScale) {\n throw adapterError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `Invalid type parameters for \"${nativeType}\": \"scale\" requires \"precision\" to be specified`,\n { meta: { nativeType, param: 'scale' } },\n );\n }\n\n if (hasPrecision) {\n const precision = typeParams['precision'];\n if (!isPositiveInteger(precision)) {\n throw adapterError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `Invalid \"precision\" type parameter for \"${nativeType}\": expected a positive integer, got ${JSON.stringify(precision)}`,\n { meta: { nativeType, param: 'precision', received: precision } },\n );\n }\n if (hasScale) {\n const scale = typeParams['scale'];\n if (!isNonNegativeInteger(scale)) {\n throw adapterError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `Invalid \"scale\" type parameter for \"${nativeType}\": expected a non-negative integer, got ${JSON.stringify(scale)}`,\n { meta: { nativeType, param: 'scale', received: scale } },\n );\n }\n return `${nativeType}(${precision},${scale})`;\n }\n return `${nativeType}(${precision})`;\n }\n\n return nativeType;\n}\n\nconst lengthHooks: CodecControlHooks = { expandNativeType: expandLength };\nconst precisionHooks: CodecControlHooks = { expandNativeType: expandPrecision };\nconst numericHooks: CodecControlHooks = { expandNativeType: expandNumeric };\nconst identityHooks: CodecControlHooks = { expandNativeType: ({ nativeType }) => nativeType };\n\n// ============================================================================ Descriptor metadata ============================================================================\n\ntype CodecTypesBase = Record<string, { readonly input: unknown; readonly output: unknown }>;\n\nexport function postgresQueryOperations<CT extends CodecTypesBase>(): QueryOperationTypes<CT> {\n return {\n ilike: {\n self: { traits: ['textual'] },\n impl: (\n self: TraitExpression<readonly ['textual'], false, CT>,\n pattern: CodecExpression<'pg/text@1', false, CT>,\n ): Expression<{ codecId: 'pg/bool@1'; nullable: false }> => {\n return buildOperation({\n method: 'ilike',\n args: [toExpr(self), toExpr(pattern, { codecId: PG_TEXT_CODEC_ID })],\n returns: { codecId: PG_BOOL_CODEC_ID, nullable: false },\n lowering: { targetFamily: 'sql', strategy: 'infix', template: '{{self}} ILIKE {{arg0}}' },\n });\n },\n },\n };\n}\n\nexport const postgresAdapterDescriptorMeta = {\n kind: 'adapter',\n familyId: 'sql',\n targetId: 'postgres',\n id: 'postgres',\n version: '0.0.1',\n capabilities: {\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 types: {\n codecTypes: {\n codecDescriptors: Array.from(postgresCodecRegistry.values()),\n import: {\n package: '@prisma-next/target-postgres/codec-types',\n named: 'CodecTypes',\n alias: 'PgTypes',\n },\n typeImports: [\n {\n package: '@prisma-next/target-postgres/codec-types',\n named: 'JsonValue',\n alias: 'JsonValue',\n },\n codecTypeImport('Char'),\n codecTypeImport('Varchar'),\n codecTypeImport('Numeric'),\n codecTypeImport('Bit'),\n codecTypeImport('VarBit'),\n codecTypeImport('Timestamp'),\n codecTypeImport('Timestamptz'),\n codecTypeImport('Time'),\n codecTypeImport('Timetz'),\n codecTypeImport('Interval'),\n ],\n controlPlaneHooks: {\n [SQL_CHAR_CODEC_ID]: lengthHooks,\n [SQL_VARCHAR_CODEC_ID]: lengthHooks,\n [SQL_TIMESTAMP_CODEC_ID]: precisionHooks,\n [PG_CHAR_CODEC_ID]: lengthHooks,\n [PG_VARCHAR_CODEC_ID]: lengthHooks,\n [PG_NUMERIC_CODEC_ID]: numericHooks,\n [PG_BIT_CODEC_ID]: lengthHooks,\n [PG_VARBIT_CODEC_ID]: lengthHooks,\n [PG_TIMESTAMP_CODEC_ID]: precisionHooks,\n [PG_TIMESTAMPTZ_CODEC_ID]: precisionHooks,\n [PG_TIME_CODEC_ID]: precisionHooks,\n [PG_TIMETZ_CODEC_ID]: precisionHooks,\n [PG_INTERVAL_CODEC_ID]: precisionHooks,\n [PG_JSON_CODEC_ID]: identityHooks,\n [PG_JSONB_CODEC_ID]: identityHooks,\n [PG_BYTEA_CODEC_ID]: identityHooks,\n [PG_UUID_CODEC_ID]: identityHooks,\n [PG_INET_CODEC_ID]: identityHooks,\n },\n },\n storage: [\n { typeId: PG_TEXT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'text' },\n { typeId: SQL_TEXT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'text' },\n { typeId: SQL_CHAR_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'character' },\n {\n typeId: SQL_VARCHAR_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'character varying',\n },\n { typeId: SQL_INT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'int4' },\n { typeId: SQL_FLOAT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'float8' },\n {\n typeId: SQL_TIMESTAMP_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'timestamp',\n },\n { typeId: PG_CHAR_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'character' },\n {\n typeId: PG_VARCHAR_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'character varying',\n },\n { typeId: PG_INT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'int4' },\n { typeId: PG_FLOAT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'float8' },\n { typeId: PG_INT4_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'int4' },\n { typeId: PG_INT2_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'int2' },\n { typeId: PG_INT8_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'int8' },\n { typeId: PG_FLOAT4_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'float4' },\n { typeId: PG_FLOAT8_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'float8' },\n { typeId: PG_NUMERIC_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'numeric' },\n {\n typeId: PG_TIMESTAMP_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'timestamp',\n },\n {\n typeId: PG_TIMESTAMPTZ_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'timestamptz',\n },\n { typeId: PG_TIME_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'time' },\n { typeId: PG_TIMETZ_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'timetz' },\n { typeId: PG_BOOL_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'bool' },\n { typeId: PG_BIT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'bit' },\n {\n typeId: PG_VARBIT_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'bit varying',\n },\n {\n typeId: PG_INTERVAL_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'interval',\n },\n { typeId: PG_JSON_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'json' },\n { typeId: PG_JSONB_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'jsonb' },\n { typeId: PG_BYTEA_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'bytea' },\n { typeId: PG_UUID_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'uuid' },\n { typeId: PG_INET_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'inet' },\n ],\n queryOperationTypes: {\n import: {\n package: '@prisma-next/adapter-postgres/operation-types',\n named: 'QueryOperationTypes',\n alias: 'PgAdapterQueryOps',\n },\n },\n },\n} as const;\n"],"mappings":";;;;;;AA+CA,MAAM,mBAAmB,WACtB;CACC,SAAS;CACT;CACA,OAAO;AACT;AAEF,SAAS,kBAAkB,OAAiC;CAC1D,OACE,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,OAAO,UAAU,KAAK,KAAK,QAAQ;AAE9F;AAEA,SAAS,qBAAqB,OAAiC;CAC7D,OACE,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,OAAO,UAAU,KAAK,KAAK,SAAS;AAE/F;AAEA,SAAS,aAAa,E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IAAkB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAO;GACtF;IAAE,QAAQ;IAAoB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAS;GAC1F;IAAE,QAAQ;IAAoB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAS;GAC1F;IAAE,QAAQ;IAAqB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAU;GAC5F;IACE,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACd;GACA;IACE,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACd;GACA;IAAE,QAAQ;IAAkB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAO;GACtF;IAAE,QAAQ;IAAoB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAS;GAC1F;IAAE,QAAQ;IAAkB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAO;GACtF;IAAE,QAAQ;IAAiB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAM;GACpF;IACE,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACd;GACA;IACE,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACd;GACA;IAAE,QAAQ;IAAkB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAO;GACtF;IAAE,QAAQ;IAAmB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAQ;GACxF;IAAE,QAAQ;IAAmB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAQ;GACxF;IAAE,QAAQ;IAAkB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAO;GACtF;IAAE,QAAQ;IAAkB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAO;EACxF;EACA,qBAAqB,EACnB,QAAQ;GACN,SAAS;GACT,OAAO;GACP,OAAO;EACT,EACF;CACF;AACF"}
@@ -1,4 +1,4 @@
1
- import { c as PostgresContract, l as PostgresLoweredStatement } from "./types-DyNEvnRB.mjs";
1
+ import { l as PostgresContract, u as PostgresLoweredStatement } from "./types-BcBENDAr.mjs";
2
2
  import { Adapter, AnyQueryAst } from "@prisma-next/sql-relational-core/ast";
3
3
  import { SqlRuntimeAdapterDescriptor } from "@prisma-next/sql-runtime";
4
4
  import { RuntimeAdapterInstance } from "@prisma-next/framework-components/execution";
package/dist/runtime.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { n as postgresRawCodecInferer, t as createPostgresAdapter } from "./adapter-CZfCp5TH.mjs";
2
- import { n as postgresQueryOperations, t as postgresAdapterDescriptorMeta } from "./descriptor-meta-Cu9d9eO7.mjs";
3
- import { extractCodecLookup } from "@prisma-next/framework-components/control";
1
+ import { r as assemblePostgresCodecRegistry } from "./control-adapter-DyFEWery.mjs";
2
+ import { n as createPostgresAdapterWithCodecRegistry, r as postgresRawCodecInferer } from "./adapter-CyErVYXZ.mjs";
3
+ import { n as postgresQueryOperations, t as postgresAdapterDescriptorMeta } from "./descriptor-meta-B8SNPesh.mjs";
4
4
  import { postgresCodecRegistry } from "@prisma-next/target-postgres/codecs";
5
5
  import { builtinGeneratorIds } from "@prisma-next/ids";
6
6
  import { timestampNowRuntimeGenerator } from "@prisma-next/family-sql/runtime";
@@ -25,11 +25,11 @@ const postgresRuntimeAdapterDescriptor = {
25
25
  mutationDefaultGenerators: createPostgresMutationDefaultGenerators,
26
26
  rawCodecInferer: postgresRawCodecInferer,
27
27
  create(stack) {
28
- return createPostgresAdapter({ codecLookup: extractCodecLookup([
28
+ return createPostgresAdapterWithCodecRegistry(assemblePostgresCodecRegistry([
29
29
  stack.target,
30
30
  stack.adapter,
31
31
  ...stack.extensions
32
- ]) });
32
+ ]));
33
33
  }
34
34
  };
35
35
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.mjs","names":[],"sources":["../src/exports/runtime.ts"],"sourcesContent":["import type { GeneratedValueSpec } from '@prisma-next/contract/types';\nimport { timestampNowRuntimeGenerator } from '@prisma-next/family-sql/runtime';\nimport { extractCodecLookup } from '@prisma-next/framework-components/control';\nimport type { RuntimeAdapterInstance } from '@prisma-next/framework-components/execution';\nimport { builtinGeneratorIds } from '@prisma-next/ids';\nimport { generateId } from '@prisma-next/ids/runtime';\nimport type { Adapter, AnyQueryAst } from '@prisma-next/sql-relational-core/ast';\nimport type { SqlRuntimeAdapterDescriptor } from '@prisma-next/sql-runtime';\nimport { postgresCodecRegistry } from '@prisma-next/target-postgres/codecs';\nimport { createPostgresAdapter, postgresRawCodecInferer } from '../core/adapter';\nimport { postgresAdapterDescriptorMeta, postgresQueryOperations } from '../core/descriptor-meta';\nimport type { PostgresContract, PostgresLoweredStatement } from '../core/types';\n\nexport interface SqlRuntimeAdapter\n extends RuntimeAdapterInstance<'sql', 'postgres'>,\n Adapter<AnyQueryAst, PostgresContract, PostgresLoweredStatement> {}\n\nfunction createPostgresMutationDefaultGenerators() {\n return [\n ...builtinGeneratorIds.map((id) => ({\n id,\n generate: (params?: Record<string, unknown>) => {\n const spec: GeneratedValueSpec = params ? { id, params } : { id };\n return generateId(spec);\n },\n stability: 'field' as const,\n })),\n timestampNowRuntimeGenerator(),\n ];\n}\n\nconst postgresRuntimeAdapterDescriptor: SqlRuntimeAdapterDescriptor<'postgres', SqlRuntimeAdapter> =\n {\n ...postgresAdapterDescriptorMeta,\n codecs: () => Array.from(postgresCodecRegistry.values()),\n queryOperations: () => postgresQueryOperations(),\n mutationDefaultGenerators: createPostgresMutationDefaultGenerators,\n rawCodecInferer: postgresRawCodecInferer,\n create(stack): SqlRuntimeAdapter {\n // The runtime `ExecutionStack` does not (yet) carry a pre-assembled `codecLookup` field the way the control `ControlStack` does, so we derive an equivalent lookup here from the stack's component metadata (target + adapter + extension packs) using the same assembly helper that `createControlStack` uses. This keeps the renderer fed with the same codec set on both planes — including extension-contributed codecs like\n // `pg/vector@1` from `@prisma-next/extension-pgvector`.\n const components = [stack.target, stack.adapter, ...stack.extensions];\n const codecLookup = extractCodecLookup(components);\n return createPostgresAdapter({ codecLookup });\n },\n };\n\nexport default postgresRuntimeAdapterDescriptor;\n"],"mappings":";;;;;;;;AAiBA,SAAS,0CAA0C;CACjD,OAAO,CACL,GAAG,oBAAoB,KAAK,QAAQ;EAClC;EACA,WAAW,WAAqC;GAE9C,OAAO,WAD0B,SAAS;IAAE;IAAI;GAAO,IAAI,EAAE,GAAG,CAC1C;EACxB;EACA,WAAW;CACb,EAAE,GACF,6BAA6B,CAC/B;AACF;AAEA,MAAM,mCACJ;CACE,GAAG;CACH,cAAc,MAAM,KAAK,sBAAsB,OAAO,CAAC;CACvD,uBAAuB,wBAAwB;CAC/C,2BAA2B;CAC3B,iBAAiB;CACjB,OAAO,OAA0B;EAK/B,OAAO,sBAAsB,EAAE,aADX,mBAAmB;GADnB,MAAM;GAAQ,MAAM;GAAS,GAAG,MAAM;EACV,CACP,EAAE,CAAC;CAC9C;AACF"}
1
+ {"version":3,"file":"runtime.mjs","names":[],"sources":["../src/exports/runtime.ts"],"sourcesContent":["import type { GeneratedValueSpec } from '@prisma-next/contract/types';\nimport { timestampNowRuntimeGenerator } from '@prisma-next/family-sql/runtime';\nimport type { RuntimeAdapterInstance } from '@prisma-next/framework-components/execution';\nimport { builtinGeneratorIds } from '@prisma-next/ids';\nimport { generateId } from '@prisma-next/ids/runtime';\nimport type { Adapter, AnyQueryAst } from '@prisma-next/sql-relational-core/ast';\nimport type { SqlRuntimeAdapterDescriptor } from '@prisma-next/sql-runtime';\nimport { postgresCodecRegistry } from '@prisma-next/target-postgres/codecs';\nimport { createPostgresAdapterWithCodecRegistry, postgresRawCodecInferer } from '../core/adapter';\nimport { assemblePostgresCodecRegistry } from '../core/codec-lookup';\nimport { postgresAdapterDescriptorMeta, postgresQueryOperations } from '../core/descriptor-meta';\nimport type { PostgresContract, PostgresLoweredStatement } from '../core/types';\n\nexport interface SqlRuntimeAdapter\n extends RuntimeAdapterInstance<'sql', 'postgres'>,\n Adapter<AnyQueryAst, PostgresContract, PostgresLoweredStatement> {}\n\nfunction createPostgresMutationDefaultGenerators() {\n return [\n ...builtinGeneratorIds.map((id) => ({\n id,\n generate: (params?: Record<string, unknown>) => {\n const spec: GeneratedValueSpec = params ? { id, params } : { id };\n return generateId(spec);\n },\n stability: 'field' as const,\n })),\n timestampNowRuntimeGenerator(),\n ];\n}\n\nconst postgresRuntimeAdapterDescriptor: SqlRuntimeAdapterDescriptor<'postgres', SqlRuntimeAdapter> =\n {\n ...postgresAdapterDescriptorMeta,\n codecs: () => Array.from(postgresCodecRegistry.values()),\n queryOperations: () => postgresQueryOperations(),\n mutationDefaultGenerators: createPostgresMutationDefaultGenerators,\n rawCodecInferer: postgresRawCodecInferer,\n create(stack): SqlRuntimeAdapter {\n const components = [stack.target, stack.adapter, ...stack.extensions];\n const codecRegistry = assemblePostgresCodecRegistry(components);\n return createPostgresAdapterWithCodecRegistry(codecRegistry);\n },\n };\n\nexport default postgresRuntimeAdapterDescriptor;\n"],"mappings":";;;;;;;;AAiBA,SAAS,0CAA0C;CACjD,OAAO,CACL,GAAG,oBAAoB,KAAK,QAAQ;EAClC;EACA,WAAW,WAAqC;GAE9C,OAAO,WAD0B,SAAS;IAAE;IAAI;GAAO,IAAI,EAAE,GAAG,CAC1C;EACxB;EACA,WAAW;CACb,EAAE,GACF,6BAA6B,CAC/B;AACF;AAEA,MAAM,mCACJ;CACE,GAAG;CACH,cAAc,MAAM,KAAK,sBAAsB,OAAO,CAAC;CACvD,uBAAuB,wBAAwB;CAC/C,2BAA2B;CAC3B,iBAAiB;CACjB,OAAO,OAA0B;EAG/B,OAAO,uCADe,8BAA8B;GADhC,MAAM;GAAQ,MAAM;GAAS,GAAG,MAAM;EACG,CACH,CAAC;CAC7D;AACF"}
@@ -0,0 +1,25 @@
1
+ import { BinaryExpr, ColumnRef, DefaultValueExpr, Direction, LoweredStatement, ParamRef, SelectAst } from "@prisma-next/sql-relational-core/ast";
2
+ import { AnyPostgresCodecDescriptor, PostgresCodecDescriptorRegistry } from "@prisma-next/target-postgres/codec-descriptor";
3
+ import { PostgresContract } from "@prisma-next/target-postgres/types";
4
+ import { CodecRegistry } from "@prisma-next/framework-components/codec";
5
+ import { StorageColumn, StorageTable } from "@prisma-next/sql-contract/types";
6
+ //#region src/core/types.d.ts
7
+ type PostgresCodecRegistry = CodecRegistry & PostgresCodecDescriptorRegistry;
8
+ interface PostgresAdapterOptions {
9
+ readonly profileId?: string;
10
+ /**
11
+ * Custom PostgreSQL codec descriptors contributed alongside the built-ins.
12
+ * The complete descriptor set is validated at construction and becomes the
13
+ * single source for both codec materialization and target-specific lowering.
14
+ */
15
+ readonly codecDescriptors?: readonly AnyPostgresCodecDescriptor[];
16
+ }
17
+ type Expr = ColumnRef | ParamRef | DefaultValueExpr;
18
+ interface OrderClause {
19
+ readonly expr: ColumnRef;
20
+ readonly dir: Direction;
21
+ }
22
+ type PostgresLoweredStatement = LoweredStatement;
23
+ //#endregion
24
+ export { OrderClause as a, PostgresCodecRegistry as c, SelectAst as d, StorageColumn as f, Expr as i, PostgresContract as l, ColumnRef as n, ParamRef as o, StorageTable as p, Direction as r, PostgresAdapterOptions as s, BinaryExpr as t, PostgresLoweredStatement as u };
25
+ //# sourceMappingURL=types-BcBENDAr.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-BcBENDAr.d.mts","names":[],"sources":["../src/core/types.ts"],"mappings":";;;;;;KAuBY,wBAAwB,gBAAgB;UAEnC;WACN;;;;;;WAMA,4BAA4B;;KAK3B,OAAO,YAAY,WAAW;UAEzB;WACN,MAAM;WACN,KAAK;;KAGJ,2BAA2B"}
package/dist/types.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as OrderClause, c as PostgresContract, d as StorageColumn, f as StorageTable, i as Expr, l as PostgresLoweredStatement, n as ColumnRef, o as ParamRef, r as Direction, s as PostgresAdapterOptions, t as BinaryExpr, u as SelectAst } from "./types-DyNEvnRB.mjs";
2
- export type { BinaryExpr, ColumnRef, Direction, Expr, OrderClause, ParamRef, PostgresAdapterOptions, PostgresContract, PostgresLoweredStatement, SelectAst, StorageColumn, StorageTable };
1
+ import { a as OrderClause, c as PostgresCodecRegistry, d as SelectAst, f as StorageColumn, i as Expr, l as PostgresContract, n as ColumnRef, o as ParamRef, p as StorageTable, r as Direction, s as PostgresAdapterOptions, t as BinaryExpr, u as PostgresLoweredStatement } from "./types-BcBENDAr.mjs";
2
+ export type { BinaryExpr, ColumnRef, Direction, Expr, OrderClause, ParamRef, PostgresAdapterOptions, PostgresCodecRegistry, PostgresContract, PostgresLoweredStatement, SelectAst, StorageColumn, StorageTable };
package/package.json CHANGED
@@ -1,35 +1,35 @@
1
1
  {
2
2
  "name": "@prisma-next/adapter-postgres",
3
- "version": "0.16.0-dev.33",
3
+ "version": "0.16.0-dev.34",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "dependencies": {
8
- "@prisma-next/contract": "0.16.0-dev.33",
9
- "@prisma-next/contract-authoring": "0.16.0-dev.33",
10
- "@prisma-next/errors": "0.16.0-dev.33",
11
- "@prisma-next/family-sql": "0.16.0-dev.33",
12
- "@prisma-next/framework-components": "0.16.0-dev.33",
13
- "@prisma-next/ids": "0.16.0-dev.33",
14
- "@prisma-next/psl-parser": "0.16.0-dev.33",
15
- "@prisma-next/sql-contract": "0.16.0-dev.33",
16
- "@prisma-next/sql-contract-psl": "0.16.0-dev.33",
17
- "@prisma-next/sql-contract-ts": "0.16.0-dev.33",
18
- "@prisma-next/sql-operations": "0.16.0-dev.33",
19
- "@prisma-next/sql-relational-core": "0.16.0-dev.33",
20
- "@prisma-next/sql-runtime": "0.16.0-dev.33",
21
- "@prisma-next/sql-schema-ir": "0.16.0-dev.33",
22
- "@prisma-next/target-postgres": "0.16.0-dev.33",
23
- "@prisma-next/utils": "0.16.0-dev.33",
8
+ "@prisma-next/contract": "0.16.0-dev.34",
9
+ "@prisma-next/contract-authoring": "0.16.0-dev.34",
10
+ "@prisma-next/errors": "0.16.0-dev.34",
11
+ "@prisma-next/family-sql": "0.16.0-dev.34",
12
+ "@prisma-next/framework-components": "0.16.0-dev.34",
13
+ "@prisma-next/ids": "0.16.0-dev.34",
14
+ "@prisma-next/psl-parser": "0.16.0-dev.34",
15
+ "@prisma-next/sql-contract": "0.16.0-dev.34",
16
+ "@prisma-next/sql-contract-psl": "0.16.0-dev.34",
17
+ "@prisma-next/sql-contract-ts": "0.16.0-dev.34",
18
+ "@prisma-next/sql-operations": "0.16.0-dev.34",
19
+ "@prisma-next/sql-relational-core": "0.16.0-dev.34",
20
+ "@prisma-next/sql-runtime": "0.16.0-dev.34",
21
+ "@prisma-next/sql-schema-ir": "0.16.0-dev.34",
22
+ "@prisma-next/target-postgres": "0.16.0-dev.34",
23
+ "@prisma-next/utils": "0.16.0-dev.34",
24
24
  "arktype": "^2.2.2"
25
25
  },
26
26
  "devDependencies": {
27
- "@prisma-next/cli": "0.16.0-dev.33",
28
- "@prisma-next/driver-postgres": "0.16.0-dev.33",
29
- "@prisma-next/migration-tools": "0.16.0-dev.33",
30
- "@prisma-next/test-utils": "0.16.0-dev.33",
31
- "@prisma-next/tsconfig": "0.16.0-dev.33",
32
- "@prisma-next/tsdown": "0.16.0-dev.33",
27
+ "@prisma-next/cli": "0.16.0-dev.34",
28
+ "@prisma-next/driver-postgres": "0.16.0-dev.34",
29
+ "@prisma-next/migration-tools": "0.16.0-dev.34",
30
+ "@prisma-next/test-utils": "0.16.0-dev.34",
31
+ "@prisma-next/tsconfig": "0.16.0-dev.34",
32
+ "@prisma-next/tsdown": "0.16.0-dev.34",
33
33
  "pathe": "^2.0.3",
34
34
  "tsdown": "0.22.8",
35
35
  "typescript": "5.9.3",
@@ -1,4 +1,3 @@
1
- import type { CodecRegistry } from '@prisma-next/framework-components/codec';
2
1
  import { APP_SPACE_ID } from '@prisma-next/framework-components/control';
3
2
  import type {
4
3
  Adapter,
@@ -12,10 +11,15 @@ import { isDdlNode } from '@prisma-next/sql-relational-core/ast';
12
11
  import type { RawCodecInferer } from '@prisma-next/sql-relational-core/expression';
13
12
  import type { PostgresDdlNode } from '@prisma-next/target-postgres/ddl';
14
13
  import { adapterError } from './adapter-errors';
15
- import { createPostgresBuiltinCodecLookup } from './codec-lookup';
14
+ import { createPostgresCodecRegistryWithBuiltins } from './codec-lookup';
16
15
  import { PostgresControlAdapter } from './control-adapter';
17
16
  import { renderLoweredSql } from './sql-renderer';
18
- import type { PostgresAdapterOptions, PostgresContract, PostgresLoweredStatement } from './types';
17
+ import type {
18
+ PostgresAdapterOptions,
19
+ PostgresCodecRegistry,
20
+ PostgresContract,
21
+ PostgresLoweredStatement,
22
+ } from './types';
19
23
 
20
24
  const defaultCapabilities = Object.freeze({
21
25
  postgres: {
@@ -43,13 +47,13 @@ class PostgresAdapterImpl
43
47
  readonly targetId = 'postgres' as const;
44
48
 
45
49
  readonly profile: AdapterProfile<'postgres'>;
46
- private readonly codecLookup: CodecRegistry;
50
+ private readonly codecRegistry: PostgresCodecRegistry;
47
51
 
48
- constructor(options?: PostgresAdapterOptions) {
49
- this.codecLookup = options?.codecLookup ?? createPostgresBuiltinCodecLookup();
50
- const controlAdapter = new PostgresControlAdapter(this.codecLookup);
52
+ constructor(codecRegistry: PostgresCodecRegistry, profileId?: string) {
53
+ this.codecRegistry = codecRegistry;
54
+ const controlAdapter = new PostgresControlAdapter(codecRegistry);
51
55
  this.profile = Object.freeze({
52
- id: options?.profileId ?? 'postgres/default@1',
56
+ id: profileId ?? 'postgres/default@1',
53
57
  target: 'postgres',
54
58
  capabilities: defaultCapabilities,
55
59
  readMarker: (queryable: SqlQueryable) =>
@@ -82,7 +86,7 @@ class PostgresAdapterImpl
82
86
  { meta: { surface: 'runtime-adapter' } },
83
87
  );
84
88
  }
85
- return renderLoweredSql(ast, context.contract, this.codecLookup);
89
+ return renderLoweredSql(ast, context.contract, this.codecRegistry);
86
90
  }
87
91
  }
88
92
 
@@ -110,5 +114,10 @@ export const postgresRawCodecInferer: RawCodecInferer = {
110
114
  };
111
115
 
112
116
  export function createPostgresAdapter(options?: PostgresAdapterOptions) {
113
- return Object.freeze(new PostgresAdapterImpl(options));
117
+ const codecRegistry = createPostgresCodecRegistryWithBuiltins(options?.codecDescriptors);
118
+ return Object.freeze(new PostgresAdapterImpl(codecRegistry, options?.profileId));
119
+ }
120
+
121
+ export function createPostgresAdapterWithCodecRegistry(codecRegistry: PostgresCodecRegistry) {
122
+ return Object.freeze(new PostgresAdapterImpl(codecRegistry));
114
123
  }
@@ -1,20 +1,52 @@
1
- import type { CodecRegistry } from '@prisma-next/framework-components/codec';
1
+ import type { ComponentMetadata } from '@prisma-next/framework-components/components';
2
2
  import { extractCodecLookup } from '@prisma-next/framework-components/control';
3
- import { postgresCodecRegistry } from '@prisma-next/target-postgres/codecs';
3
+ import {
4
+ type AnyPostgresCodecDescriptor,
5
+ buildPostgresCodecDescriptorRegistry,
6
+ } from '@prisma-next/target-postgres/codec-descriptor';
7
+ import { postgresCodecDescriptorRegistry } from '@prisma-next/target-postgres/codecs';
8
+ import type { PostgresCodecRegistry } from './types';
4
9
 
5
- /**
6
- * Build a {@link CodecRegistry} populated with the Postgres-builtin codec definitions only.
7
- *
8
- * 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).
9
- *
10
- * 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.
11
- */
12
- export function createPostgresBuiltinCodecLookup(): CodecRegistry {
13
- const descriptors = Array.from(postgresCodecRegistry.values());
14
- return extractCodecLookup([
10
+ function buildPostgresCodecRegistry(descriptors: ReadonlyArray<unknown>): PostgresCodecRegistry {
11
+ const descriptorRegistry = buildPostgresCodecDescriptorRegistry(descriptors);
12
+ const validatedDescriptors = Array.from(descriptorRegistry.values());
13
+ const codecRegistry = extractCodecLookup([
15
14
  {
16
- id: 'postgres-builtin-codecs',
17
- types: { codecTypes: { codecDescriptors: descriptors } },
15
+ id: 'postgres-codecs',
16
+ types: { codecTypes: { codecDescriptors: validatedDescriptors } },
18
17
  },
19
18
  ]);
19
+ const registry: PostgresCodecRegistry = {
20
+ ...codecRegistry,
21
+ descriptorFor: (codecId) => descriptorRegistry.descriptorFor(codecId),
22
+ values: () => descriptorRegistry.values(),
23
+ };
24
+ return Object.freeze(registry);
25
+ }
26
+
27
+ export function assemblePostgresCodecRegistry(
28
+ components: ReadonlyArray<Pick<ComponentMetadata, 'types'>>,
29
+ ): PostgresCodecRegistry {
30
+ const descriptors = components.flatMap(
31
+ (component) => component.types?.codecTypes?.codecDescriptors ?? [],
32
+ );
33
+ return buildPostgresCodecRegistry(descriptors);
34
+ }
35
+
36
+ export function createPostgresCodecRegistryWithBuiltins(
37
+ codecDescriptors: readonly AnyPostgresCodecDescriptor[] = [],
38
+ ): PostgresCodecRegistry {
39
+ return buildPostgresCodecRegistry([
40
+ ...postgresCodecDescriptorRegistry.values(),
41
+ ...codecDescriptors,
42
+ ]);
43
+ }
44
+
45
+ /**
46
+ * Build a coherent PostgreSQL codec registry populated with built-in descriptors only.
47
+ *
48
+ * 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.
49
+ */
50
+ export function createPostgresBuiltinCodecLookup(): PostgresCodecRegistry {
51
+ return createPostgresCodecRegistryWithBuiltins();
20
52
  }
@@ -10,7 +10,7 @@ import {
10
10
  } from '@prisma-next/errors/execution';
11
11
  import type { SqlControlAdapter } from '@prisma-next/family-sql/control-adapter';
12
12
  import { parseContractMarkerRow } from '@prisma-next/family-sql/verify';
13
- import type { CodecLookup, CodecRegistry } from '@prisma-next/framework-components/codec';
13
+ import type { CodecLookup } from '@prisma-next/framework-components/codec';
14
14
  import { APP_SPACE_ID, type SchemaNodeRef } from '@prisma-next/framework-components/control';
15
15
  import { UNBOUND_NAMESPACE_ID } from '@prisma-next/framework-components/ir';
16
16
  import { ledgerOriginFromStored } from '@prisma-next/migration-tools/ledger-origin';
@@ -93,7 +93,7 @@ import {
93
93
  NOW,
94
94
  } from './marker-ledger';
95
95
  import { renderLoweredSql } from './sql-renderer';
96
- import type { PostgresContract } from './types';
96
+ import type { PostgresCodecRegistry, PostgresContract } from './types';
97
97
 
98
98
  const POSTGRES_MARKER_TABLE = 'prisma_contract.marker';
99
99
  const POSTGRES_LEDGER_TABLE = 'prisma_contract.ledger';
@@ -116,11 +116,7 @@ export class PostgresControlAdapter implements SqlControlAdapter<'postgres'> {
116
116
  readonly familyId = 'sql' as const;
117
117
  readonly targetId = 'postgres' as const;
118
118
 
119
- private readonly codecRegistry: CodecRegistry;
120
-
121
- constructor(codecRegistry: CodecRegistry) {
122
- this.codecRegistry = codecRegistry;
123
- }
119
+ constructor(private readonly codecRegistry: PostgresCodecRegistry) {}
124
120
 
125
121
  /**
126
122
  * Target-specific normalizer for raw Postgres default expressions.