@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,90 +0,0 @@
|
|
|
1
|
-
import type { CID } from 'multiformats/cid'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Literally any `Iterable` (async or regular).
|
|
5
|
-
*/
|
|
6
|
-
export type AwaitIterable<T> = Iterable<T> | AsyncIterable<T>
|
|
7
|
-
|
|
8
|
-
export type { CID }
|
|
9
|
-
/* Generic types for interfacing with block storage */
|
|
10
|
-
|
|
11
|
-
export interface Block {
|
|
12
|
-
cid: CID
|
|
13
|
-
bytes: Uint8Array
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface BlockHeader {
|
|
17
|
-
cid: CID
|
|
18
|
-
length: number
|
|
19
|
-
blockLength: number
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface BlockIndex extends BlockHeader {
|
|
23
|
-
offset: number
|
|
24
|
-
blockOffset: number
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface RootsReader {
|
|
28
|
-
version: number
|
|
29
|
-
getRoots(): Promise<CID[]>
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface RootsBufferReader {
|
|
33
|
-
version: number
|
|
34
|
-
getRoots(): CID[]
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface BlockIterator extends AsyncIterable<Block> {}
|
|
38
|
-
|
|
39
|
-
export interface CIDIterator extends AsyncIterable<CID> {}
|
|
40
|
-
|
|
41
|
-
export interface BlockReader {
|
|
42
|
-
has(key: CID): Promise<boolean>
|
|
43
|
-
get(key: CID): Promise<Block | undefined>
|
|
44
|
-
blocks(): BlockIterator
|
|
45
|
-
cids(): CIDIterator
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface BlockBufferReader {
|
|
49
|
-
has(key: CID): boolean
|
|
50
|
-
get(key: CID): Block | undefined
|
|
51
|
-
blocks(): Iterable<Block>
|
|
52
|
-
cids(): Iterable<CID>
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface BlockWriter {
|
|
56
|
-
put(block: Block): Promise<void>
|
|
57
|
-
close(): Promise<void>
|
|
58
|
-
version(): number
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface CarBufferWriter {
|
|
62
|
-
addRoot(root: CID, options?: { resize?: boolean }): CarBufferWriter
|
|
63
|
-
write(block: Block): CarBufferWriter
|
|
64
|
-
close(options?: { resize?: boolean }): Uint8Array
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface CarBufferWriterOptions {
|
|
68
|
-
roots?: CID[] // defaults to []
|
|
69
|
-
byteOffset?: number // defaults to 0
|
|
70
|
-
byteLength?: number // defaults to buffer.byteLength
|
|
71
|
-
|
|
72
|
-
headerSize?: number // defaults to size needed for provided roots
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface WriterChannel {
|
|
76
|
-
writer: BlockWriter
|
|
77
|
-
out: AsyncIterable<Uint8Array>
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface CarReader extends BlockReader, RootsReader {}
|
|
81
|
-
export interface CarBufferReader extends BlockBufferReader, RootsBufferReader {}
|
|
82
|
-
|
|
83
|
-
/* Specific implementations for CAR block storage */
|
|
84
|
-
|
|
85
|
-
/*
|
|
86
|
-
export interface CarBlockIterator extends BlockIterator, RootsReader {}
|
|
87
|
-
export interface CarCIDIterator extends CIDIterator, RootsReader {}
|
|
88
|
-
export interface CarIndexer extends AsyncIterable<BlockIndex>, RootsReader {}
|
|
89
|
-
export interface CarWriter extends BlockWriter {}
|
|
90
|
-
*/
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { decode as decodeDagCbor } from "@fireproof/vendor/@ipld/dag-cbor"
|
|
2
|
-
import { CID } from 'multiformats/cid'
|
|
3
|
-
import * as Digest from 'multiformats/hashes/digest'
|
|
4
|
-
import { CIDV0_BYTES, decodeV2Header, decodeVarint, getMultihashLength, V2_HEADER_LENGTH } from './decoder-common.js'
|
|
5
|
-
import { CarV1HeaderOrV2Pragma } from './header-validator.js'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @typedef {import('./api').Block} Block
|
|
9
|
-
* @typedef {import('./api').BlockHeader} BlockHeader
|
|
10
|
-
* @typedef {import('./api').BlockIndex} BlockIndex
|
|
11
|
-
* @typedef {import('./coding').BytesBufferReader} BytesBufferReader
|
|
12
|
-
* @typedef {import('./coding').CarHeader} CarHeader
|
|
13
|
-
* @typedef {import('./coding').CarV2Header} CarV2Header
|
|
14
|
-
* @typedef {import('./coding').CarV2FixedHeader} CarV2FixedHeader
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Reads header data from a `BytesReader`. The header may either be in the form
|
|
19
|
-
* of a `CarHeader` or `CarV2Header` depending on the CAR being read.
|
|
20
|
-
*
|
|
21
|
-
* @name decoder.readHeader(reader)
|
|
22
|
-
* @param {BytesBufferReader} reader
|
|
23
|
-
* @param {number} [strictVersion]
|
|
24
|
-
* @returns {CarHeader | CarV2Header}
|
|
25
|
-
*/
|
|
26
|
-
export function readHeader (reader, strictVersion) {
|
|
27
|
-
const length = decodeVarint(reader.upTo(8), reader)
|
|
28
|
-
if (length === 0) {
|
|
29
|
-
throw new Error('Invalid CAR header (zero length)')
|
|
30
|
-
}
|
|
31
|
-
const header = reader.exactly(length, true)
|
|
32
|
-
const block = decodeDagCbor(header)
|
|
33
|
-
if (CarV1HeaderOrV2Pragma.toTyped(block) === undefined) {
|
|
34
|
-
throw new Error('Invalid CAR header format')
|
|
35
|
-
}
|
|
36
|
-
if ((block.version !== 1 && block.version !== 2) || (strictVersion !== undefined && block.version !== strictVersion)) {
|
|
37
|
-
throw new Error(`Invalid CAR version: ${block.version}${strictVersion !== undefined ? ` (expected ${strictVersion})` : ''}`)
|
|
38
|
-
}
|
|
39
|
-
if (block.version === 1) {
|
|
40
|
-
// CarV1HeaderOrV2Pragma makes roots optional, let's make it mandatory
|
|
41
|
-
if (!Array.isArray(block.roots)) {
|
|
42
|
-
throw new Error('Invalid CAR header format')
|
|
43
|
-
}
|
|
44
|
-
return block
|
|
45
|
-
}
|
|
46
|
-
// version 2
|
|
47
|
-
if (block.roots !== undefined) {
|
|
48
|
-
throw new Error('Invalid CAR header format')
|
|
49
|
-
}
|
|
50
|
-
const v2Header = decodeV2Header(reader.exactly(V2_HEADER_LENGTH, true))
|
|
51
|
-
reader.seek(v2Header.dataOffset - reader.pos)
|
|
52
|
-
const v1Header = readHeader(reader, 1)
|
|
53
|
-
return Object.assign(v1Header, v2Header)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Reads CID sync
|
|
58
|
-
*
|
|
59
|
-
* @param {BytesBufferReader} reader
|
|
60
|
-
* @returns {CID}
|
|
61
|
-
*/
|
|
62
|
-
function readCid (reader) {
|
|
63
|
-
const first = reader.exactly(2, false)
|
|
64
|
-
if (first[0] === CIDV0_BYTES.SHA2_256 && first[1] === CIDV0_BYTES.LENGTH) {
|
|
65
|
-
// cidv0 32-byte sha2-256
|
|
66
|
-
const bytes = reader.exactly(34, true)
|
|
67
|
-
const multihash = Digest.decode(bytes)
|
|
68
|
-
return CID.create(0, CIDV0_BYTES.DAG_PB, multihash)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const version = decodeVarint(reader.upTo(8), reader)
|
|
72
|
-
if (version !== 1) {
|
|
73
|
-
throw new Error(`Unexpected CID version (${version})`)
|
|
74
|
-
}
|
|
75
|
-
const codec = decodeVarint(reader.upTo(8), reader)
|
|
76
|
-
const bytes = reader.exactly(getMultihashLength(reader.upTo(8)), true)
|
|
77
|
-
const multihash = Digest.decode(bytes)
|
|
78
|
-
return CID.create(version, codec, multihash)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Reads the leading data of an individual block from CAR data from a
|
|
83
|
-
* `BytesBufferReader`. Returns a `BlockHeader` object which contains
|
|
84
|
-
* `{ cid, length, blockLength }` which can be used to either index the block
|
|
85
|
-
* or read the block binary data.
|
|
86
|
-
*
|
|
87
|
-
* @name async decoder.readBlockHead(reader)
|
|
88
|
-
* @param {BytesBufferReader} reader
|
|
89
|
-
* @returns {BlockHeader}
|
|
90
|
-
*/
|
|
91
|
-
export function readBlockHead (reader) {
|
|
92
|
-
// length includes a CID + Binary, where CID has a variable length
|
|
93
|
-
// we have to deal with
|
|
94
|
-
const start = reader.pos
|
|
95
|
-
let length = decodeVarint(reader.upTo(8), reader)
|
|
96
|
-
if (length === 0) {
|
|
97
|
-
throw new Error('Invalid CAR section (zero length)')
|
|
98
|
-
}
|
|
99
|
-
length += (reader.pos - start)
|
|
100
|
-
const cid = readCid(reader)
|
|
101
|
-
const blockLength = length - Number(reader.pos - start) // subtract CID length
|
|
102
|
-
|
|
103
|
-
return { cid, length, blockLength }
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Returns Car header and blocks from a Uint8Array
|
|
108
|
-
*
|
|
109
|
-
* @param {Uint8Array} bytes
|
|
110
|
-
* @returns {{ header : CarHeader | CarV2Header , blocks: Block[]}}
|
|
111
|
-
*/
|
|
112
|
-
export function fromBytes (bytes) {
|
|
113
|
-
let reader = bytesReader(bytes)
|
|
114
|
-
const header = readHeader(reader)
|
|
115
|
-
if (header.version === 2) {
|
|
116
|
-
const v1length = reader.pos - header.dataOffset
|
|
117
|
-
reader = limitReader(reader, header.dataSize - v1length)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const blocks = []
|
|
121
|
-
while (reader.upTo(8).length > 0) {
|
|
122
|
-
const { cid, blockLength } = readBlockHead(reader)
|
|
123
|
-
|
|
124
|
-
blocks.push({ cid, bytes: reader.exactly(blockLength, true) })
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return {
|
|
128
|
-
header, blocks
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Creates a `BytesBufferReader` from a `Uint8Array`.
|
|
134
|
-
*
|
|
135
|
-
* @name decoder.bytesReader(bytes)
|
|
136
|
-
* @param {Uint8Array} bytes
|
|
137
|
-
* @returns {BytesBufferReader}
|
|
138
|
-
*/
|
|
139
|
-
export function bytesReader (bytes) {
|
|
140
|
-
let pos = 0
|
|
141
|
-
|
|
142
|
-
/** @type {BytesBufferReader} */
|
|
143
|
-
return {
|
|
144
|
-
upTo (length) {
|
|
145
|
-
return bytes.subarray(pos, pos + Math.min(length, bytes.length - pos))
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
exactly (length, seek = false) {
|
|
149
|
-
if (length > bytes.length - pos) {
|
|
150
|
-
throw new Error('Unexpected end of data')
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
const out = bytes.subarray(pos, pos + length)
|
|
154
|
-
if (seek) {
|
|
155
|
-
pos += length
|
|
156
|
-
}
|
|
157
|
-
return out
|
|
158
|
-
},
|
|
159
|
-
|
|
160
|
-
seek (length) {
|
|
161
|
-
pos += length
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
get pos () {
|
|
165
|
-
return pos
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Wraps a `BytesBufferReader` in a limiting `BytesBufferReader` which limits maximum read
|
|
172
|
-
* to `byteLimit` bytes. It _does not_ update `pos` of the original
|
|
173
|
-
* `BytesBufferReader`.
|
|
174
|
-
*
|
|
175
|
-
* @name decoder.limitReader(reader, byteLimit)
|
|
176
|
-
* @param {BytesBufferReader} reader
|
|
177
|
-
* @param {number} byteLimit
|
|
178
|
-
* @returns {BytesBufferReader}
|
|
179
|
-
*/
|
|
180
|
-
export function limitReader (reader, byteLimit) {
|
|
181
|
-
let bytesRead = 0
|
|
182
|
-
|
|
183
|
-
/** @type {BytesBufferReader} */
|
|
184
|
-
return {
|
|
185
|
-
upTo (length) {
|
|
186
|
-
let bytes = reader.upTo(length)
|
|
187
|
-
if (bytes.length + bytesRead > byteLimit) {
|
|
188
|
-
bytes = bytes.subarray(0, byteLimit - bytesRead)
|
|
189
|
-
}
|
|
190
|
-
return bytes
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
exactly (length, seek = false) {
|
|
194
|
-
const bytes = reader.exactly(length, seek)
|
|
195
|
-
if (bytes.length + bytesRead > byteLimit) {
|
|
196
|
-
throw new Error('Unexpected end of data')
|
|
197
|
-
}
|
|
198
|
-
if (seek) {
|
|
199
|
-
bytesRead += length
|
|
200
|
-
}
|
|
201
|
-
return bytes
|
|
202
|
-
},
|
|
203
|
-
|
|
204
|
-
seek (length) {
|
|
205
|
-
bytesRead += length
|
|
206
|
-
reader.seek(length)
|
|
207
|
-
},
|
|
208
|
-
|
|
209
|
-
get pos () {
|
|
210
|
-
return reader.pos
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import * as BufferDecoder from './buffer-decoder.js'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @typedef {import('multiformats').CID} CID
|
|
5
|
-
* @typedef {import('./api').Block} Block
|
|
6
|
-
* @typedef {import('./api').CarBufferReader} ICarBufferReader
|
|
7
|
-
* @typedef {import('./coding').CarHeader} CarHeader
|
|
8
|
-
* @typedef {import('./coding').CarV2Header} CarV2Header
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Provides blockstore-like access to a CAR.
|
|
13
|
-
*
|
|
14
|
-
* Implements the `RootsBufferReader` interface:
|
|
15
|
-
* {@link ICarBufferReader.getRoots `getRoots()`}. And the `BlockBufferReader` interface:
|
|
16
|
-
* {@link ICarBufferReader.get `get()`}, {@link ICarBufferReader.has `has()`},
|
|
17
|
-
* {@link ICarBufferReader.blocks `blocks()`} and
|
|
18
|
-
* {@link ICarBufferReader.cids `cids()`}.
|
|
19
|
-
*
|
|
20
|
-
* Load this class with either `import { CarBufferReader } from '@ipld/car/buffer-reader'`
|
|
21
|
-
* (`const { CarBufferReader } = require('@ipld/car/buffer-reader')`). Or
|
|
22
|
-
* `import { CarBufferReader } from '@ipld/car'` (`const { CarBufferReader } = require('@ipld/car')`).
|
|
23
|
-
* The former will likely result in smaller bundle sizes where this is
|
|
24
|
-
* important.
|
|
25
|
-
*
|
|
26
|
-
* @name CarBufferReader
|
|
27
|
-
* @class
|
|
28
|
-
* @implements {ICarBufferReader}
|
|
29
|
-
* @property {number} version The version number of the CAR referenced by this
|
|
30
|
-
* reader (should be `1` or `2`).
|
|
31
|
-
*/
|
|
32
|
-
export class CarBufferReader {
|
|
33
|
-
/**
|
|
34
|
-
* @constructs CarBufferReader
|
|
35
|
-
* @param {CarHeader|CarV2Header} header
|
|
36
|
-
* @param {Block[]} blocks
|
|
37
|
-
*/
|
|
38
|
-
constructor (header, blocks) {
|
|
39
|
-
this._header = header
|
|
40
|
-
this._blocks = blocks
|
|
41
|
-
this._cids = undefined
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @property version
|
|
46
|
-
* @memberof CarBufferReader
|
|
47
|
-
* @instance
|
|
48
|
-
*/
|
|
49
|
-
get version () {
|
|
50
|
-
return this._header.version
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Get the list of roots defined by the CAR referenced by this reader. May be
|
|
55
|
-
* zero or more `CID`s.
|
|
56
|
-
*
|
|
57
|
-
* @function
|
|
58
|
-
* @memberof CarBufferReader
|
|
59
|
-
* @instance
|
|
60
|
-
* @returns {CID[]}
|
|
61
|
-
*/
|
|
62
|
-
getRoots () {
|
|
63
|
-
return this._header.roots
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Check whether a given `CID` exists within the CAR referenced by this
|
|
68
|
-
* reader.
|
|
69
|
-
*
|
|
70
|
-
* @function
|
|
71
|
-
* @memberof CarBufferReader
|
|
72
|
-
* @instance
|
|
73
|
-
* @param {CID} key
|
|
74
|
-
* @returns {boolean}
|
|
75
|
-
*/
|
|
76
|
-
has (key) {
|
|
77
|
-
return this._blocks.some(b => b.cid.equals(key))
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Fetch a `Block` (a `{ cid:CID, bytes:Uint8Array }` pair) from the CAR
|
|
82
|
-
* referenced by this reader matching the provided `CID`. In the case where
|
|
83
|
-
* the provided `CID` doesn't exist within the CAR, `undefined` will be
|
|
84
|
-
* returned.
|
|
85
|
-
*
|
|
86
|
-
* @function
|
|
87
|
-
* @memberof CarBufferReader
|
|
88
|
-
* @instance
|
|
89
|
-
* @param {CID} key
|
|
90
|
-
* @returns {Block | undefined}
|
|
91
|
-
*/
|
|
92
|
-
get (key) {
|
|
93
|
-
return this._blocks.find(b => b.cid.equals(key))
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Returns a `Block[]` of the `Block`s (`{ cid:CID, bytes:Uint8Array }` pairs) contained within
|
|
98
|
-
* the CAR referenced by this reader.
|
|
99
|
-
*
|
|
100
|
-
* @function
|
|
101
|
-
* @memberof CarBufferReader
|
|
102
|
-
* @instance
|
|
103
|
-
* @returns {Block[]}
|
|
104
|
-
*/
|
|
105
|
-
blocks () {
|
|
106
|
-
return this._blocks
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Returns a `CID[]` of the `CID`s contained within the CAR referenced by this reader.
|
|
111
|
-
*
|
|
112
|
-
* @function
|
|
113
|
-
* @memberof CarBufferReader
|
|
114
|
-
* @instance
|
|
115
|
-
* @returns {CID[]}
|
|
116
|
-
*/
|
|
117
|
-
cids () {
|
|
118
|
-
if (!this._cids) {
|
|
119
|
-
this._cids = this._blocks.map(b => b.cid)
|
|
120
|
-
}
|
|
121
|
-
return this._cids
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Instantiate a {@link CarBufferReader} from a `Uint8Array` blob. This performs a
|
|
126
|
-
* decode fully in memory and maintains the decoded state in memory for full
|
|
127
|
-
* access to the data via the `CarReader` API.
|
|
128
|
-
*
|
|
129
|
-
* @static
|
|
130
|
-
* @memberof CarBufferReader
|
|
131
|
-
* @param {Uint8Array} bytes
|
|
132
|
-
* @returns {CarBufferReader}
|
|
133
|
-
*/
|
|
134
|
-
static fromBytes (bytes) {
|
|
135
|
-
if (!(bytes instanceof Uint8Array)) {
|
|
136
|
-
throw new TypeError('fromBytes() requires a Uint8Array')
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const { header, blocks } = BufferDecoder.fromBytes(bytes)
|
|
140
|
-
return new CarBufferReader(header, blocks)
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export const __browser = true
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
|
-
import { CarBufferReader as BrowserCarBufferReader } from './buffer-reader-browser.js'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @typedef {import('./api').Block} Block
|
|
6
|
-
* @typedef {import('./api').BlockIndex} BlockIndex
|
|
7
|
-
* @typedef {import('./api').CarBufferReader} ICarBufferReader
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
const fsread = fs.readSync
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @class
|
|
14
|
-
* @implements {ICarBufferReader}
|
|
15
|
-
*/
|
|
16
|
-
export class CarBufferReader extends BrowserCarBufferReader {
|
|
17
|
-
/**
|
|
18
|
-
* Reads a block directly from a file descriptor for an open CAR file. This
|
|
19
|
-
* function is **only available in Node.js** and not a browser environment.
|
|
20
|
-
*
|
|
21
|
-
* This function can be used in connection with {@link CarIndexer} which emits
|
|
22
|
-
* the `BlockIndex` objects that are required by this function.
|
|
23
|
-
*
|
|
24
|
-
* The user is responsible for opening and closing the file used in this call.
|
|
25
|
-
*
|
|
26
|
-
* @static
|
|
27
|
-
* @memberof CarBufferReader
|
|
28
|
-
* @param {number} fd - A file descriptor from the
|
|
29
|
-
* Node.js `fs` module. An integer, from `fs.open()`.
|
|
30
|
-
* @param {BlockIndex} blockIndex - An index pointing to the location of the
|
|
31
|
-
* Block required. This `BlockIndex` should take the form:
|
|
32
|
-
* `{cid:CID, blockLength:number, blockOffset:number}`.
|
|
33
|
-
* @returns {Block} A `{ cid:CID, bytes:Uint8Array }` pair.
|
|
34
|
-
*/
|
|
35
|
-
static readRaw (fd, blockIndex) {
|
|
36
|
-
const { cid, blockLength, blockOffset } = blockIndex
|
|
37
|
-
const bytes = new Uint8Array(blockLength)
|
|
38
|
-
let read
|
|
39
|
-
if (typeof fd === 'number') {
|
|
40
|
-
read = fsread(fd, bytes, 0, blockLength, blockOffset)
|
|
41
|
-
} else {
|
|
42
|
-
throw new TypeError('Bad fd')
|
|
43
|
-
}
|
|
44
|
-
if (read !== blockLength) {
|
|
45
|
-
throw new Error(`Failed to read entire block (${read} instead of ${blockLength})`)
|
|
46
|
-
}
|
|
47
|
-
return { cid, bytes }
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export const __browser = false
|