@fangorn-network/sdk 2026.8.18-dev → 2026.10.1-9.0-dev

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 (91) hide show
  1. package/README.md +191 -195
  2. package/lib/cli/cli.d.ts +0 -0
  3. package/lib/cli/cli.js +198 -164
  4. package/lib/cli/index.d.ts +3 -91
  5. package/lib/cli/index.js +5 -2
  6. package/lib/config.d.ts +349 -433
  7. package/lib/config.js +41 -28
  8. package/lib/contracts/app-registry/abi.d.ts +1064 -265
  9. package/lib/contracts/app-registry/abi.js +1233 -308
  10. package/lib/contracts/app-registry/index.d.ts +123 -102
  11. package/lib/contracts/app-registry/index.js +200 -198
  12. package/lib/contracts/data-registry/abi.d.ts +166 -187
  13. package/lib/contracts/data-registry/abi.js +207 -237
  14. package/lib/contracts/data-registry/index.d.ts +4 -160
  15. package/lib/contracts/data-registry/index.js +5 -294
  16. package/lib/contracts/index.d.ts +6 -7
  17. package/lib/contracts/index.js +6 -8
  18. package/lib/contracts/logs.d.ts +21 -0
  19. package/lib/contracts/logs.js +32 -0
  20. package/lib/contracts/membership-registry/abi.d.ts +1145 -0
  21. package/lib/contracts/membership-registry/abi.js +1333 -0
  22. package/lib/contracts/membership-registry/index.d.ts +79 -0
  23. package/lib/contracts/membership-registry/index.js +104 -0
  24. package/lib/contracts/types.d.ts +3 -1
  25. package/lib/contracts/types.js +3 -1
  26. package/lib/contracts/write.d.ts +34 -2
  27. package/lib/contracts/write.js +48 -1
  28. package/lib/crypto/encryption.js +4 -4
  29. package/lib/engine/car.d.ts +2 -2
  30. package/lib/engine/car.js +10 -5
  31. package/lib/engine/index.d.ts +99 -143
  32. package/lib/engine/index.js +156 -295
  33. package/lib/engine/records.d.ts +110 -0
  34. package/lib/engine/records.js +165 -0
  35. package/lib/engine/test-helpers.d.ts +7 -14
  36. package/lib/engine/test-helpers.js +7 -18
  37. package/lib/fangorn.d.ts +163 -155
  38. package/lib/fangorn.js +284 -248
  39. package/lib/feed.d.ts +7 -4
  40. package/lib/feed.js +4 -1
  41. package/lib/index.d.ts +9 -9
  42. package/lib/index.js +9 -10
  43. package/lib/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +77 -0
  44. package/lib/node_modules/@vitest/expect/dist/index.js +1414 -0
  45. package/lib/node_modules/@vitest/pretty-format/dist/index.js +858 -0
  46. package/lib/node_modules/@vitest/runner/dist/chunk-tasks.js +51 -0
  47. package/lib/node_modules/@vitest/runner/dist/index.js +1199 -0
  48. package/lib/node_modules/@vitest/runner/dist/utils.js +3 -0
  49. package/lib/node_modules/@vitest/snapshot/dist/index.js +1075 -0
  50. package/lib/node_modules/@vitest/spy/dist/index.js +353 -0
  51. package/lib/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +7 -0
  52. package/lib/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js +81 -0
  53. package/lib/node_modules/@vitest/utils/dist/diff.js +1345 -0
  54. package/lib/node_modules/@vitest/utils/dist/display.js +534 -0
  55. package/lib/node_modules/@vitest/utils/dist/error.js +30 -0
  56. package/lib/node_modules/@vitest/utils/dist/helpers.js +118 -0
  57. package/lib/node_modules/@vitest/utils/dist/serialize.js +76 -0
  58. package/lib/node_modules/@vitest/utils/dist/source-map.js +93 -0
  59. package/lib/node_modules/@vitest/utils/dist/timers.js +36 -0
  60. package/lib/node_modules/chai/index.js +2874 -0
  61. package/lib/node_modules/magic-string/dist/magic-string.es.js +939 -0
  62. package/lib/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js +81 -0
  63. package/lib/node_modules/tinyrainbow/dist/index.js +85 -0
  64. package/lib/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js +5 -0
  65. package/lib/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js +50 -0
  66. package/lib/node_modules/vitest/dist/chunks/utils.DvEY5TfP.js +44 -0
  67. package/lib/node_modules/vitest/dist/chunks/vi.2VT5v0um.js +2578 -0
  68. package/lib/providers/storage/signed-url.d.ts +16 -6
  69. package/lib/providers/storage/signed-url.js +20 -8
  70. package/lib/registry.d.ts +116 -0
  71. package/lib/registry.js +182 -0
  72. package/lib/test/mem-registry.d.ts +51 -0
  73. package/lib/test/mem-registry.js +107 -0
  74. package/lib/test/sdk-suite.d.ts +13 -0
  75. package/lib/test/sdk-suite.js +226 -0
  76. package/lib/test/testbed.d.ts +16411 -61
  77. package/lib/test/testbed.js +190 -84
  78. package/lib/types/index.d.ts +13 -11
  79. package/package.json +89 -72
  80. package/lib/contracts/data-registry/test.d.ts +0 -1
  81. package/lib/contracts/data-registry/test.js +0 -1
  82. package/lib/contracts/settlement-registry/abi.d.ts +0 -466
  83. package/lib/contracts/settlement-registry/abi.js +0 -535
  84. package/lib/contracts/settlement-registry/index.d.ts +0 -163
  85. package/lib/contracts/settlement-registry/index.js +0 -264
  86. package/lib/contracts/subscription-registry/abi.d.ts +0 -179
  87. package/lib/contracts/subscription-registry/abi.js +0 -195
  88. package/lib/contracts/subscription-registry/index.d.ts +0 -59
  89. package/lib/contracts/subscription-registry/index.js +0 -116
  90. package/lib/engine/graph.d.ts +0 -70
  91. package/lib/engine/graph.js +0 -73
