@powerlines/deepkit 0.5.87 → 0.5.89
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/{chunk-XTGDJ7HH.js → chunk-JPFSTX7K.js} +444 -238
- package/dist/{chunk-BRD4KKCQ.cjs → chunk-ZWL5JSVT.cjs} +444 -238
- package/dist/index.cjs +8 -8
- package/dist/index.js +1 -1
- package/dist/utilities.cjs +8 -8
- package/dist/utilities.js +1 -1
- package/package.json +8 -8
|
@@ -6,163 +6,261 @@ import { isNull as isNull$1 } from '@stryke/type-checks/is-null';
|
|
|
6
6
|
import { isString as isString$1 } from '@stryke/type-checks/is-string';
|
|
7
7
|
import { isUndefined as isUndefined$1 } from '@stryke/type-checks/is-undefined';
|
|
8
8
|
|
|
9
|
-
// ../../node_modules/.pnpm/@stryke+helpers@0.9.
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
for (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
return [...
|
|
9
|
+
// ../../node_modules/.pnpm/@stryke+helpers@0.9.36/node_modules/@stryke/helpers/dist/get-unique.mjs
|
|
10
|
+
function getUniqueBy(arr, mapper = (item) => item) {
|
|
11
|
+
const map = /* @__PURE__ */ new Map();
|
|
12
|
+
for (const item of arr) {
|
|
13
|
+
const key = mapper(item);
|
|
14
|
+
if (!map.has(key)) map.set(key, item);
|
|
15
|
+
}
|
|
16
|
+
return [...map.values()];
|
|
17
17
|
}
|
|
18
|
-
__name(
|
|
18
|
+
__name(getUniqueBy, "getUniqueBy");
|
|
19
19
|
|
|
20
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
21
|
-
var
|
|
20
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/type-checks/src/get-object-tag.mjs
|
|
21
|
+
var getObjectTag = /* @__PURE__ */ __name((value) => {
|
|
22
|
+
if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
|
|
23
|
+
return Object.prototype.toString.call(value);
|
|
24
|
+
}, "getObjectTag");
|
|
22
25
|
|
|
23
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/type-checks/src/is-plain-object.mjs
|
|
27
|
+
var isObjectLike = /* @__PURE__ */ __name((obj) => {
|
|
28
|
+
return typeof obj === "object" && obj !== null;
|
|
29
|
+
}, "isObjectLike");
|
|
30
|
+
var isPlainObject = /* @__PURE__ */ __name((obj) => {
|
|
31
|
+
if (!isObjectLike(obj) || getObjectTag(obj) !== "[object Object]") return false;
|
|
32
|
+
if (Object.getPrototypeOf(obj) === null) return true;
|
|
33
|
+
let proto = obj;
|
|
34
|
+
while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
|
|
35
|
+
return Object.getPrototypeOf(obj) === proto;
|
|
36
|
+
}, "isPlainObject");
|
|
32
37
|
|
|
33
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
34
|
-
var
|
|
38
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/type-checks/src/is-object.mjs
|
|
39
|
+
var isObject = /* @__PURE__ */ __name((value) => {
|
|
35
40
|
try {
|
|
36
|
-
return typeof
|
|
41
|
+
return typeof value === "object" || Boolean(value) && value?.constructor === Object || isPlainObject(value);
|
|
37
42
|
} catch {
|
|
38
43
|
return false;
|
|
39
44
|
}
|
|
40
|
-
}, "
|
|
45
|
+
}, "isObject");
|
|
41
46
|
|
|
42
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
43
|
-
var
|
|
47
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/type-checks/src/is-string.mjs
|
|
48
|
+
var isString = /* @__PURE__ */ __name((value) => {
|
|
44
49
|
try {
|
|
45
|
-
return typeof
|
|
50
|
+
return typeof value === "string";
|
|
46
51
|
} catch {
|
|
47
52
|
return false;
|
|
48
53
|
}
|
|
49
|
-
}, "
|
|
54
|
+
}, "isString");
|
|
50
55
|
|
|
51
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
52
|
-
var
|
|
56
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/types/src/base.mjs
|
|
57
|
+
var EMPTY_STRING = "";
|
|
53
58
|
|
|
54
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
-
function
|
|
58
|
-
return
|
|
59
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/utils/strip-comments.mjs
|
|
60
|
+
var singleComment = Symbol("singleComment");
|
|
61
|
+
var multiComment = Symbol("multiComment");
|
|
62
|
+
function stripWithoutWhitespace() {
|
|
63
|
+
return "";
|
|
59
64
|
}
|
|
60
|
-
__name(
|
|
61
|
-
function
|
|
62
|
-
return
|
|
65
|
+
__name(stripWithoutWhitespace, "stripWithoutWhitespace");
|
|
66
|
+
function stripWithWhitespace(value, start, end) {
|
|
67
|
+
return value.slice(start, end).replace(/\S/g, " ");
|
|
63
68
|
}
|
|
64
|
-
__name(
|
|
65
|
-
function
|
|
66
|
-
let
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
__name(stripWithWhitespace, "stripWithWhitespace");
|
|
70
|
+
function isEscaped(value, quotePosition) {
|
|
71
|
+
let index = quotePosition - 1;
|
|
72
|
+
let backslashCount = 0;
|
|
73
|
+
while (value[index] === "\\") {
|
|
74
|
+
index -= 1;
|
|
75
|
+
backslashCount += 1;
|
|
76
|
+
}
|
|
77
|
+
return Boolean(backslashCount % 2);
|
|
69
78
|
}
|
|
70
|
-
__name(
|
|
71
|
-
function
|
|
72
|
-
if (typeof
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
__name(isEscaped, "isEscaped");
|
|
80
|
+
function stripComments(value, { whitespace = true, trailingCommas = false } = {}) {
|
|
81
|
+
if (typeof value !== "string") throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof value}\``);
|
|
82
|
+
const strip = whitespace ? stripWithWhitespace : stripWithoutWhitespace;
|
|
83
|
+
let isInsideString = false;
|
|
84
|
+
let isInsideComment = false;
|
|
85
|
+
let offset = 0;
|
|
86
|
+
let buffer = "";
|
|
87
|
+
let result = "";
|
|
88
|
+
let commaIndex = -1;
|
|
89
|
+
for (let index = 0; index < value.length; index++) {
|
|
90
|
+
const currentCharacter = value[index];
|
|
91
|
+
const nextCharacter = value[index + 1];
|
|
92
|
+
if (!isInsideComment && currentCharacter === '"') {
|
|
93
|
+
if (!isEscaped(value, index)) isInsideString = !isInsideString;
|
|
94
|
+
}
|
|
95
|
+
if (isInsideString) continue;
|
|
96
|
+
if (!isInsideComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "//") {
|
|
97
|
+
buffer += value.slice(offset, index);
|
|
98
|
+
offset = index;
|
|
99
|
+
isInsideComment = singleComment;
|
|
100
|
+
index++;
|
|
101
|
+
} else if (isInsideComment === singleComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "\r\n") {
|
|
102
|
+
index++;
|
|
103
|
+
isInsideComment = false;
|
|
104
|
+
buffer += strip(value, offset, index);
|
|
105
|
+
offset = index;
|
|
106
|
+
} else if (isInsideComment === singleComment && currentCharacter === "\n") {
|
|
107
|
+
isInsideComment = false;
|
|
108
|
+
buffer += strip(value, offset, index);
|
|
109
|
+
offset = index;
|
|
110
|
+
} else if (!isInsideComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "/*") {
|
|
111
|
+
buffer += value.slice(offset, index);
|
|
112
|
+
offset = index;
|
|
113
|
+
isInsideComment = multiComment;
|
|
114
|
+
index++;
|
|
115
|
+
} else if (isInsideComment === multiComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "*/") {
|
|
116
|
+
index++;
|
|
117
|
+
isInsideComment = false;
|
|
118
|
+
buffer += strip(value, offset, index + 1);
|
|
119
|
+
offset = index + 1;
|
|
120
|
+
} else if (trailingCommas && !isInsideComment) {
|
|
121
|
+
if (commaIndex !== -1) {
|
|
122
|
+
if (currentCharacter === "}" || currentCharacter === "]") {
|
|
123
|
+
buffer += value.slice(offset, index);
|
|
124
|
+
result += strip(buffer, 0, 1) + buffer.slice(1);
|
|
125
|
+
buffer = "";
|
|
126
|
+
offset = index;
|
|
127
|
+
commaIndex = -1;
|
|
128
|
+
} else if (currentCharacter !== " " && currentCharacter !== " " && currentCharacter !== "\r" && currentCharacter !== "\n") {
|
|
129
|
+
buffer += value.slice(offset, index);
|
|
130
|
+
offset = index;
|
|
131
|
+
commaIndex = -1;
|
|
132
|
+
}
|
|
133
|
+
} else if (currentCharacter === ",") {
|
|
134
|
+
result += buffer + value.slice(offset, index);
|
|
135
|
+
buffer = "";
|
|
136
|
+
offset = index;
|
|
137
|
+
commaIndex = index;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return result + buffer + (isInsideComment ? strip(value.slice(offset)) : value.slice(offset));
|
|
82
142
|
}
|
|
83
|
-
__name(
|
|
143
|
+
__name(stripComments, "stripComments");
|
|
84
144
|
|
|
85
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
86
|
-
var
|
|
87
|
-
var
|
|
88
|
-
var
|
|
89
|
-
function
|
|
90
|
-
if (
|
|
91
|
-
console.warn(`Dropping "${
|
|
145
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/utils/parse.mjs
|
|
146
|
+
var suspectProtoRx = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/;
|
|
147
|
+
var suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
|
|
148
|
+
var JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(?:\.\d{1,17})?(?:E[+-]?\d+)?\s*$/i;
|
|
149
|
+
function jsonParseTransform(key, value) {
|
|
150
|
+
if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
|
|
151
|
+
console.warn(`Dropping "${key}" key to prevent prototype pollution.`);
|
|
92
152
|
return;
|
|
93
153
|
}
|
|
94
|
-
return
|
|
154
|
+
return value;
|
|
95
155
|
}
|
|
96
|
-
__name(
|
|
97
|
-
function
|
|
98
|
-
if (typeof
|
|
99
|
-
let
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
|
|
156
|
+
__name(jsonParseTransform, "jsonParseTransform");
|
|
157
|
+
function parse(value, options = {}) {
|
|
158
|
+
if (typeof value !== "string") return value;
|
|
159
|
+
let stripped = stripComments(value);
|
|
160
|
+
if (stripped[0] === '"' && stripped[stripped.length - 1] === '"' && !stripped.includes("\\")) return stripped.slice(1, -1);
|
|
161
|
+
stripped = stripped.trim();
|
|
162
|
+
if (stripped.length <= 9) switch (stripped.toLowerCase()) {
|
|
163
|
+
case "true":
|
|
103
164
|
return true;
|
|
104
|
-
case
|
|
165
|
+
case "false":
|
|
105
166
|
return false;
|
|
106
|
-
case
|
|
167
|
+
case "undefined":
|
|
107
168
|
return;
|
|
108
|
-
case
|
|
169
|
+
case "null":
|
|
109
170
|
return null;
|
|
110
|
-
case
|
|
171
|
+
case "nan":
|
|
111
172
|
return NaN;
|
|
112
|
-
case
|
|
113
|
-
return
|
|
114
|
-
case
|
|
115
|
-
return
|
|
173
|
+
case "infinity":
|
|
174
|
+
return Number.POSITIVE_INFINITY;
|
|
175
|
+
case "-infinity":
|
|
176
|
+
return Number.NEGATIVE_INFINITY;
|
|
116
177
|
}
|
|
117
|
-
if (!
|
|
118
|
-
if (
|
|
119
|
-
return
|
|
178
|
+
if (!JsonSigRx.test(stripped)) {
|
|
179
|
+
if (options.strict) throw new Error("Invalid JSON");
|
|
180
|
+
return stripped;
|
|
120
181
|
}
|
|
121
182
|
try {
|
|
122
|
-
if (
|
|
123
|
-
if (
|
|
124
|
-
return JSON.parse(
|
|
183
|
+
if (suspectProtoRx.test(stripped) || suspectConstructorRx.test(stripped)) {
|
|
184
|
+
if (options.strict) throw new Error("Possible prototype pollution");
|
|
185
|
+
return JSON.parse(stripped, jsonParseTransform);
|
|
125
186
|
}
|
|
126
|
-
return JSON.parse(
|
|
127
|
-
} catch (
|
|
128
|
-
if (
|
|
129
|
-
return
|
|
187
|
+
return JSON.parse(stripped);
|
|
188
|
+
} catch (error) {
|
|
189
|
+
if (options.strict) throw error;
|
|
190
|
+
return value;
|
|
130
191
|
}
|
|
131
192
|
}
|
|
132
|
-
__name(
|
|
193
|
+
__name(parse, "parse");
|
|
133
194
|
|
|
134
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
135
|
-
var
|
|
136
|
-
function
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
195
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/utils/code-frames.mjs
|
|
196
|
+
var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
|
197
|
+
function getMarkerLines(loc, source, opts = {}) {
|
|
198
|
+
const startLoc = {
|
|
199
|
+
column: 0,
|
|
200
|
+
line: -1,
|
|
201
|
+
...loc.start
|
|
202
|
+
};
|
|
203
|
+
const endLoc = {
|
|
204
|
+
...startLoc,
|
|
205
|
+
...loc.end
|
|
206
|
+
};
|
|
207
|
+
const { linesAbove = 2, linesBelow = 3 } = opts || {};
|
|
208
|
+
const startLine = startLoc.line;
|
|
209
|
+
const startColumn = startLoc.column;
|
|
210
|
+
const endLine = endLoc.line;
|
|
211
|
+
const endColumn = endLoc.column;
|
|
212
|
+
let start = Math.max(startLine - (linesAbove + 1), 0);
|
|
213
|
+
let end = Math.min(source.length, endLine + linesBelow);
|
|
214
|
+
if (startLine === -1) start = 0;
|
|
215
|
+
if (endLine === -1) end = source.length;
|
|
216
|
+
const lineDiff = endLine - startLine;
|
|
217
|
+
const markerLines = {};
|
|
218
|
+
if (lineDiff) for (let i = 0; i <= lineDiff; i++) {
|
|
219
|
+
const lineNumber = i + startLine;
|
|
220
|
+
if (!startColumn) markerLines[lineNumber] = true;
|
|
221
|
+
else if (i === 0) markerLines[lineNumber] = [startColumn, (source[lineNumber - 1]?.length ?? 0) - startColumn + 1];
|
|
222
|
+
else if (i === lineDiff) markerLines[lineNumber] = [0, endColumn];
|
|
223
|
+
else markerLines[lineNumber] = [0, source[lineNumber - i]?.length ?? 0];
|
|
224
|
+
}
|
|
225
|
+
else if (startColumn === endColumn) markerLines[startLine] = startColumn ? [startColumn, 0] : true;
|
|
226
|
+
else markerLines[startLine] = [startColumn, endColumn - startColumn];
|
|
227
|
+
return {
|
|
228
|
+
start,
|
|
229
|
+
end,
|
|
230
|
+
markerLines
|
|
231
|
+
};
|
|
146
232
|
}
|
|
147
|
-
__name(
|
|
148
|
-
function
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
233
|
+
__name(getMarkerLines, "getMarkerLines");
|
|
234
|
+
function codeFrameColumns(rawLines, loc, opts = {}) {
|
|
235
|
+
const { start, end, markerLines } = getMarkerLines(loc, rawLines.split(NEWLINE), opts);
|
|
236
|
+
const numberMaxWidth = String(end).length;
|
|
237
|
+
return (opts.highlight ? opts.highlight(rawLines) : rawLines).split(NEWLINE).slice(start, end).map((line, index) => {
|
|
238
|
+
const number = start + 1 + index;
|
|
239
|
+
const gutter = ` ${` ${number}`.slice(-numberMaxWidth)} | `;
|
|
240
|
+
const hasMarker = Boolean(markerLines[number] ?? false);
|
|
241
|
+
if (hasMarker) {
|
|
242
|
+
let markerLine = "";
|
|
243
|
+
if (Array.isArray(hasMarker)) {
|
|
244
|
+
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
|
245
|
+
const numberOfMarkers = hasMarker[1] || 1;
|
|
246
|
+
markerLine = [
|
|
247
|
+
"\n ",
|
|
248
|
+
gutter.replace(/\d/g, " "),
|
|
249
|
+
markerSpacing,
|
|
250
|
+
"^".repeat(numberOfMarkers)
|
|
251
|
+
].join("");
|
|
158
252
|
}
|
|
159
|
-
return [
|
|
253
|
+
return [
|
|
254
|
+
">",
|
|
255
|
+
gutter,
|
|
256
|
+
line,
|
|
257
|
+
markerLine
|
|
258
|
+
].join("");
|
|
160
259
|
}
|
|
161
|
-
return ` ${
|
|
162
|
-
}).join(
|
|
163
|
-
`);
|
|
260
|
+
return ` ${gutter}${line}`;
|
|
261
|
+
}).join("\n");
|
|
164
262
|
}
|
|
165
|
-
__name(
|
|
263
|
+
__name(codeFrameColumns, "codeFrameColumns");
|
|
166
264
|
|
|
167
265
|
// ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
168
266
|
function createScanner(text, ignoreTrivia = false) {
|
|
@@ -603,7 +701,7 @@ var ParseOptions;
|
|
|
603
701
|
allowTrailingComma: false
|
|
604
702
|
};
|
|
605
703
|
})(ParseOptions || (ParseOptions = {}));
|
|
606
|
-
function
|
|
704
|
+
function parse2(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
607
705
|
let currentProperty = null;
|
|
608
706
|
let currentParent = [];
|
|
609
707
|
const previousParents = [];
|
|
@@ -651,7 +749,7 @@ function parse(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
651
749
|
visit(text, visitor, options);
|
|
652
750
|
return currentParent[0];
|
|
653
751
|
}
|
|
654
|
-
__name(
|
|
752
|
+
__name(parse2, "parse");
|
|
655
753
|
function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
656
754
|
const _scanner = createScanner(text, false);
|
|
657
755
|
const _jsonPath = [];
|
|
@@ -982,7 +1080,7 @@ var SyntaxKind;
|
|
|
982
1080
|
SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
|
|
983
1081
|
SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
|
|
984
1082
|
})(SyntaxKind || (SyntaxKind = {}));
|
|
985
|
-
var
|
|
1083
|
+
var parse3 = parse2;
|
|
986
1084
|
var ParseErrorCode;
|
|
987
1085
|
(function(ParseErrorCode2) {
|
|
988
1086
|
ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
@@ -1102,58 +1200,107 @@ var LinesAndColumns = (
|
|
|
1102
1200
|
})()
|
|
1103
1201
|
);
|
|
1104
1202
|
|
|
1105
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
1106
|
-
function
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1203
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/utils/parse-error.mjs
|
|
1204
|
+
function formatParseError(input, parseError) {
|
|
1205
|
+
const { error, offset, length } = parseError;
|
|
1206
|
+
const result = new LinesAndColumns(input).locationForIndex(offset);
|
|
1207
|
+
let line = result?.line ?? 0;
|
|
1208
|
+
let column = result?.column ?? 0;
|
|
1209
|
+
line++;
|
|
1210
|
+
column++;
|
|
1211
|
+
return `${printParseErrorCode(error)} in JSON at ${line}:${column}
|
|
1212
|
+
${codeFrameColumns(input, {
|
|
1213
|
+
start: {
|
|
1214
|
+
line,
|
|
1215
|
+
column
|
|
1216
|
+
},
|
|
1217
|
+
end: {
|
|
1218
|
+
line,
|
|
1219
|
+
column: column + length
|
|
1220
|
+
}
|
|
1221
|
+
})}
|
|
1110
1222
|
`;
|
|
1111
1223
|
}
|
|
1112
|
-
__name(
|
|
1224
|
+
__name(formatParseError, "formatParseError");
|
|
1113
1225
|
|
|
1114
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
1115
|
-
var
|
|
1226
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/type-checks/src/is-number.mjs
|
|
1227
|
+
var isNumber = /* @__PURE__ */ __name((value) => {
|
|
1116
1228
|
try {
|
|
1117
|
-
return
|
|
1229
|
+
return value instanceof Number || typeof value === "number" || Number(value) === value;
|
|
1118
1230
|
} catch {
|
|
1119
1231
|
return false;
|
|
1120
1232
|
}
|
|
1121
|
-
}, "
|
|
1233
|
+
}, "isNumber");
|
|
1122
1234
|
|
|
1123
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
1124
|
-
var
|
|
1235
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/type-checks/src/is-undefined.mjs
|
|
1236
|
+
var isUndefined = /* @__PURE__ */ __name((value) => {
|
|
1237
|
+
return value === void 0;
|
|
1238
|
+
}, "isUndefined");
|
|
1125
1239
|
|
|
1126
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
1127
|
-
var
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1240
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/utils/stringify.mjs
|
|
1241
|
+
var invalidKeyChars = [
|
|
1242
|
+
"@",
|
|
1243
|
+
"/",
|
|
1244
|
+
"#",
|
|
1245
|
+
"$",
|
|
1246
|
+
" ",
|
|
1247
|
+
":",
|
|
1248
|
+
";",
|
|
1249
|
+
",",
|
|
1250
|
+
".",
|
|
1251
|
+
"!",
|
|
1252
|
+
"?",
|
|
1253
|
+
"&",
|
|
1254
|
+
"=",
|
|
1255
|
+
"+",
|
|
1256
|
+
"-",
|
|
1257
|
+
"*",
|
|
1258
|
+
"%",
|
|
1259
|
+
"^",
|
|
1260
|
+
"~",
|
|
1261
|
+
"|",
|
|
1262
|
+
"\\",
|
|
1263
|
+
'"',
|
|
1264
|
+
"'",
|
|
1265
|
+
"`",
|
|
1266
|
+
"{",
|
|
1267
|
+
"}",
|
|
1268
|
+
"[",
|
|
1269
|
+
"]",
|
|
1270
|
+
"(",
|
|
1271
|
+
")",
|
|
1272
|
+
"<",
|
|
1273
|
+
">"
|
|
1274
|
+
];
|
|
1275
|
+
var stringify = /* @__PURE__ */ __name((value, spacing = 2) => {
|
|
1276
|
+
const space = isNumber(spacing) ? " ".repeat(spacing) : spacing;
|
|
1277
|
+
switch (value) {
|
|
1131
1278
|
case null:
|
|
1132
|
-
return
|
|
1279
|
+
return "null";
|
|
1133
1280
|
case void 0:
|
|
1134
|
-
return
|
|
1281
|
+
return '"undefined"';
|
|
1135
1282
|
case true:
|
|
1136
|
-
return
|
|
1283
|
+
return "true";
|
|
1137
1284
|
case false:
|
|
1138
|
-
return
|
|
1139
|
-
case
|
|
1140
|
-
return
|
|
1141
|
-
case
|
|
1142
|
-
return
|
|
1143
|
-
}
|
|
1144
|
-
if (Array.isArray(
|
|
1145
|
-
if (
|
|
1146
|
-
switch (typeof
|
|
1147
|
-
case
|
|
1148
|
-
return `${
|
|
1149
|
-
case
|
|
1150
|
-
return JSON.stringify(
|
|
1151
|
-
case
|
|
1152
|
-
return `{${
|
|
1285
|
+
return "false";
|
|
1286
|
+
case Number.POSITIVE_INFINITY:
|
|
1287
|
+
return "infinity";
|
|
1288
|
+
case Number.NEGATIVE_INFINITY:
|
|
1289
|
+
return "-infinity";
|
|
1290
|
+
}
|
|
1291
|
+
if (Array.isArray(value)) return `[${space}${value.map((v) => stringify(v, space)).join(`,${space}`)}${space}]`;
|
|
1292
|
+
if (value instanceof Uint8Array) return value.toString();
|
|
1293
|
+
switch (typeof value) {
|
|
1294
|
+
case "number":
|
|
1295
|
+
return `${value}`;
|
|
1296
|
+
case "string":
|
|
1297
|
+
return JSON.stringify(value);
|
|
1298
|
+
case "object":
|
|
1299
|
+
return `{${space}${Object.keys(value).filter((key) => !isUndefined(value[key])).map((key) => `${invalidKeyChars.some((invalidKeyChar) => key.includes(invalidKeyChar)) ? `"${key}"` : key}: ${space}${stringify(value[key], space)}`).join(`,${space}`)}${space}}`;
|
|
1153
1300
|
default:
|
|
1154
|
-
return
|
|
1301
|
+
return "null";
|
|
1155
1302
|
}
|
|
1156
|
-
}, "
|
|
1303
|
+
}, "stringify");
|
|
1157
1304
|
|
|
1158
1305
|
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/double-indexed-kv.js
|
|
1159
1306
|
var DoubleIndexedKV = class {
|
|
@@ -1215,7 +1362,7 @@ var ClassRegistry = class extends Registry {
|
|
|
1215
1362
|
__name(this, "ClassRegistry");
|
|
1216
1363
|
}
|
|
1217
1364
|
constructor() {
|
|
1218
|
-
super((
|
|
1365
|
+
super((c) => c.name);
|
|
1219
1366
|
this.classToAllowedProps = /* @__PURE__ */ new Map();
|
|
1220
1367
|
}
|
|
1221
1368
|
register(value, options) {
|
|
@@ -1253,8 +1400,8 @@ function find(record, predicate) {
|
|
|
1253
1400
|
return values.find(predicate);
|
|
1254
1401
|
}
|
|
1255
1402
|
const valuesNotNever = values;
|
|
1256
|
-
for (let
|
|
1257
|
-
const value = valuesNotNever[
|
|
1403
|
+
for (let i = 0; i < valuesNotNever.length; i++) {
|
|
1404
|
+
const value = valuesNotNever[i];
|
|
1258
1405
|
if (predicate(value)) {
|
|
1259
1406
|
return value;
|
|
1260
1407
|
}
|
|
@@ -1271,8 +1418,8 @@ function includes(arr, value) {
|
|
|
1271
1418
|
}
|
|
1272
1419
|
__name(includes, "includes");
|
|
1273
1420
|
function findArr(record, predicate) {
|
|
1274
|
-
for (let
|
|
1275
|
-
const value = record[
|
|
1421
|
+
for (let i = 0; i < record.length; i++) {
|
|
1422
|
+
const value = record[i];
|
|
1276
1423
|
if (predicate(value)) {
|
|
1277
1424
|
return value;
|
|
1278
1425
|
}
|
|
@@ -1302,18 +1449,18 @@ var CustomTransformerRegistry = class {
|
|
|
1302
1449
|
|
|
1303
1450
|
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/is.js
|
|
1304
1451
|
var getType = /* @__PURE__ */ __name((payload) => Object.prototype.toString.call(payload).slice(8, -1), "getType");
|
|
1305
|
-
var
|
|
1452
|
+
var isUndefined2 = /* @__PURE__ */ __name((payload) => typeof payload === "undefined", "isUndefined");
|
|
1306
1453
|
var isNull = /* @__PURE__ */ __name((payload) => payload === null, "isNull");
|
|
1307
|
-
var
|
|
1454
|
+
var isPlainObject2 = /* @__PURE__ */ __name((payload) => {
|
|
1308
1455
|
if (typeof payload !== "object" || payload === null) return false;
|
|
1309
1456
|
if (payload === Object.prototype) return false;
|
|
1310
1457
|
if (Object.getPrototypeOf(payload) === null) return true;
|
|
1311
1458
|
return Object.getPrototypeOf(payload) === Object.prototype;
|
|
1312
1459
|
}, "isPlainObject");
|
|
1313
|
-
var isEmptyObject = /* @__PURE__ */ __name((payload) =>
|
|
1460
|
+
var isEmptyObject = /* @__PURE__ */ __name((payload) => isPlainObject2(payload) && Object.keys(payload).length === 0, "isEmptyObject");
|
|
1314
1461
|
var isArray = /* @__PURE__ */ __name((payload) => Array.isArray(payload), "isArray");
|
|
1315
|
-
var
|
|
1316
|
-
var
|
|
1462
|
+
var isString2 = /* @__PURE__ */ __name((payload) => typeof payload === "string", "isString");
|
|
1463
|
+
var isNumber2 = /* @__PURE__ */ __name((payload) => typeof payload === "number" && !isNaN(payload), "isNumber");
|
|
1317
1464
|
var isBoolean = /* @__PURE__ */ __name((payload) => typeof payload === "boolean", "isBoolean");
|
|
1318
1465
|
var isRegExp = /* @__PURE__ */ __name((payload) => payload instanceof RegExp, "isRegExp");
|
|
1319
1466
|
var isMap = /* @__PURE__ */ __name((payload) => payload instanceof Map, "isMap");
|
|
@@ -1322,7 +1469,7 @@ var isSymbol = /* @__PURE__ */ __name((payload) => getType(payload) === "Symbol"
|
|
|
1322
1469
|
var isDate = /* @__PURE__ */ __name((payload) => payload instanceof Date && !isNaN(payload.valueOf()), "isDate");
|
|
1323
1470
|
var isError = /* @__PURE__ */ __name((payload) => payload instanceof Error, "isError");
|
|
1324
1471
|
var isNaNValue = /* @__PURE__ */ __name((payload) => typeof payload === "number" && isNaN(payload), "isNaNValue");
|
|
1325
|
-
var isPrimitive = /* @__PURE__ */ __name((payload) => isBoolean(payload) || isNull(payload) ||
|
|
1472
|
+
var isPrimitive = /* @__PURE__ */ __name((payload) => isBoolean(payload) || isNull(payload) || isUndefined2(payload) || isNumber2(payload) || isString2(payload) || isSymbol(payload), "isPrimitive");
|
|
1326
1473
|
var isBigint = /* @__PURE__ */ __name((payload) => typeof payload === "bigint", "isBigint");
|
|
1327
1474
|
var isInfinite = /* @__PURE__ */ __name((payload) => payload === Infinity || payload === -Infinity, "isInfinite");
|
|
1328
1475
|
var isTypedArray = /* @__PURE__ */ __name((payload) => ArrayBuffer.isView(payload) && !(payload instanceof DataView), "isTypedArray");
|
|
@@ -1334,12 +1481,12 @@ var stringifyPath = /* @__PURE__ */ __name((path) => path.map(String).map(escape
|
|
|
1334
1481
|
var parsePath = /* @__PURE__ */ __name((string) => {
|
|
1335
1482
|
const result = [];
|
|
1336
1483
|
let segment = "";
|
|
1337
|
-
for (let
|
|
1338
|
-
let char = string.charAt(
|
|
1339
|
-
const isEscapedDot = char === "\\" && string.charAt(
|
|
1484
|
+
for (let i = 0; i < string.length; i++) {
|
|
1485
|
+
let char = string.charAt(i);
|
|
1486
|
+
const isEscapedDot = char === "\\" && string.charAt(i + 1) === ".";
|
|
1340
1487
|
if (isEscapedDot) {
|
|
1341
1488
|
segment += ".";
|
|
1342
|
-
|
|
1489
|
+
i++;
|
|
1343
1490
|
continue;
|
|
1344
1491
|
}
|
|
1345
1492
|
const isEndOfSegment = char === ".";
|
|
@@ -1366,7 +1513,7 @@ function simpleTransformation(isApplicable, annotation, transform, untransform)
|
|
|
1366
1513
|
}
|
|
1367
1514
|
__name(simpleTransformation, "simpleTransformation");
|
|
1368
1515
|
var simpleRules = [
|
|
1369
|
-
simpleTransformation(
|
|
1516
|
+
simpleTransformation(isUndefined2, "undefined", () => null, () => void 0),
|
|
1370
1517
|
simpleTransformation(isBigint, "bigint", (v) => v.toString(), (v) => {
|
|
1371
1518
|
if (typeof BigInt !== "undefined") {
|
|
1372
1519
|
return BigInt(v);
|
|
@@ -1385,13 +1532,13 @@ var simpleRules = [
|
|
|
1385
1532
|
});
|
|
1386
1533
|
return baseError;
|
|
1387
1534
|
}, (v, superJson) => {
|
|
1388
|
-
const
|
|
1389
|
-
|
|
1390
|
-
|
|
1535
|
+
const e = new Error(v.message);
|
|
1536
|
+
e.name = v.name;
|
|
1537
|
+
e.stack = v.stack;
|
|
1391
1538
|
superJson.allowedErrorProps.forEach((prop) => {
|
|
1392
|
-
|
|
1539
|
+
e[prop] = v[prop];
|
|
1393
1540
|
});
|
|
1394
|
-
return
|
|
1541
|
+
return e;
|
|
1395
1542
|
}),
|
|
1396
1543
|
simpleTransformation(isRegExp, "regexp", (v) => "" + v, (regex) => {
|
|
1397
1544
|
const body = regex.slice(1, regex.lastIndexOf("/"));
|
|
@@ -1447,8 +1594,8 @@ var symbolRule = compositeTransformation((s, superJson) => {
|
|
|
1447
1594
|
"symbol",
|
|
1448
1595
|
identifier
|
|
1449
1596
|
];
|
|
1450
|
-
}, (v) => v.description, (_,
|
|
1451
|
-
const value = superJson.symbolRegistry.getValue(
|
|
1597
|
+
}, (v) => v.description, (_, a, superJson) => {
|
|
1598
|
+
const value = superJson.symbolRegistry.getValue(a[1]);
|
|
1452
1599
|
if (!value) {
|
|
1453
1600
|
throw new Error("Trying to deserialize unknown symbol");
|
|
1454
1601
|
}
|
|
@@ -1473,8 +1620,8 @@ var typedArrayRule = compositeTransformation(isTypedArray, (v) => [
|
|
|
1473
1620
|
v.constructor.name
|
|
1474
1621
|
], (v) => [
|
|
1475
1622
|
...v
|
|
1476
|
-
], (v,
|
|
1477
|
-
const ctor = constructorToName[
|
|
1623
|
+
], (v, a) => {
|
|
1624
|
+
const ctor = constructorToName[a[1]];
|
|
1478
1625
|
if (!ctor) {
|
|
1479
1626
|
throw new Error("Trying to deserialize unknown typed array");
|
|
1480
1627
|
}
|
|
@@ -1506,10 +1653,10 @@ var classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, sup
|
|
|
1506
1653
|
result[prop] = clazz[prop];
|
|
1507
1654
|
});
|
|
1508
1655
|
return result;
|
|
1509
|
-
}, (v,
|
|
1510
|
-
const clazz = superJson.classRegistry.getValue(
|
|
1656
|
+
}, (v, a, superJson) => {
|
|
1657
|
+
const clazz = superJson.classRegistry.getValue(a[1]);
|
|
1511
1658
|
if (!clazz) {
|
|
1512
|
-
throw new Error(`Trying to deserialize unknown class '${
|
|
1659
|
+
throw new Error(`Trying to deserialize unknown class '${a[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
|
|
1513
1660
|
}
|
|
1514
1661
|
return Object.assign(Object.create(clazz.prototype), v);
|
|
1515
1662
|
});
|
|
@@ -1524,8 +1671,8 @@ var customRule = compositeTransformation((value, superJson) => {
|
|
|
1524
1671
|
}, (value, superJson) => {
|
|
1525
1672
|
const transformer = superJson.customTransformerRegistry.findApplicable(value);
|
|
1526
1673
|
return transformer.serialize(value);
|
|
1527
|
-
}, (v,
|
|
1528
|
-
const transformer = superJson.customTransformerRegistry.findByName(
|
|
1674
|
+
}, (v, a, superJson) => {
|
|
1675
|
+
const transformer = superJson.customTransformerRegistry.findByName(a[1]);
|
|
1529
1676
|
if (!transformer) {
|
|
1530
1677
|
throw new Error("Trying to deserialize unknown custom value");
|
|
1531
1678
|
}
|
|
@@ -1582,12 +1729,12 @@ var untransformValue = /* @__PURE__ */ __name((json, type, superJson) => {
|
|
|
1582
1729
|
}, "untransformValue");
|
|
1583
1730
|
|
|
1584
1731
|
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/accessDeep.js
|
|
1585
|
-
var getNthKey = /* @__PURE__ */ __name((value,
|
|
1586
|
-
if (
|
|
1732
|
+
var getNthKey = /* @__PURE__ */ __name((value, n) => {
|
|
1733
|
+
if (n > value.size) throw new Error("index out of bounds");
|
|
1587
1734
|
const keys = value.keys();
|
|
1588
|
-
while (
|
|
1735
|
+
while (n > 0) {
|
|
1589
1736
|
keys.next();
|
|
1590
|
-
|
|
1737
|
+
n--;
|
|
1591
1738
|
}
|
|
1592
1739
|
return keys.next().value;
|
|
1593
1740
|
}, "getNthKey");
|
|
@@ -1605,13 +1752,13 @@ function validatePath(path) {
|
|
|
1605
1752
|
__name(validatePath, "validatePath");
|
|
1606
1753
|
var getDeep = /* @__PURE__ */ __name((object, path) => {
|
|
1607
1754
|
validatePath(path);
|
|
1608
|
-
for (let
|
|
1609
|
-
const key = path[
|
|
1755
|
+
for (let i = 0; i < path.length; i++) {
|
|
1756
|
+
const key = path[i];
|
|
1610
1757
|
if (isSet(object)) {
|
|
1611
1758
|
object = getNthKey(object, +key);
|
|
1612
1759
|
} else if (isMap(object)) {
|
|
1613
1760
|
const row = +key;
|
|
1614
|
-
const type = +path[++
|
|
1761
|
+
const type = +path[++i] === 0 ? "key" : "value";
|
|
1615
1762
|
const keyOfRow = getNthKey(object, row);
|
|
1616
1763
|
switch (type) {
|
|
1617
1764
|
case "key":
|
|
@@ -1633,23 +1780,23 @@ var setDeep = /* @__PURE__ */ __name((object, path, mapper) => {
|
|
|
1633
1780
|
return mapper(object);
|
|
1634
1781
|
}
|
|
1635
1782
|
let parent = object;
|
|
1636
|
-
for (let
|
|
1637
|
-
const key = path[
|
|
1783
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
1784
|
+
const key = path[i];
|
|
1638
1785
|
if (isArray(parent)) {
|
|
1639
1786
|
const index = +key;
|
|
1640
1787
|
parent = parent[index];
|
|
1641
|
-
} else if (
|
|
1788
|
+
} else if (isPlainObject2(parent)) {
|
|
1642
1789
|
parent = parent[key];
|
|
1643
1790
|
} else if (isSet(parent)) {
|
|
1644
1791
|
const row = +key;
|
|
1645
1792
|
parent = getNthKey(parent, row);
|
|
1646
1793
|
} else if (isMap(parent)) {
|
|
1647
|
-
const isEnd =
|
|
1794
|
+
const isEnd = i === path.length - 2;
|
|
1648
1795
|
if (isEnd) {
|
|
1649
1796
|
break;
|
|
1650
1797
|
}
|
|
1651
1798
|
const row = +key;
|
|
1652
|
-
const type = +path[++
|
|
1799
|
+
const type = +path[++i] === 0 ? "key" : "value";
|
|
1653
1800
|
const keyOfRow = getNthKey(parent, row);
|
|
1654
1801
|
switch (type) {
|
|
1655
1802
|
case "key":
|
|
@@ -1664,7 +1811,7 @@ var setDeep = /* @__PURE__ */ __name((object, path, mapper) => {
|
|
|
1664
1811
|
const lastKey = path[path.length - 1];
|
|
1665
1812
|
if (isArray(parent)) {
|
|
1666
1813
|
parent[+lastKey] = mapper(parent[+lastKey]);
|
|
1667
|
-
} else if (
|
|
1814
|
+
} else if (isPlainObject2(parent)) {
|
|
1668
1815
|
parent[lastKey] = mapper(parent[lastKey]);
|
|
1669
1816
|
}
|
|
1670
1817
|
if (isSet(parent)) {
|
|
@@ -1750,7 +1897,7 @@ function applyReferentialEqualityAnnotations(plain, annotations) {
|
|
|
1750
1897
|
return plain;
|
|
1751
1898
|
}
|
|
1752
1899
|
__name(applyReferentialEqualityAnnotations, "applyReferentialEqualityAnnotations");
|
|
1753
|
-
var isDeep = /* @__PURE__ */ __name((object, superJson) =>
|
|
1900
|
+
var isDeep = /* @__PURE__ */ __name((object, superJson) => isPlainObject2(object) || isArray(object) || isMap(object) || isSet(object) || isInstanceOfRegisteredClass(object, superJson), "isDeep");
|
|
1754
1901
|
function addIdentity(object, path, identities) {
|
|
1755
1902
|
const existingSet = identities.get(object);
|
|
1756
1903
|
if (existingSet) {
|
|
@@ -1770,7 +1917,7 @@ function generateReferentialEqualityAnnotations(identitites, dedupe) {
|
|
|
1770
1917
|
return;
|
|
1771
1918
|
}
|
|
1772
1919
|
if (!dedupe) {
|
|
1773
|
-
paths = paths.map((path) => path.map(String)).sort((
|
|
1920
|
+
paths = paths.map((path) => path.map(String)).sort((a, b) => a.length - b.length);
|
|
1774
1921
|
}
|
|
1775
1922
|
const [representativePath, ...identicalPaths] = paths;
|
|
1776
1923
|
if (representativePath.length === 0) {
|
|
@@ -1844,7 +1991,7 @@ var walker = /* @__PURE__ */ __name((object, identities, superJson, dedupe, path
|
|
|
1844
1991
|
transformedValue[index] = recursiveResult.transformedValue;
|
|
1845
1992
|
if (isArray(recursiveResult.annotations)) {
|
|
1846
1993
|
innerAnnotations[index] = recursiveResult.annotations;
|
|
1847
|
-
} else if (
|
|
1994
|
+
} else if (isPlainObject2(recursiveResult.annotations)) {
|
|
1848
1995
|
forEach(recursiveResult.annotations, (tree, key) => {
|
|
1849
1996
|
innerAnnotations[escapeKey(index) + "." + key] = tree;
|
|
1850
1997
|
});
|
|
@@ -1877,24 +2024,24 @@ function isArray2(payload) {
|
|
|
1877
2024
|
return getType2(payload) === "Array";
|
|
1878
2025
|
}
|
|
1879
2026
|
__name(isArray2, "isArray");
|
|
1880
|
-
function
|
|
2027
|
+
function isPlainObject3(payload) {
|
|
1881
2028
|
if (getType2(payload) !== "Object") return false;
|
|
1882
2029
|
const prototype = Object.getPrototypeOf(payload);
|
|
1883
2030
|
return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
|
|
1884
2031
|
}
|
|
1885
|
-
__name(
|
|
2032
|
+
__name(isPlainObject3, "isPlainObject");
|
|
1886
2033
|
function isNull2(payload) {
|
|
1887
2034
|
return getType2(payload) === "Null";
|
|
1888
2035
|
}
|
|
1889
2036
|
__name(isNull2, "isNull");
|
|
1890
|
-
function isOneOf(
|
|
1891
|
-
return (value) =>
|
|
2037
|
+
function isOneOf(a, b, c, d, e) {
|
|
2038
|
+
return (value) => a(value) || b(value) || !!c && c(value) || !!d && d(value) || !!e && e(value);
|
|
1892
2039
|
}
|
|
1893
2040
|
__name(isOneOf, "isOneOf");
|
|
1894
|
-
function
|
|
2041
|
+
function isUndefined3(payload) {
|
|
1895
2042
|
return getType2(payload) === "Undefined";
|
|
1896
2043
|
}
|
|
1897
|
-
__name(
|
|
2044
|
+
__name(isUndefined3, "isUndefined");
|
|
1898
2045
|
|
|
1899
2046
|
// ../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
|
|
1900
2047
|
function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
|
|
@@ -1914,7 +2061,7 @@ function copy(target, options = {}) {
|
|
|
1914
2061
|
if (isArray2(target)) {
|
|
1915
2062
|
return target.map((item) => copy(item, options));
|
|
1916
2063
|
}
|
|
1917
|
-
if (!
|
|
2064
|
+
if (!isPlainObject3(target)) {
|
|
1918
2065
|
return target;
|
|
1919
2066
|
}
|
|
1920
2067
|
const props = Object.getOwnPropertyNames(target);
|
|
@@ -2021,48 +2168,107 @@ SuperJSON.registerCustom;
|
|
|
2021
2168
|
SuperJSON.registerSymbol;
|
|
2022
2169
|
SuperJSON.allowErrorProps;
|
|
2023
2170
|
|
|
2024
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
2025
|
-
var
|
|
2171
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/storm-json.mjs
|
|
2172
|
+
var StormJSON = class StormJSON2 extends SuperJSON {
|
|
2026
2173
|
static {
|
|
2027
|
-
__name(this, "
|
|
2174
|
+
__name(this, "StormJSON");
|
|
2028
2175
|
}
|
|
2029
|
-
static #
|
|
2176
|
+
static #instance;
|
|
2030
2177
|
static get instance() {
|
|
2031
|
-
|
|
2178
|
+
if (!StormJSON2.#instance) StormJSON2.#instance = new StormJSON2();
|
|
2179
|
+
return StormJSON2.#instance;
|
|
2032
2180
|
}
|
|
2033
|
-
|
|
2034
|
-
|
|
2181
|
+
/**
|
|
2182
|
+
* Deserialize the given value with superjson using the given metadata
|
|
2183
|
+
*/
|
|
2184
|
+
static deserialize(payload) {
|
|
2185
|
+
return StormJSON2.instance.deserialize(payload);
|
|
2035
2186
|
}
|
|
2036
|
-
|
|
2037
|
-
|
|
2187
|
+
/**
|
|
2188
|
+
* Serialize the given value with superjson
|
|
2189
|
+
*/
|
|
2190
|
+
static serialize(object) {
|
|
2191
|
+
return StormJSON2.instance.serialize(object);
|
|
2038
2192
|
}
|
|
2039
|
-
|
|
2040
|
-
|
|
2193
|
+
/**
|
|
2194
|
+
* Parse the given string value with superjson using the given metadata
|
|
2195
|
+
*
|
|
2196
|
+
* @param value - The string value to parse
|
|
2197
|
+
* @returns The parsed data
|
|
2198
|
+
*/
|
|
2199
|
+
static parse(value) {
|
|
2200
|
+
return parse(value);
|
|
2041
2201
|
}
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2202
|
+
/**
|
|
2203
|
+
* Serializes the given data to a JSON string.
|
|
2204
|
+
* By default the JSON string is formatted with a 2 space indentation to be easy readable.
|
|
2205
|
+
*
|
|
2206
|
+
* @param value - Object which should be serialized to JSON
|
|
2207
|
+
* @param _options - JSON serialize options
|
|
2208
|
+
* @returns the formatted JSON representation of the object
|
|
2209
|
+
*/
|
|
2210
|
+
static stringify(value, _options) {
|
|
2211
|
+
const customTransformer = StormJSON2.instance.customTransformerRegistry.findApplicable(value);
|
|
2212
|
+
let result = value;
|
|
2213
|
+
if (customTransformer && customTransformer.isApplicable(value)) result = customTransformer.serialize(result);
|
|
2214
|
+
return stringify(result);
|
|
2045
2215
|
}
|
|
2046
|
-
|
|
2216
|
+
/**
|
|
2217
|
+
* Parses the given JSON string and returns the object the JSON content represents.
|
|
2218
|
+
* By default javascript-style comments and trailing commas are allowed.
|
|
2219
|
+
*
|
|
2220
|
+
* @param strData - JSON content as string
|
|
2221
|
+
* @param options - JSON parse options
|
|
2222
|
+
* @returns Object the JSON content represents
|
|
2223
|
+
*/
|
|
2224
|
+
static parseJson(strData, options) {
|
|
2047
2225
|
try {
|
|
2048
|
-
if (
|
|
2226
|
+
if (options?.expectComments === false) return StormJSON2.instance.parse(strData);
|
|
2049
2227
|
} catch {
|
|
2050
2228
|
}
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2229
|
+
const errors = [];
|
|
2230
|
+
const result = parse3(strData, errors, {
|
|
2231
|
+
allowTrailingComma: true,
|
|
2232
|
+
...options
|
|
2233
|
+
});
|
|
2234
|
+
if (errors.length > 0 && errors[0]) throw new Error(formatParseError(strData, errors[0]));
|
|
2235
|
+
return result;
|
|
2054
2236
|
}
|
|
2055
|
-
|
|
2056
|
-
|
|
2237
|
+
/**
|
|
2238
|
+
* Register a custom schema with superjson
|
|
2239
|
+
*
|
|
2240
|
+
* @param name - The name of the schema
|
|
2241
|
+
* @param serialize - The function to serialize the schema
|
|
2242
|
+
* @param deserialize - The function to deserialize the schema
|
|
2243
|
+
* @param isApplicable - The function to check if the schema is applicable
|
|
2244
|
+
*/
|
|
2245
|
+
static register(name, serialize2, deserialize2, isApplicable) {
|
|
2246
|
+
StormJSON2.instance.registerCustom({
|
|
2247
|
+
isApplicable,
|
|
2248
|
+
serialize: serialize2,
|
|
2249
|
+
deserialize: deserialize2
|
|
2250
|
+
}, name);
|
|
2057
2251
|
}
|
|
2058
|
-
|
|
2059
|
-
|
|
2252
|
+
/**
|
|
2253
|
+
* Register a class with superjson
|
|
2254
|
+
*
|
|
2255
|
+
* @param classConstructor - The class constructor to register
|
|
2256
|
+
*/
|
|
2257
|
+
static registerClass(classConstructor, options) {
|
|
2258
|
+
StormJSON2.instance.registerClass(classConstructor, {
|
|
2259
|
+
identifier: isString(options) ? options : options?.identifier || classConstructor.name,
|
|
2260
|
+
allowProps: options && isObject(options) && options?.allowProps && Array.isArray(options.allowProps) ? options.allowProps : ["__typename"]
|
|
2261
|
+
});
|
|
2060
2262
|
}
|
|
2061
2263
|
constructor() {
|
|
2062
2264
|
super({ dedupe: true });
|
|
2063
2265
|
}
|
|
2064
2266
|
};
|
|
2065
|
-
|
|
2267
|
+
StormJSON.instance.registerCustom({
|
|
2268
|
+
isApplicable: /* @__PURE__ */ __name((v) => Buffer.isBuffer(v), "isApplicable"),
|
|
2269
|
+
serialize: /* @__PURE__ */ __name((v) => v.toString("base64"), "serialize"),
|
|
2270
|
+
deserialize: /* @__PURE__ */ __name((v) => Buffer.from(v, "base64"), "deserialize")
|
|
2271
|
+
}, "Bytes");
|
|
2066
2272
|
function stringifyDefaultValue(property, value) {
|
|
2067
2273
|
return isSetObject(property) ? stringifyValue(property.type, value ?? property.getDefaultValue()) : stringifyValue({
|
|
2068
2274
|
kind: property
|
|
@@ -2074,14 +2280,14 @@ function stringifyStringValue(value) {
|
|
|
2074
2280
|
}
|
|
2075
2281
|
__name(stringifyStringValue, "stringifyStringValue");
|
|
2076
2282
|
function stringifyValue(type, value) {
|
|
2077
|
-
return isUndefined$1(value) ? "undefined" : isNull$1(value) ? "null" : type.kind === ReflectionKind.boolean ? String(value).trim().toLowerCase() === "true" ? "true" : "false" : type.kind === ReflectionKind.string || type.kind === ReflectionKind.literal && isString$1(type.literal) ? stringifyStringValue(value) : type.kind === ReflectionKind.enum ? getEnumReflectionType(type).kind === ReflectionKind.string ? stringifyStringValue(value) : `${String(value)}` : type.kind === ReflectionKind.union ? isStringUnion(type) ? stringifyStringValue(value) : `${String(value)}` : type.kind === ReflectionKind.array ? stringifyStringValue(
|
|
2283
|
+
return isUndefined$1(value) ? "undefined" : isNull$1(value) ? "null" : type.kind === ReflectionKind.boolean ? String(value).trim().toLowerCase() === "true" ? "true" : "false" : type.kind === ReflectionKind.string || type.kind === ReflectionKind.literal && isString$1(type.literal) ? stringifyStringValue(value) : type.kind === ReflectionKind.enum ? getEnumReflectionType(type).kind === ReflectionKind.string ? stringifyStringValue(value) : `${String(value)}` : type.kind === ReflectionKind.union ? isStringUnion(type) ? stringifyStringValue(value) : `${String(value)}` : type.kind === ReflectionKind.array ? stringifyStringValue(StormJSON.stringify(value)) : type.kind === ReflectionKind.object || type.kind === ReflectionKind.objectLiteral ? StormJSON.stringify(value) : type.kind === ReflectionKind.property || type.kind === ReflectionKind.parameter ? stringifyValue(type.type, value) : String(value)?.includes('"') || String(value)?.includes("'") ? stringifyStringValue(value) : String(value);
|
|
2078
2284
|
}
|
|
2079
2285
|
__name(stringifyValue, "stringifyValue");
|
|
2080
2286
|
function getEnumReflectionType(type) {
|
|
2081
2287
|
if (type.kind !== ReflectionKind.enum) {
|
|
2082
2288
|
throw new Error(`Expected a TypeEnum, but received ${type.kind}.`);
|
|
2083
2289
|
}
|
|
2084
|
-
const unique =
|
|
2290
|
+
const unique = getUniqueBy(type.values.filter((value) => value !== void 0 && value !== null), (enumMember) => isString$1(enumMember) ? {
|
|
2085
2291
|
kind: ReflectionKind.string
|
|
2086
2292
|
} : {
|
|
2087
2293
|
kind: ReflectionKind.number
|
|
@@ -2098,7 +2304,7 @@ function getEnumReflectionType(type) {
|
|
|
2098
2304
|
__name(getEnumReflectionType, "getEnumReflectionType");
|
|
2099
2305
|
function getUnionTypes(type) {
|
|
2100
2306
|
if (type.kind === ReflectionKind.union && type.types.length > 0) {
|
|
2101
|
-
return
|
|
2307
|
+
return getUniqueBy(type.types, (member) => member.kind);
|
|
2102
2308
|
}
|
|
2103
2309
|
throw new Error(`Expected a TypeUnion, but received ${type.kind}.`);
|
|
2104
2310
|
}
|