@dxos/util 0.8.4-main.84f28bd → 0.8.4-main.ae835ea
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 +162 -94
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +162 -94
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/array.d.ts.map +1 -1
- package/dist/types/src/assume.d.ts.map +1 -1
- package/dist/types/src/di-key.d.ts +3 -3
- package/dist/types/src/di-key.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/json.d.ts +1 -1
- package/dist/types/src/json.d.ts.map +1 -1
- package/dist/types/src/object.d.ts +3 -0
- package/dist/types/src/object.d.ts.map +1 -1
- package/dist/types/src/safe-parse.d.ts.map +1 -1
- package/dist/types/src/string.d.ts +8 -0
- package/dist/types/src/string.d.ts.map +1 -1
- package/dist/types/src/string.test.d.ts +2 -0
- package/dist/types/src/string.test.d.ts.map +1 -0
- package/dist/types/src/to-fallback.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/unit.d.ts +15 -0
- package/dist/types/src/unit.d.ts.map +1 -0
- package/dist/types/src/unit.test.d.ts +2 -0
- package/dist/types/src/unit.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/array.test.ts +1 -1
- package/src/array.ts +0 -2
- package/src/assume.ts +0 -1
- package/src/circular-buffer.test.ts +1 -1
- package/src/complex.test.ts +1 -1
- package/src/human-hash.test.ts +1 -1
- package/src/index.ts +1 -2
- package/src/json.ts +2 -7
- package/src/object.ts +3 -0
- package/src/position.test.ts +2 -2
- package/src/safe-parse.ts +6 -3
- package/src/sort.test.ts +1 -1
- package/src/string.test.ts +19 -0
- package/src/string.ts +36 -0
- package/src/to-fallback.ts +5 -4
- package/src/tree.test.ts +1 -1
- package/src/types.ts +1 -1
- package/src/uint8array.test.ts +1 -1
- package/src/unit.test.ts +25 -0
- package/src/unit.ts +52 -0
- package/src/weak.test.ts +1 -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/first-two-chars.ts +0 -44
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/array-to-hex.ts":{"bytes":2461,"imports":[],"format":"esm"},"src/array.ts":{"bytes":11543,"imports":[],"format":"esm"},"src/assume.ts":{"bytes":1559,"imports":[],"format":"esm"},"src/binder.ts":{"bytes":1310,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true}],"format":"esm"},"src/bitfield.ts":{"bytes":8453,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/callback-collection.ts":{"bytes":3170,"imports":[],"format":"esm"},"src/callback.ts":{"bytes":5204,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/case.ts":{"bytes":4574,"imports":[],"format":"esm"},"src/chunk-array.ts":{"bytes":1195,"imports":[],"format":"esm"},"src/circular-buffer.ts":{"bytes":6257,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/clear-undefined.ts":{"bytes":1554,"imports":[],"format":"esm"},"src/complex.ts":{"bytes":21800,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"src/deep.ts":{"bytes":3983,"imports":[{"path":"lodash.get","kind":"import-statement","external":true},{"path":"lodash.set","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/defer-function.ts":{"bytes":1558,"imports":[],"format":"esm"},"src/explicit-resource-management-polyfill.ts":{"bytes":1429,"imports":[],"format":"esm"},"src/defer.ts":{"bytes":3674,"imports":[{"path":"src/explicit-resource-management-polyfill.ts","kind":"import-statement","original":"./explicit-resource-management-polyfill"}],"format":"esm"},"src/entry.ts":{"bytes":3002,"imports":[],"format":"esm"},"src/first-two-chars.ts":{"bytes":4855,"imports":[],"format":"esm"},"src/for-each-async.ts":{"bytes":785,"imports":[],"format":"esm"},"src/human-hash.ts":{"bytes":19761,"imports":[{"path":"@dxos/keys","kind":"import-statement","external":true}],"format":"esm"},"src/map.ts":{"bytes":1489,"imports":[],"format":"esm"},"src/instance-id.ts":{"bytes":4222,"imports":[{"path":"src/map.ts","kind":"import-statement","original":"./map"}],"format":"esm"},"src/interval.ts":{"bytes":1819,"imports":[],"format":"esm"},"src/join-tables.ts":{"bytes":3063,"imports":[],"format":"esm"},"src/uint8array.ts":{"bytes":3745,"imports":[],"format":"esm"},"src/json.ts":{"bytes":13677,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"src/human-hash.ts","kind":"import-statement","original":"./human-hash"},{"path":"src/uint8array.ts","kind":"import-statement","original":"./uint8array"}],"format":"esm"},"src/map-values.ts":{"bytes":13207,"imports":[],"format":"esm"},"src/no-infer.ts":{"bytes":474,"imports":[],"format":"esm"},"src/object.ts":{"bytes":924,"imports":[],"format":"esm"},"src/order-keys.ts":{"bytes":1598,"imports":[],"format":"esm"},"src/order.ts":{"bytes":4971,"imports":[],"format":"esm"},"src/pick.ts":{"bytes":3648,"imports":[],"format":"esm"},"src/platform.ts":{"bytes":11239,"imports":[],"format":"esm"},"src/position.ts":{"bytes":2499,"imports":[],"format":"esm"},"src/random.ts":{"bytes":1303,"imports":[],"format":"esm"},"src/range.ts":{"bytes":2611,"imports":[],"format":"esm"},"src/reducers.ts":{"bytes":12812,"imports":[{"path":"src/map.ts","kind":"import-statement","original":"./map"}],"format":"esm"},"src/remove-undefined-keys.ts":{"bytes":4560,"imports":[],"format":"esm"},"src/safe-await.ts":{"bytes":2843,"imports":[],"format":"esm"},"src/safe-instanceof.ts":{"bytes":2680,"imports":[],"format":"esm"},"src/safe-parse.ts":{"bytes":2777,"imports":[],"format":"esm"},"src/sliding-window-summary.ts":{"bytes":7509,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/circular-buffer.ts","kind":"import-statement","original":"./circular-buffer"}],"format":"esm"},"src/sort.ts":{"bytes":3931,"imports":[],"format":"esm"},"src/string.ts":{"bytes":1139,"imports":[],"format":"esm"},"src/sum.ts":{"bytes":675,"imports":[],"format":"esm"},"src/throw-unhandled-error.ts":{"bytes":1163,"imports":[],"format":"esm"},"src/to-fallback.ts":{"bytes":13973,"imports":[],"format":"esm"},"src/tracer.ts":{"bytes":7225,"imports":[{"path":"src/map.ts","kind":"import-statement","original":"./map"}],"format":"esm"},"src/tree.ts":{"bytes":6250,"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"src/types.ts":{"bytes":8514,"imports":[],"format":"esm"},"src/url.ts":{"bytes":1627,"imports":[],"format":"esm"},"src/weak.ts":{"bytes":9591,"imports":[],"format":"esm"},"src/index.ts":{"bytes":5118,"imports":[{"path":"src/array-to-hex.ts","kind":"import-statement","original":"./array-to-hex"},{"path":"src/array.ts","kind":"import-statement","original":"./array"},{"path":"src/assume.ts","kind":"import-statement","original":"./assume"},{"path":"src/binder.ts","kind":"import-statement","original":"./binder"},{"path":"src/bitfield.ts","kind":"import-statement","original":"./bitfield"},{"path":"src/callback-collection.ts","kind":"import-statement","original":"./callback-collection"},{"path":"src/callback.ts","kind":"import-statement","original":"./callback"},{"path":"src/case.ts","kind":"import-statement","original":"./case"},{"path":"src/chunk-array.ts","kind":"import-statement","original":"./chunk-array"},{"path":"src/circular-buffer.ts","kind":"import-statement","original":"./circular-buffer"},{"path":"src/clear-undefined.ts","kind":"import-statement","original":"./clear-undefined"},{"path":"src/complex.ts","kind":"import-statement","original":"./complex"},{"path":"src/deep.ts","kind":"import-statement","original":"./deep"},{"path":"src/defer-function.ts","kind":"import-statement","original":"./defer-function"},{"path":"src/defer.ts","kind":"import-statement","original":"./defer"},{"path":"src/entry.ts","kind":"import-statement","original":"./entry"},{"path":"src/first-two-chars.ts","kind":"import-statement","original":"./first-two-chars"},{"path":"src/for-each-async.ts","kind":"import-statement","original":"./for-each-async"},{"path":"src/human-hash.ts","kind":"import-statement","original":"./human-hash"},{"path":"src/instance-id.ts","kind":"import-statement","original":"./instance-id"},{"path":"src/interval.ts","kind":"import-statement","original":"./interval"},{"path":"src/join-tables.ts","kind":"import-statement","original":"./join-tables"},{"path":"src/json.ts","kind":"import-statement","original":"./json"},{"path":"src/map-values.ts","kind":"import-statement","original":"./map-values"},{"path":"src/map.ts","kind":"import-statement","original":"./map"},{"path":"src/no-infer.ts","kind":"import-statement","original":"./no-infer"},{"path":"src/object.ts","kind":"import-statement","original":"./object"},{"path":"src/order-keys.ts","kind":"import-statement","original":"./order-keys"},{"path":"src/order.ts","kind":"import-statement","original":"./order"},{"path":"src/pick.ts","kind":"import-statement","original":"./pick"},{"path":"src/platform.ts","kind":"import-statement","original":"./platform"},{"path":"src/position.ts","kind":"import-statement","original":"./position"},{"path":"src/random.ts","kind":"import-statement","original":"./random"},{"path":"src/range.ts","kind":"import-statement","original":"./range"},{"path":"src/reducers.ts","kind":"import-statement","original":"./reducers"},{"path":"src/remove-undefined-keys.ts","kind":"import-statement","original":"./remove-undefined-keys"},{"path":"src/safe-await.ts","kind":"import-statement","original":"./safe-await"},{"path":"src/safe-instanceof.ts","kind":"import-statement","original":"./safe-instanceof"},{"path":"src/safe-parse.ts","kind":"import-statement","original":"./safe-parse"},{"path":"src/sliding-window-summary.ts","kind":"import-statement","original":"./sliding-window-summary"},{"path":"src/sliding-window-summary.ts","kind":"import-statement","original":"./sliding-window-summary"},{"path":"src/sort.ts","kind":"import-statement","original":"./sort"},{"path":"src/string.ts","kind":"import-statement","original":"./string"},{"path":"src/sum.ts","kind":"import-statement","original":"./sum"},{"path":"src/throw-unhandled-error.ts","kind":"import-statement","original":"./throw-unhandled-error"},{"path":"src/to-fallback.ts","kind":"import-statement","original":"./to-fallback"},{"path":"src/tracer.ts","kind":"import-statement","original":"./tracer"},{"path":"src/tree.ts","kind":"import-statement","original":"./tree"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/uint8array.ts","kind":"import-statement","original":"./uint8array"},{"path":"src/url.ts","kind":"import-statement","original":"./url"},{"path":"src/weak.ts","kind":"import-statement","original":"./weak"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":130577},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"lodash.get","kind":"import-statement","external":true},{"path":"lodash.set","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true}],"exports":["BitField","Callback","CallbackCollection","CircularBuffer","ComplexMap","ComplexSet","HumanHasher","MapEntry","SlidingWindowSummary","Tracer","WeakDictionary","accessBy","arrayMove","arrayToBuffer","arrayToHex","arrayToString","arraysEqual","assumeType","bufferToArray","byPosition","capitalize","chunkArray","clamp","clearUndefined","compareMulti","compareObject","compareScalar","compareString","createBinder","createBucketReducer","createGroupReducer","createSetDispatch","createUrl","decamelize","deepMapValues","deepMapValuesAsync","defaultMap","defer","deferAsync","deferFunction","diff","distinctBy","doAsync","entries","entry","exponentialBackoffInterval","forEachAsync","get","getAsyncProviderValue","getDate","getDebugName","getDeep","getFirstTwoRenderableChars","getHostPlatform","getPrototypeSpecificInstanceId","getProviderValue","hexToEmoji","hexToFallback","hexToHue","humanize","hyphenize","idEmoji","idHue","inferObjectOrder","inferRecordOrder","intersectBy","intersection","iosCheck","isNode","isNonNullable","isNotFalsy","joinTables","jsonKeyReplacer","jsonReplacer","jsonify","jsonlogify","keyToEmoji","keyToFallback","keyToHue","keys","makeMap","makeSet","mapValues","median","mobileAndTabletCheck","numericalValues","omit","orderKeys","partition","pick","pickBy","randomInt","range","rangeFromTo","reduceGroupBy","reduceSeries","reduceSet","removeBy","removeProperties","removeUndefinedProperties","safariCheck","safeAwaitAll","safeInstanceof","safeParseFloat","safeParseInt","safeParseJson","set","setDeep","sortKeys","stringToArray","stringifyTree","stripUndefined","sum","throwUnhandledError","toEmoji","toFallback","toHue","tracer","visitValues"],"entryPoint":"src/index.ts","inputs":{"src/array-to-hex.ts":{"bytesInOutput":341},"src/index.ts":{"bytesInOutput":0},"src/array.ts":{"bytesInOutput":1805},"src/assume.ts":{"bytesInOutput":31},"src/binder.ts":{"bytesInOutput":149},"src/bitfield.ts":{"bytesInOutput":1881},"src/callback-collection.ts":{"bytesInOutput":558},"src/callback.ts":{"bytesInOutput":1100},"src/case.ts":{"bytesInOutput":940},"src/chunk-array.ts":{"bytesInOutput":173},"src/circular-buffer.ts":{"bytesInOutput":1526},"src/clear-undefined.ts":{"bytesInOutput":223},"src/complex.ts":{"bytesInOutput":4428},"src/deep.ts":{"bytesInOutput":773},"src/defer-function.ts":{"bytesInOutput":72},"src/explicit-resource-management-polyfill.ts":{"bytesInOutput":100},"src/defer.ts":{"bytesInOutput":546},"src/entry.ts":{"bytesInOutput":471},"src/first-two-chars.ts":{"bytesInOutput":715},"src/for-each-async.ts":{"bytesInOutput":62},"src/human-hash.ts":{"bytesInOutput":5662},"src/map.ts":{"bytesInOutput":193},"src/instance-id.ts":{"bytesInOutput":784},"src/interval.ts":{"bytesInOutput":290},"src/join-tables.ts":{"bytesInOutput":493},"src/json.ts":{"bytesInOutput":2956},"src/uint8array.ts":{"bytesInOutput":562},"src/map-values.ts":{"bytesInOutput":2588},"src/object.ts":{"bytesInOutput":82},"src/order-keys.ts":{"bytesInOutput":266},"src/order.ts":{"bytesInOutput":676},"src/pick.ts":{"bytesInOutput":482},"src/platform.ts":{"bytesInOutput":3211},"src/position.ts":{"bytesInOutput":271},"src/random.ts":{"bytesInOutput":148},"src/range.ts":{"bytesInOutput":371},"src/reducers.ts":{"bytesInOutput":2326},"src/remove-undefined-keys.ts":{"bytesInOutput":935},"src/safe-await.ts":{"bytesInOutput":345},"src/safe-instanceof.ts":{"bytesInOutput":371},"src/safe-parse.ts":{"bytesInOutput":488},"src/sliding-window-summary.ts":{"bytesInOutput":1789},"src/sort.ts":{"bytesInOutput":643},"src/string.ts":{"bytesInOutput":129},"src/sum.ts":{"bytesInOutput":57},"src/throw-unhandled-error.ts":{"bytesInOutput":90},"src/to-fallback.ts":{"bytesInOutput":4324},"src/tracer.ts":{"bytesInOutput":1426},"src/tree.ts":{"bytesInOutput":1193},"src/types.ts":{"bytesInOutput":909},"src/url.ts":{"bytesInOutput":246},"src/weak.ts":{"bytesInOutput":2072}},"bytes":55253}}}
|
|
1
|
+
{"inputs":{"src/array-to-hex.ts":{"bytes":2461,"imports":[],"format":"esm"},"src/array.ts":{"bytes":11369,"imports":[],"format":"esm"},"src/assume.ts":{"bytes":1335,"imports":[],"format":"esm"},"src/binder.ts":{"bytes":1310,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true}],"format":"esm"},"src/bitfield.ts":{"bytes":8453,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/callback-collection.ts":{"bytes":3170,"imports":[],"format":"esm"},"src/callback.ts":{"bytes":5204,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/case.ts":{"bytes":4574,"imports":[],"format":"esm"},"src/chunk-array.ts":{"bytes":1195,"imports":[],"format":"esm"},"src/circular-buffer.ts":{"bytes":6257,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/clear-undefined.ts":{"bytes":1554,"imports":[],"format":"esm"},"src/complex.ts":{"bytes":21712,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"src/deep.ts":{"bytes":3983,"imports":[{"path":"lodash.get","kind":"import-statement","external":true},{"path":"lodash.set","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/defer-function.ts":{"bytes":1558,"imports":[],"format":"esm"},"src/explicit-resource-management-polyfill.ts":{"bytes":1429,"imports":[],"format":"esm"},"src/defer.ts":{"bytes":3674,"imports":[{"path":"src/explicit-resource-management-polyfill.ts","kind":"import-statement","original":"./explicit-resource-management-polyfill"}],"format":"esm"},"src/entry.ts":{"bytes":3002,"imports":[],"format":"esm"},"src/for-each-async.ts":{"bytes":785,"imports":[],"format":"esm"},"src/human-hash.ts":{"bytes":19761,"imports":[{"path":"@dxos/keys","kind":"import-statement","external":true}],"format":"esm"},"src/map.ts":{"bytes":1489,"imports":[],"format":"esm"},"src/instance-id.ts":{"bytes":4222,"imports":[{"path":"src/map.ts","kind":"import-statement","original":"./map"}],"format":"esm"},"src/interval.ts":{"bytes":1819,"imports":[],"format":"esm"},"src/join-tables.ts":{"bytes":3063,"imports":[],"format":"esm"},"src/uint8array.ts":{"bytes":3745,"imports":[],"format":"esm"},"src/json.ts":{"bytes":13272,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"src/human-hash.ts","kind":"import-statement","original":"./human-hash"},{"path":"src/uint8array.ts","kind":"import-statement","original":"./uint8array"}],"format":"esm"},"src/map-values.ts":{"bytes":12881,"imports":[],"format":"esm"},"src/no-infer.ts":{"bytes":474,"imports":[],"format":"esm"},"src/object.ts":{"bytes":1070,"imports":[],"format":"esm"},"src/order-keys.ts":{"bytes":1598,"imports":[],"format":"esm"},"src/order.ts":{"bytes":4971,"imports":[],"format":"esm"},"src/pick.ts":{"bytes":3648,"imports":[],"format":"esm"},"src/platform.ts":{"bytes":11239,"imports":[],"format":"esm"},"src/position.ts":{"bytes":2499,"imports":[],"format":"esm"},"src/random.ts":{"bytes":1303,"imports":[],"format":"esm"},"src/range.ts":{"bytes":2611,"imports":[],"format":"esm"},"src/reducers.ts":{"bytes":12812,"imports":[{"path":"src/map.ts","kind":"import-statement","original":"./map"}],"format":"esm"},"src/remove-undefined-keys.ts":{"bytes":4560,"imports":[],"format":"esm"},"src/safe-await.ts":{"bytes":2843,"imports":[],"format":"esm"},"src/safe-instanceof.ts":{"bytes":2680,"imports":[],"format":"esm"},"src/safe-parse.ts":{"bytes":2830,"imports":[],"format":"esm"},"src/sliding-window-summary.ts":{"bytes":7509,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/circular-buffer.ts","kind":"import-statement","original":"./circular-buffer"}],"format":"esm"},"src/sort.ts":{"bytes":3931,"imports":[],"format":"esm"},"src/string.ts":{"bytes":5646,"imports":[],"format":"esm"},"src/sum.ts":{"bytes":675,"imports":[],"format":"esm"},"src/throw-unhandled-error.ts":{"bytes":1163,"imports":[],"format":"esm"},"src/to-fallback.ts":{"bytes":14062,"imports":[],"format":"esm"},"src/tracer.ts":{"bytes":7225,"imports":[{"path":"src/map.ts","kind":"import-statement","original":"./map"}],"format":"esm"},"src/tree.ts":{"bytes":6250,"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"src/types.ts":{"bytes":8504,"imports":[],"format":"esm"},"src/unit.ts":{"bytes":5783,"imports":[],"format":"esm"},"src/url.ts":{"bytes":1627,"imports":[],"format":"esm"},"src/weak.ts":{"bytes":9591,"imports":[],"format":"esm"},"src/index.ts":{"bytes":4965,"imports":[{"path":"src/array-to-hex.ts","kind":"import-statement","original":"./array-to-hex"},{"path":"src/array.ts","kind":"import-statement","original":"./array"},{"path":"src/assume.ts","kind":"import-statement","original":"./assume"},{"path":"src/binder.ts","kind":"import-statement","original":"./binder"},{"path":"src/bitfield.ts","kind":"import-statement","original":"./bitfield"},{"path":"src/callback-collection.ts","kind":"import-statement","original":"./callback-collection"},{"path":"src/callback.ts","kind":"import-statement","original":"./callback"},{"path":"src/case.ts","kind":"import-statement","original":"./case"},{"path":"src/chunk-array.ts","kind":"import-statement","original":"./chunk-array"},{"path":"src/circular-buffer.ts","kind":"import-statement","original":"./circular-buffer"},{"path":"src/clear-undefined.ts","kind":"import-statement","original":"./clear-undefined"},{"path":"src/complex.ts","kind":"import-statement","original":"./complex"},{"path":"src/deep.ts","kind":"import-statement","original":"./deep"},{"path":"src/defer-function.ts","kind":"import-statement","original":"./defer-function"},{"path":"src/defer.ts","kind":"import-statement","original":"./defer"},{"path":"src/entry.ts","kind":"import-statement","original":"./entry"},{"path":"src/for-each-async.ts","kind":"import-statement","original":"./for-each-async"},{"path":"src/human-hash.ts","kind":"import-statement","original":"./human-hash"},{"path":"src/instance-id.ts","kind":"import-statement","original":"./instance-id"},{"path":"src/interval.ts","kind":"import-statement","original":"./interval"},{"path":"src/join-tables.ts","kind":"import-statement","original":"./join-tables"},{"path":"src/json.ts","kind":"import-statement","original":"./json"},{"path":"src/map-values.ts","kind":"import-statement","original":"./map-values"},{"path":"src/map.ts","kind":"import-statement","original":"./map"},{"path":"src/no-infer.ts","kind":"import-statement","original":"./no-infer"},{"path":"src/object.ts","kind":"import-statement","original":"./object"},{"path":"src/order-keys.ts","kind":"import-statement","original":"./order-keys"},{"path":"src/order.ts","kind":"import-statement","original":"./order"},{"path":"src/pick.ts","kind":"import-statement","original":"./pick"},{"path":"src/platform.ts","kind":"import-statement","original":"./platform"},{"path":"src/position.ts","kind":"import-statement","original":"./position"},{"path":"src/random.ts","kind":"import-statement","original":"./random"},{"path":"src/range.ts","kind":"import-statement","original":"./range"},{"path":"src/reducers.ts","kind":"import-statement","original":"./reducers"},{"path":"src/remove-undefined-keys.ts","kind":"import-statement","original":"./remove-undefined-keys"},{"path":"src/safe-await.ts","kind":"import-statement","original":"./safe-await"},{"path":"src/safe-instanceof.ts","kind":"import-statement","original":"./safe-instanceof"},{"path":"src/safe-parse.ts","kind":"import-statement","original":"./safe-parse"},{"path":"src/sliding-window-summary.ts","kind":"import-statement","original":"./sliding-window-summary"},{"path":"src/sort.ts","kind":"import-statement","original":"./sort"},{"path":"src/string.ts","kind":"import-statement","original":"./string"},{"path":"src/sum.ts","kind":"import-statement","original":"./sum"},{"path":"src/throw-unhandled-error.ts","kind":"import-statement","original":"./throw-unhandled-error"},{"path":"src/to-fallback.ts","kind":"import-statement","original":"./to-fallback"},{"path":"src/tracer.ts","kind":"import-statement","original":"./tracer"},{"path":"src/tree.ts","kind":"import-statement","original":"./tree"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/uint8array.ts","kind":"import-statement","original":"./uint8array"},{"path":"src/unit.ts","kind":"import-statement","original":"./unit"},{"path":"src/url.ts","kind":"import-statement","original":"./url"},{"path":"src/weak.ts","kind":"import-statement","original":"./weak"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":133459},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"lodash.get","kind":"import-statement","external":true},{"path":"lodash.set","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true}],"exports":["BitField","Callback","CallbackCollection","CircularBuffer","ComplexMap","ComplexSet","HumanHasher","MapEntry","SlidingWindowSummary","Tracer","Unit","WeakDictionary","accessBy","arrayMove","arrayToBuffer","arrayToHex","arrayToString","arraysEqual","assumeType","bufferToArray","byPosition","capitalize","chunkArray","clamp","clearUndefined","compareMulti","compareObject","compareScalar","compareString","createBinder","createBucketReducer","createGroupReducer","createSetDispatch","createUrl","decamelize","deepMapValues","deepMapValuesAsync","defaultMap","defer","deferAsync","deferFunction","diff","distinctBy","doAsync","entries","entry","exponentialBackoffInterval","forEachAsync","get","getAsyncProviderValue","getDate","getDebugName","getDeep","getHostPlatform","getPrototypeSpecificInstanceId","getProviderValue","hexToEmoji","hexToFallback","hexToHue","humanize","hyphenize","idEmoji","idHue","inferObjectOrder","inferRecordOrder","intersectBy","intersection","iosCheck","isNode","isNonNullable","isTruthy","joinTables","jsonKeyReplacer","jsonReplacer","jsonify","jsonlogify","kebabize","keyToEmoji","keyToFallback","keyToHue","keys","makeMap","makeSet","mapValues","median","mobileAndTabletCheck","numericalValues","omit","orderKeys","partition","pick","pickBy","randomInt","range","rangeFromTo","reduceGroupBy","reduceSeries","reduceSet","removeBy","removeProperties","removeUndefinedProperties","safariCheck","safeAwaitAll","safeInstanceof","safeParseFloat","safeParseInt","safeParseJson","set","setDeep","sortKeys","stringToArray","stringifyTree","stripUndefined","sum","throwUnhandledError","toEmoji","toFallback","toHue","tracer","trim","visitValues"],"entryPoint":"src/index.ts","inputs":{"src/array-to-hex.ts":{"bytesInOutput":341},"src/index.ts":{"bytesInOutput":0},"src/array.ts":{"bytesInOutput":1805},"src/assume.ts":{"bytesInOutput":31},"src/binder.ts":{"bytesInOutput":149},"src/bitfield.ts":{"bytesInOutput":1881},"src/callback-collection.ts":{"bytesInOutput":558},"src/callback.ts":{"bytesInOutput":1113},"src/case.ts":{"bytesInOutput":940},"src/chunk-array.ts":{"bytesInOutput":173},"src/circular-buffer.ts":{"bytesInOutput":1523},"src/clear-undefined.ts":{"bytesInOutput":223},"src/complex.ts":{"bytesInOutput":4440},"src/deep.ts":{"bytesInOutput":773},"src/defer-function.ts":{"bytesInOutput":72},"src/explicit-resource-management-polyfill.ts":{"bytesInOutput":100},"src/defer.ts":{"bytesInOutput":560},"src/entry.ts":{"bytesInOutput":487},"src/for-each-async.ts":{"bytesInOutput":62},"src/human-hash.ts":{"bytesInOutput":5674},"src/map.ts":{"bytesInOutput":193},"src/instance-id.ts":{"bytesInOutput":784},"src/interval.ts":{"bytesInOutput":290},"src/join-tables.ts":{"bytesInOutput":493},"src/json.ts":{"bytesInOutput":2958},"src/uint8array.ts":{"bytesInOutput":562},"src/map-values.ts":{"bytesInOutput":2490},"src/object.ts":{"bytesInOutput":82},"src/order-keys.ts":{"bytesInOutput":266},"src/order.ts":{"bytesInOutput":676},"src/pick.ts":{"bytesInOutput":482},"src/platform.ts":{"bytesInOutput":3211},"src/position.ts":{"bytesInOutput":271},"src/random.ts":{"bytesInOutput":148},"src/range.ts":{"bytesInOutput":371},"src/reducers.ts":{"bytesInOutput":2326},"src/remove-undefined-keys.ts":{"bytesInOutput":935},"src/safe-await.ts":{"bytesInOutput":345},"src/safe-instanceof.ts":{"bytesInOutput":371},"src/safe-parse.ts":{"bytesInOutput":476},"src/sliding-window-summary.ts":{"bytesInOutput":1807},"src/sort.ts":{"bytesInOutput":643},"src/string.ts":{"bytesInOutput":925},"src/sum.ts":{"bytesInOutput":57},"src/throw-unhandled-error.ts":{"bytesInOutput":90},"src/to-fallback.ts":{"bytesInOutput":4324},"src/tracer.ts":{"bytesInOutput":1390},"src/tree.ts":{"bytesInOutput":1193},"src/types.ts":{"bytesInOutput":907},"src/unit.ts":{"bytesInOutput":1308},"src/url.ts":{"bytesInOutput":246},"src/weak.ts":{"bytesInOutput":2054}},"bytes":56545}}}
|
|
@@ -207,6 +207,7 @@ var CallbackCollection = class {
|
|
|
207
207
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
208
208
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/common/util/src/callback.ts";
|
|
209
209
|
var Callback = class {
|
|
210
|
+
_callback;
|
|
210
211
|
call(...args) {
|
|
211
212
|
invariant2(this._callback, "Callback not set", {
|
|
212
213
|
F: __dxlog_file2,
|
|
@@ -301,9 +302,10 @@ var chunkArray = (array, size) => {
|
|
|
301
302
|
import { invariant as invariant3 } from "@dxos/invariant";
|
|
302
303
|
var __dxlog_file3 = "/__w/dxos/dxos/packages/common/util/src/circular-buffer.ts";
|
|
303
304
|
var CircularBuffer = class {
|
|
305
|
+
_buffer;
|
|
306
|
+
_nextIndex = 0;
|
|
307
|
+
_elementCount = 0;
|
|
304
308
|
constructor(size) {
|
|
305
|
-
this._nextIndex = 0;
|
|
306
|
-
this._elementCount = 0;
|
|
307
309
|
invariant3(size >= 1, void 0, {
|
|
308
310
|
F: __dxlog_file3,
|
|
309
311
|
L: 13,
|
|
@@ -374,10 +376,11 @@ import { inspect } from "node:util";
|
|
|
374
376
|
import { inspectObject, raise } from "@dxos/debug";
|
|
375
377
|
var MAX_SERIALIZATION_LENGTH = 10;
|
|
376
378
|
var ComplexSet = class {
|
|
379
|
+
_projection;
|
|
380
|
+
_values = /* @__PURE__ */ new Map();
|
|
377
381
|
// prettier-ignore
|
|
378
382
|
constructor(_projection, values) {
|
|
379
383
|
this._projection = _projection;
|
|
380
|
-
this._values = /* @__PURE__ */ new Map();
|
|
381
384
|
if (values) {
|
|
382
385
|
for (const value of values) {
|
|
383
386
|
this.add(value);
|
|
@@ -467,11 +470,12 @@ var makeSet = (projection) => {
|
|
|
467
470
|
};
|
|
468
471
|
};
|
|
469
472
|
var ComplexMap = class _ComplexMap {
|
|
473
|
+
_keyProjection;
|
|
474
|
+
_keys = /* @__PURE__ */ new Map();
|
|
475
|
+
_values = /* @__PURE__ */ new Map();
|
|
470
476
|
// prettier-ignore
|
|
471
477
|
constructor(_keyProjection, entries2) {
|
|
472
478
|
this._keyProjection = _keyProjection;
|
|
473
|
-
this._keys = /* @__PURE__ */ new Map();
|
|
474
|
-
this._values = /* @__PURE__ */ new Map();
|
|
475
479
|
if (entries2) {
|
|
476
480
|
for (const [key, value] of entries2) {
|
|
477
481
|
this.set(key, value);
|
|
@@ -599,6 +603,7 @@ Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
|
599
603
|
// src/defer.ts
|
|
600
604
|
var defer = (fn) => new DeferGuard(fn);
|
|
601
605
|
var DeferGuard = class {
|
|
606
|
+
_fn;
|
|
602
607
|
/**
|
|
603
608
|
* @internal
|
|
604
609
|
*/
|
|
@@ -614,6 +619,7 @@ var DeferGuard = class {
|
|
|
614
619
|
};
|
|
615
620
|
var deferAsync = (fn) => new DeferAsyncGuard(fn);
|
|
616
621
|
var DeferAsyncGuard = class {
|
|
622
|
+
_fn;
|
|
617
623
|
/**
|
|
618
624
|
* @internal
|
|
619
625
|
*/
|
|
@@ -628,6 +634,8 @@ var DeferAsyncGuard = class {
|
|
|
628
634
|
// src/entry.ts
|
|
629
635
|
var entry = (map, key) => new MapEntry(map, key);
|
|
630
636
|
var MapEntry = class {
|
|
637
|
+
_map;
|
|
638
|
+
_key;
|
|
631
639
|
/**
|
|
632
640
|
* @internal
|
|
633
641
|
*/
|
|
@@ -653,33 +661,6 @@ var MapEntry = class {
|
|
|
653
661
|
}
|
|
654
662
|
};
|
|
655
663
|
|
|
656
|
-
// src/first-two-chars.ts
|
|
657
|
-
var renderableCharRegex = /^(?![\p{Control}\p{Mark}\p{Separator}\p{Surrogate}\p{Unassigned}\p{P}])[\p{L}\p{N}\p{S}\p{Emoji}]$/u;
|
|
658
|
-
var getFirstTwoRenderableChars = (label) => {
|
|
659
|
-
const characters = Array.from(label);
|
|
660
|
-
const result = [
|
|
661
|
-
"",
|
|
662
|
-
""
|
|
663
|
-
];
|
|
664
|
-
let foundFirst = false;
|
|
665
|
-
for (let i = 0; i < characters.length; i++) {
|
|
666
|
-
const char = characters[i];
|
|
667
|
-
if (renderableCharRegex.test(char)) {
|
|
668
|
-
if (!foundFirst) {
|
|
669
|
-
result[0] = char;
|
|
670
|
-
foundFirst = true;
|
|
671
|
-
} else {
|
|
672
|
-
const textBetween = characters.slice(result[0].length, i).join("");
|
|
673
|
-
if (/[^\p{L}\p{N}_]/u.test(textBetween)) {
|
|
674
|
-
result[1] = char;
|
|
675
|
-
break;
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
return result;
|
|
681
|
-
};
|
|
682
|
-
|
|
683
664
|
// src/for-each-async.ts
|
|
684
665
|
var forEachAsync = (items, fn) => Promise.all(items.map(fn));
|
|
685
666
|
|
|
@@ -944,6 +925,7 @@ var DEFAULT_WORDLIST = [
|
|
|
944
925
|
"zulu"
|
|
945
926
|
];
|
|
946
927
|
var HumanHasher = class {
|
|
928
|
+
wordlist;
|
|
947
929
|
/**
|
|
948
930
|
* Transforms hex digests to human-readable strings.
|
|
949
931
|
*
|
|
@@ -1109,7 +1091,7 @@ var arrayToString = (array) => arrayToBuffer(array).toString("hex");
|
|
|
1109
1091
|
// src/json.ts
|
|
1110
1092
|
var MAX_DEPTH = 5;
|
|
1111
1093
|
var LOG_MAX_DEPTH = 7;
|
|
1112
|
-
|
|
1094
|
+
var jsonReplacer = (key, value) => {
|
|
1113
1095
|
if (value !== null && typeof value === "object" && typeof value[inspect2.custom] === "function") {
|
|
1114
1096
|
return value[inspect2.custom]();
|
|
1115
1097
|
}
|
|
@@ -1122,7 +1104,7 @@ function jsonReplacer(key, value) {
|
|
|
1122
1104
|
}
|
|
1123
1105
|
}
|
|
1124
1106
|
return value;
|
|
1125
|
-
}
|
|
1107
|
+
};
|
|
1126
1108
|
var jsonify = (value, depth = 0, visitedObjects = /* @__PURE__ */ new WeakSet()) => {
|
|
1127
1109
|
if (depth > MAX_DEPTH) {
|
|
1128
1110
|
return null;
|
|
@@ -1209,31 +1191,10 @@ var deepMapValues = (value, fn) => {
|
|
|
1209
1191
|
return new DeepMapper(fn).map(value);
|
|
1210
1192
|
};
|
|
1211
1193
|
var DeepMapper = class {
|
|
1194
|
+
_fn;
|
|
1195
|
+
_cyclic = /* @__PURE__ */ new Map();
|
|
1212
1196
|
constructor(_fn) {
|
|
1213
1197
|
this._fn = _fn;
|
|
1214
|
-
this._cyclic = /* @__PURE__ */ new Map();
|
|
1215
|
-
this._recurse = (value) => {
|
|
1216
|
-
if (this._cyclic.has(value)) {
|
|
1217
|
-
return this._cyclic.get(value);
|
|
1218
|
-
}
|
|
1219
|
-
if (Array.isArray(value)) {
|
|
1220
|
-
const res = new Array(value.length);
|
|
1221
|
-
this._cyclic.set(value, res);
|
|
1222
|
-
for (let i = 0; i < value.length; i++) {
|
|
1223
|
-
res[i] = this._map(value[i], i);
|
|
1224
|
-
}
|
|
1225
|
-
return res;
|
|
1226
|
-
} else if (value !== null && typeof value === "object") {
|
|
1227
|
-
const res = {};
|
|
1228
|
-
this._cyclic.set(value, res);
|
|
1229
|
-
for (const key in value) {
|
|
1230
|
-
res[key] = this._map(value[key], key);
|
|
1231
|
-
}
|
|
1232
|
-
return res;
|
|
1233
|
-
} else {
|
|
1234
|
-
return value;
|
|
1235
|
-
}
|
|
1236
|
-
};
|
|
1237
1198
|
}
|
|
1238
1199
|
map(value) {
|
|
1239
1200
|
return this._map(value, void 0);
|
|
@@ -1244,36 +1205,37 @@ var DeepMapper = class {
|
|
|
1244
1205
|
}
|
|
1245
1206
|
return this._fn(value, this._recurse, key);
|
|
1246
1207
|
}
|
|
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);
|
|
1217
|
+
}
|
|
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);
|
|
1224
|
+
}
|
|
1225
|
+
return res;
|
|
1226
|
+
} else {
|
|
1227
|
+
return value;
|
|
1228
|
+
}
|
|
1229
|
+
};
|
|
1247
1230
|
};
|
|
1248
1231
|
var deepMapValuesAsync = (value, fn) => {
|
|
1249
1232
|
return new DeepMapperAsync(fn).map(value);
|
|
1250
1233
|
};
|
|
1251
1234
|
var DeepMapperAsync = class {
|
|
1235
|
+
_fn;
|
|
1236
|
+
_cyclic = /* @__PURE__ */ new Map();
|
|
1252
1237
|
constructor(_fn) {
|
|
1253
1238
|
this._fn = _fn;
|
|
1254
|
-
this._cyclic = /* @__PURE__ */ new Map();
|
|
1255
|
-
this._recurse = async (value) => {
|
|
1256
|
-
if (this._cyclic.has(value)) {
|
|
1257
|
-
return this._cyclic.get(value);
|
|
1258
|
-
}
|
|
1259
|
-
if (Array.isArray(value)) {
|
|
1260
|
-
const res = new Array(value.length);
|
|
1261
|
-
this._cyclic.set(value, res);
|
|
1262
|
-
for (let i = 0; i < value.length; i++) {
|
|
1263
|
-
res[i] = await this._map(value[i], i);
|
|
1264
|
-
}
|
|
1265
|
-
return res;
|
|
1266
|
-
} else if (value !== null && typeof value === "object") {
|
|
1267
|
-
const res = {};
|
|
1268
|
-
this._cyclic.set(value, res);
|
|
1269
|
-
for (const key in value) {
|
|
1270
|
-
res[key] = await this._map(value[key], key);
|
|
1271
|
-
}
|
|
1272
|
-
return res;
|
|
1273
|
-
} else {
|
|
1274
|
-
return value;
|
|
1275
|
-
}
|
|
1276
|
-
};
|
|
1277
1239
|
}
|
|
1278
1240
|
map(value) {
|
|
1279
1241
|
return this._map(value, void 0);
|
|
@@ -1284,6 +1246,28 @@ var DeepMapperAsync = class {
|
|
|
1284
1246
|
}
|
|
1285
1247
|
return this._fn(value, this._recurse, key);
|
|
1286
1248
|
}
|
|
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);
|
|
1258
|
+
}
|
|
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);
|
|
1265
|
+
}
|
|
1266
|
+
return res;
|
|
1267
|
+
} else {
|
|
1268
|
+
return value;
|
|
1269
|
+
}
|
|
1270
|
+
};
|
|
1287
1271
|
};
|
|
1288
1272
|
var visitValues = (object, visitor) => {
|
|
1289
1273
|
if (Array.isArray(object)) {
|
|
@@ -1605,7 +1589,7 @@ var safeParseInt = (value, defaultValue) => {
|
|
|
1605
1589
|
try {
|
|
1606
1590
|
const n = parseInt(value ?? "");
|
|
1607
1591
|
return isNaN(n) ? defaultValue : n;
|
|
1608
|
-
} catch
|
|
1592
|
+
} catch {
|
|
1609
1593
|
return defaultValue;
|
|
1610
1594
|
}
|
|
1611
1595
|
};
|
|
@@ -1620,7 +1604,7 @@ var safeParseJson = (data, defaultValue) => {
|
|
|
1620
1604
|
if (data && data.length > 0) {
|
|
1621
1605
|
try {
|
|
1622
1606
|
return JSON.parse(data);
|
|
1623
|
-
} catch
|
|
1607
|
+
} catch {
|
|
1624
1608
|
}
|
|
1625
1609
|
}
|
|
1626
1610
|
return defaultValue;
|
|
@@ -1630,8 +1614,10 @@ var safeParseJson = (data, defaultValue) => {
|
|
|
1630
1614
|
import { invariant as invariant5 } from "@dxos/invariant";
|
|
1631
1615
|
var __dxlog_file5 = "/__w/dxos/dxos/packages/common/util/src/sliding-window-summary.ts";
|
|
1632
1616
|
var SlidingWindowSummary = class {
|
|
1617
|
+
_buffer;
|
|
1618
|
+
_sum = 0;
|
|
1619
|
+
_precision;
|
|
1633
1620
|
constructor(options) {
|
|
1634
|
-
this._sum = 0;
|
|
1635
1621
|
this._buffer = new CircularBuffer(options.dataPoints);
|
|
1636
1622
|
if (options.precision != null) {
|
|
1637
1623
|
invariant5(options.precision >= 0, void 0, {
|
|
@@ -1711,6 +1697,24 @@ var capitalize = (str) => {
|
|
|
1711
1697
|
}
|
|
1712
1698
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1713
1699
|
};
|
|
1700
|
+
function trim(strings, ...values) {
|
|
1701
|
+
const raw = strings.reduce((out, str, i) => {
|
|
1702
|
+
out += str;
|
|
1703
|
+
if (i < values.length) {
|
|
1704
|
+
const match = str.match(/(^|\n)([ \t]*)$/);
|
|
1705
|
+
const baseIndent = match ? match[2] : "";
|
|
1706
|
+
const val = String(values[i]).replace(/\r?\n/g, "\n" + baseIndent);
|
|
1707
|
+
out += val;
|
|
1708
|
+
}
|
|
1709
|
+
return out;
|
|
1710
|
+
}, "");
|
|
1711
|
+
const lines = raw.split("\n");
|
|
1712
|
+
while (lines.length && !lines[0].trim()) lines.shift();
|
|
1713
|
+
while (lines.length && !lines[lines.length - 1].trim()) lines.pop();
|
|
1714
|
+
const minIndent = Math.min(...lines.filter((l) => l.trim()).map((l) => l.match(/^[ \t]*/)?.[0].length ?? 0));
|
|
1715
|
+
return lines.map((l) => l.slice(minIndent)).join("\n");
|
|
1716
|
+
}
|
|
1717
|
+
var kebabize = (str) => str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? "-" : "") + $.toLowerCase());
|
|
1714
1718
|
|
|
1715
1719
|
// src/sum.ts
|
|
1716
1720
|
var sum = (values) => values.reduce((a, b) => a + b, 0);
|
|
@@ -1909,10 +1913,8 @@ var toFallback = (hash) => {
|
|
|
1909
1913
|
|
|
1910
1914
|
// src/tracer.ts
|
|
1911
1915
|
var Tracer = class {
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
this._recording = false;
|
|
1915
|
-
}
|
|
1916
|
+
_events = /* @__PURE__ */ new Map();
|
|
1917
|
+
_recording = false;
|
|
1916
1918
|
// TODO(burdon): Start/stop methods for recording data? By id?
|
|
1917
1919
|
// Alternatively, enable subscriptions to track/compute series.
|
|
1918
1920
|
// TODO(burdon): Hierarchical traces?
|
|
@@ -2013,7 +2015,7 @@ var stringifyTree = (node, ancestors = [], rows = []) => {
|
|
|
2013
2015
|
};
|
|
2014
2016
|
|
|
2015
2017
|
// src/types.ts
|
|
2016
|
-
var
|
|
2018
|
+
var isTruthy = (value) => !!value;
|
|
2017
2019
|
var isNonNullable = (value) => value != null;
|
|
2018
2020
|
var doAsync = async (fn) => fn();
|
|
2019
2021
|
var getProviderValue = (provider, arg) => {
|
|
@@ -2044,6 +2046,70 @@ var arrayMove = (array, from, to) => {
|
|
|
2044
2046
|
return array;
|
|
2045
2047
|
};
|
|
2046
2048
|
|
|
2049
|
+
// src/unit.ts
|
|
2050
|
+
var Formatter = (unit) => {
|
|
2051
|
+
return (n, precision = 2) => {
|
|
2052
|
+
const value = n / unit.quotient;
|
|
2053
|
+
return `${value.toFixed(precision)}${unit.symbol}`;
|
|
2054
|
+
};
|
|
2055
|
+
};
|
|
2056
|
+
var Unit = {
|
|
2057
|
+
// ms.
|
|
2058
|
+
Hour: Formatter({
|
|
2059
|
+
symbol: "h",
|
|
2060
|
+
quotient: 60 * 60 * 1e3
|
|
2061
|
+
}),
|
|
2062
|
+
Minute: Formatter({
|
|
2063
|
+
symbol: "m",
|
|
2064
|
+
quotient: 60 * 1e3
|
|
2065
|
+
}),
|
|
2066
|
+
Second: Formatter({
|
|
2067
|
+
symbol: "s",
|
|
2068
|
+
quotient: 1e3
|
|
2069
|
+
}),
|
|
2070
|
+
Millisecond: Formatter({
|
|
2071
|
+
symbol: "ms",
|
|
2072
|
+
quotient: 1
|
|
2073
|
+
}),
|
|
2074
|
+
Duration: (n) => {
|
|
2075
|
+
const hours = Math.floor(n / (60 * 60 * 1e3));
|
|
2076
|
+
const minutes = Math.floor(n % (60 * 60 * 1e3) / (60 * 1e3));
|
|
2077
|
+
if (hours) {
|
|
2078
|
+
return minutes ? `${hours}h ${minutes}m` : `${hours}h`;
|
|
2079
|
+
}
|
|
2080
|
+
const seconds = Math.floor(n % (60 * 1e3) / 1e3);
|
|
2081
|
+
if (minutes) {
|
|
2082
|
+
return seconds ? `${minutes}m ${seconds}s` : `${minutes}m`;
|
|
2083
|
+
}
|
|
2084
|
+
if (seconds) {
|
|
2085
|
+
return `${(n / 1e3).toFixed(1)}s`;
|
|
2086
|
+
}
|
|
2087
|
+
return `${n}ms`;
|
|
2088
|
+
},
|
|
2089
|
+
// bytes (note KB via KiB).
|
|
2090
|
+
Gigabyte: Formatter({
|
|
2091
|
+
symbol: "GB",
|
|
2092
|
+
quotient: 1e3 * 1e3 * 1e3
|
|
2093
|
+
}),
|
|
2094
|
+
Megabyte: Formatter({
|
|
2095
|
+
symbol: "MB",
|
|
2096
|
+
quotient: 1e3 * 1e3
|
|
2097
|
+
}),
|
|
2098
|
+
Kilobyte: Formatter({
|
|
2099
|
+
symbol: "KB",
|
|
2100
|
+
quotient: 1e3
|
|
2101
|
+
}),
|
|
2102
|
+
// general.
|
|
2103
|
+
Thousand: Formatter({
|
|
2104
|
+
symbol: "k",
|
|
2105
|
+
quotient: 1e3
|
|
2106
|
+
}),
|
|
2107
|
+
Percent: Formatter({
|
|
2108
|
+
symbol: "%",
|
|
2109
|
+
quotient: 1 / 100
|
|
2110
|
+
})
|
|
2111
|
+
};
|
|
2112
|
+
|
|
2047
2113
|
// src/url.ts
|
|
2048
2114
|
var createUrl = (url, search) => {
|
|
2049
2115
|
const base = typeof url === "string" ? new URL(url) : url;
|
|
@@ -2055,11 +2121,11 @@ var createUrl = (url, search) => {
|
|
|
2055
2121
|
|
|
2056
2122
|
// src/weak.ts
|
|
2057
2123
|
var WeakDictionary = class {
|
|
2124
|
+
_internal = /* @__PURE__ */ new Map();
|
|
2125
|
+
_finalization = new FinalizationRegistry((cleanUpCallback) => {
|
|
2126
|
+
cleanUpCallback();
|
|
2127
|
+
});
|
|
2058
2128
|
constructor(entries2) {
|
|
2059
|
-
this._internal = /* @__PURE__ */ new Map();
|
|
2060
|
-
this._finalization = new FinalizationRegistry((cleanUpCallback) => {
|
|
2061
|
-
cleanUpCallback();
|
|
2062
|
-
});
|
|
2063
2129
|
this._internal = new Map(entries2?.map(([key, value]) => [
|
|
2064
2130
|
key,
|
|
2065
2131
|
new WeakRef(value)
|
|
@@ -2158,6 +2224,7 @@ export {
|
|
|
2158
2224
|
MapEntry,
|
|
2159
2225
|
SlidingWindowSummary,
|
|
2160
2226
|
Tracer,
|
|
2227
|
+
Unit,
|
|
2161
2228
|
WeakDictionary,
|
|
2162
2229
|
accessBy,
|
|
2163
2230
|
arrayMove,
|
|
@@ -2200,7 +2267,6 @@ export {
|
|
|
2200
2267
|
getDate,
|
|
2201
2268
|
getDebugName,
|
|
2202
2269
|
getDeep,
|
|
2203
|
-
getFirstTwoRenderableChars,
|
|
2204
2270
|
getHostPlatform,
|
|
2205
2271
|
getPrototypeSpecificInstanceId,
|
|
2206
2272
|
getProviderValue,
|
|
@@ -2218,12 +2284,13 @@ export {
|
|
|
2218
2284
|
iosCheck,
|
|
2219
2285
|
isNode,
|
|
2220
2286
|
isNonNullable,
|
|
2221
|
-
|
|
2287
|
+
isTruthy,
|
|
2222
2288
|
joinTables,
|
|
2223
2289
|
jsonKeyReplacer,
|
|
2224
2290
|
jsonReplacer,
|
|
2225
2291
|
jsonify,
|
|
2226
2292
|
jsonlogify,
|
|
2293
|
+
kebabize,
|
|
2227
2294
|
keyToEmoji,
|
|
2228
2295
|
keyToFallback,
|
|
2229
2296
|
keyToHue,
|
|
@@ -2266,6 +2333,7 @@ export {
|
|
|
2266
2333
|
toFallback,
|
|
2267
2334
|
toHue,
|
|
2268
2335
|
tracer,
|
|
2336
|
+
trim,
|
|
2269
2337
|
visitValues
|
|
2270
2338
|
};
|
|
2271
2339
|
//# sourceMappingURL=index.mjs.map
|