@prisma-next/sql-relational-core 0.3.0-dev.8 → 0.3.0-pr.100.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/ast/codec-types.d.ts.map +1 -1
- package/dist/{chunk-WZBPVEZI.js → chunk-63RTW3I7.js} +2 -2
- package/dist/chunk-63RTW3I7.js.map +1 -0
- package/dist/{chunk-MM74SVJ4.js → chunk-GES77TBI.js} +1 -1
- package/dist/chunk-GES77TBI.js.map +1 -0
- package/dist/{chunk-CBTYMOX2.js → chunk-KBWXBENJ.js} +4 -3
- package/dist/{chunk-CBTYMOX2.js.map → chunk-KBWXBENJ.js.map} +1 -1
- package/dist/exports/ast.js +2 -2
- package/dist/exports/schema.js +2 -2
- package/dist/exports/types.js +1 -1
- package/dist/index.js +3 -3
- package/dist/query-lane-context.d.ts +11 -0
- package/dist/query-lane-context.d.ts.map +1 -1
- package/dist/schema.d.ts +16 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/types.d.ts +35 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/ast/codec-types.ts +5 -4
- package/src/query-lane-context.ts +12 -0
- package/src/schema.ts +24 -2
- package/src/types.ts +124 -21
- package/dist/chunk-MM74SVJ4.js.map +0 -1
- package/dist/chunk-WZBPVEZI.js.map +0 -1
package/README.md
CHANGED
|
@@ -97,7 +97,7 @@ flowchart TD
|
|
|
97
97
|
- **`@prisma-next/contract`**: Core contract types
|
|
98
98
|
- **`@prisma-next/plan`**: Plan error helpers (`planInvalid`, `planUnsupported`) and `RuntimeError` type
|
|
99
99
|
- **`@prisma-next/runtime`**: Runtime context types (TODO: Slice 6 will clean this up)
|
|
100
|
-
- **`@prisma-next/sql-
|
|
100
|
+
- **`@prisma-next/sql-contract`**: SQL contract types (via `@prisma-next/sql-contract/types`)
|
|
101
101
|
|
|
102
102
|
**Note**: This package does not depend on specific adapters (e.g., `@prisma-next/adapter-postgres`). Test fixtures define `CodecTypes` inline to remain adapter-agnostic and avoid cyclic dependencies.
|
|
103
103
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec-types.d.ts","sourceRoot":"","sources":["../../src/ast/codec-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAErC;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,CAAC,EAAE;QACZ,QAAQ,CAAC,GAAG,CAAC,EAAE;YACb,QAAQ,CAAC,QAAQ,CAAC,EAAE;gBAClB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;aAC7B,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED;;;;;GAKG;AACH,MAAM,WAAW,KAAK,CAAC,EAAE,SAAS,MAAM,GAAG,MAAM,EAAE,KAAK,GAAG,OAAO,EAAE,GAAG,GAAG,OAAO;IAC/E;;;OAGG;IACH,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;IAEhB;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAExC;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;IAE1B;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,KAAK,GAAG,GAAG,CAAC;IAEzB;;;;OAIG;IACH,MAAM,CAAC,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAC3C,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;IACtD,eAAe,CAAC,MAAM,EAAE,MAAM,GAA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AAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3C,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7C,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;SAC9C;KACF,CAAC;IAEF,QAAQ,CAAC,SAAS,EAAE;QAClB,QAAQ,EAAE,CAAC,IAAI,MAAM,WAAW,GAAG;YACjC,QAAQ,EAAE,EAAE,IAAI,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE;SACxE,CAAC,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KACtD,CAAC;CACH;AAkHD;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,aAAa,CAEnD;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,eAAe,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAEpE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isColumnBuilder
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GES77TBI.js";
|
|
4
4
|
|
|
5
5
|
// src/ast/codec-types.ts
|
|
6
6
|
var CodecRegistryImpl = class {
|
|
@@ -317,4 +317,4 @@ export {
|
|
|
317
317
|
isOperationExpr,
|
|
318
318
|
createUpdateAst
|
|
319
319
|
};
|
|
320
|
-
//# sourceMappingURL=chunk-
|
|
320
|
+
//# sourceMappingURL=chunk-63RTW3I7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ast/codec-types.ts","../src/ast/util.ts","../src/ast/common.ts","../src/ast/delete.ts","../src/ast/insert.ts","../src/ast/join.ts","../src/ast/order.ts","../src/ast/predicate.ts","../src/ast/select.ts","../src/ast/types.ts","../src/ast/update.ts"],"sourcesContent":["import type { O } from 'ts-toolbelt';\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 * Codec interface for encoding/decoding values between wire format and JavaScript types.\n *\n * Codecs are pure, synchronous functions with no side effects or IO.\n * They provide deterministic conversion between database wire types and JS values.\n */\nexport interface Codec<Id extends string = string, TWire = unknown, TJs = unknown> {\n /**\n * Namespaced codec identifier in format 'namespace/name@version'\n * Examples: 'pg/text@1', 'pg/uuid@1', 'pg/timestamptz@1'\n */\n readonly id: Id;\n\n /**\n * Contract scalar type IDs that this codec can handle.\n * Examples: ['text'], ['int4', 'float8'], ['timestamp', 'timestamptz']\n */\n readonly targetTypes: readonly string[];\n\n /**\n * Optional metadata for database-specific type information.\n * Used for schema introspection and verification.\n */\n readonly meta?: CodecMeta;\n\n /**\n * Decode a wire value (from database) to JavaScript type.\n * Must be synchronous and pure (no side effects).\n */\n decode(wire: TWire): TJs;\n\n /**\n * Encode a JavaScript value to wire format (for database).\n * Optional - if not provided, values pass through unchanged.\n * Must be synchronous and pure (no side effects).\n */\n encode?(value: TJs): TWire;\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 [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 /**\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 * Codec factory - creates a codec with typeId and encode/decode functions.\n */\nexport function codec<Id extends string, TWire, TJs>(config: {\n typeId: Id;\n targetTypes: readonly string[];\n encode: (value: TJs) => TWire;\n decode: (wire: TWire) => TJs;\n meta?: CodecMeta;\n}): Codec<Id, TWire, TJs> {\n return {\n id: config.typeId,\n targetTypes: config.targetTypes,\n ...(config.meta ? { meta: config.meta } : {}),\n encode: config.encode,\n decode: config.decode,\n };\n}\n\n/**\n * Type helpers to extract codec types.\n */\nexport type CodecId<T> =\n T extends Codec<infer Id, unknown, unknown>\n ? Id\n : T extends { readonly id: infer Id }\n ? Id\n : never;\nexport type CodecInput<T> = T extends Codec<string, unknown, infer JsT> ? JsT : never;\nexport type CodecOutput<T> = T extends Codec<string, unknown, infer JsT> ? JsT : 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, unknown, unknown>\n ? Id\n : never]: {\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecOutput<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, unknown, unknown>\n ? Id\n : never;\n readonly scalar: K;\n readonly codec: ScalarNames[K];\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecOutput<ScalarNames[K]>;\n readonly jsType: CodecOutput<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<string, { readonly input: unknown; readonly output: unknown }> = {};\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 CodecOutput<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, unknown, unknown> ? Id : never;\n readonly scalar: K;\n readonly codec: ScalarNames[K];\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecOutput<ScalarNames[K]>;\n readonly jsType: CodecOutput<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 CodecOutput<typeof codec>,\n jsType: undefined as unknown as CodecOutput<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, unknown, unknown>\n ? Id\n : never;\n readonly scalar: K;\n readonly codec: ScalarNames[K];\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecOutput<ScalarNames[K]>;\n readonly jsType: CodecOutput<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","export 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","import type { ColumnRef, LiteralExpr, OperationExpr, ParamRef, TableRef } from './types';\nimport { compact } from './util';\n\nexport function createTableRef(name: string): TableRef {\n return {\n kind: 'table',\n name,\n };\n}\n\nexport function createColumnRef(table: string, column: string): ColumnRef {\n return {\n kind: 'col',\n table,\n column,\n };\n}\n\nexport function createParamRef(index: number, name?: string): ParamRef {\n return compact({\n kind: 'param',\n index,\n name,\n }) as ParamRef;\n}\n\nexport function createOperationExpr(operation: OperationExpr): OperationExpr {\n return operation;\n}\n\nexport function createLiteralExpr(value: unknown): LiteralExpr {\n return {\n kind: 'literal',\n value,\n };\n}\n","import type { BinaryExpr, ColumnRef, DeleteAst, TableRef } from './types';\nimport { compact } from './util';\n\nexport interface CreateDeleteAstOptions {\n readonly table: TableRef;\n readonly where: BinaryExpr;\n readonly returning?: ReadonlyArray<ColumnRef>;\n}\n\nexport function createDeleteAst(options: CreateDeleteAstOptions): DeleteAst {\n return compact({\n kind: 'delete',\n table: options.table,\n where: options.where,\n returning: options.returning,\n }) as DeleteAst;\n}\n","import type { ColumnRef, InsertAst, ParamRef, TableRef } from './types';\nimport { compact } from './util';\n\nexport interface CreateInsertAstOptions {\n readonly table: TableRef;\n readonly values: Record<string, ColumnRef | ParamRef>;\n readonly returning?: ReadonlyArray<ColumnRef>;\n}\n\nexport function createInsertAst(options: CreateInsertAstOptions): InsertAst {\n return compact({\n kind: 'insert',\n table: options.table,\n values: options.values,\n returning: options.returning,\n }) as InsertAst;\n}\n","import { planInvalid } from '@prisma-next/plan';\nimport type { AnyColumnBuilder, JoinOnBuilder, JoinOnPredicate } from '../types';\nimport { isColumnBuilder } from '../types';\nimport type { ColumnRef, JoinAst, JoinOnExpr, TableRef } from './types';\n\nexport function createJoin(\n joinType: 'inner' | 'left' | 'right' | 'full',\n table: TableRef,\n on: JoinOnExpr,\n): JoinAst {\n return {\n kind: 'join',\n joinType,\n table,\n on,\n };\n}\n\nexport function createJoinOnExpr(left: ColumnRef, right: ColumnRef): JoinOnExpr {\n return {\n kind: 'eqCol',\n left,\n right,\n };\n}\n\nclass JoinOnBuilderImpl implements JoinOnBuilder {\n eqCol(left: AnyColumnBuilder, right: AnyColumnBuilder): JoinOnPredicate {\n if (!left || !isColumnBuilder(left)) {\n throw planInvalid('Join ON left operand must be a column');\n }\n\n if (!right || !isColumnBuilder(right)) {\n throw planInvalid('Join ON right operand must be a column');\n }\n\n // TypeScript can't narrow ColumnBuilder properly, so we assert\n const leftCol = left as unknown as { table: string; column: string };\n const rightCol = right as unknown as { table: string; column: string };\n if (leftCol.table === rightCol.table) {\n throw planInvalid('Self-joins are not supported in MVP');\n }\n\n return {\n kind: 'join-on',\n left: left as AnyColumnBuilder,\n right: right as AnyColumnBuilder,\n };\n }\n}\n\nexport function createJoinOnBuilder(): JoinOnBuilder {\n return new JoinOnBuilderImpl();\n}\n","import type { ColumnRef, Direction, OperationExpr } from './types';\n\nexport function createOrderByItem(\n expr: ColumnRef | OperationExpr,\n dir: 'asc' | 'desc',\n): { expr: ColumnRef | OperationExpr; dir: Direction } {\n return {\n expr,\n dir,\n };\n}\n","import type {\n BinaryExpr,\n BinaryOp,\n ColumnRef,\n ExistsExpr,\n OperationExpr,\n ParamRef,\n SelectAst,\n} from './types';\n\nexport function createBinaryExpr(\n op: BinaryOp,\n left: ColumnRef | OperationExpr,\n right: ColumnRef | ParamRef,\n): BinaryExpr {\n return {\n kind: 'bin',\n op,\n left,\n right,\n };\n}\n\nexport function createExistsExpr(not: boolean, subquery: SelectAst): ExistsExpr {\n return {\n kind: 'exists',\n not,\n subquery,\n };\n}\n","import type {\n BinaryExpr,\n ColumnRef,\n Direction,\n ExistsExpr,\n IncludeAst,\n IncludeRef,\n JoinAst,\n OperationExpr,\n SelectAst,\n TableRef,\n} from './types';\nimport { compact } from './util';\n\nexport interface CreateSelectAstOptions {\n readonly from: TableRef;\n readonly joins?: ReadonlyArray<JoinAst>;\n readonly includes?: ReadonlyArray<IncludeAst>;\n readonly project: ReadonlyArray<{\n alias: string;\n expr: ColumnRef | IncludeRef | OperationExpr;\n }>;\n readonly where?: BinaryExpr | ExistsExpr;\n readonly orderBy?: ReadonlyArray<{ expr: ColumnRef | OperationExpr; dir: Direction }>;\n readonly limit?: number;\n}\n\nexport function createSelectAst(options: CreateSelectAstOptions): SelectAst {\n return compact({\n kind: 'select',\n from: options.from,\n joins: options.joins,\n includes: options.includes,\n project: options.project,\n where: options.where,\n orderBy: options.orderBy,\n limit: options.limit,\n }) as SelectAst;\n}\n","import type { ReturnSpec } from '@prisma-next/operations';\nimport type { SqlLoweringSpec } from '@prisma-next/sql-operations';\n\n// SQL-specific AST types and supporting types\n// These types are needed by adapters and runtime for SQL query execution\n\nexport type Direction = 'asc' | 'desc';\n\nexport interface TableRef {\n readonly kind: 'table';\n readonly name: string;\n}\n\nexport interface ColumnRef {\n readonly kind: 'col';\n readonly table: string;\n readonly column: string;\n}\n\nexport interface ParamRef {\n readonly kind: 'param';\n readonly index: number;\n readonly name?: string;\n}\n\nexport interface LiteralExpr {\n readonly kind: 'literal';\n readonly value: unknown;\n}\n\nexport interface OperationExpr {\n readonly kind: 'operation';\n readonly method: string;\n readonly forTypeId: string;\n readonly self: ColumnRef | OperationExpr;\n readonly args: ReadonlyArray<ColumnRef | ParamRef | LiteralExpr | OperationExpr>;\n readonly returns: ReturnSpec;\n readonly lowering: SqlLoweringSpec;\n}\n\nexport function isOperationExpr(expr: ColumnRef | OperationExpr): expr is OperationExpr {\n return expr.kind === 'operation';\n}\n\nexport type BinaryOp = 'eq' | 'neq' | 'gt' | 'lt' | 'gte' | 'lte';\n\nexport interface BinaryExpr {\n readonly kind: 'bin';\n readonly op: BinaryOp;\n readonly left: ColumnRef | OperationExpr;\n readonly right: ColumnRef | ParamRef;\n}\n\nexport interface ExistsExpr {\n readonly kind: 'exists';\n readonly not: boolean;\n readonly subquery: SelectAst;\n}\n\nexport type JoinOnExpr = {\n readonly kind: 'eqCol';\n readonly left: ColumnRef;\n readonly right: ColumnRef;\n};\n\nexport interface JoinAst {\n readonly kind: 'join';\n readonly joinType: 'inner' | 'left' | 'right' | 'full';\n readonly table: TableRef;\n readonly on: JoinOnExpr;\n}\n\nexport interface IncludeRef {\n readonly kind: 'includeRef';\n readonly alias: string;\n}\n\nexport interface IncludeAst {\n readonly kind: 'includeMany';\n readonly alias: string;\n readonly child: {\n readonly table: TableRef;\n readonly on: JoinOnExpr;\n readonly where?: BinaryExpr | ExistsExpr;\n readonly orderBy?: ReadonlyArray<{ expr: ColumnRef | OperationExpr; dir: Direction }>;\n readonly limit?: number;\n readonly project: ReadonlyArray<{ alias: string; expr: ColumnRef | OperationExpr }>;\n };\n}\n\nexport interface SelectAst {\n readonly kind: 'select';\n readonly from: TableRef;\n readonly joins?: ReadonlyArray<JoinAst>;\n readonly includes?: ReadonlyArray<IncludeAst>;\n readonly project: ReadonlyArray<{\n alias: string;\n expr: ColumnRef | IncludeRef | OperationExpr | LiteralExpr;\n }>;\n readonly where?: BinaryExpr | ExistsExpr;\n readonly orderBy?: ReadonlyArray<{ expr: ColumnRef | OperationExpr; dir: Direction }>;\n readonly limit?: number;\n}\n\nexport interface InsertAst {\n readonly kind: 'insert';\n readonly table: TableRef;\n readonly values: Record<string, ColumnRef | ParamRef>;\n readonly returning?: ReadonlyArray<ColumnRef>;\n}\n\nexport interface UpdateAst {\n readonly kind: 'update';\n readonly table: TableRef;\n readonly set: Record<string, ColumnRef | ParamRef>;\n readonly where: BinaryExpr;\n readonly returning?: ReadonlyArray<ColumnRef>;\n}\n\nexport interface DeleteAst {\n readonly kind: 'delete';\n readonly table: TableRef;\n readonly where: BinaryExpr;\n readonly returning?: ReadonlyArray<ColumnRef>;\n}\n\nexport type QueryAst = SelectAst | InsertAst | UpdateAst | DeleteAst;\n\nexport interface LoweredStatement {\n readonly sql: string;\n readonly params: readonly unknown[];\n readonly annotations?: Record<string, unknown>;\n}\n","import type { BinaryExpr, ColumnRef, ParamRef, TableRef, UpdateAst } from './types';\nimport { compact } from './util';\n\nexport interface CreateUpdateAstOptions {\n readonly table: TableRef;\n readonly set: Record<string, ColumnRef | ParamRef>;\n readonly where: BinaryExpr;\n readonly returning?: ReadonlyArray<ColumnRef>;\n}\n\nexport function createUpdateAst(options: CreateUpdateAstOptions): UpdateAst {\n return compact({\n kind: 'update',\n table: options.table,\n set: options.set,\n where: options.where,\n returning: options.returning,\n }) as UpdateAst;\n}\n"],"mappings":";;;;;AA4EA,IAAM,oBAAN,MAAiD;AAAA,EAC9B,QAAQ,oBAAI,IAA2B;AAAA,EACvC,YAAY,oBAAI,IAA6B;AAAA;AAAA;AAAA;AAAA;AAAA,EAM9D,IAAI,IAAuC;AACzC,WAAO,KAAK,MAAM,IAAI,EAAE;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,IAAqB;AACvB,WAAO,KAAK,MAAM,IAAI,EAAE;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,YAAY,QAA0C;AACpD,WAAO,KAAK,UAAU,IAAI,MAAM,KAAK,OAAO,OAAO,CAAC,CAAC;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,gBAAgB,QAA2C;AACzD,UAAM,UAAU,KAAK,UAAU,IAAI,MAAM;AACzC,WAAO,UAAU,CAAC;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,SAASA,QAA4B;AACnC,QAAI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kB;AAC/B;;;ACnDO,SAAS,kBACd,MACA,KACqD;AACrD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;;;ACAO,SAAS,iBACd,IACA,MACA,OACY;AACZ,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,iBAAiB,KAAc,UAAiC;AAC9E,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACF;AACF;;;ACFO,SAAS,gBAAgB,SAA4C;AAC1E,SAAO,QAAQ;AAAA,IACb,MAAM;AAAA,IACN,MAAM,QAAQ;AAAA,IACd,OAAO,QAAQ;AAAA,IACf,UAAU,QAAQ;AAAA,IAClB,SAAS,QAAQ;AAAA,IACjB,OAAO,QAAQ;AAAA,IACf,SAAS,QAAQ;AAAA,IACjB,OAAO,QAAQ;AAAA,EACjB,CAAC;AACH;;;ACEO,SAAS,gBAAgB,MAAwD;AACtF,SAAO,KAAK,SAAS;AACvB;;;AChCO,SAAS,gBAAgB,SAA4C;AAC1E,SAAO,QAAQ;AAAA,IACb,MAAM;AAAA,IACN,OAAO,QAAQ;AAAA,IACf,KAAK,QAAQ;AAAA,IACb,OAAO,QAAQ;AAAA,IACf,WAAW,QAAQ;AAAA,EACrB,CAAC;AACH;","names":["codec"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n ResultType as CoreResultType,\n ExecutionPlan,\n PlanRefs,\n} from '@prisma-next/contract/types';\nimport type { ArgSpec, ReturnSpec } from '@prisma-next/operations';\nimport type { SqlContract, SqlStorage, StorageColumn } from '@prisma-next/sql-contract/types';\nimport type { SqlLoweringSpec } from '@prisma-next/sql-operations';\nimport type {\n BinaryOp,\n ColumnRef,\n Direction,\n OperationExpr,\n ParamRef,\n QueryAst,\n} from './ast/types';\nimport type { SqlQueryPlan } from './plan';\nimport type { QueryLaneContext } from './query-lane-context';\n\nexport interface ParamPlaceholder {\n readonly kind: 'param-placeholder';\n readonly name: string;\n}\n\nexport interface OrderBuilder<\n ColumnName extends string = string,\n ColumnMeta extends StorageColumn = StorageColumn,\n JsType = unknown,\n> {\n readonly kind: 'order';\n readonly expr: ColumnBuilder<ColumnName, ColumnMeta, JsType> | OperationExpr;\n readonly dir: Direction;\n}\n\n/**\n * Creates an OrderBuilder for use in orderBy clauses.\n */\nexport function createOrderBuilder(\n expr: AnyColumnBuilder | OperationExpr,\n dir: Direction,\n): AnyOrderBuilder {\n return { kind: 'order', expr, dir } as AnyOrderBuilder;\n}\n\n/**\n * ColumnBuilder with optional operation methods based on the column's typeId.\n * When Operations is provided and the column's typeId matches, operation methods are included.\n */\nexport type ColumnBuilder<\n ColumnName extends string = string,\n ColumnMeta extends StorageColumn = StorageColumn,\n JsType = unknown,\n Operations extends OperationTypes = Record<string, never>,\n> = {\n readonly kind: 'column';\n readonly table: string;\n readonly column: ColumnName;\n readonly columnMeta: ColumnMeta;\n eq(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n neq(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n gt(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n lt(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n gte(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n lte(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n asc(): OrderBuilder<ColumnName, ColumnMeta, JsType>;\n desc(): OrderBuilder<ColumnName, ColumnMeta, JsType>;\n // Helper property for type extraction (not used at runtime)\n readonly __jsType: JsType;\n} & (ColumnMeta['codecId'] extends string\n ? ColumnMeta['codecId'] extends keyof Operations\n ? OperationMethods<\n OperationsForTypeId<ColumnMeta['codecId'] & string, Operations>,\n ColumnName,\n StorageColumn,\n JsType\n >\n : Record<string, never>\n : Record<string, never>);\n\nexport interface BinaryBuilder<\n ColumnName extends string = string,\n ColumnMeta extends StorageColumn = StorageColumn,\n JsType = unknown,\n> {\n readonly kind: 'binary';\n readonly op: BinaryOp;\n readonly left: ColumnBuilder<ColumnName, ColumnMeta, JsType> | OperationExpr;\n readonly right: ParamPlaceholder | AnyColumnBuilderBase;\n}\n\n// Helper aliases for usage sites where the specific column parameters are irrelevant\n// Accepts any ColumnBuilder regardless of its Operations parameter\n// Note: We use `any` here because TypeScript's variance rules don't allow us to express\n// \"any type that extends OperationTypes\" in a way that works for assignment.\n// Contract-specific OperationTypes (e.g., PgVectorOperationTypes) are not assignable\n// to the base OperationTypes in generic parameter position, even though they extend it structurally.\n// Helper type that accepts any ColumnBuilder regardless of its generic parameters\n// This is needed because conditional types in ColumnBuilder create incompatible intersection types\n// when Operations differs, even though structurally they're compatible\nexport type AnyColumnBuilderBase = {\n readonly kind: 'column';\n readonly table: string;\n readonly column: string;\n readonly columnMeta: StorageColumn;\n eq(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;\n neq(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;\n gt(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;\n lt(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;\n gte(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;\n lte(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;\n asc(): AnyOrderBuilder;\n desc(): AnyOrderBuilder;\n readonly __jsType: unknown;\n // Allow any operation methods (from conditional type)\n readonly [key: string]: unknown;\n};\n\nexport type AnyColumnBuilder =\n | ColumnBuilder<\n string,\n StorageColumn,\n unknown,\n // biome-ignore lint/suspicious/noExplicitAny: AnyColumnBuilder must accept column builders with any operation types\n any\n >\n | AnyColumnBuilderBase;\nexport type AnyBinaryBuilder = BinaryBuilder<string, StorageColumn, unknown>;\nexport type AnyOrderBuilder = OrderBuilder<string, StorageColumn, unknown>;\n\nexport function isColumnBuilder(value: unknown): value is AnyColumnBuilder {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'kind' in value &&\n (value as { kind: unknown }).kind === 'column'\n );\n}\n\nexport interface JoinOnBuilder {\n eqCol(left: AnyColumnBuilder, right: AnyColumnBuilder): JoinOnPredicate;\n}\n\nexport interface JoinOnPredicate {\n readonly kind: 'join-on';\n readonly left: AnyColumnBuilder;\n readonly right: AnyColumnBuilder;\n}\n\nexport type Expr = ColumnRef | ParamRef;\n\n/**\n * Helper type to extract codec output type from CodecTypes.\n * Returns never if the codecId is not found in CodecTypes.\n */\ntype ExtractCodecOutputType<\n CodecId extends string,\n CodecTypes extends Record<string, { readonly output: unknown }>,\n> = CodecId extends keyof CodecTypes\n ? CodecTypes[CodecId] extends { readonly output: infer Output }\n ? Output\n : never\n : never;\n\ntype ExtractColumnJsTypeFromModels<\n Contract extends SqlContract<SqlStorage>,\n TableName extends string,\n ColumnName extends string,\n> = Contract['mappings'] extends {\n readonly tableToModel: infer TableToModel;\n readonly columnToField: infer ColumnToField;\n}\n ? TableToModel extends Record<string, string>\n ? ColumnToField extends Record<string, Record<string, string>>\n ? TableName extends keyof TableToModel\n ? TableName extends keyof ColumnToField\n ? ColumnName extends keyof ColumnToField[TableName]\n ? Contract['models'] extends infer Models\n ? Models extends Record<string, unknown>\n ? TableToModel[TableName] extends keyof Models\n ? Models[TableToModel[TableName]] extends { readonly fields: infer Fields }\n ? Fields extends Record<string, unknown>\n ? ColumnToField[TableName][ColumnName] extends keyof Fields\n ? Fields[ColumnToField[TableName][ColumnName]]\n : never\n : never\n : never\n : never\n : never\n : never\n : never\n : never\n : never\n : never\n : never\n : never;\n\n/**\n * Resolves type params for a column from either:\n * - inline `columnMeta.typeParams`, or\n * - `columnMeta.typeRef` (resolving into `contract.storage.types[typeRef].typeParams`).\n */\ntype ResolveColumnTypeParams<\n Contract extends SqlContract<SqlStorage>,\n ColumnMeta extends StorageColumn,\n> = ColumnMeta extends { typeParams: infer Params }\n ? Params extends object\n ? Params\n : undefined\n : ColumnMeta extends { typeRef: infer TypeRef extends string }\n ? Contract['storage'] extends { types: infer Types }\n ? Types extends Record<string, unknown>\n ? TypeRef extends keyof Types\n ? Types[TypeRef] extends { typeParams: infer Params }\n ? Params extends object\n ? Params\n : undefined\n : undefined\n : undefined\n : undefined\n : undefined\n : undefined;\n\n/**\n * If a codec entry exposes a type-level parameterized output surface, compute the output type\n * for a specific params object. Falls back to `never` if not supported.\n *\n * This enables lane typing to incorporate `columnMeta.typeParams` without branching on codec IDs\n * in core lane code.\n */\ntype ExtractParameterizedCodecOutputType<\n CodecId extends string,\n Params,\n CodecTypes extends Record<string, { readonly output: unknown }>,\n> = CodecId extends keyof CodecTypes\n ? CodecTypes[CodecId] extends { readonly parameterizedOutput: infer Fn }\n ? Fn extends (params: Params) => infer Out\n ? Out\n : never\n : never\n : never;\n\n/**\n * Type-level operation signature.\n * Represents an operation at the type level, similar to OperationSignature at runtime.\n */\nexport type OperationTypeSignature = {\n readonly args: ReadonlyArray<ArgSpec>;\n readonly returns: ReturnSpec;\n readonly lowering: SqlLoweringSpec;\n readonly capabilities?: ReadonlyArray<string>;\n};\n\n/**\n * Type-level operation registry.\n * Maps typeId → operations, where operations is a record of method name → operation signature.\n *\n * Example:\n * ```typescript\n * type MyOperations: OperationTypes = {\n * 'pg/vector@1': {\n * cosineDistance: {\n * args: [{ kind: 'typeId'; type: 'pg/vector@1' }];\n * returns: { kind: 'builtin'; type: 'number' };\n * lowering: { targetFamily: 'sql'; strategy: 'function'; template: '...' };\n * };\n * };\n * };\n * ```\n */\nexport type OperationTypes = Record<string, Record<string, OperationTypeSignature>>;\n\n/**\n * CodecTypes represents a map of typeId to codec definitions.\n * Each codec definition must have an `output` property indicating the JavaScript type.\n *\n * Example:\n * ```typescript\n * type MyCodecTypes: CodecTypes = {\n * 'pg/int4@1': { output: number };\n * 'pg/text@1': { output: string };\n * };\n * ```\n */\nexport type CodecTypes = Record<string, { readonly output: unknown }>;\n\n/**\n * Extracts operations for a given typeId from the operation registry.\n * Returns an empty record if the typeId is not found.\n *\n * @example\n * ```typescript\n * type Ops = OperationsForTypeId<'pg/vector@1', MyOperations>;\n * // Ops = { cosineDistance: { ... }, l2Distance: { ... } }\n * ```\n */\nexport type OperationsForTypeId<\n TypeId extends string,\n Operations extends OperationTypes,\n> = Operations extends Record<string, never>\n ? Record<string, never>\n : TypeId extends keyof Operations\n ? Operations[TypeId]\n : Record<string, never>;\n\n/**\n * Maps operation signatures to method signatures on ColumnBuilder.\n * Each operation becomes a method that returns a ColumnBuilder or BinaryBuilder\n * based on the return type.\n */\ntype OperationMethods<\n Ops extends Record<string, OperationTypeSignature>,\n ColumnName extends string,\n ColumnMeta extends StorageColumn,\n JsType,\n> = {\n [K in keyof Ops]: Ops[K] extends OperationTypeSignature\n ? (\n ...args: OperationArgs<Ops[K]['args']>\n ) => OperationReturn<Ops[K]['returns'], ColumnName, ColumnMeta, JsType>\n : never;\n};\n\n/**\n * Maps operation argument specs to TypeScript argument types.\n * - typeId args: ColumnBuilder (accepts base columns or operation results)\n * - param args: ParamPlaceholder\n * - literal args: unknown (could be more specific in future)\n */\ntype OperationArgs<Args extends ReadonlyArray<ArgSpec>> = Args extends readonly [\n infer First,\n ...infer Rest,\n]\n ? First extends ArgSpec\n ? [ArgToType<First>, ...(Rest extends ReadonlyArray<ArgSpec> ? OperationArgs<Rest> : [])]\n : []\n : [];\n\ntype ArgToType<Arg extends ArgSpec> = Arg extends { kind: 'typeId' }\n ? AnyColumnBuilder\n : Arg extends { kind: 'param' }\n ? ParamPlaceholder\n : Arg extends { kind: 'literal' }\n ? unknown\n : never;\n\n/**\n * Maps operation return spec to return type.\n * - builtin types: ColumnBuilder with appropriate JsType (matches runtime behavior)\n * - typeId types: ColumnBuilder (for now, could be more specific in future)\n */\ntype OperationReturn<\n Returns extends ReturnSpec,\n ColumnName extends string,\n ColumnMeta extends StorageColumn,\n _JsType,\n> = Returns extends { kind: 'builtin'; type: infer T }\n ? T extends 'number'\n ? ColumnBuilder<ColumnName, ColumnMeta, number>\n : T extends 'boolean'\n ? ColumnBuilder<ColumnName, ColumnMeta, boolean>\n : T extends 'string'\n ? ColumnBuilder<ColumnName, ColumnMeta, string>\n : ColumnBuilder<ColumnName, ColumnMeta, unknown>\n : Returns extends { kind: 'typeId' }\n ? AnyColumnBuilder\n : ColumnBuilder<ColumnName, ColumnMeta, unknown>;\n\n/**\n * Computes JavaScript type for a column at column creation time.\n *\n * Type inference:\n * - Read columnMeta.codecId as typeId string literal\n * - Look up CodecTypes[typeId].output\n * - Apply nullability: nullable ? Output | null : Output\n */\ntype ColumnMetaTypeId<ColumnMeta> = ColumnMeta extends { codecId: infer CodecId extends string }\n ? CodecId\n : ColumnMeta extends { type: infer TypeId extends string }\n ? TypeId\n : never;\n\nexport type ComputeColumnJsType<\n Contract extends SqlContract<SqlStorage>,\n TableName extends string,\n ColumnName extends string,\n ColumnMeta extends StorageColumn,\n CodecTypes extends Record<string, { readonly output: unknown }>,\n> = ExtractColumnJsTypeFromModels<Contract, TableName, ColumnName> extends infer FromModels\n ? [FromModels] extends [never]\n ? ColumnMeta extends { nullable: infer Nullable }\n ? ColumnMetaTypeId<ColumnMeta> extends infer TypeId\n ? TypeId extends string\n ? ResolveColumnTypeParams<Contract, ColumnMeta> extends infer Params\n ? Params extends object\n ? ExtractParameterizedCodecOutputType<\n TypeId,\n Params,\n CodecTypes\n > extends infer ParamOutput\n ? [ParamOutput] extends [never]\n ? ExtractCodecOutputType<TypeId, CodecTypes> extends infer CodecOutput\n ? [CodecOutput] extends [never]\n ? unknown // Codec not found in CodecTypes\n : Nullable extends true\n ? CodecOutput | null\n : CodecOutput\n : unknown\n : Nullable extends true\n ? ParamOutput | null\n : ParamOutput\n : unknown\n : ExtractCodecOutputType<TypeId, CodecTypes> extends infer CodecOutput\n ? [CodecOutput] extends [never]\n ? unknown // Codec not found in CodecTypes\n : Nullable extends true\n ? CodecOutput | null\n : CodecOutput\n : unknown\n : unknown\n : unknown\n : unknown\n : unknown\n : FromModels\n : unknown;\n\n/**\n * Infers Row type from a projection object.\n * Maps Record<string, ColumnBuilder> to Record<string, JSType>\n *\n * Extracts the pre-computed JsType from each ColumnBuilder in the projection.\n */\n/**\n * Extracts the inferred JsType carried by a ColumnBuilder.\n */\ntype ExtractJsTypeFromColumnBuilder<CB extends AnyColumnBuilder> =\n CB extends ColumnBuilder<\n infer _ColumnName extends string,\n infer _ColumnMeta extends StorageColumn,\n infer JsType,\n infer _Ops\n >\n ? JsType\n : never;\n\nexport type InferProjectionRow<P extends Record<string, AnyColumnBuilder>> = {\n [K in keyof P]: ExtractJsTypeFromColumnBuilder<P[K]>;\n};\n\n/**\n * Nested projection type - allows recursive nesting of ColumnBuilder or nested objects.\n */\nexport type NestedProjection = Record<\n string,\n | AnyColumnBuilder\n | Record<\n string,\n | AnyColumnBuilder\n | Record<\n string,\n AnyColumnBuilder | Record<string, AnyColumnBuilder | Record<string, AnyColumnBuilder>>\n >\n >\n>;\n\n/**\n * Helper type to extract include type from Includes map.\n * Returns the value type if K is a key of Includes, otherwise returns unknown.\n */\ntype ExtractIncludeType<\n K extends string,\n Includes extends Record<string, unknown>,\n> = K extends keyof Includes ? Includes[K] : unknown;\n\n/**\n * Infers Row type from a nested projection object.\n * Recursively maps Record<string, ColumnBuilder | boolean | NestedProjection> to nested object types.\n *\n * Extracts the pre-computed JsType from each ColumnBuilder at leaves.\n * When a value is `true`, it represents an include reference and infers `Array<ChildShape>`\n * by looking up the include alias in the Includes type map.\n */\nexport type InferNestedProjectionRow<\n P extends Record<string, AnyColumnBuilder | boolean | NestedProjection>,\n CodecTypes extends Record<string, { readonly output: unknown }> = Record<string, never>,\n Includes extends Record<string, unknown> = Record<string, never>,\n> = {\n [K in keyof P]: P[K] extends AnyColumnBuilder\n ? ExtractJsTypeFromColumnBuilder<P[K]>\n : P[K] extends true\n ? Array<ExtractIncludeType<K & string, Includes>> // Include reference - infers Array<ChildShape> from Includes map\n : P[K] extends NestedProjection\n ? InferNestedProjectionRow<P[K], CodecTypes, Includes>\n : never;\n};\n\n/**\n * Infers Row type from a tuple of ColumnBuilders used in returning() clause.\n * Extracts column name and JsType from each ColumnBuilder and creates a Record.\n */\nexport type InferReturningRow<Columns extends readonly AnyColumnBuilder[]> =\n Columns extends readonly [infer First, ...infer Rest]\n ? First extends ColumnBuilder<\n infer Name,\n infer _Meta,\n infer JsType,\n infer _Ops extends OperationTypes\n >\n ? Name extends string\n ? Rest extends readonly AnyColumnBuilder[]\n ? { [K in Name]: JsType } & InferReturningRow<Rest>\n : { [K in Name]: JsType }\n : never\n : never\n : Record<string, never>;\n\n/**\n * Utility type to check if a contract has the required capabilities for includeMany.\n * Requires both `lateral` and `jsonAgg` to be `true` in the contract's capabilities for the target.\n * Capabilities are nested by target: `{ [target]: { lateral: true, jsonAgg: true } }`\n */\nexport type HasIncludeManyCapabilities<TContract extends SqlContract<SqlStorage>> =\n TContract extends { capabilities: infer C; target: infer T }\n ? T extends string\n ? C extends Record<string, Record<string, boolean>>\n ? C extends { [K in T]: infer TargetCaps }\n ? TargetCaps extends { lateral: true; jsonAgg: true }\n ? true\n : false\n : false\n : false\n : false\n : false;\n\n/**\n * SQL-specific Plan type that refines the ast field to use QueryAst.\n * This is the type used by SQL query builders.\n */\nexport type SqlPlan<Row = unknown> = ExecutionPlan<Row, QueryAst>;\n\n/**\n * Helper types for extracting contract structure.\n */\nexport type TablesOf<TContract> = TContract extends {\n storage: { tables: infer U };\n}\n ? U\n : never;\n\nexport type TableKey<TContract> = Extract<keyof TablesOf<TContract>, string>;\n\n// Common types for contract.d.ts generation (SQL-specific)\n// These types are used by emitted contract.d.ts files to provide type-safe DSL/ORM types\n\n/**\n * Unique symbol for metadata property to avoid collisions with user-defined properties\n */\nexport declare const META: unique symbol;\n\n/**\n * Extracts metadata from a type that has a META property\n */\nexport type Meta<T extends { [META]: unknown }> = T[typeof META];\n\n/**\n * Metadata interface for table definitions\n */\nexport interface TableMetadata<Name extends string> {\n name: Name;\n}\n\n/**\n * Metadata interface for model definitions\n */\nexport interface ModelMetadata<Name extends string> {\n name: Name;\n}\n\n/**\n * Base interface for table definitions with metadata\n * Used in contract.d.ts to define storage-level table types\n */\nexport interface TableDef<Name extends string> {\n readonly [META]: TableMetadata<Name>;\n}\n\n/**\n * Base interface for model definitions with metadata\n * Used in contract.d.ts to define application-level model types\n */\nexport interface ModelDef<Name extends string> {\n readonly [META]: ModelMetadata<Name>;\n}\n\nexport type ColumnsOf<\n TContract,\n K extends TableKey<TContract>,\n> = K extends keyof TablesOf<TContract>\n ? TablesOf<TContract>[K] extends { columns: infer C }\n ? C\n : never\n : never;\n\nexport interface RawTemplateOptions {\n readonly refs?: PlanRefs;\n readonly annotations?: Record<string, unknown>;\n readonly projection?: ReadonlyArray<string>;\n}\n\nexport interface RawFunctionOptions extends RawTemplateOptions {\n readonly params: ReadonlyArray<unknown>;\n}\n\nexport type RawTemplateFactory = (\n strings: TemplateStringsArray,\n ...values: readonly unknown[]\n) => ExecutionPlan;\n\nexport interface RawFactory extends RawTemplateFactory {\n (text: string, options: RawFunctionOptions): ExecutionPlan;\n with(options: RawTemplateOptions): RawTemplateFactory;\n}\n\nexport type { RuntimeError } from '@prisma-next/plan';\n\nexport interface BuildParamsMap {\n readonly [name: string]: unknown;\n}\n\nexport interface BuildOptions {\n readonly params?: BuildParamsMap;\n}\n\nexport interface SqlBuilderOptions<\n TContract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>,\n> {\n readonly context: QueryLaneContext<TContract>;\n}\n\n/**\n * SQL-specific ResultType that works with both Plan and SqlQueryPlan.\n * This extends the core ResultType to also handle SqlQueryPlan.\n * Example: `type Row = ResultType<typeof plan>`\n */\nexport type ResultType<P> = P extends SqlQueryPlan<infer R> ? R : CoreResultType<P>;\n"],"mappings":";AAqCO,SAAS,mBACd,MACA,KACiB;AACjB,SAAO,EAAE,MAAM,SAAS,MAAM,IAAI;AACpC;AA6FO,SAAS,gBAAgB,OAA2C;AACzE,SACE,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACT,MAA4B,SAAS;AAE1C;","names":[]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-M23L3JHG.js";
|
|
4
4
|
import {
|
|
5
5
|
isColumnBuilder
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GES77TBI.js";
|
|
7
7
|
|
|
8
8
|
// src/schema.ts
|
|
9
9
|
import { planInvalid } from "@prisma-next/plan";
|
|
@@ -141,7 +141,8 @@ function schema(context) {
|
|
|
141
141
|
proxiedTable
|
|
142
142
|
);
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
const types = context.types ?? {};
|
|
145
|
+
return Object.freeze({ tables, types });
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
export {
|
|
@@ -149,4 +150,4 @@ export {
|
|
|
149
150
|
TableBuilderImpl,
|
|
150
151
|
schema
|
|
151
152
|
};
|
|
152
|
-
//# sourceMappingURL=chunk-
|
|
153
|
+
//# sourceMappingURL=chunk-KBWXBENJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schema.ts"],"sourcesContent":["import type { OperationRegistry } from '@prisma-next/operations';\nimport { planInvalid } from '@prisma-next/plan';\nimport type {\n ExtractCodecTypes,\n ExtractOperationTypes,\n SqlContract,\n SqlStorage,\n StorageColumn,\n} from '@prisma-next/sql-contract/types';\nimport type { BinaryOp, TableRef } from './ast/types';\nimport { attachOperationsToColumnBuilder } from './operations-registry';\nimport type { QueryLaneContext } from './query-lane-context';\nimport type {\n AnyColumnBuilderBase,\n BinaryBuilder,\n CodecTypes as CodecTypesType,\n ColumnBuilder,\n ComputeColumnJsType,\n OperationTypeSignature,\n OperationTypes,\n OrderBuilder,\n ParamPlaceholder,\n} from './types';\nimport { isColumnBuilder } from './types';\n\ntype TableColumns<Table extends { columns: Record<string, StorageColumn> }> = Table['columns'];\n\ntype ColumnBuilders<\n Contract extends SqlContract<SqlStorage>,\n TableName extends string,\n Columns extends Record<string, StorageColumn>,\n CodecTypes extends CodecTypesType,\n Operations extends OperationTypes,\n> = {\n readonly [K in keyof Columns]: ColumnBuilder<\n K & string,\n Columns[K],\n ComputeColumnJsType<Contract, TableName, K & string, Columns[K], CodecTypes>,\n Operations\n >;\n};\n\nexport class ColumnBuilderImpl<\n ColumnName extends string,\n ColumnMeta extends StorageColumn,\n JsType = unknown,\n> {\n readonly kind = 'column' as const;\n\n constructor(\n readonly table: string,\n readonly column: ColumnName,\n private readonly storageColumn: ColumnMeta,\n ) {}\n\n get columnMeta(): ColumnMeta {\n return this.storageColumn;\n }\n\n // Type-level helper property (not used at runtime)\n get __jsType(): JsType {\n return undefined as unknown as JsType;\n }\n\n private createBinaryBuilder(\n op: BinaryOp,\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType> {\n if (value == null) {\n throw planInvalid('Parameter placeholder or column builder required for column comparison');\n }\n if (value.kind === 'param-placeholder' || isColumnBuilder(value)) {\n return Object.freeze({\n kind: 'binary' as const,\n op,\n left: this as unknown as ColumnBuilder<ColumnName, ColumnMeta, JsType>,\n right: value,\n }) as BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n }\n throw planInvalid('Parameter placeholder or column builder required for column comparison');\n }\n\n eq(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType> {\n return this.createBinaryBuilder('eq', value);\n }\n\n neq(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType> {\n return this.createBinaryBuilder('neq', value);\n }\n\n gt(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType> {\n return this.createBinaryBuilder('gt', value);\n }\n\n lt(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType> {\n return this.createBinaryBuilder('lt', value);\n }\n\n gte(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType> {\n return this.createBinaryBuilder('gte', value);\n }\n\n lte(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType> {\n return this.createBinaryBuilder('lte', value);\n }\n\n asc(): OrderBuilder<ColumnName, ColumnMeta, JsType> {\n return Object.freeze({\n kind: 'order' as const,\n expr: this as unknown as ColumnBuilder<ColumnName, ColumnMeta, JsType>,\n dir: 'asc' as const,\n }) as OrderBuilder<ColumnName, ColumnMeta, JsType>;\n }\n\n desc(): OrderBuilder<ColumnName, ColumnMeta, JsType> {\n return Object.freeze({\n kind: 'order' as const,\n expr: this as unknown as ColumnBuilder<ColumnName, ColumnMeta, JsType>,\n dir: 'desc' as const,\n }) as OrderBuilder<ColumnName, ColumnMeta, JsType>;\n }\n}\n\nexport class TableBuilderImpl<\n Contract extends SqlContract<SqlStorage>,\n TableName extends string,\n Columns extends Record<string, StorageColumn>,\n CodecTypes extends CodecTypesType,\n Operations extends OperationTypes,\n> implements TableRef\n{\n readonly kind = 'table' as const;\n readonly columns: ColumnBuilders<Contract, TableName, Columns, CodecTypes, Operations>;\n private readonly _name: TableName;\n\n constructor(\n name: TableName,\n columns: ColumnBuilders<Contract, TableName, Columns, CodecTypes, Operations>,\n ) {\n this._name = name;\n this.columns = columns;\n }\n\n get name(): string {\n return this._name;\n }\n}\n\nfunction buildColumns<\n Contract extends SqlContract<SqlStorage>,\n TableName extends keyof Contract['storage']['tables'] & string,\n CodecTypes extends CodecTypesType,\n Operations extends OperationTypes,\n>(\n tableName: TableName,\n storage: SqlStorage,\n _contract: Contract,\n operationRegistry?: OperationRegistry,\n contractCapabilities?: Record<string, Record<string, boolean>>,\n): ColumnBuilders<\n Contract,\n TableName,\n Contract['storage']['tables'][TableName]['columns'],\n CodecTypes,\n Operations\n> {\n const table = storage.tables[tableName];\n\n if (!table) {\n throw planInvalid(`Unknown table ${tableName}`);\n }\n\n type Columns = Contract['storage']['tables'][TableName]['columns'];\n const tableColumns = table.columns as Columns;\n\n const result = {} as {\n [K in keyof Columns]: ColumnBuilder<\n K & string,\n Columns[K],\n ComputeColumnJsType<Contract, TableName, K & string, Columns[K], CodecTypes>,\n Operations\n >;\n };\n\n const assignColumn = <ColumnKey extends keyof Columns & string>(\n columnName: ColumnKey,\n columnDef: Columns[ColumnKey],\n ) => {\n type JsType = ComputeColumnJsType<\n Contract,\n TableName,\n ColumnKey,\n Columns[ColumnKey],\n CodecTypes\n >;\n\n const columnBuilder = new ColumnBuilderImpl<ColumnKey, Columns[ColumnKey], JsType>(\n tableName,\n columnName,\n columnDef,\n );\n\n const builderWithOps = attachOperationsToColumnBuilder<\n ColumnKey,\n Columns[ColumnKey],\n JsType,\n Operations\n >(\n columnBuilder as unknown as ColumnBuilder<\n ColumnKey,\n Columns[ColumnKey],\n JsType,\n Record<string, never>\n >,\n columnDef,\n operationRegistry,\n contractCapabilities,\n );\n\n (result as Record<string, unknown>)[columnName] = builderWithOps;\n };\n\n for (const columnName of Object.keys(tableColumns) as Array<keyof Columns & string>) {\n const columnDef = tableColumns[columnName];\n if (!columnDef) continue;\n assignColumn(columnName, columnDef);\n }\n\n return result as ColumnBuilders<Contract, TableName, Columns, CodecTypes, Operations>;\n}\n\n/**\n * Creates a Proxy that enables accessing table columns directly on the table object,\n * in addition to the standard `table.columns.columnName` syntax.\n *\n * This allows both access patterns:\n * - `tables.user.columns.id` (standard access)\n * - `tables.user.id` (convenience access via proxy)\n *\n * The proxy intercepts property access and routes column name lookups to\n * `table.columns[prop]`, while preserving direct access to table properties\n * like `name`, `kind`, and `columns`.\n */\nfunction createTableProxy<\n Contract extends SqlContract<SqlStorage>,\n TableName extends string,\n Columns extends Record<string, StorageColumn>,\n CodecTypes extends CodecTypesType,\n Operations extends OperationTypes,\n>(\n table: TableBuilderImpl<Contract, TableName, Columns, CodecTypes, Operations>,\n): TableBuilderImpl<Contract, TableName, Columns, CodecTypes, Operations> {\n return new Proxy(table, {\n get(target, prop) {\n if (prop === 'name' || prop === 'kind' || prop === 'columns') {\n return Reflect.get(target, prop);\n }\n if (typeof prop === 'string' && prop in target.columns) {\n return target.columns[prop as keyof typeof target.columns];\n }\n return undefined;\n },\n });\n}\n\ntype ExtractSchemaTables<\n Contract extends SqlContract<SqlStorage>,\n CodecTypes extends CodecTypesType,\n Operations extends OperationTypes,\n> = {\n readonly [TableName in keyof Contract['storage']['tables']]: TableBuilderImpl<\n Contract,\n TableName & string,\n TableColumns<Contract['storage']['tables'][TableName]>,\n CodecTypes,\n Operations\n > &\n TableRef;\n};\n\nexport type SchemaHandle<\n Contract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>,\n CodecTypes extends CodecTypesType = CodecTypesType,\n Operations extends OperationTypes = Record<string, never>,\n> = {\n readonly tables: ExtractSchemaTables<Contract, CodecTypes, Operations>;\n};\n\ntype SchemaReturnType<Contract extends SqlContract<SqlStorage>> = SchemaHandle<\n Contract,\n ExtractCodecTypes<Contract>,\n ToOperationTypes<ExtractOperationTypes<Contract>>\n>;\n\ntype NormalizeOperationTypes<T> = {\n [TypeId in keyof T]: {\n [Method in keyof T[TypeId]]: T[TypeId][Method] extends OperationTypeSignature\n ? T[TypeId][Method]\n : OperationTypeSignature;\n };\n};\n\ntype ToOperationTypes<T> = T extends OperationTypes ? T : NormalizeOperationTypes<T>;\n\n/**\n * Creates a schema handle for building SQL queries.\n *\n * @param context - Query lane context containing contract, codec and operation registries\n * @returns A schema handle with typed table builders\n *\n * @example\n * ```typescript\n * const schemaHandle = schema<Contract>(context);\n * const userTable = schemaHandle.tables.user;\n * ```\n */\nexport function schema<Contract extends SqlContract<SqlStorage>>(\n context: QueryLaneContext<Contract>,\n): SchemaReturnType<Contract> {\n const contract = context.contract;\n const storage = contract.storage;\n type CodecTypes = ExtractCodecTypes<Contract>;\n type Operations = ToOperationTypes<ExtractOperationTypes<Contract>>;\n const tables = {} as ExtractSchemaTables<Contract, CodecTypes, Operations>;\n const contractCapabilities = contract.capabilities;\n\n const operationRegistry = context.operations;\n\n for (const tableName of Object.keys(storage.tables) as Array<\n keyof Contract['storage']['tables'] & string\n >) {\n const columns = buildColumns<Contract, typeof tableName, CodecTypes, Operations>(\n tableName,\n storage,\n contract,\n operationRegistry,\n contractCapabilities,\n );\n const table = new TableBuilderImpl<\n Contract,\n typeof tableName & string,\n Contract['storage']['tables'][typeof tableName]['columns'],\n CodecTypes,\n Operations\n >(tableName, columns);\n const proxiedTable = createTableProxy<\n Contract,\n typeof tableName & string,\n Contract['storage']['tables'][typeof tableName]['columns'],\n CodecTypes,\n Operations\n >(table);\n (tables as Record<string, unknown>)[tableName] = Object.freeze(\n proxiedTable,\n ) as ExtractSchemaTables<Contract, CodecTypes, Operations>[typeof tableName];\n }\n\n return Object.freeze({ tables }) as SchemaReturnType<Contract>;\n}\n\nexport type { ColumnBuilderImpl as Column, TableBuilderImpl as Table };\n"],"mappings":";;;;;;;;AACA,SAAS,mBAAmB;AAyCrB,IAAM,oBAAN,MAIL;AAAA,EAGA,YACW,OACA,QACQ,eACjB;AAHS;AACA;AACQ;AAAA,EAChB;AAAA,EANM,OAAO;AAAA,EAQhB,IAAI,aAAyB;AAC3B,WAAO,KAAK;AAAA,EACd;AAAA;AAAA,EAGA,IAAI,WAAmB;AACrB,WAAO;AAAA,EACT;AAAA,EAEQ,oBACN,IACA,OAC+C;AAC/C,QAAI,SAAS,MAAM;AACjB,YAAM,YAAY,wEAAwE;AAAA,IAC5F;AACA,QAAI,MAAM,SAAS,uBAAuB,gBAAgB,KAAK,GAAG;AAChE,aAAO,OAAO,OAAO;AAAA,QACnB,MAAM;AAAA,QACN;AAAA,QACA,MAAM;AAAA,QACN,OAAO;AAAA,MACT,CAAC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MACxB;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAEA,UAAM,iBAAiB;AAAA,MAMrB;AAAA,MAMA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAEA,IAAC,OAAmC,UAAU,IAAI;AAAA,EACpD;AAEA,aAAW,cAAc,OAAO,KAAK,YAAY,GAAoC;AACnF,UAAM,YAAY,aAAa,UAAU;AACzC,QAAI,CAAC,UAAW;AAChB,iBAAa,YAAY,SAAS;AAAA,EACpC;AAEA,SAAO;AACT;AAcA,SAAS,iBAOP,OACwE;AACxE,SAAO,IAAI,MAAM,OAAO;AAAA,IACtB,IAAI,QAAQ,MAAM;AAChB,UAAI,SAAS,UAAU,SAAS,UAAU,SAAS,WAAW;AAC5D,eAAO,QAAQ,IAAI,QAAQ,IAAI;AAAA,MACjC;AACA,UAAI,OAAO,SAAS,YAAY,QAAQ,OAAO,SAAS;AACtD,eAAO,OAAO,QAAQ,IAAmC;AAAA,MAC3D;AACA,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;AAqDO,SAAS,OACd,SAC4B;AAC5B,QAAM,WAAW,QAAQ;AACzB,QAAM,UAAU,SAAS;AAGzB,QAAM,SAAS,CAAC;AAChB,QAAM,uBAAuB,SAAS;AAEtC,QAAM,oBAAoB,QAAQ;AAElC,aAAW,aAAa,OAAO,KAAK,QAAQ,MAAM,GAE/C;AACD,UAAM,UAAU;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,UAAM,QAAQ,IAAI,iBAMhB,WAAW,OAAO;AACpB,UAAM,eAAe,iBAMnB,KAAK;AACP,IAAC,OAAmC,SAAS,IAAI,OAAO;AAAA,MACtD;AAAA,IACF;AAAA,EACF;AAEA,SAAO,OAAO,OAAO,EAAE,OAAO,CAAC;AACjC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/schema.ts"],"sourcesContent":["import type { OperationRegistry } from '@prisma-next/operations';\nimport { planInvalid } from '@prisma-next/plan';\nimport type {\n ExtractCodecTypes,\n ExtractOperationTypes,\n SqlContract,\n SqlStorage,\n StorageColumn,\n} from '@prisma-next/sql-contract/types';\nimport type { BinaryOp, TableRef } from './ast/types';\nimport { attachOperationsToColumnBuilder } from './operations-registry';\nimport type { QueryLaneContext } from './query-lane-context';\nimport type {\n AnyColumnBuilderBase,\n BinaryBuilder,\n CodecTypes as CodecTypesType,\n ColumnBuilder,\n ComputeColumnJsType,\n OperationTypeSignature,\n OperationTypes,\n OrderBuilder,\n ParamPlaceholder,\n} from './types';\nimport { isColumnBuilder } from './types';\n\ntype TableColumns<Table extends { columns: Record<string, StorageColumn> }> = Table['columns'];\n\ntype ColumnBuilders<\n Contract extends SqlContract<SqlStorage>,\n TableName extends string,\n Columns extends Record<string, StorageColumn>,\n CodecTypes extends CodecTypesType,\n Operations extends OperationTypes,\n> = {\n readonly [K in keyof Columns]: ColumnBuilder<\n K & string,\n Columns[K],\n ComputeColumnJsType<Contract, TableName, K & string, Columns[K], CodecTypes>,\n Operations\n >;\n};\n\nexport class ColumnBuilderImpl<\n ColumnName extends string,\n ColumnMeta extends StorageColumn,\n JsType = unknown,\n> {\n readonly kind = 'column' as const;\n\n constructor(\n readonly table: string,\n readonly column: ColumnName,\n private readonly storageColumn: ColumnMeta,\n ) {}\n\n get columnMeta(): ColumnMeta {\n return this.storageColumn;\n }\n\n // Type-level helper property (not used at runtime)\n get __jsType(): JsType {\n return undefined as unknown as JsType;\n }\n\n private createBinaryBuilder(\n op: BinaryOp,\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType> {\n if (value == null) {\n throw planInvalid('Parameter placeholder or column builder required for column comparison');\n }\n if (value.kind === 'param-placeholder' || isColumnBuilder(value)) {\n return Object.freeze({\n kind: 'binary' as const,\n op,\n left: this as unknown as ColumnBuilder<ColumnName, ColumnMeta, JsType>,\n right: value,\n }) as BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n }\n throw planInvalid('Parameter placeholder or column builder required for column comparison');\n }\n\n eq(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType> {\n return this.createBinaryBuilder('eq', value);\n }\n\n neq(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType> {\n return this.createBinaryBuilder('neq', value);\n }\n\n gt(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType> {\n return this.createBinaryBuilder('gt', value);\n }\n\n lt(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType> {\n return this.createBinaryBuilder('lt', value);\n }\n\n gte(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType> {\n return this.createBinaryBuilder('gte', value);\n }\n\n lte(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType> {\n return this.createBinaryBuilder('lte', value);\n }\n\n asc(): OrderBuilder<ColumnName, ColumnMeta, JsType> {\n return Object.freeze({\n kind: 'order' as const,\n expr: this as unknown as ColumnBuilder<ColumnName, ColumnMeta, JsType>,\n dir: 'asc' as const,\n }) as OrderBuilder<ColumnName, ColumnMeta, JsType>;\n }\n\n desc(): OrderBuilder<ColumnName, ColumnMeta, JsType> {\n return Object.freeze({\n kind: 'order' as const,\n expr: this as unknown as ColumnBuilder<ColumnName, ColumnMeta, JsType>,\n dir: 'desc' as const,\n }) as OrderBuilder<ColumnName, ColumnMeta, JsType>;\n }\n}\n\nexport class TableBuilderImpl<\n Contract extends SqlContract<SqlStorage>,\n TableName extends string,\n Columns extends Record<string, StorageColumn>,\n CodecTypes extends CodecTypesType,\n Operations extends OperationTypes,\n> implements TableRef\n{\n readonly kind = 'table' as const;\n readonly columns: ColumnBuilders<Contract, TableName, Columns, CodecTypes, Operations>;\n private readonly _name: TableName;\n\n constructor(\n name: TableName,\n columns: ColumnBuilders<Contract, TableName, Columns, CodecTypes, Operations>,\n ) {\n this._name = name;\n this.columns = columns;\n }\n\n get name(): string {\n return this._name;\n }\n}\n\nfunction buildColumns<\n Contract extends SqlContract<SqlStorage>,\n TableName extends keyof Contract['storage']['tables'] & string,\n CodecTypes extends CodecTypesType,\n Operations extends OperationTypes,\n>(\n tableName: TableName,\n storage: SqlStorage,\n _contract: Contract,\n operationRegistry?: OperationRegistry,\n contractCapabilities?: Record<string, Record<string, boolean>>,\n): ColumnBuilders<\n Contract,\n TableName,\n Contract['storage']['tables'][TableName]['columns'],\n CodecTypes,\n Operations\n> {\n const table = storage.tables[tableName];\n\n if (!table) {\n throw planInvalid(`Unknown table ${tableName}`);\n }\n\n type Columns = Contract['storage']['tables'][TableName]['columns'];\n const tableColumns = table.columns as Columns;\n\n const result = {} as {\n [K in keyof Columns]: ColumnBuilder<\n K & string,\n Columns[K],\n ComputeColumnJsType<Contract, TableName, K & string, Columns[K], CodecTypes>,\n Operations\n >;\n };\n\n const assignColumn = <ColumnKey extends keyof Columns & string>(\n columnName: ColumnKey,\n columnDef: Columns[ColumnKey],\n ) => {\n type JsType = ComputeColumnJsType<\n Contract,\n TableName,\n ColumnKey,\n Columns[ColumnKey],\n CodecTypes\n >;\n\n const columnBuilder = new ColumnBuilderImpl<ColumnKey, Columns[ColumnKey], JsType>(\n tableName,\n columnName,\n columnDef,\n );\n\n const builderWithOps = attachOperationsToColumnBuilder<\n ColumnKey,\n Columns[ColumnKey],\n JsType,\n Operations\n >(\n columnBuilder as unknown as ColumnBuilder<\n ColumnKey,\n Columns[ColumnKey],\n JsType,\n Record<string, never>\n >,\n columnDef,\n operationRegistry,\n contractCapabilities,\n );\n\n (result as Record<string, unknown>)[columnName] = builderWithOps;\n };\n\n for (const columnName of Object.keys(tableColumns) as Array<keyof Columns & string>) {\n const columnDef = tableColumns[columnName];\n if (!columnDef) continue;\n assignColumn(columnName, columnDef);\n }\n\n return result as ColumnBuilders<Contract, TableName, Columns, CodecTypes, Operations>;\n}\n\n/**\n * Creates a Proxy that enables accessing table columns directly on the table object,\n * in addition to the standard `table.columns.columnName` syntax.\n *\n * This allows both access patterns:\n * - `tables.user.columns.id` (standard access)\n * - `tables.user.id` (convenience access via proxy)\n *\n * The proxy intercepts property access and routes column name lookups to\n * `table.columns[prop]`, while preserving direct access to table properties\n * like `name`, `kind`, and `columns`.\n */\nfunction createTableProxy<\n Contract extends SqlContract<SqlStorage>,\n TableName extends string,\n Columns extends Record<string, StorageColumn>,\n CodecTypes extends CodecTypesType,\n Operations extends OperationTypes,\n>(\n table: TableBuilderImpl<Contract, TableName, Columns, CodecTypes, Operations>,\n): TableBuilderImpl<Contract, TableName, Columns, CodecTypes, Operations> {\n return new Proxy(table, {\n get(target, prop) {\n if (prop === 'name' || prop === 'kind' || prop === 'columns') {\n return Reflect.get(target, prop);\n }\n if (typeof prop === 'string' && prop in target.columns) {\n return target.columns[prop as keyof typeof target.columns];\n }\n return undefined;\n },\n });\n}\n\ntype ExtractSchemaTables<\n Contract extends SqlContract<SqlStorage>,\n CodecTypes extends CodecTypesType,\n Operations extends OperationTypes,\n> = {\n readonly [TableName in keyof Contract['storage']['tables']]: TableBuilderImpl<\n Contract,\n TableName & string,\n TableColumns<Contract['storage']['tables'][TableName]>,\n CodecTypes,\n Operations\n > &\n TableRef;\n};\n\n/**\n * Extracts the types registry shape from a contract.\n * Each key is a type name from storage.types, and the value preserves the\n * literal type from the contract (including codecId, nativeType, and typeParams).\n * Returns an empty object type {} when storage.types is undefined.\n */\ntype ExtractSchemaTypes<Contract extends SqlContract<SqlStorage>> =\n Contract['storage']['types'] extends infer Types\n ? Types extends Record<string, unknown>\n ? { readonly [TypeName in keyof Types]: Types[TypeName] }\n : Record<string, never>\n : Record<string, never>;\n\nexport type SchemaHandle<\n Contract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>,\n CodecTypes extends CodecTypesType = CodecTypesType,\n Operations extends OperationTypes = Record<string, never>,\n> = {\n readonly tables: ExtractSchemaTables<Contract, CodecTypes, Operations>;\n /**\n * Initialized type helpers from storage.types.\n * Each entry corresponds to a named type instance in the contract's storage.types.\n */\n readonly types: ExtractSchemaTypes<Contract>;\n};\n\ntype SchemaReturnType<Contract extends SqlContract<SqlStorage>> = SchemaHandle<\n Contract,\n ExtractCodecTypes<Contract>,\n ToOperationTypes<ExtractOperationTypes<Contract>>\n>;\n\ntype NormalizeOperationTypes<T> = {\n [TypeId in keyof T]: {\n [Method in keyof T[TypeId]]: T[TypeId][Method] extends OperationTypeSignature\n ? T[TypeId][Method]\n : OperationTypeSignature;\n };\n};\n\ntype ToOperationTypes<T> = T extends OperationTypes ? T : NormalizeOperationTypes<T>;\n\n/**\n * Creates a schema handle for building SQL queries.\n *\n * @param context - Query lane context containing contract, codec and operation registries\n * @returns A schema handle with typed table builders and type helpers\n *\n * @example\n * ```typescript\n * const schemaHandle = schema<Contract>(context);\n * const userTable = schemaHandle.tables.user;\n * const vectorType = schemaHandle.types.Vector1536;\n * ```\n */\nexport function schema<Contract extends SqlContract<SqlStorage>>(\n context: QueryLaneContext<Contract>,\n): SchemaReturnType<Contract> {\n const contract = context.contract;\n const storage = contract.storage;\n type CodecTypes = ExtractCodecTypes<Contract>;\n type Operations = ToOperationTypes<ExtractOperationTypes<Contract>>;\n const tables = {} as ExtractSchemaTables<Contract, CodecTypes, Operations>;\n const contractCapabilities = contract.capabilities;\n\n const operationRegistry = context.operations;\n\n for (const tableName of Object.keys(storage.tables) as Array<\n keyof Contract['storage']['tables'] & string\n >) {\n const columns = buildColumns<Contract, typeof tableName, CodecTypes, Operations>(\n tableName,\n storage,\n contract,\n operationRegistry,\n contractCapabilities,\n );\n const table = new TableBuilderImpl<\n Contract,\n typeof tableName & string,\n Contract['storage']['tables'][typeof tableName]['columns'],\n CodecTypes,\n Operations\n >(tableName, columns);\n const proxiedTable = createTableProxy<\n Contract,\n typeof tableName & string,\n Contract['storage']['tables'][typeof tableName]['columns'],\n CodecTypes,\n Operations\n >(table);\n (tables as Record<string, unknown>)[tableName] = Object.freeze(\n proxiedTable,\n ) as ExtractSchemaTables<Contract, CodecTypes, Operations>[typeof tableName];\n }\n\n // Get type helpers from context (populated by createRuntimeContext)\n const types = (context.types ?? {}) as ExtractSchemaTypes<Contract>;\n\n return Object.freeze({ tables, types }) as SchemaReturnType<Contract>;\n}\n\nexport type { ColumnBuilderImpl as Column, TableBuilderImpl as Table };\n"],"mappings":";;;;;;;;AACA,SAAS,mBAAmB;AAyCrB,IAAM,oBAAN,MAIL;AAAA,EAGA,YACW,OACA,QACQ,eACjB;AAHS;AACA;AACQ;AAAA,EAChB;AAAA,EANM,OAAO;AAAA,EAQhB,IAAI,aAAyB;AAC3B,WAAO,KAAK;AAAA,EACd;AAAA;AAAA,EAGA,IAAI,WAAmB;AACrB,WAAO;AAAA,EACT;AAAA,EAEQ,oBACN,IACA,OAC+C;AAC/C,QAAI,SAAS,MAAM;AACjB,YAAM,YAAY,wEAAwE;AAAA,IAC5F;AACA,QAAI,MAAM,SAAS,uBAAuB,gBAAgB,KAAK,GAAG;AAChE,aAAO,OAAO,OAAO;AAAA,QACnB,MAAM;AAAA,QACN;AAAA,QACA,MAAM;AAAA,QACN,OAAO;AAAA,MACT,CAAC;AAAA,IACH;AACA,UAAM,YAAY,wEAAwE;AAAA,EAC5F;AAAA,EAEA,GACE,OAC+C;AAC/C,WAAO,KAAK,oBAAoB,MAAM,KAAK;AAAA,EAC7C;AAAA,EAEA,IACE,OAC+C;AAC/C,WAAO,KAAK,oBAAoB,OAAO,KAAK;AAAA,EAC9C;AAAA,EAEA,GACE,OAC+C;AAC/C,WAAO,KAAK,oBAAoB,MAAM,KAAK;AAAA,EAC7C;AAAA,EAEA,GACE,OAC+C;AAC/C,WAAO,KAAK,oBAAoB,MAAM,KAAK;AAAA,EAC7C;AAAA,EAEA,IACE,OAC+C;AAC/C,WAAO,KAAK,oBAAoB,OAAO,KAAK;AAAA,EAC9C;AAAA,E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AW;AAC5D,eAAO,QAAQ,IAAI,QAAQ,IAAI;AAAA,MACjC;AACA,UAAI,OAAO,SAAS,YAAY,QAAQ,OAAO,SAAS;AACtD,eAAO,OAAO,QAAQ,IAAmC;AAAA,MAC3D;AACA,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;AAwEO,SAAS,OACd,SAC4B;AAC5B,QAAM,WAAW,QAAQ;AACzB,QAAM,UAAU,SAAS;AAGzB,QAAM,SAAS,CAAC;AAChB,QAAM,uBAAuB,SAAS;AAEtC,QAAM,oBAAoB,QAAQ;AAElC,aAAW,aAAa,OAAO,KAAK,QAAQ,MAAM,GAE/C;AACD,UAAM,UAAU;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,UAAM,QAAQ,IAAI,iBAMhB,WAAW,OAAO;AACpB,UAAM,eAAe,iBAMnB,KAAK;AACP,IAAC,OAAmC,SAAS,IAAI,OAAO;AAAA,MACtD;AAAA,IACF;AAAA,EACF;AAGA,QAAM,QAAS,QAAQ,SAAS,CAAC;AAEjC,SAAO,OAAO,OAAO,EAAE,QAAQ,MAAM,CAAC;AACxC;","names":[]}
|
package/dist/exports/ast.js
CHANGED
package/dist/exports/schema.js
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
ColumnBuilderImpl,
|
|
3
3
|
TableBuilderImpl,
|
|
4
4
|
schema
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-KBWXBENJ.js";
|
|
6
6
|
import "../chunk-M23L3JHG.js";
|
|
7
7
|
import "../chunk-5N34PNVZ.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-GES77TBI.js";
|
|
9
9
|
export {
|
|
10
10
|
ColumnBuilderImpl,
|
|
11
11
|
TableBuilderImpl,
|
package/dist/exports/types.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
ColumnBuilderImpl,
|
|
4
4
|
TableBuilderImpl,
|
|
5
5
|
schema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KBWXBENJ.js";
|
|
7
7
|
import {
|
|
8
8
|
param
|
|
9
9
|
} from "./chunk-7I3EMQID.js";
|
|
@@ -38,11 +38,11 @@ import {
|
|
|
38
38
|
createUpdateAst,
|
|
39
39
|
defineCodecs,
|
|
40
40
|
isOperationExpr
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-63RTW3I7.js";
|
|
42
42
|
import {
|
|
43
43
|
createOrderBuilder,
|
|
44
44
|
isColumnBuilder
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-GES77TBI.js";
|
|
46
46
|
import {
|
|
47
47
|
augmentDescriptorWithColumnMeta
|
|
48
48
|
} from "./chunk-KYSP7L5C.js";
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { OperationRegistry } from '@prisma-next/operations';
|
|
2
2
|
import type { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';
|
|
3
3
|
import type { CodecRegistry } from './ast/codec-types';
|
|
4
|
+
/**
|
|
5
|
+
* Registry of initialized type helpers from storage.types.
|
|
6
|
+
* Each key is a type name from storage.types, and the value is the initialized helper
|
|
7
|
+
* (or validated typeParams if no init hook was provided).
|
|
8
|
+
*/
|
|
9
|
+
export type TypeHelperRegistry = Record<string, unknown>;
|
|
4
10
|
/**
|
|
5
11
|
* Minimal context interface for SQL query lanes.
|
|
6
12
|
*
|
|
@@ -12,5 +18,10 @@ export interface QueryLaneContext<TContract extends SqlContract<SqlStorage> = Sq
|
|
|
12
18
|
readonly contract: TContract;
|
|
13
19
|
readonly operations: OperationRegistry;
|
|
14
20
|
readonly codecs: CodecRegistry;
|
|
21
|
+
/**
|
|
22
|
+
* Optional type helper registry for parameterized types.
|
|
23
|
+
* When present, schema() will expose these helpers via schema.types.
|
|
24
|
+
*/
|
|
25
|
+
readonly types?: TypeHelperRegistry;
|
|
15
26
|
}
|
|
16
27
|
//# sourceMappingURL=query-lane-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-lane-context.d.ts","sourceRoot":"","sources":["../src/query-lane-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB,CAC/B,SAAS,SAAS,WAAW,CAAC,UAAU,CAAC,GAAG,WAAW,CAAC,UAAU,CAAC;IAEnE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"query-lane-context.d.ts","sourceRoot":"","sources":["../src/query-lane-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB,CAC/B,SAAS,SAAS,WAAW,CAAC,UAAU,CAAC,GAAG,WAAW,CAAC,UAAU,CAAC;IAEnE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,kBAAkB,CAAC;CACrC"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -36,8 +36,22 @@ export declare class TableBuilderImpl<Contract extends SqlContract<SqlStorage>,
|
|
|
36
36
|
type ExtractSchemaTables<Contract extends SqlContract<SqlStorage>, CodecTypes extends CodecTypesType, Operations extends OperationTypes> = {
|
|
37
37
|
readonly [TableName in keyof Contract['storage']['tables']]: TableBuilderImpl<Contract, TableName & string, TableColumns<Contract['storage']['tables'][TableName]>, CodecTypes, Operations> & TableRef;
|
|
38
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Extracts the types registry shape from a contract.
|
|
41
|
+
* Each key is a type name from storage.types, and the value preserves the
|
|
42
|
+
* literal type from the contract (including codecId, nativeType, and typeParams).
|
|
43
|
+
* Returns an empty object type {} when storage.types is undefined.
|
|
44
|
+
*/
|
|
45
|
+
type ExtractSchemaTypes<Contract extends SqlContract<SqlStorage>> = Contract['storage']['types'] extends infer Types ? Types extends Record<string, unknown> ? {
|
|
46
|
+
readonly [TypeName in keyof Types]: Types[TypeName];
|
|
47
|
+
} : Record<string, never> : Record<string, never>;
|
|
39
48
|
export type SchemaHandle<Contract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>, CodecTypes extends CodecTypesType = CodecTypesType, Operations extends OperationTypes = Record<string, never>> = {
|
|
40
49
|
readonly tables: ExtractSchemaTables<Contract, CodecTypes, Operations>;
|
|
50
|
+
/**
|
|
51
|
+
* Initialized type helpers from storage.types.
|
|
52
|
+
* Each entry corresponds to a named type instance in the contract's storage.types.
|
|
53
|
+
*/
|
|
54
|
+
readonly types: ExtractSchemaTypes<Contract>;
|
|
41
55
|
};
|
|
42
56
|
type SchemaReturnType<Contract extends SqlContract<SqlStorage>> = SchemaHandle<Contract, ExtractCodecTypes<Contract>, ToOperationTypes<ExtractOperationTypes<Contract>>>;
|
|
43
57
|
type NormalizeOperationTypes<T> = {
|
|
@@ -50,12 +64,13 @@ type ToOperationTypes<T> = T extends OperationTypes ? T : NormalizeOperationType
|
|
|
50
64
|
* Creates a schema handle for building SQL queries.
|
|
51
65
|
*
|
|
52
66
|
* @param context - Query lane context containing contract, codec and operation registries
|
|
53
|
-
* @returns A schema handle with typed table builders
|
|
67
|
+
* @returns A schema handle with typed table builders and type helpers
|
|
54
68
|
*
|
|
55
69
|
* @example
|
|
56
70
|
* ```typescript
|
|
57
71
|
* const schemaHandle = schema<Contract>(context);
|
|
58
72
|
* const userTable = schemaHandle.tables.user;
|
|
73
|
+
* const vectorType = schemaHandle.types.Vector1536;
|
|
59
74
|
* ```
|
|
60
75
|
*/
|
|
61
76
|
export declare function schema<Contract extends SqlContract<SqlStorage>>(context: QueryLaneContext<Contract>): SchemaReturnType<Contract>;
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACrB,WAAW,EACX,UAAU,EACV,aAAa,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAY,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,UAAU,IAAI,cAAc,EAC5B,aAAa,EACb,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,YAAY,EACZ,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAGjB,KAAK,YAAY,CAAC,KAAK,SAAS;IAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CAAE,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;AAE/F,KAAK,cAAc,CACjB,QAAQ,SAAS,WAAW,CAAC,UAAU,CAAC,EACxC,SAAS,SAAS,MAAM,EACxB,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,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M,CAAC,QAAQ,SAAS,WAAW,CAAC,UAAU,CAAC,EAC7D,OAAO,EAAE,gBAAgB,CAAC,QAAQ,CAAC,GAClC,gBAAgB,CAAC,QAAQ,CAAC,CA2C5B;AAED,YAAY,EAAE,iBAAiB,IAAI,MAAM,EAAE,gBAAgB,IAAI,KAAK,EAAE,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -81,6 +81,38 @@ type ExtractCodecOutputType<CodecId extends string, CodecTypes extends Record<st
|
|
|
81
81
|
}>> = CodecId extends keyof CodecTypes ? CodecTypes[CodecId] extends {
|
|
82
82
|
readonly output: infer Output;
|
|
83
83
|
} ? Output : never : never;
|
|
84
|
+
type ExtractColumnJsTypeFromModels<Contract extends SqlContract<SqlStorage>, TableName extends string, ColumnName extends string> = Contract['mappings'] extends {
|
|
85
|
+
readonly tableToModel: infer TableToModel;
|
|
86
|
+
readonly columnToField: infer ColumnToField;
|
|
87
|
+
} ? TableToModel extends Record<string, string> ? ColumnToField extends Record<string, Record<string, string>> ? TableName extends keyof TableToModel ? TableName extends keyof ColumnToField ? ColumnName extends keyof ColumnToField[TableName] ? Contract['models'] extends infer Models ? Models extends Record<string, unknown> ? TableToModel[TableName] extends keyof Models ? Models[TableToModel[TableName]] extends {
|
|
88
|
+
readonly fields: infer Fields;
|
|
89
|
+
} ? Fields extends Record<string, unknown> ? ColumnToField[TableName][ColumnName] extends keyof Fields ? Fields[ColumnToField[TableName][ColumnName]] : never : never : never : never : never : never : never : never : never : never : never : never;
|
|
90
|
+
/**
|
|
91
|
+
* Resolves type params for a column from either:
|
|
92
|
+
* - inline `columnMeta.typeParams`, or
|
|
93
|
+
* - `columnMeta.typeRef` (resolving into `contract.storage.types[typeRef].typeParams`).
|
|
94
|
+
*/
|
|
95
|
+
type ResolveColumnTypeParams<Contract extends SqlContract<SqlStorage>, ColumnMeta extends StorageColumn> = ColumnMeta extends {
|
|
96
|
+
typeParams: infer Params;
|
|
97
|
+
} ? Params extends object ? Params : undefined : ColumnMeta extends {
|
|
98
|
+
typeRef: infer TypeRef extends string;
|
|
99
|
+
} ? Contract['storage'] extends {
|
|
100
|
+
types: infer Types;
|
|
101
|
+
} ? Types extends Record<string, unknown> ? TypeRef extends keyof Types ? Types[TypeRef] extends {
|
|
102
|
+
typeParams: infer Params;
|
|
103
|
+
} ? Params extends object ? Params : undefined : undefined : undefined : undefined : undefined : undefined;
|
|
104
|
+
/**
|
|
105
|
+
* If a codec entry exposes a type-level parameterized output surface, compute the output type
|
|
106
|
+
* for a specific params object. Falls back to `never` if not supported.
|
|
107
|
+
*
|
|
108
|
+
* This enables lane typing to incorporate `columnMeta.typeParams` without branching on codec IDs
|
|
109
|
+
* in core lane code.
|
|
110
|
+
*/
|
|
111
|
+
type ExtractParameterizedCodecOutputType<CodecId extends string, Params, CodecTypes extends Record<string, {
|
|
112
|
+
readonly output: unknown;
|
|
113
|
+
}>> = CodecId extends keyof CodecTypes ? CodecTypes[CodecId] extends {
|
|
114
|
+
readonly parameterizedOutput: infer Fn;
|
|
115
|
+
} ? Fn extends (params: Params) => infer Out ? Out : never : never : never;
|
|
84
116
|
/**
|
|
85
117
|
* Type-level operation signature.
|
|
86
118
|
* Represents an operation at the type level, similar to OperationSignature at runtime.
|
|
@@ -184,11 +216,11 @@ type ColumnMetaTypeId<ColumnMeta> = ColumnMeta extends {
|
|
|
184
216
|
} ? CodecId : ColumnMeta extends {
|
|
185
217
|
type: infer TypeId extends string;
|
|
186
218
|
} ? TypeId : never;
|
|
187
|
-
export type ComputeColumnJsType<
|
|
219
|
+
export type ComputeColumnJsType<Contract extends SqlContract<SqlStorage>, TableName extends string, ColumnName extends string, ColumnMeta extends StorageColumn, CodecTypes extends Record<string, {
|
|
188
220
|
readonly output: unknown;
|
|
189
|
-
}>> = ColumnMeta extends {
|
|
221
|
+
}>> = ExtractColumnJsTypeFromModels<Contract, TableName, ColumnName> extends infer FromModels ? [FromModels] extends [never] ? ColumnMeta extends {
|
|
190
222
|
nullable: infer Nullable;
|
|
191
|
-
} ? ColumnMetaTypeId<ColumnMeta> extends infer TypeId ? TypeId extends string ? ExtractCodecOutputType<TypeId, CodecTypes> extends infer CodecOutput ? [CodecOutput] extends [never] ? unknown : Nullable extends true ? CodecOutput | null : CodecOutput : unknown : unknown : unknown : unknown;
|
|
223
|
+
} ? ColumnMetaTypeId<ColumnMeta> extends infer TypeId ? TypeId extends string ? ResolveColumnTypeParams<Contract, ColumnMeta> extends infer Params ? Params extends object ? ExtractParameterizedCodecOutputType<TypeId, Params, CodecTypes> extends infer ParamOutput ? [ParamOutput] extends [never] ? ExtractCodecOutputType<TypeId, CodecTypes> extends infer CodecOutput ? [CodecOutput] extends [never] ? unknown : Nullable extends true ? CodecOutput | null : CodecOutput : unknown : Nullable extends true ? ParamOutput | null : ParamOutput : unknown : ExtractCodecOutputType<TypeId, CodecTypes> extends infer CodecOutput ? [CodecOutput] extends [never] ? unknown : Nullable extends true ? CodecOutput | null : CodecOutput : unknown : unknown : unknown : unknown : unknown : FromModels : unknown;
|
|
192
224
|
/**
|
|
193
225
|
* Infers Row type from a projection object.
|
|
194
226
|
* Maps Record<string, ColumnBuilder> to Record<string, JSType>
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,IAAI,cAAc,EAC5B,aAAa,EACb,QAAQ,EACT,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAC9F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,SAAS,EACT,aAAa,EACb,QAAQ,EACR,QAAQ,EACT,MAAM,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AQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC5D,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CACzC;AAED,MAAM,MAAM,kBAAkB,GAAG,CAC/B,OAAO,EAAE,oBAAoB,EAC7B,GAAG,MAAM,EAAE,SAAS,OAAO,EAAE,KAC1B,aAAa,CAAC;AAEnB,MAAM,WAAW,UAAW,SAAQ,kBAAkB;IACpD,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,aAAa,CAAC;IAC3D,IAAI,CAAC,OAAO,EAAE,kBAAkB,GAAG,kBAAkB,CAAC;CACvD;AAED,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CAClC;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;CAClC;AAED,MAAM,WAAW,iBAAiB,CAChC,SAAS,SAAS,WAAW,CAAC,UAAU,CAAC,GAAG,WAAW,CAAC,UAAU,CAAC;IAEnE,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;CAC/C;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/sql-relational-core",
|
|
3
|
-
"version": "0.3.0-
|
|
3
|
+
"version": "0.3.0-pr.100.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Schema and column builders, operation attachment, and AST types for Prisma Next",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"ts-toolbelt": "^9.6.0",
|
|
9
|
-
"@prisma-next/
|
|
10
|
-
"@prisma-next/
|
|
11
|
-
"@prisma-next/
|
|
12
|
-
"@prisma-next/
|
|
13
|
-
"@prisma-next/
|
|
9
|
+
"@prisma-next/plan": "0.3.0-pr.100.1",
|
|
10
|
+
"@prisma-next/sql-contract": "0.3.0-pr.100.1",
|
|
11
|
+
"@prisma-next/sql-operations": "0.3.0-pr.100.1",
|
|
12
|
+
"@prisma-next/contract": "0.3.0-pr.100.1",
|
|
13
|
+
"@prisma-next/operations": "0.3.0-pr.100.1"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@vitest/coverage-v8": "4.0.16",
|
|
17
16
|
"tsup": "8.5.1",
|
|
18
17
|
"typescript": "5.9.3",
|
|
19
18
|
"vitest": "4.0.16",
|
|
20
|
-
"@prisma-next/sql-contract-ts": "0.3.0-
|
|
21
|
-
"@prisma-next/test-utils": "0.0.1"
|
|
19
|
+
"@prisma-next/sql-contract-ts": "0.3.0-pr.100.1",
|
|
20
|
+
"@prisma-next/test-utils": "0.0.1",
|
|
21
|
+
"@prisma-next/tsconfig": "0.0.0"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"dist",
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
"test": "vitest run",
|
|
72
72
|
"test:coverage": "vitest run --coverage",
|
|
73
73
|
"typecheck": "tsc --project tsconfig.json --noEmit",
|
|
74
|
-
"lint": "biome check . --
|
|
75
|
-
"lint:fix": "biome check --write .
|
|
76
|
-
"lint:fix:unsafe": "biome check --write --unsafe .
|
|
77
|
-
"clean": "
|
|
74
|
+
"lint": "biome check . --error-on-warnings",
|
|
75
|
+
"lint:fix": "biome check --write .",
|
|
76
|
+
"lint:fix:unsafe": "biome check --write --unsafe .",
|
|
77
|
+
"clean": "rm -rf dist coverage .tmp-output"
|
|
78
78
|
}
|
|
79
79
|
}
|
package/src/ast/codec-types.ts
CHANGED
|
@@ -176,11 +176,12 @@ export function codec<Id extends string, TWire, TJs>(config: {
|
|
|
176
176
|
/**
|
|
177
177
|
* Type helpers to extract codec types.
|
|
178
178
|
*/
|
|
179
|
-
export type CodecId<T> =
|
|
180
|
-
|
|
181
|
-
: T extends { readonly id: infer Id }
|
|
179
|
+
export type CodecId<T> =
|
|
180
|
+
T extends Codec<infer Id, unknown, unknown>
|
|
182
181
|
? Id
|
|
183
|
-
:
|
|
182
|
+
: T extends { readonly id: infer Id }
|
|
183
|
+
? Id
|
|
184
|
+
: never;
|
|
184
185
|
export type CodecInput<T> = T extends Codec<string, unknown, infer JsT> ? JsT : never;
|
|
185
186
|
export type CodecOutput<T> = T extends Codec<string, unknown, infer JsT> ? JsT : never;
|
|
186
187
|
|
|
@@ -2,6 +2,13 @@ import type { OperationRegistry } from '@prisma-next/operations';
|
|
|
2
2
|
import type { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';
|
|
3
3
|
import type { CodecRegistry } from './ast/codec-types';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Registry of initialized type helpers from storage.types.
|
|
7
|
+
* Each key is a type name from storage.types, and the value is the initialized helper
|
|
8
|
+
* (or validated typeParams if no init hook was provided).
|
|
9
|
+
*/
|
|
10
|
+
export type TypeHelperRegistry = Record<string, unknown>;
|
|
11
|
+
|
|
5
12
|
/**
|
|
6
13
|
* Minimal context interface for SQL query lanes.
|
|
7
14
|
*
|
|
@@ -15,4 +22,9 @@ export interface QueryLaneContext<
|
|
|
15
22
|
readonly contract: TContract;
|
|
16
23
|
readonly operations: OperationRegistry;
|
|
17
24
|
readonly codecs: CodecRegistry;
|
|
25
|
+
/**
|
|
26
|
+
* Optional type helper registry for parameterized types.
|
|
27
|
+
* When present, schema() will expose these helpers via schema.types.
|
|
28
|
+
*/
|
|
29
|
+
readonly types?: TypeHelperRegistry;
|
|
18
30
|
}
|
package/src/schema.ts
CHANGED
|
@@ -290,12 +290,30 @@ type ExtractSchemaTables<
|
|
|
290
290
|
TableRef;
|
|
291
291
|
};
|
|
292
292
|
|
|
293
|
+
/**
|
|
294
|
+
* Extracts the types registry shape from a contract.
|
|
295
|
+
* Each key is a type name from storage.types, and the value preserves the
|
|
296
|
+
* literal type from the contract (including codecId, nativeType, and typeParams).
|
|
297
|
+
* Returns an empty object type {} when storage.types is undefined.
|
|
298
|
+
*/
|
|
299
|
+
type ExtractSchemaTypes<Contract extends SqlContract<SqlStorage>> =
|
|
300
|
+
Contract['storage']['types'] extends infer Types
|
|
301
|
+
? Types extends Record<string, unknown>
|
|
302
|
+
? { readonly [TypeName in keyof Types]: Types[TypeName] }
|
|
303
|
+
: Record<string, never>
|
|
304
|
+
: Record<string, never>;
|
|
305
|
+
|
|
293
306
|
export type SchemaHandle<
|
|
294
307
|
Contract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>,
|
|
295
308
|
CodecTypes extends CodecTypesType = CodecTypesType,
|
|
296
309
|
Operations extends OperationTypes = Record<string, never>,
|
|
297
310
|
> = {
|
|
298
311
|
readonly tables: ExtractSchemaTables<Contract, CodecTypes, Operations>;
|
|
312
|
+
/**
|
|
313
|
+
* Initialized type helpers from storage.types.
|
|
314
|
+
* Each entry corresponds to a named type instance in the contract's storage.types.
|
|
315
|
+
*/
|
|
316
|
+
readonly types: ExtractSchemaTypes<Contract>;
|
|
299
317
|
};
|
|
300
318
|
|
|
301
319
|
type SchemaReturnType<Contract extends SqlContract<SqlStorage>> = SchemaHandle<
|
|
@@ -318,12 +336,13 @@ type ToOperationTypes<T> = T extends OperationTypes ? T : NormalizeOperationType
|
|
|
318
336
|
* Creates a schema handle for building SQL queries.
|
|
319
337
|
*
|
|
320
338
|
* @param context - Query lane context containing contract, codec and operation registries
|
|
321
|
-
* @returns A schema handle with typed table builders
|
|
339
|
+
* @returns A schema handle with typed table builders and type helpers
|
|
322
340
|
*
|
|
323
341
|
* @example
|
|
324
342
|
* ```typescript
|
|
325
343
|
* const schemaHandle = schema<Contract>(context);
|
|
326
344
|
* const userTable = schemaHandle.tables.user;
|
|
345
|
+
* const vectorType = schemaHandle.types.Vector1536;
|
|
327
346
|
* ```
|
|
328
347
|
*/
|
|
329
348
|
export function schema<Contract extends SqlContract<SqlStorage>>(
|
|
@@ -367,7 +386,10 @@ export function schema<Contract extends SqlContract<SqlStorage>>(
|
|
|
367
386
|
) as ExtractSchemaTables<Contract, CodecTypes, Operations>[typeof tableName];
|
|
368
387
|
}
|
|
369
388
|
|
|
370
|
-
|
|
389
|
+
// Get type helpers from context (populated by createRuntimeContext)
|
|
390
|
+
const types = (context.types ?? {}) as ExtractSchemaTypes<Contract>;
|
|
391
|
+
|
|
392
|
+
return Object.freeze({ tables, types }) as SchemaReturnType<Contract>;
|
|
371
393
|
}
|
|
372
394
|
|
|
373
395
|
export type { ColumnBuilderImpl as Column, TableBuilderImpl as Table };
|
package/src/types.ts
CHANGED
|
@@ -167,6 +167,84 @@ type ExtractCodecOutputType<
|
|
|
167
167
|
: never
|
|
168
168
|
: never;
|
|
169
169
|
|
|
170
|
+
type ExtractColumnJsTypeFromModels<
|
|
171
|
+
Contract extends SqlContract<SqlStorage>,
|
|
172
|
+
TableName extends string,
|
|
173
|
+
ColumnName extends string,
|
|
174
|
+
> = Contract['mappings'] extends {
|
|
175
|
+
readonly tableToModel: infer TableToModel;
|
|
176
|
+
readonly columnToField: infer ColumnToField;
|
|
177
|
+
}
|
|
178
|
+
? TableToModel extends Record<string, string>
|
|
179
|
+
? ColumnToField extends Record<string, Record<string, string>>
|
|
180
|
+
? TableName extends keyof TableToModel
|
|
181
|
+
? TableName extends keyof ColumnToField
|
|
182
|
+
? ColumnName extends keyof ColumnToField[TableName]
|
|
183
|
+
? Contract['models'] extends infer Models
|
|
184
|
+
? Models extends Record<string, unknown>
|
|
185
|
+
? TableToModel[TableName] extends keyof Models
|
|
186
|
+
? Models[TableToModel[TableName]] extends { readonly fields: infer Fields }
|
|
187
|
+
? Fields extends Record<string, unknown>
|
|
188
|
+
? ColumnToField[TableName][ColumnName] extends keyof Fields
|
|
189
|
+
? Fields[ColumnToField[TableName][ColumnName]]
|
|
190
|
+
: never
|
|
191
|
+
: never
|
|
192
|
+
: never
|
|
193
|
+
: never
|
|
194
|
+
: never
|
|
195
|
+
: never
|
|
196
|
+
: never
|
|
197
|
+
: never
|
|
198
|
+
: never
|
|
199
|
+
: never
|
|
200
|
+
: never
|
|
201
|
+
: never;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Resolves type params for a column from either:
|
|
205
|
+
* - inline `columnMeta.typeParams`, or
|
|
206
|
+
* - `columnMeta.typeRef` (resolving into `contract.storage.types[typeRef].typeParams`).
|
|
207
|
+
*/
|
|
208
|
+
type ResolveColumnTypeParams<
|
|
209
|
+
Contract extends SqlContract<SqlStorage>,
|
|
210
|
+
ColumnMeta extends StorageColumn,
|
|
211
|
+
> = ColumnMeta extends { typeParams: infer Params }
|
|
212
|
+
? Params extends object
|
|
213
|
+
? Params
|
|
214
|
+
: undefined
|
|
215
|
+
: ColumnMeta extends { typeRef: infer TypeRef extends string }
|
|
216
|
+
? Contract['storage'] extends { types: infer Types }
|
|
217
|
+
? Types extends Record<string, unknown>
|
|
218
|
+
? TypeRef extends keyof Types
|
|
219
|
+
? Types[TypeRef] extends { typeParams: infer Params }
|
|
220
|
+
? Params extends object
|
|
221
|
+
? Params
|
|
222
|
+
: undefined
|
|
223
|
+
: undefined
|
|
224
|
+
: undefined
|
|
225
|
+
: undefined
|
|
226
|
+
: undefined
|
|
227
|
+
: undefined;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* If a codec entry exposes a type-level parameterized output surface, compute the output type
|
|
231
|
+
* for a specific params object. Falls back to `never` if not supported.
|
|
232
|
+
*
|
|
233
|
+
* This enables lane typing to incorporate `columnMeta.typeParams` without branching on codec IDs
|
|
234
|
+
* in core lane code.
|
|
235
|
+
*/
|
|
236
|
+
type ExtractParameterizedCodecOutputType<
|
|
237
|
+
CodecId extends string,
|
|
238
|
+
Params,
|
|
239
|
+
CodecTypes extends Record<string, { readonly output: unknown }>,
|
|
240
|
+
> = CodecId extends keyof CodecTypes
|
|
241
|
+
? CodecTypes[CodecId] extends { readonly parameterizedOutput: infer Fn }
|
|
242
|
+
? Fn extends (params: Params) => infer Out
|
|
243
|
+
? Out
|
|
244
|
+
: never
|
|
245
|
+
: never
|
|
246
|
+
: never;
|
|
247
|
+
|
|
170
248
|
/**
|
|
171
249
|
* Type-level operation signature.
|
|
172
250
|
* Represents an operation at the type level, similar to OperationSignature at runtime.
|
|
@@ -308,23 +386,47 @@ type ColumnMetaTypeId<ColumnMeta> = ColumnMeta extends { codecId: infer CodecId
|
|
|
308
386
|
: never;
|
|
309
387
|
|
|
310
388
|
export type ComputeColumnJsType<
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
389
|
+
Contract extends SqlContract<SqlStorage>,
|
|
390
|
+
TableName extends string,
|
|
391
|
+
ColumnName extends string,
|
|
314
392
|
ColumnMeta extends StorageColumn,
|
|
315
393
|
CodecTypes extends Record<string, { readonly output: unknown }>,
|
|
316
|
-
> =
|
|
317
|
-
?
|
|
318
|
-
?
|
|
319
|
-
?
|
|
320
|
-
?
|
|
321
|
-
?
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
394
|
+
> = ExtractColumnJsTypeFromModels<Contract, TableName, ColumnName> extends infer FromModels
|
|
395
|
+
? [FromModels] extends [never]
|
|
396
|
+
? ColumnMeta extends { nullable: infer Nullable }
|
|
397
|
+
? ColumnMetaTypeId<ColumnMeta> extends infer TypeId
|
|
398
|
+
? TypeId extends string
|
|
399
|
+
? ResolveColumnTypeParams<Contract, ColumnMeta> extends infer Params
|
|
400
|
+
? Params extends object
|
|
401
|
+
? ExtractParameterizedCodecOutputType<
|
|
402
|
+
TypeId,
|
|
403
|
+
Params,
|
|
404
|
+
CodecTypes
|
|
405
|
+
> extends infer ParamOutput
|
|
406
|
+
? [ParamOutput] extends [never]
|
|
407
|
+
? ExtractCodecOutputType<TypeId, CodecTypes> extends infer CodecOutput
|
|
408
|
+
? [CodecOutput] extends [never]
|
|
409
|
+
? unknown // Codec not found in CodecTypes
|
|
410
|
+
: Nullable extends true
|
|
411
|
+
? CodecOutput | null
|
|
412
|
+
: CodecOutput
|
|
413
|
+
: unknown
|
|
414
|
+
: Nullable extends true
|
|
415
|
+
? ParamOutput | null
|
|
416
|
+
: ParamOutput
|
|
417
|
+
: unknown
|
|
418
|
+
: ExtractCodecOutputType<TypeId, CodecTypes> extends infer CodecOutput
|
|
419
|
+
? [CodecOutput] extends [never]
|
|
420
|
+
? unknown // Codec not found in CodecTypes
|
|
421
|
+
: Nullable extends true
|
|
422
|
+
? CodecOutput | null
|
|
423
|
+
: CodecOutput
|
|
424
|
+
: unknown
|
|
425
|
+
: unknown
|
|
426
|
+
: unknown
|
|
325
427
|
: unknown
|
|
326
428
|
: unknown
|
|
327
|
-
:
|
|
429
|
+
: FromModels
|
|
328
430
|
: unknown;
|
|
329
431
|
|
|
330
432
|
/**
|
|
@@ -336,14 +438,15 @@ export type ComputeColumnJsType<
|
|
|
336
438
|
/**
|
|
337
439
|
* Extracts the inferred JsType carried by a ColumnBuilder.
|
|
338
440
|
*/
|
|
339
|
-
type ExtractJsTypeFromColumnBuilder<CB extends AnyColumnBuilder> =
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
441
|
+
type ExtractJsTypeFromColumnBuilder<CB extends AnyColumnBuilder> =
|
|
442
|
+
CB extends ColumnBuilder<
|
|
443
|
+
infer _ColumnName extends string,
|
|
444
|
+
infer _ColumnMeta extends StorageColumn,
|
|
445
|
+
infer JsType,
|
|
446
|
+
infer _Ops
|
|
447
|
+
>
|
|
448
|
+
? JsType
|
|
449
|
+
: never;
|
|
347
450
|
|
|
348
451
|
export type InferProjectionRow<P extends Record<string, AnyColumnBuilder>> = {
|
|
349
452
|
[K in keyof P]: ExtractJsTypeFromColumnBuilder<P[K]>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n ResultType as CoreResultType,\n ExecutionPlan,\n PlanRefs,\n} from '@prisma-next/contract/types';\nimport type { ArgSpec, ReturnSpec } from '@prisma-next/operations';\nimport type { SqlContract, SqlStorage, StorageColumn } from '@prisma-next/sql-contract/types';\nimport type { SqlLoweringSpec } from '@prisma-next/sql-operations';\nimport type {\n BinaryOp,\n ColumnRef,\n Direction,\n OperationExpr,\n ParamRef,\n QueryAst,\n} from './ast/types';\nimport type { SqlQueryPlan } from './plan';\nimport type { QueryLaneContext } from './query-lane-context';\n\nexport interface ParamPlaceholder {\n readonly kind: 'param-placeholder';\n readonly name: string;\n}\n\nexport interface OrderBuilder<\n ColumnName extends string = string,\n ColumnMeta extends StorageColumn = StorageColumn,\n JsType = unknown,\n> {\n readonly kind: 'order';\n readonly expr: ColumnBuilder<ColumnName, ColumnMeta, JsType> | OperationExpr;\n readonly dir: Direction;\n}\n\n/**\n * Creates an OrderBuilder for use in orderBy clauses.\n */\nexport function createOrderBuilder(\n expr: AnyColumnBuilder | OperationExpr,\n dir: Direction,\n): AnyOrderBuilder {\n return { kind: 'order', expr, dir } as AnyOrderBuilder;\n}\n\n/**\n * ColumnBuilder with optional operation methods based on the column's typeId.\n * When Operations is provided and the column's typeId matches, operation methods are included.\n */\nexport type ColumnBuilder<\n ColumnName extends string = string,\n ColumnMeta extends StorageColumn = StorageColumn,\n JsType = unknown,\n Operations extends OperationTypes = Record<string, never>,\n> = {\n readonly kind: 'column';\n readonly table: string;\n readonly column: ColumnName;\n readonly columnMeta: ColumnMeta;\n eq(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n neq(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n gt(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n lt(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n gte(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n lte(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n asc(): OrderBuilder<ColumnName, ColumnMeta, JsType>;\n desc(): OrderBuilder<ColumnName, ColumnMeta, JsType>;\n // Helper property for type extraction (not used at runtime)\n readonly __jsType: JsType;\n} & (ColumnMeta['codecId'] extends string\n ? ColumnMeta['codecId'] extends keyof Operations\n ? OperationMethods<\n OperationsForTypeId<ColumnMeta['codecId'] & string, Operations>,\n ColumnName,\n StorageColumn,\n JsType\n >\n : Record<string, never>\n : Record<string, never>);\n\nexport interface BinaryBuilder<\n ColumnName extends string = string,\n ColumnMeta extends StorageColumn = StorageColumn,\n JsType = unknown,\n> {\n readonly kind: 'binary';\n readonly op: BinaryOp;\n readonly left: ColumnBuilder<ColumnName, ColumnMeta, JsType> | OperationExpr;\n readonly right: ParamPlaceholder | AnyColumnBuilderBase;\n}\n\n// Helper aliases for usage sites where the specific column parameters are irrelevant\n// Accepts any ColumnBuilder regardless of its Operations parameter\n// Note: We use `any` here because TypeScript's variance rules don't allow us to express\n// \"any type that extends OperationTypes\" in a way that works for assignment.\n// Contract-specific OperationTypes (e.g., PgVectorOperationTypes) are not assignable\n// to the base OperationTypes in generic parameter position, even though they extend it structurally.\n// Helper type that accepts any ColumnBuilder regardless of its generic parameters\n// This is needed because conditional types in ColumnBuilder create incompatible intersection types\n// when Operations differs, even though structurally they're compatible\nexport type AnyColumnBuilderBase = {\n readonly kind: 'column';\n readonly table: string;\n readonly column: string;\n readonly columnMeta: StorageColumn;\n eq(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;\n neq(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;\n gt(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;\n lt(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;\n gte(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;\n lte(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;\n asc(): AnyOrderBuilder;\n desc(): AnyOrderBuilder;\n readonly __jsType: unknown;\n // Allow any operation methods (from conditional type)\n readonly [key: string]: unknown;\n};\n\nexport type AnyColumnBuilder =\n | ColumnBuilder<\n string,\n StorageColumn,\n unknown,\n // biome-ignore lint/suspicious/noExplicitAny: AnyColumnBuilder must accept column builders with any operation types\n any\n >\n | AnyColumnBuilderBase;\nexport type AnyBinaryBuilder = BinaryBuilder<string, StorageColumn, unknown>;\nexport type AnyOrderBuilder = OrderBuilder<string, StorageColumn, unknown>;\n\nexport function isColumnBuilder(value: unknown): value is AnyColumnBuilder {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'kind' in value &&\n (value as { kind: unknown }).kind === 'column'\n );\n}\n\nexport interface JoinOnBuilder {\n eqCol(left: AnyColumnBuilder, right: AnyColumnBuilder): JoinOnPredicate;\n}\n\nexport interface JoinOnPredicate {\n readonly kind: 'join-on';\n readonly left: AnyColumnBuilder;\n readonly right: AnyColumnBuilder;\n}\n\nexport type Expr = ColumnRef | ParamRef;\n\n/**\n * Helper type to extract codec output type from CodecTypes.\n * Returns never if the codecId is not found in CodecTypes.\n */\ntype ExtractCodecOutputType<\n CodecId extends string,\n CodecTypes extends Record<string, { readonly output: unknown }>,\n> = CodecId extends keyof CodecTypes\n ? CodecTypes[CodecId] extends { readonly output: infer Output }\n ? Output\n : never\n : never;\n\n/**\n * Type-level operation signature.\n * Represents an operation at the type level, similar to OperationSignature at runtime.\n */\nexport type OperationTypeSignature = {\n readonly args: ReadonlyArray<ArgSpec>;\n readonly returns: ReturnSpec;\n readonly lowering: SqlLoweringSpec;\n readonly capabilities?: ReadonlyArray<string>;\n};\n\n/**\n * Type-level operation registry.\n * Maps typeId → operations, where operations is a record of method name → operation signature.\n *\n * Example:\n * ```typescript\n * type MyOperations: OperationTypes = {\n * 'pg/vector@1': {\n * cosineDistance: {\n * args: [{ kind: 'typeId'; type: 'pg/vector@1' }];\n * returns: { kind: 'builtin'; type: 'number' };\n * lowering: { targetFamily: 'sql'; strategy: 'function'; template: '...' };\n * };\n * };\n * };\n * ```\n */\nexport type OperationTypes = Record<string, Record<string, OperationTypeSignature>>;\n\n/**\n * CodecTypes represents a map of typeId to codec definitions.\n * Each codec definition must have an `output` property indicating the JavaScript type.\n *\n * Example:\n * ```typescript\n * type MyCodecTypes: CodecTypes = {\n * 'pg/int4@1': { output: number };\n * 'pg/text@1': { output: string };\n * };\n * ```\n */\nexport type CodecTypes = Record<string, { readonly output: unknown }>;\n\n/**\n * Extracts operations for a given typeId from the operation registry.\n * Returns an empty record if the typeId is not found.\n *\n * @example\n * ```typescript\n * type Ops = OperationsForTypeId<'pg/vector@1', MyOperations>;\n * // Ops = { cosineDistance: { ... }, l2Distance: { ... } }\n * ```\n */\nexport type OperationsForTypeId<\n TypeId extends string,\n Operations extends OperationTypes,\n> = Operations extends Record<string, never>\n ? Record<string, never>\n : TypeId extends keyof Operations\n ? Operations[TypeId]\n : Record<string, never>;\n\n/**\n * Maps operation signatures to method signatures on ColumnBuilder.\n * Each operation becomes a method that returns a ColumnBuilder or BinaryBuilder\n * based on the return type.\n */\ntype OperationMethods<\n Ops extends Record<string, OperationTypeSignature>,\n ColumnName extends string,\n ColumnMeta extends StorageColumn,\n JsType,\n> = {\n [K in keyof Ops]: Ops[K] extends OperationTypeSignature\n ? (\n ...args: OperationArgs<Ops[K]['args']>\n ) => OperationReturn<Ops[K]['returns'], ColumnName, ColumnMeta, JsType>\n : never;\n};\n\n/**\n * Maps operation argument specs to TypeScript argument types.\n * - typeId args: ColumnBuilder (accepts base columns or operation results)\n * - param args: ParamPlaceholder\n * - literal args: unknown (could be more specific in future)\n */\ntype OperationArgs<Args extends ReadonlyArray<ArgSpec>> = Args extends readonly [\n infer First,\n ...infer Rest,\n]\n ? First extends ArgSpec\n ? [ArgToType<First>, ...(Rest extends ReadonlyArray<ArgSpec> ? OperationArgs<Rest> : [])]\n : []\n : [];\n\ntype ArgToType<Arg extends ArgSpec> = Arg extends { kind: 'typeId' }\n ? AnyColumnBuilder\n : Arg extends { kind: 'param' }\n ? ParamPlaceholder\n : Arg extends { kind: 'literal' }\n ? unknown\n : never;\n\n/**\n * Maps operation return spec to return type.\n * - builtin types: ColumnBuilder with appropriate JsType (matches runtime behavior)\n * - typeId types: ColumnBuilder (for now, could be more specific in future)\n */\ntype OperationReturn<\n Returns extends ReturnSpec,\n ColumnName extends string,\n ColumnMeta extends StorageColumn,\n _JsType,\n> = Returns extends { kind: 'builtin'; type: infer T }\n ? T extends 'number'\n ? ColumnBuilder<ColumnName, ColumnMeta, number>\n : T extends 'boolean'\n ? ColumnBuilder<ColumnName, ColumnMeta, boolean>\n : T extends 'string'\n ? ColumnBuilder<ColumnName, ColumnMeta, string>\n : ColumnBuilder<ColumnName, ColumnMeta, unknown>\n : Returns extends { kind: 'typeId' }\n ? AnyColumnBuilder\n : ColumnBuilder<ColumnName, ColumnMeta, unknown>;\n\n/**\n * Computes JavaScript type for a column at column creation time.\n *\n * Type inference:\n * - Read columnMeta.codecId as typeId string literal\n * - Look up CodecTypes[typeId].output\n * - Apply nullability: nullable ? Output | null : Output\n */\ntype ColumnMetaTypeId<ColumnMeta> = ColumnMeta extends { codecId: infer CodecId extends string }\n ? CodecId\n : ColumnMeta extends { type: infer TypeId extends string }\n ? TypeId\n : never;\n\nexport type ComputeColumnJsType<\n _Contract extends SqlContract<SqlStorage>,\n _TableName extends string,\n _ColumnName extends string,\n ColumnMeta extends StorageColumn,\n CodecTypes extends Record<string, { readonly output: unknown }>,\n> = ColumnMeta extends { nullable: infer Nullable }\n ? ColumnMetaTypeId<ColumnMeta> extends infer TypeId\n ? TypeId extends string\n ? ExtractCodecOutputType<TypeId, CodecTypes> extends infer CodecOutput\n ? [CodecOutput] extends [never]\n ? unknown // Codec not found in CodecTypes\n : Nullable extends true\n ? CodecOutput | null\n : CodecOutput\n : unknown\n : unknown\n : unknown\n : unknown;\n\n/**\n * Infers Row type from a projection object.\n * Maps Record<string, ColumnBuilder> to Record<string, JSType>\n *\n * Extracts the pre-computed JsType from each ColumnBuilder in the projection.\n */\n/**\n * Extracts the inferred JsType carried by a ColumnBuilder.\n */\ntype ExtractJsTypeFromColumnBuilder<CB extends AnyColumnBuilder> = CB extends ColumnBuilder<\n infer _ColumnName extends string,\n infer _ColumnMeta extends StorageColumn,\n infer JsType,\n infer _Ops\n>\n ? JsType\n : never;\n\nexport type InferProjectionRow<P extends Record<string, AnyColumnBuilder>> = {\n [K in keyof P]: ExtractJsTypeFromColumnBuilder<P[K]>;\n};\n\n/**\n * Nested projection type - allows recursive nesting of ColumnBuilder or nested objects.\n */\nexport type NestedProjection = Record<\n string,\n | AnyColumnBuilder\n | Record<\n string,\n | AnyColumnBuilder\n | Record<\n string,\n AnyColumnBuilder | Record<string, AnyColumnBuilder | Record<string, AnyColumnBuilder>>\n >\n >\n>;\n\n/**\n * Helper type to extract include type from Includes map.\n * Returns the value type if K is a key of Includes, otherwise returns unknown.\n */\ntype ExtractIncludeType<\n K extends string,\n Includes extends Record<string, unknown>,\n> = K extends keyof Includes ? Includes[K] : unknown;\n\n/**\n * Infers Row type from a nested projection object.\n * Recursively maps Record<string, ColumnBuilder | boolean | NestedProjection> to nested object types.\n *\n * Extracts the pre-computed JsType from each ColumnBuilder at leaves.\n * When a value is `true`, it represents an include reference and infers `Array<ChildShape>`\n * by looking up the include alias in the Includes type map.\n */\nexport type InferNestedProjectionRow<\n P extends Record<string, AnyColumnBuilder | boolean | NestedProjection>,\n CodecTypes extends Record<string, { readonly output: unknown }> = Record<string, never>,\n Includes extends Record<string, unknown> = Record<string, never>,\n> = {\n [K in keyof P]: P[K] extends AnyColumnBuilder\n ? ExtractJsTypeFromColumnBuilder<P[K]>\n : P[K] extends true\n ? Array<ExtractIncludeType<K & string, Includes>> // Include reference - infers Array<ChildShape> from Includes map\n : P[K] extends NestedProjection\n ? InferNestedProjectionRow<P[K], CodecTypes, Includes>\n : never;\n};\n\n/**\n * Infers Row type from a tuple of ColumnBuilders used in returning() clause.\n * Extracts column name and JsType from each ColumnBuilder and creates a Record.\n */\nexport type InferReturningRow<Columns extends readonly AnyColumnBuilder[]> =\n Columns extends readonly [infer First, ...infer Rest]\n ? First extends ColumnBuilder<\n infer Name,\n infer _Meta,\n infer JsType,\n infer _Ops extends OperationTypes\n >\n ? Name extends string\n ? Rest extends readonly AnyColumnBuilder[]\n ? { [K in Name]: JsType } & InferReturningRow<Rest>\n : { [K in Name]: JsType }\n : never\n : never\n : Record<string, never>;\n\n/**\n * Utility type to check if a contract has the required capabilities for includeMany.\n * Requires both `lateral` and `jsonAgg` to be `true` in the contract's capabilities for the target.\n * Capabilities are nested by target: `{ [target]: { lateral: true, jsonAgg: true } }`\n */\nexport type HasIncludeManyCapabilities<TContract extends SqlContract<SqlStorage>> =\n TContract extends { capabilities: infer C; target: infer T }\n ? T extends string\n ? C extends Record<string, Record<string, boolean>>\n ? C extends { [K in T]: infer TargetCaps }\n ? TargetCaps extends { lateral: true; jsonAgg: true }\n ? true\n : false\n : false\n : false\n : false\n : false;\n\n/**\n * SQL-specific Plan type that refines the ast field to use QueryAst.\n * This is the type used by SQL query builders.\n */\nexport type SqlPlan<Row = unknown> = ExecutionPlan<Row, QueryAst>;\n\n/**\n * Helper types for extracting contract structure.\n */\nexport type TablesOf<TContract> = TContract extends {\n storage: { tables: infer U };\n}\n ? U\n : never;\n\nexport type TableKey<TContract> = Extract<keyof TablesOf<TContract>, string>;\n\n// Common types for contract.d.ts generation (SQL-specific)\n// These types are used by emitted contract.d.ts files to provide type-safe DSL/ORM types\n\n/**\n * Unique symbol for metadata property to avoid collisions with user-defined properties\n */\nexport declare const META: unique symbol;\n\n/**\n * Extracts metadata from a type that has a META property\n */\nexport type Meta<T extends { [META]: unknown }> = T[typeof META];\n\n/**\n * Metadata interface for table definitions\n */\nexport interface TableMetadata<Name extends string> {\n name: Name;\n}\n\n/**\n * Metadata interface for model definitions\n */\nexport interface ModelMetadata<Name extends string> {\n name: Name;\n}\n\n/**\n * Base interface for table definitions with metadata\n * Used in contract.d.ts to define storage-level table types\n */\nexport interface TableDef<Name extends string> {\n readonly [META]: TableMetadata<Name>;\n}\n\n/**\n * Base interface for model definitions with metadata\n * Used in contract.d.ts to define application-level model types\n */\nexport interface ModelDef<Name extends string> {\n readonly [META]: ModelMetadata<Name>;\n}\n\nexport type ColumnsOf<\n TContract,\n K extends TableKey<TContract>,\n> = K extends keyof TablesOf<TContract>\n ? TablesOf<TContract>[K] extends { columns: infer C }\n ? C\n : never\n : never;\n\nexport interface RawTemplateOptions {\n readonly refs?: PlanRefs;\n readonly annotations?: Record<string, unknown>;\n readonly projection?: ReadonlyArray<string>;\n}\n\nexport interface RawFunctionOptions extends RawTemplateOptions {\n readonly params: ReadonlyArray<unknown>;\n}\n\nexport type RawTemplateFactory = (\n strings: TemplateStringsArray,\n ...values: readonly unknown[]\n) => ExecutionPlan;\n\nexport interface RawFactory extends RawTemplateFactory {\n (text: string, options: RawFunctionOptions): ExecutionPlan;\n with(options: RawTemplateOptions): RawTemplateFactory;\n}\n\nexport type { RuntimeError } from '@prisma-next/plan';\n\nexport interface BuildParamsMap {\n readonly [name: string]: unknown;\n}\n\nexport interface BuildOptions {\n readonly params?: BuildParamsMap;\n}\n\nexport interface SqlBuilderOptions<\n TContract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>,\n> {\n readonly context: QueryLaneContext<TContract>;\n}\n\n/**\n * SQL-specific ResultType that works with both Plan and SqlQueryPlan.\n * This extends the core ResultType to also handle SqlQueryPlan.\n * Example: `type Row = ResultType<typeof plan>`\n */\nexport type ResultType<P> = P extends SqlQueryPlan<infer R> ? R : CoreResultType<P>;\n"],"mappings":";AAqCO,SAAS,mBACd,MACA,KACiB;AACjB,SAAO,EAAE,MAAM,SAAS,MAAM,IAAI;AACpC;AA6FO,SAAS,gBAAgB,OAA2C;AACzE,SACE,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACT,MAA4B,SAAS;AAE1C;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ast/codec-types.ts","../src/ast/util.ts","../src/ast/common.ts","../src/ast/delete.ts","../src/ast/insert.ts","../src/ast/join.ts","../src/ast/order.ts","../src/ast/predicate.ts","../src/ast/select.ts","../src/ast/types.ts","../src/ast/update.ts"],"sourcesContent":["import type { O } from 'ts-toolbelt';\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 * Codec interface for encoding/decoding values between wire format and JavaScript types.\n *\n * Codecs are pure, synchronous functions with no side effects or IO.\n * They provide deterministic conversion between database wire types and JS values.\n */\nexport interface Codec<Id extends string = string, TWire = unknown, TJs = unknown> {\n /**\n * Namespaced codec identifier in format 'namespace/name@version'\n * Examples: 'pg/text@1', 'pg/uuid@1', 'pg/timestamptz@1'\n */\n readonly id: Id;\n\n /**\n * Contract scalar type IDs that this codec can handle.\n * Examples: ['text'], ['int4', 'float8'], ['timestamp', 'timestamptz']\n */\n readonly targetTypes: readonly string[];\n\n /**\n * Optional metadata for database-specific type information.\n * Used for schema introspection and verification.\n */\n readonly meta?: CodecMeta;\n\n /**\n * Decode a wire value (from database) to JavaScript type.\n * Must be synchronous and pure (no side effects).\n */\n decode(wire: TWire): TJs;\n\n /**\n * Encode a JavaScript value to wire format (for database).\n * Optional - if not provided, values pass through unchanged.\n * Must be synchronous and pure (no side effects).\n */\n encode?(value: TJs): TWire;\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 [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 /**\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 * Codec factory - creates a codec with typeId and encode/decode functions.\n */\nexport function codec<Id extends string, TWire, TJs>(config: {\n typeId: Id;\n targetTypes: readonly string[];\n encode: (value: TJs) => TWire;\n decode: (wire: TWire) => TJs;\n meta?: CodecMeta;\n}): Codec<Id, TWire, TJs> {\n return {\n id: config.typeId,\n targetTypes: config.targetTypes,\n ...(config.meta ? { meta: config.meta } : {}),\n encode: config.encode,\n decode: config.decode,\n };\n}\n\n/**\n * Type helpers to extract codec types.\n */\nexport type CodecId<T> = T extends Codec<infer Id, unknown, unknown>\n ? Id\n : T extends { readonly id: infer Id }\n ? Id\n : never;\nexport type CodecInput<T> = T extends Codec<string, unknown, infer JsT> ? JsT : never;\nexport type CodecOutput<T> = T extends Codec<string, unknown, infer JsT> ? JsT : 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, unknown, unknown>\n ? Id\n : never]: {\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecOutput<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, unknown, unknown>\n ? Id\n : never;\n readonly scalar: K;\n readonly codec: ScalarNames[K];\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecOutput<ScalarNames[K]>;\n readonly jsType: CodecOutput<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<string, { readonly input: unknown; readonly output: unknown }> = {};\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 CodecOutput<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, unknown, unknown> ? Id : never;\n readonly scalar: K;\n readonly codec: ScalarNames[K];\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecOutput<ScalarNames[K]>;\n readonly jsType: CodecOutput<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 CodecOutput<typeof codec>,\n jsType: undefined as unknown as CodecOutput<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, unknown, unknown>\n ? Id\n : never;\n readonly scalar: K;\n readonly codec: ScalarNames[K];\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecOutput<ScalarNames[K]>;\n readonly jsType: CodecOutput<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","export 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","import type { ColumnRef, LiteralExpr, OperationExpr, ParamRef, TableRef } from './types';\nimport { compact } from './util';\n\nexport function createTableRef(name: string): TableRef {\n return {\n kind: 'table',\n name,\n };\n}\n\nexport function createColumnRef(table: string, column: string): ColumnRef {\n return {\n kind: 'col',\n table,\n column,\n };\n}\n\nexport function createParamRef(index: number, name?: string): ParamRef {\n return compact({\n kind: 'param',\n index,\n name,\n }) as ParamRef;\n}\n\nexport function createOperationExpr(operation: OperationExpr): OperationExpr {\n return operation;\n}\n\nexport function createLiteralExpr(value: unknown): LiteralExpr {\n return {\n kind: 'literal',\n value,\n };\n}\n","import type { BinaryExpr, ColumnRef, DeleteAst, TableRef } from './types';\nimport { compact } from './util';\n\nexport interface CreateDeleteAstOptions {\n readonly table: TableRef;\n readonly where: BinaryExpr;\n readonly returning?: ReadonlyArray<ColumnRef>;\n}\n\nexport function createDeleteAst(options: CreateDeleteAstOptions): DeleteAst {\n return compact({\n kind: 'delete',\n table: options.table,\n where: options.where,\n returning: options.returning,\n }) as DeleteAst;\n}\n","import type { ColumnRef, InsertAst, ParamRef, TableRef } from './types';\nimport { compact } from './util';\n\nexport interface CreateInsertAstOptions {\n readonly table: TableRef;\n readonly values: Record<string, ColumnRef | ParamRef>;\n readonly returning?: ReadonlyArray<ColumnRef>;\n}\n\nexport function createInsertAst(options: CreateInsertAstOptions): InsertAst {\n return compact({\n kind: 'insert',\n table: options.table,\n values: options.values,\n returning: options.returning,\n }) as InsertAst;\n}\n","import { planInvalid } from '@prisma-next/plan';\nimport type { AnyColumnBuilder, JoinOnBuilder, JoinOnPredicate } from '../types';\nimport { isColumnBuilder } from '../types';\nimport type { ColumnRef, JoinAst, JoinOnExpr, TableRef } from './types';\n\nexport function createJoin(\n joinType: 'inner' | 'left' | 'right' | 'full',\n table: TableRef,\n on: JoinOnExpr,\n): JoinAst {\n return {\n kind: 'join',\n joinType,\n table,\n on,\n };\n}\n\nexport function createJoinOnExpr(left: ColumnRef, right: ColumnRef): JoinOnExpr {\n return {\n kind: 'eqCol',\n left,\n right,\n };\n}\n\nclass JoinOnBuilderImpl implements JoinOnBuilder {\n eqCol(left: AnyColumnBuilder, right: AnyColumnBuilder): JoinOnPredicate {\n if (!left || !isColumnBuilder(left)) {\n throw planInvalid('Join ON left operand must be a column');\n }\n\n if (!right || !isColumnBuilder(right)) {\n throw planInvalid('Join ON right operand must be a column');\n }\n\n // TypeScript can't narrow ColumnBuilder properly, so we assert\n const leftCol = left as unknown as { table: string; column: string };\n const rightCol = right as unknown as { table: string; column: string };\n if (leftCol.table === rightCol.table) {\n throw planInvalid('Self-joins are not supported in MVP');\n }\n\n return {\n kind: 'join-on',\n left: left as AnyColumnBuilder,\n right: right as AnyColumnBuilder,\n };\n }\n}\n\nexport function createJoinOnBuilder(): JoinOnBuilder {\n return new JoinOnBuilderImpl();\n}\n","import type { ColumnRef, Direction, OperationExpr } from './types';\n\nexport function createOrderByItem(\n expr: ColumnRef | OperationExpr,\n dir: 'asc' | 'desc',\n): { expr: ColumnRef | OperationExpr; dir: Direction } {\n return {\n expr,\n dir,\n };\n}\n","import type {\n BinaryExpr,\n BinaryOp,\n ColumnRef,\n ExistsExpr,\n OperationExpr,\n ParamRef,\n SelectAst,\n} from './types';\n\nexport function createBinaryExpr(\n op: BinaryOp,\n left: ColumnRef | OperationExpr,\n right: ColumnRef | ParamRef,\n): BinaryExpr {\n return {\n kind: 'bin',\n op,\n left,\n right,\n };\n}\n\nexport function createExistsExpr(not: boolean, subquery: SelectAst): ExistsExpr {\n return {\n kind: 'exists',\n not,\n subquery,\n };\n}\n","import type {\n BinaryExpr,\n ColumnRef,\n Direction,\n ExistsExpr,\n IncludeAst,\n IncludeRef,\n JoinAst,\n OperationExpr,\n SelectAst,\n TableRef,\n} from './types';\nimport { compact } from './util';\n\nexport interface CreateSelectAstOptions {\n readonly from: TableRef;\n readonly joins?: ReadonlyArray<JoinAst>;\n readonly includes?: ReadonlyArray<IncludeAst>;\n readonly project: ReadonlyArray<{\n alias: string;\n expr: ColumnRef | IncludeRef | OperationExpr;\n }>;\n readonly where?: BinaryExpr | ExistsExpr;\n readonly orderBy?: ReadonlyArray<{ expr: ColumnRef | OperationExpr; dir: Direction }>;\n readonly limit?: number;\n}\n\nexport function createSelectAst(options: CreateSelectAstOptions): SelectAst {\n return compact({\n kind: 'select',\n from: options.from,\n joins: options.joins,\n includes: options.includes,\n project: options.project,\n where: options.where,\n orderBy: options.orderBy,\n limit: options.limit,\n }) as SelectAst;\n}\n","import type { ReturnSpec } from '@prisma-next/operations';\nimport type { SqlLoweringSpec } from '@prisma-next/sql-operations';\n\n// SQL-specific AST types and supporting types\n// These types are needed by adapters and runtime for SQL query execution\n\nexport type Direction = 'asc' | 'desc';\n\nexport interface TableRef {\n readonly kind: 'table';\n readonly name: string;\n}\n\nexport interface ColumnRef {\n readonly kind: 'col';\n readonly table: string;\n readonly column: string;\n}\n\nexport interface ParamRef {\n readonly kind: 'param';\n readonly index: number;\n readonly name?: string;\n}\n\nexport interface LiteralExpr {\n readonly kind: 'literal';\n readonly value: unknown;\n}\n\nexport interface OperationExpr {\n readonly kind: 'operation';\n readonly method: string;\n readonly forTypeId: string;\n readonly self: ColumnRef | OperationExpr;\n readonly args: ReadonlyArray<ColumnRef | ParamRef | LiteralExpr | OperationExpr>;\n readonly returns: ReturnSpec;\n readonly lowering: SqlLoweringSpec;\n}\n\nexport function isOperationExpr(expr: ColumnRef | OperationExpr): expr is OperationExpr {\n return expr.kind === 'operation';\n}\n\nexport type BinaryOp = 'eq' | 'neq' | 'gt' | 'lt' | 'gte' | 'lte';\n\nexport interface BinaryExpr {\n readonly kind: 'bin';\n readonly op: BinaryOp;\n readonly left: ColumnRef | OperationExpr;\n readonly right: ColumnRef | ParamRef;\n}\n\nexport interface ExistsExpr {\n readonly kind: 'exists';\n readonly not: boolean;\n readonly subquery: SelectAst;\n}\n\nexport type JoinOnExpr = {\n readonly kind: 'eqCol';\n readonly left: ColumnRef;\n readonly right: ColumnRef;\n};\n\nexport interface JoinAst {\n readonly kind: 'join';\n readonly joinType: 'inner' | 'left' | 'right' | 'full';\n readonly table: TableRef;\n readonly on: JoinOnExpr;\n}\n\nexport interface IncludeRef {\n readonly kind: 'includeRef';\n readonly alias: string;\n}\n\nexport interface IncludeAst {\n readonly kind: 'includeMany';\n readonly alias: string;\n readonly child: {\n readonly table: TableRef;\n readonly on: JoinOnExpr;\n readonly where?: BinaryExpr | ExistsExpr;\n readonly orderBy?: ReadonlyArray<{ expr: ColumnRef | OperationExpr; dir: Direction }>;\n readonly limit?: number;\n readonly project: ReadonlyArray<{ alias: string; expr: ColumnRef | OperationExpr }>;\n };\n}\n\nexport interface SelectAst {\n readonly kind: 'select';\n readonly from: TableRef;\n readonly joins?: ReadonlyArray<JoinAst>;\n readonly includes?: ReadonlyArray<IncludeAst>;\n readonly project: ReadonlyArray<{\n alias: string;\n expr: ColumnRef | IncludeRef | OperationExpr | LiteralExpr;\n }>;\n readonly where?: BinaryExpr | ExistsExpr;\n readonly orderBy?: ReadonlyArray<{ expr: ColumnRef | OperationExpr; dir: Direction }>;\n readonly limit?: number;\n}\n\nexport interface InsertAst {\n readonly kind: 'insert';\n readonly table: TableRef;\n readonly values: Record<string, ColumnRef | ParamRef>;\n readonly returning?: ReadonlyArray<ColumnRef>;\n}\n\nexport interface UpdateAst {\n readonly kind: 'update';\n readonly table: TableRef;\n readonly set: Record<string, ColumnRef | ParamRef>;\n readonly where: BinaryExpr;\n readonly returning?: ReadonlyArray<ColumnRef>;\n}\n\nexport interface DeleteAst {\n readonly kind: 'delete';\n readonly table: TableRef;\n readonly where: BinaryExpr;\n readonly returning?: ReadonlyArray<ColumnRef>;\n}\n\nexport type QueryAst = SelectAst | InsertAst | UpdateAst | DeleteAst;\n\nexport interface LoweredStatement {\n readonly sql: string;\n readonly params: readonly unknown[];\n readonly annotations?: Record<string, unknown>;\n}\n","import type { BinaryExpr, ColumnRef, ParamRef, TableRef, UpdateAst } from './types';\nimport { compact } from './util';\n\nexport interface CreateUpdateAstOptions {\n readonly table: TableRef;\n readonly set: Record<string, ColumnRef | ParamRef>;\n readonly where: BinaryExpr;\n readonly returning?: ReadonlyArray<ColumnRef>;\n}\n\nexport function createUpdateAst(options: CreateUpdateAstOptions): UpdateAst {\n return compact({\n kind: 'update',\n table: options.table,\n set: options.set,\n where: options.where,\n returning: options.returning,\n }) as UpdateAst;\n}\n"],"mappings":";;;;;AA4EA,IAAM,oBAAN,MAAiD;AAAA,EAC9B,QAAQ,oBAAI,IAA2B;AAAA,EACvC,YAAY,oBAAI,IAA6B;AAAA;AAAA;AAAA;AAAA;AAAA,EAM9D,IAAI,IAAuC;AACzC,WAAO,KAAK,MAAM,IAAI,EAAE;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,IAAqB;AACvB,W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