@prisma/adapter-planetscale 5.21.0-integration-itx-refactor.2 → 5.21.0-integration-itx-refactor.3
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 +15 -1
- package/dist/index.mjs +15 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -44,6 +44,20 @@ var name = "@prisma/adapter-planetscale";
|
|
|
44
44
|
// src/conversion.ts
|
|
45
45
|
var import_database = require("@planetscale/database");
|
|
46
46
|
var import_driver_adapter_utils = require("@prisma/driver-adapter-utils");
|
|
47
|
+
|
|
48
|
+
// src/text.ts
|
|
49
|
+
var decoder = new TextDecoder("utf-8");
|
|
50
|
+
function decodeUtf8(text) {
|
|
51
|
+
return text ? decoder.decode(uint8Array(text)) : "";
|
|
52
|
+
}
|
|
53
|
+
function uint8Array(text) {
|
|
54
|
+
return Uint8Array.from(bytes(text));
|
|
55
|
+
}
|
|
56
|
+
function bytes(text) {
|
|
57
|
+
return text.split("").map((c) => c.charCodeAt(0));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// src/conversion.ts
|
|
47
61
|
function fieldToColumnType(field) {
|
|
48
62
|
switch (field) {
|
|
49
63
|
case "INT8":
|
|
@@ -97,7 +111,7 @@ function fieldToColumnType(field) {
|
|
|
97
111
|
}
|
|
98
112
|
var cast = (field, value) => {
|
|
99
113
|
if (field.type === "JSON") {
|
|
100
|
-
return value;
|
|
114
|
+
return typeof value === "string" && value.length ? decodeUtf8(value) : value;
|
|
101
115
|
}
|
|
102
116
|
const defaultValue = (0, import_database.cast)(field, value);
|
|
103
117
|
if (defaultValue instanceof Uint8Array) {
|
package/dist/index.mjs
CHANGED
|
@@ -8,6 +8,20 @@ var name = "@prisma/adapter-planetscale";
|
|
|
8
8
|
// src/conversion.ts
|
|
9
9
|
import { cast as defaultCast } from "@planetscale/database";
|
|
10
10
|
import { ColumnTypeEnum } from "@prisma/driver-adapter-utils";
|
|
11
|
+
|
|
12
|
+
// src/text.ts
|
|
13
|
+
var decoder = new TextDecoder("utf-8");
|
|
14
|
+
function decodeUtf8(text) {
|
|
15
|
+
return text ? decoder.decode(uint8Array(text)) : "";
|
|
16
|
+
}
|
|
17
|
+
function uint8Array(text) {
|
|
18
|
+
return Uint8Array.from(bytes(text));
|
|
19
|
+
}
|
|
20
|
+
function bytes(text) {
|
|
21
|
+
return text.split("").map((c) => c.charCodeAt(0));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// src/conversion.ts
|
|
11
25
|
function fieldToColumnType(field) {
|
|
12
26
|
switch (field) {
|
|
13
27
|
case "INT8":
|
|
@@ -61,7 +75,7 @@ function fieldToColumnType(field) {
|
|
|
61
75
|
}
|
|
62
76
|
var cast = (field, value) => {
|
|
63
77
|
if (field.type === "JSON") {
|
|
64
|
-
return value;
|
|
78
|
+
return typeof value === "string" && value.length ? decodeUtf8(value) : value;
|
|
65
79
|
}
|
|
66
80
|
const defaultValue = defaultCast(field, value);
|
|
67
81
|
if (defaultValue instanceof Uint8Array) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/adapter-planetscale",
|
|
3
|
-
"version": "5.21.0-integration-itx-refactor.
|
|
3
|
+
"version": "5.21.0-integration-itx-refactor.3",
|
|
4
4
|
"description": "Prisma's driver adapter for \"@planetscale/database\"",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"license": "Apache-2.0",
|
|
32
32
|
"sideEffects": false,
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@prisma/driver-adapter-utils": "5.21.0-integration-itx-refactor.
|
|
34
|
+
"@prisma/driver-adapter-utils": "5.21.0-integration-itx-refactor.3"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@planetscale/database": "1.18.0",
|