@prisma/client-engine-runtime 7.3.0-integration-parameterization.11 → 7.3.0-integration-parameterization.13
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/batch.d.ts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +35 -2
- package/dist/index.mjs +35 -2
- package/package.json +5 -5
package/dist/batch.d.ts
CHANGED
|
@@ -16,4 +16,4 @@ export type CompactedBatchResponse = {
|
|
|
16
16
|
* Converts the result of a compacted query back to result objects analogous to what queries
|
|
17
17
|
* would return when executed individually.
|
|
18
18
|
*/
|
|
19
|
-
export declare function convertCompactedRows(rows: {}[], compiledBatch: CompactedBatchResponse): unknown[];
|
|
19
|
+
export declare function convertCompactedRows(rows: {}[], compiledBatch: CompactedBatchResponse, placeholderValues?: Record<string, unknown>): unknown[];
|
package/dist/index.d.mts
CHANGED
|
@@ -48,7 +48,7 @@ export declare type CompactedBatchResponse = {
|
|
|
48
48
|
* Converts the result of a compacted query back to result objects analogous to what queries
|
|
49
49
|
* would return when executed individually.
|
|
50
50
|
*/
|
|
51
|
-
export declare function convertCompactedRows(rows: {}[], compiledBatch: CompactedBatchResponse): unknown[];
|
|
51
|
+
export declare function convertCompactedRows(rows: {}[], compiledBatch: CompactedBatchResponse, placeholderValues?: Record<string, unknown>): unknown[];
|
|
52
52
|
|
|
53
53
|
export declare class DataMapperError extends UserFacingError {
|
|
54
54
|
name: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export declare type CompactedBatchResponse = {
|
|
|
48
48
|
* Converts the result of a compacted query back to result objects analogous to what queries
|
|
49
49
|
* would return when executed individually.
|
|
50
50
|
*/
|
|
51
|
-
export declare function convertCompactedRows(rows: {}[], compiledBatch: CompactedBatchResponse): unknown[];
|
|
51
|
+
export declare function convertCompactedRows(rows: {}[], compiledBatch: CompactedBatchResponse, placeholderValues?: Record<string, unknown>): unknown[];
|
|
52
52
|
|
|
53
53
|
export declare class DataMapperError extends UserFacingError {
|
|
54
54
|
name: string;
|
package/dist/index.js
CHANGED
|
@@ -421,7 +421,39 @@ function renderConstraint(constraint) {
|
|
|
421
421
|
}
|
|
422
422
|
|
|
423
423
|
// src/batch.ts
|
|
424
|
-
function
|
|
424
|
+
function isPlaceholder(value) {
|
|
425
|
+
if (typeof value !== "object" || value === null) {
|
|
426
|
+
return false;
|
|
427
|
+
}
|
|
428
|
+
const obj = value;
|
|
429
|
+
if ("$type" in obj && obj.$type === "Param") {
|
|
430
|
+
return true;
|
|
431
|
+
}
|
|
432
|
+
if ("prisma__type" in obj && obj.prisma__type === "param") {
|
|
433
|
+
return true;
|
|
434
|
+
}
|
|
435
|
+
return false;
|
|
436
|
+
}
|
|
437
|
+
function getPlaceholderName(value) {
|
|
438
|
+
if ("prisma__type" in value) {
|
|
439
|
+
return value.prisma__value?.name;
|
|
440
|
+
}
|
|
441
|
+
return value.value.name;
|
|
442
|
+
}
|
|
443
|
+
function resolveArgPlaceholders(args, placeholderValues) {
|
|
444
|
+
const resolved = {};
|
|
445
|
+
for (const [key, value] of Object.entries(args)) {
|
|
446
|
+
resolved[key] = value;
|
|
447
|
+
if (isPlaceholder(value)) {
|
|
448
|
+
const placeholderName = getPlaceholderName(value);
|
|
449
|
+
if (placeholderName && placeholderName in placeholderValues) {
|
|
450
|
+
resolved[key] = placeholderValues[placeholderName];
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
return resolved;
|
|
455
|
+
}
|
|
456
|
+
function convertCompactedRows(rows, compiledBatch, placeholderValues = {}) {
|
|
425
457
|
const keysPerRow = rows.map(
|
|
426
458
|
(item) => compiledBatch.keys.reduce((acc, key) => {
|
|
427
459
|
acc[key] = deserializeJsonResponse(item[key]);
|
|
@@ -430,7 +462,8 @@ function convertCompactedRows(rows, compiledBatch) {
|
|
|
430
462
|
);
|
|
431
463
|
const selection = new Set(compiledBatch.nestedSelection);
|
|
432
464
|
return compiledBatch.arguments.map((args) => {
|
|
433
|
-
const
|
|
465
|
+
const resolvedArgs = resolveArgPlaceholders(args, placeholderValues);
|
|
466
|
+
const rowIndex = keysPerRow.findIndex((rowKeys) => doKeysMatch(rowKeys, resolvedArgs));
|
|
434
467
|
if (rowIndex === -1) {
|
|
435
468
|
if (compiledBatch.expectNonEmpty) {
|
|
436
469
|
return new UserFacingError(
|
package/dist/index.mjs
CHANGED
|
@@ -370,7 +370,39 @@ function renderConstraint(constraint) {
|
|
|
370
370
|
}
|
|
371
371
|
|
|
372
372
|
// src/batch.ts
|
|
373
|
-
function
|
|
373
|
+
function isPlaceholder(value) {
|
|
374
|
+
if (typeof value !== "object" || value === null) {
|
|
375
|
+
return false;
|
|
376
|
+
}
|
|
377
|
+
const obj = value;
|
|
378
|
+
if ("$type" in obj && obj.$type === "Param") {
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
if ("prisma__type" in obj && obj.prisma__type === "param") {
|
|
382
|
+
return true;
|
|
383
|
+
}
|
|
384
|
+
return false;
|
|
385
|
+
}
|
|
386
|
+
function getPlaceholderName(value) {
|
|
387
|
+
if ("prisma__type" in value) {
|
|
388
|
+
return value.prisma__value?.name;
|
|
389
|
+
}
|
|
390
|
+
return value.value.name;
|
|
391
|
+
}
|
|
392
|
+
function resolveArgPlaceholders(args, placeholderValues) {
|
|
393
|
+
const resolved = {};
|
|
394
|
+
for (const [key, value] of Object.entries(args)) {
|
|
395
|
+
resolved[key] = value;
|
|
396
|
+
if (isPlaceholder(value)) {
|
|
397
|
+
const placeholderName = getPlaceholderName(value);
|
|
398
|
+
if (placeholderName && placeholderName in placeholderValues) {
|
|
399
|
+
resolved[key] = placeholderValues[placeholderName];
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return resolved;
|
|
404
|
+
}
|
|
405
|
+
function convertCompactedRows(rows, compiledBatch, placeholderValues = {}) {
|
|
374
406
|
const keysPerRow = rows.map(
|
|
375
407
|
(item) => compiledBatch.keys.reduce((acc, key) => {
|
|
376
408
|
acc[key] = deserializeJsonResponse(item[key]);
|
|
@@ -379,7 +411,8 @@ function convertCompactedRows(rows, compiledBatch) {
|
|
|
379
411
|
);
|
|
380
412
|
const selection = new Set(compiledBatch.nestedSelection);
|
|
381
413
|
return compiledBatch.arguments.map((args) => {
|
|
382
|
-
const
|
|
414
|
+
const resolvedArgs = resolveArgPlaceholders(args, placeholderValues);
|
|
415
|
+
const rowIndex = keysPerRow.findIndex((rowKeys) => doKeysMatch(rowKeys, resolvedArgs));
|
|
383
416
|
if (rowIndex === -1) {
|
|
384
417
|
if (compiledBatch.expectNonEmpty) {
|
|
385
418
|
return new UserFacingError(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-engine-runtime",
|
|
3
|
-
"version": "7.3.0-integration-parameterization.
|
|
3
|
+
"version": "7.3.0-integration-parameterization.13",
|
|
4
4
|
"description": "This package is intended for Prisma's internal use",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"nanoid": "5.1.5",
|
|
32
32
|
"ulid": "3.0.0",
|
|
33
33
|
"uuid": "11.1.0",
|
|
34
|
-
"@prisma/client-runtime-utils": "7.3.0-integration-parameterization.
|
|
35
|
-
"@prisma/
|
|
36
|
-
"@prisma/
|
|
37
|
-
"@prisma/
|
|
34
|
+
"@prisma/client-runtime-utils": "7.3.0-integration-parameterization.13",
|
|
35
|
+
"@prisma/debug": "7.3.0-integration-parameterization.13",
|
|
36
|
+
"@prisma/sqlcommenter": "7.3.0-integration-parameterization.13",
|
|
37
|
+
"@prisma/driver-adapter-utils": "7.3.0-integration-parameterization.13"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@codspeed/benchmark.js-plugin": "4.0.0",
|