@prisma-next/sql-relational-core 0.3.0-dev.4 → 0.3.0-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ast/adapter-types.d.ts +28 -0
- package/dist/ast/adapter-types.d.ts.map +1 -0
- package/dist/{query-lane-context-BhOMmb_K.d.ts → ast/codec-types.d.ts} +14 -31
- package/dist/ast/codec-types.d.ts.map +1 -0
- package/dist/ast/common.d.ts +7 -0
- package/dist/ast/common.d.ts.map +1 -0
- package/dist/ast/delete.d.ts +8 -0
- package/dist/ast/delete.d.ts.map +1 -0
- package/dist/ast/driver-types.d.ts +20 -0
- package/dist/ast/driver-types.d.ts.map +1 -0
- package/dist/ast/insert.d.ts +8 -0
- package/dist/ast/insert.d.ts.map +1 -0
- package/dist/ast/join.d.ts +6 -0
- package/dist/ast/join.d.ts.map +1 -0
- package/dist/ast/order.d.ts +6 -0
- package/dist/ast/order.d.ts.map +1 -0
- package/dist/ast/predicate.d.ts +4 -0
- package/dist/ast/predicate.d.ts.map +1 -0
- package/dist/ast/select.d.ts +18 -0
- package/dist/ast/select.d.ts.map +1 -0
- package/dist/{plan-D0OG5qzy.d.ts → ast/types.d.ts} +23 -47
- package/dist/ast/types.d.ts.map +1 -0
- package/dist/ast/update.d.ts +9 -0
- package/dist/ast/update.d.ts.map +1 -0
- package/dist/ast/util.d.ts +2 -0
- package/dist/ast/util.d.ts.map +1 -0
- package/dist/errors.d.ts +2 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/exports/ast.d.ts +14 -119
- package/dist/exports/ast.d.ts.map +1 -0
- package/dist/exports/errors.d.ts +2 -1
- package/dist/exports/errors.d.ts.map +1 -0
- package/dist/exports/guards.d.ts +2 -63
- package/dist/exports/guards.d.ts.map +1 -0
- package/dist/exports/operations-registry.d.ts +2 -13
- package/dist/exports/operations-registry.d.ts.map +1 -0
- package/dist/exports/param.d.ts +3 -14
- package/dist/exports/param.d.ts.map +1 -0
- package/dist/exports/plan.d.ts +2 -5
- package/dist/exports/plan.d.ts.map +1 -0
- package/dist/exports/query-lane-context.d.ts +2 -4
- package/dist/exports/query-lane-context.d.ts.map +1 -0
- package/dist/exports/schema.d.ts +3 -69
- package/dist/exports/schema.d.ts.map +1 -0
- package/dist/exports/types.d.ts +2 -335
- package/dist/exports/types.d.ts.map +1 -0
- package/dist/index.d.ts +9 -13
- package/dist/index.d.ts.map +1 -0
- package/dist/operations-registry.d.ts +5 -0
- package/dist/operations-registry.d.ts.map +1 -0
- package/dist/param.d.ts +4 -0
- package/dist/param.d.ts.map +1 -0
- package/dist/plan.d.ts +23 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/query-lane-context.d.ts +16 -0
- package/dist/query-lane-context.d.ts.map +1 -0
- package/dist/schema.d.ts +63 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/types.d.ts +332 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/guards.d.ts +55 -0
- package/dist/utils/guards.d.ts.map +1 -0
- package/package.json +10 -9
- package/src/ast/adapter-types.ts +36 -0
- package/src/ast/codec-types.ts +375 -0
- package/src/ast/common.ts +36 -0
- package/src/ast/delete.ts +17 -0
- package/src/ast/driver-types.ts +25 -0
- package/src/ast/insert.ts +17 -0
- package/src/ast/join.ts +54 -0
- package/src/ast/order.ts +11 -0
- package/src/ast/predicate.ts +30 -0
- package/src/ast/select.ts +39 -0
- package/src/ast/types.ts +133 -0
- package/src/ast/update.ts +19 -0
- package/src/ast/util.ts +9 -0
- package/src/errors.ts +1 -0
- package/src/exports/ast.ts +13 -0
- package/src/exports/errors.ts +1 -0
- package/src/exports/guards.ts +10 -0
- package/src/exports/operations-registry.ts +1 -0
- package/src/exports/param.ts +2 -0
- package/src/exports/plan.ts +1 -0
- package/src/exports/query-lane-context.ts +1 -0
- package/src/exports/schema.ts +6 -0
- package/src/exports/types.ts +1 -0
- package/src/index.ts +8 -0
- package/src/operations-registry.ts +237 -0
- package/src/param.ts +15 -0
- package/src/plan.ts +39 -0
- package/src/query-lane-context.ts +18 -0
- package/src/schema.ts +373 -0
- package/src/types.ts +547 -0
- package/src/utils/guards.ts +123 -0
package/dist/exports/guards.d.ts
CHANGED
|
@@ -1,63 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { AnyColumnBuilder, ParamPlaceholder } from './types.js';
|
|
4
|
-
import '@prisma-next/contract/types';
|
|
5
|
-
import '@prisma-next/operations';
|
|
6
|
-
import '@prisma-next/sql-operations';
|
|
7
|
-
import '../query-lane-context-BhOMmb_K.js';
|
|
8
|
-
import 'ts-toolbelt';
|
|
9
|
-
import '@prisma-next/plan';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Helper to extract columnMeta from a ColumnBuilder.
|
|
13
|
-
* Returns StorageColumn if present, undefined otherwise.
|
|
14
|
-
* AnyColumnBuilder is a union that includes types with columnMeta property,
|
|
15
|
-
* so we can safely access it after checking for existence.
|
|
16
|
-
*/
|
|
17
|
-
declare function getColumnMeta(expr: AnyColumnBuilder): StorageColumn | undefined;
|
|
18
|
-
/**
|
|
19
|
-
* Type predicate to check if a value is a ParamPlaceholder.
|
|
20
|
-
*/
|
|
21
|
-
declare function isParamPlaceholder(value: unknown): value is ParamPlaceholder;
|
|
22
|
-
/**
|
|
23
|
-
* Recursively extracts the base ColumnRef from an OperationExpr.
|
|
24
|
-
* If the expression is already a ColumnRef, it is returned directly.
|
|
25
|
-
*/
|
|
26
|
-
declare function extractBaseColumnRef(expr: ColumnRef | OperationExpr): ColumnRef;
|
|
27
|
-
/**
|
|
28
|
-
* Recursively collects all ColumnRef nodes from an expression tree.
|
|
29
|
-
* Handles nested OperationExpr structures by traversing both self and args.
|
|
30
|
-
*/
|
|
31
|
-
declare function collectColumnRefs(expr: ColumnRef | ParamRef | LiteralExpr | OperationExpr): ColumnRef[];
|
|
32
|
-
/**
|
|
33
|
-
* Type predicate to check if an expression is an OperationExpr.
|
|
34
|
-
*/
|
|
35
|
-
declare function isOperationExpr(expr: AnyColumnBuilder | OperationExpr): expr is OperationExpr;
|
|
36
|
-
/**
|
|
37
|
-
* Helper to extract table and column from a ColumnBuilder or OperationExpr.
|
|
38
|
-
* For OperationExpr, recursively unwraps to find the base ColumnRef.
|
|
39
|
-
*/
|
|
40
|
-
declare function getColumnInfo(expr: AnyColumnBuilder | OperationExpr): {
|
|
41
|
-
table: string;
|
|
42
|
-
column: string;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Type predicate to check if a value is a ColumnBuilder.
|
|
46
|
-
*/
|
|
47
|
-
declare function isColumnBuilder(value: unknown): value is AnyColumnBuilder;
|
|
48
|
-
/**
|
|
49
|
-
* Extracts and returns an OperationExpr from a builder.
|
|
50
|
-
* Returns the OperationExpr if the builder is an OperationExpr or has an _operationExpr property,
|
|
51
|
-
* otherwise returns undefined.
|
|
52
|
-
*
|
|
53
|
-
* @design-note: This function accesses the hidden `_operationExpr` property, which is a code smell.
|
|
54
|
-
* The issue is that `executeOperation()` in relational-core returns a ColumnBuilder-shaped object
|
|
55
|
-
* with a hidden `_operationExpr` property, creating coupling between lanes and relational-core
|
|
56
|
-
* implementation details. A cleaner design would be to have operation results be a separate
|
|
57
|
-
* type (e.g., `OperationResultBuilder`) that properly represents expression nodes rather than
|
|
58
|
-
* pretending to be a ColumnBuilder. This would require refactoring the operation execution
|
|
59
|
-
* system in relational-core to return proper expression types.
|
|
60
|
-
*/
|
|
61
|
-
declare function getOperationExpr(builder: AnyColumnBuilder | OperationExpr): OperationExpr | undefined;
|
|
62
|
-
|
|
63
|
-
export { collectColumnRefs, extractBaseColumnRef, getColumnInfo, getColumnMeta, getOperationExpr, isColumnBuilder, isOperationExpr, isParamPlaceholder };
|
|
1
|
+
export { collectColumnRefs, extractBaseColumnRef, getColumnInfo, getColumnMeta, getOperationExpr, isColumnBuilder, isOperationExpr, isParamPlaceholder, } from '../utils/guards';
|
|
2
|
+
//# sourceMappingURL=guards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/exports/guards.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,kBAAkB,GACnB,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { OperationTypes, ColumnBuilder } from './types.js';
|
|
4
|
-
import '@prisma-next/contract/types';
|
|
5
|
-
import '@prisma-next/sql-operations';
|
|
6
|
-
import '../plan-D0OG5qzy.js';
|
|
7
|
-
import '../query-lane-context-BhOMmb_K.js';
|
|
8
|
-
import 'ts-toolbelt';
|
|
9
|
-
import '@prisma-next/plan';
|
|
10
|
-
|
|
11
|
-
declare function attachOperationsToColumnBuilder<ColumnName extends string, ColumnMeta extends StorageColumn, JsType = unknown, Operations extends OperationTypes = Record<string, never>>(columnBuilder: ColumnBuilder<ColumnName, ColumnMeta, JsType, Record<string, never>>, columnMeta: ColumnMeta, registry: OperationRegistry | undefined, contractCapabilities?: Record<string, Record<string, boolean>>): ColumnBuilder<ColumnName, ColumnMeta, JsType, Operations>;
|
|
12
|
-
|
|
13
|
-
export { attachOperationsToColumnBuilder };
|
|
1
|
+
export { attachOperationsToColumnBuilder } from '../operations-registry';
|
|
2
|
+
//# sourceMappingURL=operations-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations-registry.d.ts","sourceRoot":"","sources":["../../src/exports/operations-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/exports/param.d.ts
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import '@prisma-next/sql-contract/types';
|
|
5
|
-
import '@prisma-next/sql-operations';
|
|
6
|
-
import '../plan-D0OG5qzy.js';
|
|
7
|
-
import '../query-lane-context-BhOMmb_K.js';
|
|
8
|
-
import 'ts-toolbelt';
|
|
9
|
-
import '@prisma-next/plan';
|
|
10
|
-
|
|
11
|
-
type Parameter = ParamPlaceholder;
|
|
12
|
-
declare function param(name: string): Parameter;
|
|
13
|
-
|
|
14
|
-
export { type Parameter, param };
|
|
1
|
+
export type { Parameter } from '../param';
|
|
2
|
+
export { param } from '../param';
|
|
3
|
+
//# sourceMappingURL=param.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"param.d.ts","sourceRoot":"","sources":["../../src/exports/param.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/exports/plan.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
import '@prisma-next/sql-contract/types';
|
|
4
|
-
import '@prisma-next/operations';
|
|
5
|
-
import '@prisma-next/sql-operations';
|
|
1
|
+
export * from '../plan';
|
|
2
|
+
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/exports/plan.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
import '@prisma-next/sql-contract/types';
|
|
4
|
-
import 'ts-toolbelt';
|
|
1
|
+
export * from '../query-lane-context';
|
|
2
|
+
//# sourceMappingURL=query-lane-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-lane-context.d.ts","sourceRoot":"","sources":["../../src/exports/query-lane-context.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
package/dist/exports/schema.d.ts
CHANGED
|
@@ -1,69 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { ParamPlaceholder, AnyColumnBuilderBase, BinaryBuilder, OrderBuilder, CodecTypes, OperationTypes, ColumnBuilder, ComputeColumnJsType, OperationTypeSignature } from './types.js';
|
|
5
|
-
import '@prisma-next/contract/types';
|
|
6
|
-
import '@prisma-next/operations';
|
|
7
|
-
import '@prisma-next/sql-operations';
|
|
8
|
-
import 'ts-toolbelt';
|
|
9
|
-
import '@prisma-next/plan';
|
|
10
|
-
|
|
11
|
-
type TableColumns<Table extends {
|
|
12
|
-
columns: Record<string, StorageColumn>;
|
|
13
|
-
}> = Table['columns'];
|
|
14
|
-
type ColumnBuilders<Contract extends SqlContract<SqlStorage>, TableName extends string, Columns extends Record<string, StorageColumn>, CodecTypes extends CodecTypes, Operations extends OperationTypes> = {
|
|
15
|
-
readonly [K in keyof Columns]: ColumnBuilder<K & string, Columns[K], ComputeColumnJsType<Contract, TableName, K & string, Columns[K], CodecTypes>, Operations>;
|
|
16
|
-
};
|
|
17
|
-
declare class ColumnBuilderImpl<ColumnName extends string, ColumnMeta extends StorageColumn, JsType = unknown> {
|
|
18
|
-
readonly table: string;
|
|
19
|
-
readonly column: ColumnName;
|
|
20
|
-
private readonly storageColumn;
|
|
21
|
-
readonly kind: "column";
|
|
22
|
-
constructor(table: string, column: ColumnName, storageColumn: ColumnMeta);
|
|
23
|
-
get columnMeta(): ColumnMeta;
|
|
24
|
-
get __jsType(): JsType;
|
|
25
|
-
private createBinaryBuilder;
|
|
26
|
-
eq(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
|
|
27
|
-
neq(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
|
|
28
|
-
gt(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
|
|
29
|
-
lt(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
|
|
30
|
-
gte(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
|
|
31
|
-
lte(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
|
|
32
|
-
asc(): OrderBuilder<ColumnName, ColumnMeta, JsType>;
|
|
33
|
-
desc(): OrderBuilder<ColumnName, ColumnMeta, JsType>;
|
|
34
|
-
}
|
|
35
|
-
declare class TableBuilderImpl<Contract extends SqlContract<SqlStorage>, TableName extends string, Columns extends Record<string, StorageColumn>, CodecTypes extends CodecTypes, Operations extends OperationTypes> implements TableRef {
|
|
36
|
-
readonly kind: "table";
|
|
37
|
-
readonly columns: ColumnBuilders<Contract, TableName, Columns, CodecTypes, Operations>;
|
|
38
|
-
private readonly _name;
|
|
39
|
-
constructor(name: TableName, columns: ColumnBuilders<Contract, TableName, Columns, CodecTypes, Operations>);
|
|
40
|
-
get name(): string;
|
|
41
|
-
}
|
|
42
|
-
type ExtractSchemaTables<Contract extends SqlContract<SqlStorage>, CodecTypes extends CodecTypes, Operations extends OperationTypes> = {
|
|
43
|
-
readonly [TableName in keyof Contract['storage']['tables']]: TableBuilderImpl<Contract, TableName & string, TableColumns<Contract['storage']['tables'][TableName]>, CodecTypes, Operations> & TableRef;
|
|
44
|
-
};
|
|
45
|
-
type SchemaHandle<Contract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>, CodecTypes extends CodecTypes = CodecTypes, Operations extends OperationTypes = Record<string, never>> = {
|
|
46
|
-
readonly tables: ExtractSchemaTables<Contract, CodecTypes, Operations>;
|
|
47
|
-
};
|
|
48
|
-
type SchemaReturnType<Contract extends SqlContract<SqlStorage>> = SchemaHandle<Contract, ExtractCodecTypes<Contract>, ToOperationTypes<ExtractOperationTypes<Contract>>>;
|
|
49
|
-
type NormalizeOperationTypes<T> = {
|
|
50
|
-
[TypeId in keyof T]: {
|
|
51
|
-
[Method in keyof T[TypeId]]: T[TypeId][Method] extends OperationTypeSignature ? T[TypeId][Method] : OperationTypeSignature;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
type ToOperationTypes<T> = T extends OperationTypes ? T : NormalizeOperationTypes<T>;
|
|
55
|
-
/**
|
|
56
|
-
* Creates a schema handle for building SQL queries.
|
|
57
|
-
*
|
|
58
|
-
* @param context - Query lane context containing contract, codec and operation registries
|
|
59
|
-
* @returns A schema handle with typed table builders
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```typescript
|
|
63
|
-
* const schemaHandle = schema<Contract>(context);
|
|
64
|
-
* const userTable = schemaHandle.tables.user;
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
declare function schema<Contract extends SqlContract<SqlStorage>>(context: QueryLaneContext<Contract>): SchemaReturnType<Contract>;
|
|
68
|
-
|
|
69
|
-
export { ColumnBuilderImpl as Column, ColumnBuilderImpl, type SchemaHandle, TableBuilderImpl as Table, TableBuilderImpl, schema };
|
|
1
|
+
export type { ColumnBuilderImpl as Column, SchemaHandle, TableBuilderImpl as Table, } from '../schema';
|
|
2
|
+
export { ColumnBuilderImpl, schema, TableBuilderImpl } from '../schema';
|
|
3
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/exports/schema.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,iBAAiB,IAAI,MAAM,EAC3B,YAAY,EACZ,gBAAgB,IAAI,KAAK,GAC1B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/exports/types.d.ts
CHANGED
|
@@ -1,335 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { StorageColumn, SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';
|
|
4
|
-
import { SqlLoweringSpec } from '@prisma-next/sql-operations';
|
|
5
|
-
import { B as BinaryOp, O as OperationExpr, D as Direction, C as ColumnRef, P as ParamRef, Q as QueryAst, g as SqlQueryPlan } from '../plan-D0OG5qzy.js';
|
|
6
|
-
import { Q as QueryLaneContext } from '../query-lane-context-BhOMmb_K.js';
|
|
7
|
-
export { RuntimeError } from '@prisma-next/plan';
|
|
8
|
-
import 'ts-toolbelt';
|
|
9
|
-
|
|
10
|
-
interface ParamPlaceholder {
|
|
11
|
-
readonly kind: 'param-placeholder';
|
|
12
|
-
readonly name: string;
|
|
13
|
-
}
|
|
14
|
-
interface OrderBuilder<ColumnName extends string = string, ColumnMeta extends StorageColumn = StorageColumn, JsType = unknown> {
|
|
15
|
-
readonly kind: 'order';
|
|
16
|
-
readonly expr: ColumnBuilder<ColumnName, ColumnMeta, JsType> | OperationExpr;
|
|
17
|
-
readonly dir: Direction;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Creates an OrderBuilder for use in orderBy clauses.
|
|
21
|
-
*/
|
|
22
|
-
declare function createOrderBuilder(expr: AnyColumnBuilder | OperationExpr, dir: Direction): AnyOrderBuilder;
|
|
23
|
-
/**
|
|
24
|
-
* ColumnBuilder with optional operation methods based on the column's typeId.
|
|
25
|
-
* When Operations is provided and the column's typeId matches, operation methods are included.
|
|
26
|
-
*/
|
|
27
|
-
type ColumnBuilder<ColumnName extends string = string, ColumnMeta extends StorageColumn = StorageColumn, JsType = unknown, Operations extends OperationTypes = Record<string, never>> = {
|
|
28
|
-
readonly kind: 'column';
|
|
29
|
-
readonly table: string;
|
|
30
|
-
readonly column: ColumnName;
|
|
31
|
-
readonly columnMeta: ColumnMeta;
|
|
32
|
-
eq(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
|
|
33
|
-
neq(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
|
|
34
|
-
gt(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
|
|
35
|
-
lt(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
|
|
36
|
-
gte(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
|
|
37
|
-
lte(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
|
|
38
|
-
asc(): OrderBuilder<ColumnName, ColumnMeta, JsType>;
|
|
39
|
-
desc(): OrderBuilder<ColumnName, ColumnMeta, JsType>;
|
|
40
|
-
readonly __jsType: JsType;
|
|
41
|
-
} & (ColumnMeta['codecId'] extends string ? ColumnMeta['codecId'] extends keyof Operations ? OperationMethods<OperationsForTypeId<ColumnMeta['codecId'] & string, Operations>, ColumnName, StorageColumn, JsType> : Record<string, never> : Record<string, never>);
|
|
42
|
-
interface BinaryBuilder<ColumnName extends string = string, ColumnMeta extends StorageColumn = StorageColumn, JsType = unknown> {
|
|
43
|
-
readonly kind: 'binary';
|
|
44
|
-
readonly op: BinaryOp;
|
|
45
|
-
readonly left: ColumnBuilder<ColumnName, ColumnMeta, JsType> | OperationExpr;
|
|
46
|
-
readonly right: ParamPlaceholder | AnyColumnBuilderBase;
|
|
47
|
-
}
|
|
48
|
-
type AnyColumnBuilderBase = {
|
|
49
|
-
readonly kind: 'column';
|
|
50
|
-
readonly table: string;
|
|
51
|
-
readonly column: string;
|
|
52
|
-
readonly columnMeta: StorageColumn;
|
|
53
|
-
eq(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;
|
|
54
|
-
neq(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;
|
|
55
|
-
gt(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;
|
|
56
|
-
lt(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;
|
|
57
|
-
gte(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;
|
|
58
|
-
lte(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;
|
|
59
|
-
asc(): AnyOrderBuilder;
|
|
60
|
-
desc(): AnyOrderBuilder;
|
|
61
|
-
readonly __jsType: unknown;
|
|
62
|
-
readonly [key: string]: unknown;
|
|
63
|
-
};
|
|
64
|
-
type AnyColumnBuilder = ColumnBuilder<string, StorageColumn, unknown, any> | AnyColumnBuilderBase;
|
|
65
|
-
type AnyBinaryBuilder = BinaryBuilder<string, StorageColumn, unknown>;
|
|
66
|
-
type AnyOrderBuilder = OrderBuilder<string, StorageColumn, unknown>;
|
|
67
|
-
declare function isColumnBuilder(value: unknown): value is AnyColumnBuilder;
|
|
68
|
-
interface JoinOnBuilder {
|
|
69
|
-
eqCol(left: AnyColumnBuilder, right: AnyColumnBuilder): JoinOnPredicate;
|
|
70
|
-
}
|
|
71
|
-
interface JoinOnPredicate {
|
|
72
|
-
readonly kind: 'join-on';
|
|
73
|
-
readonly left: AnyColumnBuilder;
|
|
74
|
-
readonly right: AnyColumnBuilder;
|
|
75
|
-
}
|
|
76
|
-
type Expr = ColumnRef | ParamRef;
|
|
77
|
-
/**
|
|
78
|
-
* Helper type to extract codec output type from CodecTypes.
|
|
79
|
-
* Returns never if the codecId is not found in CodecTypes.
|
|
80
|
-
*/
|
|
81
|
-
type ExtractCodecOutputType<CodecId extends string, CodecTypes extends Record<string, {
|
|
82
|
-
readonly output: unknown;
|
|
83
|
-
}>> = CodecId extends keyof CodecTypes ? CodecTypes[CodecId] extends {
|
|
84
|
-
readonly output: infer Output;
|
|
85
|
-
} ? Output : never : never;
|
|
86
|
-
/**
|
|
87
|
-
* Type-level operation signature.
|
|
88
|
-
* Represents an operation at the type level, similar to OperationSignature at runtime.
|
|
89
|
-
*/
|
|
90
|
-
type OperationTypeSignature = {
|
|
91
|
-
readonly args: ReadonlyArray<ArgSpec>;
|
|
92
|
-
readonly returns: ReturnSpec;
|
|
93
|
-
readonly lowering: SqlLoweringSpec;
|
|
94
|
-
readonly capabilities?: ReadonlyArray<string>;
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* Type-level operation registry.
|
|
98
|
-
* Maps typeId → operations, where operations is a record of method name → operation signature.
|
|
99
|
-
*
|
|
100
|
-
* Example:
|
|
101
|
-
* ```typescript
|
|
102
|
-
* type MyOperations: OperationTypes = {
|
|
103
|
-
* 'pg/vector@1': {
|
|
104
|
-
* cosineDistance: {
|
|
105
|
-
* args: [{ kind: 'typeId'; type: 'pg/vector@1' }];
|
|
106
|
-
* returns: { kind: 'builtin'; type: 'number' };
|
|
107
|
-
* lowering: { targetFamily: 'sql'; strategy: 'function'; template: '...' };
|
|
108
|
-
* };
|
|
109
|
-
* };
|
|
110
|
-
* };
|
|
111
|
-
* ```
|
|
112
|
-
*/
|
|
113
|
-
type OperationTypes = Record<string, Record<string, OperationTypeSignature>>;
|
|
114
|
-
/**
|
|
115
|
-
* CodecTypes represents a map of typeId to codec definitions.
|
|
116
|
-
* Each codec definition must have an `output` property indicating the JavaScript type.
|
|
117
|
-
*
|
|
118
|
-
* Example:
|
|
119
|
-
* ```typescript
|
|
120
|
-
* type MyCodecTypes: CodecTypes = {
|
|
121
|
-
* 'pg/int4@1': { output: number };
|
|
122
|
-
* 'pg/text@1': { output: string };
|
|
123
|
-
* };
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
type CodecTypes = Record<string, {
|
|
127
|
-
readonly output: unknown;
|
|
128
|
-
}>;
|
|
129
|
-
/**
|
|
130
|
-
* Extracts operations for a given typeId from the operation registry.
|
|
131
|
-
* Returns an empty record if the typeId is not found.
|
|
132
|
-
*
|
|
133
|
-
* @example
|
|
134
|
-
* ```typescript
|
|
135
|
-
* type Ops = OperationsForTypeId<'pg/vector@1', MyOperations>;
|
|
136
|
-
* // Ops = { cosineDistance: { ... }, l2Distance: { ... } }
|
|
137
|
-
* ```
|
|
138
|
-
*/
|
|
139
|
-
type OperationsForTypeId<TypeId extends string, Operations extends OperationTypes> = Operations extends Record<string, never> ? Record<string, never> : TypeId extends keyof Operations ? Operations[TypeId] : Record<string, never>;
|
|
140
|
-
/**
|
|
141
|
-
* Maps operation signatures to method signatures on ColumnBuilder.
|
|
142
|
-
* Each operation becomes a method that returns a ColumnBuilder or BinaryBuilder
|
|
143
|
-
* based on the return type.
|
|
144
|
-
*/
|
|
145
|
-
type OperationMethods<Ops extends Record<string, OperationTypeSignature>, ColumnName extends string, ColumnMeta extends StorageColumn, JsType> = {
|
|
146
|
-
[K in keyof Ops]: Ops[K] extends OperationTypeSignature ? (...args: OperationArgs<Ops[K]['args']>) => OperationReturn<Ops[K]['returns'], ColumnName, ColumnMeta, JsType> : never;
|
|
147
|
-
};
|
|
148
|
-
/**
|
|
149
|
-
* Maps operation argument specs to TypeScript argument types.
|
|
150
|
-
* - typeId args: ColumnBuilder (accepts base columns or operation results)
|
|
151
|
-
* - param args: ParamPlaceholder
|
|
152
|
-
* - literal args: unknown (could be more specific in future)
|
|
153
|
-
*/
|
|
154
|
-
type OperationArgs<Args extends ReadonlyArray<ArgSpec>> = Args extends readonly [
|
|
155
|
-
infer First,
|
|
156
|
-
...infer Rest
|
|
157
|
-
] ? First extends ArgSpec ? [ArgToType<First>, ...(Rest extends ReadonlyArray<ArgSpec> ? OperationArgs<Rest> : [])] : [] : [];
|
|
158
|
-
type ArgToType<Arg extends ArgSpec> = Arg extends {
|
|
159
|
-
kind: 'typeId';
|
|
160
|
-
} ? AnyColumnBuilder : Arg extends {
|
|
161
|
-
kind: 'param';
|
|
162
|
-
} ? ParamPlaceholder : Arg extends {
|
|
163
|
-
kind: 'literal';
|
|
164
|
-
} ? unknown : never;
|
|
165
|
-
/**
|
|
166
|
-
* Maps operation return spec to return type.
|
|
167
|
-
* - builtin types: ColumnBuilder with appropriate JsType (matches runtime behavior)
|
|
168
|
-
* - typeId types: ColumnBuilder (for now, could be more specific in future)
|
|
169
|
-
*/
|
|
170
|
-
type OperationReturn<Returns extends ReturnSpec, ColumnName extends string, ColumnMeta extends StorageColumn, _JsType> = Returns extends {
|
|
171
|
-
kind: 'builtin';
|
|
172
|
-
type: infer T;
|
|
173
|
-
} ? T extends 'number' ? ColumnBuilder<ColumnName, ColumnMeta, number> : T extends 'boolean' ? ColumnBuilder<ColumnName, ColumnMeta, boolean> : T extends 'string' ? ColumnBuilder<ColumnName, ColumnMeta, string> : ColumnBuilder<ColumnName, ColumnMeta, unknown> : Returns extends {
|
|
174
|
-
kind: 'typeId';
|
|
175
|
-
} ? AnyColumnBuilder : ColumnBuilder<ColumnName, ColumnMeta, unknown>;
|
|
176
|
-
/**
|
|
177
|
-
* Computes JavaScript type for a column at column creation time.
|
|
178
|
-
*
|
|
179
|
-
* Type inference:
|
|
180
|
-
* - Read columnMeta.codecId as typeId string literal
|
|
181
|
-
* - Look up CodecTypes[typeId].output
|
|
182
|
-
* - Apply nullability: nullable ? Output | null : Output
|
|
183
|
-
*/
|
|
184
|
-
type ColumnMetaTypeId<ColumnMeta> = ColumnMeta extends {
|
|
185
|
-
codecId: infer CodecId extends string;
|
|
186
|
-
} ? CodecId : ColumnMeta extends {
|
|
187
|
-
type: infer TypeId extends string;
|
|
188
|
-
} ? TypeId : never;
|
|
189
|
-
type ComputeColumnJsType<_Contract extends SqlContract<SqlStorage>, _TableName extends string, _ColumnName extends string, ColumnMeta extends StorageColumn, CodecTypes extends Record<string, {
|
|
190
|
-
readonly output: unknown;
|
|
191
|
-
}>> = ColumnMeta extends {
|
|
192
|
-
nullable: infer Nullable;
|
|
193
|
-
} ? 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;
|
|
194
|
-
/**
|
|
195
|
-
* Infers Row type from a projection object.
|
|
196
|
-
* Maps Record<string, ColumnBuilder> to Record<string, JSType>
|
|
197
|
-
*
|
|
198
|
-
* Extracts the pre-computed JsType from each ColumnBuilder in the projection.
|
|
199
|
-
*/
|
|
200
|
-
/**
|
|
201
|
-
* Extracts the inferred JsType carried by a ColumnBuilder.
|
|
202
|
-
*/
|
|
203
|
-
type ExtractJsTypeFromColumnBuilder<CB extends AnyColumnBuilder> = CB extends ColumnBuilder<infer _ColumnName extends string, infer _ColumnMeta extends StorageColumn, infer JsType, infer _Ops> ? JsType : never;
|
|
204
|
-
type InferProjectionRow<P extends Record<string, AnyColumnBuilder>> = {
|
|
205
|
-
[K in keyof P]: ExtractJsTypeFromColumnBuilder<P[K]>;
|
|
206
|
-
};
|
|
207
|
-
/**
|
|
208
|
-
* Nested projection type - allows recursive nesting of ColumnBuilder or nested objects.
|
|
209
|
-
*/
|
|
210
|
-
type NestedProjection = Record<string, AnyColumnBuilder | Record<string, AnyColumnBuilder | Record<string, AnyColumnBuilder | Record<string, AnyColumnBuilder | Record<string, AnyColumnBuilder>>>>>;
|
|
211
|
-
/**
|
|
212
|
-
* Helper type to extract include type from Includes map.
|
|
213
|
-
* Returns the value type if K is a key of Includes, otherwise returns unknown.
|
|
214
|
-
*/
|
|
215
|
-
type ExtractIncludeType<K extends string, Includes extends Record<string, unknown>> = K extends keyof Includes ? Includes[K] : unknown;
|
|
216
|
-
/**
|
|
217
|
-
* Infers Row type from a nested projection object.
|
|
218
|
-
* Recursively maps Record<string, ColumnBuilder | boolean | NestedProjection> to nested object types.
|
|
219
|
-
*
|
|
220
|
-
* Extracts the pre-computed JsType from each ColumnBuilder at leaves.
|
|
221
|
-
* When a value is `true`, it represents an include reference and infers `Array<ChildShape>`
|
|
222
|
-
* by looking up the include alias in the Includes type map.
|
|
223
|
-
*/
|
|
224
|
-
type InferNestedProjectionRow<P extends Record<string, AnyColumnBuilder | boolean | NestedProjection>, CodecTypes extends Record<string, {
|
|
225
|
-
readonly output: unknown;
|
|
226
|
-
}> = Record<string, never>, Includes extends Record<string, unknown> = Record<string, never>> = {
|
|
227
|
-
[K in keyof P]: P[K] extends AnyColumnBuilder ? ExtractJsTypeFromColumnBuilder<P[K]> : P[K] extends true ? Array<ExtractIncludeType<K & string, Includes>> : P[K] extends NestedProjection ? InferNestedProjectionRow<P[K], CodecTypes, Includes> : never;
|
|
228
|
-
};
|
|
229
|
-
/**
|
|
230
|
-
* Infers Row type from a tuple of ColumnBuilders used in returning() clause.
|
|
231
|
-
* Extracts column name and JsType from each ColumnBuilder and creates a Record.
|
|
232
|
-
*/
|
|
233
|
-
type InferReturningRow<Columns extends readonly AnyColumnBuilder[]> = Columns extends readonly [infer First, ...infer Rest] ? First extends ColumnBuilder<infer Name, infer _Meta, infer JsType, infer _Ops extends OperationTypes> ? Name extends string ? Rest extends readonly AnyColumnBuilder[] ? {
|
|
234
|
-
[K in Name]: JsType;
|
|
235
|
-
} & InferReturningRow<Rest> : {
|
|
236
|
-
[K in Name]: JsType;
|
|
237
|
-
} : never : never : Record<string, never>;
|
|
238
|
-
/**
|
|
239
|
-
* Utility type to check if a contract has the required capabilities for includeMany.
|
|
240
|
-
* Requires both `lateral` and `jsonAgg` to be `true` in the contract's capabilities for the target.
|
|
241
|
-
* Capabilities are nested by target: `{ [target]: { lateral: true, jsonAgg: true } }`
|
|
242
|
-
*/
|
|
243
|
-
type HasIncludeManyCapabilities<TContract extends SqlContract<SqlStorage>> = TContract extends {
|
|
244
|
-
capabilities: infer C;
|
|
245
|
-
target: infer T;
|
|
246
|
-
} ? T extends string ? C extends Record<string, Record<string, boolean>> ? C extends {
|
|
247
|
-
[K in T]: infer TargetCaps;
|
|
248
|
-
} ? TargetCaps extends {
|
|
249
|
-
lateral: true;
|
|
250
|
-
jsonAgg: true;
|
|
251
|
-
} ? true : false : false : false : false : false;
|
|
252
|
-
/**
|
|
253
|
-
* SQL-specific Plan type that refines the ast field to use QueryAst.
|
|
254
|
-
* This is the type used by SQL query builders.
|
|
255
|
-
*/
|
|
256
|
-
type SqlPlan<Row = unknown> = ExecutionPlan<Row, QueryAst>;
|
|
257
|
-
/**
|
|
258
|
-
* Helper types for extracting contract structure.
|
|
259
|
-
*/
|
|
260
|
-
type TablesOf<TContract> = TContract extends {
|
|
261
|
-
storage: {
|
|
262
|
-
tables: infer U;
|
|
263
|
-
};
|
|
264
|
-
} ? U : never;
|
|
265
|
-
type TableKey<TContract> = Extract<keyof TablesOf<TContract>, string>;
|
|
266
|
-
/**
|
|
267
|
-
* Unique symbol for metadata property to avoid collisions with user-defined properties
|
|
268
|
-
*/
|
|
269
|
-
declare const META: unique symbol;
|
|
270
|
-
/**
|
|
271
|
-
* Extracts metadata from a type that has a META property
|
|
272
|
-
*/
|
|
273
|
-
type Meta<T extends {
|
|
274
|
-
[META]: unknown;
|
|
275
|
-
}> = T[typeof META];
|
|
276
|
-
/**
|
|
277
|
-
* Metadata interface for table definitions
|
|
278
|
-
*/
|
|
279
|
-
interface TableMetadata<Name extends string> {
|
|
280
|
-
name: Name;
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Metadata interface for model definitions
|
|
284
|
-
*/
|
|
285
|
-
interface ModelMetadata<Name extends string> {
|
|
286
|
-
name: Name;
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Base interface for table definitions with metadata
|
|
290
|
-
* Used in contract.d.ts to define storage-level table types
|
|
291
|
-
*/
|
|
292
|
-
interface TableDef<Name extends string> {
|
|
293
|
-
readonly [META]: TableMetadata<Name>;
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Base interface for model definitions with metadata
|
|
297
|
-
* Used in contract.d.ts to define application-level model types
|
|
298
|
-
*/
|
|
299
|
-
interface ModelDef<Name extends string> {
|
|
300
|
-
readonly [META]: ModelMetadata<Name>;
|
|
301
|
-
}
|
|
302
|
-
type ColumnsOf<TContract, K extends TableKey<TContract>> = K extends keyof TablesOf<TContract> ? TablesOf<TContract>[K] extends {
|
|
303
|
-
columns: infer C;
|
|
304
|
-
} ? C : never : never;
|
|
305
|
-
interface RawTemplateOptions {
|
|
306
|
-
readonly refs?: PlanRefs;
|
|
307
|
-
readonly annotations?: Record<string, unknown>;
|
|
308
|
-
readonly projection?: ReadonlyArray<string>;
|
|
309
|
-
}
|
|
310
|
-
interface RawFunctionOptions extends RawTemplateOptions {
|
|
311
|
-
readonly params: ReadonlyArray<unknown>;
|
|
312
|
-
}
|
|
313
|
-
type RawTemplateFactory = (strings: TemplateStringsArray, ...values: readonly unknown[]) => ExecutionPlan;
|
|
314
|
-
interface RawFactory extends RawTemplateFactory {
|
|
315
|
-
(text: string, options: RawFunctionOptions): ExecutionPlan;
|
|
316
|
-
with(options: RawTemplateOptions): RawTemplateFactory;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
interface BuildParamsMap {
|
|
320
|
-
readonly [name: string]: unknown;
|
|
321
|
-
}
|
|
322
|
-
interface BuildOptions {
|
|
323
|
-
readonly params?: BuildParamsMap;
|
|
324
|
-
}
|
|
325
|
-
interface SqlBuilderOptions<TContract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>> {
|
|
326
|
-
readonly context: QueryLaneContext<TContract>;
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* SQL-specific ResultType that works with both Plan and SqlQueryPlan.
|
|
330
|
-
* This extends the core ResultType to also handle SqlQueryPlan.
|
|
331
|
-
* Example: `type Row = ResultType<typeof plan>`
|
|
332
|
-
*/
|
|
333
|
-
type ResultType<P> = P extends SqlQueryPlan<infer R> ? R : ResultType$1<P>;
|
|
334
|
-
|
|
335
|
-
export { type AnyBinaryBuilder, type AnyColumnBuilder, type AnyColumnBuilderBase, type AnyOrderBuilder, type BinaryBuilder, type BuildOptions, type BuildParamsMap, type CodecTypes, type ColumnBuilder, type ColumnsOf, type ComputeColumnJsType, type Expr, type HasIncludeManyCapabilities, type InferNestedProjectionRow, type InferProjectionRow, type InferReturningRow, type JoinOnBuilder, type JoinOnPredicate, META, type Meta, type ModelDef, type ModelMetadata, type NestedProjection, type OperationTypeSignature, type OperationTypes, type OperationsForTypeId, type OrderBuilder, type ParamPlaceholder, type RawFactory, type RawFunctionOptions, type RawTemplateFactory, type RawTemplateOptions, type ResultType, type SqlBuilderOptions, type SqlPlan, type TableDef, type TableKey, type TableMetadata, type TablesOf, createOrderBuilder, isColumnBuilder };
|
|
1
|
+
export * from '../types';
|
|
2
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/exports/types.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
import '@prisma-next/sql-contract/types';
|
|
11
|
-
import 'ts-toolbelt';
|
|
12
|
-
import '@prisma-next/contract/types';
|
|
13
|
-
import '@prisma-next/sql-operations';
|
|
1
|
+
export * from './exports/ast';
|
|
2
|
+
export * from './exports/errors';
|
|
3
|
+
export * from './exports/operations-registry';
|
|
4
|
+
export * from './exports/param';
|
|
5
|
+
export * from './exports/plan';
|
|
6
|
+
export * from './exports/query-lane-context';
|
|
7
|
+
export * from './exports/schema';
|
|
8
|
+
export * from './exports/types';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { OperationRegistry } from '@prisma-next/operations';
|
|
2
|
+
import type { StorageColumn } from '@prisma-next/sql-contract/types';
|
|
3
|
+
import type { ColumnBuilder, OperationTypes } from './types';
|
|
4
|
+
export declare function attachOperationsToColumnBuilder<ColumnName extends string, ColumnMeta extends StorageColumn, JsType = unknown, Operations extends OperationTypes = Record<string, never>>(columnBuilder: ColumnBuilder<ColumnName, ColumnMeta, JsType, Record<string, never>>, columnMeta: ColumnMeta, registry: OperationRegistry | undefined, contractCapabilities?: Record<string, Record<string, boolean>>): ColumnBuilder<ColumnName, ColumnMeta, JsType, Operations>;
|
|
5
|
+
//# sourceMappingURL=operations-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations-registry.d.ts","sourceRoot":"","sources":["../src/operations-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAGrE,OAAO,KAAK,EAAoB,aAAa,EAAE,cAAc,EAAoB,MAAM,SAAS,CAAC;AA0KjG,wBAAgB,+BAA+B,CAC7C,UAAU,SAAS,MAAM,EACzB,UAAU,SAAS,aAAa,EAChC,MAAM,GAAG,OAAO,EAChB,UAAU,SAAS,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAEzD,aAAa,EAAE,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,EACnF,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,iBAAiB,GAAG,SAAS,EACvC,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAC7D,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,CAkD3D"}
|
package/dist/param.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"param.d.ts","sourceRoot":"","sources":["../src/param.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,MAAM,MAAM,SAAS,GAAG,gBAAgB,CAAC;AAEzC,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAS7C"}
|
package/dist/plan.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ExecutionPlan, ParamDescriptor } from '@prisma-next/contract/types';
|
|
2
|
+
import type { StorageColumn } from '@prisma-next/sql-contract/types';
|
|
3
|
+
import type { QueryAst } from './ast/types';
|
|
4
|
+
/**
|
|
5
|
+
* SQL query plan produced by lanes before lowering.
|
|
6
|
+
*
|
|
7
|
+
* Lanes build ASTs and metadata but do not perform SQL lowering.
|
|
8
|
+
* The `sql` field is absent - lowering happens in the runtime executor.
|
|
9
|
+
*
|
|
10
|
+
* Structurally aligns with ExecutionPlan<Row, QueryAst> (without sql field) to maintain
|
|
11
|
+
* compatibility with ExecutionPlan/Plan-based utilities.
|
|
12
|
+
* The generic parameter `_Row` is preserved for type extraction via ResultType.
|
|
13
|
+
*/
|
|
14
|
+
export interface SqlQueryPlan<_Row = unknown> extends Pick<ExecutionPlan<_Row, QueryAst>, 'params' | 'meta'> {
|
|
15
|
+
readonly ast: QueryAst;
|
|
16
|
+
readonly _Row?: _Row;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Augments the last ParamDescriptor in the array with codecId and nativeType from columnMeta.
|
|
20
|
+
* This is used when building WHERE expressions to ensure param descriptors have type information.
|
|
21
|
+
*/
|
|
22
|
+
export declare function augmentDescriptorWithColumnMeta(descriptors: ParamDescriptor[], columnMeta: StorageColumn | undefined): void;
|
|
23
|
+
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../src/plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;;GASG;AACH,MAAM,WAAW,YAAY,CAAC,IAAI,GAAG,OAAO,CAC1C,SAAQ,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC9D,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC;IAGvB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,eAAe,EAAE,EAC9B,UAAU,EAAE,aAAa,GAAG,SAAS,GACpC,IAAI,CASN"}
|