@prisma/query-plan-executor 7.10.0-dev.4 → 7.10.0-dev.40
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/index.d.ts +102 -82
- package/dist/index.js +2795 -1197
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1645,6 +1645,21 @@ declare interface HTTPResponseError extends Error {
|
|
|
1645
1645
|
|
|
1646
1646
|
declare type IfAnyThenEmptyObject<T> = 0 extends 1 & T ? {} : T;
|
|
1647
1647
|
|
|
1648
|
+
/**
|
|
1649
|
+
* Query plan nodes that perform database I/O: individual queries and statements,
|
|
1650
|
+
* and subtrees executed within a transaction.
|
|
1651
|
+
*/
|
|
1652
|
+
declare type ImpureQueryPlanNode = {
|
|
1653
|
+
type: 'query';
|
|
1654
|
+
args: QueryPlanDbQuery;
|
|
1655
|
+
} | {
|
|
1656
|
+
type: 'execute';
|
|
1657
|
+
args: QueryPlanDbQuery;
|
|
1658
|
+
} | {
|
|
1659
|
+
type: 'transaction';
|
|
1660
|
+
args: QueryPlanNode;
|
|
1661
|
+
};
|
|
1662
|
+
|
|
1648
1663
|
/**
|
|
1649
1664
|
* Logs an informational message using the active logger.
|
|
1650
1665
|
*
|
|
@@ -1690,13 +1705,6 @@ declare type IsInvalid<T> = T extends InvalidJSONValue ? true : false;
|
|
|
1690
1705
|
|
|
1691
1706
|
declare type IsolationLevel = 'READ UNCOMMITTED' | 'READ COMMITTED' | 'REPEATABLE READ' | 'SNAPSHOT' | 'SERIALIZABLE';
|
|
1692
1707
|
|
|
1693
|
-
declare type JoinExpression = {
|
|
1694
|
-
child: QueryPlanNode;
|
|
1695
|
-
on: [left: string, right: string][];
|
|
1696
|
-
parentField: string;
|
|
1697
|
-
isRelationUnique: boolean;
|
|
1698
|
-
};
|
|
1699
|
-
|
|
1700
1708
|
declare type JSONArray = (JSONPrimitive | JSONObject | JSONArray)[];
|
|
1701
1709
|
|
|
1702
1710
|
declare type JSONObject = {
|
|
@@ -2403,57 +2411,23 @@ declare type PropsForRenderer = [...Required<Parameters<Renderer>>] extends [unk
|
|
|
2403
2411
|
declare type Provider = 'mysql' | 'postgres' | 'sqlite' | 'sqlserver';
|
|
2404
2412
|
|
|
2405
2413
|
/**
|
|
2406
|
-
*
|
|
2407
|
-
*
|
|
2408
|
-
*
|
|
2409
|
-
*
|
|
2410
|
-
*
|
|
2414
|
+
* Query plan nodes that are free of side effects and can be interpreted synchronously
|
|
2415
|
+
* without touching the database. The `Rest` parameter controls what other nodes may
|
|
2416
|
+
* appear in child positions: with the default `never` the tree is fully pure, while
|
|
2417
|
+
* `PureQueryPlanNode<ImpureQueryPlanNode>` describes a tree of pure nodes that may
|
|
2418
|
+
* contain impure nodes anywhere inside.
|
|
2411
2419
|
*/
|
|
2412
|
-
declare
|
|
2413
|
-
|
|
2414
|
-
declare interface Queryable<Query, Result> extends AdapterInfo {
|
|
2415
|
-
/**
|
|
2416
|
-
* Execute a query and return its result.
|
|
2417
|
-
*/
|
|
2418
|
-
queryRaw(params: Query): Promise<Result>;
|
|
2419
|
-
/**
|
|
2420
|
-
* Execute a query and return the number of affected rows.
|
|
2421
|
-
*/
|
|
2422
|
-
executeRaw(params: Query): Promise<number>;
|
|
2423
|
-
}
|
|
2424
|
-
|
|
2425
|
-
declare type QueryEvent = {
|
|
2426
|
-
timestamp: Date;
|
|
2427
|
-
query: string;
|
|
2428
|
-
params: readonly unknown[];
|
|
2429
|
-
duration: number;
|
|
2430
|
-
};
|
|
2431
|
-
|
|
2432
|
-
declare type QueryPlanBinding = {
|
|
2433
|
-
name: string;
|
|
2434
|
-
expr: QueryPlanNode;
|
|
2435
|
-
};
|
|
2436
|
-
|
|
2437
|
-
declare type QueryPlanDbQuery = {
|
|
2438
|
-
type: 'rawSql';
|
|
2439
|
-
sql: string;
|
|
2440
|
-
args: PrismaValue[];
|
|
2441
|
-
argTypes: ArgType[];
|
|
2442
|
-
} | {
|
|
2443
|
-
type: 'templateSql';
|
|
2444
|
-
fragments: Fragment[];
|
|
2445
|
-
placeholderFormat: PlaceholderFormat;
|
|
2446
|
-
args: PrismaValue[];
|
|
2447
|
-
argTypes: DynamicArgType[];
|
|
2448
|
-
chunkable: boolean;
|
|
2449
|
-
};
|
|
2450
|
-
|
|
2451
|
-
declare type QueryPlanNode = {
|
|
2420
|
+
declare type PureQueryPlanNode<Rest = never> = {
|
|
2452
2421
|
type: 'value';
|
|
2453
2422
|
args: PrismaValue;
|
|
2423
|
+
/**
|
|
2424
|
+
* Present when this node is the result of evaluating an impure node during
|
|
2425
|
+
* query plan purification. Never produced by the query compiler.
|
|
2426
|
+
*/
|
|
2427
|
+
lastInsertId?: string;
|
|
2454
2428
|
} | {
|
|
2455
2429
|
type: 'seq';
|
|
2456
|
-
args:
|
|
2430
|
+
args: (PureQueryPlanNode<Rest> | Rest)[];
|
|
2457
2431
|
} | {
|
|
2458
2432
|
type: 'get';
|
|
2459
2433
|
args: {
|
|
@@ -2462,101 +2436,147 @@ declare type QueryPlanNode = {
|
|
|
2462
2436
|
} | {
|
|
2463
2437
|
type: 'let';
|
|
2464
2438
|
args: {
|
|
2465
|
-
bindings:
|
|
2466
|
-
|
|
2439
|
+
bindings: {
|
|
2440
|
+
name: string;
|
|
2441
|
+
expr: PureQueryPlanNode<Rest> | Rest;
|
|
2442
|
+
}[];
|
|
2443
|
+
expr: PureQueryPlanNode<Rest> | Rest;
|
|
2467
2444
|
};
|
|
2468
2445
|
} | {
|
|
2469
2446
|
type: 'getFirstNonEmpty';
|
|
2470
2447
|
args: {
|
|
2471
2448
|
names: string[];
|
|
2472
2449
|
};
|
|
2473
|
-
} | {
|
|
2474
|
-
type: 'query';
|
|
2475
|
-
args: QueryPlanDbQuery;
|
|
2476
|
-
} | {
|
|
2477
|
-
type: 'execute';
|
|
2478
|
-
args: QueryPlanDbQuery;
|
|
2479
2450
|
} | {
|
|
2480
2451
|
type: 'reverse';
|
|
2481
|
-
args:
|
|
2452
|
+
args: PureQueryPlanNode<Rest> | Rest;
|
|
2482
2453
|
} | {
|
|
2483
2454
|
type: 'sum';
|
|
2484
|
-
args:
|
|
2455
|
+
args: (PureQueryPlanNode<Rest> | Rest)[];
|
|
2485
2456
|
} | {
|
|
2486
2457
|
type: 'concat';
|
|
2487
|
-
args:
|
|
2458
|
+
args: (PureQueryPlanNode<Rest> | Rest)[];
|
|
2488
2459
|
} | {
|
|
2489
2460
|
type: 'unique';
|
|
2490
|
-
args:
|
|
2461
|
+
args: PureQueryPlanNode<Rest> | Rest;
|
|
2491
2462
|
} | {
|
|
2492
2463
|
type: 'required';
|
|
2493
|
-
args:
|
|
2464
|
+
args: PureQueryPlanNode<Rest> | Rest;
|
|
2494
2465
|
} | {
|
|
2495
2466
|
type: 'join';
|
|
2496
2467
|
args: {
|
|
2497
|
-
parent:
|
|
2498
|
-
children:
|
|
2468
|
+
parent: PureQueryPlanNode<Rest> | Rest;
|
|
2469
|
+
children: {
|
|
2470
|
+
child: PureQueryPlanNode<Rest> | Rest;
|
|
2471
|
+
on: [left: string, right: string][];
|
|
2472
|
+
parentField: string;
|
|
2473
|
+
isRelationUnique: boolean;
|
|
2474
|
+
}[];
|
|
2499
2475
|
canAssumeStrictEquality: boolean;
|
|
2500
2476
|
};
|
|
2501
2477
|
} | {
|
|
2502
2478
|
type: 'mapField';
|
|
2503
2479
|
args: {
|
|
2504
2480
|
field: string;
|
|
2505
|
-
records:
|
|
2481
|
+
records: PureQueryPlanNode<Rest> | Rest;
|
|
2506
2482
|
};
|
|
2507
|
-
} | {
|
|
2508
|
-
type: 'transaction';
|
|
2509
|
-
args: QueryPlanNode;
|
|
2510
2483
|
} | {
|
|
2511
2484
|
type: 'dataMap';
|
|
2512
2485
|
args: {
|
|
2513
|
-
expr:
|
|
2486
|
+
expr: PureQueryPlanNode<Rest> | Rest;
|
|
2514
2487
|
structure: ResultNode;
|
|
2515
2488
|
enums: Record<string, Record<string, string>>;
|
|
2516
2489
|
};
|
|
2517
2490
|
} | {
|
|
2518
2491
|
type: 'validate';
|
|
2519
2492
|
args: {
|
|
2520
|
-
expr:
|
|
2493
|
+
expr: PureQueryPlanNode<Rest> | Rest;
|
|
2521
2494
|
rules: DataRule[];
|
|
2522
2495
|
} & ValidationError;
|
|
2523
2496
|
} | {
|
|
2524
2497
|
type: 'if';
|
|
2525
2498
|
args: {
|
|
2526
|
-
value:
|
|
2499
|
+
value: PureQueryPlanNode<Rest> | Rest;
|
|
2527
2500
|
rule: DataRule;
|
|
2528
|
-
then:
|
|
2529
|
-
else:
|
|
2501
|
+
then: PureQueryPlanNode<Rest> | Rest;
|
|
2502
|
+
else: PureQueryPlanNode<Rest> | Rest;
|
|
2530
2503
|
};
|
|
2531
2504
|
} | {
|
|
2532
2505
|
type: 'unit';
|
|
2533
2506
|
} | {
|
|
2534
2507
|
type: 'diff';
|
|
2535
2508
|
args: {
|
|
2536
|
-
from:
|
|
2537
|
-
to:
|
|
2509
|
+
from: PureQueryPlanNode<Rest> | Rest;
|
|
2510
|
+
to: PureQueryPlanNode<Rest> | Rest;
|
|
2538
2511
|
fields: string[];
|
|
2539
2512
|
};
|
|
2540
2513
|
} | {
|
|
2541
2514
|
type: 'initializeRecord';
|
|
2542
2515
|
args: {
|
|
2543
|
-
expr:
|
|
2516
|
+
expr: PureQueryPlanNode<Rest> | Rest;
|
|
2544
2517
|
fields: Record<string, FieldInitializer>;
|
|
2545
2518
|
};
|
|
2546
2519
|
} | {
|
|
2547
2520
|
type: 'mapRecord';
|
|
2548
2521
|
args: {
|
|
2549
|
-
expr:
|
|
2522
|
+
expr: PureQueryPlanNode<Rest> | Rest;
|
|
2550
2523
|
fields: Record<string, FieldOperation>;
|
|
2551
2524
|
};
|
|
2552
2525
|
} | {
|
|
2553
2526
|
type: 'process';
|
|
2554
2527
|
args: {
|
|
2555
|
-
expr:
|
|
2528
|
+
expr: PureQueryPlanNode<Rest> | Rest;
|
|
2556
2529
|
operations: InMemoryOps;
|
|
2557
2530
|
};
|
|
2558
2531
|
};
|
|
2559
2532
|
|
|
2533
|
+
/**
|
|
2534
|
+
* Logs a database query event using the active logger.
|
|
2535
|
+
*
|
|
2536
|
+
* @param message The message to log
|
|
2537
|
+
* @param attributes Optional key-value pairs to include with the log event
|
|
2538
|
+
* @throws {Error} if no active logger is found
|
|
2539
|
+
*/
|
|
2540
|
+
declare function query(message: string, attributes?: ExtendedAttributes): void;
|
|
2541
|
+
|
|
2542
|
+
declare interface Queryable<Query, Result> extends AdapterInfo {
|
|
2543
|
+
/**
|
|
2544
|
+
* Execute a query and return its result.
|
|
2545
|
+
*/
|
|
2546
|
+
queryRaw(params: Query): Promise<Result>;
|
|
2547
|
+
/**
|
|
2548
|
+
* Execute a query and return the number of affected rows.
|
|
2549
|
+
*/
|
|
2550
|
+
executeRaw(params: Query): Promise<number>;
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
declare type QueryEvent = {
|
|
2554
|
+
timestamp: Date;
|
|
2555
|
+
query: string;
|
|
2556
|
+
params: readonly unknown[];
|
|
2557
|
+
duration: number;
|
|
2558
|
+
};
|
|
2559
|
+
|
|
2560
|
+
declare type QueryPlanDbQuery = {
|
|
2561
|
+
type: 'rawSql';
|
|
2562
|
+
sql: string;
|
|
2563
|
+
args: PrismaValue[];
|
|
2564
|
+
argTypes: ArgType[];
|
|
2565
|
+
} | {
|
|
2566
|
+
type: 'templateSql';
|
|
2567
|
+
fragments: Fragment[];
|
|
2568
|
+
placeholderFormat: PlaceholderFormat;
|
|
2569
|
+
args: PrismaValue[];
|
|
2570
|
+
argTypes: DynamicArgType[];
|
|
2571
|
+
chunkable: boolean;
|
|
2572
|
+
};
|
|
2573
|
+
|
|
2574
|
+
/**
|
|
2575
|
+
* A query plan as emitted by the query compiler: a tree of pure nodes that may
|
|
2576
|
+
* contain impure nodes anywhere inside.
|
|
2577
|
+
*/
|
|
2578
|
+
declare type QueryPlanNode = ImpureQueryPlanNode | PureQueryPlanNode<ImpureQueryPlanNode>;
|
|
2579
|
+
|
|
2560
2580
|
declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
|
|
2561
2581
|
|
|
2562
2582
|
declare type RemoveBlankRecord<T> = T extends Record<infer K, unknown> ? (K extends string ? T : never) : never;
|