@prisma-next/sql-relational-core 0.3.0-dev.34 → 0.3.0-dev.37
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 +4 -1
- package/dist/errors-7_V3El9I.mjs +3 -0
- package/dist/errors-DVufq9PT.d.mts +2 -0
- package/dist/exports/ast.d.mts +189 -0
- package/dist/exports/ast.d.mts.map +1 -0
- package/dist/exports/ast.mjs +360 -0
- package/dist/exports/ast.mjs.map +1 -0
- package/dist/exports/errors.d.mts +2 -0
- package/dist/exports/errors.mjs +3 -0
- package/dist/exports/guards.d.mts +5 -0
- package/dist/exports/guards.mjs +3 -0
- package/dist/exports/operations-registry.d.mts +5 -0
- package/dist/exports/operations-registry.mjs +3 -0
- package/dist/exports/param.d.mts +5 -0
- package/dist/exports/param.mjs +3 -0
- package/dist/exports/plan.d.mts +2 -0
- package/dist/exports/plan.mjs +17 -0
- package/dist/exports/plan.mjs.map +1 -0
- package/dist/exports/query-lane-context.d.mts +2 -0
- package/dist/exports/query-lane-context.mjs +1 -0
- package/dist/exports/schema.d.mts +5 -0
- package/dist/exports/schema.mjs +4 -0
- package/dist/exports/types.d.mts +4 -0
- package/dist/exports/types.mjs +3 -0
- package/dist/exports/utils/guards.d.mts +5 -0
- package/dist/exports/utils/guards.mjs +4 -0
- package/dist/guards-0ycyntYX.mjs +132 -0
- package/dist/guards-0ycyntYX.mjs.map +1 -0
- package/dist/{utils/guards.d.ts → guards-l1R3q8pA.d.mts} +24 -19
- package/dist/guards-l1R3q8pA.d.mts.map +1 -0
- package/dist/index.d.mts +12 -0
- package/dist/index.mjs +12 -0
- package/dist/operations-registry-0GuSkOCC.d.mts +9 -0
- package/dist/operations-registry-0GuSkOCC.d.mts.map +1 -0
- package/dist/operations-registry-DPZ5aElH.mjs +152 -0
- package/dist/operations-registry-DPZ5aElH.mjs.map +1 -0
- package/dist/param-ChBZwVcw.d.mts +8 -0
- package/dist/param-ChBZwVcw.d.mts.map +1 -0
- package/dist/param-DMU3OWfI.mjs +14 -0
- package/dist/param-DMU3OWfI.mjs.map +1 -0
- package/dist/plan-cjDF_yFX.d.mts +182 -0
- package/dist/plan-cjDF_yFX.d.mts.map +1 -0
- package/dist/query-lane-context-CgkPuKaR.d.mts +259 -0
- package/dist/query-lane-context-CgkPuKaR.d.mts.map +1 -0
- package/dist/schema-Bi5p4aAc.mjs +175 -0
- package/dist/schema-Bi5p4aAc.mjs.map +1 -0
- package/dist/schema-CEpzzWNY.d.mts +86 -0
- package/dist/schema-CEpzzWNY.d.mts.map +1 -0
- package/dist/types-Cdi4Whda.mjs +18 -0
- package/dist/types-Cdi4Whda.mjs.map +1 -0
- package/dist/types-DicmXfBm.d.mts +447 -0
- package/dist/types-DicmXfBm.d.mts.map +1 -0
- package/package.json +34 -51
- package/src/ast/codec-types.ts +72 -4
- package/src/ast/driver-types.ts +20 -3
- package/src/ast/predicate.ts +3 -1
- package/src/ast/sql-codecs.ts +67 -0
- package/src/ast/types.ts +28 -3
- package/src/exports/ast.ts +1 -0
- package/src/exports/utils/guards.ts +1 -0
- package/src/query-lane-context.ts +70 -6
- package/src/schema.ts +4 -4
- package/src/types.ts +2 -2
- package/dist/ast/adapter-types.d.ts +0 -28
- package/dist/ast/adapter-types.d.ts.map +0 -1
- package/dist/ast/codec-types.d.ts +0 -141
- package/dist/ast/codec-types.d.ts.map +0 -1
- package/dist/ast/common.d.ts +0 -7
- package/dist/ast/common.d.ts.map +0 -1
- package/dist/ast/delete.d.ts +0 -8
- package/dist/ast/delete.d.ts.map +0 -1
- package/dist/ast/driver-types.d.ts +0 -20
- package/dist/ast/driver-types.d.ts.map +0 -1
- package/dist/ast/insert.d.ts +0 -8
- package/dist/ast/insert.d.ts.map +0 -1
- package/dist/ast/join.d.ts +0 -6
- package/dist/ast/join.d.ts.map +0 -1
- package/dist/ast/order.d.ts +0 -6
- package/dist/ast/order.d.ts.map +0 -1
- package/dist/ast/predicate.d.ts +0 -5
- package/dist/ast/predicate.d.ts.map +0 -1
- package/dist/ast/select.d.ts +0 -18
- package/dist/ast/select.d.ts.map +0 -1
- package/dist/ast/types.d.ts +0 -143
- package/dist/ast/types.d.ts.map +0 -1
- package/dist/ast/update.d.ts +0 -9
- package/dist/ast/update.d.ts.map +0 -1
- package/dist/ast/util.d.ts +0 -2
- package/dist/ast/util.d.ts.map +0 -1
- package/dist/chunk-2F7DSEOU.js +0 -8
- package/dist/chunk-2F7DSEOU.js.map +0 -1
- package/dist/chunk-2MAKNVCP.js +0 -86
- package/dist/chunk-2MAKNVCP.js.map +0 -1
- package/dist/chunk-36WJWNHT.js +0 -1
- package/dist/chunk-36WJWNHT.js.map +0 -1
- package/dist/chunk-3F4RFQIB.js +0 -169
- package/dist/chunk-3F4RFQIB.js.map +0 -1
- package/dist/chunk-4WKZQIDS.js +0 -193
- package/dist/chunk-4WKZQIDS.js.map +0 -1
- package/dist/chunk-7I3EMQID.js +0 -16
- package/dist/chunk-7I3EMQID.js.map +0 -1
- package/dist/chunk-G52ENULI.js +0 -1
- package/dist/chunk-G52ENULI.js.map +0 -1
- package/dist/chunk-HAUHWBE7.js +0 -13
- package/dist/chunk-HAUHWBE7.js.map +0 -1
- package/dist/chunk-KYSP7L5C.js +0 -16
- package/dist/chunk-KYSP7L5C.js.map +0 -1
- package/dist/chunk-RVHFGDZ6.js +0 -328
- package/dist/chunk-RVHFGDZ6.js.map +0 -1
- package/dist/chunk-U7AXAUJA.js +0 -1
- package/dist/chunk-U7AXAUJA.js.map +0 -1
- package/dist/errors.d.ts +0 -2
- package/dist/errors.d.ts.map +0 -1
- package/dist/exports/ast.d.ts +0 -14
- package/dist/exports/ast.d.ts.map +0 -1
- package/dist/exports/ast.js +0 -48
- package/dist/exports/ast.js.map +0 -1
- package/dist/exports/errors.d.ts +0 -2
- package/dist/exports/errors.d.ts.map +0 -1
- package/dist/exports/errors.js +0 -9
- package/dist/exports/errors.js.map +0 -1
- package/dist/exports/guards.d.ts +0 -2
- package/dist/exports/guards.d.ts.map +0 -1
- package/dist/exports/guards.js +0 -31
- package/dist/exports/guards.js.map +0 -1
- package/dist/exports/operations-registry.d.ts +0 -2
- package/dist/exports/operations-registry.d.ts.map +0 -1
- package/dist/exports/operations-registry.js +0 -9
- package/dist/exports/operations-registry.js.map +0 -1
- package/dist/exports/param.d.ts +0 -3
- package/dist/exports/param.d.ts.map +0 -1
- package/dist/exports/param.js +0 -7
- package/dist/exports/param.js.map +0 -1
- package/dist/exports/plan.d.ts +0 -2
- package/dist/exports/plan.d.ts.map +0 -1
- package/dist/exports/plan.js +0 -7
- package/dist/exports/plan.js.map +0 -1
- package/dist/exports/query-lane-context.d.ts +0 -2
- package/dist/exports/query-lane-context.d.ts.map +0 -1
- package/dist/exports/query-lane-context.js +0 -2
- package/dist/exports/query-lane-context.js.map +0 -1
- package/dist/exports/schema.d.ts +0 -3
- package/dist/exports/schema.d.ts.map +0 -1
- package/dist/exports/schema.js +0 -13
- package/dist/exports/schema.js.map +0 -1
- package/dist/exports/types.d.ts +0 -2
- package/dist/exports/types.d.ts.map +0 -1
- package/dist/exports/types.js +0 -10
- package/dist/exports/types.js.map +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -83
- package/dist/index.js.map +0 -1
- package/dist/operations-registry.d.ts +0 -5
- package/dist/operations-registry.d.ts.map +0 -1
- package/dist/param.d.ts +0 -4
- package/dist/param.d.ts.map +0 -1
- package/dist/plan.d.ts +0 -23
- package/dist/plan.d.ts.map +0 -1
- package/dist/query-lane-context.d.ts +0 -27
- package/dist/query-lane-context.d.ts.map +0 -1
- package/dist/schema.d.ts +0 -93
- package/dist/schema.d.ts.map +0 -1
- package/dist/types.d.ts +0 -459
- package/dist/types.d.ts.map +0 -1
- package/dist/utils/guards.d.ts.map +0 -1
package/dist/exports/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/index.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import "./chunk-U7AXAUJA.js";
|
|
2
|
-
import {
|
|
3
|
-
ColumnBuilderImpl,
|
|
4
|
-
TableBuilderImpl,
|
|
5
|
-
schema
|
|
6
|
-
} from "./chunk-4WKZQIDS.js";
|
|
7
|
-
import {
|
|
8
|
-
param
|
|
9
|
-
} from "./chunk-7I3EMQID.js";
|
|
10
|
-
import "./chunk-36WJWNHT.js";
|
|
11
|
-
import "./chunk-G52ENULI.js";
|
|
12
|
-
import {
|
|
13
|
-
attachOperationsToColumnBuilder
|
|
14
|
-
} from "./chunk-3F4RFQIB.js";
|
|
15
|
-
import "./chunk-2MAKNVCP.js";
|
|
16
|
-
import {
|
|
17
|
-
planInvalid,
|
|
18
|
-
planUnsupported
|
|
19
|
-
} from "./chunk-2F7DSEOU.js";
|
|
20
|
-
import {
|
|
21
|
-
codec,
|
|
22
|
-
compact,
|
|
23
|
-
createBinaryExpr,
|
|
24
|
-
createCodecRegistry,
|
|
25
|
-
createColumnRef,
|
|
26
|
-
createDeleteAst,
|
|
27
|
-
createExistsExpr,
|
|
28
|
-
createInsertAst,
|
|
29
|
-
createJoin,
|
|
30
|
-
createJoinOnBuilder,
|
|
31
|
-
createJoinOnExpr,
|
|
32
|
-
createLiteralExpr,
|
|
33
|
-
createNullCheckExpr,
|
|
34
|
-
createOperationExpr,
|
|
35
|
-
createOrderByItem,
|
|
36
|
-
createParamRef,
|
|
37
|
-
createSelectAst,
|
|
38
|
-
createTableRef,
|
|
39
|
-
createUpdateAst,
|
|
40
|
-
defineCodecs,
|
|
41
|
-
isOperationExpr
|
|
42
|
-
} from "./chunk-RVHFGDZ6.js";
|
|
43
|
-
import {
|
|
44
|
-
createOrderBuilder,
|
|
45
|
-
isColumnBuilder
|
|
46
|
-
} from "./chunk-HAUHWBE7.js";
|
|
47
|
-
import {
|
|
48
|
-
augmentDescriptorWithColumnMeta
|
|
49
|
-
} from "./chunk-KYSP7L5C.js";
|
|
50
|
-
export {
|
|
51
|
-
ColumnBuilderImpl,
|
|
52
|
-
TableBuilderImpl,
|
|
53
|
-
attachOperationsToColumnBuilder,
|
|
54
|
-
augmentDescriptorWithColumnMeta,
|
|
55
|
-
codec,
|
|
56
|
-
compact,
|
|
57
|
-
createBinaryExpr,
|
|
58
|
-
createCodecRegistry,
|
|
59
|
-
createColumnRef,
|
|
60
|
-
createDeleteAst,
|
|
61
|
-
createExistsExpr,
|
|
62
|
-
createInsertAst,
|
|
63
|
-
createJoin,
|
|
64
|
-
createJoinOnBuilder,
|
|
65
|
-
createJoinOnExpr,
|
|
66
|
-
createLiteralExpr,
|
|
67
|
-
createNullCheckExpr,
|
|
68
|
-
createOperationExpr,
|
|
69
|
-
createOrderBuilder,
|
|
70
|
-
createOrderByItem,
|
|
71
|
-
createParamRef,
|
|
72
|
-
createSelectAst,
|
|
73
|
-
createTableRef,
|
|
74
|
-
createUpdateAst,
|
|
75
|
-
defineCodecs,
|
|
76
|
-
isColumnBuilder,
|
|
77
|
-
isOperationExpr,
|
|
78
|
-
param,
|
|
79
|
-
planInvalid,
|
|
80
|
-
planUnsupported,
|
|
81
|
-
schema
|
|
82
|
-
};
|
|
83
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,5 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;AAUrE,OAAO,KAAK,EAGV,aAAa,EAEb,cAAc,EAEf,MAAM,SAAS,CAAC;AAyMjB,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,CA4C3D"}
|
package/dist/param.d.ts
DELETED
package/dist/param.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
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
|
package/dist/plan.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { OperationRegistry } from '@prisma-next/operations';
|
|
2
|
-
import type { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';
|
|
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>;
|
|
10
|
-
/**
|
|
11
|
-
* Minimal context interface for SQL query lanes.
|
|
12
|
-
*
|
|
13
|
-
* Lanes only need contract, operations, and codecs to build typed ASTs and attach
|
|
14
|
-
* operation builders. This interface explicitly excludes runtime concerns like
|
|
15
|
-
* adapters, connection management, and transaction state.
|
|
16
|
-
*/
|
|
17
|
-
export interface QueryLaneContext<TContract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>> {
|
|
18
|
-
readonly contract: TContract;
|
|
19
|
-
readonly operations: OperationRegistry;
|
|
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;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=query-lane-context.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import type { ExtractCodecTypes, ExtractOperationTypes, SqlContract, SqlStorage, StorageColumn } from '@prisma-next/sql-contract/types';
|
|
2
|
-
import type { ColumnRef, ExpressionSource, TableRef } from './ast/types';
|
|
3
|
-
import type { QueryLaneContext } from './query-lane-context';
|
|
4
|
-
import type { BinaryBuilder, CodecTypes as CodecTypesType, ColumnBuilder, ComputeColumnJsType, NullCheckBuilder, OperationTypeSignature, OperationTypes, OrderBuilder, ParamPlaceholder } from './types';
|
|
5
|
-
type TableColumns<Table extends {
|
|
6
|
-
columns: Record<string, StorageColumn>;
|
|
7
|
-
}> = Table['columns'];
|
|
8
|
-
type ColumnBuilders<Contract extends SqlContract<SqlStorage>, TableName extends string, Columns extends Record<string, StorageColumn>, CodecTypes extends CodecTypesType, Operations extends OperationTypes> = {
|
|
9
|
-
readonly [K in keyof Columns]: ColumnBuilder<K & string, Columns[K], ComputeColumnJsType<Contract, TableName, K & string, Columns[K], CodecTypes>, Operations>;
|
|
10
|
-
};
|
|
11
|
-
export declare class ColumnBuilderImpl<ColumnName extends string, ColumnMeta extends StorageColumn, JsType = unknown> implements ExpressionSource {
|
|
12
|
-
readonly table: string;
|
|
13
|
-
readonly column: ColumnName;
|
|
14
|
-
private readonly storageColumn;
|
|
15
|
-
readonly kind: "column";
|
|
16
|
-
constructor(table: string, column: ColumnName, storageColumn: ColumnMeta);
|
|
17
|
-
get columnMeta(): ColumnMeta;
|
|
18
|
-
get __jsType(): JsType;
|
|
19
|
-
/**
|
|
20
|
-
* Converts this column builder to a ColumnRef expression.
|
|
21
|
-
* This is the canonical way to get an AST node from a builder.
|
|
22
|
-
*/
|
|
23
|
-
toExpr(): ColumnRef;
|
|
24
|
-
private createBinaryBuilder;
|
|
25
|
-
eq(value: ParamPlaceholder | ExpressionSource): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
|
|
26
|
-
neq(value: ParamPlaceholder | ExpressionSource): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
|
|
27
|
-
gt(value: ParamPlaceholder | ExpressionSource): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
|
|
28
|
-
lt(value: ParamPlaceholder | ExpressionSource): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
|
|
29
|
-
gte(value: ParamPlaceholder | ExpressionSource): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
|
|
30
|
-
lte(value: ParamPlaceholder | ExpressionSource): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
|
|
31
|
-
asc(): OrderBuilder<ColumnName, ColumnMeta, JsType>;
|
|
32
|
-
desc(): OrderBuilder<ColumnName, ColumnMeta, JsType>;
|
|
33
|
-
/**
|
|
34
|
-
* Creates an IS NULL check for this column.
|
|
35
|
-
* Available on all columns at runtime, but typed to only be visible on nullable columns.
|
|
36
|
-
*/
|
|
37
|
-
isNull(): NullCheckBuilder<ColumnName, ColumnMeta, JsType>;
|
|
38
|
-
/**
|
|
39
|
-
* Creates an IS NOT NULL check for this column.
|
|
40
|
-
* Available on all columns at runtime, but typed to only be visible on nullable columns.
|
|
41
|
-
*/
|
|
42
|
-
isNotNull(): NullCheckBuilder<ColumnName, ColumnMeta, JsType>;
|
|
43
|
-
}
|
|
44
|
-
export declare class TableBuilderImpl<Contract extends SqlContract<SqlStorage>, TableName extends string, Columns extends Record<string, StorageColumn>, CodecTypes extends CodecTypesType, Operations extends OperationTypes> implements TableRef {
|
|
45
|
-
readonly kind: "table";
|
|
46
|
-
readonly columns: ColumnBuilders<Contract, TableName, Columns, CodecTypes, Operations>;
|
|
47
|
-
private readonly _name;
|
|
48
|
-
constructor(name: TableName, columns: ColumnBuilders<Contract, TableName, Columns, CodecTypes, Operations>);
|
|
49
|
-
get name(): string;
|
|
50
|
-
}
|
|
51
|
-
type ExtractSchemaTables<Contract extends SqlContract<SqlStorage>, CodecTypes extends CodecTypesType, Operations extends OperationTypes> = {
|
|
52
|
-
readonly [TableName in keyof Contract['storage']['tables']]: TableBuilderImpl<Contract, TableName & string, TableColumns<Contract['storage']['tables'][TableName]>, CodecTypes, Operations> & TableRef;
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Extracts the types registry shape from a contract.
|
|
56
|
-
* Each key is a type name from storage.types, and the value preserves the
|
|
57
|
-
* literal type from the contract (including codecId, nativeType, and typeParams).
|
|
58
|
-
* Returns an empty object type {} when storage.types is undefined.
|
|
59
|
-
*/
|
|
60
|
-
type ExtractSchemaTypes<Contract extends SqlContract<SqlStorage>> = Contract['storage']['types'] extends infer Types ? Types extends Record<string, unknown> ? {
|
|
61
|
-
readonly [TypeName in keyof Types]: Types[TypeName];
|
|
62
|
-
} : Record<string, never> : Record<string, never>;
|
|
63
|
-
export type SchemaHandle<Contract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>, CodecTypes extends CodecTypesType = CodecTypesType, Operations extends OperationTypes = Record<string, never>> = {
|
|
64
|
-
readonly tables: ExtractSchemaTables<Contract, CodecTypes, Operations>;
|
|
65
|
-
/**
|
|
66
|
-
* Initialized type helpers from storage.types.
|
|
67
|
-
* Each entry corresponds to a named type instance in the contract's storage.types.
|
|
68
|
-
*/
|
|
69
|
-
readonly types: ExtractSchemaTypes<Contract>;
|
|
70
|
-
};
|
|
71
|
-
type SchemaReturnType<Contract extends SqlContract<SqlStorage>> = SchemaHandle<Contract, ExtractCodecTypes<Contract>, ToOperationTypes<ExtractOperationTypes<Contract>>>;
|
|
72
|
-
type NormalizeOperationTypes<T> = {
|
|
73
|
-
[TypeId in keyof T]: {
|
|
74
|
-
[Method in keyof T[TypeId]]: T[TypeId][Method] extends OperationTypeSignature ? T[TypeId][Method] : OperationTypeSignature;
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
type ToOperationTypes<T> = T extends OperationTypes ? T : NormalizeOperationTypes<T>;
|
|
78
|
-
/**
|
|
79
|
-
* Creates a schema handle for building SQL queries.
|
|
80
|
-
*
|
|
81
|
-
* @param context - Query lane context containing contract, codec and operation registries
|
|
82
|
-
* @returns A schema handle with typed table builders and type helpers
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* ```typescript
|
|
86
|
-
* const schemaHandle = schema<Contract>(context);
|
|
87
|
-
* const userTable = schemaHandle.tables.user;
|
|
88
|
-
* const vectorType = schemaHandle.types.Vector1536;
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
export declare function schema<Contract extends SqlContract<SqlStorage>>(context: QueryLaneContext<Contract>): SchemaReturnType<Contract>;
|
|
92
|
-
export type { ColumnBuilderImpl as Column, TableBuilderImpl as Table };
|
|
93
|
-
//# sourceMappingURL=schema.d.ts.map
|
package/dist/schema.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEnF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EACV,aAAa,EACb,UAAU,IAAI,cAAc,EAC5B,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACd,YAAY,EACZ,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB,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,CAA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