@dxos/util 0.8.4-main.5ea62a8 → 0.8.4-main.60689f5b1c
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/LICENSE +102 -5
- package/dist/lib/browser/index.mjs +644 -552
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +644 -552
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/array-to-hex.d.ts.map +1 -1
- package/dist/types/src/array.d.ts +3 -2
- package/dist/types/src/array.d.ts.map +1 -1
- package/dist/types/src/binder.d.ts.map +1 -1
- package/dist/types/src/bitfield.d.ts.map +1 -1
- package/dist/types/src/browser-storage.d.ts +9 -0
- package/dist/types/src/browser-storage.d.ts.map +1 -0
- package/dist/types/src/callback-collection.d.ts.map +1 -1
- package/dist/types/src/callback.d.ts.map +1 -1
- package/dist/types/src/case.d.ts.map +1 -1
- package/dist/types/src/chunk-array.d.ts.map +1 -1
- package/dist/types/src/circular-buffer.d.ts +1 -0
- package/dist/types/src/circular-buffer.d.ts.map +1 -1
- package/dist/types/src/clear-undefined.d.ts.map +1 -1
- package/dist/types/src/complex.d.ts +15 -0
- package/dist/types/src/complex.d.ts.map +1 -1
- package/dist/types/src/composite-key.d.ts +10 -0
- package/dist/types/src/composite-key.d.ts.map +1 -0
- package/dist/types/src/composite-key.test.d.ts +2 -0
- package/dist/types/src/composite-key.test.d.ts.map +1 -0
- package/dist/types/src/deep.d.ts +0 -3
- package/dist/types/src/deep.d.ts.map +1 -1
- package/dist/types/src/defer-function.d.ts.map +1 -1
- package/dist/types/src/defer.d.ts +1 -1
- package/dist/types/src/defer.d.ts.map +1 -1
- package/dist/types/src/di-container.d.ts.map +1 -1
- package/dist/types/src/di-key.d.ts +7 -5
- package/dist/types/src/di-key.d.ts.map +1 -1
- package/dist/types/src/entry.d.ts.map +1 -1
- package/dist/types/src/error-format.d.ts +5 -0
- package/dist/types/src/error-format.d.ts.map +1 -0
- package/dist/types/src/filename.d.ts +9 -0
- package/dist/types/src/filename.d.ts.map +1 -0
- package/dist/types/src/for-each-async.d.ts.map +1 -1
- package/dist/types/src/human-hash.d.ts.map +1 -1
- package/dist/types/src/id.d.ts +30 -0
- package/dist/types/src/id.d.ts.map +1 -0
- package/dist/types/src/id.test.d.ts +2 -0
- package/dist/types/src/id.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +7 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/instance-id.d.ts.map +1 -1
- package/dist/types/src/interval.d.ts.map +1 -1
- package/dist/types/src/join-tables.d.ts.map +1 -1
- package/dist/types/src/json.d.ts.map +1 -1
- package/dist/types/src/map-values.d.ts.map +1 -1
- package/dist/types/src/map.d.ts.map +1 -1
- package/dist/types/src/object.d.ts.map +1 -1
- package/dist/types/src/order-keys.d.ts.map +1 -1
- package/dist/types/src/order.d.ts.map +1 -1
- package/dist/types/src/pick.d.ts.map +1 -1
- package/dist/types/src/platform.d.ts +5 -2
- package/dist/types/src/platform.d.ts.map +1 -1
- package/dist/types/src/position.d.ts +5 -5
- package/dist/types/src/position.d.ts.map +1 -1
- package/dist/types/src/random.d.ts.map +1 -1
- package/dist/types/src/range.d.ts.map +1 -1
- package/dist/types/src/reducers.d.ts.map +1 -1
- package/dist/types/src/remove-undefined-keys.d.ts.map +1 -1
- package/dist/types/src/retry.d.ts +32 -0
- package/dist/types/src/retry.d.ts.map +1 -0
- package/dist/types/src/safe-await.d.ts.map +1 -1
- package/dist/types/src/safe-instanceof.d.ts.map +1 -1
- package/dist/types/src/safe-parse.d.ts +7 -4
- package/dist/types/src/safe-parse.d.ts.map +1 -1
- package/dist/types/src/safe-stringify.d.ts +22 -0
- package/dist/types/src/safe-stringify.d.ts.map +1 -0
- package/dist/types/src/safe-stringify.test.d.ts +2 -0
- package/dist/types/src/safe-stringify.test.d.ts.map +1 -0
- package/dist/types/src/sliding-window-summary.d.ts.map +1 -1
- package/dist/types/src/sort.d.ts.map +1 -1
- package/dist/types/src/string.d.ts +4 -0
- package/dist/types/src/string.d.ts.map +1 -1
- package/dist/types/src/sum.d.ts.map +1 -1
- package/dist/types/src/throw-unhandled-error.d.ts.map +1 -1
- package/dist/types/src/to-fallback.d.ts +18 -4
- package/dist/types/src/to-fallback.d.ts.map +1 -1
- package/dist/types/src/tracer.d.ts.map +1 -1
- package/dist/types/src/tree.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +24 -6
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/uint8array.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/src/url.d.ts.map +1 -1
- package/dist/types/src/weak.d.ts +15 -0
- package/dist/types/src/weak.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -15
- package/src/array.ts +9 -2
- package/src/binder.ts +2 -2
- package/src/browser-storage.ts +60 -0
- package/src/circular-buffer.test.ts +26 -0
- package/src/circular-buffer.ts +5 -0
- package/src/complex.ts +32 -0
- package/src/composite-key.test.ts +31 -0
- package/src/composite-key.ts +16 -0
- package/src/deep.ts +2 -6
- package/src/defer.ts +1 -1
- package/src/di-key.ts +10 -8
- package/src/error-format.ts +24 -0
- package/src/filename.ts +16 -0
- package/src/id.test.ts +109 -0
- package/src/id.ts +48 -0
- package/src/index.ts +7 -1
- package/src/platform.ts +35 -3
- package/src/position.test.ts +38 -44
- package/src/position.ts +7 -11
- package/src/retry.ts +74 -0
- package/src/safe-parse.ts +27 -16
- package/src/safe-stringify.test.ts +96 -0
- package/src/safe-stringify.ts +153 -0
- package/src/string.ts +13 -2
- package/src/to-fallback.ts +44 -160
- package/src/types.test.ts +11 -1
- package/src/types.ts +40 -12
- package/src/unit.test.ts +1 -1
- package/src/unit.ts +63 -28
- package/src/weak.ts +52 -14
- package/dist/types/src/explicit-resource-management-polyfill.d.ts +0 -1
- package/dist/types/src/explicit-resource-management-polyfill.d.ts.map +0 -1
- package/dist/types/src/first-two-chars.d.ts +0 -9
- package/dist/types/src/first-two-chars.d.ts.map +0 -1
- package/src/explicit-resource-management-polyfill.ts +0 -13
- package/src/first-two-chars.ts +0 -44
|
@@ -97,21 +97,28 @@ var intersectBy = (arrays, selector) => {
|
|
|
97
97
|
return lookups.every((lookup) => lookup.has(key));
|
|
98
98
|
});
|
|
99
99
|
};
|
|
100
|
+
var coerceArray = (arr) => {
|
|
101
|
+
if (arr === void 0) {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
return Array.isArray(arr) ? arr : [
|
|
105
|
+
arr
|
|
106
|
+
];
|
|
107
|
+
};
|
|
100
108
|
|
|
101
109
|
// src/assume.ts
|
|
102
110
|
function assumeType(value) {
|
|
103
111
|
}
|
|
104
112
|
|
|
105
113
|
// src/binder.ts
|
|
106
|
-
import
|
|
114
|
+
import { promisify } from "@dxos/node-std/util";
|
|
107
115
|
var createBinder = (obj) => ({
|
|
108
116
|
fn: (fn) => fn.bind(obj),
|
|
109
|
-
async: (fn) =>
|
|
117
|
+
async: (fn) => promisify(fn.bind(obj))
|
|
110
118
|
});
|
|
111
119
|
|
|
112
120
|
// src/bitfield.ts
|
|
113
121
|
import { invariant } from "@dxos/invariant";
|
|
114
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/common/util/src/bitfield.ts";
|
|
115
122
|
var BitField = class _BitField {
|
|
116
123
|
static get(data, idx) {
|
|
117
124
|
const bit = data[idx >> 3] >> 7 - idx % 8 & 1;
|
|
@@ -143,15 +150,7 @@ var BitField = class _BitField {
|
|
|
143
150
|
return result;
|
|
144
151
|
}
|
|
145
152
|
static and(first, second) {
|
|
146
|
-
invariant(first.length === second.length, "Bitfields must be of the same length"
|
|
147
|
-
F: __dxlog_file,
|
|
148
|
-
L: 52,
|
|
149
|
-
S: this,
|
|
150
|
-
A: [
|
|
151
|
-
"first.length === second.length",
|
|
152
|
-
"'Bitfields must be of the same length'"
|
|
153
|
-
]
|
|
154
|
-
});
|
|
153
|
+
invariant(first.length === second.length, "Bitfields must be of the same length");
|
|
155
154
|
const result = new Uint8Array(first.length);
|
|
156
155
|
for (let i = 0; i < first.length; i++) {
|
|
157
156
|
result[i] = first[i] & second[i];
|
|
@@ -179,126 +178,91 @@ var BitField = class _BitField {
|
|
|
179
178
|
}
|
|
180
179
|
};
|
|
181
180
|
|
|
182
|
-
// src/
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
181
|
+
// src/browser-storage.ts
|
|
182
|
+
var clearIndexedDB = async () => {
|
|
183
|
+
const dbs = await indexedDB.databases();
|
|
184
|
+
const results = await Promise.allSettled(dbs.filter((db) => db.name != null).map((db) => new Promise((resolve, reject) => {
|
|
185
|
+
const request = indexedDB.deleteDatabase(db.name);
|
|
186
|
+
request.onsuccess = () => resolve();
|
|
187
|
+
request.onerror = () => reject(request.error);
|
|
188
|
+
request.onblocked = () => reject(new Error(`IndexedDB deletion blocked: ${db.name}`));
|
|
189
|
+
})));
|
|
190
|
+
const failures = results.filter((r) => r.status === "rejected");
|
|
191
|
+
if (failures.length > 0) {
|
|
192
|
+
throw new AggregateError(failures.map((r) => r.reason), "Failed to delete some IndexedDB databases");
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
var clearOPFS = async () => {
|
|
196
|
+
const root = await navigator.storage.getDirectory();
|
|
197
|
+
const errors = [];
|
|
198
|
+
for await (const [name] of root.entries()) {
|
|
199
|
+
try {
|
|
200
|
+
await root.removeEntry(name, {
|
|
201
|
+
recursive: true
|
|
202
|
+
});
|
|
203
|
+
} catch (err) {
|
|
204
|
+
errors.push(err);
|
|
205
|
+
}
|
|
186
206
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
if (descriptor.get) {
|
|
190
|
-
return descriptor.get.call(receiver);
|
|
207
|
+
if (errors.length > 0) {
|
|
208
|
+
throw new AggregateError(errors, "Failed to remove some OPFS entries");
|
|
191
209
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
} else {
|
|
198
|
-
if (!descriptor.writable) {
|
|
199
|
-
throw new TypeError("attempted to set read only private field");
|
|
200
|
-
}
|
|
201
|
-
descriptor.value = value;
|
|
210
|
+
};
|
|
211
|
+
var clearServiceWorkers = async () => {
|
|
212
|
+
const regs = await navigator.serviceWorker.getRegistrations();
|
|
213
|
+
for (const reg of regs) {
|
|
214
|
+
await reg.unregister();
|
|
202
215
|
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
216
|
+
};
|
|
217
|
+
var clearCaches = async () => {
|
|
218
|
+
const keys2 = await caches.keys();
|
|
219
|
+
for (const key of keys2) {
|
|
220
|
+
await caches.delete(key);
|
|
207
221
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
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();
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
// src/callback-collection.ts
|
|
224
225
|
var CallbackCollection = class {
|
|
226
|
+
#callbacks = [];
|
|
225
227
|
append(callback) {
|
|
226
|
-
|
|
228
|
+
this.#callbacks.push(callback);
|
|
227
229
|
}
|
|
228
230
|
prepend(callback) {
|
|
229
|
-
|
|
231
|
+
this.#callbacks.unshift(callback);
|
|
230
232
|
}
|
|
231
233
|
remove(callback) {
|
|
232
|
-
|
|
234
|
+
this.#callbacks = this.#callbacks.filter((c) => c !== callback);
|
|
233
235
|
}
|
|
234
236
|
callParallel(...args) {
|
|
235
|
-
return Promise.all(
|
|
237
|
+
return Promise.all(this.#callbacks.map((callback) => callback(...args)));
|
|
236
238
|
}
|
|
237
239
|
async callSerial(...args) {
|
|
238
240
|
const results = [];
|
|
239
|
-
for (const callback of
|
|
241
|
+
for (const callback of this.#callbacks) {
|
|
240
242
|
results.push(await callback(...args));
|
|
241
243
|
}
|
|
242
244
|
return results;
|
|
243
245
|
}
|
|
244
|
-
constructor() {
|
|
245
|
-
_class_private_field_init(this, _callbacks, {
|
|
246
|
-
writable: true,
|
|
247
|
-
value: []
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
246
|
};
|
|
251
247
|
|
|
252
248
|
// src/callback.ts
|
|
253
249
|
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
|
-
var __dxlog_file2 = "/__w/dxos/dxos/packages/common/util/src/callback.ts";
|
|
268
250
|
var Callback = class {
|
|
251
|
+
_callback;
|
|
269
252
|
call(...args) {
|
|
270
|
-
invariant2(this._callback, "Callback not set"
|
|
271
|
-
F: __dxlog_file2,
|
|
272
|
-
L: 20,
|
|
273
|
-
S: this,
|
|
274
|
-
A: [
|
|
275
|
-
"this._callback",
|
|
276
|
-
"'Callback not set'"
|
|
277
|
-
]
|
|
278
|
-
});
|
|
253
|
+
invariant2(this._callback, "Callback not set");
|
|
279
254
|
return this._callback(...args);
|
|
280
255
|
}
|
|
281
256
|
callIfSet(...args) {
|
|
282
257
|
return this._callback?.(...args);
|
|
283
258
|
}
|
|
284
259
|
set(callback) {
|
|
285
|
-
invariant2(!this._callback, "Callback already set"
|
|
286
|
-
F: __dxlog_file2,
|
|
287
|
-
L: 29,
|
|
288
|
-
S: this,
|
|
289
|
-
A: [
|
|
290
|
-
"!this._callback",
|
|
291
|
-
"'Callback already set'"
|
|
292
|
-
]
|
|
293
|
-
});
|
|
260
|
+
invariant2(!this._callback, "Callback already set");
|
|
294
261
|
this._callback = callback;
|
|
295
262
|
}
|
|
296
263
|
isSet() {
|
|
297
264
|
return !!this._callback;
|
|
298
265
|
}
|
|
299
|
-
constructor() {
|
|
300
|
-
_define_property(this, "_callback", void 0);
|
|
301
|
-
}
|
|
302
266
|
};
|
|
303
267
|
var createSetDispatch = ({ handlers }) => {
|
|
304
268
|
return new Proxy({
|
|
@@ -361,21 +325,14 @@ var chunkArray = (array, size) => {
|
|
|
361
325
|
|
|
362
326
|
// src/circular-buffer.ts
|
|
363
327
|
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
|
-
var __dxlog_file3 = "/__w/dxos/dxos/packages/common/util/src/circular-buffer.ts";
|
|
378
328
|
var CircularBuffer = class {
|
|
329
|
+
_buffer;
|
|
330
|
+
_nextIndex = 0;
|
|
331
|
+
_elementCount = 0;
|
|
332
|
+
constructor(size) {
|
|
333
|
+
invariant3(size >= 1);
|
|
334
|
+
this._buffer = new Array(size);
|
|
335
|
+
}
|
|
379
336
|
push(element) {
|
|
380
337
|
const evicted = this._elementCount === this._buffer.length ? this._buffer[this._nextIndex] : void 0;
|
|
381
338
|
this._buffer[this._nextIndex] = element;
|
|
@@ -386,6 +343,10 @@ var CircularBuffer = class {
|
|
|
386
343
|
get elementCount() {
|
|
387
344
|
return this._elementCount;
|
|
388
345
|
}
|
|
346
|
+
clear() {
|
|
347
|
+
this._nextIndex = 0;
|
|
348
|
+
this._elementCount = 0;
|
|
349
|
+
}
|
|
389
350
|
getLast() {
|
|
390
351
|
if (this._elementCount === 0) {
|
|
391
352
|
return void 0;
|
|
@@ -415,21 +376,6 @@ var CircularBuffer = class {
|
|
|
415
376
|
yield this._buffer[i];
|
|
416
377
|
}
|
|
417
378
|
}
|
|
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
379
|
};
|
|
434
380
|
|
|
435
381
|
// src/clear-undefined.ts
|
|
@@ -448,22 +394,19 @@ var clearUndefined = (obj) => {
|
|
|
448
394
|
// src/complex.ts
|
|
449
395
|
import { inspect } from "@dxos/node-std/util";
|
|
450
396
|
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
397
|
var MAX_SERIALIZATION_LENGTH = 10;
|
|
465
|
-
var _inspect_custom = inspect.custom;
|
|
466
398
|
var ComplexSet = class {
|
|
399
|
+
_projection;
|
|
400
|
+
_values = /* @__PURE__ */ new Map();
|
|
401
|
+
// prettier-ignore
|
|
402
|
+
constructor(_projection, values) {
|
|
403
|
+
this._projection = _projection;
|
|
404
|
+
if (values) {
|
|
405
|
+
for (const value of values) {
|
|
406
|
+
this.add(value);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
467
410
|
toString() {
|
|
468
411
|
return inspectObject(this);
|
|
469
412
|
}
|
|
@@ -472,7 +415,7 @@ var ComplexSet = class {
|
|
|
472
415
|
size: this._values.size
|
|
473
416
|
} : Array.from(this._values.values());
|
|
474
417
|
}
|
|
475
|
-
[
|
|
418
|
+
[inspect.custom]() {
|
|
476
419
|
return inspectObject(this);
|
|
477
420
|
}
|
|
478
421
|
add(value) {
|
|
@@ -538,18 +481,6 @@ var ComplexSet = class {
|
|
|
538
481
|
isDisjointFrom(other) {
|
|
539
482
|
throw new Error("Method not implemented.");
|
|
540
483
|
}
|
|
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
484
|
};
|
|
554
485
|
var makeSet = (projection) => {
|
|
555
486
|
return class BoundComplexSet extends ComplexSet {
|
|
@@ -558,8 +489,19 @@ var makeSet = (projection) => {
|
|
|
558
489
|
}
|
|
559
490
|
};
|
|
560
491
|
};
|
|
561
|
-
var _inspect_custom1 = inspect.custom;
|
|
562
492
|
var ComplexMap = class _ComplexMap {
|
|
493
|
+
_keyProjection;
|
|
494
|
+
_keys = /* @__PURE__ */ new Map();
|
|
495
|
+
_values = /* @__PURE__ */ new Map();
|
|
496
|
+
// prettier-ignore
|
|
497
|
+
constructor(_keyProjection, entries2) {
|
|
498
|
+
this._keyProjection = _keyProjection;
|
|
499
|
+
if (entries2) {
|
|
500
|
+
for (const [key, value] of entries2) {
|
|
501
|
+
this.set(key, value);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
563
505
|
toString() {
|
|
564
506
|
return inspectObject(this);
|
|
565
507
|
}
|
|
@@ -568,7 +510,7 @@ var ComplexMap = class _ComplexMap {
|
|
|
568
510
|
size: this._values.size
|
|
569
511
|
} : Array.from(this._values.values());
|
|
570
512
|
}
|
|
571
|
-
[
|
|
513
|
+
[inspect.custom]() {
|
|
572
514
|
return inspectObject(this);
|
|
573
515
|
}
|
|
574
516
|
clear() {
|
|
@@ -598,6 +540,36 @@ var ComplexMap = class _ComplexMap {
|
|
|
598
540
|
this._values.set(primitive, value);
|
|
599
541
|
return this;
|
|
600
542
|
}
|
|
543
|
+
/**
|
|
544
|
+
* Returns the value for the given key if present, otherwise inserts and returns the default value.
|
|
545
|
+
* @param key - The key to look up or insert.
|
|
546
|
+
* @param defaultValue - The value to insert if the key is not present.
|
|
547
|
+
* @returns The existing or newly inserted value.
|
|
548
|
+
*/
|
|
549
|
+
getOrInsert(key, defaultValue) {
|
|
550
|
+
const primitive = this._keyProjection(key);
|
|
551
|
+
if (this._values.has(primitive)) {
|
|
552
|
+
return this._values.get(primitive);
|
|
553
|
+
}
|
|
554
|
+
this.set(key, defaultValue);
|
|
555
|
+
return defaultValue;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Returns the value for the given key if present, otherwise computes, inserts, and returns a new value.
|
|
559
|
+
* The callback is only invoked when the key is missing.
|
|
560
|
+
* @param key - The key to look up or insert.
|
|
561
|
+
* @param callbackfn - Function to compute the value if the key is not present.
|
|
562
|
+
* @returns The existing or newly computed value.
|
|
563
|
+
*/
|
|
564
|
+
getOrInsertComputed(key, callbackfn) {
|
|
565
|
+
const primitive = this._keyProjection(key);
|
|
566
|
+
if (this._values.has(primitive)) {
|
|
567
|
+
return this._values.get(primitive);
|
|
568
|
+
}
|
|
569
|
+
const value = callbackfn(key);
|
|
570
|
+
this.set(key, value);
|
|
571
|
+
return value;
|
|
572
|
+
}
|
|
601
573
|
get size() {
|
|
602
574
|
return this._keys.size;
|
|
603
575
|
}
|
|
@@ -630,45 +602,22 @@ var ComplexMap = class _ComplexMap {
|
|
|
630
602
|
get [Symbol.toStringTag]() {
|
|
631
603
|
return "ComplexMap";
|
|
632
604
|
}
|
|
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
605
|
};
|
|
648
|
-
var makeMap = (keyProjection) => {
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
super(keyProjection, entries2);
|
|
652
|
-
}
|
|
606
|
+
var makeMap = (keyProjection) => class BoundComplexMap extends ComplexMap {
|
|
607
|
+
constructor(entries2) {
|
|
608
|
+
super(keyProjection, entries2);
|
|
653
609
|
}
|
|
654
|
-
return BoundComplexMap;
|
|
655
610
|
};
|
|
656
611
|
|
|
612
|
+
// src/composite-key.ts
|
|
613
|
+
var SEPARATOR = ":";
|
|
614
|
+
var compositeKey = (...parts) => parts.join(SEPARATOR);
|
|
615
|
+
var splitCompositeKey = (key) => key.split(SEPARATOR);
|
|
616
|
+
|
|
657
617
|
// src/deep.ts
|
|
658
|
-
import get from "lodash.get";
|
|
659
|
-
import set from "lodash.set";
|
|
660
618
|
import { invariant as invariant4 } from "@dxos/invariant";
|
|
661
|
-
var __dxlog_file4 = "/__w/dxos/dxos/packages/common/util/src/deep.ts";
|
|
662
619
|
var setDeep = (obj, path, value) => {
|
|
663
|
-
invariant4(path.length > 0
|
|
664
|
-
F: __dxlog_file4,
|
|
665
|
-
L: 18,
|
|
666
|
-
S: void 0,
|
|
667
|
-
A: [
|
|
668
|
-
"path.length > 0",
|
|
669
|
-
""
|
|
670
|
-
]
|
|
671
|
-
});
|
|
620
|
+
invariant4(path.length > 0);
|
|
672
621
|
let parent = obj;
|
|
673
622
|
for (const key of path.slice(0, -1)) {
|
|
674
623
|
if (parent[key] === void 0) {
|
|
@@ -691,72 +640,51 @@ var getDeep = (obj, path) => {
|
|
|
691
640
|
// src/defer-function.ts
|
|
692
641
|
var deferFunction = (fnProvider) => (...args) => fnProvider()(...args);
|
|
693
642
|
|
|
694
|
-
// src/explicit-resource-management-polyfill.ts
|
|
695
|
-
var _Symbol;
|
|
696
|
-
var _Symbol1;
|
|
697
|
-
(_Symbol = Symbol).dispose ?? (_Symbol.dispose = Symbol("Symbol.dispose"));
|
|
698
|
-
(_Symbol1 = Symbol).asyncDispose ?? (_Symbol1.asyncDispose = Symbol("Symbol.asyncDispose"));
|
|
699
|
-
|
|
700
643
|
// src/defer.ts
|
|
701
|
-
|
|
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
|
-
}
|
|
644
|
+
import "@hazae41/symbol-dispose-polyfill";
|
|
714
645
|
var defer = (fn) => new DeferGuard(fn);
|
|
715
646
|
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
|
-
}
|
|
647
|
+
_fn;
|
|
722
648
|
/**
|
|
723
649
|
* @internal
|
|
724
650
|
*/
|
|
725
651
|
constructor(_fn) {
|
|
726
|
-
_define_property4(this, "_fn", void 0);
|
|
727
652
|
this._fn = _fn;
|
|
728
653
|
}
|
|
654
|
+
[Symbol.dispose]() {
|
|
655
|
+
const result = this._fn();
|
|
656
|
+
if (result instanceof Promise) {
|
|
657
|
+
throw new Error("Async functions in defer are not supported. Use deferAsync instead.");
|
|
658
|
+
}
|
|
659
|
+
}
|
|
729
660
|
};
|
|
730
661
|
var deferAsync = (fn) => new DeferAsyncGuard(fn);
|
|
731
662
|
var DeferAsyncGuard = class {
|
|
732
|
-
|
|
733
|
-
await this._fn();
|
|
734
|
-
}
|
|
663
|
+
_fn;
|
|
735
664
|
/**
|
|
736
665
|
* @internal
|
|
737
666
|
*/
|
|
738
667
|
constructor(_fn) {
|
|
739
|
-
_define_property4(this, "_fn", void 0);
|
|
740
668
|
this._fn = _fn;
|
|
741
669
|
}
|
|
670
|
+
async [Symbol.asyncDispose]() {
|
|
671
|
+
await this._fn();
|
|
672
|
+
}
|
|
742
673
|
};
|
|
743
674
|
|
|
744
675
|
// 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
676
|
var entry = (map, key) => new MapEntry(map, key);
|
|
759
677
|
var MapEntry = class {
|
|
678
|
+
_map;
|
|
679
|
+
_key;
|
|
680
|
+
/**
|
|
681
|
+
* @internal
|
|
682
|
+
*/
|
|
683
|
+
// prettier-ignore
|
|
684
|
+
constructor(_map, _key) {
|
|
685
|
+
this._map = _map;
|
|
686
|
+
this._key = _key;
|
|
687
|
+
}
|
|
760
688
|
get key() {
|
|
761
689
|
return this._key;
|
|
762
690
|
}
|
|
@@ -772,63 +700,36 @@ var MapEntry = class {
|
|
|
772
700
|
deep(key) {
|
|
773
701
|
return entry(this.value, key);
|
|
774
702
|
}
|
|
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
703
|
};
|
|
786
704
|
|
|
787
|
-
// src/
|
|
788
|
-
var
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
""
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
} else {
|
|
803
|
-
const textBetween = characters.slice(result[0].length, i).join("");
|
|
804
|
-
if (/[^\p{L}\p{N}_]/u.test(textBetween)) {
|
|
805
|
-
result[1] = char;
|
|
806
|
-
break;
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
return result;
|
|
705
|
+
// src/error-format.ts
|
|
706
|
+
var formatErrorWithCauses = (error) => {
|
|
707
|
+
const lines = [];
|
|
708
|
+
let current = error;
|
|
709
|
+
let level = 0;
|
|
710
|
+
while (current) {
|
|
711
|
+
const prefix = level === 0 ? "" : `Caused by: `;
|
|
712
|
+
lines.push(prefix + (current.stack ?? String(current)));
|
|
713
|
+
if (!(current.cause instanceof Error)) {
|
|
714
|
+
break;
|
|
715
|
+
}
|
|
716
|
+
current = current.cause;
|
|
717
|
+
level += 1;
|
|
718
|
+
}
|
|
719
|
+
return lines.join("\n\n");
|
|
812
720
|
};
|
|
813
721
|
|
|
722
|
+
// src/filename.ts
|
|
723
|
+
var createFilename = ({ parts = [], ext, date = /* @__PURE__ */ new Date() }) => [
|
|
724
|
+
date.toISOString().replace(/[:.]/g, "-"),
|
|
725
|
+
...parts
|
|
726
|
+
].join("_") + (ext ? `.${ext}` : "");
|
|
727
|
+
|
|
814
728
|
// src/for-each-async.ts
|
|
815
729
|
var forEachAsync = (items, fn) => Promise.all(items.map(fn));
|
|
816
730
|
|
|
817
731
|
// src/human-hash.ts
|
|
818
732
|
import { PublicKey } from "@dxos/keys";
|
|
819
|
-
function _define_property6(obj, key, value) {
|
|
820
|
-
if (key in obj) {
|
|
821
|
-
Object.defineProperty(obj, key, {
|
|
822
|
-
value,
|
|
823
|
-
enumerable: true,
|
|
824
|
-
configurable: true,
|
|
825
|
-
writable: true
|
|
826
|
-
});
|
|
827
|
-
} else {
|
|
828
|
-
obj[key] = value;
|
|
829
|
-
}
|
|
830
|
-
return obj;
|
|
831
|
-
}
|
|
832
733
|
var DEFAULT_WORDLIST = [
|
|
833
734
|
"ack",
|
|
834
735
|
"alabama",
|
|
@@ -1088,6 +989,27 @@ var DEFAULT_WORDLIST = [
|
|
|
1088
989
|
"zulu"
|
|
1089
990
|
];
|
|
1090
991
|
var HumanHasher = class {
|
|
992
|
+
wordlist;
|
|
993
|
+
/**
|
|
994
|
+
* Transforms hex digests to human-readable strings.
|
|
995
|
+
*
|
|
996
|
+
* The format of these strings will look something like:
|
|
997
|
+
* `victor-bacon-zulu-lima`. The output is obtained by compressing the input
|
|
998
|
+
* digest to a fixed number of bytes, then mapping those bytes to one of 256
|
|
999
|
+
* words. A default wordlist is provided, but you can override this if you
|
|
1000
|
+
* prefer.
|
|
1001
|
+
* As long as you use the same wordlist, the output will be consistent (i.e.
|
|
1002
|
+
* the same digest will always render the same representation).
|
|
1003
|
+
*
|
|
1004
|
+
* @param wordlist A list of exactly 256 words to choose from
|
|
1005
|
+
*/
|
|
1006
|
+
constructor(wordlist = DEFAULT_WORDLIST) {
|
|
1007
|
+
this.wordlist = wordlist;
|
|
1008
|
+
if (wordlist.length !== 256) {
|
|
1009
|
+
throw new Error("Wordlist must have exactly 256 items");
|
|
1010
|
+
}
|
|
1011
|
+
this.wordlist = wordlist;
|
|
1012
|
+
}
|
|
1091
1013
|
/**
|
|
1092
1014
|
* Humanize a given hexadecimal digest.
|
|
1093
1015
|
*
|
|
@@ -1127,27 +1049,6 @@ var HumanHasher = class {
|
|
|
1127
1049
|
const checksums = segments.map((x) => x.reduce((acc, curr) => acc ^ curr));
|
|
1128
1050
|
return checksums;
|
|
1129
1051
|
}
|
|
1130
|
-
/**
|
|
1131
|
-
* Transforms hex digests to human-readable strings.
|
|
1132
|
-
*
|
|
1133
|
-
* The format of these strings will look something like:
|
|
1134
|
-
* `victor-bacon-zulu-lima`. The output is obtained by compressing the input
|
|
1135
|
-
* digest to a fixed number of bytes, then mapping those bytes to one of 256
|
|
1136
|
-
* words. A default wordlist is provided, but you can override this if you
|
|
1137
|
-
* prefer.
|
|
1138
|
-
* As long as you use the same wordlist, the output will be consistent (i.e.
|
|
1139
|
-
* the same digest will always render the same representation).
|
|
1140
|
-
*
|
|
1141
|
-
* @param wordlist A list of exactly 256 words to choose from
|
|
1142
|
-
*/
|
|
1143
|
-
constructor(wordlist = DEFAULT_WORDLIST) {
|
|
1144
|
-
_define_property6(this, "wordlist", void 0);
|
|
1145
|
-
this.wordlist = wordlist;
|
|
1146
|
-
if (wordlist.length !== 256) {
|
|
1147
|
-
throw new Error("Wordlist must have exactly 256 items");
|
|
1148
|
-
}
|
|
1149
|
-
this.wordlist = wordlist;
|
|
1150
|
-
}
|
|
1151
1052
|
};
|
|
1152
1053
|
var hasher = new HumanHasher();
|
|
1153
1054
|
var humanize = (value) => {
|
|
@@ -1159,6 +1060,19 @@ var humanize = (value) => {
|
|
|
1159
1060
|
return hasher.humanize(value);
|
|
1160
1061
|
};
|
|
1161
1062
|
|
|
1063
|
+
// src/id.ts
|
|
1064
|
+
var PART = /^[a-zA-Z][a-zA-Z0-9]{0,62}$/;
|
|
1065
|
+
var ID = /^[a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(\.[a-zA-Z]([a-zA-Z0-9]{0,62})?)$/;
|
|
1066
|
+
function id(strings, ...values) {
|
|
1067
|
+
const raw = strings.reduce((out, str, i) => out + str + (i < values.length ? String(values[i]) : ""), "");
|
|
1068
|
+
if (!ID.test(raw)) {
|
|
1069
|
+
throw new Error(`Invalid id (expected AT Protocol NSID): ${JSON.stringify(raw)}`);
|
|
1070
|
+
}
|
|
1071
|
+
return raw;
|
|
1072
|
+
}
|
|
1073
|
+
var isWellFormedId = (value) => ID.test(value);
|
|
1074
|
+
var isWellFormedIdPart = (value) => PART.test(value);
|
|
1075
|
+
|
|
1162
1076
|
// src/map.ts
|
|
1163
1077
|
var defaultMap = (map, key, def) => {
|
|
1164
1078
|
let value = map.get(key);
|
|
@@ -1170,22 +1084,20 @@ var defaultMap = (map, key, def) => {
|
|
|
1170
1084
|
};
|
|
1171
1085
|
|
|
1172
1086
|
// src/instance-id.ts
|
|
1173
|
-
var
|
|
1174
|
-
var
|
|
1175
|
-
var symbol = Symbol.for("dxos.instance-contexts");
|
|
1176
|
-
var instanceContexts = (_globalThis = globalThis)[_symbol = symbol] ?? (_globalThis[_symbol] = /* @__PURE__ */ new WeakMap());
|
|
1087
|
+
var symbol = /* @__PURE__ */ Symbol.for("dxos.instance-contexts");
|
|
1088
|
+
var instanceContexts = globalThis[symbol] ??= /* @__PURE__ */ new WeakMap();
|
|
1177
1089
|
var getPrototypeSpecificInstanceId = (instance) => {
|
|
1178
1090
|
const prototype = Object.getPrototypeOf(instance);
|
|
1179
1091
|
const instanceCtx = defaultMap(instanceContexts, prototype, () => ({
|
|
1180
1092
|
nextId: 0,
|
|
1181
1093
|
instanceIds: /* @__PURE__ */ new WeakMap()
|
|
1182
1094
|
}));
|
|
1183
|
-
let
|
|
1184
|
-
if (
|
|
1185
|
-
|
|
1186
|
-
instanceCtx.instanceIds.set(instance,
|
|
1095
|
+
let id2 = instanceCtx.instanceIds.get(instance);
|
|
1096
|
+
if (id2 === void 0) {
|
|
1097
|
+
id2 = instanceCtx.nextId++;
|
|
1098
|
+
instanceCtx.instanceIds.set(instance, id2);
|
|
1187
1099
|
}
|
|
1188
|
-
return
|
|
1100
|
+
return id2;
|
|
1189
1101
|
};
|
|
1190
1102
|
var getDebugName = (instance) => {
|
|
1191
1103
|
if (instance == null) {
|
|
@@ -1345,19 +1257,6 @@ var jsonKeyReplacer = (options = {}) => (key, value) => {
|
|
|
1345
1257
|
};
|
|
1346
1258
|
|
|
1347
1259
|
// src/map-values.ts
|
|
1348
|
-
function _define_property7(obj, key, value) {
|
|
1349
|
-
if (key in obj) {
|
|
1350
|
-
Object.defineProperty(obj, key, {
|
|
1351
|
-
value,
|
|
1352
|
-
enumerable: true,
|
|
1353
|
-
configurable: true,
|
|
1354
|
-
writable: true
|
|
1355
|
-
});
|
|
1356
|
-
} else {
|
|
1357
|
-
obj[key] = value;
|
|
1358
|
-
}
|
|
1359
|
-
return obj;
|
|
1360
|
-
}
|
|
1361
1260
|
var mapValues = (obj, fn) => {
|
|
1362
1261
|
const result = {};
|
|
1363
1262
|
Object.keys(obj).forEach((key) => {
|
|
@@ -1369,6 +1268,11 @@ var deepMapValues = (value, fn) => {
|
|
|
1369
1268
|
return new DeepMapper(fn).map(value);
|
|
1370
1269
|
};
|
|
1371
1270
|
var DeepMapper = class {
|
|
1271
|
+
_fn;
|
|
1272
|
+
_cyclic = /* @__PURE__ */ new Map();
|
|
1273
|
+
constructor(_fn) {
|
|
1274
|
+
this._fn = _fn;
|
|
1275
|
+
}
|
|
1372
1276
|
map(value) {
|
|
1373
1277
|
return this._map(value, void 0);
|
|
1374
1278
|
}
|
|
@@ -1378,40 +1282,38 @@ var DeepMapper = class {
|
|
|
1378
1282
|
}
|
|
1379
1283
|
return this._fn(value, this._recurse, key);
|
|
1380
1284
|
}
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1285
|
+
_recurse = (value) => {
|
|
1286
|
+
if (this._cyclic.has(value)) {
|
|
1287
|
+
return this._cyclic.get(value);
|
|
1288
|
+
}
|
|
1289
|
+
if (Array.isArray(value)) {
|
|
1290
|
+
const res = new Array(value.length);
|
|
1291
|
+
this._cyclic.set(value, res);
|
|
1292
|
+
for (let i = 0; i < value.length; i++) {
|
|
1293
|
+
res[i] = this._map(value[i], i);
|
|
1390
1294
|
}
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
return res;
|
|
1398
|
-
} else if (value !== null && typeof value === "object") {
|
|
1399
|
-
const res = {};
|
|
1400
|
-
this._cyclic.set(value, res);
|
|
1401
|
-
for (const key in value) {
|
|
1402
|
-
res[key] = this._map(value[key], key);
|
|
1403
|
-
}
|
|
1404
|
-
return res;
|
|
1405
|
-
} else {
|
|
1406
|
-
return value;
|
|
1295
|
+
return res;
|
|
1296
|
+
} else if (value !== null && typeof value === "object") {
|
|
1297
|
+
const res = {};
|
|
1298
|
+
this._cyclic.set(value, res);
|
|
1299
|
+
for (const key in value) {
|
|
1300
|
+
res[key] = this._map(value[key], key);
|
|
1407
1301
|
}
|
|
1408
|
-
|
|
1409
|
-
|
|
1302
|
+
return res;
|
|
1303
|
+
} else {
|
|
1304
|
+
return value;
|
|
1305
|
+
}
|
|
1306
|
+
};
|
|
1410
1307
|
};
|
|
1411
1308
|
var deepMapValuesAsync = (value, fn) => {
|
|
1412
1309
|
return new DeepMapperAsync(fn).map(value);
|
|
1413
1310
|
};
|
|
1414
1311
|
var DeepMapperAsync = class {
|
|
1312
|
+
_fn;
|
|
1313
|
+
_cyclic = /* @__PURE__ */ new Map();
|
|
1314
|
+
constructor(_fn) {
|
|
1315
|
+
this._fn = _fn;
|
|
1316
|
+
}
|
|
1415
1317
|
map(value) {
|
|
1416
1318
|
return this._map(value, void 0);
|
|
1417
1319
|
}
|
|
@@ -1421,35 +1323,28 @@ var DeepMapperAsync = class {
|
|
|
1421
1323
|
}
|
|
1422
1324
|
return this._fn(value, this._recurse, key);
|
|
1423
1325
|
}
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1326
|
+
_recurse = async (value) => {
|
|
1327
|
+
if (this._cyclic.has(value)) {
|
|
1328
|
+
return this._cyclic.get(value);
|
|
1329
|
+
}
|
|
1330
|
+
if (Array.isArray(value)) {
|
|
1331
|
+
const res = new Array(value.length);
|
|
1332
|
+
this._cyclic.set(value, res);
|
|
1333
|
+
for (let i = 0; i < value.length; i++) {
|
|
1334
|
+
res[i] = await this._map(value[i], i);
|
|
1433
1335
|
}
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
return res;
|
|
1441
|
-
} else if (value !== null && typeof value === "object") {
|
|
1442
|
-
const res = {};
|
|
1443
|
-
this._cyclic.set(value, res);
|
|
1444
|
-
for (const key in value) {
|
|
1445
|
-
res[key] = await this._map(value[key], key);
|
|
1446
|
-
}
|
|
1447
|
-
return res;
|
|
1448
|
-
} else {
|
|
1449
|
-
return value;
|
|
1336
|
+
return res;
|
|
1337
|
+
} else if (value !== null && typeof value === "object") {
|
|
1338
|
+
const res = {};
|
|
1339
|
+
this._cyclic.set(value, res);
|
|
1340
|
+
for (const key in value) {
|
|
1341
|
+
res[key] = await this._map(value[key], key);
|
|
1450
1342
|
}
|
|
1451
|
-
|
|
1452
|
-
|
|
1343
|
+
return res;
|
|
1344
|
+
} else {
|
|
1345
|
+
return value;
|
|
1346
|
+
}
|
|
1347
|
+
};
|
|
1453
1348
|
};
|
|
1454
1349
|
var visitValues = (object, visitor) => {
|
|
1455
1350
|
if (Array.isArray(object)) {
|
|
@@ -1483,27 +1378,27 @@ var orderKeys = (obj, order) => {
|
|
|
1483
1378
|
|
|
1484
1379
|
// src/order.ts
|
|
1485
1380
|
var inferObjectOrder = (objectMap, order = []) => {
|
|
1486
|
-
const orderedObjects = order.reduce((acc,
|
|
1487
|
-
if (
|
|
1488
|
-
acc.objects.push(objectMap[
|
|
1489
|
-
acc.ids.add(
|
|
1381
|
+
const orderedObjects = order.reduce((acc, id2) => {
|
|
1382
|
+
if (id2 in objectMap) {
|
|
1383
|
+
acc.objects.push(objectMap[id2]);
|
|
1384
|
+
acc.ids.add(id2);
|
|
1490
1385
|
}
|
|
1491
1386
|
return acc;
|
|
1492
1387
|
}, {
|
|
1493
1388
|
objects: [],
|
|
1494
1389
|
ids: /* @__PURE__ */ new Set()
|
|
1495
1390
|
});
|
|
1496
|
-
const { objects } = Object.keys(objectMap).reduce((acc,
|
|
1497
|
-
if (!acc.ids.has(
|
|
1498
|
-
acc.objects.push(objectMap[
|
|
1391
|
+
const { objects } = Object.keys(objectMap).reduce((acc, id2) => {
|
|
1392
|
+
if (!acc.ids.has(id2)) {
|
|
1393
|
+
acc.objects.push(objectMap[id2]);
|
|
1499
1394
|
}
|
|
1500
1395
|
return acc;
|
|
1501
1396
|
}, orderedObjects);
|
|
1502
1397
|
return objects;
|
|
1503
1398
|
};
|
|
1504
1399
|
var inferRecordOrder = (objectMap, order = []) => {
|
|
1505
|
-
return Object.assign(order.filter((
|
|
1506
|
-
acc[
|
|
1400
|
+
return Object.assign(order.filter((id2) => id2 in objectMap).reduce((acc, id2) => {
|
|
1401
|
+
acc[id2] = null;
|
|
1507
1402
|
return acc;
|
|
1508
1403
|
}, {}), objectMap);
|
|
1509
1404
|
};
|
|
@@ -1538,7 +1433,18 @@ var omit = (obj, keys2) => {
|
|
|
1538
1433
|
|
|
1539
1434
|
// src/platform.ts
|
|
1540
1435
|
var isNode = () => typeof process !== "undefined" && process.versions != null && process.versions.node != null;
|
|
1541
|
-
var
|
|
1436
|
+
var isBun = () => globalThis.Bun !== void 0;
|
|
1437
|
+
var isTauri = () => !!globalThis.__TAURI__;
|
|
1438
|
+
var isMobile = () => {
|
|
1439
|
+
let check = false;
|
|
1440
|
+
(function(a) {
|
|
1441
|
+
if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) {
|
|
1442
|
+
check = true;
|
|
1443
|
+
}
|
|
1444
|
+
})(navigator.userAgent || navigator.vendor || window.opera);
|
|
1445
|
+
return check;
|
|
1446
|
+
};
|
|
1447
|
+
var isMobileOrTablet = () => {
|
|
1542
1448
|
let check = false;
|
|
1543
1449
|
((a) => {
|
|
1544
1450
|
if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) {
|
|
@@ -1560,7 +1466,7 @@ var iosCheck = () => {
|
|
|
1560
1466
|
};
|
|
1561
1467
|
var safariCheck = () => typeof navigator !== "undefined" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
1562
1468
|
var getHostPlatform = () => {
|
|
1563
|
-
if (!("navigator" in
|
|
1469
|
+
if (!("navigator" in globalThis)) {
|
|
1564
1470
|
return "unknown";
|
|
1565
1471
|
}
|
|
1566
1472
|
const platform = (navigator.userAgentData?.platform || navigator.platform)?.toLowerCase();
|
|
@@ -1578,12 +1484,12 @@ var getHostPlatform = () => {
|
|
|
1578
1484
|
};
|
|
1579
1485
|
|
|
1580
1486
|
// src/position.ts
|
|
1581
|
-
var byPosition = ({ position: a
|
|
1487
|
+
var byPosition = ({ position: a }, { position: b }) => {
|
|
1582
1488
|
if (a === b) {
|
|
1583
1489
|
return 0;
|
|
1584
|
-
} else if (a === "
|
|
1490
|
+
} else if (a === "first" || b === "last") {
|
|
1585
1491
|
return -1;
|
|
1586
|
-
} else if (b === "
|
|
1492
|
+
} else if (b === "first" || a === "last") {
|
|
1587
1493
|
return 1;
|
|
1588
1494
|
} else {
|
|
1589
1495
|
return 0;
|
|
@@ -1736,6 +1642,43 @@ var removeProperties = (root, condition) => {
|
|
|
1736
1642
|
return result;
|
|
1737
1643
|
};
|
|
1738
1644
|
|
|
1645
|
+
// src/retry.ts
|
|
1646
|
+
var DEFAULT_RETRY_OPTIONS = {
|
|
1647
|
+
count: 3,
|
|
1648
|
+
delayMs: 100,
|
|
1649
|
+
exponent: 2,
|
|
1650
|
+
retryOnError: async () => true,
|
|
1651
|
+
retryOnValue: async () => false
|
|
1652
|
+
};
|
|
1653
|
+
var retry = async (options, cb) => {
|
|
1654
|
+
const fullOptions = {
|
|
1655
|
+
...DEFAULT_RETRY_OPTIONS,
|
|
1656
|
+
...options
|
|
1657
|
+
};
|
|
1658
|
+
let numRetries = 0, currentDelay = fullOptions.delayMs;
|
|
1659
|
+
while (true) {
|
|
1660
|
+
let result;
|
|
1661
|
+
try {
|
|
1662
|
+
result = await cb();
|
|
1663
|
+
} catch (err) {
|
|
1664
|
+
if (numRetries > fullOptions.count || !await fullOptions.retryOnError(err)) {
|
|
1665
|
+
throw err;
|
|
1666
|
+
}
|
|
1667
|
+
await new Promise((resolve) => setTimeout(resolve, currentDelay));
|
|
1668
|
+
currentDelay *= fullOptions.exponent;
|
|
1669
|
+
numRetries++;
|
|
1670
|
+
continue;
|
|
1671
|
+
}
|
|
1672
|
+
if (!await fullOptions.retryOnValue(result)) {
|
|
1673
|
+
return result;
|
|
1674
|
+
}
|
|
1675
|
+
await new Promise((resolve) => setTimeout(resolve, currentDelay));
|
|
1676
|
+
currentDelay *= fullOptions.exponent;
|
|
1677
|
+
numRetries++;
|
|
1678
|
+
continue;
|
|
1679
|
+
}
|
|
1680
|
+
};
|
|
1681
|
+
|
|
1739
1682
|
// src/safe-await.ts
|
|
1740
1683
|
var safeAwaitAll = async (source, taskFactory, onError) => {
|
|
1741
1684
|
const failedItems = [];
|
|
@@ -1755,7 +1698,7 @@ var safeAwaitAll = async (source, taskFactory, onError) => {
|
|
|
1755
1698
|
};
|
|
1756
1699
|
|
|
1757
1700
|
// src/safe-instanceof.ts
|
|
1758
|
-
var instanceTag = Symbol("instanceTag");
|
|
1701
|
+
var instanceTag = /* @__PURE__ */ Symbol("instanceTag");
|
|
1759
1702
|
var safeInstanceof = (tag) => (target) => {
|
|
1760
1703
|
target.prototype[instanceTag] = tag;
|
|
1761
1704
|
Object.defineProperty(target.prototype, Symbol.hasInstance, {
|
|
@@ -1767,48 +1710,142 @@ var safeInstanceof = (tag) => (target) => {
|
|
|
1767
1710
|
};
|
|
1768
1711
|
|
|
1769
1712
|
// src/safe-parse.ts
|
|
1770
|
-
|
|
1713
|
+
function safeParseInt(str, defaultValue) {
|
|
1771
1714
|
try {
|
|
1772
|
-
const
|
|
1773
|
-
return isNaN(
|
|
1715
|
+
const value = parseInt(str ?? "");
|
|
1716
|
+
return isNaN(value) ? defaultValue : value;
|
|
1774
1717
|
} catch {
|
|
1775
1718
|
return defaultValue;
|
|
1776
1719
|
}
|
|
1777
|
-
}
|
|
1778
|
-
|
|
1720
|
+
}
|
|
1721
|
+
function safeParseFloat(str, defaultValue) {
|
|
1779
1722
|
try {
|
|
1780
|
-
|
|
1723
|
+
const value = parseFloat(str ?? "");
|
|
1724
|
+
return isNaN(value) ? defaultValue : value;
|
|
1781
1725
|
} catch {
|
|
1782
|
-
return defaultValue
|
|
1726
|
+
return defaultValue;
|
|
1783
1727
|
}
|
|
1784
|
-
}
|
|
1785
|
-
var safeParseJson = (
|
|
1786
|
-
if (
|
|
1728
|
+
}
|
|
1729
|
+
var safeParseJson = (str, defaultValue) => {
|
|
1730
|
+
if (str && str.length > 0) {
|
|
1787
1731
|
try {
|
|
1788
|
-
return JSON.parse(
|
|
1732
|
+
return JSON.parse(str);
|
|
1789
1733
|
} catch {
|
|
1790
1734
|
}
|
|
1791
1735
|
}
|
|
1792
1736
|
return defaultValue;
|
|
1793
1737
|
};
|
|
1738
|
+
var safeUrl = (str) => {
|
|
1739
|
+
try {
|
|
1740
|
+
return new URL(str ?? "");
|
|
1741
|
+
} catch {
|
|
1742
|
+
return void 0;
|
|
1743
|
+
}
|
|
1744
|
+
};
|
|
1794
1745
|
|
|
1795
|
-
// src/
|
|
1796
|
-
|
|
1797
|
-
function
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1746
|
+
// src/safe-stringify.ts
|
|
1747
|
+
var SKIP = Object.freeze({});
|
|
1748
|
+
function safeStringify(obj, filter = defaultFilter, indent = 2) {
|
|
1749
|
+
const seen = /* @__PURE__ */ new WeakMap();
|
|
1750
|
+
function replacer(key, value) {
|
|
1751
|
+
try {
|
|
1752
|
+
let path = key;
|
|
1753
|
+
if (!key) {
|
|
1754
|
+
path = "$";
|
|
1755
|
+
if (value != null && typeof value === "object") {
|
|
1756
|
+
seen.set(value, path);
|
|
1757
|
+
}
|
|
1758
|
+
return value;
|
|
1759
|
+
} else if (this) {
|
|
1760
|
+
const parentPath = seen.get(this);
|
|
1761
|
+
path = parentPath ? `${parentPath}.${key}` : key;
|
|
1762
|
+
}
|
|
1763
|
+
if (value == null) {
|
|
1764
|
+
return value;
|
|
1765
|
+
}
|
|
1766
|
+
if (typeof value === "function") {
|
|
1767
|
+
return void 0;
|
|
1768
|
+
}
|
|
1769
|
+
if (typeof value === "object" && Object.getPrototypeOf(value) !== Object.prototype && !Array.isArray(value)) {
|
|
1770
|
+
return void 0;
|
|
1771
|
+
}
|
|
1772
|
+
if (typeof value === "object" && value !== null) {
|
|
1773
|
+
const exists = seen.get(value);
|
|
1774
|
+
if (exists) {
|
|
1775
|
+
return `[${path} => ${exists}]`;
|
|
1776
|
+
}
|
|
1777
|
+
seen.set(value, path);
|
|
1778
|
+
}
|
|
1779
|
+
if (filter) {
|
|
1780
|
+
const filteredValue = filter?.(key, value);
|
|
1781
|
+
if (filteredValue !== void 0) {
|
|
1782
|
+
return filteredValue === SKIP ? void 0 : filteredValue;
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
return value;
|
|
1786
|
+
} catch (error) {
|
|
1787
|
+
return `ERROR: ${error.message}`;
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
try {
|
|
1791
|
+
return JSON.stringify(obj, replacer, indent);
|
|
1792
|
+
} catch (error) {
|
|
1793
|
+
return `ERROR: ${error.message}`;
|
|
1807
1794
|
}
|
|
1808
|
-
return obj;
|
|
1809
1795
|
}
|
|
1810
|
-
var
|
|
1796
|
+
var createReplacer = ({ omit: omit2, parse, maxDepth, maxArrayLen, maxStringLen } = {}) => {
|
|
1797
|
+
let currentDepth = 0;
|
|
1798
|
+
const depthMap = /* @__PURE__ */ new WeakMap();
|
|
1799
|
+
return function(key, value) {
|
|
1800
|
+
if (key === "") {
|
|
1801
|
+
currentDepth = 0;
|
|
1802
|
+
} else if (this && typeof this === "object") {
|
|
1803
|
+
const parentDepth = depthMap.get(this) ?? 0;
|
|
1804
|
+
currentDepth = parentDepth + 1;
|
|
1805
|
+
}
|
|
1806
|
+
if (typeof value === "function") {
|
|
1807
|
+
return SKIP;
|
|
1808
|
+
}
|
|
1809
|
+
if (maxArrayLen != null && Array.isArray(value) && value.length > maxArrayLen) {
|
|
1810
|
+
return `[length: ${value.length}]`;
|
|
1811
|
+
}
|
|
1812
|
+
if (value && typeof value === "object") {
|
|
1813
|
+
depthMap.set(value, currentDepth);
|
|
1814
|
+
if (maxDepth != null && currentDepth >= maxDepth) {
|
|
1815
|
+
return Array.isArray(value) ? `[{ length: ${value.length} }]` : `{ keys: ${Object.keys(value).length} }`;
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
if (omit2?.includes(key)) {
|
|
1819
|
+
return SKIP;
|
|
1820
|
+
}
|
|
1821
|
+
if (parse?.includes(key) && typeof value === "string") {
|
|
1822
|
+
try {
|
|
1823
|
+
return JSON.parse(value);
|
|
1824
|
+
} catch {
|
|
1825
|
+
return value;
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
if (maxStringLen != null && typeof value === "string" && value.length > maxStringLen) {
|
|
1829
|
+
return value.slice(0, maxStringLen) + "...";
|
|
1830
|
+
}
|
|
1831
|
+
return value;
|
|
1832
|
+
};
|
|
1833
|
+
};
|
|
1834
|
+
var defaultFilter = createReplacer();
|
|
1835
|
+
|
|
1836
|
+
// src/sliding-window-summary.ts
|
|
1837
|
+
import { invariant as invariant5 } from "@dxos/invariant";
|
|
1811
1838
|
var SlidingWindowSummary = class {
|
|
1839
|
+
_buffer;
|
|
1840
|
+
_sum = 0;
|
|
1841
|
+
_precision;
|
|
1842
|
+
constructor(options) {
|
|
1843
|
+
this._buffer = new CircularBuffer(options.dataPoints);
|
|
1844
|
+
if (options.precision != null) {
|
|
1845
|
+
invariant5(options.precision >= 0);
|
|
1846
|
+
this._precision = Math.pow(10, options.precision);
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1812
1849
|
record(value) {
|
|
1813
1850
|
const evicted = this._buffer.push(value);
|
|
1814
1851
|
this._sum += value - (evicted ?? 0);
|
|
@@ -1843,24 +1880,6 @@ var SlidingWindowSummary = class {
|
|
|
1843
1880
|
}
|
|
1844
1881
|
return Math.round(value * this._precision) / this._precision;
|
|
1845
1882
|
}
|
|
1846
|
-
constructor(options) {
|
|
1847
|
-
_define_property8(this, "_buffer", void 0);
|
|
1848
|
-
_define_property8(this, "_sum", 0);
|
|
1849
|
-
_define_property8(this, "_precision", void 0);
|
|
1850
|
-
this._buffer = new CircularBuffer(options.dataPoints);
|
|
1851
|
-
if (options.precision != null) {
|
|
1852
|
-
invariant5(options.precision >= 0, void 0, {
|
|
1853
|
-
F: __dxlog_file5,
|
|
1854
|
-
L: 26,
|
|
1855
|
-
S: this,
|
|
1856
|
-
A: [
|
|
1857
|
-
"options.precision >= 0",
|
|
1858
|
-
""
|
|
1859
|
-
]
|
|
1860
|
-
});
|
|
1861
|
-
this._precision = Math.pow(10, options.precision);
|
|
1862
|
-
}
|
|
1863
|
-
}
|
|
1864
1883
|
};
|
|
1865
1884
|
|
|
1866
1885
|
// src/sort.ts
|
|
@@ -1904,11 +1923,16 @@ function trim(strings, ...values) {
|
|
|
1904
1923
|
return out;
|
|
1905
1924
|
}, "");
|
|
1906
1925
|
const lines = raw.split("\n");
|
|
1907
|
-
while (lines.length && !lines[0].trim())
|
|
1908
|
-
|
|
1926
|
+
while (lines.length && !lines[0].trim()) {
|
|
1927
|
+
lines.shift();
|
|
1928
|
+
}
|
|
1929
|
+
while (lines.length && !lines[lines.length - 1].trim()) {
|
|
1930
|
+
lines.pop();
|
|
1931
|
+
}
|
|
1909
1932
|
const minIndent = Math.min(...lines.filter((l) => l.trim()).map((l) => l.match(/^[ \t]*/)?.[0].length ?? 0));
|
|
1910
1933
|
return lines.map((l) => l.slice(minIndent)).join("\n");
|
|
1911
1934
|
}
|
|
1935
|
+
var kebabize = (str) => str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? "-" : "") + $.toLowerCase());
|
|
1912
1936
|
|
|
1913
1937
|
// src/sum.ts
|
|
1914
1938
|
var sum = (values) => values.reduce((a, b) => a + b, 0);
|
|
@@ -1922,18 +1946,6 @@ var throwUnhandledError = (error) => {
|
|
|
1922
1946
|
|
|
1923
1947
|
// src/to-fallback.ts
|
|
1924
1948
|
var idEmoji = [
|
|
1925
|
-
// When changing this set, please check the result in a console or e.g. RunKit (https://runkit.com/thure/642214441dd6ae000855a8de)
|
|
1926
|
-
// Emoji sometimes use a combination of code points, and some code points aren't visible on their own, so by adding or deleting you may unintentionally create non-visible items.
|
|
1927
|
-
// This set was chosen from the characters in Unicode Emoji v15.0 based on the following criteria:
|
|
1928
|
-
// – not people or isolated anthropomorphic faces
|
|
1929
|
-
// – not flags
|
|
1930
|
-
// – more concrete than abstract
|
|
1931
|
-
// – less culturally specific
|
|
1932
|
-
// – less easily confused with another emoji in the set
|
|
1933
|
-
// – requires less special knowledge to identify
|
|
1934
|
-
// – less likely to evoke negative feelings (no meat, no drugs, no weapons, etc)
|
|
1935
|
-
// – less common as a signifier in UX
|
|
1936
|
-
// NOTE that this is intentionally an array of strings because of the way emoji graphemes work.
|
|
1937
1949
|
"\u{1F47B}",
|
|
1938
1950
|
"\u{1F479}",
|
|
1939
1951
|
"\u{1F47D}",
|
|
@@ -2069,17 +2081,18 @@ var idEmoji = [
|
|
|
2069
2081
|
];
|
|
2070
2082
|
var idHue = [
|
|
2071
2083
|
"red",
|
|
2072
|
-
|
|
2084
|
+
"orange",
|
|
2073
2085
|
"amber",
|
|
2074
|
-
|
|
2086
|
+
"yellow",
|
|
2075
2087
|
"lime",
|
|
2076
2088
|
"green",
|
|
2077
2089
|
"emerald",
|
|
2078
2090
|
"teal",
|
|
2079
2091
|
"cyan",
|
|
2080
|
-
//
|
|
2081
|
-
// '
|
|
2082
|
-
// '
|
|
2092
|
+
// Omit colors similar to primary accent.
|
|
2093
|
+
// 'sky' as const,
|
|
2094
|
+
// 'blue' as const,
|
|
2095
|
+
// 'indigo' as const,
|
|
2083
2096
|
"violet",
|
|
2084
2097
|
"purple",
|
|
2085
2098
|
"fuchsia",
|
|
@@ -2106,20 +2119,9 @@ var toFallback = (hash) => {
|
|
|
2106
2119
|
};
|
|
2107
2120
|
|
|
2108
2121
|
// src/tracer.ts
|
|
2109
|
-
function _define_property9(obj, key, value) {
|
|
2110
|
-
if (key in obj) {
|
|
2111
|
-
Object.defineProperty(obj, key, {
|
|
2112
|
-
value,
|
|
2113
|
-
enumerable: true,
|
|
2114
|
-
configurable: true,
|
|
2115
|
-
writable: true
|
|
2116
|
-
});
|
|
2117
|
-
} else {
|
|
2118
|
-
obj[key] = value;
|
|
2119
|
-
}
|
|
2120
|
-
return obj;
|
|
2121
|
-
}
|
|
2122
2122
|
var Tracer = class {
|
|
2123
|
+
_events = /* @__PURE__ */ new Map();
|
|
2124
|
+
_recording = false;
|
|
2123
2125
|
// TODO(burdon): Start/stop methods for recording data? By id?
|
|
2124
2126
|
// Alternatively, enable subscriptions to track/compute series.
|
|
2125
2127
|
// TODO(burdon): Hierarchical traces?
|
|
@@ -2129,8 +2131,8 @@ var Tracer = class {
|
|
|
2129
2131
|
keys() {
|
|
2130
2132
|
return Array.from(this._events.keys());
|
|
2131
2133
|
}
|
|
2132
|
-
get(
|
|
2133
|
-
const events = this._events.get(
|
|
2134
|
+
get(id2, filter) {
|
|
2135
|
+
const events = this._events.get(id2);
|
|
2134
2136
|
if (filter) {
|
|
2135
2137
|
return events?.filter((event) => Object.entries(filter).every(([key, value]) => event?.value[key] === value));
|
|
2136
2138
|
}
|
|
@@ -2147,11 +2149,11 @@ var Tracer = class {
|
|
|
2147
2149
|
this._recording = false;
|
|
2148
2150
|
return this;
|
|
2149
2151
|
}
|
|
2150
|
-
emit(
|
|
2151
|
-
this._post(this._createEvent(
|
|
2152
|
+
emit(id2, value) {
|
|
2153
|
+
this._post(this._createEvent(id2, value));
|
|
2152
2154
|
}
|
|
2153
|
-
mark(
|
|
2154
|
-
const event = this._createEvent(
|
|
2155
|
+
mark(id2, value) {
|
|
2156
|
+
const event = this._createEvent(id2, value);
|
|
2155
2157
|
const start = performance.now();
|
|
2156
2158
|
return {
|
|
2157
2159
|
start,
|
|
@@ -2161,9 +2163,9 @@ var Tracer = class {
|
|
|
2161
2163
|
}
|
|
2162
2164
|
};
|
|
2163
2165
|
}
|
|
2164
|
-
_createEvent(
|
|
2166
|
+
_createEvent(id2, value) {
|
|
2165
2167
|
const event = {
|
|
2166
|
-
id,
|
|
2168
|
+
id: id2,
|
|
2167
2169
|
timestamp: Date.now()
|
|
2168
2170
|
};
|
|
2169
2171
|
if (value !== void 0) {
|
|
@@ -2176,10 +2178,6 @@ var Tracer = class {
|
|
|
2176
2178
|
defaultMap(this._events, event.id, []).push(event);
|
|
2177
2179
|
}
|
|
2178
2180
|
}
|
|
2179
|
-
constructor() {
|
|
2180
|
-
_define_property9(this, "_events", /* @__PURE__ */ new Map());
|
|
2181
|
-
_define_property9(this, "_recording", false);
|
|
2182
|
-
}
|
|
2183
2181
|
};
|
|
2184
2182
|
var tracer = new Tracer();
|
|
2185
2183
|
|
|
@@ -2224,7 +2222,7 @@ var stringifyTree = (node, ancestors = [], rows = []) => {
|
|
|
2224
2222
|
};
|
|
2225
2223
|
|
|
2226
2224
|
// src/types.ts
|
|
2227
|
-
var
|
|
2225
|
+
var isTruthy = (value) => !!value;
|
|
2228
2226
|
var isNonNullable = (value) => value != null;
|
|
2229
2227
|
var doAsync = async (fn) => fn();
|
|
2230
2228
|
var getProviderValue = (provider, arg) => {
|
|
@@ -2254,69 +2252,116 @@ var arrayMove = (array, from, to) => {
|
|
|
2254
2252
|
array.splice(to < 0 ? array.length + to : to, 0, array.splice(from, 1)[0]);
|
|
2255
2253
|
return array;
|
|
2256
2254
|
};
|
|
2255
|
+
function arraySwap(array, from, to) {
|
|
2256
|
+
const current = array[from];
|
|
2257
|
+
array[from] = array[to];
|
|
2258
|
+
array[to] = current;
|
|
2259
|
+
return array;
|
|
2260
|
+
}
|
|
2257
2261
|
|
|
2258
2262
|
// src/unit.ts
|
|
2259
|
-
var
|
|
2260
|
-
return (n, precision =
|
|
2263
|
+
var createFormat = (unit) => {
|
|
2264
|
+
return (n, precision = unit.precision ?? 0) => {
|
|
2261
2265
|
const value = n / unit.quotient;
|
|
2262
|
-
|
|
2266
|
+
const formattedValue = value.toLocaleString("en-US", {
|
|
2267
|
+
minimumFractionDigits: precision,
|
|
2268
|
+
maximumFractionDigits: precision
|
|
2269
|
+
});
|
|
2270
|
+
return {
|
|
2271
|
+
unit,
|
|
2272
|
+
value,
|
|
2273
|
+
formattedValue,
|
|
2274
|
+
toString: () => `${formattedValue}${unit.symbol}`
|
|
2275
|
+
};
|
|
2263
2276
|
};
|
|
2264
2277
|
};
|
|
2278
|
+
var MS_SECONDS = 1e3;
|
|
2279
|
+
var MS_MINUTES = 60 * MS_SECONDS;
|
|
2280
|
+
var MS_HOURS = 60 * MS_MINUTES;
|
|
2265
2281
|
var Unit = {
|
|
2266
|
-
//
|
|
2267
|
-
|
|
2282
|
+
// General.
|
|
2283
|
+
Percent: createFormat({
|
|
2284
|
+
symbol: "%",
|
|
2285
|
+
quotient: 1 / 100,
|
|
2286
|
+
precision: 2
|
|
2287
|
+
}),
|
|
2288
|
+
Thousand: createFormat({
|
|
2289
|
+
symbol: "k",
|
|
2290
|
+
quotient: 1e3,
|
|
2291
|
+
precision: 2
|
|
2292
|
+
}),
|
|
2293
|
+
// Bytes (note KB vs KiB).
|
|
2294
|
+
Gigabyte: createFormat({
|
|
2295
|
+
symbol: "GB",
|
|
2296
|
+
quotient: 1e3 * 1e3 * 1e3,
|
|
2297
|
+
precision: 2
|
|
2298
|
+
}),
|
|
2299
|
+
Megabyte: createFormat({
|
|
2300
|
+
symbol: "MB",
|
|
2301
|
+
quotient: 1e3 * 1e3,
|
|
2302
|
+
precision: 2
|
|
2303
|
+
}),
|
|
2304
|
+
Kilobyte: createFormat({
|
|
2305
|
+
symbol: "KB",
|
|
2306
|
+
quotient: 1e3,
|
|
2307
|
+
precision: 2
|
|
2308
|
+
}),
|
|
2309
|
+
Byte: createFormat({
|
|
2310
|
+
symbol: "B",
|
|
2311
|
+
quotient: 1
|
|
2312
|
+
}),
|
|
2313
|
+
// Time.
|
|
2314
|
+
Hour: createFormat({
|
|
2268
2315
|
symbol: "h",
|
|
2269
|
-
quotient:
|
|
2316
|
+
quotient: MS_HOURS
|
|
2270
2317
|
}),
|
|
2271
|
-
Minute:
|
|
2318
|
+
Minute: createFormat({
|
|
2272
2319
|
symbol: "m",
|
|
2273
|
-
quotient:
|
|
2320
|
+
quotient: MS_MINUTES
|
|
2274
2321
|
}),
|
|
2275
|
-
Second:
|
|
2322
|
+
Second: createFormat({
|
|
2276
2323
|
symbol: "s",
|
|
2277
|
-
quotient:
|
|
2324
|
+
quotient: MS_SECONDS,
|
|
2325
|
+
precision: 1
|
|
2278
2326
|
}),
|
|
2279
|
-
Millisecond:
|
|
2327
|
+
Millisecond: createFormat({
|
|
2280
2328
|
symbol: "ms",
|
|
2281
2329
|
quotient: 1
|
|
2282
2330
|
}),
|
|
2283
2331
|
Duration: (n) => {
|
|
2284
|
-
const hours = Math.floor(n /
|
|
2285
|
-
const minutes = Math.floor(n %
|
|
2332
|
+
const hours = Math.floor(n / MS_HOURS);
|
|
2333
|
+
const minutes = Math.floor(n % MS_HOURS / MS_MINUTES);
|
|
2286
2334
|
if (hours) {
|
|
2287
|
-
|
|
2335
|
+
const formattedValue = minutes ? `${hours}h ${minutes}m` : `${hours}h`;
|
|
2336
|
+
return {
|
|
2337
|
+
unit: {
|
|
2338
|
+
symbol: "h",
|
|
2339
|
+
quotient: MS_HOURS
|
|
2340
|
+
},
|
|
2341
|
+
value: hours,
|
|
2342
|
+
formattedValue,
|
|
2343
|
+
toString: () => formattedValue
|
|
2344
|
+
};
|
|
2288
2345
|
}
|
|
2289
|
-
const seconds = Math.floor(n % (60 * 1e3) / 1e3);
|
|
2290
2346
|
if (minutes) {
|
|
2291
|
-
|
|
2347
|
+
const seconds2 = (n - MS_MINUTES * minutes) / MS_SECONDS;
|
|
2348
|
+
const formattedValue = seconds2 ? `${minutes}m ${seconds2}s` : `${minutes}m`;
|
|
2349
|
+
return {
|
|
2350
|
+
unit: {
|
|
2351
|
+
symbol: "m",
|
|
2352
|
+
quotient: MS_MINUTES
|
|
2353
|
+
},
|
|
2354
|
+
value: minutes,
|
|
2355
|
+
formattedValue,
|
|
2356
|
+
toString: () => formattedValue
|
|
2357
|
+
};
|
|
2292
2358
|
}
|
|
2359
|
+
const seconds = n >= MS_SECONDS;
|
|
2293
2360
|
if (seconds) {
|
|
2294
|
-
return
|
|
2361
|
+
return Unit.Second(n);
|
|
2295
2362
|
}
|
|
2296
|
-
return
|
|
2297
|
-
}
|
|
2298
|
-
// bytes (note KB via KiB).
|
|
2299
|
-
Gigabyte: Formatter({
|
|
2300
|
-
symbol: "GB",
|
|
2301
|
-
quotient: 1e3 * 1e3 * 1e3
|
|
2302
|
-
}),
|
|
2303
|
-
Megabyte: Formatter({
|
|
2304
|
-
symbol: "MB",
|
|
2305
|
-
quotient: 1e3 * 1e3
|
|
2306
|
-
}),
|
|
2307
|
-
Kilobyte: Formatter({
|
|
2308
|
-
symbol: "KB",
|
|
2309
|
-
quotient: 1e3
|
|
2310
|
-
}),
|
|
2311
|
-
// general.
|
|
2312
|
-
Thousand: Formatter({
|
|
2313
|
-
symbol: "k",
|
|
2314
|
-
quotient: 1e3
|
|
2315
|
-
}),
|
|
2316
|
-
Percent: Formatter({
|
|
2317
|
-
symbol: "%",
|
|
2318
|
-
quotient: 1 / 100
|
|
2319
|
-
})
|
|
2363
|
+
return Unit.Millisecond(n);
|
|
2364
|
+
}
|
|
2320
2365
|
};
|
|
2321
2366
|
|
|
2322
2367
|
// src/url.ts
|
|
@@ -2329,20 +2374,22 @@ var createUrl = (url, search) => {
|
|
|
2329
2374
|
};
|
|
2330
2375
|
|
|
2331
2376
|
// src/weak.ts
|
|
2332
|
-
function _define_property10(obj, key, value) {
|
|
2333
|
-
if (key in obj) {
|
|
2334
|
-
Object.defineProperty(obj, key, {
|
|
2335
|
-
value,
|
|
2336
|
-
enumerable: true,
|
|
2337
|
-
configurable: true,
|
|
2338
|
-
writable: true
|
|
2339
|
-
});
|
|
2340
|
-
} else {
|
|
2341
|
-
obj[key] = value;
|
|
2342
|
-
}
|
|
2343
|
-
return obj;
|
|
2344
|
-
}
|
|
2345
2377
|
var WeakDictionary = class {
|
|
2378
|
+
_internal = /* @__PURE__ */ new Map();
|
|
2379
|
+
_finalization = new FinalizationRegistry(({ key, ref }) => {
|
|
2380
|
+
if (this._internal.get(key) === ref) {
|
|
2381
|
+
this._internal.delete(key);
|
|
2382
|
+
}
|
|
2383
|
+
});
|
|
2384
|
+
constructor(entries2) {
|
|
2385
|
+
if (entries2) {
|
|
2386
|
+
for (const [key, value] of entries2) {
|
|
2387
|
+
const ref = new WeakRef(value);
|
|
2388
|
+
this._internal.set(key, ref);
|
|
2389
|
+
this._register(key, value, ref);
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2346
2393
|
*entries() {
|
|
2347
2394
|
for (const [key, value] of this._internal) {
|
|
2348
2395
|
yield [
|
|
@@ -2381,10 +2428,45 @@ var WeakDictionary = class {
|
|
|
2381
2428
|
return this._internal.get(key)?.deref();
|
|
2382
2429
|
}
|
|
2383
2430
|
set(key, value) {
|
|
2384
|
-
this._internal.
|
|
2385
|
-
|
|
2431
|
+
const previous = this._internal.get(key)?.deref();
|
|
2432
|
+
if (previous) {
|
|
2433
|
+
this._unregister(previous);
|
|
2434
|
+
}
|
|
2435
|
+
const ref = new WeakRef(value);
|
|
2436
|
+
this._internal.set(key, ref);
|
|
2437
|
+
this._register(key, value, ref);
|
|
2386
2438
|
return this;
|
|
2387
2439
|
}
|
|
2440
|
+
/**
|
|
2441
|
+
* Returns the value for the given key if present, otherwise inserts and returns the default value.
|
|
2442
|
+
* @param key - The key to look up or insert.
|
|
2443
|
+
* @param defaultValue - The value to insert if the key is not present.
|
|
2444
|
+
* @returns The existing or newly inserted value.
|
|
2445
|
+
*/
|
|
2446
|
+
getOrInsert(key, defaultValue) {
|
|
2447
|
+
const existing = this.get(key);
|
|
2448
|
+
if (existing !== void 0) {
|
|
2449
|
+
return existing;
|
|
2450
|
+
}
|
|
2451
|
+
this.set(key, defaultValue);
|
|
2452
|
+
return defaultValue;
|
|
2453
|
+
}
|
|
2454
|
+
/**
|
|
2455
|
+
* Returns the value for the given key if present, otherwise computes, inserts, and returns a new value.
|
|
2456
|
+
* The callback is only invoked when the key is missing.
|
|
2457
|
+
* @param key - The key to look up or insert.
|
|
2458
|
+
* @param callbackfn - Function to compute the value if the key is not present.
|
|
2459
|
+
* @returns The existing or newly computed value.
|
|
2460
|
+
*/
|
|
2461
|
+
getOrInsertComputed(key, callbackfn) {
|
|
2462
|
+
const existing = this.get(key);
|
|
2463
|
+
if (existing !== void 0) {
|
|
2464
|
+
return existing;
|
|
2465
|
+
}
|
|
2466
|
+
const value = callbackfn(key);
|
|
2467
|
+
this.set(key, value);
|
|
2468
|
+
return value;
|
|
2469
|
+
}
|
|
2388
2470
|
has(key) {
|
|
2389
2471
|
return this._internal.has(key) && this._internal.get(key).deref() !== void 0;
|
|
2390
2472
|
}
|
|
@@ -2415,25 +2497,15 @@ var WeakDictionary = class {
|
|
|
2415
2497
|
}
|
|
2416
2498
|
});
|
|
2417
2499
|
}
|
|
2418
|
-
_register(key, value) {
|
|
2419
|
-
this._finalization.register(value,
|
|
2420
|
-
|
|
2500
|
+
_register(key, value, ref) {
|
|
2501
|
+
this._finalization.register(value, {
|
|
2502
|
+
key,
|
|
2503
|
+
ref
|
|
2421
2504
|
}, value);
|
|
2422
2505
|
}
|
|
2423
2506
|
_unregister(value) {
|
|
2424
2507
|
this._finalization.unregister(value);
|
|
2425
2508
|
}
|
|
2426
|
-
constructor(entries2) {
|
|
2427
|
-
_define_property10(this, "_internal", /* @__PURE__ */ new Map());
|
|
2428
|
-
_define_property10(this, "_finalization", new FinalizationRegistry((cleanUpCallback) => {
|
|
2429
|
-
cleanUpCallback();
|
|
2430
|
-
}));
|
|
2431
|
-
this._internal = new Map(entries2?.map(([key, value]) => [
|
|
2432
|
-
key,
|
|
2433
|
-
new WeakRef(value)
|
|
2434
|
-
]));
|
|
2435
|
-
entries2?.forEach(([key, value]) => this._register(key, value));
|
|
2436
|
-
}
|
|
2437
2509
|
};
|
|
2438
2510
|
export {
|
|
2439
2511
|
BitField,
|
|
@@ -2444,12 +2516,14 @@ export {
|
|
|
2444
2516
|
ComplexSet,
|
|
2445
2517
|
HumanHasher,
|
|
2446
2518
|
MapEntry,
|
|
2519
|
+
SKIP,
|
|
2447
2520
|
SlidingWindowSummary,
|
|
2448
2521
|
Tracer,
|
|
2449
2522
|
Unit,
|
|
2450
2523
|
WeakDictionary,
|
|
2451
2524
|
accessBy,
|
|
2452
2525
|
arrayMove,
|
|
2526
|
+
arraySwap,
|
|
2453
2527
|
arrayToBuffer,
|
|
2454
2528
|
arrayToHex,
|
|
2455
2529
|
arrayToString,
|
|
@@ -2460,19 +2534,28 @@ export {
|
|
|
2460
2534
|
capitalize,
|
|
2461
2535
|
chunkArray,
|
|
2462
2536
|
clamp,
|
|
2537
|
+
clearCaches,
|
|
2538
|
+
clearIndexedDB,
|
|
2539
|
+
clearOPFS,
|
|
2540
|
+
clearServiceWorkers,
|
|
2463
2541
|
clearUndefined,
|
|
2542
|
+
coerceArray,
|
|
2464
2543
|
compareMulti,
|
|
2465
2544
|
compareObject,
|
|
2466
2545
|
compareScalar,
|
|
2467
2546
|
compareString,
|
|
2547
|
+
compositeKey,
|
|
2468
2548
|
createBinder,
|
|
2469
2549
|
createBucketReducer,
|
|
2550
|
+
createFilename,
|
|
2470
2551
|
createGroupReducer,
|
|
2552
|
+
createReplacer,
|
|
2471
2553
|
createSetDispatch,
|
|
2472
2554
|
createUrl,
|
|
2473
2555
|
decamelize,
|
|
2474
2556
|
deepMapValues,
|
|
2475
2557
|
deepMapValuesAsync,
|
|
2558
|
+
defaultFilter,
|
|
2476
2559
|
defaultMap,
|
|
2477
2560
|
defer,
|
|
2478
2561
|
deferAsync,
|
|
@@ -2484,12 +2567,11 @@ export {
|
|
|
2484
2567
|
entry,
|
|
2485
2568
|
exponentialBackoffInterval,
|
|
2486
2569
|
forEachAsync,
|
|
2487
|
-
|
|
2570
|
+
formatErrorWithCauses,
|
|
2488
2571
|
getAsyncProviderValue,
|
|
2489
2572
|
getDate,
|
|
2490
2573
|
getDebugName,
|
|
2491
2574
|
getDeep,
|
|
2492
|
-
getFirstTwoRenderableChars,
|
|
2493
2575
|
getHostPlatform,
|
|
2494
2576
|
getPrototypeSpecificInstanceId,
|
|
2495
2577
|
getProviderValue,
|
|
@@ -2498,6 +2580,7 @@ export {
|
|
|
2498
2580
|
hexToHue,
|
|
2499
2581
|
humanize,
|
|
2500
2582
|
hyphenize,
|
|
2583
|
+
id,
|
|
2501
2584
|
idEmoji,
|
|
2502
2585
|
idHue,
|
|
2503
2586
|
inferObjectOrder,
|
|
@@ -2505,14 +2588,21 @@ export {
|
|
|
2505
2588
|
intersectBy,
|
|
2506
2589
|
intersection,
|
|
2507
2590
|
iosCheck,
|
|
2591
|
+
isBun,
|
|
2592
|
+
isMobile,
|
|
2593
|
+
isMobileOrTablet,
|
|
2508
2594
|
isNode,
|
|
2509
2595
|
isNonNullable,
|
|
2510
|
-
|
|
2596
|
+
isTauri,
|
|
2597
|
+
isTruthy,
|
|
2598
|
+
isWellFormedId,
|
|
2599
|
+
isWellFormedIdPart,
|
|
2511
2600
|
joinTables,
|
|
2512
2601
|
jsonKeyReplacer,
|
|
2513
2602
|
jsonReplacer,
|
|
2514
2603
|
jsonify,
|
|
2515
2604
|
jsonlogify,
|
|
2605
|
+
kebabize,
|
|
2516
2606
|
keyToEmoji,
|
|
2517
2607
|
keyToFallback,
|
|
2518
2608
|
keyToHue,
|
|
@@ -2521,7 +2611,6 @@ export {
|
|
|
2521
2611
|
makeSet,
|
|
2522
2612
|
mapValues,
|
|
2523
2613
|
median,
|
|
2524
|
-
mobileAndTabletCheck,
|
|
2525
2614
|
numericalValues,
|
|
2526
2615
|
omit,
|
|
2527
2616
|
orderKeys,
|
|
@@ -2537,15 +2626,18 @@ export {
|
|
|
2537
2626
|
removeBy,
|
|
2538
2627
|
removeProperties,
|
|
2539
2628
|
removeUndefinedProperties,
|
|
2629
|
+
retry,
|
|
2540
2630
|
safariCheck,
|
|
2541
2631
|
safeAwaitAll,
|
|
2542
2632
|
safeInstanceof,
|
|
2543
2633
|
safeParseFloat,
|
|
2544
2634
|
safeParseInt,
|
|
2545
2635
|
safeParseJson,
|
|
2546
|
-
|
|
2636
|
+
safeStringify,
|
|
2637
|
+
safeUrl,
|
|
2547
2638
|
setDeep,
|
|
2548
2639
|
sortKeys,
|
|
2640
|
+
splitCompositeKey,
|
|
2549
2641
|
stringToArray,
|
|
2550
2642
|
stringifyTree,
|
|
2551
2643
|
stripUndefined,
|