@prisma/query-plan-executor 7.4.1-dev.1 → 7.4.2-dev.1
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 +11 -7
- package/dist/index.js +63 -17
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -955,6 +955,9 @@ declare type Fragment = {
|
|
|
955
955
|
type: 'parameter';
|
|
956
956
|
} | {
|
|
957
957
|
type: 'parameterTuple';
|
|
958
|
+
itemPrefix: string;
|
|
959
|
+
itemSeparator: string;
|
|
960
|
+
itemSuffix: string;
|
|
958
961
|
} | {
|
|
959
962
|
type: 'parameterTupleList';
|
|
960
963
|
itemPrefix: string;
|
|
@@ -2406,7 +2409,7 @@ declare interface Queryable<Query, Result> extends AdapterInfo {
|
|
|
2406
2409
|
declare type QueryEvent = {
|
|
2407
2410
|
timestamp: Date;
|
|
2408
2411
|
query: string;
|
|
2409
|
-
params: unknown[];
|
|
2412
|
+
params: readonly unknown[];
|
|
2410
2413
|
duration: number;
|
|
2411
2414
|
};
|
|
2412
2415
|
|
|
@@ -2477,6 +2480,7 @@ declare type QueryPlanNode = {
|
|
|
2477
2480
|
args: {
|
|
2478
2481
|
parent: QueryPlanNode;
|
|
2479
2482
|
children: JoinExpression[];
|
|
2483
|
+
canAssumeStrictEquality: boolean;
|
|
2480
2484
|
};
|
|
2481
2485
|
} | {
|
|
2482
2486
|
type: 'mapField';
|
|
@@ -3312,14 +3316,14 @@ declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) e
|
|
|
3312
3316
|
declare type UnofficialStatusCode = -1;
|
|
3313
3317
|
|
|
3314
3318
|
declare type ValidationError = {
|
|
3315
|
-
|
|
3319
|
+
errorIdentifier: 'RELATION_VIOLATION';
|
|
3316
3320
|
context: {
|
|
3317
3321
|
relation: string;
|
|
3318
3322
|
modelA: string;
|
|
3319
3323
|
modelB: string;
|
|
3320
3324
|
};
|
|
3321
3325
|
} | {
|
|
3322
|
-
|
|
3326
|
+
errorIdentifier: 'MISSING_RELATED_RECORD';
|
|
3323
3327
|
context: {
|
|
3324
3328
|
model: string;
|
|
3325
3329
|
relation: string;
|
|
@@ -3328,24 +3332,24 @@ declare type ValidationError = {
|
|
|
3328
3332
|
neededFor?: string;
|
|
3329
3333
|
};
|
|
3330
3334
|
} | {
|
|
3331
|
-
|
|
3335
|
+
errorIdentifier: 'MISSING_RECORD';
|
|
3332
3336
|
context: {
|
|
3333
3337
|
operation: string;
|
|
3334
3338
|
};
|
|
3335
3339
|
} | {
|
|
3336
|
-
|
|
3340
|
+
errorIdentifier: 'INCOMPLETE_CONNECT_INPUT';
|
|
3337
3341
|
context: {
|
|
3338
3342
|
expectedRows: number;
|
|
3339
3343
|
};
|
|
3340
3344
|
} | {
|
|
3341
|
-
|
|
3345
|
+
errorIdentifier: 'INCOMPLETE_CONNECT_OUTPUT';
|
|
3342
3346
|
context: {
|
|
3343
3347
|
expectedRows: number;
|
|
3344
3348
|
relation: string;
|
|
3345
3349
|
relationType: string;
|
|
3346
3350
|
};
|
|
3347
3351
|
} | {
|
|
3348
|
-
|
|
3352
|
+
errorIdentifier: 'RECORDS_NOT_CONNECTED';
|
|
3349
3353
|
context: {
|
|
3350
3354
|
relation: string;
|
|
3351
3355
|
parent: string;
|
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.4.
|
|
101328
|
+
var version = "7.4.2-dev.1";
|
|
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) {
|
|
@@ -110496,8 +110496,11 @@ function paginateSingleList(list, { cursor, skip, take }) {
|
|
|
110496
110496
|
const end = take !== null ? start + take : list.length;
|
|
110497
110497
|
return list.slice(start, end);
|
|
110498
110498
|
}
|
|
110499
|
-
function getRecordKey(record2, fields) {
|
|
110500
|
-
|
|
110499
|
+
function getRecordKey(record2, fields, mappers) {
|
|
110500
|
+
const array2 = fields.map(
|
|
110501
|
+
(field, index) => mappers?.[index] ? record2[field] !== null ? mappers[index](record2[field]) : null : record2[field]
|
|
110502
|
+
);
|
|
110503
|
+
return JSON.stringify(array2);
|
|
110501
110504
|
}
|
|
110502
110505
|
function isPrismaValuePlaceholder(value) {
|
|
110503
110506
|
return typeof value === "object" && value !== null && value["prisma__type"] === "param";
|
|
@@ -110588,7 +110591,10 @@ function renderFragment(fragment, placeholderFormat, ctx) {
|
|
|
110588
110591
|
case "stringChunk":
|
|
110589
110592
|
return fragment.chunk;
|
|
110590
110593
|
case "parameterTuple": {
|
|
110591
|
-
const placeholders = fragment.value.length == 0 ? "NULL" : fragment.value.map(() =>
|
|
110594
|
+
const placeholders = fragment.value.length == 0 ? "NULL" : fragment.value.map(() => {
|
|
110595
|
+
const item = formatPlaceholder(placeholderFormat, ctx.placeholderNumber++);
|
|
110596
|
+
return `${fragment.itemPrefix}${item}${fragment.itemSuffix}`;
|
|
110597
|
+
}).join(fragment.itemSeparator);
|
|
110592
110598
|
return `(${placeholders})`;
|
|
110593
110599
|
}
|
|
110594
110600
|
case "parameterTupleList": {
|
|
@@ -110942,7 +110948,7 @@ function doesSatisfyRule(data, rule) {
|
|
|
110942
110948
|
}
|
|
110943
110949
|
}
|
|
110944
110950
|
function renderMessage(data, error44) {
|
|
110945
|
-
switch (error44.
|
|
110951
|
+
switch (error44.errorIdentifier) {
|
|
110946
110952
|
case "RELATION_VIOLATION":
|
|
110947
110953
|
return `The change you are trying to make would violate the required relation '${error44.context.relation}' between the \`${error44.context.modelA}\` and \`${error44.context.modelB}\` models.`;
|
|
110948
110954
|
case "MISSING_RECORD":
|
|
@@ -110962,7 +110968,7 @@ function renderMessage(data, error44) {
|
|
|
110962
110968
|
}
|
|
110963
110969
|
}
|
|
110964
110970
|
function getErrorCode2(error44) {
|
|
110965
|
-
switch (error44.
|
|
110971
|
+
switch (error44.errorIdentifier) {
|
|
110966
110972
|
case "RELATION_VIOLATION":
|
|
110967
110973
|
return "P2014";
|
|
110968
110974
|
case "RECORDS_NOT_CONNECTED":
|
|
@@ -111075,7 +111081,7 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
111075
111081
|
sum2 += await this.#withQuerySpanAndEvent(
|
|
111076
111082
|
commentedQuery,
|
|
111077
111083
|
context2.queryable,
|
|
111078
|
-
() => context2.queryable.executeRaw(commentedQuery).catch(
|
|
111084
|
+
() => context2.queryable.executeRaw(cloneObject(commentedQuery)).catch(
|
|
111079
111085
|
(err) => node.args.type === "rawSql" ? rethrowAsUserFacingRawError(err) : rethrowAsUserFacing(err)
|
|
111080
111086
|
)
|
|
111081
111087
|
);
|
|
@@ -111090,7 +111096,7 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
111090
111096
|
const result = await this.#withQuerySpanAndEvent(
|
|
111091
111097
|
commentedQuery,
|
|
111092
111098
|
context2.queryable,
|
|
111093
|
-
() => context2.queryable.queryRaw(commentedQuery).catch(
|
|
111099
|
+
() => context2.queryable.queryRaw(cloneObject(commentedQuery)).catch(
|
|
111094
111100
|
(err) => node.args.type === "rawSql" ? rethrowAsUserFacingRawError(err) : rethrowAsUserFacing(err)
|
|
111095
111101
|
)
|
|
111096
111102
|
);
|
|
@@ -111142,7 +111148,7 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
111142
111148
|
childRecords: (await this.interpretNode(joinExpr.child, context2)).value
|
|
111143
111149
|
}))
|
|
111144
111150
|
);
|
|
111145
|
-
return { value: attachChildrenToParents(parent, children), lastInsertId };
|
|
111151
|
+
return { value: attachChildrenToParents(parent, children, node.args.canAssumeStrictEquality), lastInsertId };
|
|
111146
111152
|
}
|
|
111147
111153
|
case "transaction": {
|
|
111148
111154
|
if (!context2.transactionManager.enabled) {
|
|
@@ -111189,8 +111195,9 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
111189
111195
|
}
|
|
111190
111196
|
case "process": {
|
|
111191
111197
|
const { value, lastInsertId } = await this.interpretNode(node.args.expr, context2);
|
|
111192
|
-
|
|
111193
|
-
|
|
111198
|
+
const ops = cloneObject(node.args.operations);
|
|
111199
|
+
evaluateProcessingParameters(ops, context2.scope, context2.generators);
|
|
111200
|
+
return { value: processRecords(value, ops), lastInsertId };
|
|
111194
111201
|
}
|
|
111195
111202
|
case "initializeRecord": {
|
|
111196
111203
|
const { lastInsertId } = await this.interpretNode(node.args.expr, context2);
|
|
@@ -111283,12 +111290,13 @@ function mapField2(value, field) {
|
|
|
111283
111290
|
}
|
|
111284
111291
|
return value;
|
|
111285
111292
|
}
|
|
111286
|
-
function attachChildrenToParents(parentRecords, children) {
|
|
111293
|
+
function attachChildrenToParents(parentRecords, children, canAssumeStrictEquality) {
|
|
111287
111294
|
for (const { joinExpr, childRecords } of children) {
|
|
111288
111295
|
const parentKeys = joinExpr.on.map(([k2]) => k2);
|
|
111289
111296
|
const childKeys = joinExpr.on.map(([, k2]) => k2);
|
|
111290
111297
|
const parentMap = {};
|
|
111291
|
-
|
|
111298
|
+
const parentArray = Array.isArray(parentRecords) ? parentRecords : [parentRecords];
|
|
111299
|
+
for (const parent of parentArray) {
|
|
111292
111300
|
const parentRecord = asRecord(parent);
|
|
111293
111301
|
const key = getRecordKey(parentRecord, parentKeys);
|
|
111294
111302
|
if (!parentMap[key]) {
|
|
@@ -111301,11 +111309,12 @@ function attachChildrenToParents(parentRecords, children) {
|
|
|
111301
111309
|
parentRecord[joinExpr.parentField] = [];
|
|
111302
111310
|
}
|
|
111303
111311
|
}
|
|
111312
|
+
const mappers = canAssumeStrictEquality ? void 0 : inferKeyCasts(parentArray, parentKeys);
|
|
111304
111313
|
for (const childRecord of Array.isArray(childRecords) ? childRecords : [childRecords]) {
|
|
111305
111314
|
if (childRecord === null) {
|
|
111306
111315
|
continue;
|
|
111307
111316
|
}
|
|
111308
|
-
const key = getRecordKey(asRecord(childRecord), childKeys);
|
|
111317
|
+
const key = getRecordKey(asRecord(childRecord), childKeys, mappers);
|
|
111309
111318
|
for (const parentRecord of parentMap[key] ?? []) {
|
|
111310
111319
|
if (joinExpr.isRelationUnique) {
|
|
111311
111320
|
parentRecord[joinExpr.parentField] = childRecord;
|
|
@@ -111317,6 +111326,40 @@ function attachChildrenToParents(parentRecords, children) {
|
|
|
111317
111326
|
}
|
|
111318
111327
|
return parentRecords;
|
|
111319
111328
|
}
|
|
111329
|
+
function inferKeyCasts(rows, keys) {
|
|
111330
|
+
function getKeyCast(type2) {
|
|
111331
|
+
switch (type2) {
|
|
111332
|
+
case "number":
|
|
111333
|
+
return Number;
|
|
111334
|
+
case "string":
|
|
111335
|
+
return String;
|
|
111336
|
+
case "boolean":
|
|
111337
|
+
return Boolean;
|
|
111338
|
+
case "bigint":
|
|
111339
|
+
return BigInt;
|
|
111340
|
+
default:
|
|
111341
|
+
return;
|
|
111342
|
+
}
|
|
111343
|
+
}
|
|
111344
|
+
const keyCasts = Array.from({ length: keys.length });
|
|
111345
|
+
let keysFound = 0;
|
|
111346
|
+
for (const parent of rows) {
|
|
111347
|
+
const parentRecord = asRecord(parent);
|
|
111348
|
+
for (const [i2, key] of keys.entries()) {
|
|
111349
|
+
if (parentRecord[key] !== null && keyCasts[i2] === void 0) {
|
|
111350
|
+
const keyCast = getKeyCast(typeof parentRecord[key]);
|
|
111351
|
+
if (keyCast !== void 0) {
|
|
111352
|
+
keyCasts[i2] = keyCast;
|
|
111353
|
+
}
|
|
111354
|
+
keysFound++;
|
|
111355
|
+
}
|
|
111356
|
+
}
|
|
111357
|
+
if (keysFound === keys.length) {
|
|
111358
|
+
break;
|
|
111359
|
+
}
|
|
111360
|
+
}
|
|
111361
|
+
return keyCasts;
|
|
111362
|
+
}
|
|
111320
111363
|
function evalFieldInitializer(initializer3, lastInsertId, scope, generators) {
|
|
111321
111364
|
switch (initializer3.type) {
|
|
111322
111365
|
case "value":
|
|
@@ -111376,6 +111419,9 @@ function evaluateProcessingParameters(ops, scope, generators) {
|
|
|
111376
111419
|
evaluateProcessingParameters(nested, scope, generators);
|
|
111377
111420
|
}
|
|
111378
111421
|
}
|
|
111422
|
+
function cloneObject(value) {
|
|
111423
|
+
return klona(value);
|
|
111424
|
+
}
|
|
111379
111425
|
async function getCrypto() {
|
|
111380
111426
|
return globalThis.crypto ?? await import("node:crypto");
|
|
111381
111427
|
}
|
|
@@ -113815,7 +113861,7 @@ function runInActiveSpan(nameOrOptions, fn2) {
|
|
|
113815
113861
|
var mariadb = __toESM(require_promise(), 1);
|
|
113816
113862
|
var name = "@prisma/adapter-mariadb";
|
|
113817
113863
|
var UNSIGNED_FLAG = 1 << 5;
|
|
113818
|
-
var
|
|
113864
|
+
var BINARY_COLLATION_INDEX = 63;
|
|
113819
113865
|
function mapColumnType(field) {
|
|
113820
113866
|
switch (field.type) {
|
|
113821
113867
|
case "TINY":
|
|
@@ -113858,7 +113904,7 @@ function mapColumnType(field) {
|
|
|
113858
113904
|
case "LONG_BLOB":
|
|
113859
113905
|
if (field["dataTypeFormat"] === "json") {
|
|
113860
113906
|
return ColumnTypeEnum.Json;
|
|
113861
|
-
} else if (field.
|
|
113907
|
+
} else if (field.collation.index === BINARY_COLLATION_INDEX) {
|
|
113862
113908
|
return ColumnTypeEnum.Bytes;
|
|
113863
113909
|
} else {
|
|
113864
113910
|
return ColumnTypeEnum.Text;
|
|
@@ -114244,7 +114290,7 @@ function inferCapabilities(version5) {
|
|
|
114244
114290
|
const [versionStr, suffix] = version5.split("-");
|
|
114245
114291
|
const [major2, minor, patch] = versionStr.split(".").map((n2) => parseInt(n2, 10));
|
|
114246
114292
|
const isMariaDB = suffix?.toLowerCase()?.includes("mariadb") ?? false;
|
|
114247
|
-
const supportsRelationJoins = !isMariaDB && (major2 > 8 || major2 === 8 && minor
|
|
114293
|
+
const supportsRelationJoins = !isMariaDB && (major2 > 8 || major2 === 8 && (minor > 0 || minor === 0 && patch >= 13));
|
|
114248
114294
|
return { supportsRelationJoins };
|
|
114249
114295
|
}
|
|
114250
114296
|
function rewriteConnectionString(config3) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/query-plan-executor",
|
|
3
|
-
"version": "7.4.
|
|
3
|
+
"version": "7.4.2-dev.1",
|
|
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",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"temporal-polyfill": "0.3.0",
|
|
21
21
|
"vitest": "3.2.4",
|
|
22
22
|
"zod": "4.1.3",
|
|
23
|
-
"@prisma/adapter-
|
|
24
|
-
"@prisma/adapter-
|
|
25
|
-
"@prisma/adapter-
|
|
26
|
-
"@prisma/
|
|
27
|
-
"@prisma/
|
|
23
|
+
"@prisma/adapter-mssql": "7.4.2-dev.1",
|
|
24
|
+
"@prisma/driver-adapter-utils": "7.4.2-dev.1",
|
|
25
|
+
"@prisma/adapter-mariadb": "7.4.2-dev.1",
|
|
26
|
+
"@prisma/adapter-pg": "7.4.2-dev.1",
|
|
27
|
+
"@prisma/client-engine-runtime": "7.4.2-dev.1"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"dist"
|