@prisma/client-engine-runtime 6.6.0-dev.9 → 6.6.0-dev.90
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/QueryPlan.d.ts +31 -2
- package/dist/crypto.d.ts +1 -0
- package/dist/index.d.mts +55 -21
- package/dist/index.d.ts +55 -21
- package/dist/index.js +248 -240
- package/dist/index.mjs +244 -238
- package/dist/interpreter/QueryInterpreter.d.ts +11 -4
- package/dist/interpreter/generators.d.ts +21 -0
- package/dist/interpreter/renderQuery.d.ts +3 -2
- package/dist/interpreter/renderQuery.test.d.ts +1 -0
- package/dist/transactionManager/Transaction.d.ts +1 -7
- package/dist/transactionManager/TransactionManager.d.ts +7 -6
- package/package.json +9 -4
- package/dist/interpreter/renderQueryTemplate.d.ts +0 -10
- /package/dist/interpreter/{renderQueryTemplate.test.d.ts → generators.test.d.ts} +0 -0
package/dist/QueryPlan.d.ts
CHANGED
|
@@ -6,15 +6,41 @@ export type PrismaValuePlaceholder = {
|
|
|
6
6
|
};
|
|
7
7
|
};
|
|
8
8
|
export declare function isPrismaValuePlaceholder(value: unknown): value is PrismaValuePlaceholder;
|
|
9
|
-
export type
|
|
9
|
+
export type PrismaValueGenerator = {
|
|
10
|
+
prisma__type: 'generatorCall';
|
|
11
|
+
prisma__value: {
|
|
12
|
+
name: string;
|
|
13
|
+
args: PrismaValue[];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare function isPrismaValueGenerator(value: unknown): value is PrismaValueGenerator;
|
|
17
|
+
export type PrismaValue = string | boolean | number | PrismaValue[] | null | Record<string, unknown> | PrismaValuePlaceholder | PrismaValueGenerator;
|
|
10
18
|
export type QueryPlanBinding = {
|
|
11
19
|
name: string;
|
|
12
20
|
expr: QueryPlanNode;
|
|
13
21
|
};
|
|
14
22
|
export type QueryPlanDbQuery = {
|
|
15
|
-
|
|
23
|
+
type: 'rawSql';
|
|
24
|
+
sql: string;
|
|
25
|
+
params: PrismaValue[];
|
|
26
|
+
} | {
|
|
27
|
+
type: 'templateSql';
|
|
28
|
+
fragments: Fragment[];
|
|
29
|
+
placeholderFormat: PlaceholderFormat;
|
|
16
30
|
params: PrismaValue[];
|
|
17
31
|
};
|
|
32
|
+
export type Fragment = {
|
|
33
|
+
type: 'stringChunk';
|
|
34
|
+
value: string;
|
|
35
|
+
} | {
|
|
36
|
+
type: 'parameter';
|
|
37
|
+
} | {
|
|
38
|
+
type: 'parameterTuple';
|
|
39
|
+
};
|
|
40
|
+
export interface PlaceholderFormat {
|
|
41
|
+
prefix: string;
|
|
42
|
+
hasNumbering: boolean;
|
|
43
|
+
}
|
|
18
44
|
export type JoinExpression = {
|
|
19
45
|
child: QueryPlanNode;
|
|
20
46
|
on: [left: string, right: string][];
|
|
@@ -72,4 +98,7 @@ export type QueryPlanNode = {
|
|
|
72
98
|
field: string;
|
|
73
99
|
records: QueryPlanNode;
|
|
74
100
|
};
|
|
101
|
+
} | {
|
|
102
|
+
type: 'transaction';
|
|
103
|
+
args: QueryPlanNode;
|
|
75
104
|
};
|
package/dist/crypto.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function randomUUID(): Promise<string>;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
1
|
+
import type { IsolationLevel } from '@prisma/driver-adapter-utils';
|
|
2
|
+
import { SqlDriverAdapter } from '@prisma/driver-adapter-utils';
|
|
3
|
+
import { SqlQueryable } from '@prisma/driver-adapter-utils';
|
|
4
|
+
import { Transaction } from '@prisma/driver-adapter-utils';
|
|
5
|
+
|
|
6
|
+
export declare type Fragment = {
|
|
7
|
+
type: 'stringChunk';
|
|
8
|
+
value: string;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'parameter';
|
|
11
|
+
} | {
|
|
12
|
+
type: 'parameterTuple';
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export declare function isPrismaValueGenerator(value: unknown): value is PrismaValueGenerator;
|
|
12
16
|
|
|
13
17
|
export declare function isPrismaValuePlaceholder(value: unknown): value is PrismaValuePlaceholder;
|
|
14
18
|
|
|
@@ -18,7 +22,20 @@ export declare type JoinExpression = {
|
|
|
18
22
|
parentField: string;
|
|
19
23
|
};
|
|
20
24
|
|
|
21
|
-
export declare
|
|
25
|
+
export declare interface PlaceholderFormat {
|
|
26
|
+
prefix: string;
|
|
27
|
+
hasNumbering: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export declare type PrismaValue = string | boolean | number | PrismaValue[] | null | Record<string, unknown> | PrismaValuePlaceholder | PrismaValueGenerator;
|
|
31
|
+
|
|
32
|
+
export declare type PrismaValueGenerator = {
|
|
33
|
+
prisma__type: 'generatorCall';
|
|
34
|
+
prisma__value: {
|
|
35
|
+
name: string;
|
|
36
|
+
args: PrismaValue[];
|
|
37
|
+
};
|
|
38
|
+
};
|
|
22
39
|
|
|
23
40
|
export declare type PrismaValuePlaceholder = {
|
|
24
41
|
prisma__type: 'param';
|
|
@@ -37,24 +54,37 @@ export declare type QueryEvent = {
|
|
|
37
54
|
|
|
38
55
|
export declare class QueryInterpreter {
|
|
39
56
|
#private;
|
|
40
|
-
constructor({
|
|
41
|
-
run(queryPlan: QueryPlanNode): Promise<unknown>;
|
|
57
|
+
constructor({ transactionManager, placeholderValues, onQuery }: QueryInterpreterOptions);
|
|
58
|
+
run(queryPlan: QueryPlanNode, queryable: SqlQueryable): Promise<unknown>;
|
|
42
59
|
private interpretNode;
|
|
43
60
|
}
|
|
44
61
|
|
|
45
62
|
export declare type QueryInterpreterOptions = {
|
|
46
|
-
|
|
63
|
+
transactionManager: QueryInterpreterTransactionManager;
|
|
47
64
|
placeholderValues: Record<string, unknown>;
|
|
48
65
|
onQuery?: (event: QueryEvent) => void;
|
|
49
66
|
};
|
|
50
67
|
|
|
68
|
+
export declare type QueryInterpreterTransactionManager = {
|
|
69
|
+
enabled: true;
|
|
70
|
+
manager: TransactionManager;
|
|
71
|
+
} | {
|
|
72
|
+
enabled: false;
|
|
73
|
+
};
|
|
74
|
+
|
|
51
75
|
export declare type QueryPlanBinding = {
|
|
52
76
|
name: string;
|
|
53
77
|
expr: QueryPlanNode;
|
|
54
78
|
};
|
|
55
79
|
|
|
56
80
|
export declare type QueryPlanDbQuery = {
|
|
57
|
-
|
|
81
|
+
type: 'rawSql';
|
|
82
|
+
sql: string;
|
|
83
|
+
params: PrismaValue[];
|
|
84
|
+
} | {
|
|
85
|
+
type: 'templateSql';
|
|
86
|
+
fragments: Fragment[];
|
|
87
|
+
placeholderFormat: PlaceholderFormat;
|
|
58
88
|
params: PrismaValue[];
|
|
59
89
|
};
|
|
60
90
|
|
|
@@ -110,6 +140,9 @@ export declare type QueryPlanNode = {
|
|
|
110
140
|
field: string;
|
|
111
141
|
records: QueryPlanNode;
|
|
112
142
|
};
|
|
143
|
+
} | {
|
|
144
|
+
type: 'transaction';
|
|
145
|
+
args: QueryPlanNode;
|
|
113
146
|
};
|
|
114
147
|
|
|
115
148
|
export declare type TransactionInfo = {
|
|
@@ -120,19 +153,20 @@ export declare class TransactionManager {
|
|
|
120
153
|
private transactions;
|
|
121
154
|
private closedTransactions;
|
|
122
155
|
private readonly driverAdapter;
|
|
123
|
-
|
|
124
|
-
|
|
156
|
+
private readonly transactionOptions;
|
|
157
|
+
constructor({ driverAdapter, transactionOptions }: {
|
|
158
|
+
driverAdapter: SqlDriverAdapter;
|
|
159
|
+
transactionOptions: TransactionOptions;
|
|
125
160
|
});
|
|
126
|
-
startTransaction(options
|
|
161
|
+
startTransaction(options?: TransactionOptions): Promise<TransactionInfo>;
|
|
127
162
|
commitTransaction(transactionId: string): Promise<void>;
|
|
128
163
|
rollbackTransaction(transactionId: string): Promise<void>;
|
|
129
|
-
getTransaction(txInfo: TransactionInfo, operation: string):
|
|
164
|
+
getTransaction(txInfo: TransactionInfo, operation: string): Transaction;
|
|
130
165
|
private getActiveTransaction;
|
|
131
166
|
cancelAllTransactions(): Promise<void>;
|
|
132
167
|
private startTransactionTimeout;
|
|
133
168
|
private closeTransaction;
|
|
134
169
|
private validateOptions;
|
|
135
|
-
private requiresSettingIsolationLevelFirst;
|
|
136
170
|
}
|
|
137
171
|
|
|
138
172
|
export declare class TransactionManagerError extends Error {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
1
|
+
import type { IsolationLevel } from '@prisma/driver-adapter-utils';
|
|
2
|
+
import { SqlDriverAdapter } from '@prisma/driver-adapter-utils';
|
|
3
|
+
import { SqlQueryable } from '@prisma/driver-adapter-utils';
|
|
4
|
+
import { Transaction } from '@prisma/driver-adapter-utils';
|
|
5
|
+
|
|
6
|
+
export declare type Fragment = {
|
|
7
|
+
type: 'stringChunk';
|
|
8
|
+
value: string;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'parameter';
|
|
11
|
+
} | {
|
|
12
|
+
type: 'parameterTuple';
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export declare function isPrismaValueGenerator(value: unknown): value is PrismaValueGenerator;
|
|
12
16
|
|
|
13
17
|
export declare function isPrismaValuePlaceholder(value: unknown): value is PrismaValuePlaceholder;
|
|
14
18
|
|
|
@@ -18,7 +22,20 @@ export declare type JoinExpression = {
|
|
|
18
22
|
parentField: string;
|
|
19
23
|
};
|
|
20
24
|
|
|
21
|
-
export declare
|
|
25
|
+
export declare interface PlaceholderFormat {
|
|
26
|
+
prefix: string;
|
|
27
|
+
hasNumbering: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export declare type PrismaValue = string | boolean | number | PrismaValue[] | null | Record<string, unknown> | PrismaValuePlaceholder | PrismaValueGenerator;
|
|
31
|
+
|
|
32
|
+
export declare type PrismaValueGenerator = {
|
|
33
|
+
prisma__type: 'generatorCall';
|
|
34
|
+
prisma__value: {
|
|
35
|
+
name: string;
|
|
36
|
+
args: PrismaValue[];
|
|
37
|
+
};
|
|
38
|
+
};
|
|
22
39
|
|
|
23
40
|
export declare type PrismaValuePlaceholder = {
|
|
24
41
|
prisma__type: 'param';
|
|
@@ -37,24 +54,37 @@ export declare type QueryEvent = {
|
|
|
37
54
|
|
|
38
55
|
export declare class QueryInterpreter {
|
|
39
56
|
#private;
|
|
40
|
-
constructor({
|
|
41
|
-
run(queryPlan: QueryPlanNode): Promise<unknown>;
|
|
57
|
+
constructor({ transactionManager, placeholderValues, onQuery }: QueryInterpreterOptions);
|
|
58
|
+
run(queryPlan: QueryPlanNode, queryable: SqlQueryable): Promise<unknown>;
|
|
42
59
|
private interpretNode;
|
|
43
60
|
}
|
|
44
61
|
|
|
45
62
|
export declare type QueryInterpreterOptions = {
|
|
46
|
-
|
|
63
|
+
transactionManager: QueryInterpreterTransactionManager;
|
|
47
64
|
placeholderValues: Record<string, unknown>;
|
|
48
65
|
onQuery?: (event: QueryEvent) => void;
|
|
49
66
|
};
|
|
50
67
|
|
|
68
|
+
export declare type QueryInterpreterTransactionManager = {
|
|
69
|
+
enabled: true;
|
|
70
|
+
manager: TransactionManager;
|
|
71
|
+
} | {
|
|
72
|
+
enabled: false;
|
|
73
|
+
};
|
|
74
|
+
|
|
51
75
|
export declare type QueryPlanBinding = {
|
|
52
76
|
name: string;
|
|
53
77
|
expr: QueryPlanNode;
|
|
54
78
|
};
|
|
55
79
|
|
|
56
80
|
export declare type QueryPlanDbQuery = {
|
|
57
|
-
|
|
81
|
+
type: 'rawSql';
|
|
82
|
+
sql: string;
|
|
83
|
+
params: PrismaValue[];
|
|
84
|
+
} | {
|
|
85
|
+
type: 'templateSql';
|
|
86
|
+
fragments: Fragment[];
|
|
87
|
+
placeholderFormat: PlaceholderFormat;
|
|
58
88
|
params: PrismaValue[];
|
|
59
89
|
};
|
|
60
90
|
|
|
@@ -110,6 +140,9 @@ export declare type QueryPlanNode = {
|
|
|
110
140
|
field: string;
|
|
111
141
|
records: QueryPlanNode;
|
|
112
142
|
};
|
|
143
|
+
} | {
|
|
144
|
+
type: 'transaction';
|
|
145
|
+
args: QueryPlanNode;
|
|
113
146
|
};
|
|
114
147
|
|
|
115
148
|
export declare type TransactionInfo = {
|
|
@@ -120,19 +153,20 @@ export declare class TransactionManager {
|
|
|
120
153
|
private transactions;
|
|
121
154
|
private closedTransactions;
|
|
122
155
|
private readonly driverAdapter;
|
|
123
|
-
|
|
124
|
-
|
|
156
|
+
private readonly transactionOptions;
|
|
157
|
+
constructor({ driverAdapter, transactionOptions }: {
|
|
158
|
+
driverAdapter: SqlDriverAdapter;
|
|
159
|
+
transactionOptions: TransactionOptions;
|
|
125
160
|
});
|
|
126
|
-
startTransaction(options
|
|
161
|
+
startTransaction(options?: TransactionOptions): Promise<TransactionInfo>;
|
|
127
162
|
commitTransaction(transactionId: string): Promise<void>;
|
|
128
163
|
rollbackTransaction(transactionId: string): Promise<void>;
|
|
129
|
-
getTransaction(txInfo: TransactionInfo, operation: string):
|
|
164
|
+
getTransaction(txInfo: TransactionInfo, operation: string): Transaction;
|
|
130
165
|
private getActiveTransaction;
|
|
131
166
|
cancelAllTransactions(): Promise<void>;
|
|
132
167
|
private startTransactionTimeout;
|
|
133
168
|
private closeTransaction;
|
|
134
169
|
private validateOptions;
|
|
135
|
-
private requiresSettingIsolationLevelFirst;
|
|
136
170
|
}
|
|
137
171
|
|
|
138
172
|
export declare class TransactionManagerError extends Error {
|