@powerlines/deepkit 0.7.5 → 0.7.7

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.
Files changed (88) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +31 -0
  2. package/dist/_virtual/_rolldown/runtime.mjs +8 -0
  3. package/dist/capnp.cjs +955 -46
  4. package/dist/capnp.d.cts +41 -41
  5. package/dist/capnp.d.mts +41 -41
  6. package/dist/capnp.mjs +911 -2
  7. package/dist/esbuild-plugin.cjs +47 -2
  8. package/dist/esbuild-plugin.d.cts +1 -1
  9. package/dist/esbuild-plugin.d.mts +1 -1
  10. package/dist/esbuild-plugin.mjs +47 -2
  11. package/dist/index.cjs +3 -4
  12. package/dist/index.mjs +3 -4
  13. package/dist/{capnp-BLCHrDSY.cjs → packages/deepkit/schemas/reflection.cjs} +3 -1180
  14. package/dist/{reflection-Bhe75GyI.d.mts → packages/deepkit/schemas/reflection.d.cts} +2 -2
  15. package/dist/{reflection-DGOuMF8F.d.cts → packages/deepkit/schemas/reflection.d.mts} +2 -2
  16. package/dist/{capnp-BqAglxrS.mjs → packages/deepkit/schemas/reflection.mjs} +2 -910
  17. package/dist/reflect-type.cjs +5 -5
  18. package/dist/reflect-type.d.cts +1 -1
  19. package/dist/reflect-type.d.mts +1 -1
  20. package/dist/reflect-type.mjs +2 -2
  21. package/dist/resolve-reflections.cjs +1 -1
  22. package/dist/rolldown-plugin.cjs +1 -1
  23. package/dist/transformer.cjs +6 -5
  24. package/dist/transformer.d.cts +1 -1
  25. package/dist/transformer.d.mts +1 -1
  26. package/dist/transformer.mjs +2 -1
  27. package/dist/transpile.cjs +2 -2
  28. package/dist/transpile.d.cts +1 -1
  29. package/dist/transpile.d.mts +1 -1
  30. package/dist/types.d.cts +3 -3
  31. package/dist/types.d.mts +3 -3
  32. package/dist/utilities.cjs +116 -8
  33. package/dist/utilities.d.cts +1 -1
  34. package/dist/utilities.d.mts +1 -1
  35. package/dist/utilities.mjs +110 -2
  36. package/dist/{compiler-B-zwyGQf.d.cts → vendor/compiler-BYhFaVxE.d.mts} +3 -3
  37. package/dist/{compiler-DTp8Jvav.cjs → vendor/compiler-Ci5aO9pY.cjs} +2 -2
  38. package/dist/{compiler-BUUdv7wG.mjs → vendor/compiler-CqkzeoNX.mjs} +3 -3
  39. package/dist/{compiler-BzOZmhWO.d.mts → vendor/compiler-Dz2b4nOM.d.cts} +3 -3
  40. package/dist/{config-B2hS4_tR.d.mts → vendor/config-BTErH18l.d.mts} +1 -1
  41. package/dist/{config-DCmu3CV2.d.cts → vendor/config-Cc2qE8fH.d.cts} +1 -1
  42. package/dist/{config-CuXC21KA.mjs → vendor/config-eSNKiBGB.mjs} +1 -1
  43. package/dist/vendor/core.cjs +1 -1
  44. package/dist/vendor/core.d.cts +1 -1
  45. package/dist/vendor/core.d.mts +1 -1
  46. package/dist/vendor/core.mjs +1 -1
  47. package/dist/{string-CjkshhTG.mjs → vendor/string-DoT35ViA.mjs} +1 -1
  48. package/dist/{type-DfwJ6GTs.d.mts → vendor/type-2yMJb9Mw.d.cts} +1 -1
  49. package/dist/{type-DR66Hepn.d.cts → vendor/type-BoBEcrg7.d.mts} +1 -1
  50. package/dist/vendor/type-compiler/compiler.cjs +1 -1
  51. package/dist/vendor/type-compiler/compiler.d.cts +1 -1
  52. package/dist/vendor/type-compiler/compiler.d.mts +1 -1
  53. package/dist/vendor/type-compiler/compiler.mjs +1 -1
  54. package/dist/vendor/type-compiler/config.cjs +1 -1
  55. package/dist/vendor/type-compiler/config.d.cts +1 -1
  56. package/dist/vendor/type-compiler/config.d.mts +1 -1
  57. package/dist/vendor/type-compiler/config.mjs +1 -1
  58. package/dist/vendor/type-compiler/index.cjs +3 -3
  59. package/dist/vendor/type-compiler/index.d.cts +2 -2
  60. package/dist/vendor/type-compiler/index.d.mts +2 -2
  61. package/dist/vendor/type-compiler/index.mjs +2 -2
  62. package/dist/vendor/type-spec.cjs +1 -1
  63. package/dist/vendor/type-spec.d.cts +1 -1
  64. package/dist/vendor/type-spec.d.mts +1 -1
  65. package/dist/vendor/type-spec.mjs +1 -1
  66. package/dist/{type-BWm74eaQ.mjs → vendor/type-wscUl8NW.mjs} +1 -1
  67. package/dist/vendor/type.cjs +9375 -268
  68. package/dist/vendor/type.d.cts +2969 -3
  69. package/dist/vendor/type.d.mts +2969 -3
  70. package/dist/vendor/type.mjs +9109 -3
  71. package/dist/{types-BO3PJV5p.d.mts → vendor/types-BwPWMe3m.d.mts} +1 -1
  72. package/dist/{types-Bb6lL3KL.d.cts → vendor/types-exLGvFgG.d.cts} +1 -1
  73. package/package.json +13 -21
  74. package/dist/config-C0OHvihx.d.mts +0 -1
  75. package/dist/config-GPeRZeGl.d.cts +0 -1
  76. package/dist/esbuild-plugin-BUYqx8_5.cjs +0 -80
  77. package/dist/esbuild-plugin-CRQUmm86.mjs +0 -75
  78. package/dist/type-8AL5U7vn.d.cts +0 -2969
  79. package/dist/type-BDuj5wg2.d.mts +0 -2969
  80. package/dist/type-C7UXbXfx.cjs +0 -10688
  81. package/dist/type-ma8o4dJG.mjs +0 -9110
  82. package/dist/utilities-CT_jcB5h.mjs +0 -1483
  83. package/dist/utilities-Dr3TzxMb.cjs +0 -1523
  84. /package/dist/{chunk-BmvPcxpV.cjs → vendor/chunk-BmvPcxpV.cjs} +0 -0
  85. /package/dist/{chunk-CgI6uo-e.mjs → vendor/chunk-CgI6uo-e.mjs} +0 -0
  86. /package/dist/{config-GVyELKY1.cjs → vendor/config-BbFVGRVh.cjs} +0 -0
  87. /package/dist/{string-CpVz34Gv.cjs → vendor/string-LTCnMzW_.cjs} +0 -0
  88. /package/dist/{type-DhqntM0q.cjs → vendor/type-fEQrgtBF.cjs} +0 -0
