@xyo-network/sdk-protocol 7.2.1 → 7.2.3

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  (() => {
3
- // ../../node_modules/.pnpm/@ariestools+threads@8.1.1_@opentelemetry+api@1.9.1_observable-fns@0.6.1_zod@4.4.3/node_modules/@ariestools/threads/dist/browser/worker/worker.browser.mjs
3
+ // ../../node_modules/.pnpm/@ariestools+threads@8.1.6_@opentelemetry+api@1.9.1_observable-fns@0.6.1_zod@4.4.3/node_modules/@ariestools/threads/dist/browser/worker/worker.browser.mjs
4
4
  var DefaultErrorSerializer = {
5
5
  deserialize: (message) => {
6
6
  const error = Object.create(Error.prototype);
@@ -1372,7 +1372,7 @@
1372
1372
  }
1373
1373
  };
1374
1374
 
1375
- // ../../node_modules/.pnpm/@ariestools+sdk@8.1.1_@opentelemetry+api@1.9.1_zod@4.4.3/node_modules/@ariestools/sdk/dist/browser/index.mjs
1375
+ // ../../node_modules/.pnpm/@ariestools+sdk@8.1.6_@opentelemetry+api@1.9.1_zod@4.4.3/node_modules/@ariestools/sdk/dist/browser/index.mjs
1376
1376
  var __defProp = Object.defineProperty;
1377
1377
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
1378
1378
  var __decorateClass = (decorators, target, key, kind) => {
@@ -1441,15 +1441,25 @@
1441
1441
  return { type: "unknown" };
1442
1442
  }
1443
1443
  var FetchError = class extends Error {
1444
+ /** Cross-realm marker consumed by {@link isFetchError}. */
1444
1445
  __fetchErrorMarker = fetchErrorMarker;
1446
+ /** Raw unparseable body text for `parse` failures. */
1445
1447
  body;
1448
+ /** Node, undici, or TLS system error code when available. */
1446
1449
  code;
1450
+ /** HTTP method associated with the failed request. */
1447
1451
  method;
1452
+ /** Parsed response for rejected HTTP-status requests. */
1448
1453
  response;
1454
+ /** HTTP status when a response was received. */
1449
1455
  status;
1456
+ /** HTTP reason phrase when a response was received. */
1450
1457
  statusText;
1458
+ /** Classified reason for the fetch failure. */
1451
1459
  type;
1460
+ /** Request URL associated with the failure. */
1452
1461
  url;
1462
+ /** Creates a structured fetch error from a message and request context. */
1453
1463
  constructor(message, context = {}) {
1454
1464
  super(message, { cause: context.cause });
1455
1465
  this.name = "FetchError";
@@ -1462,6 +1472,7 @@
1462
1472
  this.response = context.response;
1463
1473
  this.body = context.body;
1464
1474
  }
1475
+ /** Returns a circular-reference-free representation for logs and telemetry. */
1465
1476
  toJSON() {
1466
1477
  return {
1467
1478
  name: this.name,
@@ -1547,7 +1558,9 @@
1547
1558
  }
1548
1559
  }
1549
1560
  var FetchClientError = class extends FetchError {
1561
+ /** Effective request configuration, including the resolved request URL. */
1550
1562
  config;
1563
+ /** Creates an HTTP-status error with its response and request configuration. */
1551
1564
  constructor(message, response, config2) {
1552
1565
  super(message, {
1553
1566
  type: "http-status",
@@ -1585,13 +1598,17 @@
1585
1598
  return url.href;
1586
1599
  }
1587
1600
  var FetchClient = class _FetchClient {
1601
+ /** Instance defaults shallow-merged beneath every request configuration. */
1588
1602
  defaults;
1603
+ /** Creates a client with reusable request defaults. */
1589
1604
  constructor(defaults = {}) {
1590
1605
  this.defaults = defaults;
1591
1606
  }
1607
+ /** Creates a client with the supplied request defaults. */
1592
1608
  static create(config2) {
1593
1609
  return new _FetchClient(config2);
1594
1610
  }
1611
+ /** Sends a `DELETE` request and parses its response as JSON. */
1595
1612
  delete(url, config2) {
1596
1613
  return this.request({
1597
1614
  ...config2,
@@ -1599,6 +1616,7 @@
1599
1616
  method: "DELETE"
1600
1617
  });
1601
1618
  }
1619
+ /** Sends a `GET` request and parses its response as JSON. */
1602
1620
  get(url, config2) {
1603
1621
  return this.request({
1604
1622
  ...config2,
@@ -1606,6 +1624,7 @@
1606
1624
  method: "GET"
1607
1625
  });
1608
1626
  }
1627
+ /** Serializes `data`, sends a `PATCH` request, and parses the JSON response. */
1609
1628
  patch(url, data, config2) {
1610
1629
  return this.request({
1611
1630
  ...config2,
@@ -1614,6 +1633,7 @@
1614
1633
  method: "PATCH"
1615
1634
  });
1616
1635
  }
1636
+ /** Serializes `data`, sends a `POST` request, and parses the JSON response. */
1617
1637
  post(url, data, config2) {
1618
1638
  return this.request({
1619
1639
  ...config2,
@@ -1622,6 +1642,7 @@
1622
1642
  method: "POST"
1623
1643
  });
1624
1644
  }
1645
+ /** Serializes `data`, sends a `PUT` request, and parses the JSON response. */
1625
1646
  put(url, data, config2) {
1626
1647
  return this.request({
1627
1648
  ...config2,
@@ -1630,6 +1651,12 @@
1630
1651
  method: "PUT"
1631
1652
  });
1632
1653
  }
1654
+ /**
1655
+ * Resolves and executes a request using native fetch semantics.
1656
+ * @returns Response metadata and parsed JSON, or `null` for an empty body.
1657
+ * @throws {@link FetchClientError} when `validateStatus` rejects the status.
1658
+ * @throws {@link FetchError} for transport or JSON parsing failures.
1659
+ */
1633
1660
  async request(config2) {
1634
1661
  const merged = { ...this.defaults, ...config2 };
1635
1662
  const url = buildURL(merged);
@@ -1663,9 +1690,11 @@
1663
1690
  }
1664
1691
  };
1665
1692
  var FetchJsonClient = class _FetchJsonClient extends FetchClient {
1693
+ /** Creates a JSON client with reusable request and compression defaults. */
1666
1694
  constructor(config2) {
1667
1695
  super(config2);
1668
1696
  }
1697
+ /** Creates a JSON client with the supplied defaults. */
1669
1698
  static create(config2) {
1670
1699
  return new _FetchJsonClient(config2);
1671
1700
  }
@@ -1734,7 +1763,7 @@
1734
1763
  var assertError = (value, assert, defaultMessage) => {
1735
1764
  if (!isUndefined(assert)) {
1736
1765
  const assertString = typeof assert === "string" ? assert : typeof assert === "boolean" ? defaultMessage : assert(value, defaultMessage);
1737
- if (isString(assertString) || assertString) {
1766
+ if (assertString === true || isString(assertString)) {
1738
1767
  throw new Error(assertString === true ? defaultMessage : assertString);
1739
1768
  }
1740
1769
  }
@@ -1895,8 +1924,11 @@
1895
1924
  var MIN_GC_FREQUENCY = 1e3;
1896
1925
  var MIN_HISTORY_INTERVAL = 1e3;
1897
1926
  var Base = class _Base {
1927
+ /** Process-wide fallback logger used by instances without an explicit logger. */
1898
1928
  static defaultLogger;
1929
+ /** Weak references grouped by runtime class name for diagnostic instance counts. */
1899
1930
  static globalInstances = {};
1931
+ /** Recorded instance-count samples grouped by runtime class name. */
1900
1932
  static globalInstancesCountHistory = {};
1901
1933
  static _historyInterval = DEFAULT_HISTORY_INTERVAL;
1902
1934
  static _historyTime = DEFAULT_HISTORY_TIME;
@@ -1904,46 +1936,69 @@
1904
1936
  static _lastGC = 0;
1905
1937
  static _maxGcFrequency = MAX_GC_FREQUENCY;
1906
1938
  _params;
1939
+ /**
1940
+ * Stores the shared services and registers a weak reference for instance
1941
+ * diagnostics.
1942
+ * @param params - Logger and telemetry providers plus subclass parameters.
1943
+ */
1907
1944
  constructor(params) {
1908
1945
  this._params = params;
1909
1946
  params?.logger?.debug(`Base constructed [${this.constructor.name}]`);
1910
1947
  this.recordInstance();
1911
1948
  }
1949
+ /** Interval between instance-count samples, in milliseconds. */
1912
1950
  static get historyInterval() {
1913
1951
  return this._historyInterval;
1914
1952
  }
1953
+ /**
1954
+ * Sets the sample interval, clamped to at least one second.
1955
+ * @throws When the requested interval exceeds {@link historyTime}.
1956
+ */
1915
1957
  static set historyInterval(value) {
1916
1958
  assertEx(value <= this.historyTime, () => `historyInterval [${value}] must be less than or equal to historyTime [${this.historyTime}]`);
1917
1959
  this._historyInterval = Math.max(value, MIN_HISTORY_INTERVAL);
1918
1960
  }
1961
+ /** Configured retention window for instance-count history, in milliseconds. */
1919
1962
  static get historyTime() {
1920
1963
  return this._historyTime;
1921
1964
  }
1965
+ /**
1966
+ * Applies the requested history-time configuration.
1967
+ * @throws When the requested value is shorter than {@link historyInterval}.
1968
+ */
1922
1969
  static set historyTime(value) {
1923
1970
  assertEx(value >= this.historyInterval, () => `historyTime [${value}] must be greater than or equal to historyInterval [${this.historyInterval}]`);
1924
1971
  this._historyInterval = value;
1925
1972
  }
1973
+ /** Minimum elapsed time between unforced garbage-collection scans. */
1926
1974
  static get maxGcFrequency() {
1927
1975
  return this._maxGcFrequency;
1928
1976
  }
1977
+ /** Sets the scan interval, clamped to at least one second. */
1929
1978
  static set maxGcFrequency(value) {
1930
1979
  this._maxGcFrequency = Math.max(value, MIN_GC_FREQUENCY);
1931
1980
  }
1981
+ /** Maximum number of samples retained for each runtime class. */
1932
1982
  static get maxHistoryDepth() {
1933
1983
  return Math.floor(this.historyTime / this.historyInterval);
1934
1984
  }
1985
+ /** Explicit instance logger or the process-wide default logger. */
1935
1986
  get logger() {
1936
1987
  return this.params?.logger ?? _Base.defaultLogger;
1937
1988
  }
1989
+ /** Meter created lazily from the configured provider for the runtime class. */
1938
1990
  get meter() {
1939
1991
  return this.params?.meterProvider?.getMeter(this.constructor.name);
1940
1992
  }
1993
+ /** Construction parameters retained by this instance. */
1941
1994
  get params() {
1942
1995
  return this._params;
1943
1996
  }
1997
+ /** Tracer created lazily from the configured provider for the runtime class. */
1944
1998
  get tracer() {
1945
1999
  return this.params?.traceProvider?.getTracer(this.constructor.name);
1946
2000
  }
2001
+ /** Implements forced, frequency-limited, or class-specific cleanup. */
1947
2002
  static gc(classNameOrForce = false) {
1948
2003
  if (typeof classNameOrForce === "string") {
1949
2004
  this.gcClass(classNameOrForce);
@@ -1953,15 +2008,18 @@
1953
2008
  }
1954
2009
  }
1955
2010
  }
2011
+ /** Returns the currently tracked weak-reference count for a runtime class. */
1956
2012
  static instanceCount(className) {
1957
2013
  return this.globalInstances[className]?.length ?? 0;
1958
2014
  }
2015
+ /** Runs eligible cleanup and returns counts for all tracked runtime classes. */
1959
2016
  static instanceCounts() {
1960
2017
  this.gc();
1961
2018
  const result = {};
1962
2019
  for (const [className, instances] of Object.entries(this.globalInstances)) result[className] = instances.length;
1963
2020
  return result;
1964
2021
  }
2022
+ /** Starts periodic instance-count sampling, replacing an existing timer. */
1965
2023
  static startHistory() {
1966
2024
  if (this._historyTimeout !== void 0) {
1967
2025
  this.stopHistory();
@@ -1975,6 +2033,7 @@
1975
2033
  };
1976
2034
  this._historyTimeout = setTimeout(timeoutHandler, this.historyInterval);
1977
2035
  }
2036
+ /** Stops periodic instance-count sampling when it is active. */
1978
2037
  static stopHistory() {
1979
2038
  if (this._historyTimeout === void 0) {
1980
2039
  return;
@@ -2225,9 +2284,13 @@
2225
2284
  static anyMap = /* @__PURE__ */ new WeakMap();
2226
2285
  static eventsMap = /* @__PURE__ */ new WeakMap();
2227
2286
  static isGlobalDebugEnabled = false;
2228
- // this is here to be able to query the type, not use
2287
+ /** Type-only event map exposed for consumers that need to infer event data. */
2229
2288
  eventData = {};
2230
2289
  _canEmitMetaEvents = false;
2290
+ /**
2291
+ * Creates isolated named and wildcard listener registries.
2292
+ * @param params - Base services and optional per-instance debug behavior.
2293
+ */
2231
2294
  constructor(params = {}) {
2232
2295
  const mutatedParams = { ...params };
2233
2296
  if (mutatedParams.debug) {
@@ -2257,6 +2320,7 @@
2257
2320
  const env = processGlobal.process?.env;
2258
2321
  return env?.DEBUG === "events" || env?.DEBUG === "*" || this.isGlobalDebugEnabled;
2259
2322
  }
2323
+ /** Enables or disables process-wide event debug logging. */
2260
2324
  static set isDebugEnabled(newValue) {
2261
2325
  this.isGlobalDebugEnabled = newValue;
2262
2326
  }
@@ -2534,9 +2598,10 @@
2534
2598
  }
2535
2599
  };
2536
2600
  var BaseEmitter = class extends Base {
2537
- // just here to query types
2601
+ /** Type-only event map exposed for consumers that need to infer event data. */
2538
2602
  eventData = {};
2539
2603
  events;
2604
+ /** Creates an emitter with an isolated listener registry. */
2540
2605
  constructor(params) {
2541
2606
  super(params);
2542
2607
  this.events = new Events();
@@ -2628,6 +2693,12 @@
2628
2693
  defaultParams;
2629
2694
  /** Labels identifying resources created by this factory. */
2630
2695
  labels;
2696
+ /**
2697
+ * Creates a factory with reusable defaults and merged class labels.
2698
+ * @param creatable - Creatable constructor invoked by {@link create}.
2699
+ * @param params - Default parameters overridden by each create call.
2700
+ * @param labels - Labels merged over any static creatable labels.
2701
+ */
2631
2702
  constructor(creatable2, params, labels = {}) {
2632
2703
  this.creatable = creatable2;
2633
2704
  this.defaultParams = params;
@@ -2659,7 +2730,7 @@
2659
2730
  let newIndex;
2660
2731
  const stackParts = error.stack?.split("\n")[depth]?.split(" ");
2661
2732
  const funcName = stackParts?.find((item, index) => {
2662
- if (item.length === 0 || item === "at") {
2733
+ if (item === "at" || item.length === 0) {
2663
2734
  return;
2664
2735
  }
2665
2736
  if (item === "new") {
@@ -2692,6 +2763,12 @@
2692
2763
  _status = null;
2693
2764
  _statusMutex = new Mutex();
2694
2765
  _validatedParams;
2766
+ /**
2767
+ * Constructs an instance for the static creation pipeline.
2768
+ * @param key - Private construction token supplied by {@link create}.
2769
+ * @param params - Unvalidated parameters retained until first access.
2770
+ * @throws When called directly instead of through {@link create}.
2771
+ */
2695
2772
  constructor(key, params) {
2696
2773
  assertEx(key === AbstractCreatableConstructorKey, () => "AbstractCreatable should not be instantiated directly, use the static create method instead");
2697
2774
  super(params);
@@ -3120,7 +3197,7 @@
3120
3197
  var toJsonObject = zodToFactory(JsonObjectZod, "toJsonObject");
3121
3198
  var subtle = globalThis.crypto?.subtle;
3122
3199
 
3123
- // ../../node_modules/.pnpm/@ariestools+threads@8.1.1_@opentelemetry+api@1.9.1_observable-fns@0.6.1_zod@4.4.3/node_modules/@ariestools/threads/dist/browser/worker/worker.browser.mjs
3200
+ // ../../node_modules/.pnpm/@ariestools+threads@8.1.6_@opentelemetry+api@1.9.1_observable-fns@0.6.1_zod@4.4.3/node_modules/@ariestools/threads/dist/browser/worker/worker.browser.mjs
3124
3201
  var DefaultErrorSerializer = {
3125
3202
  deserialize: (message) => {
3126
3203
  const error = Object.create(Error.prototype);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/sdk-protocol",
3
- "version": "7.2.1",
3
+ "version": "7.2.3",
4
4
  "description": "Foundation SDK facade for XYO Protocol 2.0 (re-exports @xyo-network/sdk-protocol-core)",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -363,15 +363,15 @@
363
363
  "README.md"
364
364
  ],
365
365
  "dependencies": {
366
- "@xyo-network/sdk-protocol-core": "~7.2.1"
366
+ "@xyo-network/sdk-protocol-core": "~7.2.3"
367
367
  },
368
368
  "devDependencies": {
369
- "@ariestools/sdk": "~8.1.1",
370
- "@ariestools/toolchain": "~8.7.14",
371
- "@ariestools/tsconfig": "~8.7.14",
372
- "@opentelemetry/api": "~1.9.0",
369
+ "@ariestools/sdk": "~8.1.6",
370
+ "@ariestools/toolchain": "~8.7.26",
371
+ "@ariestools/tsconfig": "~8.7.26",
372
+ "@opentelemetry/api": "~1.9.1",
373
373
  "ajv": "~8.20.0",
374
- "eslint": "~10.7.0",
374
+ "eslint": "~10.8.0",
375
375
  "eslint-import-resolver-typescript": "~4.4.5",
376
376
  "ethers": "~6.17.0",
377
377
  "typescript": "~6.0.3",