@prisma/query-plan-executor 7.5.0-dev.30 → 7.5.0-dev.32
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 +2 -1
- package/dist/index.js +54 -11
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -2414,7 +2414,7 @@ declare interface Queryable<Query, Result> extends AdapterInfo {
|
|
|
2414
2414
|
declare type QueryEvent = {
|
|
2415
2415
|
timestamp: Date;
|
|
2416
2416
|
query: string;
|
|
2417
|
-
params: unknown[];
|
|
2417
|
+
params: readonly unknown[];
|
|
2418
2418
|
duration: number;
|
|
2419
2419
|
};
|
|
2420
2420
|
|
|
@@ -2485,6 +2485,7 @@ declare type QueryPlanNode = {
|
|
|
2485
2485
|
args: {
|
|
2486
2486
|
parent: QueryPlanNode;
|
|
2487
2487
|
children: JoinExpression[];
|
|
2488
|
+
canAssumeStrictEquality: boolean;
|
|
2488
2489
|
};
|
|
2489
2490
|
} | {
|
|
2490
2491
|
type: 'mapField';
|
package/dist/index.js
CHANGED
|
@@ -101325,7 +101325,7 @@ __export(index_exports, {
|
|
|
101325
101325
|
module.exports = __toCommonJS(index_exports);
|
|
101326
101326
|
|
|
101327
101327
|
// package.json
|
|
101328
|
-
var version = "7.5.0-dev.
|
|
101328
|
+
var version = "7.5.0-dev.32";
|
|
101329
101329
|
|
|
101330
101330
|
// ../../node_modules/.pnpm/temporal-polyfill@0.3.0/node_modules/temporal-polyfill/chunks/internal.js
|
|
101331
101331
|
function clampProp(e2, n2, t2, o2, r2) {
|
|
@@ -110498,8 +110498,11 @@ function paginateSingleList(list, { cursor, skip, take }) {
|
|
|
110498
110498
|
const end = take !== null ? start + take : list.length;
|
|
110499
110499
|
return list.slice(start, end);
|
|
110500
110500
|
}
|
|
110501
|
-
function getRecordKey(record2, fields) {
|
|
110502
|
-
|
|
110501
|
+
function getRecordKey(record2, fields, mappers) {
|
|
110502
|
+
const array2 = fields.map(
|
|
110503
|
+
(field, index) => mappers?.[index] ? record2[field] !== null ? mappers[index](record2[field]) : null : record2[field]
|
|
110504
|
+
);
|
|
110505
|
+
return JSON.stringify(array2);
|
|
110503
110506
|
}
|
|
110504
110507
|
function isPrismaValuePlaceholder(value) {
|
|
110505
110508
|
return typeof value === "object" && value !== null && value["prisma__type"] === "param";
|
|
@@ -111080,7 +111083,7 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
111080
111083
|
sum2 += await this.#withQuerySpanAndEvent(
|
|
111081
111084
|
commentedQuery,
|
|
111082
111085
|
context2.queryable,
|
|
111083
|
-
() => context2.queryable.executeRaw(commentedQuery).catch(
|
|
111086
|
+
() => context2.queryable.executeRaw(cloneObject(commentedQuery)).catch(
|
|
111084
111087
|
(err) => node.args.type === "rawSql" ? rethrowAsUserFacingRawError(err) : rethrowAsUserFacing(err)
|
|
111085
111088
|
)
|
|
111086
111089
|
);
|
|
@@ -111095,7 +111098,7 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
111095
111098
|
const result = await this.#withQuerySpanAndEvent(
|
|
111096
111099
|
commentedQuery,
|
|
111097
111100
|
context2.queryable,
|
|
111098
|
-
() => context2.queryable.queryRaw(commentedQuery).catch(
|
|
111101
|
+
() => context2.queryable.queryRaw(cloneObject(commentedQuery)).catch(
|
|
111099
111102
|
(err) => node.args.type === "rawSql" ? rethrowAsUserFacingRawError(err) : rethrowAsUserFacing(err)
|
|
111100
111103
|
)
|
|
111101
111104
|
);
|
|
@@ -111147,7 +111150,7 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
111147
111150
|
childRecords: (await this.interpretNode(joinExpr.child, context2)).value
|
|
111148
111151
|
}))
|
|
111149
111152
|
);
|
|
111150
|
-
return { value: attachChildrenToParents(parent, children), lastInsertId };
|
|
111153
|
+
return { value: attachChildrenToParents(parent, children, node.args.canAssumeStrictEquality), lastInsertId };
|
|
111151
111154
|
}
|
|
111152
111155
|
case "transaction": {
|
|
111153
111156
|
if (!context2.transactionManager.enabled) {
|
|
@@ -111194,8 +111197,9 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
111194
111197
|
}
|
|
111195
111198
|
case "process": {
|
|
111196
111199
|
const { value, lastInsertId } = await this.interpretNode(node.args.expr, context2);
|
|
111197
|
-
|
|
111198
|
-
|
|
111200
|
+
const ops = cloneObject(node.args.operations);
|
|
111201
|
+
evaluateProcessingParameters(ops, context2.scope, context2.generators);
|
|
111202
|
+
return { value: processRecords(value, ops), lastInsertId };
|
|
111199
111203
|
}
|
|
111200
111204
|
case "initializeRecord": {
|
|
111201
111205
|
const { lastInsertId } = await this.interpretNode(node.args.expr, context2);
|
|
@@ -111288,12 +111292,13 @@ function mapField2(value, field) {
|
|
|
111288
111292
|
}
|
|
111289
111293
|
return value;
|
|
111290
111294
|
}
|
|
111291
|
-
function attachChildrenToParents(parentRecords, children) {
|
|
111295
|
+
function attachChildrenToParents(parentRecords, children, canAssumeStrictEquality) {
|
|
111292
111296
|
for (const { joinExpr, childRecords } of children) {
|
|
111293
111297
|
const parentKeys = joinExpr.on.map(([k2]) => k2);
|
|
111294
111298
|
const childKeys = joinExpr.on.map(([, k2]) => k2);
|
|
111295
111299
|
const parentMap = {};
|
|
111296
|
-
|
|
111300
|
+
const parentArray = Array.isArray(parentRecords) ? parentRecords : [parentRecords];
|
|
111301
|
+
for (const parent of parentArray) {
|
|
111297
111302
|
const parentRecord = asRecord(parent);
|
|
111298
111303
|
const key = getRecordKey(parentRecord, parentKeys);
|
|
111299
111304
|
if (!parentMap[key]) {
|
|
@@ -111306,11 +111311,12 @@ function attachChildrenToParents(parentRecords, children) {
|
|
|
111306
111311
|
parentRecord[joinExpr.parentField] = [];
|
|
111307
111312
|
}
|
|
111308
111313
|
}
|
|
111314
|
+
const mappers = canAssumeStrictEquality ? void 0 : inferKeyCasts(parentArray, parentKeys);
|
|
111309
111315
|
for (const childRecord of Array.isArray(childRecords) ? childRecords : [childRecords]) {
|
|
111310
111316
|
if (childRecord === null) {
|
|
111311
111317
|
continue;
|
|
111312
111318
|
}
|
|
111313
|
-
const key = getRecordKey(asRecord(childRecord), childKeys);
|
|
111319
|
+
const key = getRecordKey(asRecord(childRecord), childKeys, mappers);
|
|
111314
111320
|
for (const parentRecord of parentMap[key] ?? []) {
|
|
111315
111321
|
if (joinExpr.isRelationUnique) {
|
|
111316
111322
|
parentRecord[joinExpr.parentField] = childRecord;
|
|
@@ -111322,6 +111328,40 @@ function attachChildrenToParents(parentRecords, children) {
|
|
|
111322
111328
|
}
|
|
111323
111329
|
return parentRecords;
|
|
111324
111330
|
}
|
|
111331
|
+
function inferKeyCasts(rows, keys) {
|
|
111332
|
+
function getKeyCast(type2) {
|
|
111333
|
+
switch (type2) {
|
|
111334
|
+
case "number":
|
|
111335
|
+
return Number;
|
|
111336
|
+
case "string":
|
|
111337
|
+
return String;
|
|
111338
|
+
case "boolean":
|
|
111339
|
+
return Boolean;
|
|
111340
|
+
case "bigint":
|
|
111341
|
+
return BigInt;
|
|
111342
|
+
default:
|
|
111343
|
+
return;
|
|
111344
|
+
}
|
|
111345
|
+
}
|
|
111346
|
+
const keyCasts = Array.from({ length: keys.length });
|
|
111347
|
+
let keysFound = 0;
|
|
111348
|
+
for (const parent of rows) {
|
|
111349
|
+
const parentRecord = asRecord(parent);
|
|
111350
|
+
for (const [i2, key] of keys.entries()) {
|
|
111351
|
+
if (parentRecord[key] !== null && keyCasts[i2] === void 0) {
|
|
111352
|
+
const keyCast = getKeyCast(typeof parentRecord[key]);
|
|
111353
|
+
if (keyCast !== void 0) {
|
|
111354
|
+
keyCasts[i2] = keyCast;
|
|
111355
|
+
}
|
|
111356
|
+
keysFound++;
|
|
111357
|
+
}
|
|
111358
|
+
}
|
|
111359
|
+
if (keysFound === keys.length) {
|
|
111360
|
+
break;
|
|
111361
|
+
}
|
|
111362
|
+
}
|
|
111363
|
+
return keyCasts;
|
|
111364
|
+
}
|
|
111325
111365
|
function evalFieldInitializer(initializer3, lastInsertId, scope, generators) {
|
|
111326
111366
|
switch (initializer3.type) {
|
|
111327
111367
|
case "value":
|
|
@@ -111381,6 +111421,9 @@ function evaluateProcessingParameters(ops, scope, generators) {
|
|
|
111381
111421
|
evaluateProcessingParameters(nested, scope, generators);
|
|
111382
111422
|
}
|
|
111383
111423
|
}
|
|
111424
|
+
function cloneObject(value) {
|
|
111425
|
+
return klona(value);
|
|
111426
|
+
}
|
|
111384
111427
|
async function getCrypto() {
|
|
111385
111428
|
return globalThis.crypto ?? await import("node:crypto");
|
|
111386
111429
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/query-plan-executor",
|
|
3
|
-
"version": "7.5.0-dev.
|
|
3
|
+
"version": "7.5.0-dev.32",
|
|
4
4
|
"description": "This package is intended for Prisma's internal use",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"hono": "4.11.7",
|
|
20
20
|
"temporal-polyfill": "0.3.0",
|
|
21
21
|
"zod": "4.1.3",
|
|
22
|
-
"@prisma/adapter-
|
|
23
|
-
"@prisma/adapter-
|
|
24
|
-
"@prisma/
|
|
25
|
-
"@prisma/adapter-
|
|
26
|
-
"@prisma/
|
|
22
|
+
"@prisma/adapter-pg": "7.5.0-dev.32",
|
|
23
|
+
"@prisma/adapter-mariadb": "7.5.0-dev.32",
|
|
24
|
+
"@prisma/client-engine-runtime": "7.5.0-dev.32",
|
|
25
|
+
"@prisma/driver-adapter-utils": "7.5.0-dev.32",
|
|
26
|
+
"@prisma/adapter-mssql": "7.5.0-dev.32"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
"dist"
|