@prisma/param-graph 7.4.0-integration-parameterization.8 → 7.4.0-integration-parameterization.9
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/serialization.js +3 -44
- package/dist/serialization.mjs +3 -44
- package/package.json +1 -1
package/dist/serialization.js
CHANGED
|
@@ -27,56 +27,15 @@ const FORMAT_WIDE = 1;
|
|
|
27
27
|
const NONE_16 = 65535;
|
|
28
28
|
const NONE_32 = 4294967295;
|
|
29
29
|
const MAX_COMPACT_INDEX = 65534;
|
|
30
|
-
const BASE64URL_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
31
30
|
function encodeBase64url(bytes) {
|
|
32
|
-
|
|
33
|
-
const len = bytes.length;
|
|
34
|
-
let i = 0;
|
|
35
|
-
while (i < len) {
|
|
36
|
-
const b0 = bytes[i++];
|
|
37
|
-
const hasB1 = i < len;
|
|
38
|
-
const b1 = hasB1 ? bytes[i++] : 0;
|
|
39
|
-
const hasB2 = i < len;
|
|
40
|
-
const b2 = hasB2 ? bytes[i++] : 0;
|
|
41
|
-
result += BASE64URL_CHARS[b0 >> 2 & 63];
|
|
42
|
-
result += BASE64URL_CHARS[(b0 << 4 | b1 >> 4) & 63];
|
|
43
|
-
if (hasB1) {
|
|
44
|
-
result += BASE64URL_CHARS[(b1 << 2 | b2 >> 6) & 63];
|
|
45
|
-
}
|
|
46
|
-
if (hasB2) {
|
|
47
|
-
result += BASE64URL_CHARS[b2 & 63];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return result;
|
|
31
|
+
return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString("base64url");
|
|
51
32
|
}
|
|
52
33
|
function decodeBase64url(str) {
|
|
53
|
-
|
|
54
|
-
for (let i = 0; i < BASE64URL_CHARS.length; i++) {
|
|
55
|
-
charToIndex[BASE64URL_CHARS.charCodeAt(i)] = i;
|
|
56
|
-
}
|
|
57
|
-
const len = str.length;
|
|
58
|
-
const outputLen = Math.floor(len * 3 / 4);
|
|
59
|
-
const bytes = new Uint8Array(outputLen);
|
|
60
|
-
let bi = 0;
|
|
61
|
-
for (let i = 0; i < len; ) {
|
|
62
|
-
const c0 = charToIndex[str.charCodeAt(i++)];
|
|
63
|
-
const c1 = i < len ? charToIndex[str.charCodeAt(i++)] : 0;
|
|
64
|
-
const c2 = i < len ? charToIndex[str.charCodeAt(i++)] : 0;
|
|
65
|
-
const c3 = i < len ? charToIndex[str.charCodeAt(i++)] : 0;
|
|
66
|
-
bytes[bi++] = c0 << 2 | c1 >> 4;
|
|
67
|
-
if (bi < outputLen) bytes[bi++] = (c1 << 4 | c2 >> 2) & 255;
|
|
68
|
-
if (bi < outputLen) bytes[bi++] = (c2 << 6 | c3) & 255;
|
|
69
|
-
}
|
|
70
|
-
return bytes;
|
|
34
|
+
return Buffer.from(str, "base64url");
|
|
71
35
|
}
|
|
72
36
|
function serializeParamGraph(data) {
|
|
73
37
|
const rootKeys = Object.keys(data.roots);
|
|
74
|
-
const maxIndex = Math.max(
|
|
75
|
-
data.strings.length,
|
|
76
|
-
data.inputNodes.length,
|
|
77
|
-
data.outputNodes.length,
|
|
78
|
-
rootKeys.length
|
|
79
|
-
);
|
|
38
|
+
const maxIndex = Math.max(data.strings.length, data.inputNodes.length, data.outputNodes.length, rootKeys.length);
|
|
80
39
|
const useWide = maxIndex > MAX_COMPACT_INDEX;
|
|
81
40
|
let size = 1;
|
|
82
41
|
size += useWide ? 12 : 6;
|
package/dist/serialization.mjs
CHANGED
|
@@ -3,56 +3,15 @@ const FORMAT_WIDE = 1;
|
|
|
3
3
|
const NONE_16 = 65535;
|
|
4
4
|
const NONE_32 = 4294967295;
|
|
5
5
|
const MAX_COMPACT_INDEX = 65534;
|
|
6
|
-
const BASE64URL_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
7
6
|
function encodeBase64url(bytes) {
|
|
8
|
-
|
|
9
|
-
const len = bytes.length;
|
|
10
|
-
let i = 0;
|
|
11
|
-
while (i < len) {
|
|
12
|
-
const b0 = bytes[i++];
|
|
13
|
-
const hasB1 = i < len;
|
|
14
|
-
const b1 = hasB1 ? bytes[i++] : 0;
|
|
15
|
-
const hasB2 = i < len;
|
|
16
|
-
const b2 = hasB2 ? bytes[i++] : 0;
|
|
17
|
-
result += BASE64URL_CHARS[b0 >> 2 & 63];
|
|
18
|
-
result += BASE64URL_CHARS[(b0 << 4 | b1 >> 4) & 63];
|
|
19
|
-
if (hasB1) {
|
|
20
|
-
result += BASE64URL_CHARS[(b1 << 2 | b2 >> 6) & 63];
|
|
21
|
-
}
|
|
22
|
-
if (hasB2) {
|
|
23
|
-
result += BASE64URL_CHARS[b2 & 63];
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return result;
|
|
7
|
+
return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString("base64url");
|
|
27
8
|
}
|
|
28
9
|
function decodeBase64url(str) {
|
|
29
|
-
|
|
30
|
-
for (let i = 0; i < BASE64URL_CHARS.length; i++) {
|
|
31
|
-
charToIndex[BASE64URL_CHARS.charCodeAt(i)] = i;
|
|
32
|
-
}
|
|
33
|
-
const len = str.length;
|
|
34
|
-
const outputLen = Math.floor(len * 3 / 4);
|
|
35
|
-
const bytes = new Uint8Array(outputLen);
|
|
36
|
-
let bi = 0;
|
|
37
|
-
for (let i = 0; i < len; ) {
|
|
38
|
-
const c0 = charToIndex[str.charCodeAt(i++)];
|
|
39
|
-
const c1 = i < len ? charToIndex[str.charCodeAt(i++)] : 0;
|
|
40
|
-
const c2 = i < len ? charToIndex[str.charCodeAt(i++)] : 0;
|
|
41
|
-
const c3 = i < len ? charToIndex[str.charCodeAt(i++)] : 0;
|
|
42
|
-
bytes[bi++] = c0 << 2 | c1 >> 4;
|
|
43
|
-
if (bi < outputLen) bytes[bi++] = (c1 << 4 | c2 >> 2) & 255;
|
|
44
|
-
if (bi < outputLen) bytes[bi++] = (c2 << 6 | c3) & 255;
|
|
45
|
-
}
|
|
46
|
-
return bytes;
|
|
10
|
+
return Buffer.from(str, "base64url");
|
|
47
11
|
}
|
|
48
12
|
function serializeParamGraph(data) {
|
|
49
13
|
const rootKeys = Object.keys(data.roots);
|
|
50
|
-
const maxIndex = Math.max(
|
|
51
|
-
data.strings.length,
|
|
52
|
-
data.inputNodes.length,
|
|
53
|
-
data.outputNodes.length,
|
|
54
|
-
rootKeys.length
|
|
55
|
-
);
|
|
14
|
+
const maxIndex = Math.max(data.strings.length, data.inputNodes.length, data.outputNodes.length, rootKeys.length);
|
|
56
15
|
const useWide = maxIndex > MAX_COMPACT_INDEX;
|
|
57
16
|
let size = 1;
|
|
58
17
|
size += useWide ? 12 : 6;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/param-graph",
|
|
3
|
-
"version": "7.4.0-integration-parameterization.
|
|
3
|
+
"version": "7.4.0-integration-parameterization.9",
|
|
4
4
|
"description": "This package is intended for Prisma's internal use",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|