@fireproof/vendor 0.0.0-smoke → 0.0.2-dev-test
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/merge-package.ts +207 -0
- package/p-limit/index.d.ts +81 -0
- package/p-limit/index.js +104 -0
- package/p-limit/index.test-d.ts +19 -0
- package/p-limit/license +9 -0
- package/p-limit/package.json +59 -0
- package/p-limit/readme.md +128 -0
- package/p-limit/test.js +241 -0
- package/package.json +12 -9
- package/to-esm-transform.ts +42 -0
- package/patched/@ipld/dag-json/.github/dependabot.yml +0 -11
- package/patched/@ipld/dag-json/.github/workflows/js-test-and-release.yml +0 -28
- package/patched/@ipld/dag-json/CHANGELOG.md +0 -202
- package/patched/@ipld/dag-json/LICENSE +0 -4
- package/patched/@ipld/dag-json/LICENSE-APACHE +0 -5
- package/patched/@ipld/dag-json/LICENSE-MIT +0 -19
- package/patched/@ipld/dag-json/README.md +0 -58
- package/patched/@ipld/dag-json/ipld-dag-json-10.2.3.tgz +0 -0
- package/patched/@ipld/dag-json/package.json +0 -173
- package/patched/@ipld/dag-json/src/index.js +0 -291
- package/patched/@ipld/dag-json/test/test-basics.spec.js +0 -290
- package/patched/@ipld/dag-json/test/ts-use/package.json +0 -11
- package/patched/@ipld/dag-json/test/ts-use/src/main.ts +0 -54
- package/patched/@ipld/dag-json/test/ts-use/tsconfig.json +0 -9
- package/patched/@ipld/dag-json/tsconfig.json +0 -14
- package/patched/cborg/.github/dependabot.yml +0 -16
- package/patched/cborg/.github/workflows/test-and-release.yml +0 -52
- package/patched/cborg/CHANGELOG.md +0 -513
- package/patched/cborg/LICENSE +0 -13
- package/patched/cborg/README.md +0 -515
- package/patched/cborg/bench/bench.js +0 -117
- package/patched/cborg/bench/json.js +0 -124
- package/patched/cborg/bench/package.json +0 -8
- package/patched/cborg/cborg-4.2.7.tgz +0 -0
- package/patched/cborg/cborg.js +0 -31
- package/patched/cborg/example-bytestrings.js +0 -180
- package/patched/cborg/example-json.js +0 -6
- package/patched/cborg/example.js +0 -5
- package/patched/cborg/interface.ts +0 -56
- package/patched/cborg/lib/0uint.js +0 -227
- package/patched/cborg/lib/1negint.js +0 -111
- package/patched/cborg/lib/2bytes.js +0 -133
- package/patched/cborg/lib/3string.js +0 -90
- package/patched/cborg/lib/4array.js +0 -113
- package/patched/cborg/lib/5map.js +0 -113
- package/patched/cborg/lib/6tag.js +0 -80
- package/patched/cborg/lib/7float.js +0 -308
- package/patched/cborg/lib/bin.js +0 -189
- package/patched/cborg/lib/bl.js +0 -124
- package/patched/cborg/lib/byte-utils.js +0 -417
- package/patched/cborg/lib/common.js +0 -27
- package/patched/cborg/lib/decode.js +0 -209
- package/patched/cborg/lib/diagnostic.js +0 -156
- package/patched/cborg/lib/diagnostic_test.js +0 -117
- package/patched/cborg/lib/encode.js +0 -464
- package/patched/cborg/lib/is.js +0 -106
- package/patched/cborg/lib/json/decode.js +0 -462
- package/patched/cborg/lib/json/encode.js +0 -299
- package/patched/cborg/lib/json/json.js +0 -4
- package/patched/cborg/lib/jump.js +0 -209
- package/patched/cborg/lib/length.js +0 -61
- package/patched/cborg/lib/token.js +0 -76
- package/patched/cborg/package.json +0 -169
- package/patched/cborg/pnpm-lock.yaml +0 -6096
- package/patched/cborg/taglib.js +0 -73
- package/patched/cborg/test/appendix_a.js +0 -647
- package/patched/cborg/test/common.js +0 -18
- package/patched/cborg/test/node-test-bin.js +0 -402
- package/patched/cborg/test/noop-bin-test.js +0 -3
- package/patched/cborg/test/test-0uint.js +0 -103
- package/patched/cborg/test/test-1negint.js +0 -96
- package/patched/cborg/test/test-2bytes.js +0 -198
- package/patched/cborg/test/test-3string.js +0 -136
- package/patched/cborg/test/test-4array.js +0 -93
- package/patched/cborg/test/test-5map.js +0 -284
- package/patched/cborg/test/test-6tag.js +0 -85
- package/patched/cborg/test/test-7float.js +0 -131
- package/patched/cborg/test/test-bl.js +0 -37
- package/patched/cborg/test/test-cbor-vectors.js +0 -107
- package/patched/cborg/test/test-decode-errors.js +0 -65
- package/patched/cborg/test/test-fuzz.js +0 -42
- package/patched/cborg/test/test-json.js +0 -219
- package/patched/cborg/test/test-length.js +0 -65
- package/patched/cborg/test/test-partial.js +0 -111
- package/patched/cborg/tsconfig.json +0 -45
- package/patched/cborg/types/cborg.d.ts +0 -28
- package/patched/cborg/types/cborg.d.ts.map +0 -1
- package/patched/cborg/types/example.d.ts +0 -2
- package/patched/cborg/types/example.d.ts.map +0 -1
- package/patched/cborg/types/interface.d.ts +0 -47
- package/patched/cborg/types/interface.d.ts.map +0 -1
- package/patched/cborg/types/lib/0uint.d.ts +0 -100
- package/patched/cborg/types/lib/0uint.d.ts.map +0 -1
- package/patched/cborg/types/lib/1negint.d.ts +0 -58
- package/patched/cborg/types/lib/1negint.d.ts.map +0 -1
- package/patched/cborg/types/lib/2bytes.d.ts +0 -68
- package/patched/cborg/types/lib/2bytes.d.ts.map +0 -1
- package/patched/cborg/types/lib/3string.d.ts +0 -46
- package/patched/cborg/types/lib/3string.d.ts.map +0 -1
- package/patched/cborg/types/lib/4array.d.ts +0 -65
- package/patched/cborg/types/lib/4array.d.ts.map +0 -1
- package/patched/cborg/types/lib/5map.d.ts +0 -65
- package/patched/cborg/types/lib/5map.d.ts.map +0 -1
- package/patched/cborg/types/lib/6tag.d.ts +0 -61
- package/patched/cborg/types/lib/6tag.d.ts.map +0 -1
- package/patched/cborg/types/lib/7float.d.ts +0 -60
- package/patched/cborg/types/lib/7float.d.ts.map +0 -1
- package/patched/cborg/types/lib/bin.d.ts +0 -4
- package/patched/cborg/types/lib/bin.d.ts.map +0 -1
- package/patched/cborg/types/lib/bl.d.ts +0 -26
- package/patched/cborg/types/lib/bl.d.ts.map +0 -1
- package/patched/cborg/types/lib/byte-utils.d.ts +0 -53
- package/patched/cborg/types/lib/byte-utils.d.ts.map +0 -1
- package/patched/cborg/types/lib/common.d.ts +0 -10
- package/patched/cborg/types/lib/common.d.ts.map +0 -1
- package/patched/cborg/types/lib/decode.d.ts +0 -41
- package/patched/cborg/types/lib/decode.d.ts.map +0 -1
- package/patched/cborg/types/lib/diagnostic.d.ts +0 -12
- package/patched/cborg/types/lib/diagnostic.d.ts.map +0 -1
- package/patched/cborg/types/lib/diagnostic_test.d.ts +0 -2
- package/patched/cborg/types/lib/diagnostic_test.d.ts.map +0 -1
- package/patched/cborg/types/lib/encode.d.ts +0 -50
- package/patched/cborg/types/lib/encode.d.ts.map +0 -1
- package/patched/cborg/types/lib/is.d.ts +0 -6
- package/patched/cborg/types/lib/is.d.ts.map +0 -1
- package/patched/cborg/types/lib/json/decode.d.ts +0 -67
- package/patched/cborg/types/lib/json/decode.d.ts.map +0 -1
- package/patched/cborg/types/lib/json/encode.d.ts +0 -11
- package/patched/cborg/types/lib/json/encode.d.ts.map +0 -1
- package/patched/cborg/types/lib/json/forward-cborg.d.ts +0 -6
- package/patched/cborg/types/lib/json/forward-cborg.d.ts.map +0 -1
- package/patched/cborg/types/lib/json/json.d.ts +0 -6
- package/patched/cborg/types/lib/json/json.d.ts.map +0 -1
- package/patched/cborg/types/lib/jump.d.ts +0 -12
- package/patched/cborg/types/lib/jump.d.ts.map +0 -1
- package/patched/cborg/types/lib/length.d.ts +0 -27
- package/patched/cborg/types/lib/length.d.ts.map +0 -1
- package/patched/cborg/types/lib/token.d.ts +0 -59
- package/patched/cborg/types/lib/token.d.ts.map +0 -1
- package/patched/cborg/types/taglib.d.ts +0 -18
- package/patched/cborg/types/taglib.d.ts.map +0 -1
- package/patched/cborg/types/tsconfig.tsbuildinfo +0 -1
- package/src/@ipld/car/car/LICENSE +0 -4
- package/src/@ipld/car/car/README.md +0 -1078
- package/src/@ipld/car/car/dist/index.min.js +0 -5
- package/src/@ipld/car/car/dist/src/api.d.ts +0 -72
- package/src/@ipld/car/car/dist/src/api.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/buffer-decoder.d.ts +0 -67
- package/src/@ipld/car/car/dist/src/buffer-decoder.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/buffer-reader-browser.d.ts +0 -116
- package/src/@ipld/car/car/dist/src/buffer-reader-browser.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/buffer-reader.d.ts +0 -31
- package/src/@ipld/car/car/dist/src/buffer-reader.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/buffer-writer.d.ts +0 -86
- package/src/@ipld/car/car/dist/src/buffer-writer.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/coding.d.ts +0 -49
- package/src/@ipld/car/car/dist/src/coding.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/decoder-common.d.ts +0 -43
- package/src/@ipld/car/car/dist/src/decoder-common.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/decoder.d.ts +0 -87
- package/src/@ipld/car/car/dist/src/decoder.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/encoder.d.ts +0 -17
- package/src/@ipld/car/car/dist/src/encoder.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/header-validator.d.ts +0 -5
- package/src/@ipld/car/car/dist/src/header-validator.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/index-browser.d.ts +0 -10
- package/src/@ipld/car/car/dist/src/index-browser.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/index.d.ts +0 -11
- package/src/@ipld/car/car/dist/src/index.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/indexed-reader-browser.d.ts +0 -5
- package/src/@ipld/car/car/dist/src/indexed-reader-browser.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/indexed-reader.d.ts +0 -152
- package/src/@ipld/car/car/dist/src/indexed-reader.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/indexer.d.ts +0 -95
- package/src/@ipld/car/car/dist/src/indexer.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/iterator-channel.d.ts +0 -7
- package/src/@ipld/car/car/dist/src/iterator-channel.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/iterator.d.ts +0 -174
- package/src/@ipld/car/car/dist/src/iterator.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/reader-browser.d.ts +0 -151
- package/src/@ipld/car/car/dist/src/reader-browser.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/reader.d.ts +0 -35
- package/src/@ipld/car/car/dist/src/reader.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/writer-browser.d.ts +0 -155
- package/src/@ipld/car/car/dist/src/writer-browser.d.ts.map +0 -1
- package/src/@ipld/car/car/dist/src/writer.d.ts +0 -45
- package/src/@ipld/car/car/dist/src/writer.d.ts.map +0 -1
- package/src/@ipld/car/car/node_modules/.bin/cborg +0 -17
- package/src/@ipld/car/car/package.json +0 -235
- package/src/@ipld/car/car/src/api.ts +0 -90
- package/src/@ipld/car/car/src/buffer-decoder.js +0 -213
- package/src/@ipld/car/car/src/buffer-reader-browser.js +0 -144
- package/src/@ipld/car/car/src/buffer-reader.js +0 -51
- package/src/@ipld/car/car/src/buffer-writer.js +0 -286
- package/src/@ipld/car/car/src/coding.ts +0 -68
- package/src/@ipld/car/car/src/decoder-common.js +0 -82
- package/src/@ipld/car/car/src/decoder.js +0 -347
- package/src/@ipld/car/car/src/encoder.js +0 -76
- package/src/@ipld/car/car/src/header-validator.js +0 -214
- package/src/@ipld/car/car/src/header.ipldsch +0 -18
- package/src/@ipld/car/car/src/index-browser.js +0 -18
- package/src/@ipld/car/car/src/index.js +0 -21
- package/src/@ipld/car/car/src/indexed-reader-browser.js +0 -7
- package/src/@ipld/car/car/src/indexed-reader.js +0 -211
- package/src/@ipld/car/car/src/indexer.js +0 -130
- package/src/@ipld/car/car/src/iterator-channel.js +0 -91
- package/src/@ipld/car/car/src/iterator.js +0 -267
- package/src/@ipld/car/car/src/reader-browser.js +0 -194
- package/src/@ipld/car/car/src/reader.js +0 -56
- package/src/@ipld/car/car/src/writer-browser.js +0 -250
- package/src/@ipld/car/car/src/writer.js +0 -84
- package/src/@ipld/dag-cbor/dag-cbor/LICENSE +0 -4
- package/src/@ipld/dag-cbor/dag-cbor/README.md +0 -80
- package/src/@ipld/dag-cbor/dag-cbor/dist/index.min.js +0 -3
- package/src/@ipld/dag-cbor/dag-cbor/dist/src/index.d.ts +0 -67
- package/src/@ipld/dag-cbor/dag-cbor/dist/src/index.d.ts.map +0 -1
- package/src/@ipld/dag-cbor/dag-cbor/node_modules/.bin/cborg +0 -17
- package/src/@ipld/dag-cbor/dag-cbor/package.json +0 -171
- package/src/@ipld/dag-cbor/dag-cbor/src/index.js +0 -147
- package/src/@ipld/dag-json/dag-json/LICENSE +0 -4
- package/src/@ipld/dag-json/dag-json/README.md +0 -58
- package/src/@ipld/dag-json/dag-json/dist/index.min.js +0 -3
- package/src/@ipld/dag-json/dag-json/dist/src/index.d.ts +0 -12
- package/src/@ipld/dag-json/dag-json/dist/src/index.d.ts.map +0 -1
- package/src/@ipld/dag-json/dag-json/node_modules/.bin/cborg +0 -17
- package/src/@ipld/dag-json/dag-json/package.json +0 -173
- package/src/@ipld/dag-json/dag-json/src/index.js +0 -291
- package/src/@web3-storage/pail/pail/LICENSE.md +0 -232
- package/src/@web3-storage/pail/pail/README.md +0 -84
- package/src/@web3-storage/pail/pail/cli.js +0 -218
- package/src/@web3-storage/pail/pail/dist/src/api.d.ts +0 -59
- package/src/@web3-storage/pail/pail/dist/src/api.d.ts.map +0 -1
- package/src/@web3-storage/pail/pail/dist/src/batch/api.d.ts +0 -31
- package/src/@web3-storage/pail/pail/dist/src/batch/api.d.ts.map +0 -1
- package/src/@web3-storage/pail/pail/dist/src/batch/index.d.ts +0 -75
- package/src/@web3-storage/pail/pail/dist/src/batch/index.d.ts.map +0 -1
- package/src/@web3-storage/pail/pail/dist/src/batch/shard.d.ts +0 -3
- package/src/@web3-storage/pail/pail/dist/src/batch/shard.d.ts.map +0 -1
- package/src/@web3-storage/pail/pail/dist/src/block.d.ts +0 -35
- package/src/@web3-storage/pail/pail/dist/src/block.d.ts.map +0 -1
- package/src/@web3-storage/pail/pail/dist/src/clock/api.d.ts +0 -10
- package/src/@web3-storage/pail/pail/dist/src/clock/api.d.ts.map +0 -1
- package/src/@web3-storage/pail/pail/dist/src/clock/index.d.ts +0 -48
- package/src/@web3-storage/pail/pail/dist/src/clock/index.d.ts.map +0 -1
- package/src/@web3-storage/pail/pail/dist/src/crdt/api.d.ts +0 -26
- package/src/@web3-storage/pail/pail/dist/src/crdt/api.d.ts.map +0 -1
- package/src/@web3-storage/pail/pail/dist/src/crdt/batch/api.d.ts +0 -11
- package/src/@web3-storage/pail/pail/dist/src/crdt/batch/api.d.ts.map +0 -1
- package/src/@web3-storage/pail/pail/dist/src/crdt/batch/index.d.ts +0 -5
- package/src/@web3-storage/pail/pail/dist/src/crdt/batch/index.d.ts.map +0 -1
- package/src/@web3-storage/pail/pail/dist/src/crdt/index.d.ts +0 -9
- package/src/@web3-storage/pail/pail/dist/src/crdt/index.d.ts.map +0 -1
- package/src/@web3-storage/pail/pail/dist/src/diff.d.ts +0 -13
- package/src/@web3-storage/pail/pail/dist/src/diff.d.ts.map +0 -1
- package/src/@web3-storage/pail/pail/dist/src/index.d.ts +0 -10
- package/src/@web3-storage/pail/pail/dist/src/index.d.ts.map +0 -1
- package/src/@web3-storage/pail/pail/dist/src/merge.d.ts +0 -5
- package/src/@web3-storage/pail/pail/dist/src/merge.d.ts.map +0 -1
- package/src/@web3-storage/pail/pail/dist/src/shard.d.ts +0 -43
- package/src/@web3-storage/pail/pail/dist/src/shard.d.ts.map +0 -1
- package/src/@web3-storage/pail/pail/dist/tsconfig.tsbuildinfo +0 -1
- package/src/@web3-storage/pail/pail/node_modules/.bin/pail +0 -17
- package/src/@web3-storage/pail/pail/package.json +0 -173
- package/src/@web3-storage/pail/pail/src/api.js +0 -1
- package/src/@web3-storage/pail/pail/src/api.ts +0 -90
- package/src/@web3-storage/pail/pail/src/batch/api.js +0 -1
- package/src/@web3-storage/pail/pail/src/batch/api.ts +0 -59
- package/src/@web3-storage/pail/pail/src/batch/index.js +0 -258
- package/src/@web3-storage/pail/pail/src/batch/shard.js +0 -13
- package/src/@web3-storage/pail/pail/src/block.js +0 -75
- package/src/@web3-storage/pail/pail/src/clock/api.js +0 -1
- package/src/@web3-storage/pail/pail/src/clock/api.ts +0 -12
- package/src/@web3-storage/pail/pail/src/clock/index.js +0 -182
- package/src/@web3-storage/pail/pail/src/crdt/api.js +0 -1
- package/src/@web3-storage/pail/pail/src/crdt/api.ts +0 -33
- package/src/@web3-storage/pail/pail/src/crdt/batch/api.js +0 -1
- package/src/@web3-storage/pail/pail/src/crdt/batch/api.ts +0 -30
- package/src/@web3-storage/pail/pail/src/crdt/batch/index.js +0 -155
- package/src/@web3-storage/pail/pail/src/crdt/index.js +0 -354
- package/src/@web3-storage/pail/pail/src/diff.js +0 -151
- package/src/@web3-storage/pail/pail/src/index.js +0 -406
- package/src/@web3-storage/pail/pail/src/merge.js +0 -43
- package/src/@web3-storage/pail/pail/src/shard.js +0 -180
- package/src/cborg/cborg/.github/dependabot.yml +0 -16
- package/src/cborg/cborg/.github/workflows/test-and-release.yml +0 -52
- package/src/cborg/cborg/CHANGELOG.md +0 -513
- package/src/cborg/cborg/LICENSE +0 -13
- package/src/cborg/cborg/README.md +0 -515
- package/src/cborg/cborg/bench/bench.js +0 -117
- package/src/cborg/cborg/bench/json.js +0 -124
- package/src/cborg/cborg/bench/package.json +0 -8
- package/src/cborg/cborg/cborg.js +0 -31
- package/src/cborg/cborg/example-bytestrings.js +0 -180
- package/src/cborg/cborg/example-json.js +0 -6
- package/src/cborg/cborg/example.js +0 -5
- package/src/cborg/cborg/interface.ts +0 -56
- package/src/cborg/cborg/lib/0uint.js +0 -227
- package/src/cborg/cborg/lib/1negint.js +0 -111
- package/src/cborg/cborg/lib/2bytes.js +0 -133
- package/src/cborg/cborg/lib/3string.js +0 -90
- package/src/cborg/cborg/lib/4array.js +0 -113
- package/src/cborg/cborg/lib/5map.js +0 -113
- package/src/cborg/cborg/lib/6tag.js +0 -80
- package/src/cborg/cborg/lib/7float.js +0 -308
- package/src/cborg/cborg/lib/bin.js +0 -189
- package/src/cborg/cborg/lib/bl.js +0 -124
- package/src/cborg/cborg/lib/byte-utils.js +0 -417
- package/src/cborg/cborg/lib/common.js +0 -27
- package/src/cborg/cborg/lib/decode.js +0 -209
- package/src/cborg/cborg/lib/diagnostic.js +0 -156
- package/src/cborg/cborg/lib/diagnostic_test.js +0 -117
- package/src/cborg/cborg/lib/encode.js +0 -464
- package/src/cborg/cborg/lib/is.js +0 -106
- package/src/cborg/cborg/lib/json/decode.js +0 -462
- package/src/cborg/cborg/lib/json/encode.js +0 -299
- package/src/cborg/cborg/lib/json/json.js +0 -4
- package/src/cborg/cborg/lib/jump.js +0 -209
- package/src/cborg/cborg/lib/length.js +0 -61
- package/src/cborg/cborg/lib/token.js +0 -76
- package/src/cborg/cborg/node_modules/.bin/cborg +0 -17
- package/src/cborg/cborg/package.json +0 -168
- package/src/cborg/cborg/taglib.js +0 -73
- package/src/cborg/cborg/test/appendix_a.js +0 -647
- package/src/cborg/cborg/test/common.js +0 -18
- package/src/cborg/cborg/test/node-test-bin.js +0 -402
- package/src/cborg/cborg/test/noop-bin-test.js +0 -3
- package/src/cborg/cborg/test/test-0uint.js +0 -103
- package/src/cborg/cborg/test/test-1negint.js +0 -96
- package/src/cborg/cborg/test/test-2bytes.js +0 -198
- package/src/cborg/cborg/test/test-3string.js +0 -136
- package/src/cborg/cborg/test/test-4array.js +0 -93
- package/src/cborg/cborg/test/test-5map.js +0 -284
- package/src/cborg/cborg/test/test-6tag.js +0 -85
- package/src/cborg/cborg/test/test-7float.js +0 -131
- package/src/cborg/cborg/test/test-bl.js +0 -37
- package/src/cborg/cborg/test/test-cbor-vectors.js +0 -107
- package/src/cborg/cborg/test/test-decode-errors.js +0 -65
- package/src/cborg/cborg/test/test-fuzz.js +0 -42
- package/src/cborg/cborg/test/test-json.js +0 -219
- package/src/cborg/cborg/test/test-length.js +0 -65
- package/src/cborg/cborg/test/test-partial.js +0 -111
- package/src/cborg/cborg/tsconfig.json +0 -45
- package/src/cborg/cborg/types/cborg.d.ts +0 -28
- package/src/cborg/cborg/types/cborg.d.ts.map +0 -1
- package/src/cborg/cborg/types/example.d.ts +0 -2
- package/src/cborg/cborg/types/example.d.ts.map +0 -1
- package/src/cborg/cborg/types/interface.d.ts +0 -47
- package/src/cborg/cborg/types/interface.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/0uint.d.ts +0 -100
- package/src/cborg/cborg/types/lib/0uint.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/1negint.d.ts +0 -58
- package/src/cborg/cborg/types/lib/1negint.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/2bytes.d.ts +0 -68
- package/src/cborg/cborg/types/lib/2bytes.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/3string.d.ts +0 -46
- package/src/cborg/cborg/types/lib/3string.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/4array.d.ts +0 -65
- package/src/cborg/cborg/types/lib/4array.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/5map.d.ts +0 -65
- package/src/cborg/cborg/types/lib/5map.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/6tag.d.ts +0 -61
- package/src/cborg/cborg/types/lib/6tag.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/7float.d.ts +0 -60
- package/src/cborg/cborg/types/lib/7float.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/bin.d.ts +0 -4
- package/src/cborg/cborg/types/lib/bin.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/bl.d.ts +0 -26
- package/src/cborg/cborg/types/lib/bl.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/byte-utils.d.ts +0 -53
- package/src/cborg/cborg/types/lib/byte-utils.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/common.d.ts +0 -10
- package/src/cborg/cborg/types/lib/common.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/decode.d.ts +0 -41
- package/src/cborg/cborg/types/lib/decode.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/diagnostic.d.ts +0 -12
- package/src/cborg/cborg/types/lib/diagnostic.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/diagnostic_test.d.ts +0 -2
- package/src/cborg/cborg/types/lib/diagnostic_test.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/encode.d.ts +0 -50
- package/src/cborg/cborg/types/lib/encode.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/is.d.ts +0 -6
- package/src/cborg/cborg/types/lib/is.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/json/decode.d.ts +0 -67
- package/src/cborg/cborg/types/lib/json/decode.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/json/encode.d.ts +0 -11
- package/src/cborg/cborg/types/lib/json/encode.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/json/forward-cborg.d.ts +0 -6
- package/src/cborg/cborg/types/lib/json/forward-cborg.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/json/json.d.ts +0 -6
- package/src/cborg/cborg/types/lib/json/json.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/jump.d.ts +0 -12
- package/src/cborg/cborg/types/lib/jump.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/length.d.ts +0 -27
- package/src/cborg/cborg/types/lib/length.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/token.d.ts +0 -59
- package/src/cborg/cborg/types/lib/token.d.ts.map +0 -1
- package/src/cborg/cborg/types/taglib.d.ts +0 -18
- package/src/cborg/cborg/types/taglib.d.ts.map +0 -1
- package/src/cborg/cborg/types/tsconfig.tsbuildinfo +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/LICENSE +0 -4
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/README.md +0 -105
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/index.min.js +0 -3
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/errors.d.ts +0 -57
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/errors.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/errors.js +0 -73
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/errors.js.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/index.d.ts +0 -355
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/index.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/index.js +0 -197
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/index.js.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.js +0 -9
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.js.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.js +0 -9
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.js.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/identity.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/identity.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/identity.js +0 -38
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/identity.js.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/index.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/index.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/index.js +0 -30
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/index.js.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/json.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/json.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/json.js +0 -9
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/json.js.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/raw.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/raw.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/raw.js +0 -37
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/raw.js.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.js +0 -29
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.js.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.js +0 -153
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.js.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.js +0 -59
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.js.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.js +0 -25
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.js.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.js +0 -104
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.js.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.d.ts +0 -3
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.js +0 -20
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.js.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.d.ts +0 -6
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.js +0 -116
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.js.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.js +0 -57
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.js.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.d.ts +0 -6
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.js +0 -30
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.js.map +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/typedoc-urls.json +0 -58
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/package.json +0 -180
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/errors.ts +0 -87
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/index.ts +0 -498
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/dag-cbor.ts +0 -12
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/dag-json.ts +0 -12
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/identity.ts +0 -49
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/index.ts +0 -35
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/json.ts +0 -12
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/raw.ts +0 -49
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/directory.ts +0 -39
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/file.ts +0 -198
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/hamt-sharded-directory.ts +0 -76
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/raw.ts +0 -37
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/index.ts +0 -121
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/utils/extract-data-from-block.ts +0 -24
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/utils/find-cid-in-shard.ts +0 -149
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/utils/resolve-object-path.ts +0 -62
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/utils/validate-offset-and-length.ts +0 -38
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ShardDiff, ShardLink, UnknownLink } from '../api.js'
|
|
2
|
-
import { EventLink, EventBlockView } from '../clock/api.js'
|
|
3
|
-
|
|
4
|
-
export { BlockFetcher, UnknownLink, ShardBlockView, ShardDiff, ShardLink, EntriesOptions } from '../api.js'
|
|
5
|
-
export { EventBlockView, EventLink } from '../clock/api.js'
|
|
6
|
-
|
|
7
|
-
export interface Result extends ShardDiff {
|
|
8
|
-
root: ShardLink
|
|
9
|
-
head: EventLink<Operation>[]
|
|
10
|
-
event?: EventBlockView<Operation>
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type Operation = (
|
|
14
|
-
| PutOperation
|
|
15
|
-
| DeleteOperation
|
|
16
|
-
| BatchOperation
|
|
17
|
-
) & { root: ShardLink }
|
|
18
|
-
|
|
19
|
-
export interface PutOperation {
|
|
20
|
-
type: 'put',
|
|
21
|
-
key: string
|
|
22
|
-
value: UnknownLink
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface DeleteOperation {
|
|
26
|
-
type: 'del',
|
|
27
|
-
key: string
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface BatchOperation {
|
|
31
|
-
type: 'batch',
|
|
32
|
-
ops: Array<PutOperation|DeleteOperation>
|
|
33
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Batcher,
|
|
3
|
-
BatcherShardEntry,
|
|
4
|
-
ShardBlockView,
|
|
5
|
-
BlockFetcher,
|
|
6
|
-
ShardLink,
|
|
7
|
-
UnknownLink
|
|
8
|
-
} from '../../batch/api.js'
|
|
9
|
-
import { Operation, BatchOperation, EventLink, Result } from '../api.js'
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
Batcher,
|
|
13
|
-
BatcherShardEntry,
|
|
14
|
-
ShardBlockView,
|
|
15
|
-
BlockFetcher,
|
|
16
|
-
ShardLink,
|
|
17
|
-
UnknownLink,
|
|
18
|
-
Operation,
|
|
19
|
-
BatchOperation,
|
|
20
|
-
EventLink,
|
|
21
|
-
Result
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface CRDTBatcher extends Batcher {
|
|
25
|
-
/**
|
|
26
|
-
* Encode all altered shards in the batch and return the new root CID, new
|
|
27
|
-
* clock head, the new clock event and the difference blocks.
|
|
28
|
-
*/
|
|
29
|
-
commit (): Promise<Result>
|
|
30
|
-
}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line no-unused-vars
|
|
2
|
-
import * as API from './api.js'
|
|
3
|
-
import * as Shard from '../../shard.js'
|
|
4
|
-
import { ShardFetcher, ShardBlock } from '../../shard.js'
|
|
5
|
-
import * as Batch from '../../batch/index.js'
|
|
6
|
-
import { BatchCommittedError } from '../../batch/index.js'
|
|
7
|
-
import * as CRDT from '../index.js'
|
|
8
|
-
import * as Clock from '../../clock/index.js'
|
|
9
|
-
import { EventBlock } from '../../clock/index.js'
|
|
10
|
-
import { MemoryBlockstore, MultiBlockFetcher } from '../../block.js'
|
|
11
|
-
|
|
12
|
-
export { BatchCommittedError }
|
|
13
|
-
|
|
14
|
-
/** @implements {API.CRDTBatcher} */
|
|
15
|
-
class Batcher {
|
|
16
|
-
#committed = false
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @param {object} init
|
|
20
|
-
* @param {API.BlockFetcher} init.blocks Block storage.
|
|
21
|
-
* @param {API.EventLink<API.Operation>[]} init.head Merkle clock head.
|
|
22
|
-
* @param {API.BatcherShardEntry[]} init.entries The entries in this shard.
|
|
23
|
-
* @param {string} init.prefix Key prefix.
|
|
24
|
-
* @param {number} init.version Shard compatibility version.
|
|
25
|
-
* @param {string} init.keyChars Characters allowed in keys, referring to a known character set.
|
|
26
|
-
* @param {number} init.maxKeySize Max key size in bytes.
|
|
27
|
-
* @param {API.ShardBlockView} init.base Original shard this batcher is based on.
|
|
28
|
-
* @param {API.ShardBlockView[]} init.additions Additions to include in the committed batch.
|
|
29
|
-
* @param {API.ShardBlockView[]} init.removals Removals to include in the committed batch.
|
|
30
|
-
*/
|
|
31
|
-
constructor ({ blocks, head, entries, prefix, version, keyChars, maxKeySize, base, additions, removals }) {
|
|
32
|
-
this.blocks = blocks
|
|
33
|
-
this.head = head
|
|
34
|
-
this.prefix = prefix
|
|
35
|
-
this.entries = [...entries]
|
|
36
|
-
this.base = base
|
|
37
|
-
this.version = version
|
|
38
|
-
this.keyChars = keyChars
|
|
39
|
-
this.maxKeySize = maxKeySize
|
|
40
|
-
this.additions = additions
|
|
41
|
-
this.removals = removals
|
|
42
|
-
/** @type {API.BatchOperation['ops']} */
|
|
43
|
-
this.ops = []
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @param {string} key The key of the value to put.
|
|
48
|
-
* @param {API.UnknownLink} value The value to put.
|
|
49
|
-
* @returns {Promise<void>}
|
|
50
|
-
*/
|
|
51
|
-
async put (key, value) {
|
|
52
|
-
if (this.#committed) throw new BatchCommittedError()
|
|
53
|
-
await Batch.put(this.blocks, this, key, value)
|
|
54
|
-
this.ops.push({ type: 'put', key, value })
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async commit () {
|
|
58
|
-
if (this.#committed) throw new BatchCommittedError()
|
|
59
|
-
this.#committed = true
|
|
60
|
-
|
|
61
|
-
const res = await Batch.commit(this)
|
|
62
|
-
|
|
63
|
-
/** @type {API.Operation} */
|
|
64
|
-
const data = { type: 'batch', ops: this.ops, root: res.root }
|
|
65
|
-
const event = await EventBlock.create(data, this.head)
|
|
66
|
-
|
|
67
|
-
const mblocks = new MemoryBlockstore()
|
|
68
|
-
const blocks = new MultiBlockFetcher(mblocks, this.blocks)
|
|
69
|
-
mblocks.putSync(event.cid, event.bytes)
|
|
70
|
-
|
|
71
|
-
const head = await Clock.advance(blocks, this.head, event.cid)
|
|
72
|
-
|
|
73
|
-
/** @type {Map<string, API.ShardBlockView>} */
|
|
74
|
-
const additions = new Map()
|
|
75
|
-
/** @type {Map<string, API.ShardBlockView>} */
|
|
76
|
-
const removals = new Map()
|
|
77
|
-
|
|
78
|
-
for (const a of this.additions) {
|
|
79
|
-
additions.set(a.cid.toString(), a)
|
|
80
|
-
}
|
|
81
|
-
for (const r of this.removals) {
|
|
82
|
-
removals.set(r.cid.toString(), r)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
for (const a of res.additions) {
|
|
86
|
-
if (removals.has(a.cid.toString())) {
|
|
87
|
-
removals.delete(a.cid.toString())
|
|
88
|
-
}
|
|
89
|
-
additions.set(a.cid.toString(), a)
|
|
90
|
-
}
|
|
91
|
-
for (const r of res.removals) {
|
|
92
|
-
if (additions.has(r.cid.toString())) {
|
|
93
|
-
additions.delete(r.cid.toString())
|
|
94
|
-
} else {
|
|
95
|
-
removals.set(r.cid.toString(), r)
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return {
|
|
100
|
-
head,
|
|
101
|
-
event,
|
|
102
|
-
root: res.root,
|
|
103
|
-
additions: [...additions.values()],
|
|
104
|
-
removals: [...removals.values()]
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* @param {object} init
|
|
110
|
-
* @param {API.BlockFetcher} init.blocks Block storage.
|
|
111
|
-
* @param {API.EventLink<API.Operation>[]} init.head Merkle clock head.
|
|
112
|
-
*/
|
|
113
|
-
static async create ({ blocks, head }) {
|
|
114
|
-
const mblocks = new MemoryBlockstore()
|
|
115
|
-
blocks = new MultiBlockFetcher(mblocks, blocks)
|
|
116
|
-
|
|
117
|
-
if (!head.length) {
|
|
118
|
-
const base = await ShardBlock.create()
|
|
119
|
-
mblocks.putSync(base.cid, base.bytes)
|
|
120
|
-
return new Batcher({
|
|
121
|
-
blocks,
|
|
122
|
-
head,
|
|
123
|
-
entries: [],
|
|
124
|
-
base,
|
|
125
|
-
additions: [base],
|
|
126
|
-
removals: [],
|
|
127
|
-
...Shard.configure(base.value)
|
|
128
|
-
})
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const { root, additions, removals } = await CRDT.root(blocks, head)
|
|
132
|
-
for (const a of additions) {
|
|
133
|
-
mblocks.putSync(a.cid, a.bytes)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const shards = new ShardFetcher(blocks)
|
|
137
|
-
const base = await shards.get(root)
|
|
138
|
-
return new Batcher({
|
|
139
|
-
blocks,
|
|
140
|
-
head,
|
|
141
|
-
entries: base.value.entries,
|
|
142
|
-
base,
|
|
143
|
-
additions,
|
|
144
|
-
removals,
|
|
145
|
-
...Shard.configure(base.value)
|
|
146
|
-
})
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* @param {API.BlockFetcher} blocks Bucket block storage.
|
|
152
|
-
* @param {API.EventLink<API.Operation>[]} head Merkle clock head.
|
|
153
|
-
* @returns {Promise<API.CRDTBatcher>}
|
|
154
|
-
*/
|
|
155
|
-
export const create = (blocks, head) => Batcher.create({ blocks, head })
|
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line no-unused-vars
|
|
2
|
-
import * as API from './api.js'
|
|
3
|
-
import * as Clock from '../clock/index.js'
|
|
4
|
-
import { EventFetcher, EventBlock } from '../clock/index.js'
|
|
5
|
-
import * as Pail from '../index.js'
|
|
6
|
-
import { ShardBlock } from '../shard.js'
|
|
7
|
-
import { MemoryBlockstore, MultiBlockFetcher } from '../block.js'
|
|
8
|
-
import * as Batch from '../batch/index.js'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Put a value (a CID) for the given key. If the key exists it's value is
|
|
12
|
-
* overwritten.
|
|
13
|
-
*
|
|
14
|
-
* @param {API.BlockFetcher} blocks Bucket block storage.
|
|
15
|
-
* @param {API.EventLink<API.Operation>[]} head Merkle clock head.
|
|
16
|
-
* @param {string} key The key of the value to put.
|
|
17
|
-
* @param {API.UnknownLink} value The value to put.
|
|
18
|
-
* @returns {Promise<API.Result>}
|
|
19
|
-
*/
|
|
20
|
-
export const put = async (blocks, head, key, value) => {
|
|
21
|
-
const mblocks = new MemoryBlockstore()
|
|
22
|
-
blocks = new MultiBlockFetcher(mblocks, blocks)
|
|
23
|
-
|
|
24
|
-
if (!head.length) {
|
|
25
|
-
const shard = await ShardBlock.create()
|
|
26
|
-
mblocks.putSync(shard.cid, shard.bytes)
|
|
27
|
-
const result = await Pail.put(blocks, shard.cid, key, value)
|
|
28
|
-
/** @type {API.Operation} */
|
|
29
|
-
const data = { type: 'put', root: result.root, key, value }
|
|
30
|
-
const event = await EventBlock.create(data, head)
|
|
31
|
-
head = await Clock.advance(blocks, head, event.cid)
|
|
32
|
-
return {
|
|
33
|
-
root: result.root,
|
|
34
|
-
additions: [shard, ...result.additions],
|
|
35
|
-
removals: result.removals,
|
|
36
|
-
head,
|
|
37
|
-
event
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** @type {EventFetcher<API.Operation>} */
|
|
42
|
-
const events = new EventFetcher(blocks)
|
|
43
|
-
const ancestor = await findCommonAncestor(events, head)
|
|
44
|
-
if (!ancestor) throw new Error('failed to find common ancestor event')
|
|
45
|
-
|
|
46
|
-
const aevent = await events.get(ancestor)
|
|
47
|
-
let { root } = aevent.value.data
|
|
48
|
-
|
|
49
|
-
const sorted = await findSortedEvents(events, head, ancestor)
|
|
50
|
-
/** @type {Map<string, API.ShardBlockView>} */
|
|
51
|
-
const additions = new Map()
|
|
52
|
-
/** @type {Map<string, API.ShardBlockView>} */
|
|
53
|
-
const removals = new Map()
|
|
54
|
-
|
|
55
|
-
for (const { value: event } of sorted) {
|
|
56
|
-
let result
|
|
57
|
-
if (event.data.type === 'put') {
|
|
58
|
-
result = await Pail.put(blocks, root, event.data.key, event.data.value)
|
|
59
|
-
} else if (event.data.type === 'del') {
|
|
60
|
-
result = await Pail.del(blocks, root, event.data.key)
|
|
61
|
-
} else if (event.data.type === 'batch') {
|
|
62
|
-
const batch = await Batch.create(blocks, root)
|
|
63
|
-
for (const op of event.data.ops) {
|
|
64
|
-
if (op.type !== 'put') throw new Error(`unsupported batch operation: ${op.type}`)
|
|
65
|
-
await batch.put(op.key, op.value)
|
|
66
|
-
}
|
|
67
|
-
result = await batch.commit()
|
|
68
|
-
} else {
|
|
69
|
-
// @ts-expect-error type does not exist on never
|
|
70
|
-
throw new Error(`unknown operation: ${event.data.type}`)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
root = result.root
|
|
74
|
-
for (const a of result.additions) {
|
|
75
|
-
mblocks.putSync(a.cid, a.bytes)
|
|
76
|
-
additions.set(a.cid.toString(), a)
|
|
77
|
-
}
|
|
78
|
-
for (const r of result.removals) {
|
|
79
|
-
removals.set(r.cid.toString(), r)
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const result = await Pail.put(blocks, root, key, value)
|
|
84
|
-
// if we didn't change the pail we're done
|
|
85
|
-
if (result.root.toString() === root.toString()) {
|
|
86
|
-
return { root, additions: [], removals: [], head }
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
for (const a of result.additions) {
|
|
90
|
-
mblocks.putSync(a.cid, a.bytes)
|
|
91
|
-
additions.set(a.cid.toString(), a)
|
|
92
|
-
}
|
|
93
|
-
for (const r of result.removals) {
|
|
94
|
-
removals.set(r.cid.toString(), r)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/** @type {API.Operation} */
|
|
98
|
-
const data = { type: 'put', root: result.root, key, value }
|
|
99
|
-
const event = await EventBlock.create(data, head)
|
|
100
|
-
mblocks.putSync(event.cid, event.bytes)
|
|
101
|
-
head = await Clock.advance(blocks, head, event.cid)
|
|
102
|
-
|
|
103
|
-
// filter blocks that were added _and_ removed
|
|
104
|
-
for (const k of removals.keys()) {
|
|
105
|
-
if (additions.has(k)) {
|
|
106
|
-
additions.delete(k)
|
|
107
|
-
removals.delete(k)
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return {
|
|
112
|
-
root: result.root,
|
|
113
|
-
additions: [...additions.values()],
|
|
114
|
-
removals: [...removals.values()],
|
|
115
|
-
head,
|
|
116
|
-
event
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Delete the value for the given key from the bucket. If the key is not found
|
|
122
|
-
* no operation occurs.
|
|
123
|
-
*
|
|
124
|
-
* @param {API.BlockFetcher} blocks Bucket block storage.
|
|
125
|
-
* @param {API.EventLink<API.Operation>[]} head Merkle clock head.
|
|
126
|
-
* @param {string} key The key of the value to delete.
|
|
127
|
-
* @param {object} [options]
|
|
128
|
-
* @returns {Promise<API.Result>}
|
|
129
|
-
*/
|
|
130
|
-
export const del = async (blocks, head, key, options) => {
|
|
131
|
-
throw new Error('not implemented')
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Determine the effective pail root given the current merkle clock head.
|
|
136
|
-
*
|
|
137
|
-
* Clocks with multiple head events may return blocks that were added or
|
|
138
|
-
* removed while playing forward events from their common ancestor.
|
|
139
|
-
*
|
|
140
|
-
* @param {API.BlockFetcher} blocks Bucket block storage.
|
|
141
|
-
* @param {API.EventLink<API.Operation>[]} head Merkle clock head.
|
|
142
|
-
* @returns {Promise<{ root: API.ShardLink } & API.ShardDiff>}
|
|
143
|
-
*/
|
|
144
|
-
export const root = async (blocks, head) => {
|
|
145
|
-
if (!head.length) throw new Error('cannot determine root of headless clock')
|
|
146
|
-
|
|
147
|
-
const mblocks = new MemoryBlockstore()
|
|
148
|
-
blocks = new MultiBlockFetcher(mblocks, blocks)
|
|
149
|
-
|
|
150
|
-
/** @type {EventFetcher<API.Operation>} */
|
|
151
|
-
const events = new EventFetcher(blocks)
|
|
152
|
-
|
|
153
|
-
if (head.length === 1) {
|
|
154
|
-
const event = await events.get(head[0])
|
|
155
|
-
const { root } = event.value.data
|
|
156
|
-
return { root, additions: [], removals: [] }
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const ancestor = await findCommonAncestor(events, head)
|
|
160
|
-
if (!ancestor) throw new Error('failed to find common ancestor event')
|
|
161
|
-
|
|
162
|
-
const aevent = await events.get(ancestor)
|
|
163
|
-
let { root } = aevent.value.data
|
|
164
|
-
|
|
165
|
-
const sorted = await findSortedEvents(events, head, ancestor)
|
|
166
|
-
/** @type {Map<string, API.ShardBlockView>} */
|
|
167
|
-
const additions = new Map()
|
|
168
|
-
/** @type {Map<string, API.ShardBlockView>} */
|
|
169
|
-
const removals = new Map()
|
|
170
|
-
|
|
171
|
-
for (const { value: event } of sorted) {
|
|
172
|
-
let result
|
|
173
|
-
if (event.data.type === 'put') {
|
|
174
|
-
result = await Pail.put(blocks, root, event.data.key, event.data.value)
|
|
175
|
-
} else if (event.data.type === 'del') {
|
|
176
|
-
result = await Pail.del(blocks, root, event.data.key)
|
|
177
|
-
} else if (event.data.type === 'batch') {
|
|
178
|
-
const batch = await Batch.create(blocks, root)
|
|
179
|
-
for (const op of event.data.ops) {
|
|
180
|
-
if (op.type !== 'put') throw new Error(`unsupported batch operation: ${op.type}`)
|
|
181
|
-
await batch.put(op.key, op.value)
|
|
182
|
-
}
|
|
183
|
-
result = await batch.commit()
|
|
184
|
-
} else {
|
|
185
|
-
// @ts-expect-error type does not exist on never
|
|
186
|
-
throw new Error(`unknown operation: ${event.data.type}`)
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
root = result.root
|
|
190
|
-
for (const a of result.additions) {
|
|
191
|
-
mblocks.putSync(a.cid, a.bytes)
|
|
192
|
-
additions.set(a.cid.toString(), a)
|
|
193
|
-
}
|
|
194
|
-
for (const r of result.removals) {
|
|
195
|
-
removals.set(r.cid.toString(), r)
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// filter blocks that were added _and_ removed
|
|
200
|
-
for (const k of removals.keys()) {
|
|
201
|
-
if (additions.has(k)) {
|
|
202
|
-
additions.delete(k)
|
|
203
|
-
removals.delete(k)
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return {
|
|
208
|
-
root,
|
|
209
|
-
additions: [...additions.values()],
|
|
210
|
-
removals: [...removals.values()]
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* @param {API.BlockFetcher} blocks Bucket block storage.
|
|
216
|
-
* @param {API.EventLink<API.Operation>[]} head Merkle clock head.
|
|
217
|
-
* @param {string} key The key of the value to retrieve.
|
|
218
|
-
*/
|
|
219
|
-
export const get = async (blocks, head, key) => {
|
|
220
|
-
if (!head.length) return
|
|
221
|
-
const result = await root(blocks, head)
|
|
222
|
-
if (result.additions.length) {
|
|
223
|
-
blocks = new MultiBlockFetcher(new MemoryBlockstore(result.additions), blocks)
|
|
224
|
-
}
|
|
225
|
-
return Pail.get(blocks, result.root, key)
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* @param {API.BlockFetcher} blocks Bucket block storage.
|
|
230
|
-
* @param {API.EventLink<API.Operation>[]} head Merkle clock head.
|
|
231
|
-
* @param {API.EntriesOptions} [options]
|
|
232
|
-
*/
|
|
233
|
-
export const entries = async function * (blocks, head, options) {
|
|
234
|
-
if (!head.length) return
|
|
235
|
-
const result = await root(blocks, head)
|
|
236
|
-
if (result.additions.length) {
|
|
237
|
-
blocks = new MultiBlockFetcher(new MemoryBlockstore(result.additions), blocks)
|
|
238
|
-
}
|
|
239
|
-
yield * Pail.entries(blocks, result.root, options)
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Find the common ancestor event of the passed children. A common ancestor is
|
|
244
|
-
* the first single event in the DAG that _all_ paths from children lead to.
|
|
245
|
-
*
|
|
246
|
-
* @param {EventFetcher<API.Operation>} events
|
|
247
|
-
* @param {API.EventLink<API.Operation>[]} children
|
|
248
|
-
*/
|
|
249
|
-
const findCommonAncestor = async (events, children) => {
|
|
250
|
-
if (!children.length) return
|
|
251
|
-
const candidates = children.map(c => [c])
|
|
252
|
-
while (true) {
|
|
253
|
-
let changed = false
|
|
254
|
-
for (const c of candidates) {
|
|
255
|
-
const candidate = await findAncestorCandidate(events, c[c.length - 1])
|
|
256
|
-
if (!candidate) continue
|
|
257
|
-
changed = true
|
|
258
|
-
c.push(candidate)
|
|
259
|
-
const ancestor = findCommonString(candidates)
|
|
260
|
-
if (ancestor) return ancestor
|
|
261
|
-
}
|
|
262
|
-
if (!changed) return
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* @param {EventFetcher<API.Operation>} events
|
|
268
|
-
* @param {API.EventLink<API.Operation>} root
|
|
269
|
-
*/
|
|
270
|
-
const findAncestorCandidate = async (events, root) => {
|
|
271
|
-
const { value: event } = await events.get(root)
|
|
272
|
-
if (!event.parents.length) return root
|
|
273
|
-
return event.parents.length === 1
|
|
274
|
-
? event.parents[0]
|
|
275
|
-
: findCommonAncestor(events, event.parents)
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* @template {{ toString: () => string }} T
|
|
280
|
-
* @param {Array<T[]>} arrays
|
|
281
|
-
*/
|
|
282
|
-
const findCommonString = (arrays) => {
|
|
283
|
-
arrays = arrays.map(a => [...a])
|
|
284
|
-
for (const arr of arrays) {
|
|
285
|
-
for (const item of arr) {
|
|
286
|
-
let matched = true
|
|
287
|
-
for (const other of arrays) {
|
|
288
|
-
if (arr === other) continue
|
|
289
|
-
matched = other.some(i => String(i) === String(item))
|
|
290
|
-
if (!matched) break
|
|
291
|
-
}
|
|
292
|
-
if (matched) return item
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Find and sort events between the head(s) and the tail.
|
|
299
|
-
* @param {EventFetcher<API.Operation>} events
|
|
300
|
-
* @param {API.EventLink<API.Operation>[]} head
|
|
301
|
-
* @param {API.EventLink<API.Operation>} tail
|
|
302
|
-
*/
|
|
303
|
-
const findSortedEvents = async (events, head, tail) => {
|
|
304
|
-
if (head.length === 1 && head[0].toString() === tail.toString()) {
|
|
305
|
-
return []
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// get weighted events - heavier events happened first
|
|
309
|
-
/** @type {Map<string, { event: API.EventBlockView<API.Operation>, weight: number }>} */
|
|
310
|
-
const weights = new Map()
|
|
311
|
-
const all = await Promise.all(head.map(h => findEvents(events, h, tail)))
|
|
312
|
-
for (const arr of all) {
|
|
313
|
-
for (const { event, depth } of arr) {
|
|
314
|
-
const info = weights.get(event.cid.toString())
|
|
315
|
-
if (info) {
|
|
316
|
-
info.weight += depth
|
|
317
|
-
} else {
|
|
318
|
-
weights.set(event.cid.toString(), { event, weight: depth })
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
// group events into buckets by weight
|
|
324
|
-
/** @type {Map<number, API.EventBlockView<API.Operation>[]>} */
|
|
325
|
-
const buckets = new Map()
|
|
326
|
-
for (const { event, weight } of weights.values()) {
|
|
327
|
-
const bucket = buckets.get(weight)
|
|
328
|
-
if (bucket) {
|
|
329
|
-
bucket.push(event)
|
|
330
|
-
} else {
|
|
331
|
-
buckets.set(weight, [event])
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
// sort by weight, and by CID within weight
|
|
336
|
-
return Array.from(buckets)
|
|
337
|
-
.sort((a, b) => b[0] - a[0])
|
|
338
|
-
.flatMap(([, es]) => es.sort((a, b) => String(a.cid) < String(b.cid) ? -1 : 1))
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* @param {EventFetcher<API.Operation>} events
|
|
343
|
-
* @param {API.EventLink<API.Operation>} start
|
|
344
|
-
* @param {API.EventLink<API.Operation>} end
|
|
345
|
-
* @returns {Promise<Array<{ event: API.EventBlockView<API.Operation>, depth: number }>>}
|
|
346
|
-
*/
|
|
347
|
-
const findEvents = async (events, start, end, depth = 0) => {
|
|
348
|
-
const event = await events.get(start)
|
|
349
|
-
const acc = [{ event, depth }]
|
|
350
|
-
const { parents } = event.value
|
|
351
|
-
if (parents.length === 1 && String(parents[0]) === String(end)) return acc
|
|
352
|
-
const rest = await Promise.all(parents.map(p => findEvents(events, p, end, depth + 1)))
|
|
353
|
-
return acc.concat(...rest)
|
|
354
|
-
}
|