@@ -0,0 +1,534 @@
1
+ import { format, plugins } from "../../pretty-format/dist/index.js";
2
+
3
+ //#region node_modules/@vitest/utils/dist/display.js
4
+ const ansiColors = {
5
+ bold: ["1", "22"],
6
+ dim: ["2", "22"],
7
+ italic: ["3", "23"],
8
+ underline: ["4", "24"],
9
+ inverse: ["7", "27"],
10
+ hidden: ["8", "28"],
11
+ strike: ["9", "29"],
12
+ black: ["30", "39"],
13
+ red: ["31", "39"],
14
+ green: ["32", "39"],
15
+ yellow: ["33", "39"],
16
+ blue: ["34", "39"],
17
+ magenta: ["35", "39"],
18
+ cyan: ["36", "39"],
19
+ white: ["37", "39"],
20
+ brightblack: ["30;1", "39"],
21
+ brightred: ["31;1", "39"],
22
+ brightgreen: ["32;1", "39"],
23
+ brightyellow: ["33;1", "39"],
24
+ brightblue: ["34;1", "39"],
25
+ brightmagenta: ["35;1", "39"],
26
+ brightcyan: ["36;1", "39"],
27
+ brightwhite: ["37;1", "39"],
28
+ grey: ["90", "39"]
29
+ };
30
+ const styles = {
31
+ special: "cyan",
32
+ number: "yellow",
33
+ bigint: "yellow",
34
+ boolean: "yellow",
35
+ undefined: "grey",
36
+ null: "bold",
37
+ string: "green",
38
+ symbol: "green",
39
+ date: "magenta",
40
+ regexp: "red"
41
+ };
42
+ const truncator = "…";
43
+ function colorise(value, styleType) {
44
+ const color = ansiColors[styles[styleType]] || ansiColors[styleType] || "";
45
+ if (!color) return String(value);
46
+ return `\u001b[${color[0]}m${String(value)}\u001b[${color[1]}m`;
47
+ }
48
+ function normaliseOptions({ showHidden = false, depth = 2, colors = false, customInspect = true, showProxy = false, maxArrayLength = Infinity, breakLength = Infinity, seen = [], truncate: truncate$1 = Infinity, stylize = String } = {}, inspect$2) {
49
+ const options = {
50
+ showHidden: Boolean(showHidden),
51
+ depth: Number(depth),
52
+ colors: Boolean(colors),
53
+ customInspect: Boolean(customInspect),
54
+ showProxy: Boolean(showProxy),
55
+ maxArrayLength: Number(maxArrayLength),
56
+ breakLength: Number(breakLength),
57
+ truncate: Number(truncate$1),
58
+ seen,
59
+ inspect: inspect$2,
60
+ stylize
61
+ };
62
+ if (options.colors) options.stylize = colorise;
63
+ return options;
64
+ }
65
+ function isHighSurrogate(char) {
66
+ return char >= "\ud800" && char <= "\udbff";
67
+ }
68
+ function truncate(string, length, tail = truncator) {
69
+ string = String(string);
70
+ const tailLength = tail.length;
71
+ const stringLength = string.length;
72
+ if (tailLength > length && stringLength > tailLength) return tail;
73
+ if (stringLength > length && stringLength > tailLength) {
74
+ let end = length - tailLength;
75
+ if (end > 0 && isHighSurrogate(string[end - 1])) end = end - 1;
76
+ return `${string.slice(0, end)}${tail}`;
77
+ }
78
+ return string;
79
+ }
80
+ function inspectList(list, options, inspectItem, separator = ", ") {
81
+ inspectItem = inspectItem || options.inspect;
82
+ const size = list.length;
83
+ if (size === 0) return "";
84
+ const originalLength = options.truncate;
85
+ let output = "";
86
+ let peek = "";
87
+ let truncated = "";
88
+ for (let i = 0; i < size; i += 1) {
89
+ const last = i + 1 === list.length;
90
+ const secondToLast = i + 2 === list.length;
91
+ truncated = `${truncator}(${list.length - i})`;
92
+ const value = list[i];
93
+ options.truncate = originalLength - output.length - (last ? 0 : separator.length);
94
+ const string = peek || inspectItem(value, options) + (last ? "" : separator);
95
+ const nextLength = output.length + string.length;
96
+ const truncatedLength = nextLength + truncated.length;
97
+ if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) break;
98
+ if (!last && !secondToLast && truncatedLength > originalLength) break;
99
+ peek = last ? "" : inspectItem(list[i + 1], options) + (secondToLast ? "" : separator);
100
+ if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) break;
101
+ output += string;
102
+ if (!last && !secondToLast && nextLength + peek.length >= originalLength) {
103
+ truncated = `${truncator}(${list.length - i - 1})`;
104
+ break;
105
+ }
106
+ truncated = "";
107
+ }
108
+ return `${output}${truncated}`;
109
+ }
110
+ function quoteComplexKey(key) {
111
+ if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) return key;
112
+ return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, "\"").replace(/(^"|"$)/g, "'");
113
+ }
114
+ function inspectProperty([key, value], options) {
115
+ options.truncate -= 2;
116
+ if (typeof key === "string") key = quoteComplexKey(key);
117
+ else if (typeof key !== "number") key = `[${options.inspect(key, options)}]`;
118
+ options.truncate -= key.length;
119
+ value = options.inspect(value, options);
120
+ return `${key}: ${value}`;
121
+ }
122
+ function inspectArray(array, options) {
123
+ const nonIndexProperties = Object.keys(array).slice(array.length);
124
+ if (!array.length && !nonIndexProperties.length) return "[]";
125
+ options.truncate -= 4;
126
+ const listContents = inspectList(array, options);
127
+ options.truncate -= listContents.length;
128
+ let propertyContents = "";
129
+ if (nonIndexProperties.length) propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
130
+ return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ""} ]`;
131
+ }
132
+ const getArrayName = (array) => {
133
+ if (typeof Buffer === "function" && array instanceof Buffer) return "Buffer";
134
+ if (array[Symbol.toStringTag]) return array[Symbol.toStringTag];
135
+ return array.constructor.name;
136
+ };
137
+ function inspectTypedArray(array, options) {
138
+ const name = getArrayName(array);
139
+ options.truncate -= name.length + 4;
140
+ const nonIndexProperties = Object.keys(array).slice(array.length);
141
+ if (!array.length && !nonIndexProperties.length) return `${name}[]`;
142
+ let output = "";
143
+ for (let i = 0; i < array.length; i++) {
144
+ const string = `${options.stylize(truncate(array[i], options.truncate), "number")}${i === array.length - 1 ? "" : ", "}`;
145
+ options.truncate -= string.length;
146
+ if (array[i] !== array.length && options.truncate <= 3) {
147
+ output += `${truncator}(${array.length - array[i] + 1})`;
148
+ break;
149
+ }
150
+ output += string;
151
+ }
152
+ let propertyContents = "";
153
+ if (nonIndexProperties.length) propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
154
+ return `${name}[ ${output}${propertyContents ? `, ${propertyContents}` : ""} ]`;
155
+ }
156
+ function inspectDate(dateObject, options) {
157
+ const stringRepresentation = dateObject.toJSON();
158
+ if (stringRepresentation === null) return "Invalid Date";
159
+ const split = stringRepresentation.split("T");
160
+ const date = split[0];
161
+ return options.stylize(`${date}T${truncate(split[1], options.truncate - date.length - 1)}`, "date");
162
+ }
163
+ function inspectFunction(func, options) {
164
+ const functionType = func[Symbol.toStringTag] || "Function";
165
+ const name = func.name;
166
+ if (!name) return options.stylize(`[${functionType}]`, "special");
167
+ return options.stylize(`[${functionType} ${truncate(name, options.truncate - 11)}]`, "special");
168
+ }
169
+ function inspectMapEntry([key, value], options) {
170
+ options.truncate -= 4;
171
+ key = options.inspect(key, options);
172
+ options.truncate -= key.length;
173
+ value = options.inspect(value, options);
174
+ return `${key} => ${value}`;
175
+ }
176
+ function mapToEntries(map) {
177
+ const entries = [];
178
+ map.forEach((value, key) => {
179
+ entries.push([key, value]);
180
+ });
181
+ return entries;
182
+ }
183
+ function inspectMap(map, options) {
184
+ if (map.size === 0) return "Map{}";
185
+ options.truncate -= 7;
186
+ return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`;
187
+ }
188
+ const isNaN = Number.isNaN || ((i) => i !== i);
189
+ function inspectNumber(number, options) {
190
+ if (isNaN(number)) return options.stylize("NaN", "number");
191
+ if (number === Infinity) return options.stylize("Infinity", "number");
192
+ if (number === -Infinity) return options.stylize("-Infinity", "number");
193
+ if (number === 0) return options.stylize(1 / number === Infinity ? "+0" : "-0", "number");
194
+ return options.stylize(truncate(String(number), options.truncate), "number");
195
+ }
196
+ function inspectBigInt(number, options) {
197
+ let nums = truncate(number.toString(), options.truncate - 1);
198
+ if (nums !== truncator) nums += "n";
199
+ return options.stylize(nums, "bigint");
200
+ }
201
+ function inspectRegExp(value, options) {
202
+ const flags = value.toString().split("/")[2];
203
+ const sourceLength = options.truncate - (2 + flags.length);
204
+ const source = value.source;
205
+ return options.stylize(`/${truncate(source, sourceLength)}/${flags}`, "regexp");
206
+ }
207
+ function arrayFromSet(set) {
208
+ const values = [];
209
+ set.forEach((value) => {
210
+ values.push(value);
211
+ });
212
+ return values;
213
+ }
214
+ function inspectSet(set, options) {
215
+ if (set.size === 0) return "Set{}";
216
+ options.truncate -= 7;
217
+ return `Set{ ${inspectList(arrayFromSet(set), options)} }`;
218
+ }
219
+ const stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", "g");
220
+ const escapeCharacters = {
221
+ "\b": "\\b",
222
+ " ": "\\t",
223
+ "\n": "\\n",
224
+ "\f": "\\f",
225
+ "\r": "\\r",
226
+ "'": "\\'",
227
+ "\\": "\\\\"
228
+ };
229
+ const hex = 16;
230
+ function escape(char) {
231
+ return escapeCharacters[char] || `\\u${`0000${char.charCodeAt(0).toString(hex)}`.slice(-4)}`;
232
+ }
233
+ function inspectString(string, options) {
234
+ if (stringEscapeChars.test(string)) string = string.replace(stringEscapeChars, escape);
235
+ return options.stylize(`'${truncate(string, options.truncate - 2)}'`, "string");
236
+ }
237
+ function inspectSymbol(value) {
238
+ if ("description" in Symbol.prototype) return value.description ? `Symbol(${value.description})` : "Symbol()";
239
+ return value.toString();
240
+ }
241
+ const getPromiseValue = () => "Promise{…}";
242
+ function inspectObject$1(object, options) {
243
+ const properties = Object.getOwnPropertyNames(object);
244
+ const symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [];
245
+ if (properties.length === 0 && symbols.length === 0) return "{}";
246
+ options.truncate -= 4;
247
+ options.seen = options.seen || [];
248
+ if (options.seen.includes(object)) return "[Circular]";
249
+ options.seen.push(object);
250
+ const propertyContents = inspectList(properties.map((key) => [key, object[key]]), options, inspectProperty);
251
+ const symbolContents = inspectList(symbols.map((key) => [key, object[key]]), options, inspectProperty);
252
+ options.seen.pop();
253
+ let sep = "";
254
+ if (propertyContents && symbolContents) sep = ", ";
255
+ return `{ ${propertyContents}${sep}${symbolContents} }`;
256
+ }
257
+ const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag ? Symbol.toStringTag : false;
258
+ function inspectClass(value, options) {
259
+ let name = "";
260
+ if (toStringTag && toStringTag in value) name = value[toStringTag];
261
+ name = name || value.constructor.name;
262
+ if (!name || name === "_class") name = "<Anonymous Class>";
263
+ options.truncate -= name.length;
264
+ return `${name}${inspectObject$1(value, options)}`;
265
+ }
266
+ function inspectArguments(args, options) {
267
+ if (args.length === 0) return "Arguments[]";
268
+ options.truncate -= 13;
269
+ return `Arguments[ ${inspectList(args, options)} ]`;
270
+ }
271
+ const errorKeys = [
272
+ "stack",
273
+ "line",
274
+ "column",
275
+ "name",
276
+ "message",
277
+ "fileName",
278
+ "lineNumber",
279
+ "columnNumber",
280
+ "number",
281
+ "description",
282
+ "cause"
283
+ ];
284
+ function inspectObject(error, options) {
285
+ const properties = Object.getOwnPropertyNames(error).filter((key) => errorKeys.indexOf(key) === -1);
286
+ const name = error.name;
287
+ options.truncate -= name.length;
288
+ let message = "";
289
+ if (typeof error.message === "string") message = truncate(error.message, options.truncate);
290
+ else properties.unshift("message");
291
+ message = message ? `: ${message}` : "";
292
+ options.truncate -= message.length + 5;
293
+ options.seen = options.seen || [];
294
+ if (options.seen.includes(error)) return "[Circular]";
295
+ options.seen.push(error);
296
+ const propertyContents = inspectList(properties.map((key) => [key, error[key]]), options, inspectProperty);
297
+ return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ""}`;
298
+ }
299
+ function inspectAttribute([key, value], options) {
300
+ options.truncate -= 3;
301
+ if (!value) return `${options.stylize(String(key), "yellow")}`;
302
+ return `${options.stylize(String(key), "yellow")}=${options.stylize(`"${value}"`, "string")}`;
303
+ }
304
+ function inspectNodeCollection(collection, options) {
305
+ return inspectList(collection, options, inspectNode, "\n");
306
+ }
307
+ function inspectNode(node, options) {
308
+ switch (node.nodeType) {
309
+ case 1: return inspectHTML(node, options);
310
+ case 3: return options.inspect(node.data, options);
311
+ default: return options.inspect(node, options);
312
+ }
313
+ }
314
+ function inspectHTML(element, options) {
315
+ const properties = element.getAttributeNames();
316
+ const name = element.tagName.toLowerCase();
317
+ const head = options.stylize(`<${name}`, "special");
318
+ const headClose = options.stylize(`>`, "special");
319
+ const tail = options.stylize(`</${name}>`, "special");
320
+ options.truncate -= name.length * 2 + 5;
321
+ let propertyContents = "";
322
+ if (properties.length > 0) {
323
+ propertyContents += " ";
324
+ propertyContents += inspectList(properties.map((key) => [key, element.getAttribute(key)]), options, inspectAttribute, " ");
325
+ }
326
+ options.truncate -= propertyContents.length;
327
+ const truncate$1 = options.truncate;
328
+ let children = inspectNodeCollection(element.children, options);
329
+ if (children && children.length > truncate$1) children = `${truncator}(${element.children.length})`;
330
+ return `${head}${propertyContents}${headClose}${children}${tail}`;
331
+ }
332
+ const chaiInspect = typeof Symbol === "function" && typeof Symbol.for === "function" ? Symbol.for("chai/inspect") : "@@chai/inspect";
333
+ const nodeInspect = Symbol.for("nodejs.util.inspect.custom");
334
+ const constructorMap = /* @__PURE__ */ new WeakMap();
335
+ const stringTagMap = {};
336
+ const baseTypesMap = {
337
+ undefined: (value, options) => options.stylize("undefined", "undefined"),
338
+ null: (value, options) => options.stylize("null", "null"),
339
+ boolean: (value, options) => options.stylize(String(value), "boolean"),
340
+ Boolean: (value, options) => options.stylize(String(value), "boolean"),
341
+ number: inspectNumber,
342
+ Number: inspectNumber,
343
+ bigint: inspectBigInt,
344
+ BigInt: inspectBigInt,
345
+ string: inspectString,
346
+ String: inspectString,
347
+ function: inspectFunction,
348
+ Function: inspectFunction,
349
+ symbol: inspectSymbol,
350
+ Symbol: inspectSymbol,
351
+ Array: inspectArray,
352
+ Date: inspectDate,
353
+ Map: inspectMap,
354
+ Set: inspectSet,
355
+ RegExp: inspectRegExp,
356
+ Promise: getPromiseValue,
357
+ WeakSet: (value, options) => options.stylize("WeakSet{…}", "special"),
358
+ WeakMap: (value, options) => options.stylize("WeakMap{…}", "special"),
359
+ Arguments: inspectArguments,
360
+ Int8Array: inspectTypedArray,
361
+ Uint8Array: inspectTypedArray,
362
+ Uint8ClampedArray: inspectTypedArray,
363
+ Int16Array: inspectTypedArray,
364
+ Uint16Array: inspectTypedArray,
365
+ Int32Array: inspectTypedArray,
366
+ Uint32Array: inspectTypedArray,
367
+ Float32Array: inspectTypedArray,
368
+ Float64Array: inspectTypedArray,
369
+ Generator: () => "",
370
+ DataView: () => "",
371
+ ArrayBuffer: () => "",
372
+ Error: inspectObject,
373
+ HTMLCollection: inspectNodeCollection,
374
+ NodeList: inspectNodeCollection
375
+ };
376
+ const inspectCustom = (value, options, type, inspectFn) => {
377
+ if (chaiInspect in value && typeof value[chaiInspect] === "function") return value[chaiInspect](options);
378
+ if (nodeInspect in value && typeof value[nodeInspect] === "function") return value[nodeInspect](options.depth, options, inspectFn);
379
+ if ("inspect" in value && typeof value.inspect === "function") return value.inspect(options.depth, options);
380
+ if ("constructor" in value && constructorMap.has(value.constructor)) return constructorMap.get(value.constructor)(value, options);
381
+ if (stringTagMap[type]) return stringTagMap[type](value, options);
382
+ return "";
383
+ };
384
+ const toString = Object.prototype.toString;
385
+ function inspect$1(value, opts = {}) {
386
+ const options = normaliseOptions(opts, inspect$1);
387
+ const { customInspect } = options;
388
+ let type = value === null ? "null" : typeof value;
389
+ if (type === "object") type = toString.call(value).slice(8, -1);
390
+ if (type in baseTypesMap) return baseTypesMap[type](value, options);
391
+ if (customInspect && value) {
392
+ const output = inspectCustom(value, options, type, inspect$1);
393
+ if (output) {
394
+ if (typeof output === "string") return output;
395
+ return inspect$1(output, options);
396
+ }
397
+ }
398
+ const proto = value ? Object.getPrototypeOf(value) : false;
399
+ if (proto === Object.prototype || proto === null) return inspectObject$1(value, options);
400
+ if (value && typeof HTMLElement === "function" && value instanceof HTMLElement) return inspectHTML(value, options);
401
+ if ("constructor" in value) {
402
+ if (value.constructor !== Object) return inspectClass(value, options);
403
+ return inspectObject$1(value, options);
404
+ }
405
+ if (value === Object(value)) return inspectObject$1(value, options);
406
+ return options.stylize(String(value), type);
407
+ }
408
+ const { AsymmetricMatcher, DOMCollection, DOMElement, Immutable, ReactElement, ReactTestComponent } = plugins;
409
+ const PLUGINS = [
410
+ ReactTestComponent,
411
+ ReactElement,
412
+ DOMElement,
413
+ DOMCollection,
414
+ Immutable,
415
+ AsymmetricMatcher
416
+ ];
417
+ function stringify(object, maxDepth = 10, { maxLength, ...options } = {}) {
418
+ const MAX_LENGTH = maxLength ?? 1e4;
419
+ let result;
420
+ try {
421
+ result = format(object, {
422
+ maxDepth,
423
+ escapeString: false,
424
+ plugins: PLUGINS,
425
+ ...options
426
+ });
427
+ } catch {
428
+ result = format(object, {
429
+ callToJSON: false,
430
+ maxDepth,
431
+ escapeString: false,
432
+ plugins: PLUGINS,
433
+ ...options
434
+ });
435
+ }
436
+ return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(Math.min(maxDepth, Number.MAX_SAFE_INTEGER) / 2), {
437
+ maxLength,
438
+ ...options
439
+ }) : result;
440
+ }
441
+ const formatRegExp = /%[sdjifoOc%]/g;
442
+ function baseFormat(args, options = {}) {
443
+ const formatArg = (item, inspecOptions) => {
444
+ if (options.prettifyObject) return stringify(item, void 0, {
445
+ printBasicPrototype: false,
446
+ escapeString: false
447
+ });
448
+ return inspect(item, inspecOptions);
449
+ };
450
+ if (typeof args[0] !== "string") {
451
+ const objects = [];
452
+ for (let i$1 = 0; i$1 < args.length; i$1++) objects.push(formatArg(args[i$1], {
453
+ depth: 0,
454
+ colors: false
455
+ }));
456
+ return objects.join(" ");
457
+ }
458
+ const len = args.length;
459
+ let i = 1;
460
+ const template = args[0];
461
+ let str = String(template).replace(formatRegExp, (x) => {
462
+ if (x === "%%") return "%";
463
+ if (i >= len) return x;
464
+ switch (x) {
465
+ case "%s": {
466
+ const value = args[i++];
467
+ if (typeof value === "bigint") return `${value.toString()}n`;
468
+ if (typeof value === "number" && value === 0 && 1 / value < 0) return "-0";
469
+ if (typeof value === "object" && value !== null) {
470
+ if (typeof value.toString === "function" && value.toString !== Object.prototype.toString) return value.toString();
471
+ return formatArg(value, {
472
+ depth: 0,
473
+ colors: false
474
+ });
475
+ }
476
+ return String(value);
477
+ }
478
+ case "%d": {
479
+ const value = args[i++];
480
+ if (typeof value === "bigint") return `${value.toString()}n`;
481
+ return Number(value).toString();
482
+ }
483
+ case "%i": {
484
+ const value = args[i++];
485
+ if (typeof value === "bigint") return `${value.toString()}n`;
486
+ return Number.parseInt(String(value)).toString();
487
+ }
488
+ case "%f": return Number.parseFloat(String(args[i++])).toString();
489
+ case "%o": return formatArg(args[i++], {
490
+ showHidden: true,
491
+ showProxy: true
492
+ });
493
+ case "%O": return formatArg(args[i++]);
494
+ case "%c":
495
+ i++;
496
+ return "";
497
+ case "%j": try {
498
+ return JSON.stringify(args[i++]);
499
+ } catch (err) {
500
+ const m = err.message;
501
+ if (m.includes("circular structure") || m.includes("cyclic structures") || m.includes("cyclic object")) return "[Circular]";
502
+ throw err;
503
+ }
504
+ default: return x;
505
+ }
506
+ });
507
+ for (let x = args[i]; i < len; x = args[++i]) if (x === null || typeof x !== "object") str += ` ${x}`;
508
+ else str += ` ${formatArg(x)}`;
509
+ return str;
510
+ }
511
+ function format$1(...args) {
512
+ return baseFormat(args);
513
+ }
514
+ function inspect(obj, options = {}) {
515
+ if (options.truncate === 0) options.truncate = Number.POSITIVE_INFINITY;
516
+ return inspect$1(obj, options);
517
+ }
518
+ function objDisplay(obj, options = {}) {
519
+ if (typeof options.truncate === "undefined") options.truncate = 40;
520
+ const str = inspect(obj, options);
521
+ const type = Object.prototype.toString.call(obj);
522
+ if (options.truncate && str.length >= options.truncate) if (type === "[object Function]") {
523
+ const fn = obj;
524
+ return !fn.name ? "[Function]" : `[Function: ${fn.name}]`;
525
+ } else if (type === "[object Array]") return `[ Array(${obj.length}) ]`;
526
+ else if (type === "[object Object]") {
527
+ const keys = Object.keys(obj);
528
+ return `{ Object (${keys.length > 2 ? `${keys.splice(0, 2).join(", ")}, ...` : keys.join(", ")}) }`;
529
+ } else return str;
530
+ return str;
531
+ }
532
+
533
+ //#endregion
534
+ export { format$1 as format, formatRegExp, objDisplay, stringify };
@@ -0,0 +1,30 @@
1
+ import "../../../tinyrainbow/dist/index.js";
2
+ import { stringify } from "./display.js";
3
+ import { printDiffOrStringify } from "./diff.js";
4
+ import { serializeValue } from "./serialize.js";
5
+
6
+ //#region node_modules/@vitest/utils/dist/error.js
7
+ function processError(_err, diffOptions, seen = /* @__PURE__ */ new WeakSet()) {
8
+ if (!_err || typeof _err !== "object") return { message: String(_err) };
9
+ const err = _err;
10
+ if (err.showDiff || err.showDiff === void 0 && err.expected !== void 0 && err.actual !== void 0) err.diff = printDiffOrStringify(err.actual, err.expected, {
11
+ ...diffOptions,
12
+ ...err.diffOptions
13
+ });
14
+ if ("expected" in err && typeof err.expected !== "string") err.expected = stringify(err.expected, 10);
15
+ if ("actual" in err && typeof err.actual !== "string") err.actual = stringify(err.actual, 10);
16
+ try {
17
+ if (!seen.has(err) && typeof err.cause === "object") {
18
+ seen.add(err);
19
+ err.cause = processError(err.cause, diffOptions, seen);
20
+ }
21
+ } catch {}
22
+ try {
23
+ return serializeValue(err);
24
+ } catch (e) {
25
+ return serializeValue(/* @__PURE__ */ new Error(`Failed to fully serialize error: ${e === null || e === void 0 ? void 0 : e.message}\nInner error message: ${err === null || err === void 0 ? void 0 : err.message}`));
26
+ }
27
+ }
28
+
29
+ //#endregion
30
+ export { processError };
@@ -0,0 +1,118 @@
1
+ //#region node_modules/@vitest/utils/dist/helpers.js
2
+ /**
3
+ * Get original stacktrace without source map support the most performant way.
4
+ * - Create only 1 stack frame.
5
+ * - Rewrite prepareStackTrace to bypass "support-stack-trace" (usually takes ~250ms).
6
+ */
7
+ function createSimpleStackTrace(options) {
8
+ const { message = "$$stack trace error", stackTraceLimit = 1 } = options || {};
9
+ const limit = Error.stackTraceLimit;
10
+ const prepareStackTrace = Error.prepareStackTrace;
11
+ Error.stackTraceLimit = stackTraceLimit;
12
+ Error.prepareStackTrace = (e) => e.stack;
13
+ const stackTrace = new Error(message).stack || "";
14
+ Error.prepareStackTrace = prepareStackTrace;
15
+ Error.stackTraceLimit = limit;
16
+ return stackTrace;
17
+ }
18
+ function assertTypes(value, name, types) {
19
+ const receivedType = typeof value;
20
+ if (!types.includes(receivedType)) throw new TypeError(`${name} value must be ${types.join(" or ")}, received "${receivedType}"`);
21
+ }
22
+ function toArray(array) {
23
+ if (array === null || array === void 0) array = [];
24
+ if (Array.isArray(array)) return array;
25
+ return [array];
26
+ }
27
+ function isObject(item) {
28
+ return item != null && typeof item === "object" && !Array.isArray(item);
29
+ }
30
+ function isFinalObj(obj) {
31
+ return obj === Object.prototype || obj === Function.prototype || obj === RegExp.prototype;
32
+ }
33
+ function getType(value) {
34
+ return Object.prototype.toString.apply(value).slice(8, -1);
35
+ }
36
+ function collectOwnProperties(obj, collector) {
37
+ const collect = typeof collector === "function" ? collector : (key) => collector.add(key);
38
+ Object.getOwnPropertyNames(obj).forEach(collect);
39
+ Object.getOwnPropertySymbols(obj).forEach(collect);
40
+ }
41
+ function getOwnProperties(obj) {
42
+ const ownProps = /* @__PURE__ */ new Set();
43
+ if (isFinalObj(obj)) return [];
44
+ collectOwnProperties(obj, ownProps);
45
+ return Array.from(ownProps);
46
+ }
47
+ const defaultCloneOptions = { forceWritable: false };
48
+ function deepClone(val, options = defaultCloneOptions) {
49
+ return clone(val, /* @__PURE__ */ new WeakMap(), options);
50
+ }
51
+ function clone(val, seen, options = defaultCloneOptions) {
52
+ let k, out;
53
+ if (seen.has(val)) return seen.get(val);
54
+ if (Array.isArray(val)) {
55
+ out = Array.from({ length: k = val.length });
56
+ seen.set(val, out);
57
+ while (k--) out[k] = clone(val[k], seen, options);
58
+ return out;
59
+ }
60
+ if (Object.prototype.toString.call(val) === "[object Object]") {
61
+ out = Object.create(Object.getPrototypeOf(val));
62
+ seen.set(val, out);
63
+ const props = getOwnProperties(val);
64
+ for (const k$1 of props) {
65
+ const descriptor = Object.getOwnPropertyDescriptor(val, k$1);
66
+ if (!descriptor) continue;
67
+ const cloned = clone(val[k$1], seen, options);
68
+ if (options.forceWritable) Object.defineProperty(out, k$1, {
69
+ enumerable: descriptor.enumerable,
70
+ configurable: true,
71
+ writable: true,
72
+ value: cloned
73
+ });
74
+ else if ("get" in descriptor) Object.defineProperty(out, k$1, {
75
+ ...descriptor,
76
+ get() {
77
+ return cloned;
78
+ }
79
+ });
80
+ else Object.defineProperty(out, k$1, {
81
+ ...descriptor,
82
+ value: cloned
83
+ });
84
+ }
85
+ return out;
86
+ }
87
+ return val;
88
+ }
89
+ function noop() {}
90
+ function objectAttr(source, path, defaultValue = void 0) {
91
+ const paths = path.replace(/\[(\d+)\]/g, ".$1").split(".");
92
+ let result = source;
93
+ for (const p of paths) {
94
+ result = new Object(result)[p];
95
+ if (result === void 0) return defaultValue;
96
+ }
97
+ return result;
98
+ }
99
+ function createDefer() {
100
+ let resolve = null;
101
+ let reject = null;
102
+ const p = new Promise((_resolve, _reject) => {
103
+ resolve = _resolve;
104
+ reject = _reject;
105
+ });
106
+ p.resolve = resolve;
107
+ p.reject = reject;
108
+ return p;
109
+ }
110
+ function isNegativeNaN(val) {
111
+ if (!Number.isNaN(val)) return false;
112
+ const f64 = new Float64Array(1);
113
+ f64[0] = val;
114
+ return new Uint32Array(f64.buffer)[1] >>> 31 === 1;
115
+ }
116
+
117
+ //#endregion
118
+ export { assertTypes, createDefer, createSimpleStackTrace, deepClone, getOwnProperties, getType, isNegativeNaN, isObject, noop, objectAttr, toArray };