@fangorn-network/sdk 2026.9.22-dev → 2026.10.19-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 (89) hide show
  1. package/README.md +177 -192
  2. package/lib/cli/cli.d.ts +0 -0
  3. package/lib/cli/cli.js +165 -194
  4. package/lib/config.d.ts +32 -27
  5. package/lib/config.js +17 -7
  6. package/lib/contracts/app-registry/abi.d.ts +1033 -277
  7. package/lib/contracts/app-registry/abi.js +1214 -335
  8. package/lib/contracts/app-registry/index.d.ts +105 -65
  9. package/lib/contracts/app-registry/index.js +182 -175
  10. package/lib/contracts/data-registry/abi.d.ts +166 -187
  11. package/lib/contracts/data-registry/abi.js +207 -237
  12. package/lib/contracts/data-registry/index.d.ts +4 -151
  13. package/lib/contracts/data-registry/index.js +5 -279
  14. package/lib/contracts/index.d.ts +6 -7
  15. package/lib/contracts/index.js +6 -8
  16. package/lib/contracts/logs.d.ts +4 -1
  17. package/lib/contracts/logs.js +9 -2
  18. package/lib/contracts/membership-registry/abi.d.ts +1145 -0
  19. package/lib/contracts/membership-registry/abi.js +1333 -0
  20. package/lib/contracts/membership-registry/index.d.ts +79 -0
  21. package/lib/contracts/membership-registry/index.js +104 -0
  22. package/lib/contracts/types.d.ts +3 -1
  23. package/lib/contracts/types.js +3 -1
  24. package/lib/contracts/write.d.ts +34 -2
  25. package/lib/contracts/write.js +48 -1
  26. package/lib/crypto/encryption.js +4 -4
  27. package/lib/engine/car.d.ts +2 -2
  28. package/lib/engine/car.js +10 -5
  29. package/lib/engine/index.d.ts +99 -143
  30. package/lib/engine/index.js +156 -295
  31. package/lib/engine/records.d.ts +110 -0
  32. package/lib/engine/records.js +165 -0
  33. package/lib/engine/test-helpers.d.ts +7 -14
  34. package/lib/engine/test-helpers.js +7 -18
  35. package/lib/fangorn.d.ts +129 -156
  36. package/lib/fangorn.js +250 -250
  37. package/lib/feed.d.ts +7 -4
  38. package/lib/feed.js +4 -1
  39. package/lib/index.d.ts +9 -9
  40. package/lib/index.js +8 -9
  41. package/lib/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +77 -0
  42. package/lib/node_modules/@vitest/expect/dist/index.js +1414 -0
  43. package/lib/node_modules/@vitest/pretty-format/dist/index.js +858 -0
  44. package/lib/node_modules/@vitest/runner/dist/chunk-tasks.js +51 -0
  45. package/lib/node_modules/@vitest/runner/dist/index.js +1199 -0
  46. package/lib/node_modules/@vitest/runner/dist/utils.js +3 -0
  47. package/lib/node_modules/@vitest/snapshot/dist/index.js +1075 -0
  48. package/lib/node_modules/@vitest/spy/dist/index.js +353 -0
  49. package/lib/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +7 -0
  50. package/lib/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js +81 -0
  51. package/lib/node_modules/@vitest/utils/dist/diff.js +1345 -0
  52. package/lib/node_modules/@vitest/utils/dist/display.js +534 -0
  53. package/lib/node_modules/@vitest/utils/dist/error.js +30 -0
  54. package/lib/node_modules/@vitest/utils/dist/helpers.js +118 -0
  55. package/lib/node_modules/@vitest/utils/dist/serialize.js +76 -0
  56. package/lib/node_modules/@vitest/utils/dist/source-map.js +93 -0
  57. package/lib/node_modules/@vitest/utils/dist/timers.js +36 -0
  58. package/lib/node_modules/chai/index.js +2874 -0
  59. package/lib/node_modules/magic-string/dist/magic-string.es.js +939 -0
  60. package/lib/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js +81 -0
  61. package/lib/node_modules/tinyrainbow/dist/index.js +85 -0
  62. package/lib/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js +5 -0
  63. package/lib/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js +50 -0
  64. package/lib/node_modules/vitest/dist/chunks/utils.DvEY5TfP.js +44 -0
  65. package/lib/node_modules/vitest/dist/chunks/vi.2VT5v0um.js +2578 -0
  66. package/lib/providers/storage/signed-url.d.ts +16 -6
  67. package/lib/providers/storage/signed-url.js +20 -8
  68. package/lib/registry.d.ts +116 -0
  69. package/lib/registry.js +182 -0
  70. package/lib/test/mem-registry.d.ts +51 -0
  71. package/lib/test/mem-registry.js +107 -0
  72. package/lib/test/sdk-suite.d.ts +13 -0
  73. package/lib/test/sdk-suite.js +226 -0
  74. package/lib/test/testbed.d.ts +16411 -61
  75. package/lib/test/testbed.js +190 -84
  76. package/lib/types/index.d.ts +13 -11
  77. package/package.json +89 -73
  78. package/lib/contracts/data-registry/test.d.ts +0 -1
  79. package/lib/contracts/data-registry/test.js +0 -1
  80. package/lib/contracts/settlement-registry/abi.d.ts +0 -466
  81. package/lib/contracts/settlement-registry/abi.js +0 -535
  82. package/lib/contracts/settlement-registry/index.d.ts +0 -163
  83. package/lib/contracts/settlement-registry/index.js +0 -264
  84. package/lib/contracts/subscription-registry/abi.d.ts +0 -179
  85. package/lib/contracts/subscription-registry/abi.js +0 -195
  86. package/lib/contracts/subscription-registry/index.d.ts +0 -59
  87. package/lib/contracts/subscription-registry/index.js +0 -116
  88. package/lib/engine/graph.d.ts +0 -70
  89. package/lib/engine/graph.js +0 -73
