@dxos/util 0.8.4-main.c1de068 → 0.8.4-main.fd6878d

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.
@@ -207,6 +207,7 @@ var CallbackCollection = class {
207
207
  import { invariant as invariant2 } from "@dxos/invariant";
208
208
  var __dxlog_file2 = "/__w/dxos/dxos/packages/common/util/src/callback.ts";
209
209
  var Callback = class {
210
+ _callback;
210
211
  call(...args) {
211
212
  invariant2(this._callback, "Callback not set", {
212
213
  F: __dxlog_file2,
@@ -301,9 +302,10 @@ var chunkArray = (array, size) => {
301
302
  import { invariant as invariant3 } from "@dxos/invariant";
302
303
  var __dxlog_file3 = "/__w/dxos/dxos/packages/common/util/src/circular-buffer.ts";
303
304
  var CircularBuffer = class {
305
+ _buffer;
306
+ _nextIndex = 0;
307
+ _elementCount = 0;
304
308
  constructor(size) {
305
- this._nextIndex = 0;
306
- this._elementCount = 0;
307
309
  invariant3(size >= 1, void 0, {
308
310
  F: __dxlog_file3,
309
311
  L: 13,
@@ -374,6 +376,8 @@ import { inspect } from "@dxos/node-std/util";
374
376
  import { inspectObject, raise } from "@dxos/debug";
375
377
  var MAX_SERIALIZATION_LENGTH = 10;
376
378
  var ComplexSet = class {
379
+ _projection;
380
+ _values;
377
381
  // prettier-ignore
378
382
  constructor(_projection, values) {
379
383
  this._projection = _projection;
@@ -467,6 +471,9 @@ var makeSet = (projection) => {
467
471
  };
468
472
  };
469
473
  var ComplexMap = class _ComplexMap {
474
+ _keyProjection;
475
+ _keys;
476
+ _values;
470
477
  // prettier-ignore
471
478
  constructor(_keyProjection, entries2) {
472
479
  this._keyProjection = _keyProjection;
@@ -599,6 +606,7 @@ Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
599
606
  // src/defer.ts
600
607
  var defer = (fn) => new DeferGuard(fn);
601
608
  var DeferGuard = class {
609
+ _fn;
602
610
  /**
603
611
  * @internal
604
612
  */
@@ -614,6 +622,7 @@ var DeferGuard = class {
614
622
  };
615
623
  var deferAsync = (fn) => new DeferAsyncGuard(fn);
616
624
  var DeferAsyncGuard = class {
625
+ _fn;
617
626
  /**
618
627
  * @internal
619
628
  */
@@ -628,6 +637,8 @@ var DeferAsyncGuard = class {
628
637
  // src/entry.ts
629
638
  var entry = (map, key) => new MapEntry(map, key);
630
639
  var MapEntry = class {
640
+ _map;
641
+ _key;
631
642
  /**
632
643
  * @internal
633
644
  */
@@ -944,6 +955,7 @@ var DEFAULT_WORDLIST = [
944
955
  "zulu"
945
956
  ];
946
957
  var HumanHasher = class {
958
+ wordlist;
947
959
  /**
948
960
  * Transforms hex digests to human-readable strings.
949
961
  *
@@ -1209,6 +1221,8 @@ var deepMapValues = (value, fn) => {
1209
1221
  return new DeepMapper(fn).map(value);
1210
1222
  };
1211
1223
  var DeepMapper = class {
1224
+ _fn;
1225
+ _cyclic;
1212
1226
  constructor(_fn) {
1213
1227
  this._fn = _fn;
1214
1228
  this._cyclic = /* @__PURE__ */ new Map();
@@ -1244,11 +1258,14 @@ var DeepMapper = class {
1244
1258
  }
1245
1259
  return this._fn(value, this._recurse, key);
1246
1260
  }
1261
+ _recurse;
1247
1262
  };
1248
1263
  var deepMapValuesAsync = (value, fn) => {
1249
1264
  return new DeepMapperAsync(fn).map(value);
1250
1265
  };
1251
1266
  var DeepMapperAsync = class {
1267
+ _fn;
1268
+ _cyclic;
1252
1269
  constructor(_fn) {
1253
1270
  this._fn = _fn;
1254
1271
  this._cyclic = /* @__PURE__ */ new Map();
@@ -1284,6 +1301,7 @@ var DeepMapperAsync = class {
1284
1301
  }
1285
1302
  return this._fn(value, this._recurse, key);
1286
1303
  }
1304
+ _recurse;
1287
1305
  };
1288
1306
  var visitValues = (object, visitor) => {
1289
1307
  if (Array.isArray(object)) {
@@ -1630,8 +1648,10 @@ var safeParseJson = (data, defaultValue) => {
1630
1648
  import { invariant as invariant5 } from "@dxos/invariant";
1631
1649
  var __dxlog_file5 = "/__w/dxos/dxos/packages/common/util/src/sliding-window-summary.ts";
1632
1650
  var SlidingWindowSummary = class {
1651
+ _buffer;
1652
+ _sum = 0;
1653
+ _precision;
1633
1654
  constructor(options) {
1634
- this._sum = 0;
1635
1655
  this._buffer = new CircularBuffer(options.dataPoints);
1636
1656
  if (options.precision != null) {
1637
1657
  invariant5(options.precision >= 0, void 0, {
@@ -1711,12 +1731,23 @@ var capitalize = (str) => {
1711
1731
  }
1712
1732
  return str.charAt(0).toUpperCase() + str.slice(1);
1713
1733
  };
1714
- var trim = (strings, ...values) => {
1715
- const full = String.raw(strings, ...values);
1716
- const lines = full.replace(/^\n/, "").split("\n");
1717
- const indent = Math.min(...lines.filter((l) => l.trim()).map((l) => l.match(/^ */)[0].length));
1718
- return lines.map((l) => l.slice(indent)).join("\n");
1719
- };
1734
+ function trim(strings, ...values) {
1735
+ const raw = strings.reduce((out, str, i) => {
1736
+ out += str;
1737
+ if (i < values.length) {
1738
+ const match = str.match(/(^|\n)([ \t]*)$/);
1739
+ const baseIndent = match ? match[2] : "";
1740
+ const val = String(values[i]).replace(/\r?\n/g, "\n" + baseIndent);
1741
+ out += val;
1742
+ }
1743
+ return out;
1744
+ }, "");
1745
+ const lines = raw.split("\n");
1746
+ while (lines.length && !lines[0].trim()) lines.shift();
1747
+ while (lines.length && !lines[lines.length - 1].trim()) lines.pop();
1748
+ const minIndent = Math.min(...lines.filter((l) => l.trim()).map((l) => l.match(/^[ \t]*/)?.[0].length ?? 0));
1749
+ return lines.map((l) => l.slice(minIndent)).join("\n");
1750
+ }
1720
1751
 
1721
1752
  // src/sum.ts
1722
1753
  var sum = (values) => values.reduce((a, b) => a + b, 0);
@@ -1915,10 +1946,8 @@ var toFallback = (hash) => {
1915
1946
 
1916
1947
  // src/tracer.ts
1917
1948
  var Tracer = class {
1918
- constructor() {
1919
- this._events = /* @__PURE__ */ new Map();
1920
- this._recording = false;
1921
- }
1949
+ _events = /* @__PURE__ */ new Map();
1950
+ _recording = false;
1922
1951
  // TODO(burdon): Start/stop methods for recording data? By id?
1923
1952
  // Alternatively, enable subscriptions to track/compute series.
1924
1953
  // TODO(burdon): Hierarchical traces?
@@ -2061,11 +2090,11 @@ var createUrl = (url, search) => {
2061
2090
 
2062
2091
  // src/weak.ts
2063
2092
  var WeakDictionary = class {
2093
+ _internal = /* @__PURE__ */ new Map();
2094
+ _finalization = new FinalizationRegistry((cleanUpCallback) => {
2095
+ cleanUpCallback();
2096
+ });
2064
2097
  constructor(entries2) {
2065
- this._internal = /* @__PURE__ */ new Map();
2066
- this._finalization = new FinalizationRegistry((cleanUpCallback) => {
2067
- cleanUpCallback();
2068
- });
2069
2098
  this._internal = new Map(entries2?.map(([key, value]) => [
2070
2099
  key,
2071
2100
  new WeakRef(value)