@dxos/util 0.8.4-main.406dc2a → 0.8.4-main.548089c
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.
- package/dist/lib/browser/index.mjs +323 -415
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +323 -415
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/safe-stringify.d.ts +13 -0
- package/dist/types/src/safe-stringify.d.ts.map +1 -0
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/unit.d.ts +12 -13
- package/dist/types/src/unit.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/src/binder.ts +2 -2
- package/src/index.ts +1 -0
- package/src/safe-stringify.ts +104 -0
- package/src/types.ts +0 -1
- package/src/unit.test.ts +1 -1
- package/src/unit.ts +58 -28
|
@@ -103,10 +103,10 @@ function assumeType(value) {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
// src/binder.ts
|
|
106
|
-
import
|
|
106
|
+
import { promisify } from "@dxos/node-std/util";
|
|
107
107
|
var createBinder = (obj) => ({
|
|
108
108
|
fn: (fn) => fn.bind(obj),
|
|
109
|
-
async: (fn) =>
|
|
109
|
+
async: (fn) => promisify(fn.bind(obj))
|
|
110
110
|
});
|
|
111
111
|
|
|
112
112
|
// src/bitfield.ts
|
|
@@ -180,92 +180,34 @@ var BitField = class _BitField {
|
|
|
180
180
|
};
|
|
181
181
|
|
|
182
182
|
// src/callback-collection.ts
|
|
183
|
-
function _check_private_redeclaration(obj, privateCollection) {
|
|
184
|
-
if (privateCollection.has(obj)) {
|
|
185
|
-
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
function _class_apply_descriptor_get(receiver, descriptor) {
|
|
189
|
-
if (descriptor.get) {
|
|
190
|
-
return descriptor.get.call(receiver);
|
|
191
|
-
}
|
|
192
|
-
return descriptor.value;
|
|
193
|
-
}
|
|
194
|
-
function _class_apply_descriptor_set(receiver, descriptor, value) {
|
|
195
|
-
if (descriptor.set) {
|
|
196
|
-
descriptor.set.call(receiver, value);
|
|
197
|
-
} else {
|
|
198
|
-
if (!descriptor.writable) {
|
|
199
|
-
throw new TypeError("attempted to set read only private field");
|
|
200
|
-
}
|
|
201
|
-
descriptor.value = value;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
function _class_extract_field_descriptor(receiver, privateMap, action) {
|
|
205
|
-
if (!privateMap.has(receiver)) {
|
|
206
|
-
throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
207
|
-
}
|
|
208
|
-
return privateMap.get(receiver);
|
|
209
|
-
}
|
|
210
|
-
function _class_private_field_get(receiver, privateMap) {
|
|
211
|
-
var descriptor = _class_extract_field_descriptor(receiver, privateMap, "get");
|
|
212
|
-
return _class_apply_descriptor_get(receiver, descriptor);
|
|
213
|
-
}
|
|
214
|
-
function _class_private_field_init(obj, privateMap, value) {
|
|
215
|
-
_check_private_redeclaration(obj, privateMap);
|
|
216
|
-
privateMap.set(obj, value);
|
|
217
|
-
}
|
|
218
|
-
function _class_private_field_set(receiver, privateMap, value) {
|
|
219
|
-
var descriptor = _class_extract_field_descriptor(receiver, privateMap, "set");
|
|
220
|
-
_class_apply_descriptor_set(receiver, descriptor, value);
|
|
221
|
-
return value;
|
|
222
|
-
}
|
|
223
|
-
var _callbacks = /* @__PURE__ */ new WeakMap();
|
|
224
183
|
var CallbackCollection = class {
|
|
184
|
+
#callbacks = [];
|
|
225
185
|
append(callback) {
|
|
226
|
-
|
|
186
|
+
this.#callbacks.push(callback);
|
|
227
187
|
}
|
|
228
188
|
prepend(callback) {
|
|
229
|
-
|
|
189
|
+
this.#callbacks.unshift(callback);
|
|
230
190
|
}
|
|
231
191
|
remove(callback) {
|
|
232
|
-
|
|
192
|
+
this.#callbacks = this.#callbacks.filter((c) => c !== callback);
|
|
233
193
|
}
|
|
234
194
|
callParallel(...args) {
|
|
235
|
-
return Promise.all(
|
|
195
|
+
return Promise.all(this.#callbacks.map((callback) => callback(...args)));
|
|
236
196
|
}
|
|
237
197
|
async callSerial(...args) {
|
|
238
198
|
const results = [];
|
|
239
|
-
for (const callback of
|
|
199
|
+
for (const callback of this.#callbacks) {
|
|
240
200
|
results.push(await callback(...args));
|
|
241
201
|
}
|
|
242
202
|
return results;
|
|
243
203
|
}
|
|
244
|
-
constructor() {
|
|
245
|
-
_class_private_field_init(this, _callbacks, {
|
|
246
|
-
writable: true,
|
|
247
|
-
value: []
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
204
|
};
|
|
251
205
|
|
|
252
206
|
// src/callback.ts
|
|
253
207
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
254
|
-
function _define_property(obj, key, value) {
|
|
255
|
-
if (key in obj) {
|
|
256
|
-
Object.defineProperty(obj, key, {
|
|
257
|
-
value,
|
|
258
|
-
enumerable: true,
|
|
259
|
-
configurable: true,
|
|
260
|
-
writable: true
|
|
261
|
-
});
|
|
262
|
-
} else {
|
|
263
|
-
obj[key] = value;
|
|
264
|
-
}
|
|
265
|
-
return obj;
|
|
266
|
-
}
|
|
267
208
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/common/util/src/callback.ts";
|
|
268
209
|
var Callback = class {
|
|
210
|
+
_callback;
|
|
269
211
|
call(...args) {
|
|
270
212
|
invariant2(this._callback, "Callback not set", {
|
|
271
213
|
F: __dxlog_file2,
|
|
@@ -296,9 +238,6 @@ var Callback = class {
|
|
|
296
238
|
isSet() {
|
|
297
239
|
return !!this._callback;
|
|
298
240
|
}
|
|
299
|
-
constructor() {
|
|
300
|
-
_define_property(this, "_callback", void 0);
|
|
301
|
-
}
|
|
302
241
|
};
|
|
303
242
|
var createSetDispatch = ({ handlers }) => {
|
|
304
243
|
return new Proxy({
|
|
@@ -361,21 +300,23 @@ var chunkArray = (array, size) => {
|
|
|
361
300
|
|
|
362
301
|
// src/circular-buffer.ts
|
|
363
302
|
import { invariant as invariant3 } from "@dxos/invariant";
|
|
364
|
-
function _define_property2(obj, key, value) {
|
|
365
|
-
if (key in obj) {
|
|
366
|
-
Object.defineProperty(obj, key, {
|
|
367
|
-
value,
|
|
368
|
-
enumerable: true,
|
|
369
|
-
configurable: true,
|
|
370
|
-
writable: true
|
|
371
|
-
});
|
|
372
|
-
} else {
|
|
373
|
-
obj[key] = value;
|
|
374
|
-
}
|
|
375
|
-
return obj;
|
|
376
|
-
}
|
|
377
303
|
var __dxlog_file3 = "/__w/dxos/dxos/packages/common/util/src/circular-buffer.ts";
|
|
378
304
|
var CircularBuffer = class {
|
|
305
|
+
_buffer;
|
|
306
|
+
_nextIndex = 0;
|
|
307
|
+
_elementCount = 0;
|
|
308
|
+
constructor(size) {
|
|
309
|
+
invariant3(size >= 1, void 0, {
|
|
310
|
+
F: __dxlog_file3,
|
|
311
|
+
L: 13,
|
|
312
|
+
S: this,
|
|
313
|
+
A: [
|
|
314
|
+
"size >= 1",
|
|
315
|
+
""
|
|
316
|
+
]
|
|
317
|
+
});
|
|
318
|
+
this._buffer = new Array(size);
|
|
319
|
+
}
|
|
379
320
|
push(element) {
|
|
380
321
|
const evicted = this._elementCount === this._buffer.length ? this._buffer[this._nextIndex] : void 0;
|
|
381
322
|
this._buffer[this._nextIndex] = element;
|
|
@@ -415,21 +356,6 @@ var CircularBuffer = class {
|
|
|
415
356
|
yield this._buffer[i];
|
|
416
357
|
}
|
|
417
358
|
}
|
|
418
|
-
constructor(size) {
|
|
419
|
-
_define_property2(this, "_buffer", void 0);
|
|
420
|
-
_define_property2(this, "_nextIndex", 0);
|
|
421
|
-
_define_property2(this, "_elementCount", 0);
|
|
422
|
-
invariant3(size >= 1, void 0, {
|
|
423
|
-
F: __dxlog_file3,
|
|
424
|
-
L: 13,
|
|
425
|
-
S: this,
|
|
426
|
-
A: [
|
|
427
|
-
"size >= 1",
|
|
428
|
-
""
|
|
429
|
-
]
|
|
430
|
-
});
|
|
431
|
-
this._buffer = new Array(size);
|
|
432
|
-
}
|
|
433
359
|
};
|
|
434
360
|
|
|
435
361
|
// src/clear-undefined.ts
|
|
@@ -448,22 +374,19 @@ var clearUndefined = (obj) => {
|
|
|
448
374
|
// src/complex.ts
|
|
449
375
|
import { inspect } from "@dxos/node-std/util";
|
|
450
376
|
import { inspectObject, raise } from "@dxos/debug";
|
|
451
|
-
function _define_property3(obj, key, value) {
|
|
452
|
-
if (key in obj) {
|
|
453
|
-
Object.defineProperty(obj, key, {
|
|
454
|
-
value,
|
|
455
|
-
enumerable: true,
|
|
456
|
-
configurable: true,
|
|
457
|
-
writable: true
|
|
458
|
-
});
|
|
459
|
-
} else {
|
|
460
|
-
obj[key] = value;
|
|
461
|
-
}
|
|
462
|
-
return obj;
|
|
463
|
-
}
|
|
464
377
|
var MAX_SERIALIZATION_LENGTH = 10;
|
|
465
|
-
var _inspect_custom = inspect.custom;
|
|
466
378
|
var ComplexSet = class {
|
|
379
|
+
_projection;
|
|
380
|
+
_values = /* @__PURE__ */ new Map();
|
|
381
|
+
// prettier-ignore
|
|
382
|
+
constructor(_projection, values) {
|
|
383
|
+
this._projection = _projection;
|
|
384
|
+
if (values) {
|
|
385
|
+
for (const value of values) {
|
|
386
|
+
this.add(value);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
467
390
|
toString() {
|
|
468
391
|
return inspectObject(this);
|
|
469
392
|
}
|
|
@@ -472,7 +395,7 @@ var ComplexSet = class {
|
|
|
472
395
|
size: this._values.size
|
|
473
396
|
} : Array.from(this._values.values());
|
|
474
397
|
}
|
|
475
|
-
[
|
|
398
|
+
[inspect.custom]() {
|
|
476
399
|
return inspectObject(this);
|
|
477
400
|
}
|
|
478
401
|
add(value) {
|
|
@@ -538,18 +461,6 @@ var ComplexSet = class {
|
|
|
538
461
|
isDisjointFrom(other) {
|
|
539
462
|
throw new Error("Method not implemented.");
|
|
540
463
|
}
|
|
541
|
-
// prettier-ignore
|
|
542
|
-
constructor(_projection, values) {
|
|
543
|
-
_define_property3(this, "_projection", void 0);
|
|
544
|
-
_define_property3(this, "_values", void 0);
|
|
545
|
-
this._projection = _projection;
|
|
546
|
-
this._values = /* @__PURE__ */ new Map();
|
|
547
|
-
if (values) {
|
|
548
|
-
for (const value of values) {
|
|
549
|
-
this.add(value);
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
464
|
};
|
|
554
465
|
var makeSet = (projection) => {
|
|
555
466
|
return class BoundComplexSet extends ComplexSet {
|
|
@@ -558,8 +469,19 @@ var makeSet = (projection) => {
|
|
|
558
469
|
}
|
|
559
470
|
};
|
|
560
471
|
};
|
|
561
|
-
var _inspect_custom1 = inspect.custom;
|
|
562
472
|
var ComplexMap = class _ComplexMap {
|
|
473
|
+
_keyProjection;
|
|
474
|
+
_keys = /* @__PURE__ */ new Map();
|
|
475
|
+
_values = /* @__PURE__ */ new Map();
|
|
476
|
+
// prettier-ignore
|
|
477
|
+
constructor(_keyProjection, entries2) {
|
|
478
|
+
this._keyProjection = _keyProjection;
|
|
479
|
+
if (entries2) {
|
|
480
|
+
for (const [key, value] of entries2) {
|
|
481
|
+
this.set(key, value);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
563
485
|
toString() {
|
|
564
486
|
return inspectObject(this);
|
|
565
487
|
}
|
|
@@ -568,7 +490,7 @@ var ComplexMap = class _ComplexMap {
|
|
|
568
490
|
size: this._values.size
|
|
569
491
|
} : Array.from(this._values.values());
|
|
570
492
|
}
|
|
571
|
-
[
|
|
493
|
+
[inspect.custom]() {
|
|
572
494
|
return inspectObject(this);
|
|
573
495
|
}
|
|
574
496
|
clear() {
|
|
@@ -630,28 +552,11 @@ var ComplexMap = class _ComplexMap {
|
|
|
630
552
|
get [Symbol.toStringTag]() {
|
|
631
553
|
return "ComplexMap";
|
|
632
554
|
}
|
|
633
|
-
// prettier-ignore
|
|
634
|
-
constructor(_keyProjection, entries2) {
|
|
635
|
-
_define_property3(this, "_keyProjection", void 0);
|
|
636
|
-
_define_property3(this, "_keys", void 0);
|
|
637
|
-
_define_property3(this, "_values", void 0);
|
|
638
|
-
this._keyProjection = _keyProjection;
|
|
639
|
-
this._keys = /* @__PURE__ */ new Map();
|
|
640
|
-
this._values = /* @__PURE__ */ new Map();
|
|
641
|
-
if (entries2) {
|
|
642
|
-
for (const [key, value] of entries2) {
|
|
643
|
-
this.set(key, value);
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
555
|
};
|
|
648
|
-
var makeMap = (keyProjection) => {
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
super(keyProjection, entries2);
|
|
652
|
-
}
|
|
556
|
+
var makeMap = (keyProjection) => class BoundComplexMap extends ComplexMap {
|
|
557
|
+
constructor(entries2) {
|
|
558
|
+
super(keyProjection, entries2);
|
|
653
559
|
}
|
|
654
|
-
return BoundComplexMap;
|
|
655
560
|
};
|
|
656
561
|
|
|
657
562
|
// src/deep.ts
|
|
@@ -692,71 +597,53 @@ var getDeep = (obj, path) => {
|
|
|
692
597
|
var deferFunction = (fnProvider) => (...args) => fnProvider()(...args);
|
|
693
598
|
|
|
694
599
|
// src/explicit-resource-management-polyfill.ts
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
(_Symbol = Symbol).dispose ?? (_Symbol.dispose = Symbol("Symbol.dispose"));
|
|
698
|
-
(_Symbol1 = Symbol).asyncDispose ?? (_Symbol1.asyncDispose = Symbol("Symbol.asyncDispose"));
|
|
600
|
+
Symbol.dispose ??= Symbol("Symbol.dispose");
|
|
601
|
+
Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
699
602
|
|
|
700
603
|
// src/defer.ts
|
|
701
|
-
function _define_property4(obj, key, value) {
|
|
702
|
-
if (key in obj) {
|
|
703
|
-
Object.defineProperty(obj, key, {
|
|
704
|
-
value,
|
|
705
|
-
enumerable: true,
|
|
706
|
-
configurable: true,
|
|
707
|
-
writable: true
|
|
708
|
-
});
|
|
709
|
-
} else {
|
|
710
|
-
obj[key] = value;
|
|
711
|
-
}
|
|
712
|
-
return obj;
|
|
713
|
-
}
|
|
714
604
|
var defer = (fn) => new DeferGuard(fn);
|
|
715
605
|
var DeferGuard = class {
|
|
716
|
-
|
|
717
|
-
const result = this._fn();
|
|
718
|
-
if (result instanceof Promise) {
|
|
719
|
-
throw new Error("Async functions in defer are not supported. Use deferAsync instead.");
|
|
720
|
-
}
|
|
721
|
-
}
|
|
606
|
+
_fn;
|
|
722
607
|
/**
|
|
723
608
|
* @internal
|
|
724
609
|
*/
|
|
725
610
|
constructor(_fn) {
|
|
726
|
-
_define_property4(this, "_fn", void 0);
|
|
727
611
|
this._fn = _fn;
|
|
728
612
|
}
|
|
613
|
+
[Symbol.dispose]() {
|
|
614
|
+
const result = this._fn();
|
|
615
|
+
if (result instanceof Promise) {
|
|
616
|
+
throw new Error("Async functions in defer are not supported. Use deferAsync instead.");
|
|
617
|
+
}
|
|
618
|
+
}
|
|
729
619
|
};
|
|
730
620
|
var deferAsync = (fn) => new DeferAsyncGuard(fn);
|
|
731
621
|
var DeferAsyncGuard = class {
|
|
732
|
-
|
|
733
|
-
await this._fn();
|
|
734
|
-
}
|
|
622
|
+
_fn;
|
|
735
623
|
/**
|
|
736
624
|
* @internal
|
|
737
625
|
*/
|
|
738
626
|
constructor(_fn) {
|
|
739
|
-
_define_property4(this, "_fn", void 0);
|
|
740
627
|
this._fn = _fn;
|
|
741
628
|
}
|
|
629
|
+
async [Symbol.asyncDispose]() {
|
|
630
|
+
await this._fn();
|
|
631
|
+
}
|
|
742
632
|
};
|
|
743
633
|
|
|
744
634
|
// src/entry.ts
|
|
745
|
-
function _define_property5(obj, key, value) {
|
|
746
|
-
if (key in obj) {
|
|
747
|
-
Object.defineProperty(obj, key, {
|
|
748
|
-
value,
|
|
749
|
-
enumerable: true,
|
|
750
|
-
configurable: true,
|
|
751
|
-
writable: true
|
|
752
|
-
});
|
|
753
|
-
} else {
|
|
754
|
-
obj[key] = value;
|
|
755
|
-
}
|
|
756
|
-
return obj;
|
|
757
|
-
}
|
|
758
635
|
var entry = (map, key) => new MapEntry(map, key);
|
|
759
636
|
var MapEntry = class {
|
|
637
|
+
_map;
|
|
638
|
+
_key;
|
|
639
|
+
/**
|
|
640
|
+
* @internal
|
|
641
|
+
*/
|
|
642
|
+
// prettier-ignore
|
|
643
|
+
constructor(_map, _key) {
|
|
644
|
+
this._map = _map;
|
|
645
|
+
this._key = _key;
|
|
646
|
+
}
|
|
760
647
|
get key() {
|
|
761
648
|
return this._key;
|
|
762
649
|
}
|
|
@@ -772,16 +659,6 @@ var MapEntry = class {
|
|
|
772
659
|
deep(key) {
|
|
773
660
|
return entry(this.value, key);
|
|
774
661
|
}
|
|
775
|
-
/**
|
|
776
|
-
* @internal
|
|
777
|
-
*/
|
|
778
|
-
// prettier-ignore
|
|
779
|
-
constructor(_map, _key) {
|
|
780
|
-
_define_property5(this, "_map", void 0);
|
|
781
|
-
_define_property5(this, "_key", void 0);
|
|
782
|
-
this._map = _map;
|
|
783
|
-
this._key = _key;
|
|
784
|
-
}
|
|
785
662
|
};
|
|
786
663
|
|
|
787
664
|
// src/for-each-async.ts
|
|
@@ -789,19 +666,6 @@ var forEachAsync = (items, fn) => Promise.all(items.map(fn));
|
|
|
789
666
|
|
|
790
667
|
// src/human-hash.ts
|
|
791
668
|
import { PublicKey } from "@dxos/keys";
|
|
792
|
-
function _define_property6(obj, key, value) {
|
|
793
|
-
if (key in obj) {
|
|
794
|
-
Object.defineProperty(obj, key, {
|
|
795
|
-
value,
|
|
796
|
-
enumerable: true,
|
|
797
|
-
configurable: true,
|
|
798
|
-
writable: true
|
|
799
|
-
});
|
|
800
|
-
} else {
|
|
801
|
-
obj[key] = value;
|
|
802
|
-
}
|
|
803
|
-
return obj;
|
|
804
|
-
}
|
|
805
669
|
var DEFAULT_WORDLIST = [
|
|
806
670
|
"ack",
|
|
807
671
|
"alabama",
|
|
@@ -1061,6 +925,27 @@ var DEFAULT_WORDLIST = [
|
|
|
1061
925
|
"zulu"
|
|
1062
926
|
];
|
|
1063
927
|
var HumanHasher = class {
|
|
928
|
+
wordlist;
|
|
929
|
+
/**
|
|
930
|
+
* Transforms hex digests to human-readable strings.
|
|
931
|
+
*
|
|
932
|
+
* The format of these strings will look something like:
|
|
933
|
+
* `victor-bacon-zulu-lima`. The output is obtained by compressing the input
|
|
934
|
+
* digest to a fixed number of bytes, then mapping those bytes to one of 256
|
|
935
|
+
* words. A default wordlist is provided, but you can override this if you
|
|
936
|
+
* prefer.
|
|
937
|
+
* As long as you use the same wordlist, the output will be consistent (i.e.
|
|
938
|
+
* the same digest will always render the same representation).
|
|
939
|
+
*
|
|
940
|
+
* @param wordlist A list of exactly 256 words to choose from
|
|
941
|
+
*/
|
|
942
|
+
constructor(wordlist = DEFAULT_WORDLIST) {
|
|
943
|
+
this.wordlist = wordlist;
|
|
944
|
+
if (wordlist.length !== 256) {
|
|
945
|
+
throw new Error("Wordlist must have exactly 256 items");
|
|
946
|
+
}
|
|
947
|
+
this.wordlist = wordlist;
|
|
948
|
+
}
|
|
1064
949
|
/**
|
|
1065
950
|
* Humanize a given hexadecimal digest.
|
|
1066
951
|
*
|
|
@@ -1100,27 +985,6 @@ var HumanHasher = class {
|
|
|
1100
985
|
const checksums = segments.map((x) => x.reduce((acc, curr) => acc ^ curr));
|
|
1101
986
|
return checksums;
|
|
1102
987
|
}
|
|
1103
|
-
/**
|
|
1104
|
-
* Transforms hex digests to human-readable strings.
|
|
1105
|
-
*
|
|
1106
|
-
* The format of these strings will look something like:
|
|
1107
|
-
* `victor-bacon-zulu-lima`. The output is obtained by compressing the input
|
|
1108
|
-
* digest to a fixed number of bytes, then mapping those bytes to one of 256
|
|
1109
|
-
* words. A default wordlist is provided, but you can override this if you
|
|
1110
|
-
* prefer.
|
|
1111
|
-
* As long as you use the same wordlist, the output will be consistent (i.e.
|
|
1112
|
-
* the same digest will always render the same representation).
|
|
1113
|
-
*
|
|
1114
|
-
* @param wordlist A list of exactly 256 words to choose from
|
|
1115
|
-
*/
|
|
1116
|
-
constructor(wordlist = DEFAULT_WORDLIST) {
|
|
1117
|
-
_define_property6(this, "wordlist", void 0);
|
|
1118
|
-
this.wordlist = wordlist;
|
|
1119
|
-
if (wordlist.length !== 256) {
|
|
1120
|
-
throw new Error("Wordlist must have exactly 256 items");
|
|
1121
|
-
}
|
|
1122
|
-
this.wordlist = wordlist;
|
|
1123
|
-
}
|
|
1124
988
|
};
|
|
1125
989
|
var hasher = new HumanHasher();
|
|
1126
990
|
var humanize = (value) => {
|
|
@@ -1143,10 +1007,8 @@ var defaultMap = (map, key, def) => {
|
|
|
1143
1007
|
};
|
|
1144
1008
|
|
|
1145
1009
|
// src/instance-id.ts
|
|
1146
|
-
var _globalThis;
|
|
1147
|
-
var _symbol;
|
|
1148
1010
|
var symbol = Symbol.for("dxos.instance-contexts");
|
|
1149
|
-
var instanceContexts =
|
|
1011
|
+
var instanceContexts = globalThis[symbol] ??= /* @__PURE__ */ new WeakMap();
|
|
1150
1012
|
var getPrototypeSpecificInstanceId = (instance) => {
|
|
1151
1013
|
const prototype = Object.getPrototypeOf(instance);
|
|
1152
1014
|
const instanceCtx = defaultMap(instanceContexts, prototype, () => ({
|
|
@@ -1318,19 +1180,6 @@ var jsonKeyReplacer = (options = {}) => (key, value) => {
|
|
|
1318
1180
|
};
|
|
1319
1181
|
|
|
1320
1182
|
// src/map-values.ts
|
|
1321
|
-
function _define_property7(obj, key, value) {
|
|
1322
|
-
if (key in obj) {
|
|
1323
|
-
Object.defineProperty(obj, key, {
|
|
1324
|
-
value,
|
|
1325
|
-
enumerable: true,
|
|
1326
|
-
configurable: true,
|
|
1327
|
-
writable: true
|
|
1328
|
-
});
|
|
1329
|
-
} else {
|
|
1330
|
-
obj[key] = value;
|
|
1331
|
-
}
|
|
1332
|
-
return obj;
|
|
1333
|
-
}
|
|
1334
1183
|
var mapValues = (obj, fn) => {
|
|
1335
1184
|
const result = {};
|
|
1336
1185
|
Object.keys(obj).forEach((key) => {
|
|
@@ -1342,6 +1191,11 @@ var deepMapValues = (value, fn) => {
|
|
|
1342
1191
|
return new DeepMapper(fn).map(value);
|
|
1343
1192
|
};
|
|
1344
1193
|
var DeepMapper = class {
|
|
1194
|
+
_fn;
|
|
1195
|
+
_cyclic = /* @__PURE__ */ new Map();
|
|
1196
|
+
constructor(_fn) {
|
|
1197
|
+
this._fn = _fn;
|
|
1198
|
+
}
|
|
1345
1199
|
map(value) {
|
|
1346
1200
|
return this._map(value, void 0);
|
|
1347
1201
|
}
|
|
@@ -1351,40 +1205,38 @@ var DeepMapper = class {
|
|
|
1351
1205
|
}
|
|
1352
1206
|
return this._fn(value, this._recurse, key);
|
|
1353
1207
|
}
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1208
|
+
_recurse = (value) => {
|
|
1209
|
+
if (this._cyclic.has(value)) {
|
|
1210
|
+
return this._cyclic.get(value);
|
|
1211
|
+
}
|
|
1212
|
+
if (Array.isArray(value)) {
|
|
1213
|
+
const res = new Array(value.length);
|
|
1214
|
+
this._cyclic.set(value, res);
|
|
1215
|
+
for (let i = 0; i < value.length; i++) {
|
|
1216
|
+
res[i] = this._map(value[i], i);
|
|
1363
1217
|
}
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
return res;
|
|
1371
|
-
} else if (value !== null && typeof value === "object") {
|
|
1372
|
-
const res = {};
|
|
1373
|
-
this._cyclic.set(value, res);
|
|
1374
|
-
for (const key in value) {
|
|
1375
|
-
res[key] = this._map(value[key], key);
|
|
1376
|
-
}
|
|
1377
|
-
return res;
|
|
1378
|
-
} else {
|
|
1379
|
-
return value;
|
|
1218
|
+
return res;
|
|
1219
|
+
} else if (value !== null && typeof value === "object") {
|
|
1220
|
+
const res = {};
|
|
1221
|
+
this._cyclic.set(value, res);
|
|
1222
|
+
for (const key in value) {
|
|
1223
|
+
res[key] = this._map(value[key], key);
|
|
1380
1224
|
}
|
|
1381
|
-
|
|
1382
|
-
|
|
1225
|
+
return res;
|
|
1226
|
+
} else {
|
|
1227
|
+
return value;
|
|
1228
|
+
}
|
|
1229
|
+
};
|
|
1383
1230
|
};
|
|
1384
1231
|
var deepMapValuesAsync = (value, fn) => {
|
|
1385
1232
|
return new DeepMapperAsync(fn).map(value);
|
|
1386
1233
|
};
|
|
1387
1234
|
var DeepMapperAsync = class {
|
|
1235
|
+
_fn;
|
|
1236
|
+
_cyclic = /* @__PURE__ */ new Map();
|
|
1237
|
+
constructor(_fn) {
|
|
1238
|
+
this._fn = _fn;
|
|
1239
|
+
}
|
|
1388
1240
|
map(value) {
|
|
1389
1241
|
return this._map(value, void 0);
|
|
1390
1242
|
}
|
|
@@ -1394,35 +1246,28 @@ var DeepMapperAsync = class {
|
|
|
1394
1246
|
}
|
|
1395
1247
|
return this._fn(value, this._recurse, key);
|
|
1396
1248
|
}
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1249
|
+
_recurse = async (value) => {
|
|
1250
|
+
if (this._cyclic.has(value)) {
|
|
1251
|
+
return this._cyclic.get(value);
|
|
1252
|
+
}
|
|
1253
|
+
if (Array.isArray(value)) {
|
|
1254
|
+
const res = new Array(value.length);
|
|
1255
|
+
this._cyclic.set(value, res);
|
|
1256
|
+
for (let i = 0; i < value.length; i++) {
|
|
1257
|
+
res[i] = await this._map(value[i], i);
|
|
1406
1258
|
}
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
return res;
|
|
1414
|
-
} else if (value !== null && typeof value === "object") {
|
|
1415
|
-
const res = {};
|
|
1416
|
-
this._cyclic.set(value, res);
|
|
1417
|
-
for (const key in value) {
|
|
1418
|
-
res[key] = await this._map(value[key], key);
|
|
1419
|
-
}
|
|
1420
|
-
return res;
|
|
1421
|
-
} else {
|
|
1422
|
-
return value;
|
|
1259
|
+
return res;
|
|
1260
|
+
} else if (value !== null && typeof value === "object") {
|
|
1261
|
+
const res = {};
|
|
1262
|
+
this._cyclic.set(value, res);
|
|
1263
|
+
for (const key in value) {
|
|
1264
|
+
res[key] = await this._map(value[key], key);
|
|
1423
1265
|
}
|
|
1424
|
-
|
|
1425
|
-
|
|
1266
|
+
return res;
|
|
1267
|
+
} else {
|
|
1268
|
+
return value;
|
|
1269
|
+
}
|
|
1270
|
+
};
|
|
1426
1271
|
};
|
|
1427
1272
|
var visitValues = (object, visitor) => {
|
|
1428
1273
|
if (Array.isArray(object)) {
|
|
@@ -1765,23 +1610,95 @@ var safeParseJson = (data, defaultValue) => {
|
|
|
1765
1610
|
return defaultValue;
|
|
1766
1611
|
};
|
|
1767
1612
|
|
|
1768
|
-
// src/
|
|
1769
|
-
|
|
1770
|
-
function
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1613
|
+
// src/safe-stringify.ts
|
|
1614
|
+
var SKIP = Object.freeze({});
|
|
1615
|
+
function safeStringify(obj, filter = defaultFilter, indent = 2) {
|
|
1616
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
1617
|
+
function replacer(key, value) {
|
|
1618
|
+
if (typeof value === "object" && value !== null) {
|
|
1619
|
+
if (seen.has(value)) {
|
|
1620
|
+
return "[Circular]";
|
|
1621
|
+
}
|
|
1622
|
+
seen.add(value);
|
|
1623
|
+
}
|
|
1624
|
+
if (filter) {
|
|
1625
|
+
const v2 = filter?.(key, value);
|
|
1626
|
+
if (v2 !== void 0) {
|
|
1627
|
+
return v2 === SKIP ? void 0 : v2;
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
return value;
|
|
1780
1631
|
}
|
|
1781
|
-
|
|
1632
|
+
let result = "";
|
|
1633
|
+
try {
|
|
1634
|
+
result = JSON.stringify(obj, replacer, indent);
|
|
1635
|
+
} catch (error) {
|
|
1636
|
+
result = `Error: ${error.message}`;
|
|
1637
|
+
}
|
|
1638
|
+
return result;
|
|
1782
1639
|
}
|
|
1640
|
+
var createReplacer = ({ omit: omit2, parse, maxDepth, maxArrayLen, maxStringLen } = {}) => {
|
|
1641
|
+
let currentDepth = 0;
|
|
1642
|
+
const depthMap = /* @__PURE__ */ new WeakMap();
|
|
1643
|
+
return function(key, value) {
|
|
1644
|
+
if (key === "") {
|
|
1645
|
+
currentDepth = 0;
|
|
1646
|
+
} else if (this && typeof this === "object") {
|
|
1647
|
+
const parentDepth = depthMap.get(this) ?? 0;
|
|
1648
|
+
currentDepth = parentDepth + 1;
|
|
1649
|
+
}
|
|
1650
|
+
if (typeof value === "function") {
|
|
1651
|
+
return void 0;
|
|
1652
|
+
}
|
|
1653
|
+
if (value && typeof value === "object") {
|
|
1654
|
+
depthMap.set(value, currentDepth);
|
|
1655
|
+
if (maxDepth != null && currentDepth >= maxDepth) {
|
|
1656
|
+
return Array.isArray(value) ? `[{ length: ${value.length} }]` : `{ keys: ${Object.keys(value).length} }`;
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
if (omit2?.includes(key)) {
|
|
1660
|
+
return void 0;
|
|
1661
|
+
}
|
|
1662
|
+
if (parse?.includes(key) && typeof value === "string") {
|
|
1663
|
+
try {
|
|
1664
|
+
return JSON.parse(value);
|
|
1665
|
+
} catch {
|
|
1666
|
+
return value;
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
if (maxArrayLen != null && Array.isArray(value) && value.length > maxArrayLen) {
|
|
1670
|
+
return `[length: ${value.length}]`;
|
|
1671
|
+
}
|
|
1672
|
+
if (maxStringLen != null && typeof value === "string" && value.length > maxStringLen) {
|
|
1673
|
+
return value.slice(0, maxStringLen) + "...";
|
|
1674
|
+
}
|
|
1675
|
+
return value;
|
|
1676
|
+
};
|
|
1677
|
+
};
|
|
1678
|
+
var defaultFilter = createReplacer();
|
|
1679
|
+
|
|
1680
|
+
// src/sliding-window-summary.ts
|
|
1681
|
+
import { invariant as invariant5 } from "@dxos/invariant";
|
|
1783
1682
|
var __dxlog_file5 = "/__w/dxos/dxos/packages/common/util/src/sliding-window-summary.ts";
|
|
1784
1683
|
var SlidingWindowSummary = class {
|
|
1684
|
+
_buffer;
|
|
1685
|
+
_sum = 0;
|
|
1686
|
+
_precision;
|
|
1687
|
+
constructor(options) {
|
|
1688
|
+
this._buffer = new CircularBuffer(options.dataPoints);
|
|
1689
|
+
if (options.precision != null) {
|
|
1690
|
+
invariant5(options.precision >= 0, void 0, {
|
|
1691
|
+
F: __dxlog_file5,
|
|
1692
|
+
L: 26,
|
|
1693
|
+
S: this,
|
|
1694
|
+
A: [
|
|
1695
|
+
"options.precision >= 0",
|
|
1696
|
+
""
|
|
1697
|
+
]
|
|
1698
|
+
});
|
|
1699
|
+
this._precision = Math.pow(10, options.precision);
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1785
1702
|
record(value) {
|
|
1786
1703
|
const evicted = this._buffer.push(value);
|
|
1787
1704
|
this._sum += value - (evicted ?? 0);
|
|
@@ -1816,24 +1733,6 @@ var SlidingWindowSummary = class {
|
|
|
1816
1733
|
}
|
|
1817
1734
|
return Math.round(value * this._precision) / this._precision;
|
|
1818
1735
|
}
|
|
1819
|
-
constructor(options) {
|
|
1820
|
-
_define_property8(this, "_buffer", void 0);
|
|
1821
|
-
_define_property8(this, "_sum", 0);
|
|
1822
|
-
_define_property8(this, "_precision", void 0);
|
|
1823
|
-
this._buffer = new CircularBuffer(options.dataPoints);
|
|
1824
|
-
if (options.precision != null) {
|
|
1825
|
-
invariant5(options.precision >= 0, void 0, {
|
|
1826
|
-
F: __dxlog_file5,
|
|
1827
|
-
L: 26,
|
|
1828
|
-
S: this,
|
|
1829
|
-
A: [
|
|
1830
|
-
"options.precision >= 0",
|
|
1831
|
-
""
|
|
1832
|
-
]
|
|
1833
|
-
});
|
|
1834
|
-
this._precision = Math.pow(10, options.precision);
|
|
1835
|
-
}
|
|
1836
|
-
}
|
|
1837
1736
|
};
|
|
1838
1737
|
|
|
1839
1738
|
// src/sort.ts
|
|
@@ -2080,20 +1979,9 @@ var toFallback = (hash) => {
|
|
|
2080
1979
|
};
|
|
2081
1980
|
|
|
2082
1981
|
// src/tracer.ts
|
|
2083
|
-
function _define_property9(obj, key, value) {
|
|
2084
|
-
if (key in obj) {
|
|
2085
|
-
Object.defineProperty(obj, key, {
|
|
2086
|
-
value,
|
|
2087
|
-
enumerable: true,
|
|
2088
|
-
configurable: true,
|
|
2089
|
-
writable: true
|
|
2090
|
-
});
|
|
2091
|
-
} else {
|
|
2092
|
-
obj[key] = value;
|
|
2093
|
-
}
|
|
2094
|
-
return obj;
|
|
2095
|
-
}
|
|
2096
1982
|
var Tracer = class {
|
|
1983
|
+
_events = /* @__PURE__ */ new Map();
|
|
1984
|
+
_recording = false;
|
|
2097
1985
|
// TODO(burdon): Start/stop methods for recording data? By id?
|
|
2098
1986
|
// Alternatively, enable subscriptions to track/compute series.
|
|
2099
1987
|
// TODO(burdon): Hierarchical traces?
|
|
@@ -2150,10 +2038,6 @@ var Tracer = class {
|
|
|
2150
2038
|
defaultMap(this._events, event.id, []).push(event);
|
|
2151
2039
|
}
|
|
2152
2040
|
}
|
|
2153
|
-
constructor() {
|
|
2154
|
-
_define_property9(this, "_events", /* @__PURE__ */ new Map());
|
|
2155
|
-
_define_property9(this, "_recording", false);
|
|
2156
|
-
}
|
|
2157
2041
|
};
|
|
2158
2042
|
var tracer = new Tracer();
|
|
2159
2043
|
|
|
@@ -2230,67 +2114,100 @@ var arrayMove = (array, from, to) => {
|
|
|
2230
2114
|
};
|
|
2231
2115
|
|
|
2232
2116
|
// src/unit.ts
|
|
2233
|
-
var
|
|
2234
|
-
return (n, precision =
|
|
2117
|
+
var createFormat = (unit) => {
|
|
2118
|
+
return (n, precision = unit.precision ?? 0) => {
|
|
2235
2119
|
const value = n / unit.quotient;
|
|
2236
|
-
return
|
|
2120
|
+
return {
|
|
2121
|
+
unit,
|
|
2122
|
+
value,
|
|
2123
|
+
formattedValue: value.toFixed(precision),
|
|
2124
|
+
toString: () => `${value.toFixed(precision)}${unit.symbol}`
|
|
2125
|
+
};
|
|
2237
2126
|
};
|
|
2238
2127
|
};
|
|
2128
|
+
var MS_SECONDS = 1e3;
|
|
2129
|
+
var MS_MINUTES = 60 * MS_SECONDS;
|
|
2130
|
+
var MS_HOURS = 60 * MS_MINUTES;
|
|
2239
2131
|
var Unit = {
|
|
2240
|
-
//
|
|
2241
|
-
|
|
2132
|
+
// General.
|
|
2133
|
+
Percent: createFormat({
|
|
2134
|
+
symbol: "%",
|
|
2135
|
+
quotient: 1 / 100,
|
|
2136
|
+
precision: 2
|
|
2137
|
+
}),
|
|
2138
|
+
Thousand: createFormat({
|
|
2139
|
+
symbol: "k",
|
|
2140
|
+
quotient: 1e3,
|
|
2141
|
+
precision: 2
|
|
2142
|
+
}),
|
|
2143
|
+
// Bytes (note KB vs KiB).
|
|
2144
|
+
Gigabyte: createFormat({
|
|
2145
|
+
symbol: "GB",
|
|
2146
|
+
quotient: 1e3 * 1e3 * 1e3,
|
|
2147
|
+
precision: 2
|
|
2148
|
+
}),
|
|
2149
|
+
Megabyte: createFormat({
|
|
2150
|
+
symbol: "MB",
|
|
2151
|
+
quotient: 1e3 * 1e3,
|
|
2152
|
+
precision: 2
|
|
2153
|
+
}),
|
|
2154
|
+
Kilobyte: createFormat({
|
|
2155
|
+
symbol: "KB",
|
|
2156
|
+
quotient: 1e3,
|
|
2157
|
+
precision: 2
|
|
2158
|
+
}),
|
|
2159
|
+
// Time.
|
|
2160
|
+
Hour: createFormat({
|
|
2242
2161
|
symbol: "h",
|
|
2243
|
-
quotient:
|
|
2162
|
+
quotient: MS_HOURS
|
|
2244
2163
|
}),
|
|
2245
|
-
Minute:
|
|
2164
|
+
Minute: createFormat({
|
|
2246
2165
|
symbol: "m",
|
|
2247
|
-
quotient:
|
|
2166
|
+
quotient: MS_MINUTES
|
|
2248
2167
|
}),
|
|
2249
|
-
Second:
|
|
2168
|
+
Second: createFormat({
|
|
2250
2169
|
symbol: "s",
|
|
2251
|
-
quotient:
|
|
2170
|
+
quotient: MS_SECONDS,
|
|
2171
|
+
precision: 1
|
|
2252
2172
|
}),
|
|
2253
|
-
Millisecond:
|
|
2173
|
+
Millisecond: createFormat({
|
|
2254
2174
|
symbol: "ms",
|
|
2255
2175
|
quotient: 1
|
|
2256
2176
|
}),
|
|
2257
2177
|
Duration: (n) => {
|
|
2258
|
-
const hours = Math.floor(n /
|
|
2259
|
-
const minutes = Math.floor(n %
|
|
2178
|
+
const hours = Math.floor(n / MS_HOURS);
|
|
2179
|
+
const minutes = Math.floor(n % MS_HOURS / MS_MINUTES);
|
|
2260
2180
|
if (hours) {
|
|
2261
|
-
|
|
2181
|
+
const formattedValue = minutes ? `${hours}h ${minutes}m` : `${hours}h`;
|
|
2182
|
+
return {
|
|
2183
|
+
unit: {
|
|
2184
|
+
symbol: "h",
|
|
2185
|
+
quotient: MS_HOURS
|
|
2186
|
+
},
|
|
2187
|
+
value: hours,
|
|
2188
|
+
formattedValue,
|
|
2189
|
+
toString: () => formattedValue
|
|
2190
|
+
};
|
|
2262
2191
|
}
|
|
2263
|
-
const seconds = Math.floor(n % (60 * 1e3) / 1e3);
|
|
2264
2192
|
if (minutes) {
|
|
2265
|
-
|
|
2193
|
+
const seconds2 = (n - MS_MINUTES * minutes) / MS_SECONDS;
|
|
2194
|
+
const formattedValue = seconds2 ? `${minutes}m ${seconds2}s` : `${minutes}m`;
|
|
2195
|
+
return {
|
|
2196
|
+
unit: {
|
|
2197
|
+
symbol: "m",
|
|
2198
|
+
quotient: MS_MINUTES
|
|
2199
|
+
},
|
|
2200
|
+
value: minutes,
|
|
2201
|
+
formattedValue,
|
|
2202
|
+
toString: () => formattedValue
|
|
2203
|
+
};
|
|
2266
2204
|
}
|
|
2205
|
+
const seconds = n >= MS_SECONDS;
|
|
2267
2206
|
if (seconds) {
|
|
2268
|
-
return
|
|
2207
|
+
return Unit.Second(n);
|
|
2269
2208
|
}
|
|
2270
|
-
return
|
|
2271
|
-
}
|
|
2272
|
-
// bytes (note KB via KiB).
|
|
2273
|
-
Gigabyte: Formatter({
|
|
2274
|
-
symbol: "GB",
|
|
2275
|
-
quotient: 1e3 * 1e3 * 1e3
|
|
2276
|
-
}),
|
|
2277
|
-
Megabyte: Formatter({
|
|
2278
|
-
symbol: "MB",
|
|
2279
|
-
quotient: 1e3 * 1e3
|
|
2280
|
-
}),
|
|
2281
|
-
Kilobyte: Formatter({
|
|
2282
|
-
symbol: "KB",
|
|
2283
|
-
quotient: 1e3
|
|
2284
|
-
}),
|
|
2285
|
-
// general.
|
|
2286
|
-
Thousand: Formatter({
|
|
2287
|
-
symbol: "k",
|
|
2288
|
-
quotient: 1e3
|
|
2289
|
-
}),
|
|
2290
|
-
Percent: Formatter({
|
|
2291
|
-
symbol: "%",
|
|
2292
|
-
quotient: 1 / 100
|
|
2293
|
-
})
|
|
2209
|
+
return Unit.Millisecond(n);
|
|
2210
|
+
}
|
|
2294
2211
|
};
|
|
2295
2212
|
|
|
2296
2213
|
// src/url.ts
|
|
@@ -2303,20 +2220,18 @@ var createUrl = (url, search) => {
|
|
|
2303
2220
|
};
|
|
2304
2221
|
|
|
2305
2222
|
// src/weak.ts
|
|
2306
|
-
function _define_property10(obj, key, value) {
|
|
2307
|
-
if (key in obj) {
|
|
2308
|
-
Object.defineProperty(obj, key, {
|
|
2309
|
-
value,
|
|
2310
|
-
enumerable: true,
|
|
2311
|
-
configurable: true,
|
|
2312
|
-
writable: true
|
|
2313
|
-
});
|
|
2314
|
-
} else {
|
|
2315
|
-
obj[key] = value;
|
|
2316
|
-
}
|
|
2317
|
-
return obj;
|
|
2318
|
-
}
|
|
2319
2223
|
var WeakDictionary = class {
|
|
2224
|
+
_internal = /* @__PURE__ */ new Map();
|
|
2225
|
+
_finalization = new FinalizationRegistry((cleanUpCallback) => {
|
|
2226
|
+
cleanUpCallback();
|
|
2227
|
+
});
|
|
2228
|
+
constructor(entries2) {
|
|
2229
|
+
this._internal = new Map(entries2?.map(([key, value]) => [
|
|
2230
|
+
key,
|
|
2231
|
+
new WeakRef(value)
|
|
2232
|
+
]));
|
|
2233
|
+
entries2?.forEach(([key, value]) => this._register(key, value));
|
|
2234
|
+
}
|
|
2320
2235
|
*entries() {
|
|
2321
2236
|
for (const [key, value] of this._internal) {
|
|
2322
2237
|
yield [
|
|
@@ -2397,17 +2312,6 @@ var WeakDictionary = class {
|
|
|
2397
2312
|
_unregister(value) {
|
|
2398
2313
|
this._finalization.unregister(value);
|
|
2399
2314
|
}
|
|
2400
|
-
constructor(entries2) {
|
|
2401
|
-
_define_property10(this, "_internal", /* @__PURE__ */ new Map());
|
|
2402
|
-
_define_property10(this, "_finalization", new FinalizationRegistry((cleanUpCallback) => {
|
|
2403
|
-
cleanUpCallback();
|
|
2404
|
-
}));
|
|
2405
|
-
this._internal = new Map(entries2?.map(([key, value]) => [
|
|
2406
|
-
key,
|
|
2407
|
-
new WeakRef(value)
|
|
2408
|
-
]));
|
|
2409
|
-
entries2?.forEach(([key, value]) => this._register(key, value));
|
|
2410
|
-
}
|
|
2411
2315
|
};
|
|
2412
2316
|
export {
|
|
2413
2317
|
BitField,
|
|
@@ -2418,6 +2322,7 @@ export {
|
|
|
2418
2322
|
ComplexSet,
|
|
2419
2323
|
HumanHasher,
|
|
2420
2324
|
MapEntry,
|
|
2325
|
+
SKIP,
|
|
2421
2326
|
SlidingWindowSummary,
|
|
2422
2327
|
Tracer,
|
|
2423
2328
|
Unit,
|
|
@@ -2442,11 +2347,13 @@ export {
|
|
|
2442
2347
|
createBinder,
|
|
2443
2348
|
createBucketReducer,
|
|
2444
2349
|
createGroupReducer,
|
|
2350
|
+
createReplacer,
|
|
2445
2351
|
createSetDispatch,
|
|
2446
2352
|
createUrl,
|
|
2447
2353
|
decamelize,
|
|
2448
2354
|
deepMapValues,
|
|
2449
2355
|
deepMapValuesAsync,
|
|
2356
|
+
defaultFilter,
|
|
2450
2357
|
defaultMap,
|
|
2451
2358
|
defer,
|
|
2452
2359
|
deferAsync,
|
|
@@ -2517,6 +2424,7 @@ export {
|
|
|
2517
2424
|
safeParseFloat,
|
|
2518
2425
|
safeParseInt,
|
|
2519
2426
|
safeParseJson,
|
|
2427
|
+
safeStringify,
|
|
2520
2428
|
set,
|
|
2521
2429
|
setDeep,
|
|
2522
2430
|
sortKeys,
|