@prisma/client-engine-runtime 7.10.0-dev.32 → 7.10.0-dev.34
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.js +13 -7
- package/dist/index.mjs +13 -7
- package/dist/utils.d.ts +10 -0
- package/dist/utils.test.d.ts +1 -0
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -56,6 +56,12 @@ var import_client_runtime_utils2 = require("@prisma/client-runtime-utils");
|
|
|
56
56
|
|
|
57
57
|
// src/utils.ts
|
|
58
58
|
var import_client_runtime_utils = require("@prisma/client-runtime-utils");
|
|
59
|
+
function isUint8Array(value) {
|
|
60
|
+
return ArrayBuffer.isView(value) && Object.prototype.toString.call(value) === "[object Uint8Array]";
|
|
61
|
+
}
|
|
62
|
+
function isDate(value) {
|
|
63
|
+
return Object.prototype.toString.call(value) === "[object Date]";
|
|
64
|
+
}
|
|
59
65
|
function assertNever(_, message) {
|
|
60
66
|
throw new Error(message);
|
|
61
67
|
}
|
|
@@ -74,11 +80,11 @@ function doKeysMatch(lhs, rhs) {
|
|
|
74
80
|
const lhsDecimal = asDecimal(lhs[key]);
|
|
75
81
|
const rhsDecimal = asDecimal(rhs[key]);
|
|
76
82
|
return lhsDecimal && rhsDecimal && lhsDecimal.equals(rhsDecimal);
|
|
77
|
-
} else if (lhs[key]
|
|
83
|
+
} else if (isUint8Array(lhs[key]) || isUint8Array(rhs[key])) {
|
|
78
84
|
const lhsBuffer = asBuffer(lhs[key]);
|
|
79
85
|
const rhsBuffer = asBuffer(rhs[key]);
|
|
80
86
|
return lhsBuffer && rhsBuffer && lhsBuffer.equals(rhsBuffer);
|
|
81
|
-
} else if (lhs[key]
|
|
87
|
+
} else if (isDate(lhs[key]) || isDate(rhs[key])) {
|
|
82
88
|
return asDate(lhs[key])?.getTime() === asDate(rhs[key])?.getTime();
|
|
83
89
|
} else if (typeof lhs[key] === "bigint" || typeof rhs[key] === "bigint") {
|
|
84
90
|
return asBigInt(lhs[key]) === asBigInt(rhs[key]);
|
|
@@ -100,7 +106,7 @@ function asDecimal(value) {
|
|
|
100
106
|
function asBuffer(value) {
|
|
101
107
|
if (Buffer.isBuffer(value)) {
|
|
102
108
|
return value;
|
|
103
|
-
} else if (value
|
|
109
|
+
} else if (isUint8Array(value)) {
|
|
104
110
|
return Buffer.from(value.buffer, value.byteOffset, value.byteLength);
|
|
105
111
|
} else if (typeof value === "string") {
|
|
106
112
|
return Buffer.from(value, "base64");
|
|
@@ -109,7 +115,7 @@ function asBuffer(value) {
|
|
|
109
115
|
}
|
|
110
116
|
}
|
|
111
117
|
function asDate(value) {
|
|
112
|
-
if (value
|
|
118
|
+
if (isDate(value)) {
|
|
113
119
|
return value;
|
|
114
120
|
} else if (typeof value === "string" || typeof value === "number") {
|
|
115
121
|
return new Date(value);
|
|
@@ -701,7 +707,7 @@ function mapValue(value, columnName, scalarType, enums) {
|
|
|
701
707
|
throw new DataMapperError(`Expected a boolean in column '${columnName}', got ${typeof value}: ${value}`);
|
|
702
708
|
}
|
|
703
709
|
}
|
|
704
|
-
if (Array.isArray(value) || value
|
|
710
|
+
if (Array.isArray(value) || isUint8Array(value)) {
|
|
705
711
|
for (const byte of value) {
|
|
706
712
|
if (byte !== 0) return true;
|
|
707
713
|
}
|
|
@@ -718,7 +724,7 @@ function mapValue(value, columnName, scalarType, enums) {
|
|
|
718
724
|
if (typeof value === "string") {
|
|
719
725
|
return { $type: "DateTime", value: normalizeDateTime(value) };
|
|
720
726
|
}
|
|
721
|
-
if (typeof value === "number" || value
|
|
727
|
+
if (typeof value === "number" || isDate(value)) {
|
|
722
728
|
return { $type: "DateTime", value };
|
|
723
729
|
}
|
|
724
730
|
throw new DataMapperError(`Expected a date in column '${columnName}', got ${typeof value}: ${value}`);
|
|
@@ -749,7 +755,7 @@ function mapValue(value, columnName, scalarType, enums) {
|
|
|
749
755
|
if (Array.isArray(value)) {
|
|
750
756
|
return { $type: "Bytes", value: Buffer.from(value).toString("base64") };
|
|
751
757
|
}
|
|
752
|
-
if (value
|
|
758
|
+
if (isUint8Array(value)) {
|
|
753
759
|
return { $type: "Bytes", value: Buffer.from(value).toString("base64") };
|
|
754
760
|
}
|
|
755
761
|
throw new DataMapperError(`Expected a byte array in column '${columnName}', got ${typeof value}: ${value}`);
|
package/dist/index.mjs
CHANGED
|
@@ -3,6 +3,12 @@ import { Decimal as Decimal2 } from "@prisma/client-runtime-utils";
|
|
|
3
3
|
|
|
4
4
|
// src/utils.ts
|
|
5
5
|
import { Decimal } from "@prisma/client-runtime-utils";
|
|
6
|
+
function isUint8Array(value) {
|
|
7
|
+
return ArrayBuffer.isView(value) && Object.prototype.toString.call(value) === "[object Uint8Array]";
|
|
8
|
+
}
|
|
9
|
+
function isDate(value) {
|
|
10
|
+
return Object.prototype.toString.call(value) === "[object Date]";
|
|
11
|
+
}
|
|
6
12
|
function assertNever(_, message) {
|
|
7
13
|
throw new Error(message);
|
|
8
14
|
}
|
|
@@ -21,11 +27,11 @@ function doKeysMatch(lhs, rhs) {
|
|
|
21
27
|
const lhsDecimal = asDecimal(lhs[key]);
|
|
22
28
|
const rhsDecimal = asDecimal(rhs[key]);
|
|
23
29
|
return lhsDecimal && rhsDecimal && lhsDecimal.equals(rhsDecimal);
|
|
24
|
-
} else if (lhs[key]
|
|
30
|
+
} else if (isUint8Array(lhs[key]) || isUint8Array(rhs[key])) {
|
|
25
31
|
const lhsBuffer = asBuffer(lhs[key]);
|
|
26
32
|
const rhsBuffer = asBuffer(rhs[key]);
|
|
27
33
|
return lhsBuffer && rhsBuffer && lhsBuffer.equals(rhsBuffer);
|
|
28
|
-
} else if (lhs[key]
|
|
34
|
+
} else if (isDate(lhs[key]) || isDate(rhs[key])) {
|
|
29
35
|
return asDate(lhs[key])?.getTime() === asDate(rhs[key])?.getTime();
|
|
30
36
|
} else if (typeof lhs[key] === "bigint" || typeof rhs[key] === "bigint") {
|
|
31
37
|
return asBigInt(lhs[key]) === asBigInt(rhs[key]);
|
|
@@ -47,7 +53,7 @@ function asDecimal(value) {
|
|
|
47
53
|
function asBuffer(value) {
|
|
48
54
|
if (Buffer.isBuffer(value)) {
|
|
49
55
|
return value;
|
|
50
|
-
} else if (value
|
|
56
|
+
} else if (isUint8Array(value)) {
|
|
51
57
|
return Buffer.from(value.buffer, value.byteOffset, value.byteLength);
|
|
52
58
|
} else if (typeof value === "string") {
|
|
53
59
|
return Buffer.from(value, "base64");
|
|
@@ -56,7 +62,7 @@ function asBuffer(value) {
|
|
|
56
62
|
}
|
|
57
63
|
}
|
|
58
64
|
function asDate(value) {
|
|
59
|
-
if (value
|
|
65
|
+
if (isDate(value)) {
|
|
60
66
|
return value;
|
|
61
67
|
} else if (typeof value === "string" || typeof value === "number") {
|
|
62
68
|
return new Date(value);
|
|
@@ -648,7 +654,7 @@ function mapValue(value, columnName, scalarType, enums) {
|
|
|
648
654
|
throw new DataMapperError(`Expected a boolean in column '${columnName}', got ${typeof value}: ${value}`);
|
|
649
655
|
}
|
|
650
656
|
}
|
|
651
|
-
if (Array.isArray(value) || value
|
|
657
|
+
if (Array.isArray(value) || isUint8Array(value)) {
|
|
652
658
|
for (const byte of value) {
|
|
653
659
|
if (byte !== 0) return true;
|
|
654
660
|
}
|
|
@@ -665,7 +671,7 @@ function mapValue(value, columnName, scalarType, enums) {
|
|
|
665
671
|
if (typeof value === "string") {
|
|
666
672
|
return { $type: "DateTime", value: normalizeDateTime(value) };
|
|
667
673
|
}
|
|
668
|
-
if (typeof value === "number" || value
|
|
674
|
+
if (typeof value === "number" || isDate(value)) {
|
|
669
675
|
return { $type: "DateTime", value };
|
|
670
676
|
}
|
|
671
677
|
throw new DataMapperError(`Expected a date in column '${columnName}', got ${typeof value}: ${value}`);
|
|
@@ -696,7 +702,7 @@ function mapValue(value, columnName, scalarType, enums) {
|
|
|
696
702
|
if (Array.isArray(value)) {
|
|
697
703
|
return { $type: "Bytes", value: Buffer.from(value).toString("base64") };
|
|
698
704
|
}
|
|
699
|
-
if (value
|
|
705
|
+
if (isUint8Array(value)) {
|
|
700
706
|
return { $type: "Bytes", value: Buffer.from(value).toString("base64") };
|
|
701
707
|
}
|
|
702
708
|
throw new DataMapperError(`Expected a byte array in column '${columnName}', got ${typeof value}: ${value}`);
|
package/dist/utils.d.ts
CHANGED
|
@@ -4,6 +4,16 @@ export type DeepReadonly<T> = T extends undefined | null | boolean | string | nu
|
|
|
4
4
|
export type DeepUnreadonly<T> = T extends undefined | null | boolean | string | number | symbol | Function | Date ? T : T extends ReadonlyArray<infer U> ? Array<DeepUnreadonly<U>> : unknown extends T ? unknown : {
|
|
5
5
|
-readonly [K in keyof T]: DeepUnreadonly<T[K]>;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Cross-realm safe check for Uint8Array. `instanceof Uint8Array` fails when the value
|
|
9
|
+
* was created in a different realm (e.g. jsdom, iframes, vm contexts).
|
|
10
|
+
*/
|
|
11
|
+
export declare function isUint8Array(value: unknown): value is Uint8Array;
|
|
12
|
+
/**
|
|
13
|
+
* Cross-realm safe check for Date. `instanceof Date` fails when the value
|
|
14
|
+
* was created in a different realm (e.g. jsdom, iframes, vm contexts).
|
|
15
|
+
*/
|
|
16
|
+
export declare function isDate(value: unknown): value is Date;
|
|
7
17
|
export declare function assertNever(_: never, message: string): never;
|
|
8
18
|
/**
|
|
9
19
|
* Checks if two objects are deeply equal, recursively checking all properties for strict equality.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-engine-runtime",
|
|
3
|
-
"version": "7.10.0-dev.
|
|
3
|
+
"version": "7.10.0-dev.34",
|
|
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,20 +31,20 @@
|
|
|
31
31
|
"nanoid": "5.1.5",
|
|
32
32
|
"ulid": "3.0.0",
|
|
33
33
|
"uuid": "14.0.0",
|
|
34
|
-
"@prisma/client-runtime-utils": "7.10.0-dev.
|
|
35
|
-
"@prisma/
|
|
36
|
-
"@prisma/
|
|
37
|
-
"@prisma/
|
|
38
|
-
"@prisma/
|
|
39
|
-
"@prisma/json-protocol": "7.10.0-dev.
|
|
34
|
+
"@prisma/client-runtime-utils": "7.10.0-dev.34",
|
|
35
|
+
"@prisma/driver-adapter-utils": "7.10.0-dev.34",
|
|
36
|
+
"@prisma/debug": "7.10.0-dev.34",
|
|
37
|
+
"@prisma/param-graph": "7.10.0-dev.34",
|
|
38
|
+
"@prisma/sqlcommenter": "7.10.0-dev.34",
|
|
39
|
+
"@prisma/json-protocol": "7.10.0-dev.34"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@codspeed/benchmark.js-plugin": "4.0.0",
|
|
43
43
|
"@types/benchmark": "2.1.5",
|
|
44
44
|
"@types/node": "~20.19.24",
|
|
45
45
|
"benchmark": "2.1.4",
|
|
46
|
-
"@prisma/get-dmmf": "7.10.0-dev.
|
|
47
|
-
"@prisma/param-graph-builder": "7.10.0-dev.
|
|
46
|
+
"@prisma/get-dmmf": "7.10.0-dev.34",
|
|
47
|
+
"@prisma/param-graph-builder": "7.10.0-dev.34"
|
|
48
48
|
},
|
|
49
49
|
"files": [
|
|
50
50
|
"dist"
|