@@ -1,1523 +0,0 @@
1
- const require_chunk = require('./chunk-BmvPcxpV.cjs');
2
- const require_type = require('./type-C7UXbXfx.cjs');
3
- let _stryke_type_checks = require("@stryke/type-checks");
4
- let node_buffer = require("node:buffer");
5
- let _stryke_type_checks_is_null = require("@stryke/type-checks/is-null");
6
- let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
7
- let _stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
8
-
9
- //#region ../../node_modules/.pnpm/@stryke+helpers@0.10.8/node_modules/@stryke/helpers/dist/get-unique.mjs
10
- /**
11
- * Returns a new array containing only the unique elements from the original array,
12
- * based on the values returned by the mapper function.
13
- *
14
- * @example
15
- * ```ts
16
- * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);
17
- * // [1.2, 2.1, 3.2, 5.7, 7.19]
18
- * ```
19
- *
20
- * @param arr - The array to process.
21
- * @param mapper - The function used to convert the array elements.
22
- * @returns A new array containing only the unique elements from the original array, based on the values returned by the mapper function.
23
- */
24
- function getUniqueBy(arr, mapper = (item) => item) {
25
- const map = /* @__PURE__ */ new Map();
26
- for (const item of arr) {
27
- const key = mapper(item);
28
- if (!map.has(key)) map.set(key, item);
29
- }
30
- return [...map.values()];
31
- }
32
-
33
- //#endregion
34
- //#region ../../node_modules/.pnpm/@stryke+json@0.14.12/node_modules/@stryke/json/dist/code-frames-C8DEdLmV.mjs
35
- /**
36
- * RegExp to test for newlines in terminal.
37
- */
38
- const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
39
- /**
40
- * Extract what lines should be marked and highlighted.
41
- */
42
- function getMarkerLines(loc, source, opts = {}) {
43
- const startLoc = {
44
- column: 0,
45
- line: -1,
46
- ...loc.start
47
- };
48
- const endLoc = {
49
- ...startLoc,
50
- ...loc.end
51
- };
52
- const { linesAbove = 2, linesBelow = 3 } = opts || {};
53
- const startLine = startLoc.line;
54
- const startColumn = startLoc.column;
55
- const endLine = endLoc.line;
56
- const endColumn = endLoc.column;
57
- let start = Math.max(startLine - (linesAbove + 1), 0);
58
- let end = Math.min(source.length, endLine + linesBelow);
59
- if (startLine === -1) start = 0;
60
- if (endLine === -1) end = source.length;
61
- const lineDiff = endLine - startLine;
62
- const markerLines = {};
63
- if (lineDiff) for (let i = 0; i <= lineDiff; i++) {
64
- const lineNumber = i + startLine;
65
- if (!startColumn) markerLines[lineNumber] = true;
66
- else if (i === 0) markerLines[lineNumber] = [startColumn, (source[lineNumber - 1]?.length ?? 0) - startColumn + 1];
67
- else if (i === lineDiff) markerLines[lineNumber] = [0, endColumn];
68
- else markerLines[lineNumber] = [0, source[lineNumber - i]?.length ?? 0];
69
- }
70
- else if (startColumn === endColumn) markerLines[startLine] = startColumn ? [startColumn, 0] : true;
71
- else markerLines[startLine] = [startColumn, endColumn - startColumn];
72
- return {
73
- start,
74
- end,
75
- markerLines
76
- };
77
- }
78
- function codeFrameColumns(rawLines, loc, opts = {}) {
79
- const { start, end, markerLines } = getMarkerLines(loc, rawLines.split(NEWLINE), opts);
80
- const numberMaxWidth = String(end).length;
81
- return (opts.highlight ? opts.highlight(rawLines) : rawLines).split(NEWLINE).slice(start, end).map((line, index) => {
82
- const number = start + 1 + index;
83
- const gutter = ` ${` ${number}`.slice(-numberMaxWidth)} | `;
84
- const hasMarker = Boolean(markerLines[number] ?? false);
85
- if (hasMarker) {
86
- let markerLine = "";
87
- if (Array.isArray(hasMarker)) {
88
- const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
89
- const numberOfMarkers = hasMarker[1] || 1;
90
- markerLine = [
91
- "\n ",
92
- gutter.replace(/\d/g, " "),
93
- markerSpacing,
94
- "^".repeat(numberOfMarkers)
95
- ].join("");
96
- }
97
- return [
98
- ">",
99
- gutter,
100
- line,
101
- markerLine
102
- ].join("");
103
- }
104
- return ` ${gutter}${line}`;
105
- }).join("\n");
106
- }
107
-
108
- //#endregion
109
- //#region ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/umd/main.js
110
- var require_main = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
111
- (function(factory) {
112
- if (typeof module === "object" && typeof module.exports === "object") {
113
- var v = factory(require, exports);
114
- if (v !== void 0) module.exports = v;
115
- } else if (typeof define === "function" && define.amd) define([
116
- "require",
117
- "exports",
118
- "./impl/format",
119
- "./impl/edit",
120
- "./impl/scanner",
121
- "./impl/parser"
122
- ], factory);
123
- })(function(require, exports$1) {
124
- "use strict";
125
- Object.defineProperty(exports$1, "__esModule", { value: true });
126
- exports$1.applyEdits = exports$1.modify = exports$1.format = exports$1.printParseErrorCode = exports$1.ParseErrorCode = exports$1.stripComments = exports$1.visit = exports$1.getNodeValue = exports$1.getNodePath = exports$1.findNodeAtOffset = exports$1.findNodeAtLocation = exports$1.parseTree = exports$1.parse = exports$1.getLocation = exports$1.SyntaxKind = exports$1.ScanError = exports$1.createScanner = void 0;
127
- const formatter = require("./impl/format");
128
- const edit = require("./impl/edit");
129
- const scanner = require("./impl/scanner");
130
- const parser = require("./impl/parser");
131
- /**
132
- * Creates a JSON scanner on the given text.
133
- * If ignoreTrivia is set, whitespaces or comments are ignored.
134
- */
135
- exports$1.createScanner = scanner.createScanner;
136
- var ScanError;
137
- (function(ScanError) {
138
- ScanError[ScanError["None"] = 0] = "None";
139
- ScanError[ScanError["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
140
- ScanError[ScanError["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
141
- ScanError[ScanError["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
142
- ScanError[ScanError["InvalidUnicode"] = 4] = "InvalidUnicode";
143
- ScanError[ScanError["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
144
- ScanError[ScanError["InvalidCharacter"] = 6] = "InvalidCharacter";
145
- })(ScanError || (exports$1.ScanError = ScanError = {}));
146
- var SyntaxKind;
147
- (function(SyntaxKind) {
148
- SyntaxKind[SyntaxKind["OpenBraceToken"] = 1] = "OpenBraceToken";
149
- SyntaxKind[SyntaxKind["CloseBraceToken"] = 2] = "CloseBraceToken";
150
- SyntaxKind[SyntaxKind["OpenBracketToken"] = 3] = "OpenBracketToken";
151
- SyntaxKind[SyntaxKind["CloseBracketToken"] = 4] = "CloseBracketToken";
152
- SyntaxKind[SyntaxKind["CommaToken"] = 5] = "CommaToken";
153
- SyntaxKind[SyntaxKind["ColonToken"] = 6] = "ColonToken";
154
- SyntaxKind[SyntaxKind["NullKeyword"] = 7] = "NullKeyword";
155
- SyntaxKind[SyntaxKind["TrueKeyword"] = 8] = "TrueKeyword";
156
- SyntaxKind[SyntaxKind["FalseKeyword"] = 9] = "FalseKeyword";
157
- SyntaxKind[SyntaxKind["StringLiteral"] = 10] = "StringLiteral";
158
- SyntaxKind[SyntaxKind["NumericLiteral"] = 11] = "NumericLiteral";
159
- SyntaxKind[SyntaxKind["LineCommentTrivia"] = 12] = "LineCommentTrivia";
160
- SyntaxKind[SyntaxKind["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
161
- SyntaxKind[SyntaxKind["LineBreakTrivia"] = 14] = "LineBreakTrivia";
162
- SyntaxKind[SyntaxKind["Trivia"] = 15] = "Trivia";
163
- SyntaxKind[SyntaxKind["Unknown"] = 16] = "Unknown";
164
- SyntaxKind[SyntaxKind["EOF"] = 17] = "EOF";
165
- })(SyntaxKind || (exports$1.SyntaxKind = SyntaxKind = {}));
166
- /**
167
- * For a given offset, evaluate the location in the JSON document. Each segment in the location path is either a property name or an array index.
168
- */
169
- exports$1.getLocation = parser.getLocation;
170
- /**
171
- * Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.
172
- * Therefore, always check the errors list to find out if the input was valid.
173
- */
174
- exports$1.parse = parser.parse;
175
- /**
176
- * Parses the given text and returns a tree representation the JSON content. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.
177
- */
178
- exports$1.parseTree = parser.parseTree;
179
- /**
180
- * Finds the node at the given path in a JSON DOM.
181
- */
182
- exports$1.findNodeAtLocation = parser.findNodeAtLocation;
183
- /**
184
- * Finds the innermost node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset.
185
- */
186
- exports$1.findNodeAtOffset = parser.findNodeAtOffset;
187
- /**
188
- * Gets the JSON path of the given JSON DOM node
189
- */
190
- exports$1.getNodePath = parser.getNodePath;
191
- /**
192
- * Evaluates the JavaScript object of the given JSON DOM node
193
- */
194
- exports$1.getNodeValue = parser.getNodeValue;
195
- /**
196
- * Parses the given text and invokes the visitor functions for each object, array and literal reached.
197
- */
198
- exports$1.visit = parser.visit;
199
- /**
200
- * Takes JSON with JavaScript-style comments and remove
201
- * them. Optionally replaces every none-newline character
202
- * of comments with a replaceCharacter
203
- */
204
- exports$1.stripComments = parser.stripComments;
205
- var ParseErrorCode;
206
- (function(ParseErrorCode) {
207
- ParseErrorCode[ParseErrorCode["InvalidSymbol"] = 1] = "InvalidSymbol";
208
- ParseErrorCode[ParseErrorCode["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
209
- ParseErrorCode[ParseErrorCode["PropertyNameExpected"] = 3] = "PropertyNameExpected";
210
- ParseErrorCode[ParseErrorCode["ValueExpected"] = 4] = "ValueExpected";
211
- ParseErrorCode[ParseErrorCode["ColonExpected"] = 5] = "ColonExpected";
212
- ParseErrorCode[ParseErrorCode["CommaExpected"] = 6] = "CommaExpected";
213
- ParseErrorCode[ParseErrorCode["CloseBraceExpected"] = 7] = "CloseBraceExpected";
214
- ParseErrorCode[ParseErrorCode["CloseBracketExpected"] = 8] = "CloseBracketExpected";
215
- ParseErrorCode[ParseErrorCode["EndOfFileExpected"] = 9] = "EndOfFileExpected";
216
- ParseErrorCode[ParseErrorCode["InvalidCommentToken"] = 10] = "InvalidCommentToken";
217
- ParseErrorCode[ParseErrorCode["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
218
- ParseErrorCode[ParseErrorCode["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
219
- ParseErrorCode[ParseErrorCode["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
220
- ParseErrorCode[ParseErrorCode["InvalidUnicode"] = 14] = "InvalidUnicode";
221
- ParseErrorCode[ParseErrorCode["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
222
- ParseErrorCode[ParseErrorCode["InvalidCharacter"] = 16] = "InvalidCharacter";
223
- })(ParseErrorCode || (exports$1.ParseErrorCode = ParseErrorCode = {}));
224
- function printParseErrorCode(code) {
225
- switch (code) {
226
- case 1: return "InvalidSymbol";
227
- case 2: return "InvalidNumberFormat";
228
- case 3: return "PropertyNameExpected";
229
- case 4: return "ValueExpected";
230
- case 5: return "ColonExpected";
231
- case 6: return "CommaExpected";
232
- case 7: return "CloseBraceExpected";
233
- case 8: return "CloseBracketExpected";
234
- case 9: return "EndOfFileExpected";
235
- case 10: return "InvalidCommentToken";
236
- case 11: return "UnexpectedEndOfComment";
237
- case 12: return "UnexpectedEndOfString";
238
- case 13: return "UnexpectedEndOfNumber";
239
- case 14: return "InvalidUnicode";
240
- case 15: return "InvalidEscapeCharacter";
241
- case 16: return "InvalidCharacter";
242
- }
243
- return "<unknown ParseErrorCode>";
244
- }
245
- exports$1.printParseErrorCode = printParseErrorCode;
246
- /**
247
- * Computes the edit operations needed to format a JSON document.
248
- *
249
- * @param documentText The input text
250
- * @param range The range to format or `undefined` to format the full content
251
- * @param options The formatting options
252
- * @returns The edit operations describing the formatting changes to the original document following the format described in {@linkcode EditResult}.
253
- * To apply the edit operations to the input, use {@linkcode applyEdits}.
254
- */
255
- function format(documentText, range, options) {
256
- return formatter.format(documentText, range, options);
257
- }
258
- exports$1.format = format;
259
- /**
260
- * Computes the edit operations needed to modify a value in the JSON document.
261
- *
262
- * @param documentText The input text
263
- * @param path The path of the value to change. The path represents either to the document root, a property or an array item.
264
- * If the path points to an non-existing property or item, it will be created.
265
- * @param value The new value for the specified property or item. If the value is undefined,
266
- * the property or item will be removed.
267
- * @param options Options
268
- * @returns The edit operations describing the changes to the original document, following the format described in {@linkcode EditResult}.
269
- * To apply the edit operations to the input, use {@linkcode applyEdits}.
270
- */
271
- function modify(text, path, value, options) {
272
- return edit.setProperty(text, path, value, options);
273
- }
274
- exports$1.modify = modify;
275
- /**
276
- * Applies edits to an input string.
277
- * @param text The input text
278
- * @param edits Edit operations following the format described in {@linkcode EditResult}.
279
- * @returns The text with the applied edits.
280
- * @throws An error if the edit operations are not well-formed as described in {@linkcode EditResult}.
281
- */
282
- function applyEdits(text, edits) {
283
- let sortedEdits = edits.slice(0).sort((a, b) => {
284
- const diff = a.offset - b.offset;
285
- if (diff === 0) return a.length - b.length;
286
- return diff;
287
- });
288
- let lastModifiedOffset = text.length;
289
- for (let i = sortedEdits.length - 1; i >= 0; i--) {
290
- let e = sortedEdits[i];
291
- if (e.offset + e.length <= lastModifiedOffset) text = edit.applyEdit(text, e);
292
- else throw new Error("Overlapping edit");
293
- lastModifiedOffset = e.offset;
294
- }
295
- return text;
296
- }
297
- exports$1.applyEdits = applyEdits;
298
- });
299
- }));
300
-
301
- //#endregion
302
- //#region ../../node_modules/.pnpm/lines-and-columns@2.0.4/node_modules/lines-and-columns/build/index.mjs
303
- var LF = "\n";
304
- var CR = "\r";
305
- var LinesAndColumns = function() {
306
- function LinesAndColumns(string) {
307
- this.length = string.length;
308
- var offsets = [0];
309
- for (var offset = 0; offset < string.length;) switch (string[offset]) {
310
- case LF:
311
- offset += LF.length;
312
- offsets.push(offset);
313
- break;
314
- case CR:
315
- offset += CR.length;
316
- if (string[offset] === LF) offset += LF.length;
317
- offsets.push(offset);
318
- break;
319
- default:
320
- offset++;
321
- break;
322
- }
323
- this.offsets = offsets;
324
- }
325
- LinesAndColumns.prototype.locationForIndex = function(index) {
326
- if (index < 0 || index > this.length) return null;
327
- var line = 0;
328
- var offsets = this.offsets;
329
- while (offsets[line + 1] <= index) line++;
330
- var column = index - offsets[line];
331
- return {
332
- line,
333
- column
334
- };
335
- };
336
- LinesAndColumns.prototype.indexForLocation = function(location) {
337
- var line = location.line, column = location.column;
338
- if (line < 0 || line >= this.offsets.length) return null;
339
- if (column < 0 || column > this.lengthOfLine(line)) return null;
340
- return this.offsets[line] + column;
341
- };
342
- LinesAndColumns.prototype.lengthOfLine = function(line) {
343
- var offset = this.offsets[line];
344
- return (line === this.offsets.length - 1 ? this.length : this.offsets[line + 1]) - offset;
345
- };
346
- return LinesAndColumns;
347
- }();
348
-
349
- //#endregion
350
- //#region ../../node_modules/.pnpm/@stryke+json@0.14.12/node_modules/@stryke/json/dist/parse-error-Cu6mjBS7.mjs
351
- var import_main = require_main();
352
- /**
353
- * Nicely formats a JSON error with context
354
- *
355
- * @param input - JSON content as string
356
- * @param parseError - jsonc ParseError
357
- * @returns Formatted error message with context
358
- */
359
- function formatParseError(input, parseError) {
360
- const { error, offset, length } = parseError;
361
- const result = new LinesAndColumns(input).locationForIndex(offset);
362
- let line = result?.line ?? 0;
363
- let column = result?.column ?? 0;
364
- line++;
365
- column++;
366
- return `${(0, import_main.printParseErrorCode)(error)} in JSON at ${line}:${column}\n${codeFrameColumns(input, {
367
- start: {
368
- line,
369
- column
370
- },
371
- end: {
372
- line,
373
- column: column + length
374
- }
375
- })}\n`;
376
- }
377
-
378
- //#endregion
379
- //#region ../../node_modules/.pnpm/@stryke+json@0.14.12/node_modules/@stryke/json/dist/is-number-BMxmACAS.mjs
380
- /**
381
- * Gets the `toStringTag` of `obj`.
382
- *
383
- * @param value - The obj to query.
384
- * @returns Returns the `toStringTag`.
385
- */
386
- const getObjectTag = (value) => {
387
- if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
388
- return Object.prototype.toString.call(value);
389
- };
390
- /**
391
- * Check if the provided value's type is `number`
392
- *
393
- * @param value - The value to type check
394
- * @returns An indicator specifying if the value provided is of type `number`
395
- */
396
- const isNumber$1 = (value) => {
397
- try {
398
- return value instanceof Number || typeof value === "number" || Number(value) === value;
399
- } catch {
400
- return false;
401
- }
402
- };
403
-
404
- //#endregion
405
- //#region ../../node_modules/.pnpm/@stryke+json@0.14.12/node_modules/@stryke/json/dist/is-object-B5abMUWX.mjs
406
- /**
407
- * Checks if `value` is object-like. A value is object-like if it's not `null`
408
- * and has a `typeof` result of "object".
409
- *
410
- * @example
411
- * ```typescript
412
- * isObjectLike({})
413
- * // => true
414
- *
415
- * isObjectLike([1, 2, 3])
416
- * // => true
417
- *
418
- * isObjectLike(Function)
419
- * // => false
420
- *
421
- * isObjectLike(null)
422
- * // => false
423
- * ```
424
- *
425
- * @param value - The value to check.
426
- * @returns Returns `true` if `value` is object-like, else `false`.
427
- */
428
- const isObjectLike = (value) => {
429
- return typeof value === "object" && value !== null;
430
- };
431
- /**
432
- * Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.
433
- *
434
- * @example
435
- * ```typescript
436
- * function Foo() {
437
- * this.a = 1
438
- * }
439
- *
440
- * isPlainObject(new Foo)
441
- * // => false
442
- *
443
- * isPlainObject([1, 2, 3])
444
- * // => false
445
- *
446
- * isPlainObject({ 'x': 0, 'y': 0 })
447
- * // => true
448
- *
449
- * isPlainObject(Object.create(null))
450
- * // => true
451
- * ```
452
- *
453
- * @param obj - The value to check.
454
- * @returns Returns `true` if `obj` is a plain object, else `false`.
455
- */
456
- const isPlainObject$2 = (obj) => {
457
- if (!isObjectLike(obj) || getObjectTag(obj) !== "[object Object]") return false;
458
- if (Object.getPrototypeOf(obj) === null) return true;
459
- let proto = obj;
460
- while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
461
- return Object.getPrototypeOf(obj) === proto;
462
- };
463
- /**
464
- * Check if the provided value's type is `Object`
465
- *
466
- * @param value - The value to type check
467
- * @returns An indicator specifying if the value provided is of type `Object`
468
- */
469
- const isObject = (value) => {
470
- try {
471
- return typeof value === "object" || Boolean(value) && value?.constructor === Object || isPlainObject$2(value);
472
- } catch {
473
- return false;
474
- }
475
- };
476
-
477
- //#endregion
478
- //#region ../../node_modules/.pnpm/@stryke+json@0.14.12/node_modules/@stryke/json/dist/is-string--ny35huw.mjs
479
- const isString$2 = (value) => {
480
- try {
481
- return typeof value === "string";
482
- } catch {
483
- return false;
484
- }
485
- };
486
-
487
- //#endregion
488
- //#region ../../node_modules/.pnpm/@stryke+json@0.14.12/node_modules/@stryke/json/dist/strip-comments-DNTu6CWM.mjs
489
- const EMPTY_STRING = "";
490
- const singleComment = Symbol("singleComment");
491
- const multiComment = Symbol("multiComment");
492
- function stripWithoutWhitespace() {
493
- return "";
494
- }
495
- function stripWithWhitespace(value, start, end) {
496
- return value.slice(start, end).replace(/\S/g, " ");
497
- }
498
- function isEscaped(value, quotePosition) {
499
- let index = quotePosition - 1;
500
- let backslashCount = 0;
501
- while (value[index] === "\\") {
502
- index -= 1;
503
- backslashCount += 1;
504
- }
505
- return Boolean(backslashCount % 2);
506
- }
507
- function stripComments(value, { whitespace = true, trailingCommas = false } = {}) {
508
- if (typeof value !== "string") throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof value}\``);
509
- const strip = whitespace ? stripWithWhitespace : stripWithoutWhitespace;
510
- let isInsideString = false;
511
- let isInsideComment = false;
512
- let offset = 0;
513
- let buffer = "";
514
- let result = "";
515
- let commaIndex = -1;
516
- for (let index = 0; index < value.length; index++) {
517
- const currentCharacter = value[index];
518
- const nextCharacter = value[index + 1];
519
- if (!isInsideComment && currentCharacter === "\"") {
520
- if (!isEscaped(value, index)) isInsideString = !isInsideString;
521
- }
522
- if (isInsideString) continue;
523
- if (!isInsideComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "//") {
524
- buffer += value.slice(offset, index);
525
- offset = index;
526
- isInsideComment = singleComment;
527
- index++;
528
- } else if (isInsideComment === singleComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "\r\n") {
529
- index++;
530
- isInsideComment = false;
531
- buffer += strip(value, offset, index);
532
- offset = index;
533
- } else if (isInsideComment === singleComment && currentCharacter === "\n") {
534
- isInsideComment = false;
535
- buffer += strip(value, offset, index);
536
- offset = index;
537
- } else if (!isInsideComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "/*") {
538
- buffer += value.slice(offset, index);
539
- offset = index;
540
- isInsideComment = multiComment;
541
- index++;
542
- } else if (isInsideComment === multiComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "*/") {
543
- index++;
544
- isInsideComment = false;
545
- buffer += strip(value, offset, index + 1);
546
- offset = index + 1;
547
- } else if (trailingCommas && !isInsideComment) {
548
- if (commaIndex !== -1) {
549
- if (currentCharacter === "}" || currentCharacter === "]") {
550
- buffer += value.slice(offset, index);
551
- result += strip(buffer, 0, 1) + buffer.slice(1);
552
- buffer = "";
553
- offset = index;
554
- commaIndex = -1;
555
- } else if (currentCharacter !== " " && currentCharacter !== " " && currentCharacter !== "\r" && currentCharacter !== "\n") {
556
- buffer += value.slice(offset, index);
557
- offset = index;
558
- commaIndex = -1;
559
- }
560
- } else if (currentCharacter === ",") {
561
- result += buffer + value.slice(offset, index);
562
- buffer = "";
563
- offset = index;
564
- commaIndex = index;
565
- }
566
- }
567
- }
568
- return result + buffer + (isInsideComment ? strip(value.slice(offset)) : value.slice(offset));
569
- }
570
-
571
- //#endregion
572
- //#region ../../node_modules/.pnpm/@stryke+json@0.14.12/node_modules/@stryke/json/dist/parse-BrChHTWb.mjs
573
- const 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*:/;
574
- const 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*:/;
575
- const JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(?:\.\d{1,17})?(?:E[+-]?\d+)?\s*$/i;
576
- function jsonParseTransform(key, value) {
577
- if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
578
- console.warn(`Dropping "${key}" key to prevent prototype pollution.`);
579
- return;
580
- }
581
- return value;
582
- }
583
- function parse$2(value, options = {}) {
584
- if (typeof value !== "string") return value;
585
- let stripped = stripComments(value);
586
- if (stripped[0] === "\"" && stripped[stripped.length - 1] === "\"" && !stripped.includes("\\")) return stripped.slice(1, -1);
587
- stripped = stripped.trim();
588
- if (stripped.length <= 9) switch (stripped.toLowerCase()) {
589
- case "true": return true;
590
- case "false": return false;
591
- case "undefined": return;
592
- case "null": return null;
593
- case "nan": return NaN;
594
- case "infinity": return Number.POSITIVE_INFINITY;
595
- case "-infinity": return Number.NEGATIVE_INFINITY;
596
- }
597
- if (!JsonSigRx.test(stripped)) {
598
- if (options.strict) throw new Error("Invalid JSON");
599
- return stripped;
600
- }
601
- try {
602
- if (suspectProtoRx.test(stripped) || suspectConstructorRx.test(stripped)) {
603
- if (options.strict) throw new Error("Possible prototype pollution");
604
- return JSON.parse(stripped, jsonParseTransform);
605
- }
606
- return JSON.parse(stripped);
607
- } catch (error) {
608
- if (options.strict) throw error;
609
- return value;
610
- }
611
- }
612
-
613
- //#endregion
614
- //#region ../../node_modules/.pnpm/@stryke+json@0.14.12/node_modules/@stryke/json/dist/is-undefined-CqNzBssC.mjs
615
- const isUndefined$3 = (value) => {
616
- return value === void 0;
617
- };
618
-
619
- //#endregion
620
- //#region ../../node_modules/.pnpm/@stryke+json@0.14.12/node_modules/@stryke/json/dist/stringify-Ciz4xWm4.mjs
621
- /**
622
- * Stringify a value to a JSON-like string.
623
- *
624
- * @param value - The value to stringify
625
- * @param spacing - The spacing to use for the stringification
626
- * @returns The stringified value
627
- */
628
- const stringify$1 = (value, spacing = 2) => {
629
- const space = isNumber$1(spacing) ? " ".repeat(spacing) : spacing;
630
- switch (value) {
631
- case null: return "null";
632
- case void 0: return "\"undefined\"";
633
- case true: return "true";
634
- case false: return "false";
635
- case Number.POSITIVE_INFINITY: return "infinity";
636
- case Number.NEGATIVE_INFINITY: return "-infinity";
637
- }
638
- if (Array.isArray(value)) return `[${space}${value.map((v) => stringify$1(v, space)).join(`,${space}`)}${space}]`;
639
- if (value instanceof Uint8Array) return value.toString();
640
- switch (typeof value) {
641
- case "number": return `${value}`;
642
- case "string": return JSON.stringify(value);
643
- case "object": return `{${space}${Object.keys(value).filter((key) => !isUndefined$3(value[key])).map((key) => `"${key}": ${space}${stringify$1(value[key], space)}`).join(`,${space}`)}${space}}`;
644
- default: return "null";
645
- }
646
- };
647
-
648
- //#endregion
649
- //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/double-indexed-kv.js
650
- var DoubleIndexedKV = class {
651
- constructor() {
652
- this.keyToValue = /* @__PURE__ */ new Map();
653
- this.valueToKey = /* @__PURE__ */ new Map();
654
- }
655
- set(key, value) {
656
- this.keyToValue.set(key, value);
657
- this.valueToKey.set(value, key);
658
- }
659
- getByKey(key) {
660
- return this.keyToValue.get(key);
661
- }
662
- getByValue(value) {
663
- return this.valueToKey.get(value);
664
- }
665
- clear() {
666
- this.keyToValue.clear();
667
- this.valueToKey.clear();
668
- }
669
- };
670
-
671
- //#endregion
672
- //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/registry.js
673
- var Registry = class {
674
- constructor(generateIdentifier) {
675
- this.generateIdentifier = generateIdentifier;
676
- this.kv = new DoubleIndexedKV();
677
- }
678
- register(value, identifier) {
679
- if (this.kv.getByValue(value)) return;
680
- if (!identifier) identifier = this.generateIdentifier(value);
681
- this.kv.set(identifier, value);
682
- }
683
- clear() {
684
- this.kv.clear();
685
- }
686
- getIdentifier(value) {
687
- return this.kv.getByValue(value);
688
- }
689
- getValue(identifier) {
690
- return this.kv.getByKey(identifier);
691
- }
692
- };
693
-
694
- //#endregion
695
- //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/class-registry.js
696
- var ClassRegistry = class extends Registry {
697
- constructor() {
698
- super((c) => c.name);
699
- this.classToAllowedProps = /* @__PURE__ */ new Map();
700
- }
701
- register(value, options) {
702
- if (typeof options === "object") {
703
- if (options.allowProps) this.classToAllowedProps.set(value, options.allowProps);
704
- super.register(value, options.identifier);
705
- } else super.register(value, options);
706
- }
707
- getAllowedProps(value) {
708
- return this.classToAllowedProps.get(value);
709
- }
710
- };
711
-
712
- //#endregion
713
- //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/util.js
714
- function valuesOfObj(record) {
715
- if ("values" in Object) return Object.values(record);
716
- const values = [];
717
- for (const key in record) if (record.hasOwnProperty(key)) values.push(record[key]);
718
- return values;
719
- }
720
- function find(record, predicate) {
721
- const values = valuesOfObj(record);
722
- if ("find" in values) return values.find(predicate);
723
- const valuesNotNever = values;
724
- for (let i = 0; i < valuesNotNever.length; i++) {
725
- const value = valuesNotNever[i];
726
- if (predicate(value)) return value;
727
- }
728
- }
729
- function forEach(record, run) {
730
- Object.entries(record).forEach(([key, value]) => run(value, key));
731
- }
732
- function includes(arr, value) {
733
- return arr.indexOf(value) !== -1;
734
- }
735
- function findArr(record, predicate) {
736
- for (let i = 0; i < record.length; i++) {
737
- const value = record[i];
738
- if (predicate(value)) return value;
739
- }
740
- }
741
-
742
- //#endregion
743
- //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/custom-transformer-registry.js
744
- var CustomTransformerRegistry = class {
745
- constructor() {
746
- this.transfomers = {};
747
- }
748
- register(transformer) {
749
- this.transfomers[transformer.name] = transformer;
750
- }
751
- findApplicable(v) {
752
- return find(this.transfomers, (transformer) => transformer.isApplicable(v));
753
- }
754
- findByName(name) {
755
- return this.transfomers[name];
756
- }
757
- };
758
-
759
- //#endregion
760
- //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/is.js
761
- const getType$1 = (payload) => Object.prototype.toString.call(payload).slice(8, -1);
762
- const isUndefined$2 = (payload) => typeof payload === "undefined";
763
- const isNull$2 = (payload) => payload === null;
764
- const isPlainObject$1 = (payload) => {
765
- if (typeof payload !== "object" || payload === null) return false;
766
- if (payload === Object.prototype) return false;
767
- if (Object.getPrototypeOf(payload) === null) return true;
768
- return Object.getPrototypeOf(payload) === Object.prototype;
769
- };
770
- const isEmptyObject = (payload) => isPlainObject$1(payload) && Object.keys(payload).length === 0;
771
- const isArray$1 = (payload) => Array.isArray(payload);
772
- const isString$1 = (payload) => typeof payload === "string";
773
- const isNumber = (payload) => typeof payload === "number" && !isNaN(payload);
774
- const isBoolean = (payload) => typeof payload === "boolean";
775
- const isRegExp = (payload) => payload instanceof RegExp;
776
- const isMap = (payload) => payload instanceof Map;
777
- const isSet = (payload) => payload instanceof Set;
778
- const isSymbol = (payload) => getType$1(payload) === "Symbol";
779
- const isDate = (payload) => payload instanceof Date && !isNaN(payload.valueOf());
780
- const isError = (payload) => payload instanceof Error;
781
- const isNaNValue = (payload) => typeof payload === "number" && isNaN(payload);
782
- const isPrimitive = (payload) => isBoolean(payload) || isNull$2(payload) || isUndefined$2(payload) || isNumber(payload) || isString$1(payload) || isSymbol(payload);
783
- const isBigint = (payload) => typeof payload === "bigint";
784
- const isInfinite = (payload) => payload === Infinity || payload === -Infinity;
785
- const isTypedArray = (payload) => ArrayBuffer.isView(payload) && !(payload instanceof DataView);
786
- const isURL = (payload) => payload instanceof URL;
787
-
788
- //#endregion
789
- //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/pathstringifier.js
790
- const escapeKey = (key) => key.replace(/\./g, "\\.");
791
- const stringifyPath = (path) => path.map(String).map(escapeKey).join(".");
792
- const parsePath = (string) => {
793
- const result = [];
794
- let segment = "";
795
- for (let i = 0; i < string.length; i++) {
796
- let char = string.charAt(i);
797
- if (char === "\\" && string.charAt(i + 1) === ".") {
798
- segment += ".";
799
- i++;
800
- continue;
801
- }
802
- if (char === ".") {
803
- result.push(segment);
804
- segment = "";
805
- continue;
806
- }
807
- segment += char;
808
- }
809
- const lastSegment = segment;
810
- result.push(lastSegment);
811
- return result;
812
- };
813
-
814
- //#endregion
815
- //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/transformer.js
816
- function simpleTransformation(isApplicable, annotation, transform, untransform) {
817
- return {
818
- isApplicable,
819
- annotation,
820
- transform,
821
- untransform
822
- };
823
- }
824
- const simpleRules = [
825
- simpleTransformation(isUndefined$2, "undefined", () => null, () => void 0),
826
- simpleTransformation(isBigint, "bigint", (v) => v.toString(), (v) => {
827
- if (typeof BigInt !== "undefined") return BigInt(v);
828
- console.error("Please add a BigInt polyfill.");
829
- return v;
830
- }),
831
- simpleTransformation(isDate, "Date", (v) => v.toISOString(), (v) => new Date(v)),
832
- simpleTransformation(isError, "Error", (v, superJson) => {
833
- const baseError = {
834
- name: v.name,
835
- message: v.message
836
- };
837
- superJson.allowedErrorProps.forEach((prop) => {
838
- baseError[prop] = v[prop];
839
- });
840
- return baseError;
841
- }, (v, superJson) => {
842
- const e = new Error(v.message);
843
- e.name = v.name;
844
- e.stack = v.stack;
845
- superJson.allowedErrorProps.forEach((prop) => {
846
- e[prop] = v[prop];
847
- });
848
- return e;
849
- }),
850
- simpleTransformation(isRegExp, "regexp", (v) => "" + v, (regex) => {
851
- const body = regex.slice(1, regex.lastIndexOf("/"));
852
- const flags = regex.slice(regex.lastIndexOf("/") + 1);
853
- return new RegExp(body, flags);
854
- }),
855
- simpleTransformation(isSet, "set", (v) => [...v.values()], (v) => new Set(v)),
856
- simpleTransformation(isMap, "map", (v) => [...v.entries()], (v) => new Map(v)),
857
- simpleTransformation((v) => isNaNValue(v) || isInfinite(v), "number", (v) => {
858
- if (isNaNValue(v)) return "NaN";
859
- if (v > 0) return "Infinity";
860
- else return "-Infinity";
861
- }, Number),
862
- simpleTransformation((v) => v === 0 && 1 / v === -Infinity, "number", () => {
863
- return "-0";
864
- }, Number),
865
- simpleTransformation(isURL, "URL", (v) => v.toString(), (v) => new URL(v))
866
- ];
867
- function compositeTransformation(isApplicable, annotation, transform, untransform) {
868
- return {
869
- isApplicable,
870
- annotation,
871
- transform,
872
- untransform
873
- };
874
- }
875
- const symbolRule = compositeTransformation((s, superJson) => {
876
- if (isSymbol(s)) return !!superJson.symbolRegistry.getIdentifier(s);
877
- return false;
878
- }, (s, superJson) => {
879
- return ["symbol", superJson.symbolRegistry.getIdentifier(s)];
880
- }, (v) => v.description, (_, a, superJson) => {
881
- const value = superJson.symbolRegistry.getValue(a[1]);
882
- if (!value) throw new Error("Trying to deserialize unknown symbol");
883
- return value;
884
- });
885
- const constructorToName = [
886
- Int8Array,
887
- Uint8Array,
888
- Int16Array,
889
- Uint16Array,
890
- Int32Array,
891
- Uint32Array,
892
- Float32Array,
893
- Float64Array,
894
- Uint8ClampedArray
895
- ].reduce((obj, ctor) => {
896
- obj[ctor.name] = ctor;
897
- return obj;
898
- }, {});
899
- const typedArrayRule = compositeTransformation(isTypedArray, (v) => ["typed-array", v.constructor.name], (v) => [...v], (v, a) => {
900
- const ctor = constructorToName[a[1]];
901
- if (!ctor) throw new Error("Trying to deserialize unknown typed array");
902
- return new ctor(v);
903
- });
904
- function isInstanceOfRegisteredClass(potentialClass, superJson) {
905
- if (potentialClass?.constructor) return !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
906
- return false;
907
- }
908
- const classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, superJson) => {
909
- return ["class", superJson.classRegistry.getIdentifier(clazz.constructor)];
910
- }, (clazz, superJson) => {
911
- const allowedProps = superJson.classRegistry.getAllowedProps(clazz.constructor);
912
- if (!allowedProps) return { ...clazz };
913
- const result = {};
914
- allowedProps.forEach((prop) => {
915
- result[prop] = clazz[prop];
916
- });
917
- return result;
918
- }, (v, a, superJson) => {
919
- const clazz = superJson.classRegistry.getValue(a[1]);
920
- if (!clazz) throw new Error(`Trying to deserialize unknown class '${a[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
921
- return Object.assign(Object.create(clazz.prototype), v);
922
- });
923
- const customRule = compositeTransformation((value, superJson) => {
924
- return !!superJson.customTransformerRegistry.findApplicable(value);
925
- }, (value, superJson) => {
926
- return ["custom", superJson.customTransformerRegistry.findApplicable(value).name];
927
- }, (value, superJson) => {
928
- return superJson.customTransformerRegistry.findApplicable(value).serialize(value);
929
- }, (v, a, superJson) => {
930
- const transformer = superJson.customTransformerRegistry.findByName(a[1]);
931
- if (!transformer) throw new Error("Trying to deserialize unknown custom value");
932
- return transformer.deserialize(v);
933
- });
934
- const compositeRules = [
935
- classRule,
936
- symbolRule,
937
- customRule,
938
- typedArrayRule
939
- ];
940
- const transformValue = (value, superJson) => {
941
- const applicableCompositeRule = findArr(compositeRules, (rule) => rule.isApplicable(value, superJson));
942
- if (applicableCompositeRule) return {
943
- value: applicableCompositeRule.transform(value, superJson),
944
- type: applicableCompositeRule.annotation(value, superJson)
945
- };
946
- const applicableSimpleRule = findArr(simpleRules, (rule) => rule.isApplicable(value, superJson));
947
- if (applicableSimpleRule) return {
948
- value: applicableSimpleRule.transform(value, superJson),
949
- type: applicableSimpleRule.annotation
950
- };
951
- };
952
- const simpleRulesByAnnotation = {};
953
- simpleRules.forEach((rule) => {
954
- simpleRulesByAnnotation[rule.annotation] = rule;
955
- });
956
- const untransformValue = (json, type, superJson) => {
957
- if (isArray$1(type)) switch (type[0]) {
958
- case "symbol": return symbolRule.untransform(json, type, superJson);
959
- case "class": return classRule.untransform(json, type, superJson);
960
- case "custom": return customRule.untransform(json, type, superJson);
961
- case "typed-array": return typedArrayRule.untransform(json, type, superJson);
962
- default: throw new Error("Unknown transformation: " + type);
963
- }
964
- else {
965
- const transformation = simpleRulesByAnnotation[type];
966
- if (!transformation) throw new Error("Unknown transformation: " + type);
967
- return transformation.untransform(json, superJson);
968
- }
969
- };
970
-
971
- //#endregion
972
- //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/accessDeep.js
973
- const getNthKey = (value, n) => {
974
- if (n > value.size) throw new Error("index out of bounds");
975
- const keys = value.keys();
976
- while (n > 0) {
977
- keys.next();
978
- n--;
979
- }
980
- return keys.next().value;
981
- };
982
- function validatePath(path) {
983
- if (includes(path, "__proto__")) throw new Error("__proto__ is not allowed as a property");
984
- if (includes(path, "prototype")) throw new Error("prototype is not allowed as a property");
985
- if (includes(path, "constructor")) throw new Error("constructor is not allowed as a property");
986
- }
987
- const getDeep = (object, path) => {
988
- validatePath(path);
989
- for (let i = 0; i < path.length; i++) {
990
- const key = path[i];
991
- if (isSet(object)) object = getNthKey(object, +key);
992
- else if (isMap(object)) {
993
- const row = +key;
994
- const type = +path[++i] === 0 ? "key" : "value";
995
- const keyOfRow = getNthKey(object, row);
996
- switch (type) {
997
- case "key":
998
- object = keyOfRow;
999
- break;
1000
- case "value":
1001
- object = object.get(keyOfRow);
1002
- break;
1003
- }
1004
- } else object = object[key];
1005
- }
1006
- return object;
1007
- };
1008
- const setDeep = (object, path, mapper) => {
1009
- validatePath(path);
1010
- if (path.length === 0) return mapper(object);
1011
- let parent = object;
1012
- for (let i = 0; i < path.length - 1; i++) {
1013
- const key = path[i];
1014
- if (isArray$1(parent)) {
1015
- const index = +key;
1016
- parent = parent[index];
1017
- } else if (isPlainObject$1(parent)) parent = parent[key];
1018
- else if (isSet(parent)) {
1019
- const row = +key;
1020
- parent = getNthKey(parent, row);
1021
- } else if (isMap(parent)) {
1022
- if (i === path.length - 2) break;
1023
- const row = +key;
1024
- const type = +path[++i] === 0 ? "key" : "value";
1025
- const keyOfRow = getNthKey(parent, row);
1026
- switch (type) {
1027
- case "key":
1028
- parent = keyOfRow;
1029
- break;
1030
- case "value":
1031
- parent = parent.get(keyOfRow);
1032
- break;
1033
- }
1034
- }
1035
- }
1036
- const lastKey = path[path.length - 1];
1037
- if (isArray$1(parent)) parent[+lastKey] = mapper(parent[+lastKey]);
1038
- else if (isPlainObject$1(parent)) parent[lastKey] = mapper(parent[lastKey]);
1039
- if (isSet(parent)) {
1040
- const oldValue = getNthKey(parent, +lastKey);
1041
- const newValue = mapper(oldValue);
1042
- if (oldValue !== newValue) {
1043
- parent.delete(oldValue);
1044
- parent.add(newValue);
1045
- }
1046
- }
1047
- if (isMap(parent)) {
1048
- const row = +path[path.length - 2];
1049
- const keyToRow = getNthKey(parent, row);
1050
- switch (+lastKey === 0 ? "key" : "value") {
1051
- case "key": {
1052
- const newKey = mapper(keyToRow);
1053
- parent.set(newKey, parent.get(keyToRow));
1054
- if (newKey !== keyToRow) parent.delete(keyToRow);
1055
- break;
1056
- }
1057
- case "value":
1058
- parent.set(keyToRow, mapper(parent.get(keyToRow)));
1059
- break;
1060
- }
1061
- }
1062
- return object;
1063
- };
1064
-
1065
- //#endregion
1066
- //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/plainer.js
1067
- function traverse(tree, walker, origin = []) {
1068
- if (!tree) return;
1069
- if (!isArray$1(tree)) {
1070
- forEach(tree, (subtree, key) => traverse(subtree, walker, [...origin, ...parsePath(key)]));
1071
- return;
1072
- }
1073
- const [nodeValue, children] = tree;
1074
- if (children) forEach(children, (child, key) => {
1075
- traverse(child, walker, [...origin, ...parsePath(key)]);
1076
- });
1077
- walker(nodeValue, origin);
1078
- }
1079
- function applyValueAnnotations(plain, annotations, superJson) {
1080
- traverse(annotations, (type, path) => {
1081
- plain = setDeep(plain, path, (v) => untransformValue(v, type, superJson));
1082
- });
1083
- return plain;
1084
- }
1085
- function applyReferentialEqualityAnnotations(plain, annotations) {
1086
- function apply(identicalPaths, path) {
1087
- const object = getDeep(plain, parsePath(path));
1088
- identicalPaths.map(parsePath).forEach((identicalObjectPath) => {
1089
- plain = setDeep(plain, identicalObjectPath, () => object);
1090
- });
1091
- }
1092
- if (isArray$1(annotations)) {
1093
- const [root, other] = annotations;
1094
- root.forEach((identicalPath) => {
1095
- plain = setDeep(plain, parsePath(identicalPath), () => plain);
1096
- });
1097
- if (other) forEach(other, apply);
1098
- } else forEach(annotations, apply);
1099
- return plain;
1100
- }
1101
- const isDeep = (object, superJson) => isPlainObject$1(object) || isArray$1(object) || isMap(object) || isSet(object) || isInstanceOfRegisteredClass(object, superJson);
1102
- function addIdentity(object, path, identities) {
1103
- const existingSet = identities.get(object);
1104
- if (existingSet) existingSet.push(path);
1105
- else identities.set(object, [path]);
1106
- }
1107
- function generateReferentialEqualityAnnotations(identitites, dedupe) {
1108
- const result = {};
1109
- let rootEqualityPaths = void 0;
1110
- identitites.forEach((paths) => {
1111
- if (paths.length <= 1) return;
1112
- if (!dedupe) paths = paths.map((path) => path.map(String)).sort((a, b) => a.length - b.length);
1113
- const [representativePath, ...identicalPaths] = paths;
1114
- if (representativePath.length === 0) rootEqualityPaths = identicalPaths.map(stringifyPath);
1115
- else result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
1116
- });
1117
- if (rootEqualityPaths) if (isEmptyObject(result)) return [rootEqualityPaths];
1118
- else return [rootEqualityPaths, result];
1119
- else return isEmptyObject(result) ? void 0 : result;
1120
- }
1121
- const walker = (object, identities, superJson, dedupe, path = [], objectsInThisPath = [], seenObjects = /* @__PURE__ */ new Map()) => {
1122
- const primitive = isPrimitive(object);
1123
- if (!primitive) {
1124
- addIdentity(object, path, identities);
1125
- const seen = seenObjects.get(object);
1126
- if (seen) return dedupe ? { transformedValue: null } : seen;
1127
- }
1128
- if (!isDeep(object, superJson)) {
1129
- const transformed = transformValue(object, superJson);
1130
- const result = transformed ? {
1131
- transformedValue: transformed.value,
1132
- annotations: [transformed.type]
1133
- } : { transformedValue: object };
1134
- if (!primitive) seenObjects.set(object, result);
1135
- return result;
1136
- }
1137
- if (includes(objectsInThisPath, object)) return { transformedValue: null };
1138
- const transformationResult = transformValue(object, superJson);
1139
- const transformed = transformationResult?.value ?? object;
1140
- const transformedValue = isArray$1(transformed) ? [] : {};
1141
- const innerAnnotations = {};
1142
- forEach(transformed, (value, index) => {
1143
- if (index === "__proto__" || index === "constructor" || index === "prototype") throw new Error(`Detected property ${index}. This is a prototype pollution risk, please remove it from your object.`);
1144
- const recursiveResult = walker(value, identities, superJson, dedupe, [...path, index], [...objectsInThisPath, object], seenObjects);
1145
- transformedValue[index] = recursiveResult.transformedValue;
1146
- if (isArray$1(recursiveResult.annotations)) innerAnnotations[index] = recursiveResult.annotations;
1147
- else if (isPlainObject$1(recursiveResult.annotations)) forEach(recursiveResult.annotations, (tree, key) => {
1148
- innerAnnotations[escapeKey(index) + "." + key] = tree;
1149
- });
1150
- });
1151
- const result = isEmptyObject(innerAnnotations) ? {
1152
- transformedValue,
1153
- annotations: !!transformationResult ? [transformationResult.type] : void 0
1154
- } : {
1155
- transformedValue,
1156
- annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
1157
- };
1158
- if (!primitive) seenObjects.set(object, result);
1159
- return result;
1160
- };
1161
-
1162
- //#endregion
1163
- //#region ../../node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.js
1164
- function getType(payload) {
1165
- return Object.prototype.toString.call(payload).slice(8, -1);
1166
- }
1167
- function isArray(payload) {
1168
- return getType(payload) === "Array";
1169
- }
1170
- function isPlainObject(payload) {
1171
- if (getType(payload) !== "Object") return false;
1172
- const prototype = Object.getPrototypeOf(payload);
1173
- return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
1174
- }
1175
- function isNull$1(payload) {
1176
- return getType(payload) === "Null";
1177
- }
1178
- function isOneOf(a, b, c, d, e) {
1179
- return (value) => a(value) || b(value) || !!c && c(value) || !!d && d(value) || !!e && e(value);
1180
- }
1181
- function isUndefined$1(payload) {
1182
- return getType(payload) === "Undefined";
1183
- }
1184
- const isNullOrUndefined = isOneOf(isNull$1, isUndefined$1);
1185
-
1186
- //#endregion
1187
- //#region ../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
1188
- function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
1189
- const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable";
1190
- if (propType === "enumerable") carry[key] = newVal;
1191
- if (includeNonenumerable && propType === "nonenumerable") Object.defineProperty(carry, key, {
1192
- value: newVal,
1193
- enumerable: false,
1194
- writable: true,
1195
- configurable: true
1196
- });
1197
- }
1198
- function copy(target, options = {}) {
1199
- if (isArray(target)) return target.map((item) => copy(item, options));
1200
- if (!isPlainObject(target)) return target;
1201
- const props = Object.getOwnPropertyNames(target);
1202
- const symbols = Object.getOwnPropertySymbols(target);
1203
- return [...props, ...symbols].reduce((carry, key) => {
1204
- if (isArray(options.props) && !options.props.includes(key)) return carry;
1205
- const val = target[key];
1206
- assignProp(carry, key, copy(val, options), target, options.nonenumerable);
1207
- return carry;
1208
- }, {});
1209
- }
1210
-
1211
- //#endregion
1212
- //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.js
1213
- var SuperJSON = class {
1214
- /**
1215
- * @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
1216
- */
1217
- constructor({ dedupe = false } = {}) {
1218
- this.classRegistry = new ClassRegistry();
1219
- this.symbolRegistry = new Registry((s) => s.description ?? "");
1220
- this.customTransformerRegistry = new CustomTransformerRegistry();
1221
- this.allowedErrorProps = [];
1222
- this.dedupe = dedupe;
1223
- }
1224
- serialize(object) {
1225
- const identities = /* @__PURE__ */ new Map();
1226
- const output = walker(object, identities, this, this.dedupe);
1227
- const res = { json: output.transformedValue };
1228
- if (output.annotations) res.meta = {
1229
- ...res.meta,
1230
- values: output.annotations
1231
- };
1232
- const equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
1233
- if (equalityAnnotations) res.meta = {
1234
- ...res.meta,
1235
- referentialEqualities: equalityAnnotations
1236
- };
1237
- return res;
1238
- }
1239
- deserialize(payload) {
1240
- const { json, meta } = payload;
1241
- let result = copy(json);
1242
- if (meta?.values) result = applyValueAnnotations(result, meta.values, this);
1243
- if (meta?.referentialEqualities) result = applyReferentialEqualityAnnotations(result, meta.referentialEqualities);
1244
- return result;
1245
- }
1246
- stringify(object) {
1247
- return JSON.stringify(this.serialize(object));
1248
- }
1249
- parse(string) {
1250
- return this.deserialize(JSON.parse(string));
1251
- }
1252
- registerClass(v, options) {
1253
- this.classRegistry.register(v, options);
1254
- }
1255
- registerSymbol(v, identifier) {
1256
- this.symbolRegistry.register(v, identifier);
1257
- }
1258
- registerCustom(transformer, name) {
1259
- this.customTransformerRegistry.register({
1260
- name,
1261
- ...transformer
1262
- });
1263
- }
1264
- allowErrorProps(...props) {
1265
- this.allowedErrorProps.push(...props);
1266
- }
1267
- };
1268
- SuperJSON.defaultInstance = new SuperJSON();
1269
- SuperJSON.serialize = SuperJSON.defaultInstance.serialize.bind(SuperJSON.defaultInstance);
1270
- SuperJSON.deserialize = SuperJSON.defaultInstance.deserialize.bind(SuperJSON.defaultInstance);
1271
- SuperJSON.stringify = SuperJSON.defaultInstance.stringify.bind(SuperJSON.defaultInstance);
1272
- SuperJSON.parse = SuperJSON.defaultInstance.parse.bind(SuperJSON.defaultInstance);
1273
- SuperJSON.registerClass = SuperJSON.defaultInstance.registerClass.bind(SuperJSON.defaultInstance);
1274
- SuperJSON.registerSymbol = SuperJSON.defaultInstance.registerSymbol.bind(SuperJSON.defaultInstance);
1275
- SuperJSON.registerCustom = SuperJSON.defaultInstance.registerCustom.bind(SuperJSON.defaultInstance);
1276
- SuperJSON.allowErrorProps = SuperJSON.defaultInstance.allowErrorProps.bind(SuperJSON.defaultInstance);
1277
- const serialize = SuperJSON.serialize;
1278
- const deserialize = SuperJSON.deserialize;
1279
- const stringify = SuperJSON.stringify;
1280
- const parse$1 = SuperJSON.parse;
1281
- const registerClass = SuperJSON.registerClass;
1282
- const registerCustom = SuperJSON.registerCustom;
1283
- const registerSymbol = SuperJSON.registerSymbol;
1284
- const allowErrorProps = SuperJSON.allowErrorProps;
1285
-
1286
- //#endregion
1287
- //#region ../../node_modules/.pnpm/@stryke+json@0.14.12/node_modules/@stryke/json/dist/storm-json-MaHpNbZy.mjs
1288
- /**
1289
- * A static JSON parser class used by Storm Software to serialize and deserialize JSON data
1290
- *
1291
- * @remarks
1292
- * This class uses the [SuperJSON](https://github.com/blitz-js/superjson) library under the hood.
1293
- */
1294
- var StormJSON = class StormJSON extends SuperJSON {
1295
- static #instance;
1296
- static get instance() {
1297
- if (!StormJSON.#instance) StormJSON.#instance = new StormJSON();
1298
- return StormJSON.#instance;
1299
- }
1300
- /**
1301
- * Deserialize the given value with superjson using the given metadata
1302
- */
1303
- static deserialize(payload) {
1304
- return StormJSON.instance.deserialize(payload);
1305
- }
1306
- /**
1307
- * Serialize the given value with superjson
1308
- */
1309
- static serialize(object) {
1310
- return StormJSON.instance.serialize(object);
1311
- }
1312
- /**
1313
- * Parse the given string value with superjson using the given metadata
1314
- *
1315
- * @param value - The string value to parse
1316
- * @returns The parsed data
1317
- */
1318
- static parse(value, options = {}) {
1319
- try {
1320
- if (options.expectComments === false) return parse$2(value);
1321
- } catch {}
1322
- const errors = [];
1323
- const result = (0, import_main.parse)(value, errors, {
1324
- allowTrailingComma: true,
1325
- ...options
1326
- });
1327
- if (errors.length > 0 && errors[0]) throw new Error(formatParseError(value, errors[0]));
1328
- return result;
1329
- }
1330
- /**
1331
- * Serializes the given data to a JSON string.
1332
- * By default the JSON string is formatted with a 2 space indentation to be easy readable.
1333
- *
1334
- * @param value - Object which should be serialized to JSON
1335
- * @param options - JSON serialize options
1336
- * @returns the formatted JSON representation of the object
1337
- */
1338
- static stringify(value, options) {
1339
- const customTransformer = StormJSON.instance.customTransformerRegistry.findApplicable(value);
1340
- let result = value;
1341
- if (customTransformer && customTransformer.isApplicable(value)) result = customTransformer.serialize(result);
1342
- return stringify$1(result, options?.spaces ?? 2);
1343
- }
1344
- /**
1345
- * Register a custom schema with superjson
1346
- *
1347
- * @param name - The name of the schema
1348
- * @param serialize - The function to serialize the schema
1349
- * @param deserialize - The function to deserialize the schema
1350
- * @param isApplicable - The function to check if the schema is applicable
1351
- */
1352
- static register(name, serialize, deserialize, isApplicable) {
1353
- StormJSON.instance.registerCustom({
1354
- isApplicable,
1355
- serialize,
1356
- deserialize
1357
- }, name);
1358
- }
1359
- /**
1360
- * Register a class with superjson
1361
- *
1362
- * @param classConstructor - The class constructor to register
1363
- */
1364
- static registerClass(classConstructor, options) {
1365
- StormJSON.instance.registerClass(classConstructor, {
1366
- identifier: isString$2(options) ? options : options?.identifier || classConstructor.name,
1367
- allowProps: options && isObject(options) && options?.allowProps && Array.isArray(options.allowProps) ? options.allowProps : ["__typename"]
1368
- });
1369
- }
1370
- constructor() {
1371
- super({ dedupe: true });
1372
- }
1373
- };
1374
- StormJSON.instance.registerCustom({
1375
- isApplicable: (v) => typeof node_buffer.Buffer.isBuffer === "function" && node_buffer.Buffer.isBuffer(v),
1376
- serialize: (v) => v.toString("base64"),
1377
- deserialize: (v) => node_buffer.Buffer.from(v, "base64")
1378
- }, "Bytes");
1379
-
1380
- //#endregion
1381
- //#region src/utilities.ts
1382
- /**
1383
- * Converts any {@link ReflectionProperty}, {@link ReflectionParameter}, or {@link ReflectionKind}'s value to string representation.
1384
- *
1385
- * @param property - The {@link ReflectionProperty}, {@link ReflectionParameter}, or {@link ReflectionKind} containing the value to stringify.
1386
- * @param value - The value to stringify.
1387
- * @returns A string representation of the value.
1388
- */
1389
- function stringifyDefaultValue(property, value) {
1390
- return (0, _stryke_type_checks.isSetObject)(property) ? stringifyValue(property.type, value ?? property.getDefaultValue()) : stringifyValue({ kind: property }, value);
1391
- }
1392
- /**
1393
- * Stringifies a value as a string.
1394
- *
1395
- * @param value - The value to stringify.
1396
- * @returns A string representation of the value.
1397
- */
1398
- function stringifyStringValue(value) {
1399
- return `"${String(value).replaceAll("\"", "\\\"")}"`;
1400
- }
1401
- /**
1402
- * Converts any {@link Type}'s actual value to string representation.
1403
- *
1404
- * @param type - The {@link Type} of the value to stringify.
1405
- * @param value - The value to stringify.
1406
- * @returns A string representation of the value.
1407
- */
1408
- function stringifyValue(type, value) {
1409
- return (0, _stryke_type_checks_is_undefined.isUndefined)(value) ? "undefined" : (0, _stryke_type_checks_is_null.isNull)(value) ? "null" : type.kind === require_type.ReflectionKind.boolean ? String(value).trim().toLowerCase() === "true" ? "true" : "false" : type.kind === require_type.ReflectionKind.string || type.kind === require_type.ReflectionKind.literal && (0, _stryke_type_checks_is_string.isString)(type.literal) ? stringifyStringValue(value) : type.kind === require_type.ReflectionKind.enum ? getEnumReflectionType(type).kind === require_type.ReflectionKind.string ? stringifyStringValue(value) : `${String(value)}` : type.kind === require_type.ReflectionKind.union ? isStringUnion(type) ? stringifyStringValue(value) : `${String(value)}` : type.kind === require_type.ReflectionKind.array ? stringifyStringValue(StormJSON.stringify(value)) : type.kind === require_type.ReflectionKind.object || type.kind === require_type.ReflectionKind.objectLiteral ? StormJSON.stringify(value) : (type.kind === require_type.ReflectionKind.property || type.kind === require_type.ReflectionKind.parameter) && type.type?.kind ? stringifyValue(type.type, value) : String(value)?.includes("\"") || String(value)?.includes("'") ? stringifyStringValue(value) : String(value);
1410
- }
1411
- /**
1412
- * Converts a {@link TypeEnum} to its underlying primitive type representation.
1413
- *
1414
- * @param type - The {@link TypeEnum} to evaluate.
1415
- * @returns A string representation of the primitive type.
1416
- */
1417
- function getEnumReflectionType(type) {
1418
- if (type.kind !== require_type.ReflectionKind.enum) throw new Error(`Expected a TypeEnum, but received ${type.kind}.`);
1419
- const unique = getUniqueBy(type.values.filter((value) => value !== void 0 && value !== null), (enumMember) => (0, _stryke_type_checks_is_string.isString)(enumMember) ? { kind: require_type.ReflectionKind.string } : { kind: require_type.ReflectionKind.number });
1420
- if (unique.length === 0) throw new Error(`No valid enum members could be found.`);
1421
- return unique[0] && (0, _stryke_type_checks_is_string.isString)(unique[0]) ? { kind: require_type.ReflectionKind.string } : { kind: require_type.ReflectionKind.number };
1422
- }
1423
- /**
1424
- * Converts a {@link TypeUnion} to its underlying primitive type representation.
1425
- *
1426
- * @param type - The {@link TypeUnion} to evaluate.
1427
- * @returns A string representation of the primitive type.
1428
- */
1429
- function getUnionTypes(type) {
1430
- if (type.kind === require_type.ReflectionKind.union && type.types.length > 0) return getUniqueBy(type.types, (member) => member.kind);
1431
- throw new Error(`Expected a TypeUnion, but received ${type.kind}.`);
1432
- }
1433
- function isStringUnion(type) {
1434
- return getUnionTypes(type).some((member) => member.kind === require_type.ReflectionKind.string || member.kind === require_type.ReflectionKind.literal && (0, _stryke_type_checks_is_string.isString)(member.literal));
1435
- }
1436
- /**
1437
- * Converts a ReflectionKind to its string representation.
1438
- *
1439
- * @param kind - The {@link ReflectionKind} to convert.
1440
- * @returns A string representation of the kind.
1441
- */
1442
- function kindToName(kind) {
1443
- if (kind === require_type.ReflectionKind.void) return "void";
1444
- else if (kind === require_type.ReflectionKind.never) return "never";
1445
- else if (kind === require_type.ReflectionKind.null) return "null";
1446
- else if (kind === require_type.ReflectionKind.undefined) return "undefined";
1447
- else if (kind === require_type.ReflectionKind.symbol) return "symbol";
1448
- else if (kind === require_type.ReflectionKind.bigint) return "bigint";
1449
- else if (kind === require_type.ReflectionKind.number) return "number";
1450
- else if (kind === require_type.ReflectionKind.string) return "string";
1451
- else if (kind === require_type.ReflectionKind.boolean) return "boolean";
1452
- else if (kind === require_type.ReflectionKind.literal) return "literal";
1453
- else if (kind === require_type.ReflectionKind.class) return "class";
1454
- else if (kind === require_type.ReflectionKind.array) return "array";
1455
- else if (kind === require_type.ReflectionKind.object) return "object";
1456
- else if (kind === require_type.ReflectionKind.objectLiteral) return "objectLiteral";
1457
- else if (kind === require_type.ReflectionKind.union) return "union";
1458
- else if (kind === require_type.ReflectionKind.enum) return "enum";
1459
- else if (kind === require_type.ReflectionKind.regexp) return "regexp";
1460
- else if (kind === require_type.ReflectionKind.templateLiteral) return "templateLiteral";
1461
- else if (kind === require_type.ReflectionKind.property) return "property";
1462
- else if (kind === require_type.ReflectionKind.method) return "method";
1463
- else if (kind === require_type.ReflectionKind.function) return "function";
1464
- else if (kind === require_type.ReflectionKind.parameter) return "parameter";
1465
- else if (kind === require_type.ReflectionKind.promise) return "promise";
1466
- else if (kind === require_type.ReflectionKind.typeParameter) return "typeParameter";
1467
- else if (kind === require_type.ReflectionKind.tuple) return "tuple";
1468
- else if (kind === require_type.ReflectionKind.tupleMember) return "tupleMember";
1469
- else if (kind === require_type.ReflectionKind.enumMember) return "enumMember";
1470
- else if (kind === require_type.ReflectionKind.rest) return "rest";
1471
- else if (kind === require_type.ReflectionKind.indexSignature) return "indexSignature";
1472
- else if (kind === require_type.ReflectionKind.propertySignature) return "propertySignature";
1473
- else if (kind === require_type.ReflectionKind.methodSignature) return "methodSignature";
1474
- else if (kind === require_type.ReflectionKind.infer) return "infer";
1475
- else if (kind === require_type.ReflectionKind.callSignature) return "callSignature";
1476
- else if (kind === require_type.ReflectionKind.any) return "any";
1477
- else if (kind === require_type.ReflectionKind.intersection) return "intersection";
1478
- return "unknown";
1479
- }
1480
-
1481
- //#endregion
1482
- Object.defineProperty(exports, 'getEnumReflectionType', {
1483
- enumerable: true,
1484
- get: function () {
1485
- return getEnumReflectionType;
1486
- }
1487
- });
1488
- Object.defineProperty(exports, 'getUnionTypes', {
1489
- enumerable: true,
1490
- get: function () {
1491
- return getUnionTypes;
1492
- }
1493
- });
1494
- Object.defineProperty(exports, 'isStringUnion', {
1495
- enumerable: true,
1496
- get: function () {
1497
- return isStringUnion;
1498
- }
1499
- });
1500
- Object.defineProperty(exports, 'kindToName', {
1501
- enumerable: true,
1502
- get: function () {
1503
- return kindToName;
1504
- }
1505
- });
1506
- Object.defineProperty(exports, 'stringifyDefaultValue', {
1507
- enumerable: true,
1508
- get: function () {
1509
- return stringifyDefaultValue;
1510
- }
1511
- });
1512
- Object.defineProperty(exports, 'stringifyStringValue', {
1513
- enumerable: true,
1514
- get: function () {
1515
- return stringifyStringValue;
1516
- }
1517
- });
1518
- Object.defineProperty(exports, 'stringifyValue', {
1519
- enumerable: true,
1520
- get: function () {
1521
- return stringifyValue;
1522
- }
1523
- });