@@ -0,0 +1,76 @@
1
+ //#region node_modules/@vitest/utils/dist/serialize.js
2
+ const IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
3
+ const IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";
4
+ function isImmutable(v) {
5
+ return v && (v[IS_COLLECTION_SYMBOL] || v[IS_RECORD_SYMBOL]);
6
+ }
7
+ const OBJECT_PROTO = Object.getPrototypeOf({});
8
+ function getUnserializableMessage(err) {
9
+ if (err instanceof Error) return `<unserializable>: ${err.message}`;
10
+ if (typeof err === "string") return `<unserializable>: ${err}`;
11
+ return "<unserializable>";
12
+ }
13
+ function serializeValue(val, seen = /* @__PURE__ */ new WeakMap()) {
14
+ if (!val || typeof val === "string") return val;
15
+ if (val instanceof Error && "toJSON" in val && typeof val.toJSON === "function") {
16
+ const jsonValue = val.toJSON();
17
+ if (jsonValue && jsonValue !== val && typeof jsonValue === "object") {
18
+ if (typeof val.message === "string") safe(() => jsonValue.message ?? (jsonValue.message = normalizeErrorMessage(val.message)));
19
+ if (typeof val.stack === "string") safe(() => jsonValue.stack ?? (jsonValue.stack = val.stack));
20
+ if (typeof val.name === "string") safe(() => jsonValue.name ?? (jsonValue.name = val.name));
21
+ if (val.cause != null) safe(() => jsonValue.cause ?? (jsonValue.cause = serializeValue(val.cause, seen)));
22
+ }
23
+ return serializeValue(jsonValue, seen);
24
+ }
25
+ if (typeof val === "function") return `Function<${val.name || "anonymous"}>`;
26
+ if (typeof val === "symbol") return val.toString();
27
+ if (typeof val !== "object") return val;
28
+ if (typeof Buffer !== "undefined" && val instanceof Buffer) return `<Buffer(${val.length}) ...>`;
29
+ if (typeof Uint8Array !== "undefined" && val instanceof Uint8Array) return `<Uint8Array(${val.length}) ...>`;
30
+ if (isImmutable(val)) return serializeValue(val.toJSON(), seen);
31
+ if (val instanceof Promise || val.constructor && val.constructor.prototype === "AsyncFunction") return "Promise";
32
+ if (typeof Element !== "undefined" && val instanceof Element) return val.tagName;
33
+ if (typeof val.toJSON === "function") return serializeValue(val.toJSON(), seen);
34
+ if (seen.has(val)) return seen.get(val);
35
+ if (Array.isArray(val)) {
36
+ const clone = new Array(val.length);
37
+ seen.set(val, clone);
38
+ val.forEach((e, i) => {
39
+ try {
40
+ clone[i] = serializeValue(e, seen);
41
+ } catch (err) {
42
+ clone[i] = getUnserializableMessage(err);
43
+ }
44
+ });
45
+ return clone;
46
+ } else {
47
+ const clone = Object.create(null);
48
+ seen.set(val, clone);
49
+ let obj = val;
50
+ while (obj && obj !== OBJECT_PROTO) {
51
+ Object.getOwnPropertyNames(obj).forEach((key) => {
52
+ if (key in clone) return;
53
+ try {
54
+ clone[key] = serializeValue(val[key], seen);
55
+ } catch (err) {
56
+ delete clone[key];
57
+ clone[key] = getUnserializableMessage(err);
58
+ }
59
+ });
60
+ obj = Object.getPrototypeOf(obj);
61
+ }
62
+ if (val instanceof Error) safe(() => val.message = normalizeErrorMessage(val.message));
63
+ return clone;
64
+ }
65
+ }
66
+ function safe(fn) {
67
+ try {
68
+ return fn();
69
+ } catch {}
70
+ }
71
+ function normalizeErrorMessage(message) {
72
+ return message.replace(/__(vite_ssr_import|vi_import)_\d+__\./g, "");
73
+ }
74
+
75
+ //#endregion
76
+ export { serializeValue };
@@ -0,0 +1,93 @@
1
+ import { resolve } from "./chunk-pathe.M-eThtNZ.js";
2
+
3
+ //#region node_modules/@vitest/utils/dist/source-map.js
4
+ var comma = ",".charCodeAt(0);
5
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
6
+ var intToChar = new Uint8Array(64);
7
+ var charToInt = new Uint8Array(128);
8
+ for (let i = 0; i < chars.length; i++) {
9
+ const c = chars.charCodeAt(i);
10
+ intToChar[i] = c;
11
+ charToInt[c] = i;
12
+ }
13
+ const CHROME_IE_STACK_REGEXP = /^\s*at .*(?:\S:\d+|\(native\))/m;
14
+ const SAFARI_NATIVE_CODE_REGEXP = /^(?:eval@)?(?:\[native code\])?$/;
15
+ function extractLocation(urlLike) {
16
+ if (!urlLike.includes(":")) return [urlLike];
17
+ const parts = /(.+?)(?::(\d+))?(?::(\d+))?$/.exec(urlLike.replace(/^\(|\)$/g, ""));
18
+ if (!parts) return [urlLike];
19
+ let url = parts[1];
20
+ if (url.startsWith("async ")) url = url.slice(6);
21
+ if (url.startsWith("http:") || url.startsWith("https:")) {
22
+ const urlObj = new URL(url);
23
+ urlObj.searchParams.delete("import");
24
+ urlObj.searchParams.delete("browserv");
25
+ url = urlObj.pathname + urlObj.hash + urlObj.search;
26
+ }
27
+ if (url.startsWith("/@fs/")) {
28
+ const isWindows = /^\/@fs\/[a-zA-Z]:\//.test(url);
29
+ url = url.slice(isWindows ? 5 : 4);
30
+ }
31
+ return [
32
+ url,
33
+ parts[2] || void 0,
34
+ parts[3] || void 0
35
+ ];
36
+ }
37
+ function parseSingleFFOrSafariStack(raw) {
38
+ let line = raw.trim();
39
+ if (SAFARI_NATIVE_CODE_REGEXP.test(line)) return null;
40
+ if (line.includes(" > eval")) line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1");
41
+ if (!line.includes("@")) return null;
42
+ let atIndex = -1;
43
+ let locationPart = "";
44
+ let functionName;
45
+ for (let i = 0; i < line.length; i++) if (line[i] === "@") {
46
+ const candidateLocation = line.slice(i + 1);
47
+ if (candidateLocation.includes(":") && candidateLocation.length >= 3) {
48
+ atIndex = i;
49
+ locationPart = candidateLocation;
50
+ functionName = i > 0 ? line.slice(0, i) : void 0;
51
+ break;
52
+ }
53
+ }
54
+ if (atIndex === -1 || !locationPart.includes(":") || locationPart.length < 3) return null;
55
+ const [url, lineNumber, columnNumber] = extractLocation(locationPart);
56
+ if (!url || !lineNumber || !columnNumber) return null;
57
+ return {
58
+ file: url,
59
+ method: functionName || "",
60
+ line: Number.parseInt(lineNumber),
61
+ column: Number.parseInt(columnNumber)
62
+ };
63
+ }
64
+ function parseSingleStack(raw) {
65
+ const line = raw.trim();
66
+ if (!CHROME_IE_STACK_REGEXP.test(line)) return parseSingleFFOrSafariStack(line);
67
+ return parseSingleV8Stack(line);
68
+ }
69
+ function parseSingleV8Stack(raw) {
70
+ let line = raw.trim();
71
+ if (!CHROME_IE_STACK_REGEXP.test(line)) return null;
72
+ if (line.includes("(eval ")) line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, "");
73
+ let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, "");
74
+ const location = sanitizedLine.match(/ (\(.+\)$)/);
75
+ sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
76
+ const [url, lineNumber, columnNumber] = extractLocation(location ? location[1] : sanitizedLine);
77
+ let method = location && sanitizedLine || "";
78
+ let file = url && ["eval", "<anonymous>"].includes(url) ? void 0 : url;
79
+ if (!file || !lineNumber || !columnNumber) return null;
80
+ if (method.startsWith("async ")) method = method.slice(6);
81
+ if (file.startsWith("file://")) file = file.slice(7);
82
+ file = file.startsWith("node:") || file.startsWith("internal:") ? file : resolve(file);
83
+ if (method) method = method.replace(/__vite_ssr_import_\d+__\./g, "").replace(/(Object\.)?__vite_ssr_export_default__\s?/g, "");
84
+ return {
85
+ method,
86
+ file,
87
+ line: Number.parseInt(lineNumber),
88
+ column: Number.parseInt(columnNumber)
89
+ };
90
+ }
91
+
92
+ //#endregion
93
+ export { parseSingleStack };
@@ -0,0 +1,36 @@
1
+ //#region node_modules/@vitest/utils/dist/timers.js
2
+ const SAFE_TIMERS_SYMBOL = Symbol("vitest:SAFE_TIMERS");
3
+ function getSafeTimers() {
4
+ const { setTimeout: safeSetTimeout, setInterval: safeSetInterval, clearInterval: safeClearInterval, clearTimeout: safeClearTimeout, setImmediate: safeSetImmediate, clearImmediate: safeClearImmediate, queueMicrotask: safeQueueMicrotask } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis;
5
+ const { nextTick: safeNextTick } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis.process || {};
6
+ return {
7
+ nextTick: safeNextTick,
8
+ setTimeout: safeSetTimeout,
9
+ setInterval: safeSetInterval,
10
+ clearInterval: safeClearInterval,
11
+ clearTimeout: safeClearTimeout,
12
+ setImmediate: safeSetImmediate,
13
+ clearImmediate: safeClearImmediate,
14
+ queueMicrotask: safeQueueMicrotask
15
+ };
16
+ }
17
+ /**
18
+ * Returns a promise that resolves after the specified duration.
19
+ *
20
+ * @param timeout - Delay in milliseconds
21
+ * @param scheduler - Timer function to use, defaults to `setTimeout`. Useful for mocked timers.
22
+ *
23
+ * @example
24
+ * await delay(100)
25
+ *
26
+ * @example
27
+ * // With mocked timers
28
+ * const { setTimeout } = getSafeTimers()
29
+ * await delay(100, setTimeout)
30
+ */
31
+ function delay(timeout, scheduler = setTimeout) {
32
+ return new Promise((resolve) => scheduler(resolve, timeout));
33
+ }
34
+
35
+ //#endregion
36
+ export { delay, getSafeTimers };