@prisma-next/sql-relational-core 0.5.0-dev.60 → 0.5.0-dev.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +45 -47
  2. package/dist/{errors-p3Ou_n9J.d.mts → errors-Chs-ph28.d.mts} +2 -2
  3. package/dist/errors-Chs-ph28.d.mts.map +1 -0
  4. package/dist/{errors-D6kqqjHM.mjs → errors-kgKOaDM1.mjs} +1 -1
  5. package/dist/{errors-D6kqqjHM.mjs.map → errors-kgKOaDM1.mjs.map} +1 -1
  6. package/dist/exports/ast.d.mts +141 -87
  7. package/dist/exports/ast.d.mts.map +1 -1
  8. package/dist/exports/ast.mjs +242 -272
  9. package/dist/exports/ast.mjs.map +1 -1
  10. package/dist/exports/codec-descriptor-registry.d.mts +18 -0
  11. package/dist/exports/codec-descriptor-registry.d.mts.map +1 -0
  12. package/dist/exports/codec-descriptor-registry.mjs +40 -0
  13. package/dist/exports/codec-descriptor-registry.mjs.map +1 -0
  14. package/dist/exports/errors.d.mts +4 -4
  15. package/dist/exports/errors.mjs +1 -1
  16. package/dist/exports/expression.d.mts +29 -24
  17. package/dist/exports/expression.d.mts.map +1 -1
  18. package/dist/exports/expression.mjs +33 -11
  19. package/dist/exports/expression.mjs.map +1 -1
  20. package/dist/exports/plan.d.mts +2 -2
  21. package/dist/exports/query-lane-context.d.mts +2 -3
  22. package/dist/exports/types.d.mts +5 -4
  23. package/dist/index.d.mts +10 -11
  24. package/dist/index.mjs +5 -5
  25. package/dist/{plan-C7SiEWkN.d.mts → plan-nwFE15re.d.mts} +2 -2
  26. package/dist/plan-nwFE15re.d.mts.map +1 -0
  27. package/dist/query-lane-context-DlWgKvvt.d.mts +175 -0
  28. package/dist/query-lane-context-DlWgKvvt.d.mts.map +1 -0
  29. package/dist/{sql-execution-plan-Dgx7BGin.d.mts → sql-execution-plan-DTfj23Tj.d.mts} +2 -2
  30. package/dist/{sql-execution-plan-Dgx7BGin.d.mts.map → sql-execution-plan-DTfj23Tj.d.mts.map} +1 -1
  31. package/dist/{types-DUL-3vy6.mjs → types-CO7zrXfK.mjs} +15 -7
  32. package/dist/types-CO7zrXfK.mjs.map +1 -0
  33. package/dist/{types-DviRR7AL.d.mts → types-G3hdNPZZ.d.mts} +4 -4
  34. package/dist/{types-DviRR7AL.d.mts.map → types-G3hdNPZZ.d.mts.map} +1 -1
  35. package/dist/{types-B4dL4lc3.d.mts → types-U74HFwNI.d.mts} +22 -4
  36. package/dist/types-U74HFwNI.d.mts.map +1 -0
  37. package/dist/{types-BUlUvdIU.d.mts → types-dPxXIUPS.d.mts} +3 -3
  38. package/dist/{types-BUlUvdIU.d.mts.map → types-dPxXIUPS.d.mts.map} +1 -1
  39. package/package.json +10 -8
  40. package/src/ast/adapter-types.ts +3 -19
  41. package/src/ast/codec-types.ts +53 -541
  42. package/src/ast/sql-codec-helpers.ts +79 -0
  43. package/src/ast/sql-codecs.ts +280 -137
  44. package/src/ast/types.ts +33 -8
  45. package/src/ast/validate-param-refs.ts +39 -0
  46. package/src/codec-descriptor-registry.ts +52 -0
  47. package/src/exports/ast.ts +2 -0
  48. package/src/exports/codec-descriptor-registry.ts +1 -0
  49. package/src/expression.ts +40 -23
  50. package/src/query-lane-context.ts +14 -96
  51. package/dist/codec-types-DJEaWT36.d.mts +0 -313
  52. package/dist/codec-types-DJEaWT36.d.mts.map +0 -1
  53. package/dist/errors-p3Ou_n9J.d.mts.map +0 -1
  54. package/dist/plan-C7SiEWkN.d.mts.map +0 -1
  55. package/dist/query-lane-context-Bwca4sc8.d.mts +0 -150
  56. package/dist/query-lane-context-Bwca4sc8.d.mts.map +0 -1
  57. package/dist/types-B4dL4lc3.d.mts.map +0 -1
  58. package/dist/types-DUL-3vy6.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ast.mjs","names":["codec","codecs","codecTypes: Record<\n string,\n { readonly input: unknown; readonly output: unknown; readonly traits: unknown }\n >","result: Record<\n string,\n {\n typeId: string;\n scalar: string;\n codec: Codec;\n input: unknown;\n output: unknown;\n jsType: unknown;\n }\n >","arktype","out: Record<string, unknown>","ordered: ParamRef[]"],"sources":["../../src/ast/codec-types.ts","../../src/ast/sql-codecs.ts","../../src/ast/util.ts"],"sourcesContent":["import type { JsonValue } from '@prisma-next/contract/types';\nimport type {\n Codec as BaseCodec,\n CodecCallContext,\n CodecInstanceContext,\n CodecTrait,\n} from '@prisma-next/framework-components/codec';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport type { Type } from 'arktype';\nimport type { O } from 'ts-toolbelt';\n\nexport type { CodecCallContext, CodecTrait } from '@prisma-next/framework-components/codec';\n\n/**\n * SQL-family addressing of a single column. The decode site populates a\n * `SqlColumnRef` whenever it can resolve the cell to a single underlying\n * `(table, column)` (the typical case for projected columns from a\n * single-table source); cells the runtime cannot resolve (aggregate\n * aliases, include aggregate fields, computed projections without a\n * simple ref) get `column = undefined`.\n *\n * The shape is a structural projection of the runtime's `ColumnRef` so\n * the SQL decode site can reuse the resolution it already performs for\n * `RUNTIME.DECODE_FAILED` envelope construction without allocating\n * twice per cell.\n */\nexport interface SqlColumnRef {\n readonly table: string;\n readonly name: string;\n}\n\n/**\n * SQL-family per-call context. Extends the framework {@link CodecCallContext}\n * (which carries `signal` only) with `column?: SqlColumnRef`, populated\n * on **decode** call sites that can resolve a single underlying column\n * ref. Encode call sites currently leave `column` undefined (encode-time\n * column context is the middleware's domain).\n *\n * SQL codec authors writing a `(value, ctx)` author function for the SQL\n * `codec()` factory observe this type. The framework codec dispatch\n * surface (and Mongo) sees only the base `CodecCallContext`.\n */\nexport interface SqlCodecCallContext extends CodecCallContext {\n readonly column?: SqlColumnRef;\n}\n\n/**\n * SQL-family per-instance context. Extends the framework\n * {@link CodecInstanceContext} (`name` only) with `usedAt`, the set of\n * `(table, column)` pairs the resolved codec serves.\n *\n * - For `typeRef` columns sharing one named `storage.types` instance, the\n * array lists every referencing column — a column-scoped stateful codec\n * (e.g. encryption) can derive aggregated per-instance state across all\n * the columns sharing the named instance.\n * - For inline-`typeParams` columns, the array has exactly one entry —\n * the column that owns the inline params.\n * - For shared non-parameterized codecs, the array carries one\n * representative entry (the column that triggered materialization);\n * the codec is shared across every column with that codec id, so the\n * `usedAt` is informational only.\n *\n * SQL extensions consuming `usedAt` (e.g. column-scoped state derivation)\n * type their factory parameter as `SqlCodecInstanceContext`. Extensions\n * that don't read `usedAt` type their factory parameter as the\n * family-agnostic {@link CodecInstanceContext} — a `SqlCodecInstanceContext`\n * is structurally assignable to the base.\n */\nexport interface SqlCodecInstanceContext extends CodecInstanceContext {\n readonly usedAt: ReadonlyArray<{ readonly table: string; readonly column: string }>;\n}\n\n/**\n * Legacy adapter-level descriptor for parameterized codecs that require\n * type-parameter validation at compile time. The runtime descriptor\n * (`RuntimeParameterizedCodecDescriptor` in `@prisma-next/sql-runtime`)\n * has migrated to the unified `CodecDescriptor<P>` shape with\n * `factory: (P) => (CodecInstanceContext) => Codec`; this descriptor stays only because\n * the SQL `Adapter.parameterizedCodecs()` surface still returns\n * `CodecParamsDescriptor[]` (compile-time typeParams validation only,\n * not runtime materialization).\n *\n * Retirement is tracked under TML-2357 T3.5.4 (single registration slot)\n * — the adapter-level `parameterizedCodecs()` collapses into the unified\n * runtime descriptor map once contributors migrate fully.\n *\n * @template TParams - The shape of the type parameters (e.g., `{ length: number }`)\n * @template THelper - The type returned by the optional `init` hook\n */\nexport interface CodecParamsDescriptor<TParams = Record<string, unknown>, THelper = unknown> {\n /** The codec ID this descriptor applies to (e.g., 'pg/vector@1') */\n readonly codecId: string;\n\n /**\n * Arktype schema for validating typeParams.\n * Used to validate both storage.types entries and inline column typeParams.\n */\n readonly paramsSchema: Type<TParams>;\n\n /**\n * Optional init hook called during runtime context creation.\n * Receives validated params and returns a helper object to be stored in context.types.\n * If not provided, the validated params are stored directly.\n *\n * Predecessor pattern. The runtime descriptor's curried\n * `factory: (P) => (CodecInstanceContext) => Codec` subsumes this hook — per-instance\n * state lives on the resolved codec rather than in a parallel\n * `TypeHelperRegistry` entry. Retirement tracked under TML-2357 T3.5.2\n * (narrow runtime `Codec` interface) and T3.5.4 (single registration\n * slot). Adapter-level callers reading codec-self-carried `init` should\n * migrate to the runtime descriptor map's factory instead.\n */\n readonly init?: (params: TParams) => THelper;\n}\n\n/**\n * Codec metadata for database-specific type information.\n * Used for schema introspection and verification.\n */\nexport interface CodecMeta {\n readonly db?: {\n readonly sql?: {\n readonly postgres?: {\n readonly nativeType: string; // e.g. 'integer', 'text', 'vector', 'timestamp with time zone'\n };\n };\n };\n}\n\n/**\n * SQL codec — extends the framework codec base with SQL-specific metadata:\n * driver-native type info (`meta.db.sql.<dialect>.nativeType`) and an\n * optional parameterized-codec descriptor (`paramsSchema` + `init`) for\n * codecs that require type-parameter validation (e.g. `pg/vector@1`).\n *\n * `encode` and `decode` are redeclared here to narrow the per-call\n * context to the SQL-family {@link SqlCodecCallContext} (adds\n * `column?: SqlColumnRef`). TypeScript treats method-syntax declarations\n * bivariantly, so the SQL narrowing is structurally compatible with the\n * framework {@link BaseCodec} super-interface.\n *\n * Note: `paramsSchema` and `init` here are the legacy adapter-level slots\n * mirrored from {@link CodecParamsDescriptor}. The runtime materialization\n * path uses `RuntimeParameterizedCodecDescriptor` (in\n * `@prisma-next/sql-runtime`) via the unified `CodecDescriptor<P>` shape;\n * codec-self-carried `paramsSchema`/`init` retire under TML-2357 (T3.5.2\n * narrows the runtime `Codec` interface; T3.5.4 collapses the parallel\n * registration slots).\n *\n * See `Codec` in `@prisma-next/framework-components/codec` for the codec\n * contract that this interface extends.\n */\nexport interface Codec<\n Id extends string = string,\n TTraits extends readonly CodecTrait[] = readonly CodecTrait[],\n TWire = unknown,\n TInput = unknown,\n TParams = Record<string, unknown>,\n THelper = unknown,\n> extends BaseCodec<Id, TTraits, TWire, TInput> {\n encode(value: TInput, ctx: SqlCodecCallContext): Promise<TWire>;\n decode(wire: TWire, ctx: SqlCodecCallContext): Promise<TInput>;\n readonly meta?: CodecMeta;\n readonly paramsSchema?: Type<TParams>;\n /**\n * Predecessor init hook. Retirement tracked under TML-2357 (T3.5.2 /\n * T3.5.4); the unified runtime descriptor's\n * `factory: (P) => (CodecInstanceContext) => Codec` is the replacement.\n */\n readonly init?: (params: TParams) => THelper;\n}\n\n/**\n * Contract-bound codec registry.\n *\n * The dispatch interface for encode/decode at runtime: built once at\n * `ExecutionContext` construction time by walking the contract's\n * `storage.tables[].columns[]` and resolving each column to either a per-\n * instance parameterized codec (via `descriptor.factory(typeParams)(ctx)`)\n * or the shared codec instance from the legacy `CodecRegistry` (for non-\n * parameterized codecs). The dispatch path calls\n * `forColumn(table, column).encode/decode(...)` and doesn't know whether\n * the codec is parameterized.\n *\n * `forCodecId(codecId)` is a fallback for sites that don't carry the\n * `(table, column)` ref through to the encode/decode call site —\n * primarily the param-encoding path, where `ParamRef.refs` is not\n * populated by the SQL builder today (every `ParamRef` carries `codecId`\n * but not the column it relates to). For the parameterized codecs shipped\n * at Phase B, encode is per-instance-stateless (pgvector formats\n * `[v1,v2,v3]` regardless of length; JSON's `encode` is `JSON.stringify`\n * regardless of schema), so a codec-id-keyed lookup yields a structurally\n * equivalent encoder; the fallback is the bridge that lets the legacy\n * `codecs:` registration retire from the dispatch path while staying as\n * the codec-id-only source for now.\n *\n * The encode-side fallback is the AC-5-deferred carve-out documented in\n * the codec-registry-unification spec § Non-functional constraints.\n * TML-2357 retires the fallback by threading `ParamRef.refs` through\n * column-bound construction sites.\n */\nexport interface ContractCodecRegistry {\n /**\n * Resolve the codec for `(table, column)`. Returns the per-instance\n * parameterized codec for parameterized columns, the shared codec for\n * non-parameterized columns, or `undefined` if the column is unknown\n * or the codec isn't registered.\n */\n forColumn(table: string, column: string): Codec | undefined;\n\n /**\n * Resolve a codec by id. Returns the same codec instance the legacy\n * `CodecRegistry.get(codecId)` would return — for non-parameterized\n * codecs that's the shared instance; for parameterized codecs that's\n * a representative resolved instance. Used by sites that don't carry\n * `(table, column)` through to the encode/decode call site (the AC-5\n * carve-out path).\n */\n forCodecId(codecId: string): Codec | undefined;\n}\n\n/**\n * Registry interface for codecs organized by ID and by contract scalar type.\n *\n * The registry allows looking up codecs by their namespaced ID or by the\n * contract scalar types they handle. Multiple codecs may handle the same\n * scalar type; ordering in byScalar reflects preference (adapter first,\n * then packs, then app overrides).\n */\nexport interface CodecRegistry {\n get(id: string): Codec<string> | undefined;\n has(id: string): boolean;\n getByScalar(scalar: string): readonly Codec<string>[];\n getDefaultCodec(scalar: string): Codec<string> | undefined;\n register(codec: Codec<string>): void;\n /** Returns true if the codec with this ID has the given trait. */\n hasTrait(codecId: string, trait: CodecTrait): boolean;\n /** Returns all traits for a codec, or an empty array if not found. */\n traitsOf(codecId: string): readonly CodecTrait[];\n [Symbol.iterator](): Iterator<Codec<string>>;\n values(): IterableIterator<Codec<string>>;\n}\n\n/**\n * Implementation of CodecRegistry.\n */\nclass CodecRegistryImpl implements CodecRegistry {\n private readonly _byId = new Map<string, Codec<string>>();\n private readonly _byScalar = new Map<string, Codec<string>[]>();\n\n /**\n * Map-like interface for codec lookup by ID.\n * Example: registry.get('pg/text@1')\n */\n get(id: string): Codec<string> | undefined {\n return this._byId.get(id);\n }\n\n /**\n * Check if a codec with the given ID is registered.\n */\n has(id: string): boolean {\n return this._byId.has(id);\n }\n\n /**\n * Get all codecs that handle a given scalar type.\n * Returns an empty frozen array if no codecs are found.\n * Example: registry.getByScalar('text') → [codec1, codec2, ...]\n */\n getByScalar(scalar: string): readonly Codec<string>[] {\n return this._byScalar.get(scalar) ?? Object.freeze([]);\n }\n\n /**\n * Get the default codec for a scalar type (first registered codec).\n * Returns undefined if no codec handles this scalar type.\n */\n getDefaultCodec(scalar: string): Codec<string> | undefined {\n const _codecs = this._byScalar.get(scalar);\n return _codecs?.[0];\n }\n\n /**\n * Register a codec in the registry.\n * Throws an error if a codec with the same ID is already registered.\n *\n * @param codec - The codec to register\n * @throws Error if a codec with the same ID already exists\n */\n register(codec: Codec<string>): void {\n if (this._byId.has(codec.id)) {\n throw new Error(`Codec with ID '${codec.id}' is already registered`);\n }\n\n this._byId.set(codec.id, codec);\n\n // Update byScalar mapping\n for (const scalarType of codec.targetTypes) {\n const existing = this._byScalar.get(scalarType);\n if (existing) {\n existing.push(codec);\n } else {\n this._byScalar.set(scalarType, [codec]);\n }\n }\n }\n\n hasTrait(codecId: string, trait: CodecTrait): boolean {\n const codec = this._byId.get(codecId);\n return codec?.traits?.includes(trait) ?? false;\n }\n\n traitsOf(codecId: string): readonly CodecTrait[] {\n return this._byId.get(codecId)?.traits ?? [];\n }\n\n /**\n * Returns an iterator over all registered codecs.\n * Useful for iterating through codecs from another registry.\n */\n *[Symbol.iterator](): Iterator<Codec<string>> {\n for (const codec of this._byId.values()) {\n yield codec;\n }\n }\n\n /**\n * Returns an iterable of all registered codecs.\n */\n values(): IterableIterator<Codec<string>> {\n return this._byId.values();\n }\n}\n\n/**\n * Conditional bundle for `encodeJson`/`decodeJson`: when `TInput` is\n * structurally assignable to `JsonValue` the identity defaults are\n * sound and both fields are optional; otherwise both fields are\n * required so an author cannot silently produce a non-JSON-safe\n * contract artifact.\n */\ntype JsonRoundTripConfig<TInput> = [TInput] extends [JsonValue]\n ? {\n encodeJson?: (value: TInput) => JsonValue;\n decodeJson?: (json: JsonValue) => TInput;\n }\n : {\n encodeJson: (value: TInput) => JsonValue;\n decodeJson: (json: JsonValue) => TInput;\n };\n\n/**\n * Construct a SQL codec from author functions and optional metadata.\n *\n * Author `encode` and `decode` as sync or async functions; the factory\n * produces a {@link Codec} whose query-time methods follow the boundary\n * contract documented on `Codec`. Authors receive a second `ctx` options\n * argument carrying the SQL-family per-call context; ignore it if you\n * don't need it.\n *\n * Both `encode` and `decode` are required so `TInput` and `TWire` are\n * always covered by an explicit author function — the factory installs\n * no identity fallback. `encodeJson` and `decodeJson` default to identity\n * **only when `TInput` is assignable to `JsonValue`**; otherwise both are\n * required so the contract artifact stays JSON-safe.\n */\nexport function codec<\n Id extends string,\n const TTraits extends readonly CodecTrait[] = readonly [],\n TWire = unknown,\n TInput = unknown,\n TParams = Record<string, unknown>,\n THelper = unknown,\n>(\n config: {\n typeId: Id;\n targetTypes: readonly string[];\n encode: (value: TInput, ctx: SqlCodecCallContext) => TWire | Promise<TWire>;\n decode: (wire: TWire, ctx: SqlCodecCallContext) => TInput | Promise<TInput>;\n meta?: CodecMeta;\n paramsSchema?: Type<TParams>;\n init?: (params: TParams) => THelper;\n traits?: TTraits;\n renderOutputType?: (typeParams: Record<string, unknown>) => string | undefined;\n } & JsonRoundTripConfig<TInput>,\n): Codec<Id, TTraits, TWire, TInput, TParams, THelper> {\n const identity = (v: unknown) => v;\n // The runtime allocates one `SqlCodecCallContext` per `runtime.execute()`\n // call (no caller-supplied `signal` produces `{}` instead of `undefined`)\n // and threads it as a non-optional reference to every codec call. The\n // author surface keeps the second parameter optional so single-arg\n // `(value) => …` authors continue to satisfy the signature via\n // TypeScript's bivariance for trailing parameters.\n const userEncode = config.encode;\n const userDecode = config.decode;\n // The conditional JsonRoundTripConfig narrows TInput|JsonValue at the\n // boundary; widen back to the generic shape inside the factory body.\n const widenedConfig = config as {\n encodeJson?: (value: TInput) => JsonValue;\n decodeJson?: (json: JsonValue) => TInput;\n };\n return {\n id: config.typeId,\n targetTypes: config.targetTypes,\n ...ifDefined('meta', config.meta),\n ...ifDefined('paramsSchema', config.paramsSchema),\n ...ifDefined('init', config.init),\n ...ifDefined(\n 'traits',\n config.traits ? (Object.freeze([...config.traits]) as TTraits) : undefined,\n ),\n ...ifDefined('renderOutputType', config.renderOutputType),\n encode: (value, ctx) => {\n try {\n return Promise.resolve(userEncode(value, ctx));\n } catch (error) {\n return Promise.reject(error);\n }\n },\n decode: (wire, ctx) => {\n try {\n return Promise.resolve(userDecode(wire, ctx));\n } catch (error) {\n return Promise.reject(error);\n }\n },\n encodeJson: (widenedConfig.encodeJson ?? identity) as (value: TInput) => JsonValue,\n decodeJson: (widenedConfig.decodeJson ?? identity) as (json: JsonValue) => TInput,\n };\n}\n\n/**\n * Type helpers to extract codec types.\n */\nexport type CodecId<T> =\n T extends Codec<infer Id> ? Id : T extends { readonly id: infer Id } ? Id : never;\nexport type CodecInput<T> =\n T extends Codec<string, readonly CodecTrait[], unknown, infer In> ? In : never;\nexport type CodecTraits<T> =\n T extends Codec<string, infer TTraits> ? TTraits[number] & CodecTrait : never;\n\n/**\n * Type helper to extract codec types from builder instance.\n */\nexport type ExtractCodecTypes<\n ScalarNames extends { readonly [K in keyof ScalarNames]: Codec<string> } = Record<never, never>,\n> = {\n readonly [K in keyof ScalarNames as ScalarNames[K] extends Codec<infer Id> ? Id : never]: {\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecInput<ScalarNames[K]>;\n readonly traits: CodecTraits<ScalarNames[K]>;\n };\n};\n\n/**\n * Type helper to extract data type IDs from builder instance.\n * Uses ExtractCodecTypes which preserves literal types as keys.\n * Since ExtractCodecTypes<Record<K, ScalarNames[K]>> has exactly one key (the Id),\n * we extract it by creating a mapped type that uses the Id as both key and value,\n * then extract the value type. This preserves literal types.\n */\nexport type ExtractDataTypes<\n ScalarNames extends { readonly [K in keyof ScalarNames]: Codec<string> },\n> = {\n readonly [K in keyof ScalarNames]: {\n readonly [Id in keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>]: Id;\n }[keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>];\n};\n\n/**\n * Builder interface for declaring codecs.\n */\nexport interface CodecDefBuilder<\n ScalarNames extends { readonly [K in keyof ScalarNames]: Codec<string> } = Record<never, never>,\n> {\n readonly CodecTypes: ExtractCodecTypes<ScalarNames>;\n\n add<ScalarName extends string, CodecImpl extends Codec<string>>(\n scalarName: ScalarName,\n codecImpl: CodecImpl,\n ): CodecDefBuilder<\n O.Overwrite<ScalarNames, Record<ScalarName, CodecImpl>> & Record<ScalarName, CodecImpl>\n >;\n\n readonly codecDefinitions: {\n readonly [K in keyof ScalarNames]: {\n readonly typeId: ScalarNames[K] extends Codec<infer Id extends string> ? Id : never;\n readonly scalar: K;\n readonly codec: ScalarNames[K];\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecInput<ScalarNames[K]>;\n readonly jsType: CodecInput<ScalarNames[K]>;\n };\n };\n\n readonly dataTypes: {\n readonly [K in keyof ScalarNames]: {\n readonly [Id in keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>]: Id;\n }[keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>];\n };\n}\n\n/**\n * Implementation of CodecDefBuilder.\n */\nclass CodecDefBuilderImpl<\n ScalarNames extends { readonly [K in keyof ScalarNames]: Codec<string> } = Record<never, never>,\n> implements CodecDefBuilder<ScalarNames>\n{\n private readonly _codecs: ScalarNames;\n\n public readonly CodecTypes: ExtractCodecTypes<ScalarNames>;\n public readonly dataTypes: {\n readonly [K in keyof ScalarNames]: {\n readonly [Id in keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>]: Id;\n }[keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>];\n };\n\n constructor(codecs: ScalarNames) {\n this._codecs = codecs;\n\n // Populate CodecTypes from codecs\n const codecTypes: Record<\n string,\n { readonly input: unknown; readonly output: unknown; readonly traits: unknown }\n > = {};\n for (const [, codecImpl] of Object.entries(this._codecs)) {\n const codecImplTyped = codecImpl as Codec<string>;\n codecTypes[codecImplTyped.id] = {\n input: undefined as unknown as CodecInput<typeof codecImplTyped>,\n output: undefined as unknown as CodecInput<typeof codecImplTyped>,\n traits: undefined as unknown as CodecTraits<typeof codecImplTyped>,\n };\n }\n this.CodecTypes = codecTypes as ExtractCodecTypes<ScalarNames>;\n\n // Populate dataTypes from codecs - extract id property from each codec\n // Build object preserving keys from ScalarNames\n // Type assertion is safe because we know ScalarNames structure matches the return type\n // biome-ignore lint/suspicious/noExplicitAny: dynamic codec mapping requires any\n const dataTypes = {} as any;\n for (const key in this._codecs) {\n if (Object.hasOwn(this._codecs, key)) {\n const codec = this._codecs[key] as Codec<string>;\n dataTypes[key] = codec.id;\n }\n }\n this.dataTypes = dataTypes as {\n readonly [K in keyof ScalarNames]: {\n readonly [Id in keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>]: Id;\n }[keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>];\n };\n }\n\n add<ScalarName extends string, CodecImpl extends Codec<string>>(\n scalarName: ScalarName,\n codecImpl: CodecImpl,\n ): CodecDefBuilder<\n O.Overwrite<ScalarNames, Record<ScalarName, CodecImpl>> & Record<ScalarName, CodecImpl>\n > {\n return new CodecDefBuilderImpl({\n ...this._codecs,\n [scalarName]: codecImpl,\n } as O.Overwrite<ScalarNames, Record<ScalarName, CodecImpl>> & Record<ScalarName, CodecImpl>);\n }\n\n /**\n * Derive codecDefinitions structure.\n */\n get codecDefinitions(): {\n readonly [K in keyof ScalarNames]: {\n readonly typeId: ScalarNames[K] extends Codec<infer Id> ? Id : never;\n readonly scalar: K;\n readonly codec: ScalarNames[K];\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecInput<ScalarNames[K]>;\n readonly jsType: CodecInput<ScalarNames[K]>;\n };\n } {\n const result: Record<\n string,\n {\n typeId: string;\n scalar: string;\n codec: Codec;\n input: unknown;\n output: unknown;\n jsType: unknown;\n }\n > = {};\n\n for (const [scalarName, codecImpl] of Object.entries(this._codecs)) {\n const codec = codecImpl as Codec<string>;\n result[scalarName] = {\n typeId: codec.id,\n scalar: scalarName,\n codec: codec,\n input: undefined as unknown as CodecInput<typeof codec>,\n output: undefined as unknown as CodecInput<typeof codec>,\n jsType: undefined as unknown as CodecInput<typeof codec>,\n };\n }\n\n return result as {\n readonly [K in keyof ScalarNames]: {\n readonly typeId: ScalarNames[K] extends Codec<infer Id extends string> ? Id : never;\n readonly scalar: K;\n readonly codec: ScalarNames[K];\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecInput<ScalarNames[K]>;\n readonly jsType: CodecInput<ScalarNames[K]>;\n };\n };\n }\n}\n\n/**\n * Create a new codec registry.\n */\nexport function createCodecRegistry(): CodecRegistry {\n return new CodecRegistryImpl();\n}\n\n/**\n * Create a new codec definition builder.\n */\nexport function defineCodecs(): CodecDefBuilder<Record<never, never>> {\n return new CodecDefBuilderImpl({});\n}\n","import type { JsonValue } from '@prisma-next/contract/types';\nimport { type as arktype } from 'arktype';\nimport { codec, defineCodecs } from './codec-types';\n\nexport const SQL_CHAR_CODEC_ID = 'sql/char@1' as const;\nexport const SQL_VARCHAR_CODEC_ID = 'sql/varchar@1' as const;\nexport const SQL_INT_CODEC_ID = 'sql/int@1' as const;\nexport const SQL_FLOAT_CODEC_ID = 'sql/float@1' as const;\nexport const SQL_TEXT_CODEC_ID = 'sql/text@1' as const;\nexport const SQL_TIMESTAMP_CODEC_ID = 'sql/timestamp@1' as const;\n\nconst lengthParamsSchema = arktype({\n length: 'number.integer > 0',\n});\n\nconst precisionParamsSchema = arktype({\n 'precision?': 'number.integer >= 0 & number.integer <= 6',\n});\n\ntype LengthTypeHelper = {\n readonly kind: 'fixed' | 'variable';\n readonly maxLength: number;\n};\n\nfunction createLengthTypeHelper(\n kind: LengthTypeHelper['kind'],\n): (params: Record<string, unknown>) => LengthTypeHelper {\n return (params) => ({\n kind,\n maxLength: params['length'] as number,\n });\n}\n\nconst sqlCharCodec = codec<\n typeof SQL_CHAR_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n>({\n typeId: SQL_CHAR_CODEC_ID,\n targetTypes: ['char'],\n traits: ['equality', 'order', 'textual'],\n encode: (value: string): string => value,\n decode: (wire: string): string => wire.trimEnd(),\n paramsSchema: lengthParamsSchema,\n init: createLengthTypeHelper('fixed'),\n renderOutputType: (typeParams) => {\n const length = typeParams['length'];\n if (length === undefined) return undefined;\n if (typeof length !== 'number' || !Number.isFinite(length) || !Number.isInteger(length)) {\n throw new Error(\n `renderOutputType: expected integer \"length\" in typeParams for Char, got ${String(length)}`,\n );\n }\n return `Char<${length}>`;\n },\n});\n\nconst sqlVarcharCodec = codec<\n typeof SQL_VARCHAR_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n>({\n typeId: SQL_VARCHAR_CODEC_ID,\n targetTypes: ['varchar'],\n traits: ['equality', 'order', 'textual'],\n encode: (value: string): string => value,\n decode: (wire: string): string => wire,\n paramsSchema: lengthParamsSchema,\n init: createLengthTypeHelper('variable'),\n renderOutputType: (typeParams) => {\n const length = typeParams['length'];\n if (length === undefined) return undefined;\n if (typeof length !== 'number' || !Number.isFinite(length) || !Number.isInteger(length)) {\n throw new Error(\n `renderOutputType: expected integer \"length\" in typeParams for Varchar, got ${String(length)}`,\n );\n }\n return `Varchar<${length}>`;\n },\n});\n\nconst sqlIntCodec = codec({\n typeId: SQL_INT_CODEC_ID,\n targetTypes: ['int'],\n traits: ['equality', 'order', 'numeric'],\n encode: (value: number): number => value,\n decode: (wire: number): number => wire,\n});\n\nconst sqlFloatCodec = codec({\n typeId: SQL_FLOAT_CODEC_ID,\n targetTypes: ['float'],\n traits: ['equality', 'order', 'numeric'],\n encode: (value: number): number => value,\n decode: (wire: number): number => wire,\n});\n\nconst sqlTextCodec = codec({\n typeId: SQL_TEXT_CODEC_ID,\n targetTypes: ['text'],\n traits: ['equality', 'order', 'textual'],\n encode: (value: string): string => value,\n decode: (wire: string): string => wire,\n});\n\nconst sqlTimestampCodec = codec<\n typeof SQL_TIMESTAMP_CODEC_ID,\n readonly ['equality', 'order'],\n Date,\n Date\n>({\n typeId: SQL_TIMESTAMP_CODEC_ID,\n targetTypes: ['timestamp'],\n traits: ['equality', 'order'],\n encode: (value: Date): Date => value,\n decode: (wire: Date): Date => wire,\n encodeJson: (value: Date): JsonValue => value.toISOString(),\n decodeJson: (json: JsonValue): Date => {\n if (typeof json !== 'string') {\n throw new Error(`Expected ISO date string for sql/timestamp@1, got ${typeof json}`);\n }\n const date = new Date(json);\n if (Number.isNaN(date.getTime())) {\n throw new Error(`Invalid ISO date string for sql/timestamp@1: ${json}`);\n }\n return date;\n },\n paramsSchema: precisionParamsSchema,\n renderOutputType: (typeParams) => {\n const precision = typeParams['precision'];\n if (precision === undefined) {\n return 'Timestamp';\n }\n if (\n typeof precision !== 'number' ||\n !Number.isFinite(precision) ||\n !Number.isInteger(precision)\n ) {\n throw new Error(\n `renderOutputType: expected integer \"precision\" in typeParams for Timestamp, got ${String(precision)}`,\n );\n }\n return `Timestamp<${precision}>`;\n },\n});\n\nconst codecs = defineCodecs()\n .add('char', sqlCharCodec)\n .add('varchar', sqlVarcharCodec)\n .add('int', sqlIntCodec)\n .add('float', sqlFloatCodec)\n .add('text', sqlTextCodec)\n .add('timestamp', sqlTimestampCodec);\n\nexport const sqlCodecDefinitions = codecs.codecDefinitions;\nexport const sqlDataTypes = codecs.dataTypes;\nexport type SqlCodecTypes = typeof codecs.CodecTypes;\n","import type { AnyQueryAst, ParamRef } from './types';\n\nexport function compact<T extends Record<string, unknown>>(o: T): T {\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(o)) {\n if (v === undefined || v === null) continue;\n if (Array.isArray(v) && v.length === 0) continue;\n out[k] = v;\n }\n return out as T;\n}\n\n/**\n * Walks an AST's parameter references in first-encounter order and dedupes\n * by ParamRef identity. The single canonical helper used by every consumer\n * that aligns `plan.params` with metadata-by-index — the SQL builder lane,\n * the SQL ORM client, the SQL runtime encoder, and the Postgres renderer's\n * `$N` index map — so the four walks cannot drift in dedupe semantics.\n *\n * SQLite's `?`-placeholder renderer intentionally does NOT use this helper\n * because it needs one params entry per occurrence in the SQL.\n */\nexport function collectOrderedParamRefs(ast: AnyQueryAst): ReadonlyArray<ParamRef> {\n const seen = new Set<ParamRef>();\n const ordered: ParamRef[] = [];\n for (const ref of ast.collectParamRefs()) {\n if (seen.has(ref)) continue;\n seen.add(ref);\n ordered.push(ref);\n }\n return Object.freeze(ordered);\n}\n"],"mappings":";;;;;;;;AAsPA,IAAM,oBAAN,MAAiD;CAC/C,AAAiB,wBAAQ,IAAI,KAA4B;CACzD,AAAiB,4BAAY,IAAI,KAA8B;;;;;CAM/D,IA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,aAAa,CACzB,IAAI,WAAW,gBAAgB,CAC/B,IAAI,OAAO,YAAY,CACvB,IAAI,SAAS,cAAc,CAC3B,IAAI,QAAQ,aAAa,CACzB,IAAI,aAAa,kBAAkB;AAEtC,MAAa,sBAAsB,OAAO;AAC1C,MAAa,eAAe,OAAO;;;;AC3JnC,SAAgB,QAA2C,GAAS;CAClE,MAAMC,MAA+B,EAAE;AACvC,MAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,EAAE,EAAE;AACtC,MAAI,MAAM,UAAa,MAAM,KAAM;AACnC,MAAI,MAAM,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAG;AACxC,MAAI,KAAK;;AAEX,QAAO;;;;;;;;;;;;AAaT,SAAgB,wBAAwB,KAA2C;CACjF,MAAM,uBAAO,IAAI,KAAe;CAChC,MAAMC,UAAsB,EAAE;AAC9B,MAAK,MAAM,OAAO,IAAI,kBAAkB,EAAE;AACxC,MAAI,KAAK,IAAI,IAAI,CAAE;AACnB,OAAK,IAAI,IAAI;AACb,UAAQ,KAAK,IAAI;;AAEnB,QAAO,OAAO,OAAO,QAAQ"}
1
+ {"version":3,"file":"ast.mjs","names":["arktype","out: Record<string, unknown>","ordered: ParamRef[]"],"sources":["../../src/ast/sql-codec-helpers.ts","../../src/ast/sql-codecs.ts","../../src/ast/util.ts","../../src/ast/validate-param-refs.ts"],"sourcesContent":["/**\n * Shared encode/decode/render constants and codec id literals for the six SQL base codecs (`sql/char@1`, `sql/varchar@1`, `sql/int@1`, `sql/float@1`, `sql/text@1`, `sql/timestamp@1`).\n *\n * The codec implementations live in `sql-codecs.ts` (TML-2357). This module retains only the conversion helpers + emit-path renderers the codec methods compose with — keeping a single source of truth for non-trivial conversions while the codec methods provide the framework-required `Promise<…>` boundary.\n */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\n\nexport const SQL_CHAR_CODEC_ID = 'sql/char@1' as const;\nexport const SQL_VARCHAR_CODEC_ID = 'sql/varchar@1' as const;\nexport const SQL_INT_CODEC_ID = 'sql/int@1' as const;\nexport const SQL_FLOAT_CODEC_ID = 'sql/float@1' as const;\nexport const SQL_TEXT_CODEC_ID = 'sql/text@1' as const;\nexport const SQL_TIMESTAMP_CODEC_ID = 'sql/timestamp@1' as const;\n\nexport const sqlCharEncode = (value: string): string => value;\nexport const sqlCharDecode = (wire: string): string => wire.trimEnd();\nexport const sqlCharRenderOutputType = (typeParams: { readonly length?: number }) => {\n const length = typeParams.length;\n if (length === undefined) return undefined;\n if (typeof length !== 'number' || !Number.isFinite(length) || !Number.isInteger(length)) {\n throw new Error(\n `renderOutputType: expected integer \"length\" in typeParams for Char, got ${String(length)}`,\n );\n }\n return `Char<${length}>`;\n};\n\nexport const sqlVarcharEncode = (value: string): string => value;\nexport const sqlVarcharDecode = (wire: string): string => wire;\nexport const sqlVarcharRenderOutputType = (typeParams: { readonly length?: number }) => {\n const length = typeParams.length;\n if (length === undefined) return undefined;\n if (typeof length !== 'number' || !Number.isFinite(length) || !Number.isInteger(length)) {\n throw new Error(\n `renderOutputType: expected integer \"length\" in typeParams for Varchar, got ${String(length)}`,\n );\n }\n return `Varchar<${length}>`;\n};\n\nexport const sqlIntEncode = (value: number): number => value;\nexport const sqlIntDecode = (wire: number): number => wire;\n\nexport const sqlFloatEncode = (value: number): number => value;\nexport const sqlFloatDecode = (wire: number): number => wire;\n\nexport const sqlTextEncode = (value: string): string => value;\nexport const sqlTextDecode = (wire: string): string => wire;\n\nexport const sqlTimestampEncode = (value: Date): Date => value;\nexport const sqlTimestampDecode = (wire: Date): Date => wire;\nexport const sqlTimestampEncodeJson = (value: Date): JsonValue => value.toISOString();\nexport const sqlTimestampDecodeJson = (json: JsonValue): Date => {\n if (typeof json !== 'string') {\n throw new Error(`Expected ISO date string for sql/timestamp@1, got ${typeof json}`);\n }\n const date = new Date(json);\n if (Number.isNaN(date.getTime())) {\n throw new Error(`Invalid ISO date string for sql/timestamp@1: ${json}`);\n }\n return date;\n};\nexport const sqlTimestampRenderOutputType = (typeParams: { readonly precision?: number }) => {\n const precision = typeParams.precision;\n if (precision === undefined) {\n return 'Timestamp';\n }\n if (\n typeof precision !== 'number' ||\n !Number.isFinite(precision) ||\n !Number.isInteger(precision)\n ) {\n throw new Error(\n `renderOutputType: expected integer \"precision\" in typeParams for Timestamp, got ${String(precision)}`,\n );\n }\n return `Timestamp<${precision}>`;\n};\n","/**\n * The six SQL base codecs (TML-2357).\n *\n * Each codec ships as three artifacts:\n *\n * 1. A `SqlXCodec` class extending {@link CodecImpl} that wraps the module-level encode/decode constants exported from `sql-codec-helpers.ts` (the single source of truth for runtime behaviour). 2. A `SqlXDescriptor` class extending {@link CodecDescriptorImpl} declaring the codec id, traits, target types, params schema, and (where applicable) the emit-path `renderOutputType`. 3. A per-codec column helper (`sqlXColumn`)\n * that calls `descriptor.factory(...)` directly and packages the result into a {@link ColumnSpec} via the framework {@link column} packager. The helper is tied to its descriptor with `satisfies ColumnHelperFor`.\n *\n * After TML-2357 this file is the canonical source of SQL base codec metadata and runtime behaviour — the legacy `mkCodec` / `defineCodec` carriers retired with the deletion sweep.\n */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\nimport {\n type CodecCallContext,\n CodecDescriptorImpl,\n CodecImpl,\n type CodecInstanceContext,\n type ColumnHelperFor,\n type ColumnHelperForStrict,\n column,\n voidParamsSchema,\n} from '@prisma-next/framework-components/codec';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { type as arktype } from 'arktype';\nimport {\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 sqlCharDecode,\n sqlCharEncode,\n sqlCharRenderOutputType,\n sqlFloatDecode,\n sqlFloatEncode,\n sqlIntDecode,\n sqlIntEncode,\n sqlTextDecode,\n sqlTextEncode,\n sqlTimestampDecode,\n sqlTimestampDecodeJson,\n sqlTimestampEncode,\n sqlTimestampEncodeJson,\n sqlTimestampRenderOutputType,\n sqlVarcharDecode,\n sqlVarcharEncode,\n sqlVarcharRenderOutputType,\n} from './sql-codec-helpers';\n\ntype LengthParams = { readonly length?: number };\ntype PrecisionParams = { readonly precision?: number };\n\nconst lengthParamsSchema = arktype({\n 'length?': 'number.integer > 0',\n}) satisfies StandardSchemaV1<LengthParams>;\n\nconst precisionParamsSchema = arktype({\n 'precision?': 'number.integer >= 0 & number.integer <= 6',\n}) satisfies StandardSchemaV1<PrecisionParams>;\n\nexport class SqlTextCodec extends CodecImpl<\n typeof SQL_TEXT_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return sqlTextEncode(value);\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return sqlTextDecode(wire);\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\n }\n}\n\nexport class SqlTextDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQL_TEXT_CODEC_ID;\n override readonly traits = ['equality', 'order', 'textual'] as const;\n override readonly targetTypes = ['text'] as const;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqlTextCodec {\n return () => new SqlTextCodec(this);\n }\n}\n\nexport const sqlTextDescriptor = new SqlTextDescriptor();\n\nexport const sqlTextColumn = () =>\n column(sqlTextDescriptor.factory(), sqlTextDescriptor.codecId, undefined, 'text');\n\nsqlTextColumn satisfies ColumnHelperFor<SqlTextDescriptor>;\nsqlTextColumn satisfies ColumnHelperForStrict<SqlTextDescriptor>;\n\nexport class SqlIntCodec extends CodecImpl<\n typeof SQL_INT_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number,\n number\n> {\n async encode(value: number, _ctx: CodecCallContext): Promise<number> {\n return sqlIntEncode(value);\n }\n async decode(wire: number, _ctx: CodecCallContext): Promise<number> {\n return sqlIntDecode(wire);\n }\n encodeJson(value: number): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): number {\n return json as number;\n }\n}\n\nexport class SqlIntDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQL_INT_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['int'] as const;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqlIntCodec {\n return () => new SqlIntCodec(this);\n }\n}\n\nexport const sqlIntDescriptor = new SqlIntDescriptor();\n\nexport const sqlIntColumn = () =>\n column(sqlIntDescriptor.factory(), sqlIntDescriptor.codecId, undefined, 'int');\n\nsqlIntColumn satisfies ColumnHelperFor<SqlIntDescriptor>;\nsqlIntColumn satisfies ColumnHelperForStrict<SqlIntDescriptor>;\n\nexport class SqlFloatCodec extends CodecImpl<\n typeof SQL_FLOAT_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number,\n number\n> {\n async encode(value: number, _ctx: CodecCallContext): Promise<number> {\n return sqlFloatEncode(value);\n }\n async decode(wire: number, _ctx: CodecCallContext): Promise<number> {\n return sqlFloatDecode(wire);\n }\n encodeJson(value: number): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): number {\n return json as number;\n }\n}\n\nexport class SqlFloatDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQL_FLOAT_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['float'] as const;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqlFloatCodec {\n return () => new SqlFloatCodec(this);\n }\n}\n\nexport const sqlFloatDescriptor = new SqlFloatDescriptor();\n\nexport const sqlFloatColumn = () =>\n column(sqlFloatDescriptor.factory(), sqlFloatDescriptor.codecId, undefined, 'float');\n\nsqlFloatColumn satisfies ColumnHelperFor<SqlFloatDescriptor>;\nsqlFloatColumn satisfies ColumnHelperForStrict<SqlFloatDescriptor>;\n\nexport class SqlCharCodec extends CodecImpl<\n typeof SQL_CHAR_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return sqlCharEncode(value);\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return sqlCharDecode(wire);\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\n }\n}\n\nexport class SqlCharDescriptor extends CodecDescriptorImpl<LengthParams> {\n override readonly codecId = SQL_CHAR_CODEC_ID;\n override readonly traits = ['equality', 'order', 'textual'] as const;\n override readonly targetTypes = ['char'] as const;\n override readonly paramsSchema: StandardSchemaV1<LengthParams> = lengthParamsSchema;\n override renderOutputType(params: LengthParams): string | undefined {\n return sqlCharRenderOutputType(params);\n }\n override factory(_params: LengthParams): (ctx: CodecInstanceContext) => SqlCharCodec {\n return () => new SqlCharCodec(this);\n }\n}\n\nexport const sqlCharDescriptor = new SqlCharDescriptor();\n\nexport const sqlCharColumn = (params: LengthParams = {}) =>\n column(sqlCharDescriptor.factory(params), sqlCharDescriptor.codecId, params, 'char');\n\nsqlCharColumn satisfies ColumnHelperFor<SqlCharDescriptor>;\nsqlCharColumn satisfies ColumnHelperForStrict<SqlCharDescriptor>;\n\nexport class SqlVarcharCodec extends CodecImpl<\n typeof SQL_VARCHAR_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return sqlVarcharEncode(value);\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return sqlVarcharDecode(wire);\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\n }\n}\n\nexport class SqlVarcharDescriptor extends CodecDescriptorImpl<LengthParams> {\n override readonly codecId = SQL_VARCHAR_CODEC_ID;\n override readonly traits = ['equality', 'order', 'textual'] as const;\n override readonly targetTypes = ['varchar'] as const;\n override readonly paramsSchema: StandardSchemaV1<LengthParams> = lengthParamsSchema;\n override renderOutputType(params: LengthParams): string | undefined {\n return sqlVarcharRenderOutputType(params);\n }\n override factory(_params: LengthParams): (ctx: CodecInstanceContext) => SqlVarcharCodec {\n return () => new SqlVarcharCodec(this);\n }\n}\n\nexport const sqlVarcharDescriptor = new SqlVarcharDescriptor();\n\nexport const sqlVarcharColumn = (params: LengthParams = {}) =>\n column(sqlVarcharDescriptor.factory(params), sqlVarcharDescriptor.codecId, params, 'varchar');\n\nsqlVarcharColumn satisfies ColumnHelperFor<SqlVarcharDescriptor>;\nsqlVarcharColumn satisfies ColumnHelperForStrict<SqlVarcharDescriptor>;\n\nexport class SqlTimestampCodec extends CodecImpl<\n typeof SQL_TIMESTAMP_CODEC_ID,\n readonly ['equality', 'order'],\n Date,\n Date\n> {\n async encode(value: Date, _ctx: CodecCallContext): Promise<Date> {\n return sqlTimestampEncode(value);\n }\n async decode(wire: Date, _ctx: CodecCallContext): Promise<Date> {\n return sqlTimestampDecode(wire);\n }\n encodeJson(value: Date): JsonValue {\n return sqlTimestampEncodeJson(value);\n }\n decodeJson(json: JsonValue): Date {\n return sqlTimestampDecodeJson(json);\n }\n}\n\nexport class SqlTimestampDescriptor extends CodecDescriptorImpl<PrecisionParams> {\n override readonly codecId = SQL_TIMESTAMP_CODEC_ID;\n override readonly traits = ['equality', 'order'] as const;\n override readonly targetTypes = ['timestamp'] as const;\n override readonly paramsSchema: StandardSchemaV1<PrecisionParams> = precisionParamsSchema;\n override renderOutputType(params: PrecisionParams): string | undefined {\n return sqlTimestampRenderOutputType(params);\n }\n override factory(_params: PrecisionParams): (ctx: CodecInstanceContext) => SqlTimestampCodec {\n return () => new SqlTimestampCodec(this);\n }\n}\n\nexport const sqlTimestampDescriptor = new SqlTimestampDescriptor();\n\nexport const sqlTimestampColumn = (params: PrecisionParams = {}) =>\n column(\n sqlTimestampDescriptor.factory(params),\n sqlTimestampDescriptor.codecId,\n params,\n 'timestamp',\n );\n\nsqlTimestampColumn satisfies ColumnHelperFor<SqlTimestampDescriptor>;\nsqlTimestampColumn satisfies ColumnHelperForStrict<SqlTimestampDescriptor>;\n","import type { AnyQueryAst, ParamRef } from './types';\n\nexport function compact<T extends Record<string, unknown>>(o: T): T {\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(o)) {\n if (v === undefined || v === null) continue;\n if (Array.isArray(v) && v.length === 0) continue;\n out[k] = v;\n }\n return out as T;\n}\n\n/**\n * Walks an AST's parameter references in first-encounter order and dedupes\n * by ParamRef identity. The single canonical helper used by every consumer\n * that aligns `plan.params` with metadata-by-index — the SQL builder lane,\n * the SQL ORM client, the SQL runtime encoder, and the Postgres renderer's\n * `$N` index map — so the four walks cannot drift in dedupe semantics.\n *\n * SQLite's `?`-placeholder renderer intentionally does NOT use this helper\n * because it needs one params entry per occurrence in the SQL.\n */\nexport function collectOrderedParamRefs(ast: AnyQueryAst): ReadonlyArray<ParamRef> {\n const seen = new Set<ParamRef>();\n const ordered: ParamRef[] = [];\n for (const ref of ast.collectParamRefs()) {\n if (seen.has(ref)) continue;\n seen.add(ref);\n ordered.push(ref);\n }\n return Object.freeze(ordered);\n}\n","/**\n * Builder-pipeline validator pass: every {@link ParamRef} whose `codecId` resolves to a *parameterized* descriptor must carry `refs: { table, column }` so encode-side dispatch can call `contractCodecs.forColumn(table, column)`. Refs-less parameterized `ParamRef`s are a hard error — the codec-id-keyed `forCodecId` fallback cannot disambiguate per-instance codecs (e.g. `vector(1024)` vs. `vector(1536)`), so the dispatch\n * path must reject them at validation time rather than silently bind to the wrong instance.\n *\n * Non-parameterized codec ids (the `voidParamsSchema` case) are always dispatch-safe via codec id alone, so refs-less ParamRefs for those ids are accepted unchanged.\n *\n * The pass runs post-build / pre-execute — the natural location is the SQL runtime's `lower()` step, between any `beforeCompile` rewrites and `encodeParams`. See AC-5 in the codec-registry-unification spec.\n */\n\nimport { runtimeError } from '@prisma-next/framework-components/runtime';\nimport type { CodecDescriptorRegistry } from '../query-lane-context';\nimport type { AnyQueryAst, ParamRef } from './types';\nimport { collectOrderedParamRefs } from './util';\n\n/**\n * Validate that every parameterized-codec `ParamRef` in `plan` carries `refs`. Throws `RUNTIME.PARAM_REF_REFS_REQUIRED` (a runtime envelope) naming the codec id and the binding label when the invariant is violated. Returns the plan unchanged on success — callers that prefer a side-effecting assertion can ignore the return value.\n *\n * The `registry` is consulted via `descriptorFor(codecId).isParameterized` — `true` whenever the descriptor's `paramsSchema` is not the singleton `voidParamsSchema`.\n */\nexport function validateParamRefRefs(plan: AnyQueryAst, registry: CodecDescriptorRegistry): void {\n for (const ref of collectOrderedParamRefs(plan)) {\n diagnoseRef(ref, registry);\n }\n}\n\nfunction diagnoseRef(ref: ParamRef, registry: CodecDescriptorRegistry): void {\n if (!ref.codecId) return;\n const descriptor = registry.descriptorFor(ref.codecId);\n if (descriptor === undefined) return;\n if (!descriptor.isParameterized) return;\n if (ref.refs) return;\n\n const label = ref.name ?? '<anonymous>';\n throw runtimeError(\n 'RUNTIME.PARAM_REF_REFS_REQUIRED',\n `ParamRef '${label}' for parameterized codec '${ref.codecId}' is missing column refs; column-aware dispatch requires { table, column } at the binding site.`,\n { codecId: ref.codecId, paramName: ref.name },\n );\n}\n"],"mappings":";;;;;;AAQA,MAAa,oBAAoB;AACjC,MAAa,uBAAuB;AACpC,MAAa,mBAAmB;AAChC,MAAa,qBAAqB;AAClC,MAAa,oBAAoB;AACjC,MAAa,yBAAyB;AAEtC,MAAa,iBAAiB,UAA0B;AACxD,MAAa,iBAAiB,SAAyB,KAAK,SAAS;AACrE,MAAa,2BAA2B,eAA6C;CACnF,MAAM,SAAS,WAAW;AAC1B,KAAI,WAAW,OAAW,QAAO;AACjC,KAAI,OAAO,WAAW,YAAY,CAAC,OAAO,SAAS,OAAO,IAAI,CAAC,OAAO,UAAU,OAAO,CACrF,OAAM,IAAI,MACR,2EAA2E,OAAO,OAAO,GAC1F;AAEH,Q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AA2C;CACjF,MAAM,uBAAO,IAAI,KAAe;CAChC,MAAMC,UAAsB,EAAE;AAC9B,MAAK,MAAM,OAAO,IAAI,kBAAkB,EAAE;AACxC,MAAI,KAAK,IAAI,IAAI,CAAE;AACnB,OAAK,IAAI,IAAI;AACb,UAAQ,KAAK,IAAI;;AAEnB,QAAO,OAAO,OAAO,QAAQ;;;;;;;;;;;;;;;;;;ACX/B,SAAgB,qBAAqB,MAAmB,UAAyC;AAC/F,MAAK,MAAM,OAAO,wBAAwB,KAAK,CAC7C,aAAY,KAAK,SAAS;;AAI9B,SAAS,YAAY,KAAe,UAAyC;AAC3E,KAAI,CAAC,IAAI,QAAS;CAClB,MAAM,aAAa,SAAS,cAAc,IAAI,QAAQ;AACtD,KAAI,eAAe,OAAW;AAC9B,KAAI,CAAC,WAAW,gBAAiB;AACjC,KAAI,IAAI,KAAM;AAGd,OAAM,aACJ,mCACA,aAHY,IAAI,QAAQ,cAGL,6BAA6B,IAAI,QAAQ,kGAC5D;EAAE,SAAS,IAAI;EAAS,WAAW,IAAI;EAAM,CAC9C"}
@@ -0,0 +1,18 @@
1
+ import { n as CodecDescriptorRegistry, s as AnyCodecDescriptor } from "../query-lane-context-DlWgKvvt.mjs";
2
+
3
+ //#region src/codec-descriptor-registry.d.ts
4
+
5
+ /**
6
+ * Build a {@link CodecDescriptorRegistry} from a flat descriptor list.
7
+ *
8
+ * Used by:
9
+ * - Each codec-shipping package's `core/registry.ts` to expose a package-scoped registry as the public consumer surface (replacing raw descriptor-array exports). See ADR 208.
10
+ * - The runtime's `buildExecutionContext` to construct the contract-bound combined registry from every contributor's `codecs:` slot.
11
+ *
12
+ * The descriptor map is heterogeneous in `P` — each codec id has its own params shape. The public {@link CodecDescriptorRegistry} interface widens to `CodecDescriptor<unknown>` and consumers narrow per codec id at the call site (the descriptor's `paramsSchema` validates JSON-sourced params before the factory ever sees them, so the runtime narrow is safe). The cast at registration goes through `unknown` because
13
+ * `CodecDescriptor<P>` is invariant in `P` (the `factory` and `renderOutputType` slots use `P` contravariantly).
14
+ */
15
+ declare function buildCodecDescriptorRegistry(allDescriptors: ReadonlyArray<AnyCodecDescriptor>): CodecDescriptorRegistry;
16
+ //#endregion
17
+ export { buildCodecDescriptorRegistry };
18
+ //# sourceMappingURL=codec-descriptor-registry.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-descriptor-registry.d.mts","names":[],"sources":["../../src/codec-descriptor-registry.ts"],"sourcesContent":[],"mappings":";;;;;AAcA;;;;;;;;;iBAAgB,4BAAA,iBACE,cAAc,sBAC7B"}
@@ -0,0 +1,40 @@
1
+ //#region src/codec-descriptor-registry.ts
2
+ /**
3
+ * Build a {@link CodecDescriptorRegistry} from a flat descriptor list.
4
+ *
5
+ * Used by:
6
+ * - Each codec-shipping package's `core/registry.ts` to expose a package-scoped registry as the public consumer surface (replacing raw descriptor-array exports). See ADR 208.
7
+ * - The runtime's `buildExecutionContext` to construct the contract-bound combined registry from every contributor's `codecs:` slot.
8
+ *
9
+ * The descriptor map is heterogeneous in `P` — each codec id has its own params shape. The public {@link CodecDescriptorRegistry} interface widens to `CodecDescriptor<unknown>` and consumers narrow per codec id at the call site (the descriptor's `paramsSchema` validates JSON-sourced params before the factory ever sees them, so the runtime narrow is safe). The cast at registration goes through `unknown` because
10
+ * `CodecDescriptor<P>` is invariant in `P` (the `factory` and `renderOutputType` slots use `P` contravariantly).
11
+ */
12
+ function buildCodecDescriptorRegistry(allDescriptors) {
13
+ const byId = /* @__PURE__ */ new Map();
14
+ const byTargetType = /* @__PURE__ */ new Map();
15
+ for (const descriptor of allDescriptors) {
16
+ if (byId.has(descriptor.codecId)) throw new Error(`Duplicate codec descriptor id: '${descriptor.codecId}' — registered twice during registry construction. Each codecId must be contributed by exactly one component (target / adapter / extension pack).`);
17
+ const widened = descriptor;
18
+ byId.set(descriptor.codecId, widened);
19
+ for (const targetType of descriptor.targetTypes) {
20
+ const list = byTargetType.get(targetType);
21
+ if (list) list.push(widened);
22
+ else byTargetType.set(targetType, [widened]);
23
+ }
24
+ }
25
+ return {
26
+ descriptorFor(codecId) {
27
+ return byId.get(codecId);
28
+ },
29
+ *values() {
30
+ yield* byId.values();
31
+ },
32
+ byTargetType(targetType) {
33
+ return byTargetType.get(targetType) ?? Object.freeze([]);
34
+ }
35
+ };
36
+ }
37
+
38
+ //#endregion
39
+ export { buildCodecDescriptorRegistry };
40
+ //# sourceMappingURL=codec-descriptor-registry.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-descriptor-registry.mjs","names":[],"sources":["../../src/codec-descriptor-registry.ts"],"sourcesContent":["import type { CodecDescriptor } from '@prisma-next/framework-components/codec';\nimport type { AnyCodecDescriptor } from './ast/codec-types';\nimport type { CodecDescriptorRegistry } from './query-lane-context';\n\n/**\n * Build a {@link CodecDescriptorRegistry} from a flat descriptor list.\n *\n * Used by:\n * - Each codec-shipping package's `core/registry.ts` to expose a package-scoped registry as the public consumer surface (replacing raw descriptor-array exports). See ADR 208.\n * - The runtime's `buildExecutionContext` to construct the contract-bound combined registry from every contributor's `codecs:` slot.\n *\n * The descriptor map is heterogeneous in `P` — each codec id has its own params shape. The public {@link CodecDescriptorRegistry} interface widens to `CodecDescriptor<unknown>` and consumers narrow per codec id at the call site (the descriptor's `paramsSchema` validates JSON-sourced params before the factory ever sees them, so the runtime narrow is safe). The cast at registration goes through `unknown` because\n * `CodecDescriptor<P>` is invariant in `P` (the `factory` and `renderOutputType` slots use `P` contravariantly).\n */\nexport function buildCodecDescriptorRegistry(\n allDescriptors: ReadonlyArray<AnyCodecDescriptor>,\n): CodecDescriptorRegistry {\n type AnyDescriptor = CodecDescriptor<unknown>;\n const byId = new Map<string, AnyDescriptor>();\n const byTargetType = new Map<string, Array<AnyDescriptor>>();\n\n for (const descriptor of allDescriptors) {\n if (byId.has(descriptor.codecId)) {\n throw new Error(\n `Duplicate codec descriptor id: '${descriptor.codecId}' — registered twice during registry construction. ` +\n 'Each codecId must be contributed by exactly one component (target / adapter / extension pack).',\n );\n }\n const widened = descriptor as unknown as AnyDescriptor;\n byId.set(descriptor.codecId, widened);\n for (const targetType of descriptor.targetTypes) {\n const list = byTargetType.get(targetType);\n if (list) {\n list.push(widened);\n } else {\n byTargetType.set(targetType, [widened]);\n }\n }\n }\n\n return {\n descriptorFor(codecId: string): AnyDescriptor | undefined {\n return byId.get(codecId);\n },\n *values(): IterableIterator<AnyDescriptor> {\n yield* byId.values();\n },\n byTargetType(targetType: string): readonly AnyDescriptor[] {\n return byTargetType.get(targetType) ?? Object.freeze([]);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;AAcA,SAAgB,6BACd,gBACyB;CAEzB,MAAM,uBAAO,IAAI,KAA4B;CAC7C,MAAM,+BAAe,IAAI,KAAmC;AAE5D,MAAK,MAAM,cAAc,gBAAgB;AACvC,MAAI,KAAK,IAAI,WAAW,QAAQ,CAC9B,OAAM,IAAI,MACR,mCAAmC,WAAW,QAAQ,mJAEvD;EAEH,MAAM,UAAU;AAChB,OAAK,IAAI,WAAW,SAAS,QAAQ;AACrC,OAAK,MAAM,cAAc,WAAW,aAAa;GAC/C,MAAM,OAAO,aAAa,IAAI,WAAW;AACzC,OAAI,KACF,MAAK,KAAK,QAAQ;OAElB,cAAa,IAAI,YAAY,CAAC,QAAQ,CAAC;;;AAK7C,QAAO;EACL,cAAc,SAA4C;AACxD,UAAO,KAAK,IAAI,QAAQ;;EAE1B,CAAC,SAA0C;AACzC,UAAO,KAAK,QAAQ;;EAEtB,aAAa,YAA8C;AACzD,UAAO,aAAa,IAAI,WAAW,IAAI,OAAO,OAAO,EAAE,CAAC;;EAE3D"}
@@ -1,5 +1,5 @@
1
- import "../codec-types-DJEaWT36.mjs";
2
- import "../query-lane-context-Bwca4sc8.mjs";
3
- import "../types-DviRR7AL.mjs";
4
- import { n as planUnsupported, t as planInvalid } from "../errors-p3Ou_n9J.mjs";
1
+ import "../query-lane-context-DlWgKvvt.mjs";
2
+ import "../sql-execution-plan-DTfj23Tj.mjs";
3
+ import "../types-G3hdNPZZ.mjs";
4
+ import { n as planUnsupported, t as planInvalid } from "../errors-Chs-ph28.mjs";
5
5
  export { planInvalid, planUnsupported };
@@ -1,3 +1,3 @@
1
- import { n as planUnsupported, t as planInvalid } from "../errors-D6kqqjHM.mjs";
1
+ import { n as planUnsupported, t as planInvalid } from "../errors-kgKOaDM1.mjs";
2
2
 
3
3
  export { planInvalid, planUnsupported };
@@ -1,4 +1,4 @@
1
- import { o as AnyExpression } from "../types-B4dL4lc3.mjs";
1
+ import { o as AnyExpression } from "../types-U74HFwNI.mjs";
2
2
  import { ParamSpec } from "@prisma-next/operations";
3
3
  import { SqlLoweringSpec } from "@prisma-next/sql-operations";
4
4
  import { QueryOperationReturn } from "@prisma-next/sql-contract/types";
@@ -9,10 +9,7 @@ type ScopeField = {
9
9
  nullable: boolean;
10
10
  };
11
11
  /**
12
- * A typed SQL expression. Identity is carried by the `returnType` descriptor
13
- * (inherited from `QueryOperationReturn` and narrowed to `T`) — distinct `T`
14
- * makes distinct Expression types structurally. `buildAst()` materialises the
15
- * underlying AST node.
12
+ * A typed SQL expression. Identity is carried by the `returnType` descriptor (inherited from `QueryOperationReturn` and narrowed to `T`) — distinct `T` makes distinct Expression types structurally. `buildAst()` materialises the underlying AST node.
16
13
  */
17
14
  type Expression<T$1 extends ScopeField> = QueryOperationReturn & {
18
15
  readonly returnType: T$1;
@@ -28,9 +25,9 @@ type NullSuffix<N> = N extends true ? null : never;
28
25
  * An expression or literal value targeting a specific codec.
29
26
  *
30
27
  * Accepts any of:
31
- * - An `Expression` whose codec matches exactly
32
- * - A raw JS value of the codec's `input` type
33
- * - `null` when `Nullable` is true
28
+ * - An `Expression` whose codec matches exactly
29
+ * - A raw JS value of the codec's `input` type
30
+ * - `null` when `Nullable` is true
34
31
  */
35
32
  type CodecExpression<CodecId extends string, Nullable extends boolean, CT extends Record<string, {
36
33
  readonly input: unknown;
@@ -39,11 +36,9 @@ type CodecExpression<CodecId extends string, Nullable extends boolean, CT extend
39
36
  nullable: Nullable;
40
37
  }> | (CodecId extends keyof CT ? CT[CodecId]['input'] : never) | NullSuffix<Nullable>;
41
38
  /**
42
- * An expression or literal value targeting any codec whose trait set contains
43
- * all the required traits.
39
+ * An expression or literal value targeting any codec whose trait set contains all the required traits.
44
40
  *
45
- * Resolves the trait set to the union of matching codec identities via
46
- * `CodecIdsWithTrait`, then reuses `CodecExpression` for the codec-id form.
41
+ * Resolves the trait set to the union of matching codec identities via `CodecIdsWithTrait`, then reuses `CodecExpression` for the codec-id form.
47
42
  */
48
43
  type TraitExpression<Traits extends readonly string[], Nullable extends boolean, CT extends Record<string, {
49
44
  readonly input: unknown;
@@ -51,29 +46,39 @@ type TraitExpression<Traits extends readonly string[], Nullable extends boolean,
51
46
  /**
52
47
  * Resolve a raw value or an Expression into an AST expression node.
53
48
  *
54
- * When `value` is an Expression (duck-typed by its `buildAst` method), the AST
55
- * it wraps is returned. Otherwise the value is embedded as a ParamRef tagged
56
- * with `codecId` (if given). Pass `codecId` to encode the literal with a
57
- * specific codec — most operations do.
49
+ * When `value` is an Expression (duck-typed by its `buildAst` method), the AST it wraps is returned. Otherwise the value is embedded as a ParamRef tagged with `codecId` (if given) and optionally `refs: { table, column }` (if the caller knows the column-bound site).
50
+ *
51
+ * For parameterized codec ids (e.g. `pg/vector@1`), encode-side dispatch requires `refs` to select the per-instance codec — so operation implementations that compare a column to a user-supplied value should derive `refs` from the column-bound side and pass it down. Non-parameterized codec ids (e.g. `pg/int4@1`) tolerate refs-less ParamRefs; the validator pass enforces refs only for parameterized ids.
52
+ */
53
+ declare function toExpr(value: unknown, codecId?: string, refs?: {
54
+ table: string;
55
+ column: string;
56
+ }): AnyExpression;
57
+ /**
58
+ * Derive `(table, column)` refs from an expression-like value when it carries column-bound metadata. Returns `undefined` for non-column-bound expressions and for raw scalar values.
59
+ *
60
+ * Two sources are consulted, in order: 1. An optional `refs` slot on the `Expression` wrapper (the SQL builder's `ExpressionImpl` records `(table, column)` for top-level fields whose AST is `IdentifierRef` — the AST stays bare to preserve SQL rendering, the metadata lives on the wrapper). 2. The wrapped AST when it's already a `ColumnRef` (the namespaced field-proxy form, or operation impls passing column-bound exprs
61
+ * directly).
62
+ *
63
+ * Operation implementations call this on the column-bound side of a comparison and forward the refs to {@link toExpr} on the user-value side, so the resulting `ParamRef` carries the table+column required by encode-side `forColumn` dispatch.
58
64
  */
59
- declare function toExpr(value: unknown, codecId?: string): AnyExpression;
65
+ declare function refsOf(value: unknown): {
66
+ table: string;
67
+ column: string;
68
+ } | undefined;
60
69
  interface BuildOperationSpec<R extends ScopeField> {
61
70
  readonly method: string;
62
71
  /**
63
- * The operation's arguments. The first element is the self argument (the
64
- * value the operation is being applied to); the rest are the remaining
65
- * user-supplied arguments.
72
+ * The operation's arguments. The first element is the self argument (the value the operation is being applied to); the rest are the remaining user-supplied arguments.
66
73
  */
67
74
  readonly args: readonly [AnyExpression, ...AnyExpression[]];
68
75
  readonly returns: R & ParamSpec;
69
76
  readonly lowering: SqlLoweringSpec;
70
77
  }
71
78
  /**
72
- * Construct an OperationExpr AST node and wrap it as a typed Expression.
73
- * Operation implementations use this to turn their user-facing arguments into
74
- * the AST node the compilation pipeline eventually lowers to SQL.
79
+ * Construct an OperationExpr AST node and wrap it as a typed Expression. Operation implementations use this to turn their user-facing arguments into the AST node the compilation pipeline eventually lowers to SQL.
75
80
  */
76
81
  declare function buildOperation<R extends ScopeField>(spec: BuildOperationSpec<R>): Expression<R>;
77
82
  //#endregion
78
- export { BuildOperationSpec, CodecExpression, Expression, ScopeField, TraitExpression, buildOperation, toExpr };
83
+ export { BuildOperationSpec, CodecExpression, Expression, ScopeField, TraitExpression, buildOperation, refsOf, toExpr };
79
84
  //# sourceMappingURL=expression.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"expression.d.mts","names":[],"sources":["../../src/expression.ts"],"sourcesContent":[],"mappings":";;;;;;KAMY,UAAA;;EAAA,QAAA,EAAA,OAAU;AAQtB,CAAA;;;;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,CAAA,CAAA,GAFX,UAEW,CAAA;EAAX,OAAA,EAFsB,OAEtB;EAAU,QAAA,EAF+B,QAE/B;AAOd,CAAA,CAAA,GAAY,CARP,OAQO,SAAe,MARA,EAQA,GARK,EAQL,CARQ,OAQR,CAAA,CAAA,OAAA,CAAA,GAAA,KAAA,CAAA,GAPvB,UAOuB,CAPZ,QAOY,CAAA;;;;;;AAIkC,KAJjD,eAIiD,CAAA,eAAA,SAAA,MAAA,EAAA,EAAA,iBAAA,OAAA,EAAA,WADhD,MACgD,CAAA,MAAA,EAAA;EAAzD,SAAA,KAAA,EAAA,OAAA;CAAe,CAAA,CAAA,GAAf,eAAe,CAAC,iBAAD,CAAmB,EAAnB,EAAuB,MAAvB,CAAA,EAAgC,QAAhC,EAA0C,EAA1C,CAAA;AASnB;AAuBA;AAoBA;;;;;AAMwB,iBAjDR,MAAA,CAiDQ,KAAA,EAAA,OAAA,EAAA,OAAA,CAAA,EAAA,MAAA,EAAA,IAOxB,CAPwB,EAAA;EACH,KAAA,EAAA,MAAA;EAAe,MAAA,EAAA,MAAA;AAMpC,CAAA,CAAA,EApDG,aAoDa;;;;;;;;;iBAjCA,MAAA;;;;UAoBC,6BAA6B;;;;;2BAKnB,kBAAkB;oBACzB,IAAI;qBACH;;;;;iBAML,yBAAyB,kBAAkB,mBAAmB,KAAK,WAAW"}
@@ -1,25 +1,47 @@
1
- import { S as OperationExpr, T as ParamRef } from "../types-DUL-3vy6.mjs";
1
+ import { S as OperationExpr, T as ParamRef } from "../types-CO7zrXfK.mjs";
2
2
 
3
3
  //#region src/expression.ts
4
4
  /**
5
5
  * Resolve a raw value or an Expression into an AST expression node.
6
6
  *
7
- * When `value` is an Expression (duck-typed by its `buildAst` method), the AST
8
- * it wraps is returned. Otherwise the value is embedded as a ParamRef tagged
9
- * with `codecId` (if given). Pass `codecId` to encode the literal with a
10
- * specific codec — most operations do.
7
+ * When `value` is an Expression (duck-typed by its `buildAst` method), the AST it wraps is returned. Otherwise the value is embedded as a ParamRef tagged with `codecId` (if given) and optionally `refs: { table, column }` (if the caller knows the column-bound site).
8
+ *
9
+ * For parameterized codec ids (e.g. `pg/vector@1`), encode-side dispatch requires `refs` to select the per-instance codec — so operation implementations that compare a column to a user-supplied value should derive `refs` from the column-bound side and pass it down. Non-parameterized codec ids (e.g. `pg/int4@1`) tolerate refs-less ParamRefs; the validator pass enforces refs only for parameterized ids.
11
10
  */
12
- function toExpr(value, codecId) {
11
+ function toExpr(value, codecId, refs) {
13
12
  if (isExpressionLike(value)) return value.buildAst();
14
- return ParamRef.of(value, codecId ? { codecId } : void 0);
13
+ if (codecId === void 0 && refs === void 0) return ParamRef.of(value);
14
+ return ParamRef.of(value, {
15
+ ...codecId !== void 0 ? { codecId } : {},
16
+ ...refs !== void 0 ? { refs } : {}
17
+ });
18
+ }
19
+ /**
20
+ * Derive `(table, column)` refs from an expression-like value when it carries column-bound metadata. Returns `undefined` for non-column-bound expressions and for raw scalar values.
21
+ *
22
+ * Two sources are consulted, in order: 1. An optional `refs` slot on the `Expression` wrapper (the SQL builder's `ExpressionImpl` records `(table, column)` for top-level fields whose AST is `IdentifierRef` — the AST stays bare to preserve SQL rendering, the metadata lives on the wrapper). 2. The wrapped AST when it's already a `ColumnRef` (the namespaced field-proxy form, or operation impls passing column-bound exprs
23
+ * directly).
24
+ *
25
+ * Operation implementations call this on the column-bound side of a comparison and forward the refs to {@link toExpr} on the user-value side, so the resulting `ParamRef` carries the table+column required by encode-side `forColumn` dispatch.
26
+ */
27
+ function refsOf(value) {
28
+ if (!isExpressionLike(value)) return void 0;
29
+ const wrapperRefs = value.refs;
30
+ if (wrapperRefs) return {
31
+ table: wrapperRefs.table,
32
+ column: wrapperRefs.column
33
+ };
34
+ const ast = value.buildAst();
35
+ if (ast.kind === "column-ref") return {
36
+ table: ast.table,
37
+ column: ast.column
38
+ };
15
39
  }
16
40
  function isExpressionLike(value) {
17
41
  return typeof value === "object" && value !== null && "buildAst" in value && typeof value.buildAst === "function";
18
42
  }
19
43
  /**
20
- * Construct an OperationExpr AST node and wrap it as a typed Expression.
21
- * Operation implementations use this to turn their user-facing arguments into
22
- * the AST node the compilation pipeline eventually lowers to SQL.
44
+ * Construct an OperationExpr AST node and wrap it as a typed Expression. Operation implementations use this to turn their user-facing arguments into the AST node the compilation pipeline eventually lowers to SQL.
23
45
  */
24
46
  function buildOperation(spec) {
25
47
  const [self, ...rest] = spec.args;
@@ -37,5 +59,5 @@ function buildOperation(spec) {
37
59
  }
38
60
 
39
61
  //#endregion
40
- export { buildOperation, toExpr };
62
+ export { buildOperation, refsOf, toExpr };
41
63
  //# sourceMappingURL=expression.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"expression.mjs","names":[],"sources":["../../src/expression.ts"],"sourcesContent":["import type { ParamSpec } from '@prisma-next/operations';\nimport type { QueryOperationReturn } from '@prisma-next/sql-contract/types';\nimport type { SqlLoweringSpec } from '@prisma-next/sql-operations';\nimport type { AnyExpression as AstExpression } from './ast/types';\nimport { OperationExpr, ParamRef } from './ast/types';\n\nexport type ScopeField = { codecId: string; nullable: boolean };\n\n/**\n * A typed SQL expression. Identity is carried by the `returnType` descriptor\n * (inherited from `QueryOperationReturn` and narrowed to `T`) — distinct `T`\n * makes distinct Expression types structurally. `buildAst()` materialises the\n * underlying AST node.\n */\nexport type Expression<T extends ScopeField> = QueryOperationReturn & {\n readonly returnType: T;\n buildAst(): AstExpression;\n};\n\ntype CodecIdsWithTrait<\n CT extends Record<string, { readonly input: unknown }>,\n RequiredTraits extends readonly string[],\n> = {\n [K in keyof CT & string]: CT[K] extends { readonly traits: infer T }\n ? [RequiredTraits[number]] extends [T]\n ? K\n : never\n : never;\n}[keyof CT & string];\n\ntype NullSuffix<N> = N extends true ? null : never;\n\n/**\n * An expression or literal value targeting a specific codec.\n *\n * Accepts any of:\n * - An `Expression` whose codec matches exactly\n * - A raw JS value of the codec's `input` type\n * - `null` when `Nullable` is true\n */\nexport type CodecExpression<\n CodecId extends string,\n Nullable extends boolean,\n CT extends Record<string, { readonly input: unknown }>,\n> =\n | Expression<{ codecId: CodecId; nullable: Nullable }>\n | (CodecId extends keyof CT ? CT[CodecId]['input'] : never)\n | NullSuffix<Nullable>;\n\n/**\n * An expression or literal value targeting any codec whose trait set contains\n * all the required traits.\n *\n * Resolves the trait set to the union of matching codec identities via\n * `CodecIdsWithTrait`, then reuses `CodecExpression` for the codec-id form.\n */\nexport type TraitExpression<\n Traits extends readonly string[],\n Nullable extends boolean,\n CT extends Record<string, { readonly input: unknown }>,\n> = CodecExpression<CodecIdsWithTrait<CT, Traits>, Nullable, CT>;\n\n/**\n * Resolve a raw value or an Expression into an AST expression node.\n *\n * When `value` is an Expression (duck-typed by its `buildAst` method), the AST\n * it wraps is returned. Otherwise the value is embedded as a ParamRef tagged\n * with `codecId` (if given). Pass `codecId` to encode the literal with a\n * specific codec — most operations do.\n */\nexport function toExpr(value: unknown, codecId?: string): AstExpression {\n if (isExpressionLike(value)) {\n return value.buildAst();\n }\n return ParamRef.of(value, codecId ? { codecId } : undefined);\n}\n\nfunction isExpressionLike(value: unknown): value is Expression<ScopeField> {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'buildAst' in value &&\n typeof (value as { buildAst: unknown }).buildAst === 'function'\n );\n}\n\nexport interface BuildOperationSpec<R extends ScopeField> {\n readonly method: string;\n /**\n * The operation's arguments. The first element is the self argument (the\n * value the operation is being applied to); the rest are the remaining\n * user-supplied arguments.\n */\n readonly args: readonly [AstExpression, ...AstExpression[]];\n readonly returns: R & ParamSpec;\n readonly lowering: SqlLoweringSpec;\n}\n\n/**\n * Construct an OperationExpr AST node and wrap it as a typed Expression.\n * Operation implementations use this to turn their user-facing arguments into\n * the AST node the compilation pipeline eventually lowers to SQL.\n */\nexport function buildOperation<R extends ScopeField>(spec: BuildOperationSpec<R>): Expression<R> {\n const [self, ...rest] = spec.args;\n const op = new OperationExpr({\n method: spec.method,\n self,\n args: rest.length > 0 ? rest : undefined,\n returns: spec.returns,\n lowering: spec.lowering,\n });\n return {\n returnType: spec.returns,\n buildAst: () => op,\n };\n}\n"],"mappings":";;;;;;;;;;;AAsEA,SAAgB,OAAO,OAAgB,SAAiC;AACtE,KAAI,iBAAiB,MAAM,CACzB,QAAO,MAAM,UAAU;AAEzB,QAAO,SAAS,GAAG,OAAO,UAAU,EAAE,SAAS,GAAG,OAAU;;AAG9D,SAAS,iBAAiB,OAAiD;AACzE,QACE,OAAO,UAAU,YACjB,UAAU,QACV,cAAc,SACd,OAAQ,MAAgC,aAAa;;;;;;;AAqBzD,SAAgB,eAAqC,MAA4C;CAC/F,MAAM,CAAC,MAAM,GAAG,QAAQ,KAAK;CAC7B,MAAM,KAAK,IAAI,cAAc;EAC3B,QAAQ,KAAK;EACb;EACA,MAAM,KAAK,SAAS,IAAI,OAAO;EAC/B,SAAS,KAAK;EACd,UAAU,KAAK;EAChB,CAAC;AACF,QAAO;EACL,YAAY,KAAK;EACjB,gBAAgB;EACjB"}
1
+ {"version":3,"file":"expression.mjs","names":[],"sources":["../../src/expression.ts"],"sourcesContent":["import type { ParamSpec } from '@prisma-next/operations';\nimport type { QueryOperationReturn } from '@prisma-next/sql-contract/types';\nimport type { SqlLoweringSpec } from '@prisma-next/sql-operations';\nimport type { AnyExpression as AstExpression } from './ast/types';\nimport { OperationExpr, ParamRef } from './ast/types';\n\nexport type ScopeField = { codecId: string; nullable: boolean };\n\n/**\n * A typed SQL expression. Identity is carried by the `returnType` descriptor (inherited from `QueryOperationReturn` and narrowed to `T`) — distinct `T` makes distinct Expression types structurally. `buildAst()` materialises the underlying AST node.\n */\nexport type Expression<T extends ScopeField> = QueryOperationReturn & {\n readonly returnType: T;\n buildAst(): AstExpression;\n};\n\ntype CodecIdsWithTrait<\n CT extends Record<string, { readonly input: unknown }>,\n RequiredTraits extends readonly string[],\n> = {\n [K in keyof CT & string]: CT[K] extends { readonly traits: infer T }\n ? [RequiredTraits[number]] extends [T]\n ? K\n : never\n : never;\n}[keyof CT & string];\n\ntype NullSuffix<N> = N extends true ? null : never;\n\n/**\n * An expression or literal value targeting a specific codec.\n *\n * Accepts any of:\n * - An `Expression` whose codec matches exactly\n * - A raw JS value of the codec's `input` type\n * - `null` when `Nullable` is true\n */\nexport type CodecExpression<\n CodecId extends string,\n Nullable extends boolean,\n CT extends Record<string, { readonly input: unknown }>,\n> =\n | Expression<{ codecId: CodecId; nullable: Nullable }>\n | (CodecId extends keyof CT ? CT[CodecId]['input'] : never)\n | NullSuffix<Nullable>;\n\n/**\n * An expression or literal value targeting any codec whose trait set contains all the required traits.\n *\n * Resolves the trait set to the union of matching codec identities via `CodecIdsWithTrait`, then reuses `CodecExpression` for the codec-id form.\n */\nexport type TraitExpression<\n Traits extends readonly string[],\n Nullable extends boolean,\n CT extends Record<string, { readonly input: unknown }>,\n> = CodecExpression<CodecIdsWithTrait<CT, Traits>, Nullable, CT>;\n\n/**\n * Resolve a raw value or an Expression into an AST expression node.\n *\n * When `value` is an Expression (duck-typed by its `buildAst` method), the AST it wraps is returned. Otherwise the value is embedded as a ParamRef tagged with `codecId` (if given) and optionally `refs: { table, column }` (if the caller knows the column-bound site).\n *\n * For parameterized codec ids (e.g. `pg/vector@1`), encode-side dispatch requires `refs` to select the per-instance codec so operation implementations that compare a column to a user-supplied value should derive `refs` from the column-bound side and pass it down. Non-parameterized codec ids (e.g. `pg/int4@1`) tolerate refs-less ParamRefs; the validator pass enforces refs only for parameterized ids.\n */\nexport function toExpr(\n value: unknown,\n codecId?: string,\n refs?: { table: string; column: string },\n): AstExpression {\n if (isExpressionLike(value)) {\n return value.buildAst();\n }\n if (codecId === undefined && refs === undefined) return ParamRef.of(value);\n return ParamRef.of(value, {\n ...(codecId !== undefined ? { codecId } : {}),\n ...(refs !== undefined ? { refs } : {}),\n });\n}\n\n/**\n * Derive `(table, column)` refs from an expression-like value when it carries column-bound metadata. Returns `undefined` for non-column-bound expressions and for raw scalar values.\n *\n * Two sources are consulted, in order: 1. An optional `refs` slot on the `Expression` wrapper (the SQL builder's `ExpressionImpl` records `(table, column)` for top-level fields whose AST is `IdentifierRef` — the AST stays bare to preserve SQL rendering, the metadata lives on the wrapper). 2. The wrapped AST when it's already a `ColumnRef` (the namespaced field-proxy form, or operation impls passing column-bound exprs\n * directly).\n *\n * Operation implementations call this on the column-bound side of a comparison and forward the refs to {@link toExpr} on the user-value side, so the resulting `ParamRef` carries the table+column required by encode-side `forColumn` dispatch.\n */\nexport function refsOf(value: unknown): { table: string; column: string } | undefined {\n if (!isExpressionLike(value)) return undefined;\n const wrapperRefs = (value as { refs?: { table: string; column: string } }).refs;\n if (wrapperRefs) return { table: wrapperRefs.table, column: wrapperRefs.column };\n const ast = value.buildAst();\n if (ast.kind === 'column-ref') {\n return { table: ast.table, column: ast.column };\n }\n return undefined;\n}\n\nfunction isExpressionLike(value: unknown): value is Expression<ScopeField> {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'buildAst' in value &&\n typeof (value as { buildAst: unknown }).buildAst === 'function'\n );\n}\n\nexport interface BuildOperationSpec<R extends ScopeField> {\n readonly method: string;\n /**\n * The operation's arguments. The first element is the self argument (the value the operation is being applied to); the rest are the remaining user-supplied arguments.\n */\n readonly args: readonly [AstExpression, ...AstExpression[]];\n readonly returns: R & ParamSpec;\n readonly lowering: SqlLoweringSpec;\n}\n\n/**\n * Construct an OperationExpr AST node and wrap it as a typed Expression. Operation implementations use this to turn their user-facing arguments into the AST node the compilation pipeline eventually lowers to SQL.\n */\nexport function buildOperation<R extends ScopeField>(spec: BuildOperationSpec<R>): Expression<R> {\n const [self, ...rest] = spec.args;\n const op = new OperationExpr({\n method: spec.method,\n self,\n args: rest.length > 0 ? rest : undefined,\n returns: spec.returns,\n lowering: spec.lowering,\n });\n return {\n returnType: spec.returns,\n buildAst: () => op,\n };\n}\n"],"mappings":";;;;;;;;;;AAgEA,SAAgB,OACd,OACA,SACA,MACe;AACf,KAAI,iBAAiB,MAAM,CACzB,QAAO,MAAM,UAAU;AAEzB,KAAI,YAAY,UAAa,SAAS,OAAW,QAAO,SAAS,GAAG,MAAM;AAC1E,QAAO,SAAS,GAAG,OAAO;EACxB,GAAI,YAAY,SAAY,EAAE,SAAS,GAAG,EAAE;EAC5C,GAAI,SAAS,SAAY,EAAE,MAAM,GAAG,EAAE;EACvC,CAAC;;;;;;;;;;AAWJ,SAAgB,OAAO,OAA+D;AACpF,KAAI,CAAC,iBAAiB,MAAM,CAAE,QAAO;CACrC,MAAM,cAAe,MAAuD;AAC5E,KAAI,YAAa,QAAO;EAAE,OAAO,YAAY;EAAO,QAAQ,YAAY;EAAQ;CAChF,MAAM,MAAM,MAAM,UAAU;AAC5B,KAAI,IAAI,SAAS,aACf,QAAO;EAAE,OAAO,IAAI;EAAO,QAAQ,IAAI;EAAQ;;AAKnD,SAAS,iBAAiB,OAAiD;AACzE,QACE,OAAO,UAAU,YACjB,UAAU,QACV,cAAc,SACd,OAAQ,MAAgC,aAAa;;;;;AAiBzD,SAAgB,eAAqC,MAA4C;CAC/F,MAAM,CAAC,MAAM,GAAG,QAAQ,KAAK;CAC7B,MAAM,KAAK,IAAI,cAAc;EAC3B,QAAQ,KAAK;EACb;EACA,MAAM,KAAK,SAAS,IAAI,OAAO;EAC/B,SAAS,KAAK;EACd,UAAU,KAAK;EAChB,CAAC;AACF,QAAO;EACL,YAAY,KAAK;EACjB,gBAAgB;EACjB"}
@@ -1,3 +1,3 @@
1
- import { t as SqlExecutionPlan } from "../sql-execution-plan-Dgx7BGin.mjs";
2
- import { t as SqlQueryPlan } from "../plan-C7SiEWkN.mjs";
1
+ import { t as SqlExecutionPlan } from "../sql-execution-plan-DTfj23Tj.mjs";
2
+ import { t as SqlQueryPlan } from "../plan-nwFE15re.mjs";
3
3
  export { type SqlExecutionPlan, SqlQueryPlan };
@@ -1,3 +1,2 @@
1
- import "../codec-types-DJEaWT36.mjs";
2
- import { a as JsonSchemaValidationError, c as MutationDefaultsOp, i as JsonSchemaValidateFn, l as MutationDefaultsOptions, n as CodecDescriptorRegistry, o as JsonSchemaValidationResult, r as ExecutionContext, s as JsonSchemaValidatorRegistry, t as AppliedMutationDefault, u as TypeHelperRegistry } from "../query-lane-context-Bwca4sc8.mjs";
3
- export { AppliedMutationDefault, CodecDescriptorRegistry, ExecutionContext, JsonSchemaValidateFn, JsonSchemaValidationError, JsonSchemaValidationResult, JsonSchemaValidatorRegistry, MutationDefaultsOp, MutationDefaultsOptions, TypeHelperRegistry };
1
+ import { a as MutationDefaultsOptions, i as MutationDefaultsOp, n as CodecDescriptorRegistry, o as TypeHelperRegistry, r as ExecutionContext, t as AppliedMutationDefault } from "../query-lane-context-DlWgKvvt.mjs";
2
+ export { AppliedMutationDefault, CodecDescriptorRegistry, ExecutionContext, MutationDefaultsOp, MutationDefaultsOptions, TypeHelperRegistry };
@@ -1,5 +1,6 @@
1
- import "../codec-types-DJEaWT36.mjs";
2
- import "../query-lane-context-Bwca4sc8.mjs";
3
- import { C as TableKey, S as TableDef, T as TablesOf, _ as RawTemplateFactory, a as ComputeColumnJsType, b as SqlBuilderOptions, c as META, d as ModelMetadata, f as OperationTypeSignature, g as RawFunctionOptions, h as RawFactory, i as ColumnsOf, l as Meta, m as OperationsForTypeId, n as BuildParamsMap, o as Expr, p as OperationTypes, r as CodecTypes, s as HasIncludeManyCapabilities, t as BuildOptions, u as ModelDef, v as RawTemplateOptions, w as TableMetadata, x as SqlPlan, y as RuntimeError } from "../types-DviRR7AL.mjs";
4
- import { n as SqlOrmPlan, t as RuntimeScope } from "../types-BUlUvdIU.mjs";
1
+ import "../query-lane-context-DlWgKvvt.mjs";
2
+ import "../sql-execution-plan-DTfj23Tj.mjs";
3
+ import { C as TableKey, S as TableDef, T as TablesOf, _ as RawTemplateFactory, a as ComputeColumnJsType, b as SqlBuilderOptions, c as META, d as ModelMetadata, f as OperationTypeSignature, g as RawFunctionOptions, h as RawFactory, i as ColumnsOf, l as Meta, m as OperationsForTypeId, n as BuildParamsMap, o as Expr, p as OperationTypes, r as CodecTypes, s as HasIncludeManyCapabilities, t as BuildOptions, u as ModelDef, v as RawTemplateOptions, w as TableMetadata, x as SqlPlan, y as RuntimeError } from "../types-G3hdNPZZ.mjs";
4
+ import "../plan-nwFE15re.mjs";
5
+ import { n as SqlOrmPlan, t as RuntimeScope } from "../types-dPxXIUPS.mjs";
5
6
  export { BuildOptions, BuildParamsMap, CodecTypes, ColumnsOf, ComputeColumnJsType, Expr, HasIncludeManyCapabilities, META, Meta, ModelDef, ModelMetadata, OperationTypeSignature, OperationTypes, OperationsForTypeId, RawFactory, RawFunctionOptions, RawTemplateFactory, RawTemplateOptions, RuntimeError, RuntimeScope, SqlBuilderOptions, SqlOrmPlan, SqlPlan, TableDef, TableKey, TableMetadata, TablesOf };
package/dist/index.d.mts CHANGED
@@ -1,13 +1,12 @@
1
- import { _ as codec, a as CodecInput, c as CodecRegistry, d as ContractCodecRegistry, f as ExtractCodecTypes, g as SqlColumnRef, h as SqlCodecInstanceContext, i as CodecId, l as CodecTrait, m as SqlCodecCallContext, n as CodecCallContext, o as CodecMeta, p as ExtractDataTypes, r as CodecDefBuilder, s as CodecParamsDescriptor, t as Codec, u as CodecTraits, v as createCodecRegistry, y as defineCodecs } from "./codec-types-DJEaWT36.mjs";
2
- import { $ as ToWhereExpr, A as InsertOnConflict, B as NotExpr, C as ExistsExpr, D as ExpressionSource, E as ExpressionRewriter, F as JsonObjectEntry, G as ParamRef, H as OperationExpr, I as JsonObjectExpr, J as SelectAst, K as ProjectionExpr, L as ListExpression, M as JoinAst, N as JoinOnExpr, O as IdentifierRef, P as JsonArrayAggExpr, Q as TableSource, R as LiteralExpr, S as EqColJoinOn, T as ExpressionFolder, U as OrExpr, V as NullCheckExpr, W as OrderByItem, X as SubqueryExpr, Y as SelectAstOptions, Z as TableRef, _ as DeleteAst, a as AndExpr, at as whereExprKinds, b as DoNothingConflictAction, c as AnyInsertOnConflictAction, d as AnyQueryAst, et as UpdateAst, f as AstRewriter, g as DefaultValueExpr, h as ColumnRef, i as AggregateOpFn, it as queryAstKinds, j as InsertValue, k as InsertAst, l as AnyInsertValue, m as BinaryOp, n as AggregateExpr, nt as isQueryAst, o as AnyExpression, p as BinaryExpr, q as ProjectionItem, r as AggregateFn, rt as isWhereExpr, s as AnyFromSource, t as AggregateCountFn, tt as WhereArg, u as AnyOperationArg, v as DerivedTableSource, w as ExprVisitor, x as DoUpdateSetConflictAction, y as Direction, z as LoweredStatement } from "./types-B4dL4lc3.mjs";
3
- import { Adapter, AdapterProfile, AdapterTarget, Lowerer, LowererContext, MarkerStatement, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, SqlCodecTypes, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, SqlExplainResult, SqlQueryResult, SqlQueryable, SqlTransaction, collectOrderedParamRefs, compact, sqlCodecDefinitions, sqlDataTypes } from "./exports/ast.mjs";
4
- import { a as JsonSchemaValidationError, c as MutationDefaultsOp, i as JsonSchemaValidateFn, l as MutationDefaultsOptions, n as CodecDescriptorRegistry, o as JsonSchemaValidationResult, r as ExecutionContext, s as JsonSchemaValidatorRegistry, t as AppliedMutationDefault, u as TypeHelperRegistry } from "./query-lane-context-Bwca4sc8.mjs";
5
- import { t as SqlExecutionPlan } from "./sql-execution-plan-Dgx7BGin.mjs";
6
- import { C as TableKey, S as TableDef, T as TablesOf, _ as RawTemplateFactory, a as ComputeColumnJsType, b as SqlBuilderOptions, c as META, d as ModelMetadata, f as OperationTypeSignature, g as RawFunctionOptions, h as RawFactory, i as ColumnsOf, l as Meta, m as OperationsForTypeId, n as BuildParamsMap, o as Expr, p as OperationTypes, r as CodecTypes, s as HasIncludeManyCapabilities, t as BuildOptions, u as ModelDef, v as RawTemplateOptions, w as TableMetadata, x as SqlPlan, y as RuntimeError } from "./types-DviRR7AL.mjs";
7
- import { n as planUnsupported, t as planInvalid } from "./errors-p3Ou_n9J.mjs";
8
- import { BuildOperationSpec, CodecExpression, Expression, ScopeField, TraitExpression, buildOperation, toExpr } from "./exports/expression.mjs";
9
- import { t as SqlQueryPlan } from "./plan-C7SiEWkN.mjs";
1
+ import { $ as TableSource, A as InsertOnConflict, B as NotExpr, C as ExistsExpr, D as ExpressionSource, E as ExpressionRewriter, F as JsonObjectEntry, G as ParamRef, H as OperationExpr, I as JsonObjectExpr, J as ProjectionItem, K as ParamRefBindingRefs, L as ListExpression, M as JoinAst, N as JoinOnExpr, O as IdentifierRef, P as JsonArrayAggExpr, Q as TableRef, R as LiteralExpr, S as EqColJoinOn, T as ExpressionFolder, U as OrExpr, V as NullCheckExpr, W as OrderByItem, X as SelectAstOptions, Y as SelectAst, Z as SubqueryExpr, _ as DeleteAst, a as AndExpr, at as queryAstKinds, b as DoNothingConflictAction, c as AnyInsertOnConflictAction, d as AnyQueryAst, et as ToWhereExpr, f as AstRewriter, g as DefaultValueExpr, h as ColumnRef, i as AggregateOpFn, it as isWhereExpr, j as InsertValue, k as InsertAst, l as AnyInsertValue, m as BinaryOp, n as AggregateExpr, nt as WhereArg, o as AnyExpression, ot as whereExprKinds, p as BinaryExpr, q as ProjectionExpr, r as AggregateFn, rt as isQueryAst, s as AnyFromSource, t as AggregateCountFn, tt as UpdateAst, u as AnyOperationArg, v as DerivedTableSource, w as ExprVisitor, x as DoUpdateSetConflictAction, y as Direction, z as LoweredStatement } from "./types-U74HFwNI.mjs";
2
+ import { _ as ExtractCodecTypes, a as MutationDefaultsOptions, b as SqlColumnRef, c as Codec, d as CodecMeta, f as CodecTrait, g as DescriptorCodecTraits, h as DescriptorCodecInput, i as MutationDefaultsOp, l as CodecCallContext, m as DescriptorCodecId, n as CodecDescriptorRegistry, o as TypeHelperRegistry, p as ContractCodecRegistry, r as ExecutionContext, s as AnyCodecDescriptor, t as AppliedMutationDefault, u as CodecDescriptor, v as SqlCodecCallContext, y as SqlCodecInstanceContext } from "./query-lane-context-DlWgKvvt.mjs";
3
+ import { Adapter, AdapterProfile, AdapterTarget, Lowerer, LowererContext, MarkerStatement, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, SqlCharCodec, SqlCharDescriptor, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, SqlExplainResult, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlQueryResult, SqlQueryable, SqlTextCodec, SqlTextDescriptor, SqlTimestampCodec, SqlTimestampDescriptor, SqlTransaction, SqlVarcharCodec, SqlVarcharDescriptor, collectOrderedParamRefs, compact, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDescriptor, sqlFloatEncode, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlTimestampColumn, sqlTimestampDecode, sqlTimestampDecodeJson, sqlTimestampDescriptor, sqlTimestampEncode, sqlTimestampEncodeJson, sqlTimestampRenderOutputType, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, validateParamRefRefs } from "./exports/ast.mjs";
4
+ import { t as SqlExecutionPlan } from "./sql-execution-plan-DTfj23Tj.mjs";
5
+ import { C as TableKey, S as TableDef, T as TablesOf, _ as RawTemplateFactory, a as ComputeColumnJsType, b as SqlBuilderOptions, c as META, d as ModelMetadata, f as OperationTypeSignature, g as RawFunctionOptions, h as RawFactory, i as ColumnsOf, l as Meta, m as OperationsForTypeId, n as BuildParamsMap, o as Expr, p as OperationTypes, r as CodecTypes, s as HasIncludeManyCapabilities, t as BuildOptions, u as ModelDef, v as RawTemplateOptions, w as TableMetadata, x as SqlPlan, y as RuntimeError } from "./types-G3hdNPZZ.mjs";
6
+ import { n as planUnsupported, t as planInvalid } from "./errors-Chs-ph28.mjs";
7
+ import { BuildOperationSpec, CodecExpression, Expression, ScopeField, TraitExpression, buildOperation, refsOf, toExpr } from "./exports/expression.mjs";
8
+ import { t as SqlQueryPlan } from "./plan-nwFE15re.mjs";
10
9
  import "./exports/plan.mjs";
11
10
  import "./exports/query-lane-context.mjs";
12
- import { n as SqlOrmPlan, t as RuntimeScope } from "./types-BUlUvdIU.mjs";
13
- export { Adapter, AdapterProfile, AdapterTarget, AggregateCountFn, AggregateExpr, AggregateFn, AggregateOpFn, AndExpr, AnyExpression, AnyFromSource, AnyInsertOnConflictAction, AnyInsertValue, AnyOperationArg, AnyQueryAst, AppliedMutationDefault, AstRewriter, BinaryExpr, BinaryOp, BuildOperationSpec, BuildOptions, BuildParamsMap, Codec, CodecCallContext, CodecDefBuilder, CodecDescriptorRegistry, CodecExpression, CodecId, CodecInput, CodecMeta, CodecParamsDescriptor, CodecRegistry, CodecTrait, CodecTraits, CodecTypes, ColumnRef, ColumnsOf, ComputeColumnJsType, ContractCodecRegistry, DefaultValueExpr, DeleteAst, DerivedTableSource, Direction, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExecutionContext, ExistsExpr, Expr, ExprVisitor, Expression, ExpressionFolder, ExpressionRewriter, ExpressionSource, ExtractCodecTypes, ExtractDataTypes, HasIncludeManyCapabilities, IdentifierRef, InsertAst, InsertOnConflict, InsertValue, JoinAst, JoinOnExpr, JsonArrayAggExpr, JsonObjectEntry, JsonObjectExpr, JsonSchemaValidateFn, JsonSchemaValidationError, JsonSchemaValidationResult, JsonSchemaValidatorRegistry, ListExpression, LiteralExpr, LoweredStatement, Lowerer, LowererContext, META, MarkerStatement, Meta, ModelDef, ModelMetadata, MutationDefaultsOp, MutationDefaultsOptions, NotExpr, NullCheckExpr, OperationExpr, OperationTypeSignature, OperationTypes, OperationsForTypeId, OrExpr, OrderByItem, ParamRef, ProjectionExpr, ProjectionItem, RawFactory, RawFunctionOptions, RawTemplateFactory, RawTemplateOptions, RuntimeError, RuntimeScope, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, ScopeField, SelectAst, SelectAstOptions, SqlBuilderOptions, SqlCodecCallContext, SqlCodecInstanceContext, SqlCodecTypes, SqlColumnRef, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, SqlExecutionPlan, SqlExplainResult, SqlOrmPlan, SqlPlan, SqlQueryPlan, SqlQueryResult, SqlQueryable, SqlTransaction, SubqueryExpr, TableDef, TableKey, TableMetadata, TableRef, TableSource, TablesOf, ToWhereExpr, TraitExpression, TypeHelperRegistry, UpdateAst, WhereArg, buildOperation, codec, collectOrderedParamRefs, compact, createCodecRegistry, defineCodecs, isQueryAst, isWhereExpr, planInvalid, planUnsupported, queryAstKinds, sqlCodecDefinitions, sqlDataTypes, toExpr, whereExprKinds };
11
+ import { n as SqlOrmPlan, t as RuntimeScope } from "./types-dPxXIUPS.mjs";
12
+ export { Adapter, AdapterProfile, AdapterTarget, AggregateCountFn, AggregateExpr, AggregateFn, AggregateOpFn, AndExpr, AnyCodecDescriptor, AnyExpression, AnyFromSource, AnyInsertOnConflictAction, AnyInsertValue, AnyOperationArg, AnyQueryAst, AppliedMutationDefault, AstRewriter, BinaryExpr, BinaryOp, BuildOperationSpec, BuildOptions, BuildParamsMap, Codec, CodecCallContext, CodecDescriptor, CodecDescriptorRegistry, CodecExpression, CodecMeta, CodecTrait, CodecTypes, ColumnRef, ColumnsOf, ComputeColumnJsType, ContractCodecRegistry, DefaultValueExpr, DeleteAst, DerivedTableSource, DescriptorCodecId, DescriptorCodecInput, DescriptorCodecTraits, Direction, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExecutionContext, ExistsExpr, Expr, ExprVisitor, Expression, ExpressionFolder, ExpressionRewriter, ExpressionSource, ExtractCodecTypes, HasIncludeManyCapabilities, IdentifierRef, InsertAst, InsertOnConflict, InsertValue, JoinAst, JoinOnExpr, JsonArrayAggExpr, JsonObjectEntry, JsonObjectExpr, ListExpression, LiteralExpr, LoweredStatement, Lowerer, LowererContext, META, MarkerStatement, Meta, ModelDef, ModelMetadata, MutationDefaultsOp, MutationDefaultsOptions, NotExpr, NullCheckExpr, OperationExpr, OperationTypeSignature, OperationTypes, OperationsForTypeId, OrExpr, OrderByItem, ParamRef, ParamRefBindingRefs, ProjectionExpr, ProjectionItem, RawFactory, RawFunctionOptions, RawTemplateFactory, RawTemplateOptions, RuntimeError, RuntimeScope, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, ScopeField, SelectAst, SelectAstOptions, SqlBuilderOptions, SqlCharCodec, SqlCharDescriptor, SqlCodecCallContext, SqlCodecInstanceContext, SqlColumnRef, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, SqlExecutionPlan, SqlExplainResult, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlOrmPlan, SqlPlan, SqlQueryPlan, SqlQueryResult, SqlQueryable, SqlTextCodec, SqlTextDescriptor, SqlTimestampCodec, SqlTimestampDescriptor, SqlTransaction, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableDef, TableKey, TableMetadata, TableRef, TableSource, TablesOf, ToWhereExpr, TraitExpression, TypeHelperRegistry, UpdateAst, WhereArg, buildOperation, collectOrderedParamRefs, compact, isQueryAst, isWhereExpr, planInvalid, planUnsupported, queryAstKinds, refsOf, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDescriptor, sqlFloatEncode, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlTimestampColumn, sqlTimestampDecode, sqlTimestampDecodeJson, sqlTimestampDescriptor, sqlTimestampEncode, sqlTimestampEncodeJson, sqlTimestampRenderOutputType, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, toExpr, validateParamRefRefs, whereExprKinds };
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { A as UpdateAst, C as OrExpr, D as SelectAst, E as ProjectionItem, M as isWhereExpr, N as queryAstKinds, O as SubqueryExpr, P as whereExprKinds, S as OperationExpr, T as ParamRef, _ as JsonObjectExpr, a as DefaultValueExpr, b as NotExpr, c as DoNothingConflictAction, d as ExistsExpr, f as IdentifierRef, g as JsonArrayAggExpr, h as JoinAst, i as ColumnRef, j as isQueryAst, k as TableSource, l as DoUpdateSetConflictAction, m as InsertOnConflict, n as AndExpr, o as DeleteAst, p as InsertAst, r as BinaryExpr, s as DerivedTableSource, t as AggregateExpr, u as EqColJoinOn, v as ListExpression, w as OrderByItem, x as NullCheckExpr, y as LiteralExpr } from "./types-DUL-3vy6.mjs";
2
- import { SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, codec, collectOrderedParamRefs, compact, createCodecRegistry, defineCodecs, sqlCodecDefinitions, sqlDataTypes } from "./exports/ast.mjs";
3
- import { n as planUnsupported, t as planInvalid } from "./errors-D6kqqjHM.mjs";
4
- import { buildOperation, toExpr } from "./exports/expression.mjs";
1
+ import { A as UpdateAst, C as OrExpr, D as SelectAst, E as ProjectionItem, M as isWhereExpr, N as queryAstKinds, O as SubqueryExpr, P as whereExprKinds, S as OperationExpr, T as ParamRef, _ as JsonObjectExpr, a as DefaultValueExpr, b as NotExpr, c as DoNothingConflictAction, d as ExistsExpr, f as IdentifierRef, g as JsonArrayAggExpr, h as JoinAst, i as ColumnRef, j as isQueryAst, k as TableSource, l as DoUpdateSetConflictAction, m as InsertOnConflict, n as AndExpr, o as DeleteAst, p as InsertAst, r as BinaryExpr, s as DerivedTableSource, t as AggregateExpr, u as EqColJoinOn, v as ListExpression, w as OrderByItem, x as NullCheckExpr, y as LiteralExpr } from "./types-CO7zrXfK.mjs";
2
+ import { SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, SqlCharCodec, SqlCharDescriptor, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlTextCodec, SqlTextDescriptor, SqlTimestampCodec, SqlTimestampDescriptor, SqlVarcharCodec, SqlVarcharDescriptor, collectOrderedParamRefs, compact, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDescriptor, sqlFloatEncode, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlTimestampColumn, sqlTimestampDecode, sqlTimestampDecodeJson, sqlTimestampDescriptor, sqlTimestampEncode, sqlTimestampEncodeJson, sqlTimestampRenderOutputType, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, validateParamRefRefs } from "./exports/ast.mjs";
3
+ import { n as planUnsupported, t as planInvalid } from "./errors-kgKOaDM1.mjs";
4
+ import { buildOperation, refsOf, toExpr } from "./exports/expression.mjs";
5
5
  import "./exports/plan.mjs";
6
6
  import "./exports/query-lane-context.mjs";
7
7
  import "./exports/types.mjs";
8
8
 
9
- export { AggregateExpr, AndExpr, BinaryExpr, ColumnRef, DefaultValueExpr, DeleteAst, DerivedTableSource, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, IdentifierRef, InsertAst, InsertOnConflict, JoinAst, JsonArrayAggExpr, JsonObjectExpr, ListExpression, LiteralExpr, NotExpr, NullCheckExpr, OperationExpr, OrExpr, OrderByItem, ParamRef, ProjectionItem, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, SelectAst, SubqueryExpr, TableSource, UpdateAst, buildOperation, codec, collectOrderedParamRefs, compact, createCodecRegistry, defineCodecs, isQueryAst, isWhereExpr, planInvalid, planUnsupported, queryAstKinds, sqlCodecDefinitions, sqlDataTypes, toExpr, whereExprKinds };
9
+ export { AggregateExpr, AndExpr, BinaryExpr, ColumnRef, DefaultValueExpr, DeleteAst, DerivedTableSource, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, IdentifierRef, InsertAst, InsertOnConflict, JoinAst, JsonArrayAggExpr, JsonObjectExpr, ListExpression, LiteralExpr, NotExpr, NullCheckExpr, OperationExpr, OrExpr, OrderByItem, ParamRef, ProjectionItem, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, SelectAst, SqlCharCodec, SqlCharDescriptor, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlTextCodec, SqlTextDescriptor, SqlTimestampCodec, SqlTimestampDescriptor, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableSource, UpdateAst, buildOperation, collectOrderedParamRefs, compact, isQueryAst, isWhereExpr, planInvalid, planUnsupported, queryAstKinds, refsOf, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDescriptor, sqlFloatEncode, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlTimestampColumn, sqlTimestampDecode, sqlTimestampDecodeJson, sqlTimestampDescriptor, sqlTimestampEncode, sqlTimestampEncodeJson, sqlTimestampRenderOutputType, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, toExpr, validateParamRefRefs, whereExprKinds };
@@ -1,4 +1,4 @@
1
- import { d as AnyQueryAst } from "./types-B4dL4lc3.mjs";
1
+ import { d as AnyQueryAst } from "./types-U74HFwNI.mjs";
2
2
  import { QueryPlan } from "@prisma-next/framework-components/runtime";
3
3
 
4
4
  //#region src/plan.d.ts
@@ -22,4 +22,4 @@ interface SqlQueryPlan<Row = unknown> extends QueryPlan<Row> {
22
22
  }
23
23
  //#endregion
24
24
  export { SqlQueryPlan as t };
25
- //# sourceMappingURL=plan-C7SiEWkN.d.mts.map
25
+ //# sourceMappingURL=plan-nwFE15re.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan-nwFE15re.d.mts","names":[],"sources":["../src/plan.ts"],"sourcesContent":[],"mappings":";;;;;;;AAgBA;;;;;;;;;;;UAAiB,oCAAoC,UAAU;gBAC/C"}