@prisma/client-engine-runtime 7.2.0-dev.2 → 7.2.0-dev.20
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.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +9 -13
- package/dist/index.mjs +9 -13
- package/dist/interpreter/data-mapper.d.ts +5 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -47,8 +47,11 @@ export declare type CompactedBatchResponse = {
|
|
|
47
47
|
*/
|
|
48
48
|
export declare function convertCompactedRows(rows: {}[], compiledBatch: CompactedBatchResponse): unknown[];
|
|
49
49
|
|
|
50
|
-
export declare class DataMapperError extends
|
|
50
|
+
export declare class DataMapperError extends UserFacingError {
|
|
51
51
|
name: string;
|
|
52
|
+
constructor(message: string, options?: {
|
|
53
|
+
cause?: unknown;
|
|
54
|
+
});
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
export declare type DataRule = {
|
package/dist/index.d.ts
CHANGED
|
@@ -47,8 +47,11 @@ export declare type CompactedBatchResponse = {
|
|
|
47
47
|
*/
|
|
48
48
|
export declare function convertCompactedRows(rows: {}[], compiledBatch: CompactedBatchResponse): unknown[];
|
|
49
49
|
|
|
50
|
-
export declare class DataMapperError extends
|
|
50
|
+
export declare class DataMapperError extends UserFacingError {
|
|
51
51
|
name: string;
|
|
52
|
+
constructor(message: string, options?: {
|
|
53
|
+
cause?: unknown;
|
|
54
|
+
});
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
export declare type DataRule = {
|
package/dist/index.js
CHANGED
|
@@ -300,6 +300,8 @@ function getErrorCode(err) {
|
|
|
300
300
|
return "P2002";
|
|
301
301
|
case "ForeignKeyConstraintViolation":
|
|
302
302
|
return "P2003";
|
|
303
|
+
case "InvalidInputValue":
|
|
304
|
+
return "P2007";
|
|
303
305
|
case "UnsupportedNativeDataType":
|
|
304
306
|
return "P2010";
|
|
305
307
|
case "NullConstraintViolation":
|
|
@@ -396,6 +398,8 @@ function renderErrorMessage(err) {
|
|
|
396
398
|
return `Error in external connector (id ${err.cause.id})`;
|
|
397
399
|
case "TooManyConnections":
|
|
398
400
|
return `Too many database connections opened: ${err.cause.cause}`;
|
|
401
|
+
case "InvalidInputValue":
|
|
402
|
+
return `Invalid input value: ${err.cause.message}`;
|
|
399
403
|
case "sqlite":
|
|
400
404
|
case "postgres":
|
|
401
405
|
case "mysql":
|
|
@@ -445,8 +449,11 @@ function convertCompactedRows(rows, compiledBatch) {
|
|
|
445
449
|
|
|
446
450
|
// src/interpreter/data-mapper.ts
|
|
447
451
|
var import_client_runtime_utils3 = require("@prisma/client-runtime-utils");
|
|
448
|
-
var DataMapperError = class extends
|
|
452
|
+
var DataMapperError = class extends UserFacingError {
|
|
449
453
|
name = "DataMapperError";
|
|
454
|
+
constructor(message, options) {
|
|
455
|
+
super(message, "P2023", options);
|
|
456
|
+
}
|
|
450
457
|
};
|
|
451
458
|
function applyDataMap(data, structure, enums) {
|
|
452
459
|
switch (structure.type) {
|
|
@@ -597,7 +604,7 @@ function mapValue(value, columnName, scalarType, enums) {
|
|
|
597
604
|
throw new DataMapperError(`Expected a boolean in column '${columnName}', got ${typeof value}: ${value}`);
|
|
598
605
|
}
|
|
599
606
|
}
|
|
600
|
-
if (Array.isArray(value)) {
|
|
607
|
+
if (Array.isArray(value) || value instanceof Uint8Array) {
|
|
601
608
|
for (const byte of value) {
|
|
602
609
|
if (byte !== 0) return true;
|
|
603
610
|
}
|
|
@@ -1294,17 +1301,6 @@ function serializeRawValue(value, type) {
|
|
|
1294
1301
|
throw new Error(`Cannot serialize value of type ${typeof value} as JsonArray`);
|
|
1295
1302
|
}
|
|
1296
1303
|
return value.map((v) => serializeRawValue(v, import_driver_adapter_utils2.ColumnTypeEnum.Json));
|
|
1297
|
-
case import_driver_adapter_utils2.ColumnTypeEnum.Bytes:
|
|
1298
|
-
if (Array.isArray(value)) {
|
|
1299
|
-
return new Uint8Array(value);
|
|
1300
|
-
} else {
|
|
1301
|
-
throw new Error(`Cannot serialize value of type ${typeof value} as Bytes`);
|
|
1302
|
-
}
|
|
1303
|
-
case import_driver_adapter_utils2.ColumnTypeEnum.BytesArray:
|
|
1304
|
-
if (!Array.isArray(value)) {
|
|
1305
|
-
throw new Error(`Cannot serialize value of type ${typeof value} as BytesArray`);
|
|
1306
|
-
}
|
|
1307
|
-
return value.map((v) => serializeRawValue(v, import_driver_adapter_utils2.ColumnTypeEnum.Bytes));
|
|
1308
1304
|
case import_driver_adapter_utils2.ColumnTypeEnum.Boolean:
|
|
1309
1305
|
switch (typeof value) {
|
|
1310
1306
|
case "boolean":
|
package/dist/index.mjs
CHANGED
|
@@ -249,6 +249,8 @@ function getErrorCode(err) {
|
|
|
249
249
|
return "P2002";
|
|
250
250
|
case "ForeignKeyConstraintViolation":
|
|
251
251
|
return "P2003";
|
|
252
|
+
case "InvalidInputValue":
|
|
253
|
+
return "P2007";
|
|
252
254
|
case "UnsupportedNativeDataType":
|
|
253
255
|
return "P2010";
|
|
254
256
|
case "NullConstraintViolation":
|
|
@@ -345,6 +347,8 @@ function renderErrorMessage(err) {
|
|
|
345
347
|
return `Error in external connector (id ${err.cause.id})`;
|
|
346
348
|
case "TooManyConnections":
|
|
347
349
|
return `Too many database connections opened: ${err.cause.cause}`;
|
|
350
|
+
case "InvalidInputValue":
|
|
351
|
+
return `Invalid input value: ${err.cause.message}`;
|
|
348
352
|
case "sqlite":
|
|
349
353
|
case "postgres":
|
|
350
354
|
case "mysql":
|
|
@@ -394,8 +398,11 @@ function convertCompactedRows(rows, compiledBatch) {
|
|
|
394
398
|
|
|
395
399
|
// src/interpreter/data-mapper.ts
|
|
396
400
|
import { Decimal as Decimal3 } from "@prisma/client-runtime-utils";
|
|
397
|
-
var DataMapperError = class extends
|
|
401
|
+
var DataMapperError = class extends UserFacingError {
|
|
398
402
|
name = "DataMapperError";
|
|
403
|
+
constructor(message, options) {
|
|
404
|
+
super(message, "P2023", options);
|
|
405
|
+
}
|
|
399
406
|
};
|
|
400
407
|
function applyDataMap(data, structure, enums) {
|
|
401
408
|
switch (structure.type) {
|
|
@@ -546,7 +553,7 @@ function mapValue(value, columnName, scalarType, enums) {
|
|
|
546
553
|
throw new DataMapperError(`Expected a boolean in column '${columnName}', got ${typeof value}: ${value}`);
|
|
547
554
|
}
|
|
548
555
|
}
|
|
549
|
-
if (Array.isArray(value)) {
|
|
556
|
+
if (Array.isArray(value) || value instanceof Uint8Array) {
|
|
550
557
|
for (const byte of value) {
|
|
551
558
|
if (byte !== 0) return true;
|
|
552
559
|
}
|
|
@@ -1243,17 +1250,6 @@ function serializeRawValue(value, type) {
|
|
|
1243
1250
|
throw new Error(`Cannot serialize value of type ${typeof value} as JsonArray`);
|
|
1244
1251
|
}
|
|
1245
1252
|
return value.map((v) => serializeRawValue(v, ColumnTypeEnum.Json));
|
|
1246
|
-
case ColumnTypeEnum.Bytes:
|
|
1247
|
-
if (Array.isArray(value)) {
|
|
1248
|
-
return new Uint8Array(value);
|
|
1249
|
-
} else {
|
|
1250
|
-
throw new Error(`Cannot serialize value of type ${typeof value} as Bytes`);
|
|
1251
|
-
}
|
|
1252
|
-
case ColumnTypeEnum.BytesArray:
|
|
1253
|
-
if (!Array.isArray(value)) {
|
|
1254
|
-
throw new Error(`Cannot serialize value of type ${typeof value} as BytesArray`);
|
|
1255
|
-
}
|
|
1256
|
-
return value.map((v) => serializeRawValue(v, ColumnTypeEnum.Bytes));
|
|
1257
1253
|
case ColumnTypeEnum.Boolean:
|
|
1258
1254
|
switch (typeof value) {
|
|
1259
1255
|
case "boolean":
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { ResultNode } from '../query-plan';
|
|
2
|
+
import { UserFacingError } from '../user-facing-error';
|
|
2
3
|
import { Value } from './scope';
|
|
3
|
-
export declare class DataMapperError extends
|
|
4
|
+
export declare class DataMapperError extends UserFacingError {
|
|
4
5
|
name: string;
|
|
6
|
+
constructor(message: string, options?: {
|
|
7
|
+
cause?: unknown;
|
|
8
|
+
});
|
|
5
9
|
}
|
|
6
10
|
export declare function applyDataMap(data: Value, structure: ResultNode, enums: Record<string, Record<string, string>>): Value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-engine-runtime",
|
|
3
|
-
"version": "7.2.0-dev.
|
|
3
|
+
"version": "7.2.0-dev.20",
|
|
4
4
|
"description": "This package is intended for Prisma's internal use",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"nanoid": "5.1.5",
|
|
31
31
|
"ulid": "3.0.0",
|
|
32
32
|
"uuid": "11.1.0",
|
|
33
|
-
"@prisma/client-runtime-utils": "7.2.0-dev.
|
|
34
|
-
"@prisma/
|
|
35
|
-
"@prisma/
|
|
36
|
-
"@prisma/
|
|
33
|
+
"@prisma/client-runtime-utils": "7.2.0-dev.20",
|
|
34
|
+
"@prisma/driver-adapter-utils": "7.2.0-dev.20",
|
|
35
|
+
"@prisma/sqlcommenter": "7.2.0-dev.20",
|
|
36
|
+
"@prisma/debug": "7.2.0-dev.20"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/jest": "29.5.14",
|