@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/src/ast/codec-types.ts
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
|
+
import { ifDefined } from '@prisma-next/utils/defined';
|
|
2
|
+
import type { Type } from 'arktype';
|
|
1
3
|
import type { O } from 'ts-toolbelt';
|
|
2
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Descriptor for parameterized codecs that require type parameter validation.
|
|
7
|
+
* Shared between adapter (compile-time) and runtime layers to avoid duplication.
|
|
8
|
+
*
|
|
9
|
+
* @template TParams - The shape of the type parameters (e.g., `{ length: number }`)
|
|
10
|
+
* @template THelper - The type returned by the optional `init` hook
|
|
11
|
+
*/
|
|
12
|
+
export interface CodecParamsDescriptor<TParams = Record<string, unknown>, THelper = unknown> {
|
|
13
|
+
/** The codec ID this descriptor applies to (e.g., 'pg/vector@1') */
|
|
14
|
+
readonly codecId: string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Arktype schema for validating typeParams.
|
|
18
|
+
* Used to validate both storage.types entries and inline column typeParams.
|
|
19
|
+
*/
|
|
20
|
+
readonly paramsSchema: Type<TParams>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Optional init hook called during runtime context creation.
|
|
24
|
+
* Receives validated params and returns a helper object to be stored in context.types.
|
|
25
|
+
* If not provided, the validated params are stored directly.
|
|
26
|
+
*/
|
|
27
|
+
readonly init?: (params: TParams) => THelper;
|
|
28
|
+
}
|
|
29
|
+
|
|
3
30
|
/**
|
|
4
31
|
* Codec metadata for database-specific type information.
|
|
5
32
|
* Used for schema introspection and verification.
|
|
@@ -20,7 +47,13 @@ export interface CodecMeta {
|
|
|
20
47
|
* Codecs are pure, synchronous functions with no side effects or IO.
|
|
21
48
|
* They provide deterministic conversion between database wire types and JS values.
|
|
22
49
|
*/
|
|
23
|
-
export interface Codec<
|
|
50
|
+
export interface Codec<
|
|
51
|
+
Id extends string = string,
|
|
52
|
+
TWire = unknown,
|
|
53
|
+
TJs = unknown,
|
|
54
|
+
TParams = Record<string, unknown>,
|
|
55
|
+
THelper = unknown,
|
|
56
|
+
> {
|
|
24
57
|
/**
|
|
25
58
|
* Namespaced codec identifier in format 'namespace/name@version'
|
|
26
59
|
* Examples: 'pg/text@1', 'pg/uuid@1', 'pg/timestamptz@1'
|
|
@@ -39,6 +72,31 @@ export interface Codec<Id extends string = string, TWire = unknown, TJs = unknow
|
|
|
39
72
|
*/
|
|
40
73
|
readonly meta?: CodecMeta;
|
|
41
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Optional params schema for parameterized codecs.
|
|
77
|
+
* If provided, typeParams are validated against this schema.
|
|
78
|
+
*/
|
|
79
|
+
readonly paramsSchema?: Type<TParams>;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Optional init hook for building runtime helper state from validated params.
|
|
83
|
+
*
|
|
84
|
+
* Useful when parameterized types need derived data at runtime, for example:
|
|
85
|
+
* - normalize typeParams into a stable helper shape consumed by lanes/adapters
|
|
86
|
+
* - precompute reusable values once during context creation
|
|
87
|
+
* - avoid repeating typeParams parsing logic during query execution
|
|
88
|
+
*
|
|
89
|
+
* Example:
|
|
90
|
+
* { length: 255 } -> { kind: 'variable', maxLength: 255 }
|
|
91
|
+
*
|
|
92
|
+
* **Convention for JSON/JSONB codecs**: When the helper includes a `validate`
|
|
93
|
+
* property of type `JsonSchemaValidateFn`, the runtime will use it to enforce
|
|
94
|
+
* JSON Schema conformance during encoding and decoding. The property is
|
|
95
|
+
* discovered via duck typing (`helper?.validate`) for flexibility across
|
|
96
|
+
* different codec types.
|
|
97
|
+
*/
|
|
98
|
+
readonly init?: (params: TParams) => THelper;
|
|
99
|
+
|
|
42
100
|
/**
|
|
43
101
|
* Decode a wire value (from database) to JavaScript type.
|
|
44
102
|
* Must be synchronous and pure (no side effects).
|
|
@@ -157,17 +215,27 @@ class CodecRegistryImpl implements CodecRegistry {
|
|
|
157
215
|
/**
|
|
158
216
|
* Codec factory - creates a codec with typeId and encode/decode functions.
|
|
159
217
|
*/
|
|
160
|
-
export function codec<
|
|
218
|
+
export function codec<
|
|
219
|
+
Id extends string,
|
|
220
|
+
TWire,
|
|
221
|
+
TJs,
|
|
222
|
+
TParams = Record<string, unknown>,
|
|
223
|
+
THelper = unknown,
|
|
224
|
+
>(config: {
|
|
161
225
|
typeId: Id;
|
|
162
226
|
targetTypes: readonly string[];
|
|
163
227
|
encode: (value: TJs) => TWire;
|
|
164
228
|
decode: (wire: TWire) => TJs;
|
|
165
229
|
meta?: CodecMeta;
|
|
166
|
-
|
|
230
|
+
paramsSchema?: Type<TParams>;
|
|
231
|
+
init?: (params: TParams) => THelper;
|
|
232
|
+
}): Codec<Id, TWire, TJs, TParams, THelper> {
|
|
167
233
|
return {
|
|
168
234
|
id: config.typeId,
|
|
169
235
|
targetTypes: config.targetTypes,
|
|
170
|
-
...(
|
|
236
|
+
...ifDefined('meta', config.meta),
|
|
237
|
+
...ifDefined('paramsSchema', config.paramsSchema),
|
|
238
|
+
...ifDefined('init', config.init),
|
|
171
239
|
encode: config.encode,
|
|
172
240
|
decode: config.decode,
|
|
173
241
|
};
|
package/src/ast/driver-types.ts
CHANGED
|
@@ -13,13 +13,30 @@ export interface SqlExplainResult<Row = Record<string, unknown>> {
|
|
|
13
13
|
readonly rows: ReadonlyArray<Row>;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export
|
|
17
|
-
|
|
16
|
+
export type SqlDriverState = 'unbound' | 'connected' | 'closed';
|
|
17
|
+
|
|
18
|
+
export interface SqlDriver<TBinding = void> extends SqlQueryable {
|
|
19
|
+
readonly state?: SqlDriverState;
|
|
20
|
+
connect(binding: TBinding): Promise<void>;
|
|
21
|
+
acquireConnection(): Promise<SqlConnection>;
|
|
22
|
+
close(): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface SqlConnection extends SqlQueryable {
|
|
26
|
+
beginTransaction(): Promise<SqlTransaction>;
|
|
27
|
+
release(): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface SqlTransaction extends SqlQueryable {
|
|
31
|
+
commit(): Promise<void>;
|
|
32
|
+
rollback(): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface SqlQueryable {
|
|
18
36
|
execute<Row = Record<string, unknown>>(request: SqlExecuteRequest): AsyncIterable<Row>;
|
|
19
37
|
explain?(request: SqlExecuteRequest): Promise<SqlExplainResult>;
|
|
20
38
|
query<Row = Record<string, unknown>>(
|
|
21
39
|
sql: string,
|
|
22
40
|
params?: readonly unknown[],
|
|
23
41
|
): Promise<SqlQueryResult<Row>>;
|
|
24
|
-
close(): Promise<void>;
|
|
25
42
|
}
|
package/src/ast/predicate.ts
CHANGED
|
@@ -3,6 +3,8 @@ import type {
|
|
|
3
3
|
BinaryOp,
|
|
4
4
|
ExistsExpr,
|
|
5
5
|
Expression,
|
|
6
|
+
ListLiteralExpr,
|
|
7
|
+
LiteralExpr,
|
|
6
8
|
NullCheckExpr,
|
|
7
9
|
ParamRef,
|
|
8
10
|
SelectAst,
|
|
@@ -11,7 +13,7 @@ import type {
|
|
|
11
13
|
export function createBinaryExpr(
|
|
12
14
|
op: BinaryOp,
|
|
13
15
|
left: Expression,
|
|
14
|
-
right: Expression | ParamRef,
|
|
16
|
+
right: Expression | ParamRef | LiteralExpr | ListLiteralExpr,
|
|
15
17
|
): BinaryExpr {
|
|
16
18
|
return {
|
|
17
19
|
kind: 'bin',
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type as arktype } from 'arktype';
|
|
2
|
+
import { codec, defineCodecs } from './codec-types';
|
|
3
|
+
|
|
4
|
+
export const SQL_CHAR_CODEC_ID = 'sql/char@1' as const;
|
|
5
|
+
export const SQL_VARCHAR_CODEC_ID = 'sql/varchar@1' as const;
|
|
6
|
+
export const SQL_INT_CODEC_ID = 'sql/int@1' as const;
|
|
7
|
+
export const SQL_FLOAT_CODEC_ID = 'sql/float@1' as const;
|
|
8
|
+
|
|
9
|
+
const lengthParamsSchema = arktype({
|
|
10
|
+
length: 'number.integer > 0',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
type LengthTypeHelper = {
|
|
14
|
+
readonly kind: 'fixed' | 'variable';
|
|
15
|
+
readonly maxLength: number;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
function createLengthTypeHelper(
|
|
19
|
+
kind: LengthTypeHelper['kind'],
|
|
20
|
+
): (params: Record<string, unknown>) => LengthTypeHelper {
|
|
21
|
+
return (params) => ({
|
|
22
|
+
kind,
|
|
23
|
+
maxLength: params['length'] as number,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const sqlCharCodec = codec<typeof SQL_CHAR_CODEC_ID, string, string>({
|
|
28
|
+
typeId: SQL_CHAR_CODEC_ID,
|
|
29
|
+
targetTypes: ['char'],
|
|
30
|
+
encode: (value: string): string => value,
|
|
31
|
+
decode: (wire: string): string => wire.trimEnd(),
|
|
32
|
+
paramsSchema: lengthParamsSchema,
|
|
33
|
+
init: createLengthTypeHelper('fixed'),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const sqlVarcharCodec = codec<typeof SQL_VARCHAR_CODEC_ID, string, string>({
|
|
37
|
+
typeId: SQL_VARCHAR_CODEC_ID,
|
|
38
|
+
targetTypes: ['varchar'],
|
|
39
|
+
encode: (value: string): string => value,
|
|
40
|
+
decode: (wire: string): string => wire,
|
|
41
|
+
paramsSchema: lengthParamsSchema,
|
|
42
|
+
init: createLengthTypeHelper('variable'),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const sqlIntCodec = codec<typeof SQL_INT_CODEC_ID, number, number>({
|
|
46
|
+
typeId: SQL_INT_CODEC_ID,
|
|
47
|
+
targetTypes: ['int'],
|
|
48
|
+
encode: (value) => value,
|
|
49
|
+
decode: (wire) => wire,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const sqlFloatCodec = codec<typeof SQL_FLOAT_CODEC_ID, number, number>({
|
|
53
|
+
typeId: SQL_FLOAT_CODEC_ID,
|
|
54
|
+
targetTypes: ['float'],
|
|
55
|
+
encode: (value) => value,
|
|
56
|
+
decode: (wire) => wire,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const codecs = defineCodecs()
|
|
60
|
+
.add('char', sqlCharCodec)
|
|
61
|
+
.add('varchar', sqlVarcharCodec)
|
|
62
|
+
.add('int', sqlIntCodec)
|
|
63
|
+
.add('float', sqlFloatCodec);
|
|
64
|
+
|
|
65
|
+
export const sqlCodecDefinitions = codecs.codecDefinitions;
|
|
66
|
+
export const sqlDataTypes = codecs.dataTypes;
|
|
67
|
+
export type SqlCodecTypes = typeof codecs.CodecTypes;
|
package/src/ast/types.ts
CHANGED
|
@@ -56,13 +56,28 @@ export function isOperationExpr(expr: Expression): expr is OperationExpr {
|
|
|
56
56
|
return expr.kind === 'operation';
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
export type BinaryOp =
|
|
59
|
+
export type BinaryOp =
|
|
60
|
+
| 'eq'
|
|
61
|
+
| 'neq'
|
|
62
|
+
| 'gt'
|
|
63
|
+
| 'lt'
|
|
64
|
+
| 'gte'
|
|
65
|
+
| 'lte'
|
|
66
|
+
| 'like'
|
|
67
|
+
| 'ilike'
|
|
68
|
+
| 'in'
|
|
69
|
+
| 'notIn';
|
|
70
|
+
|
|
71
|
+
export interface ListLiteralExpr {
|
|
72
|
+
readonly kind: 'listLiteral';
|
|
73
|
+
readonly values: ReadonlyArray<ParamRef | LiteralExpr>;
|
|
74
|
+
}
|
|
60
75
|
|
|
61
76
|
export interface BinaryExpr {
|
|
62
77
|
readonly kind: 'bin';
|
|
63
78
|
readonly op: BinaryOp;
|
|
64
79
|
readonly left: Expression;
|
|
65
|
-
readonly right: Expression | ParamRef;
|
|
80
|
+
readonly right: Expression | ParamRef | LiteralExpr | ListLiteralExpr;
|
|
66
81
|
}
|
|
67
82
|
|
|
68
83
|
export interface ExistsExpr {
|
|
@@ -81,10 +96,20 @@ export interface NullCheckExpr {
|
|
|
81
96
|
readonly isNull: boolean;
|
|
82
97
|
}
|
|
83
98
|
|
|
99
|
+
export interface AndExpr {
|
|
100
|
+
readonly kind: 'and';
|
|
101
|
+
readonly exprs: ReadonlyArray<WhereExpr>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface OrExpr {
|
|
105
|
+
readonly kind: 'or';
|
|
106
|
+
readonly exprs: ReadonlyArray<WhereExpr>;
|
|
107
|
+
}
|
|
108
|
+
|
|
84
109
|
/**
|
|
85
110
|
* Union type for WHERE clause expressions.
|
|
86
111
|
*/
|
|
87
|
-
export type WhereExpr = BinaryExpr | ExistsExpr | NullCheckExpr;
|
|
112
|
+
export type WhereExpr = BinaryExpr | ExistsExpr | NullCheckExpr | AndExpr | OrExpr;
|
|
88
113
|
|
|
89
114
|
export type JoinOnExpr = {
|
|
90
115
|
readonly kind: 'eqCol';
|
package/src/exports/ast.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from '../ast/join';
|
|
|
8
8
|
export * from '../ast/order';
|
|
9
9
|
export * from '../ast/predicate';
|
|
10
10
|
export * from '../ast/select';
|
|
11
|
+
export * from '../ast/sql-codecs';
|
|
11
12
|
export * from '../ast/types';
|
|
12
13
|
export * from '../ast/update';
|
|
13
14
|
export * from '../ast/util';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../guards';
|
|
@@ -4,11 +4,65 @@ import type { CodecRegistry } from './ast/codec-types';
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Registry of initialized type helpers from storage.types.
|
|
7
|
-
* Each key is a type name from storage.types, and the value is
|
|
8
|
-
*
|
|
7
|
+
* Each key is a type name from storage.types, and the value is:
|
|
8
|
+
* - The result of the codec's init hook (if provided), or
|
|
9
|
+
* - The full StorageTypeInstance metadata (codecId, nativeType, typeParams) if no init hook
|
|
9
10
|
*/
|
|
10
11
|
export type TypeHelperRegistry = Record<string, unknown>;
|
|
11
12
|
|
|
13
|
+
// =============================================================================
|
|
14
|
+
// JSON Schema Validation Types
|
|
15
|
+
// =============================================================================
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A single validation error from JSON Schema validation.
|
|
19
|
+
*/
|
|
20
|
+
export interface JsonSchemaValidationError {
|
|
21
|
+
readonly path: string;
|
|
22
|
+
readonly message: string;
|
|
23
|
+
readonly keyword: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Result of a JSON Schema validation.
|
|
28
|
+
*/
|
|
29
|
+
export type JsonSchemaValidationResult =
|
|
30
|
+
| { readonly valid: true }
|
|
31
|
+
| { readonly valid: false; readonly errors: ReadonlyArray<JsonSchemaValidationError> };
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A compiled JSON Schema validate function.
|
|
35
|
+
* Returns a structured result indicating whether the value conforms to the schema.
|
|
36
|
+
*/
|
|
37
|
+
export type JsonSchemaValidateFn = (value: unknown) => JsonSchemaValidationResult;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Registry of compiled JSON Schema validators for columns with typed JSON/JSONB.
|
|
41
|
+
*
|
|
42
|
+
* Built during context creation by scanning the contract for columns whose codec
|
|
43
|
+
* descriptor provides an `init` hook that returns a `{ validate }` helper.
|
|
44
|
+
* Keys are `"table.column"` (e.g., `"user.metadata"`).
|
|
45
|
+
*/
|
|
46
|
+
export interface JsonSchemaValidatorRegistry {
|
|
47
|
+
/** Get the compiled validator for a column. Key format: "table.column". */
|
|
48
|
+
get(key: string): JsonSchemaValidateFn | undefined;
|
|
49
|
+
/** Number of registered validators. */
|
|
50
|
+
readonly size: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type MutationDefaultsOp = 'create' | 'update';
|
|
54
|
+
|
|
55
|
+
export type AppliedMutationDefault = {
|
|
56
|
+
readonly column: string;
|
|
57
|
+
readonly value: unknown;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type MutationDefaultsOptions = {
|
|
61
|
+
readonly op: MutationDefaultsOp;
|
|
62
|
+
readonly table: string;
|
|
63
|
+
readonly values: Record<string, unknown>;
|
|
64
|
+
};
|
|
65
|
+
|
|
12
66
|
/**
|
|
13
67
|
* Minimal context interface for SQL query lanes.
|
|
14
68
|
*
|
|
@@ -16,15 +70,25 @@ export type TypeHelperRegistry = Record<string, unknown>;
|
|
|
16
70
|
* operation builders. This interface explicitly excludes runtime concerns like
|
|
17
71
|
* adapters, connection management, and transaction state.
|
|
18
72
|
*/
|
|
19
|
-
export interface
|
|
73
|
+
export interface ExecutionContext<
|
|
20
74
|
TContract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>,
|
|
21
75
|
> {
|
|
22
76
|
readonly contract: TContract;
|
|
23
77
|
readonly operations: OperationRegistry;
|
|
24
78
|
readonly codecs: CodecRegistry;
|
|
25
79
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
80
|
+
* Type helper registry for parameterized types.
|
|
81
|
+
* Schema builders expose these helpers via schema.types.
|
|
82
|
+
*/
|
|
83
|
+
readonly types: TypeHelperRegistry;
|
|
84
|
+
/**
|
|
85
|
+
* Compiled JSON Schema validators for typed JSON/JSONB columns.
|
|
86
|
+
* Present only when the contract declares columns with JSON Schema typeParams.
|
|
87
|
+
*/
|
|
88
|
+
readonly jsonSchemaValidators?: JsonSchemaValidatorRegistry;
|
|
89
|
+
/**
|
|
90
|
+
* Applies execution-time mutation defaults for the given table.
|
|
91
|
+
* Returns the applied defaults (caller-provided values always win).
|
|
28
92
|
*/
|
|
29
|
-
|
|
93
|
+
applyMutationDefaults(options: MutationDefaultsOptions): ReadonlyArray<AppliedMutationDefault>;
|
|
30
94
|
}
|
package/src/schema.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
} from '@prisma-next/sql-contract/types';
|
|
10
10
|
import type { BinaryOp, ColumnRef, ExpressionSource, TableRef } from './ast/types';
|
|
11
11
|
import { attachOperationsToColumnBuilder } from './operations-registry';
|
|
12
|
-
import type {
|
|
12
|
+
import type { ExecutionContext } from './query-lane-context';
|
|
13
13
|
import type {
|
|
14
14
|
BinaryBuilder,
|
|
15
15
|
CodecTypes as CodecTypesType,
|
|
@@ -382,7 +382,7 @@ type ToOperationTypes<T> = T extends OperationTypes ? T : NormalizeOperationType
|
|
|
382
382
|
* ```
|
|
383
383
|
*/
|
|
384
384
|
export function schema<Contract extends SqlContract<SqlStorage>>(
|
|
385
|
-
context:
|
|
385
|
+
context: ExecutionContext<Contract>,
|
|
386
386
|
): SchemaReturnType<Contract> {
|
|
387
387
|
const contract = context.contract;
|
|
388
388
|
const storage = contract.storage;
|
|
@@ -422,8 +422,8 @@ export function schema<Contract extends SqlContract<SqlStorage>>(
|
|
|
422
422
|
) as ExtractSchemaTables<Contract, CodecTypes, Operations>[typeof tableName];
|
|
423
423
|
}
|
|
424
424
|
|
|
425
|
-
// Get type helpers from context (populated by
|
|
426
|
-
const types =
|
|
425
|
+
// Get type helpers from context (populated by runtime context creation)
|
|
426
|
+
const types = context.types as ExtractSchemaTypes<Contract>;
|
|
427
427
|
|
|
428
428
|
return Object.freeze({ tables, types }) as SchemaReturnType<Contract>;
|
|
429
429
|
}
|
package/src/types.ts
CHANGED
|
@@ -17,7 +17,7 @@ import type {
|
|
|
17
17
|
QueryAst,
|
|
18
18
|
} from './ast/types';
|
|
19
19
|
import type { SqlQueryPlan } from './plan';
|
|
20
|
-
import type {
|
|
20
|
+
import type { ExecutionContext } from './query-lane-context';
|
|
21
21
|
|
|
22
22
|
export interface ParamPlaceholder {
|
|
23
23
|
readonly kind: 'param-placeholder';
|
|
@@ -788,7 +788,7 @@ export interface BuildOptions {
|
|
|
788
788
|
export interface SqlBuilderOptions<
|
|
789
789
|
TContract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>,
|
|
790
790
|
> {
|
|
791
|
-
readonly context:
|
|
791
|
+
readonly context: ExecutionContext<TContract>;
|
|
792
792
|
}
|
|
793
793
|
|
|
794
794
|
/**
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { CodecRegistry } from './codec-types';
|
|
2
|
-
export type AdapterTarget = string;
|
|
3
|
-
export interface AdapterProfile<TTarget extends AdapterTarget = AdapterTarget> {
|
|
4
|
-
readonly id: string;
|
|
5
|
-
readonly target: TTarget;
|
|
6
|
-
readonly capabilities: Record<string, unknown>;
|
|
7
|
-
/**
|
|
8
|
-
* Returns the adapter's default codec registry.
|
|
9
|
-
* The registry contains codecs provided by the adapter for converting
|
|
10
|
-
* between wire types and JavaScript types.
|
|
11
|
-
*/
|
|
12
|
-
codecs(): CodecRegistry;
|
|
13
|
-
}
|
|
14
|
-
export interface LoweredPayload<TBody = unknown> {
|
|
15
|
-
readonly profileId?: string;
|
|
16
|
-
readonly body: TBody;
|
|
17
|
-
readonly annotations?: Record<string, unknown>;
|
|
18
|
-
}
|
|
19
|
-
export interface LowererContext<TContract = unknown> {
|
|
20
|
-
readonly contract: TContract;
|
|
21
|
-
readonly params?: readonly unknown[];
|
|
22
|
-
}
|
|
23
|
-
export type Lowerer<Ast = unknown, TContract = unknown, TBody = unknown> = (ast: Ast, context: LowererContext<TContract>) => LoweredPayload<TBody>;
|
|
24
|
-
export interface Adapter<Ast = unknown, TContract = unknown, TBody = unknown> {
|
|
25
|
-
readonly profile: AdapterProfile;
|
|
26
|
-
lower(ast: Ast, context: LowererContext<TContract>): LoweredPayload<TBody>;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=adapter-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapter-types.d.ts","sourceRoot":"","sources":["../../src/ast/adapter-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,MAAM,WAAW,cAAc,CAAC,OAAO,SAAS,aAAa,GAAG,aAAa;IAC3E,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/C;;;;OAIG;IACH,MAAM,IAAI,aAAa,CAAC;CACzB;AAED,MAAM,WAAW,cAAc,CAAC,KAAK,GAAG,OAAO;IAC7C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChD;AAED,MAAM,WAAW,cAAc,CAAC,SAAS,GAAG,OAAO;IACjD,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CACtC;AAED,MAAM,MAAM,OAAO,CAAC,GAAG,GAAG,OAAO,EAAE,SAAS,GAAG,OAAO,EAAE,KAAK,GAAG,OAAO,IAAI,CACzE,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,KAC/B,cAAc,CAAC,KAAK,CAAC,CAAC;AAE3B,MAAM,WAAW,OAAO,CAAC,GAAG,GAAG,OAAO,EAAE,SAAS,GAAG,OAAO,EAAE,KAAK,GAAG,OAAO;IAC1E,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;CAC5E"}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import type { O } from 'ts-toolbelt';
|
|
2
|
-
/**
|
|
3
|
-
* Codec metadata for database-specific type information.
|
|
4
|
-
* Used for schema introspection and verification.
|
|
5
|
-
*/
|
|
6
|
-
export interface CodecMeta {
|
|
7
|
-
readonly db?: {
|
|
8
|
-
readonly sql?: {
|
|
9
|
-
readonly postgres?: {
|
|
10
|
-
readonly nativeType: string;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Codec interface for encoding/decoding values between wire format and JavaScript types.
|
|
17
|
-
*
|
|
18
|
-
* Codecs are pure, synchronous functions with no side effects or IO.
|
|
19
|
-
* They provide deterministic conversion between database wire types and JS values.
|
|
20
|
-
*/
|
|
21
|
-
export interface Codec<Id extends string = string, TWire = unknown, TJs = unknown> {
|
|
22
|
-
/**
|
|
23
|
-
* Namespaced codec identifier in format 'namespace/name@version'
|
|
24
|
-
* Examples: 'pg/text@1', 'pg/uuid@1', 'pg/timestamptz@1'
|
|
25
|
-
*/
|
|
26
|
-
readonly id: Id;
|
|
27
|
-
/**
|
|
28
|
-
* Contract scalar type IDs that this codec can handle.
|
|
29
|
-
* Examples: ['text'], ['int4', 'float8'], ['timestamp', 'timestamptz']
|
|
30
|
-
*/
|
|
31
|
-
readonly targetTypes: readonly string[];
|
|
32
|
-
/**
|
|
33
|
-
* Optional metadata for database-specific type information.
|
|
34
|
-
* Used for schema introspection and verification.
|
|
35
|
-
*/
|
|
36
|
-
readonly meta?: CodecMeta;
|
|
37
|
-
/**
|
|
38
|
-
* Decode a wire value (from database) to JavaScript type.
|
|
39
|
-
* Must be synchronous and pure (no side effects).
|
|
40
|
-
*/
|
|
41
|
-
decode(wire: TWire): TJs;
|
|
42
|
-
/**
|
|
43
|
-
* Encode a JavaScript value to wire format (for database).
|
|
44
|
-
* Optional - if not provided, values pass through unchanged.
|
|
45
|
-
* Must be synchronous and pure (no side effects).
|
|
46
|
-
*/
|
|
47
|
-
encode?(value: TJs): TWire;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Registry interface for codecs organized by ID and by contract scalar type.
|
|
51
|
-
*
|
|
52
|
-
* The registry allows looking up codecs by their namespaced ID or by the
|
|
53
|
-
* contract scalar types they handle. Multiple codecs may handle the same
|
|
54
|
-
* scalar type; ordering in byScalar reflects preference (adapter first,
|
|
55
|
-
* then packs, then app overrides).
|
|
56
|
-
*/
|
|
57
|
-
export interface CodecRegistry {
|
|
58
|
-
get(id: string): Codec<string> | undefined;
|
|
59
|
-
has(id: string): boolean;
|
|
60
|
-
getByScalar(scalar: string): readonly Codec<string>[];
|
|
61
|
-
getDefaultCodec(scalar: string): Codec<string> | undefined;
|
|
62
|
-
register(codec: Codec<string>): void;
|
|
63
|
-
[Symbol.iterator](): Iterator<Codec<string>>;
|
|
64
|
-
values(): IterableIterator<Codec<string>>;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Codec factory - creates a codec with typeId and encode/decode functions.
|
|
68
|
-
*/
|
|
69
|
-
export declare function codec<Id extends string, TWire, TJs>(config: {
|
|
70
|
-
typeId: Id;
|
|
71
|
-
targetTypes: readonly string[];
|
|
72
|
-
encode: (value: TJs) => TWire;
|
|
73
|
-
decode: (wire: TWire) => TJs;
|
|
74
|
-
meta?: CodecMeta;
|
|
75
|
-
}): Codec<Id, TWire, TJs>;
|
|
76
|
-
/**
|
|
77
|
-
* Type helpers to extract codec types.
|
|
78
|
-
*/
|
|
79
|
-
export type CodecId<T> = T extends Codec<infer Id, unknown, unknown> ? Id : T extends {
|
|
80
|
-
readonly id: infer Id;
|
|
81
|
-
} ? Id : never;
|
|
82
|
-
export type CodecInput<T> = T extends Codec<string, unknown, infer JsT> ? JsT : never;
|
|
83
|
-
export type CodecOutput<T> = T extends Codec<string, unknown, infer JsT> ? JsT : never;
|
|
84
|
-
/**
|
|
85
|
-
* Type helper to extract codec types from builder instance.
|
|
86
|
-
*/
|
|
87
|
-
export type ExtractCodecTypes<ScalarNames extends {
|
|
88
|
-
readonly [K in keyof ScalarNames]: Codec<string>;
|
|
89
|
-
} = Record<never, never>> = {
|
|
90
|
-
readonly [K in keyof ScalarNames as ScalarNames[K] extends Codec<infer Id, unknown, unknown> ? Id : never]: {
|
|
91
|
-
readonly input: CodecInput<ScalarNames[K]>;
|
|
92
|
-
readonly output: CodecOutput<ScalarNames[K]>;
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* Type helper to extract data type IDs from builder instance.
|
|
97
|
-
* Uses ExtractCodecTypes which preserves literal types as keys.
|
|
98
|
-
* Since ExtractCodecTypes<Record<K, ScalarNames[K]>> has exactly one key (the Id),
|
|
99
|
-
* we extract it by creating a mapped type that uses the Id as both key and value,
|
|
100
|
-
* then extract the value type. This preserves literal types.
|
|
101
|
-
*/
|
|
102
|
-
export type ExtractDataTypes<ScalarNames extends {
|
|
103
|
-
readonly [K in keyof ScalarNames]: Codec<string>;
|
|
104
|
-
}> = {
|
|
105
|
-
readonly [K in keyof ScalarNames]: {
|
|
106
|
-
readonly [Id in keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>]: Id;
|
|
107
|
-
}[keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>];
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* Builder interface for declaring codecs.
|
|
111
|
-
*/
|
|
112
|
-
export interface CodecDefBuilder<ScalarNames extends {
|
|
113
|
-
readonly [K in keyof ScalarNames]: Codec<string>;
|
|
114
|
-
} = Record<never, never>> {
|
|
115
|
-
readonly CodecTypes: ExtractCodecTypes<ScalarNames>;
|
|
116
|
-
add<ScalarName extends string, CodecImpl extends Codec<string>>(scalarName: ScalarName, codecImpl: CodecImpl): CodecDefBuilder<O.Overwrite<ScalarNames, Record<ScalarName, CodecImpl>> & Record<ScalarName, CodecImpl>>;
|
|
117
|
-
readonly codecDefinitions: {
|
|
118
|
-
readonly [K in keyof ScalarNames]: {
|
|
119
|
-
readonly typeId: ScalarNames[K] extends Codec<infer Id extends string, unknown, unknown> ? Id : never;
|
|
120
|
-
readonly scalar: K;
|
|
121
|
-
readonly codec: ScalarNames[K];
|
|
122
|
-
readonly input: CodecInput<ScalarNames[K]>;
|
|
123
|
-
readonly output: CodecOutput<ScalarNames[K]>;
|
|
124
|
-
readonly jsType: CodecOutput<ScalarNames[K]>;
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
readonly dataTypes: {
|
|
128
|
-
readonly [K in keyof ScalarNames]: {
|
|
129
|
-
readonly [Id in keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>]: Id;
|
|
130
|
-
}[keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>];
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Create a new codec registry.
|
|
135
|
-
*/
|
|
136
|
-
export declare function createCodecRegistry(): CodecRegistry;
|
|
137
|
-
/**
|
|
138
|
-
* Create a new codec definition builder.
|
|
139
|
-
*/
|
|
140
|
-
export declare function defineCodecs(): CodecDefBuilder<Record<never, never>>;
|
|
141
|
-
//# sourceMappingURL=codec-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,GA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,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"}
|
package/dist/ast/common.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ColumnRef, LiteralExpr, OperationExpr, ParamRef, TableRef } from './types';
|
|
2
|
-
export declare function createTableRef(name: string): TableRef;
|
|
3
|
-
export declare function createColumnRef(table: string, column: string): ColumnRef;
|
|
4
|
-
export declare function createParamRef(index: number, name?: string): ParamRef;
|
|
5
|
-
export declare function createOperationExpr(operation: OperationExpr): OperationExpr;
|
|
6
|
-
export declare function createLiteralExpr(value: unknown): LiteralExpr;
|
|
7
|
-
//# sourceMappingURL=common.d.ts.map
|
package/dist/ast/common.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/ast/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGzF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAKrD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAMxE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAMrE;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,aAAa,GAAG,aAAa,CAE3E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAK7D"}
|
package/dist/ast/delete.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ColumnRef, DeleteAst, TableRef, WhereExpr } from './types';
|
|
2
|
-
export interface CreateDeleteAstOptions {
|
|
3
|
-
readonly table: TableRef;
|
|
4
|
-
readonly where: WhereExpr;
|
|
5
|
-
readonly returning?: ReadonlyArray<ColumnRef>;
|
|
6
|
-
}
|
|
7
|
-
export declare function createDeleteAst(options: CreateDeleteAstOptions): DeleteAst;
|
|
8
|
-
//# sourceMappingURL=delete.d.ts.map
|
package/dist/ast/delete.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../src/ast/delete.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGzE,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CAC/C;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,SAAS,CAO1E"}
|