@prisma-next/runtime-executor 0.3.0-dev.9 → 0.3.0-dev.91
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/LICENSE +201 -0
- package/README.md +5 -3
- package/dist/index.d.mts +169 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +555 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +22 -15
- package/src/async-iterable-result.ts +39 -22
- package/src/exports/index.ts +3 -2
- package/src/marker.ts +1 -1
- package/src/plugins/budgets.ts +7 -26
- package/src/runtime-core.ts +105 -28
- package/dist/async-iterable-result.d.ts +0 -17
- package/dist/async-iterable-result.d.ts.map +0 -1
- package/dist/errors.d.ts +0 -8
- package/dist/errors.d.ts.map +0 -1
- package/dist/exports/index.d.ts +0 -17
- package/dist/exports/index.d.ts.map +0 -1
- package/dist/fingerprint.d.ts +0 -2
- package/dist/fingerprint.d.ts.map +0 -1
- package/dist/guardrails/raw.d.ts +0 -28
- package/dist/guardrails/raw.d.ts.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -746
- package/dist/index.js.map +0 -1
- package/dist/marker.d.ts +0 -13
- package/dist/marker.d.ts.map +0 -1
- package/dist/plugins/budgets.d.ts +0 -16
- package/dist/plugins/budgets.d.ts.map +0 -1
- package/dist/plugins/lints.d.ts +0 -11
- package/dist/plugins/lints.d.ts.map +0 -1
- package/dist/plugins/types.d.ts +0 -27
- package/dist/plugins/types.d.ts.map +0 -1
- package/dist/runtime-core.d.ts +0 -37
- package/dist/runtime-core.d.ts.map +0 -1
- package/dist/runtime-spi.d.ts +0 -14
- package/dist/runtime-spi.d.ts.map +0 -1
- package/src/plugins/lints.ts +0 -85
package/package.json
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/runtime-executor",
|
|
3
|
-
"version": "0.3.0-dev.
|
|
3
|
+
"version": "0.3.0-dev.91",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Target-agnostic execution engine for Prisma Next",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"arktype": "^2.1.25",
|
|
9
|
-
"@prisma-next/
|
|
10
|
-
"@prisma-next/
|
|
9
|
+
"@prisma-next/contract": "0.3.0-dev.91",
|
|
10
|
+
"@prisma-next/operations": "0.3.0-dev.91"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@prisma/dev": "0.19.1",
|
|
14
|
-
"
|
|
15
|
-
"tsup": "8.5.1",
|
|
14
|
+
"tsdown": "0.18.4",
|
|
16
15
|
"typescript": "5.9.3",
|
|
17
|
-
"vitest": "4.0.
|
|
16
|
+
"vitest": "4.0.17",
|
|
17
|
+
"@prisma-next/tsconfig": "0.0.0",
|
|
18
|
+
"@prisma-next/tsdown": "0.0.0",
|
|
18
19
|
"@prisma-next/test-utils": "0.0.1"
|
|
19
20
|
},
|
|
20
21
|
"files": [
|
|
@@ -22,19 +23,25 @@
|
|
|
22
23
|
"src"
|
|
23
24
|
],
|
|
24
25
|
"exports": {
|
|
25
|
-
".":
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
".": "./dist/index.mjs",
|
|
27
|
+
"./package.json": "./package.json"
|
|
28
|
+
},
|
|
29
|
+
"main": "./dist/index.mjs",
|
|
30
|
+
"module": "./dist/index.mjs",
|
|
31
|
+
"types": "./dist/index.d.mts",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/prisma/prisma-next.git",
|
|
35
|
+
"directory": "packages/1-framework/4-runtime-executor"
|
|
29
36
|
},
|
|
30
37
|
"scripts": {
|
|
31
|
-
"build": "
|
|
38
|
+
"build": "tsdown",
|
|
32
39
|
"test": "vitest run",
|
|
33
40
|
"test:coverage": "vitest run --coverage",
|
|
34
41
|
"typecheck": "tsc --project tsconfig.json --noEmit",
|
|
35
|
-
"lint": "biome check . --
|
|
36
|
-
"lint:fix": "biome check --write .
|
|
37
|
-
"lint:fix:unsafe": "biome check --write --unsafe .
|
|
38
|
-
"clean": "
|
|
42
|
+
"lint": "biome check . --error-on-warnings",
|
|
43
|
+
"lint:fix": "biome check --write .",
|
|
44
|
+
"lint:fix:unsafe": "biome check --write --unsafe .",
|
|
45
|
+
"clean": "rm -rf dist dist-tsc dist-tsc-prod coverage .tmp-output"
|
|
39
46
|
}
|
|
40
47
|
}
|
|
@@ -4,10 +4,11 @@ import { runtimeError } from './errors';
|
|
|
4
4
|
* Custom async iterable result that extends AsyncIterable with a toArray() method.
|
|
5
5
|
* This provides a convenient way to collect all results from an async iterator.
|
|
6
6
|
*/
|
|
7
|
-
export class AsyncIterableResult<Row> implements AsyncIterable<Row> {
|
|
7
|
+
export class AsyncIterableResult<Row> implements AsyncIterable<Row>, PromiseLike<Row[]> {
|
|
8
8
|
private readonly generator: AsyncGenerator<Row, void, unknown>;
|
|
9
9
|
private consumed = false;
|
|
10
|
-
private consumedBy: '
|
|
10
|
+
private consumedBy: 'bufferedArray' | 'iterator' | undefined;
|
|
11
|
+
private bufferedArrayPromise: Promise<Row[]> | undefined;
|
|
11
12
|
|
|
12
13
|
constructor(generator: AsyncGenerator<Row, void, unknown>) {
|
|
13
14
|
this.generator = generator;
|
|
@@ -17,11 +18,11 @@ export class AsyncIterableResult<Row> implements AsyncIterable<Row> {
|
|
|
17
18
|
if (this.consumed) {
|
|
18
19
|
throw runtimeError(
|
|
19
20
|
'RUNTIME.ITERATOR_CONSUMED',
|
|
20
|
-
`AsyncIterableResult iterator has already been consumed via ${this.consumedBy === '
|
|
21
|
+
`AsyncIterableResult iterator has already been consumed via ${this.consumedBy === 'bufferedArray' ? 'toArray()/then()' : 'for-await loop'}. Each AsyncIterableResult can only be iterated once.`,
|
|
21
22
|
{
|
|
22
23
|
consumedBy: this.consumedBy,
|
|
23
24
|
suggestion:
|
|
24
|
-
this.consumedBy === '
|
|
25
|
+
this.consumedBy === 'bufferedArray'
|
|
25
26
|
? 'If you need to iterate multiple times, store the results from toArray() in a variable and reuse that.'
|
|
26
27
|
: 'If you need to iterate multiple times, use toArray() to collect all results first.',
|
|
27
28
|
},
|
|
@@ -36,26 +37,42 @@ export class AsyncIterableResult<Row> implements AsyncIterable<Row> {
|
|
|
36
37
|
* Collects all values from the async iterator into an array.
|
|
37
38
|
* Once called, the iterator is consumed and cannot be reused.
|
|
38
39
|
*/
|
|
39
|
-
|
|
40
|
-
if (this.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
40
|
+
toArray(): Promise<Row[]> {
|
|
41
|
+
if (this.consumedBy === 'iterator') {
|
|
42
|
+
return Promise.reject(
|
|
43
|
+
runtimeError(
|
|
44
|
+
'RUNTIME.ITERATOR_CONSUMED',
|
|
45
|
+
'AsyncIterableResult iterator has already been consumed via for-await loop. Each AsyncIterableResult can only be iterated once.',
|
|
46
|
+
{
|
|
47
|
+
consumedBy: this.consumedBy,
|
|
48
|
+
suggestion:
|
|
49
|
+
'The iterator was already consumed by a for-await loop. Use toArray() or await the result before iterating.',
|
|
50
|
+
},
|
|
51
|
+
),
|
|
51
52
|
);
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
-
this.
|
|
55
|
-
|
|
56
|
-
for await (const item of this.generator) {
|
|
57
|
-
out.push(item);
|
|
54
|
+
|
|
55
|
+
if (this.bufferedArrayPromise) {
|
|
56
|
+
return this.bufferedArrayPromise;
|
|
58
57
|
}
|
|
59
|
-
|
|
58
|
+
|
|
59
|
+
this.consumed = true;
|
|
60
|
+
this.consumedBy = 'bufferedArray';
|
|
61
|
+
this.bufferedArrayPromise = (async () => {
|
|
62
|
+
const out: Row[] = [];
|
|
63
|
+
for await (const item of this.generator) {
|
|
64
|
+
out.push(item);
|
|
65
|
+
}
|
|
66
|
+
return out;
|
|
67
|
+
})();
|
|
68
|
+
return this.bufferedArrayPromise;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// biome-ignore lint/suspicious/noThenProperty: PromiseLike implementation is intentional for await support.
|
|
72
|
+
then<TResult1 = Row[], TResult2 = never>(
|
|
73
|
+
onfulfilled?: ((value: Row[]) => TResult1 | PromiseLike<TResult1>) | undefined | null,
|
|
74
|
+
onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | undefined | null,
|
|
75
|
+
): PromiseLike<TResult1 | TResult2> {
|
|
76
|
+
return this.toArray().then(onfulfilled, onrejected);
|
|
60
77
|
}
|
|
61
78
|
}
|
package/src/exports/index.ts
CHANGED
|
@@ -8,8 +8,6 @@ export type { ContractMarkerRecord } from '../marker';
|
|
|
8
8
|
export { parseContractMarkerRow } from '../marker';
|
|
9
9
|
export type { BudgetsOptions } from '../plugins/budgets';
|
|
10
10
|
export { budgets } from '../plugins/budgets';
|
|
11
|
-
export type { LintsOptions } from '../plugins/lints';
|
|
12
|
-
export { lints } from '../plugins/lints';
|
|
13
11
|
export type {
|
|
14
12
|
AfterExecuteResult,
|
|
15
13
|
Log,
|
|
@@ -18,9 +16,12 @@ export type {
|
|
|
18
16
|
Severity,
|
|
19
17
|
} from '../plugins/types';
|
|
20
18
|
export type {
|
|
19
|
+
RuntimeConnection,
|
|
21
20
|
RuntimeCore,
|
|
22
21
|
RuntimeCoreOptions,
|
|
22
|
+
RuntimeQueryable,
|
|
23
23
|
RuntimeTelemetryEvent,
|
|
24
|
+
RuntimeTransaction,
|
|
24
25
|
RuntimeVerifyOptions,
|
|
25
26
|
TelemetryOutcome,
|
|
26
27
|
} from '../runtime-core';
|
package/src/marker.ts
CHANGED
|
@@ -74,7 +74,7 @@ export function parseContractMarkerRow(row: unknown): ContractMarkerRecord {
|
|
|
74
74
|
: new Date();
|
|
75
75
|
|
|
76
76
|
return {
|
|
77
|
-
|
|
77
|
+
storageHash: validatedRow.core_hash,
|
|
78
78
|
profileHash: validatedRow.profile_hash,
|
|
79
79
|
contractJson: validatedRow.contract_json ?? null,
|
|
80
80
|
canonicalVersion: validatedRow.canonical_version ?? null,
|
package/src/plugins/budgets.ts
CHANGED
|
@@ -119,10 +119,6 @@ function estimateRows(
|
|
|
119
119
|
tableRows: Record<string, number>,
|
|
120
120
|
defaultTableRows: number,
|
|
121
121
|
): number | null {
|
|
122
|
-
if (!plan.ast) {
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
122
|
const table = plan.meta.refs?.tables?.[0];
|
|
127
123
|
if (!table) {
|
|
128
124
|
return null;
|
|
@@ -130,34 +126,19 @@ function estimateRows(
|
|
|
130
126
|
|
|
131
127
|
const tableEstimate = tableRows[table] ?? defaultTableRows;
|
|
132
128
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
typeof plan.ast.limit === 'number'
|
|
140
|
-
) {
|
|
141
|
-
return Math.min(plan.ast.limit, tableEstimate);
|
|
129
|
+
// TODO: this is really not great. It should instead walk the AST.
|
|
130
|
+
// It also doesn't check in any way that this limit correlates with the current table.
|
|
131
|
+
// Move this plugin to a higher level (close to the linter) and use AST visitors.
|
|
132
|
+
const limit = plan.meta.annotations?.['limit'];
|
|
133
|
+
if (typeof limit === 'number') {
|
|
134
|
+
return Math.min(limit, tableEstimate);
|
|
142
135
|
}
|
|
143
136
|
|
|
144
137
|
return tableEstimate;
|
|
145
138
|
}
|
|
146
139
|
|
|
147
140
|
function hasDetectableLimit(plan: ExecutionPlan): boolean {
|
|
148
|
-
|
|
149
|
-
plan.ast &&
|
|
150
|
-
typeof plan.ast === 'object' &&
|
|
151
|
-
'kind' in plan.ast &&
|
|
152
|
-
plan.ast.kind === 'select' &&
|
|
153
|
-
'limit' in plan.ast &&
|
|
154
|
-
typeof plan.ast.limit === 'number'
|
|
155
|
-
) {
|
|
156
|
-
return true;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const annotations = plan.meta.annotations as { limit?: number; LIMIT?: number } | undefined;
|
|
160
|
-
return typeof annotations?.limit === 'number' || typeof annotations?.LIMIT === 'number';
|
|
141
|
+
return typeof plan.meta.annotations?.['limit'] === 'number';
|
|
161
142
|
}
|
|
162
143
|
|
|
163
144
|
export function budgets<TContract = unknown, TAdapter = unknown, TDriver = unknown>(
|
package/src/runtime-core.ts
CHANGED
|
@@ -32,22 +32,51 @@ export interface RuntimeCoreOptions<TContract = unknown, TAdapter = unknown, TDr
|
|
|
32
32
|
readonly operationRegistry: OperationRegistry;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export interface RuntimeCore<TContract = unknown, TAdapter = unknown, TDriver = unknown>
|
|
35
|
+
export interface RuntimeCore<TContract = unknown, TAdapter = unknown, TDriver = unknown>
|
|
36
|
+
extends RuntimeQueryable {
|
|
36
37
|
// Type parameters are used in the implementation for type safety
|
|
37
38
|
readonly _typeContract?: TContract;
|
|
38
39
|
readonly _typeAdapter?: TAdapter;
|
|
39
40
|
readonly _typeDriver?: TDriver;
|
|
40
|
-
|
|
41
|
+
connection(): Promise<RuntimeConnection>;
|
|
41
42
|
telemetry(): RuntimeTelemetryEvent | null;
|
|
42
43
|
close(): Promise<void>;
|
|
43
44
|
operations(): OperationRegistry;
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
export interface RuntimeConnection extends RuntimeQueryable {
|
|
48
|
+
transaction(): Promise<RuntimeTransaction>;
|
|
49
|
+
release(): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface RuntimeTransaction extends RuntimeQueryable {
|
|
53
|
+
commit(): Promise<void>;
|
|
54
|
+
rollback(): Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface RuntimeQueryable {
|
|
58
|
+
execute<Row = Record<string, unknown>>(plan: ExecutionPlan<Row>): AsyncIterableResult<Row>;
|
|
59
|
+
}
|
|
60
|
+
|
|
46
61
|
interface DriverWithQuery<_TDriver> {
|
|
47
62
|
query(sql: string, params: readonly unknown[]): Promise<{ rows: ReadonlyArray<unknown> }>;
|
|
48
63
|
}
|
|
49
64
|
|
|
50
|
-
interface
|
|
65
|
+
interface DriverWithConnection<_TDriver> {
|
|
66
|
+
acquireConnection(): Promise<DriverConnection>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface DriverConnection extends Queryable {
|
|
70
|
+
beginTransaction(): Promise<DriverTransaction>;
|
|
71
|
+
release(): Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface DriverTransaction extends Queryable {
|
|
75
|
+
commit(): Promise<void>;
|
|
76
|
+
rollback(): Promise<void>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface Queryable {
|
|
51
80
|
execute<Row = Record<string, unknown>>(options: {
|
|
52
81
|
sql: string;
|
|
53
82
|
params: readonly unknown[];
|
|
@@ -136,12 +165,20 @@ class RuntimeCoreImpl<TContract = unknown, TAdapter = unknown, TDriver = unknown
|
|
|
136
165
|
|
|
137
166
|
const marker = parseContractMarkerRow(result.rows[0]);
|
|
138
167
|
|
|
139
|
-
const contract = this.contract as {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
168
|
+
const contract = this.contract as {
|
|
169
|
+
storageHash: string;
|
|
170
|
+
executionHash?: string | null;
|
|
171
|
+
profileHash?: string | null;
|
|
172
|
+
};
|
|
173
|
+
if (marker.storageHash !== contract.storageHash) {
|
|
174
|
+
throw runtimeError(
|
|
175
|
+
'CONTRACT.MARKER_MISMATCH',
|
|
176
|
+
'Database storage hash does not match contract',
|
|
177
|
+
{
|
|
178
|
+
expected: contract.storageHash,
|
|
179
|
+
actual: marker.storageHash,
|
|
180
|
+
},
|
|
181
|
+
);
|
|
145
182
|
}
|
|
146
183
|
|
|
147
184
|
const expectedProfile = contract.profileHash ?? null;
|
|
@@ -180,6 +217,63 @@ class RuntimeCoreImpl<TContract = unknown, TAdapter = unknown, TDriver = unknown
|
|
|
180
217
|
}
|
|
181
218
|
|
|
182
219
|
execute<Row = Record<string, unknown>>(plan: ExecutionPlan<Row>): AsyncIterableResult<Row> {
|
|
220
|
+
return this.#executeWith(plan, this.driver as Queryable);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
async connection(): Promise<RuntimeConnection> {
|
|
224
|
+
const driver = this.driver as unknown as DriverWithConnection<TDriver>;
|
|
225
|
+
const driverConn = await driver.acquireConnection();
|
|
226
|
+
const self = this;
|
|
227
|
+
|
|
228
|
+
const runtimeConnection: RuntimeConnection = {
|
|
229
|
+
async transaction(): Promise<RuntimeTransaction> {
|
|
230
|
+
const driverTx = await driverConn.beginTransaction();
|
|
231
|
+
const runtimeTx: RuntimeTransaction = {
|
|
232
|
+
async commit(): Promise<void> {
|
|
233
|
+
await driverTx.commit();
|
|
234
|
+
},
|
|
235
|
+
async rollback(): Promise<void> {
|
|
236
|
+
await driverTx.rollback();
|
|
237
|
+
},
|
|
238
|
+
execute<Row = Record<string, unknown>>(
|
|
239
|
+
plan: ExecutionPlan<Row>,
|
|
240
|
+
): AsyncIterableResult<Row> {
|
|
241
|
+
return self.#executeWith(plan, driverTx);
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
return runtimeTx;
|
|
245
|
+
},
|
|
246
|
+
execute<Row = Record<string, unknown>>(plan: ExecutionPlan<Row>): AsyncIterableResult<Row> {
|
|
247
|
+
return self.#executeWith(plan, driverConn);
|
|
248
|
+
},
|
|
249
|
+
async release(): Promise<void> {
|
|
250
|
+
await driverConn.release();
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
return runtimeConnection;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
telemetry(): RuntimeTelemetryEvent | null {
|
|
258
|
+
return this._telemetry;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
operations(): OperationRegistry {
|
|
262
|
+
return this.operationRegistry;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
close(): Promise<void> {
|
|
266
|
+
const driver = this.driver as unknown as DriverWithClose<TDriver>;
|
|
267
|
+
if (typeof driver.close === 'function') {
|
|
268
|
+
return driver.close();
|
|
269
|
+
}
|
|
270
|
+
return Promise.resolve();
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
#executeWith<Row = Record<string, unknown>>(
|
|
274
|
+
plan: ExecutionPlan<Row>,
|
|
275
|
+
queryable: Queryable,
|
|
276
|
+
): AsyncIterableResult<Row> {
|
|
183
277
|
this.validatePlan(plan);
|
|
184
278
|
this._telemetry = null;
|
|
185
279
|
|
|
@@ -209,10 +303,9 @@ class RuntimeCoreImpl<TContract = unknown, TAdapter = unknown, TDriver = unknown
|
|
|
209
303
|
}
|
|
210
304
|
}
|
|
211
305
|
|
|
212
|
-
const
|
|
213
|
-
const encodedParams = plan.params as readonly unknown[];
|
|
306
|
+
const encodedParams = plan.params;
|
|
214
307
|
|
|
215
|
-
for await (const row of
|
|
308
|
+
for await (const row of queryable.execute<Record<string, unknown>>({
|
|
216
309
|
sql: plan.sql,
|
|
217
310
|
params: encodedParams,
|
|
218
311
|
})) {
|
|
@@ -260,22 +353,6 @@ class RuntimeCoreImpl<TContract = unknown, TAdapter = unknown, TDriver = unknown
|
|
|
260
353
|
|
|
261
354
|
return new AsyncIterableResult(iterator(this));
|
|
262
355
|
}
|
|
263
|
-
|
|
264
|
-
telemetry(): RuntimeTelemetryEvent | null {
|
|
265
|
-
return this._telemetry;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
operations(): OperationRegistry {
|
|
269
|
-
return this.operationRegistry;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
close(): Promise<void> {
|
|
273
|
-
const driver = this.driver as unknown as DriverWithClose<TDriver>;
|
|
274
|
-
if (typeof driver.close === 'function') {
|
|
275
|
-
return driver.close();
|
|
276
|
-
}
|
|
277
|
-
return Promise.resolve();
|
|
278
|
-
}
|
|
279
356
|
}
|
|
280
357
|
|
|
281
358
|
export function createRuntimeCore<TContract = unknown, TAdapter = unknown, TDriver = unknown>(
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom async iterable result that extends AsyncIterable with a toArray() method.
|
|
3
|
-
* This provides a convenient way to collect all results from an async iterator.
|
|
4
|
-
*/
|
|
5
|
-
export declare class AsyncIterableResult<Row> implements AsyncIterable<Row> {
|
|
6
|
-
private readonly generator;
|
|
7
|
-
private consumed;
|
|
8
|
-
private consumedBy;
|
|
9
|
-
constructor(generator: AsyncGenerator<Row, void, unknown>);
|
|
10
|
-
[Symbol.asyncIterator](): AsyncIterator<Row>;
|
|
11
|
-
/**
|
|
12
|
-
* Collects all values from the async iterator into an array.
|
|
13
|
-
* Once called, the iterator is consumed and cannot be reused.
|
|
14
|
-
*/
|
|
15
|
-
toArray(): Promise<Row[]>;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=async-iterable-result.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async-iterable-result.d.ts","sourceRoot":"","sources":["../src/async-iterable-result.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,qBAAa,mBAAmB,CAAC,GAAG,CAAE,YAAW,aAAa,CAAC,GAAG,CAAC;IACjE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqC;IAC/D,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAAqC;gBAE3C,SAAS,EAAE,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC;IAIzD,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC;IAmB5C;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;CAsBhC"}
|
package/dist/errors.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export interface RuntimeErrorEnvelope extends Error {
|
|
2
|
-
readonly code: string;
|
|
3
|
-
readonly category: 'PLAN' | 'CONTRACT' | 'LINT' | 'BUDGET' | 'RUNTIME';
|
|
4
|
-
readonly severity: 'error';
|
|
5
|
-
readonly details?: Record<string, unknown>;
|
|
6
|
-
}
|
|
7
|
-
export declare function runtimeError(code: string, message: string, details?: Record<string, unknown>): RuntimeErrorEnvelope;
|
|
8
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAqB,SAAQ,KAAK;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;IACvE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,oBAAoB,CActB"}
|
package/dist/exports/index.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export { AsyncIterableResult } from '../async-iterable-result';
|
|
2
|
-
export type { RuntimeErrorEnvelope } from '../errors';
|
|
3
|
-
export { runtimeError } from '../errors';
|
|
4
|
-
export { computeSqlFingerprint } from '../fingerprint';
|
|
5
|
-
export type { BudgetFinding, LintFinding, RawGuardrailResult } from '../guardrails/raw';
|
|
6
|
-
export { evaluateRawGuardrails } from '../guardrails/raw';
|
|
7
|
-
export type { ContractMarkerRecord } from '../marker';
|
|
8
|
-
export { parseContractMarkerRow } from '../marker';
|
|
9
|
-
export type { BudgetsOptions } from '../plugins/budgets';
|
|
10
|
-
export { budgets } from '../plugins/budgets';
|
|
11
|
-
export type { LintsOptions } from '../plugins/lints';
|
|
12
|
-
export { lints } from '../plugins/lints';
|
|
13
|
-
export type { AfterExecuteResult, Log, Plugin, PluginContext, Severity, } from '../plugins/types';
|
|
14
|
-
export type { RuntimeCore, RuntimeCoreOptions, RuntimeTelemetryEvent, RuntimeVerifyOptions, TelemetryOutcome, } from '../runtime-core';
|
|
15
|
-
export { createRuntimeCore } from '../runtime-core';
|
|
16
|
-
export type { MarkerReader, MarkerStatement, RuntimeFamilyAdapter } from '../runtime-spi';
|
|
17
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,YAAY,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,YAAY,EACV,kBAAkB,EAClB,GAAG,EACH,MAAM,EACN,aAAa,EACb,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,WAAW,EACX,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/fingerprint.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fingerprint.d.ts","sourceRoot":"","sources":["../src/fingerprint.ts"],"names":[],"mappings":"AAMA,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAOzD"}
|
package/dist/guardrails/raw.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { ExecutionPlan } from '@prisma-next/contract/types';
|
|
2
|
-
export type LintSeverity = 'error' | 'warn';
|
|
3
|
-
export type BudgetSeverity = 'error' | 'warn';
|
|
4
|
-
export interface LintFinding {
|
|
5
|
-
readonly code: `LINT.${string}`;
|
|
6
|
-
readonly severity: LintSeverity;
|
|
7
|
-
readonly message: string;
|
|
8
|
-
readonly details?: Record<string, unknown>;
|
|
9
|
-
}
|
|
10
|
-
export interface BudgetFinding {
|
|
11
|
-
readonly code: `BUDGET.${string}`;
|
|
12
|
-
readonly severity: BudgetSeverity;
|
|
13
|
-
readonly message: string;
|
|
14
|
-
readonly details?: Record<string, unknown>;
|
|
15
|
-
}
|
|
16
|
-
export interface RawGuardrailConfig {
|
|
17
|
-
readonly budgets?: {
|
|
18
|
-
readonly unboundedSelectSeverity?: BudgetSeverity;
|
|
19
|
-
readonly estimatedRows?: number;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export interface RawGuardrailResult {
|
|
23
|
-
readonly lints: LintFinding[];
|
|
24
|
-
readonly budgets: BudgetFinding[];
|
|
25
|
-
readonly statement: 'select' | 'mutation' | 'other';
|
|
26
|
-
}
|
|
27
|
-
export declare function evaluateRawGuardrails(plan: ExecutionPlan, config?: RawGuardrailConfig): RawGuardrailResult;
|
|
28
|
-
//# sourceMappingURL=raw.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"raw.d.ts","sourceRoot":"","sources":["../../src/guardrails/raw.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAsB,MAAM,6BAA6B,CAAC;AAErF,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,CAAC;AAC5C,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,CAAC;AAE9C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,QAAQ,MAAM,EAAE,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,UAAU,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE;QACjB,QAAQ,CAAC,uBAAuB,CAAC,EAAE,cAAc,CAAC;QAClD,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;KACjC,CAAC;CACH;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;CACrD;AAQD,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,aAAa,EACnB,MAAM,CAAC,EAAE,kBAAkB,GAC1B,kBAAkB,CA4DpB"}
|
package/dist/index.d.ts
DELETED
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,WAAW,CAAC"}
|