@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,347 +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').BytesReader} BytesReader
|
|
12
|
-
* @typedef {import('./coding').CarHeader} CarHeader
|
|
13
|
-
* @typedef {import('./coding').CarV2Header} CarV2Header
|
|
14
|
-
* @typedef {import('./coding').CarV2FixedHeader} CarV2FixedHeader
|
|
15
|
-
* @typedef {import('./coding').CarDecoder} CarDecoder
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Reads header data from a `BytesReader`. The header may either be in the form
|
|
20
|
-
* of a `CarHeader` or `CarV2Header` depending on the CAR being read.
|
|
21
|
-
*
|
|
22
|
-
* @name async decoder.readHeader(reader)
|
|
23
|
-
* @param {BytesReader} reader
|
|
24
|
-
* @param {number} [strictVersion]
|
|
25
|
-
* @returns {Promise<CarHeader|CarV2Header>}
|
|
26
|
-
*/
|
|
27
|
-
export async function readHeader (reader, strictVersion) {
|
|
28
|
-
const length = decodeVarint(await reader.upTo(8), reader)
|
|
29
|
-
if (length === 0) {
|
|
30
|
-
throw new Error('Invalid CAR header (zero length)')
|
|
31
|
-
}
|
|
32
|
-
const header = await reader.exactly(length, true)
|
|
33
|
-
const block = decodeDagCbor(header)
|
|
34
|
-
if (CarV1HeaderOrV2Pragma.toTyped(block) === undefined) {
|
|
35
|
-
throw new Error('Invalid CAR header format')
|
|
36
|
-
}
|
|
37
|
-
if ((block.version !== 1 && block.version !== 2) || (strictVersion !== undefined && block.version !== strictVersion)) {
|
|
38
|
-
throw new Error(`Invalid CAR version: ${block.version}${strictVersion !== undefined ? ` (expected ${strictVersion})` : ''}`)
|
|
39
|
-
}
|
|
40
|
-
if (block.version === 1) {
|
|
41
|
-
// CarV1HeaderOrV2Pragma makes roots optional, let's make it mandatory
|
|
42
|
-
if (!Array.isArray(block.roots)) {
|
|
43
|
-
throw new Error('Invalid CAR header format')
|
|
44
|
-
}
|
|
45
|
-
return block
|
|
46
|
-
}
|
|
47
|
-
// version 2
|
|
48
|
-
if (block.roots !== undefined) {
|
|
49
|
-
throw new Error('Invalid CAR header format')
|
|
50
|
-
}
|
|
51
|
-
const v2Header = decodeV2Header(await reader.exactly(V2_HEADER_LENGTH, true))
|
|
52
|
-
reader.seek(v2Header.dataOffset - reader.pos)
|
|
53
|
-
const v1Header = await readHeader(reader, 1)
|
|
54
|
-
return Object.assign(v1Header, v2Header)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @param {BytesReader} reader
|
|
59
|
-
* @returns {Promise<CID>}
|
|
60
|
-
*/
|
|
61
|
-
async function readCid (reader) {
|
|
62
|
-
const first = await reader.exactly(2, false)
|
|
63
|
-
if (first[0] === CIDV0_BYTES.SHA2_256 && first[1] === CIDV0_BYTES.LENGTH) {
|
|
64
|
-
// cidv0 32-byte sha2-256
|
|
65
|
-
const bytes = await reader.exactly(34, true)
|
|
66
|
-
const multihash = Digest.decode(bytes)
|
|
67
|
-
return CID.create(0, CIDV0_BYTES.DAG_PB, multihash)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const version = decodeVarint(await reader.upTo(8), reader)
|
|
71
|
-
if (version !== 1) {
|
|
72
|
-
throw new Error(`Unexpected CID version (${version})`)
|
|
73
|
-
}
|
|
74
|
-
const codec = decodeVarint(await reader.upTo(8), reader)
|
|
75
|
-
const bytes = await reader.exactly(getMultihashLength(await reader.upTo(8)), true)
|
|
76
|
-
const multihash = Digest.decode(bytes)
|
|
77
|
-
return CID.create(version, codec, multihash)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Reads the leading data of an individual block from CAR data from a
|
|
82
|
-
* `BytesReader`. Returns a `BlockHeader` object which contains
|
|
83
|
-
* `{ cid, length, blockLength }` which can be used to either index the block
|
|
84
|
-
* or read the block binary data.
|
|
85
|
-
*
|
|
86
|
-
* @name async decoder.readBlockHead(reader)
|
|
87
|
-
* @param {BytesReader} reader
|
|
88
|
-
* @returns {Promise<BlockHeader>}
|
|
89
|
-
*/
|
|
90
|
-
export async function readBlockHead (reader) {
|
|
91
|
-
// length includes a CID + Binary, where CID has a variable length
|
|
92
|
-
// we have to deal with
|
|
93
|
-
const start = reader.pos
|
|
94
|
-
let length = decodeVarint(await reader.upTo(8), reader)
|
|
95
|
-
if (length === 0) {
|
|
96
|
-
throw new Error('Invalid CAR section (zero length)')
|
|
97
|
-
}
|
|
98
|
-
length += (reader.pos - start)
|
|
99
|
-
const cid = await readCid(reader)
|
|
100
|
-
const blockLength = length - Number(reader.pos - start) // subtract CID length
|
|
101
|
-
|
|
102
|
-
return { cid, length, blockLength }
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* @param {BytesReader} reader
|
|
107
|
-
* @returns {Promise<Block>}
|
|
108
|
-
*/
|
|
109
|
-
async function readBlock (reader) {
|
|
110
|
-
const { cid, blockLength } = await readBlockHead(reader)
|
|
111
|
-
const bytes = await reader.exactly(blockLength, true)
|
|
112
|
-
return { bytes, cid }
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* @param {BytesReader} reader
|
|
117
|
-
* @returns {Promise<BlockIndex>}
|
|
118
|
-
*/
|
|
119
|
-
async function readBlockIndex (reader) {
|
|
120
|
-
const offset = reader.pos
|
|
121
|
-
const { cid, length, blockLength } = await readBlockHead(reader)
|
|
122
|
-
const index = { cid, length, blockLength, offset, blockOffset: reader.pos }
|
|
123
|
-
reader.seek(index.blockLength)
|
|
124
|
-
return index
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Creates a `CarDecoder` from a `BytesReader`. The `CarDecoder` is as async
|
|
129
|
-
* interface that will consume the bytes from the `BytesReader` to yield a
|
|
130
|
-
* `header()` and either `blocks()` or `blocksIndex()` data.
|
|
131
|
-
*
|
|
132
|
-
* @name decoder.createDecoder(reader)
|
|
133
|
-
* @param {BytesReader} reader
|
|
134
|
-
* @returns {CarDecoder}
|
|
135
|
-
*/
|
|
136
|
-
export function createDecoder (reader) {
|
|
137
|
-
const headerPromise = (async () => {
|
|
138
|
-
const header = await readHeader(reader)
|
|
139
|
-
if (header.version === 2) {
|
|
140
|
-
const v1length = reader.pos - header.dataOffset
|
|
141
|
-
reader = limitReader(reader, header.dataSize - v1length)
|
|
142
|
-
}
|
|
143
|
-
return header
|
|
144
|
-
})()
|
|
145
|
-
|
|
146
|
-
return {
|
|
147
|
-
header: () => headerPromise,
|
|
148
|
-
|
|
149
|
-
async * blocks () {
|
|
150
|
-
await headerPromise
|
|
151
|
-
while ((await reader.upTo(8)).length > 0) {
|
|
152
|
-
yield await readBlock(reader)
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
async * blocksIndex () {
|
|
157
|
-
await headerPromise
|
|
158
|
-
while ((await reader.upTo(8)).length > 0) {
|
|
159
|
-
yield await readBlockIndex(reader)
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Creates a `BytesReader` from a `Uint8Array`.
|
|
167
|
-
*
|
|
168
|
-
* @name decoder.bytesReader(bytes)
|
|
169
|
-
* @param {Uint8Array} bytes
|
|
170
|
-
* @returns {BytesReader}
|
|
171
|
-
*/
|
|
172
|
-
export function bytesReader (bytes) {
|
|
173
|
-
let pos = 0
|
|
174
|
-
|
|
175
|
-
/** @type {BytesReader} */
|
|
176
|
-
return {
|
|
177
|
-
async upTo (length) {
|
|
178
|
-
const out = bytes.subarray(pos, pos + Math.min(length, bytes.length - pos))
|
|
179
|
-
return out
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
async exactly (length, seek = false) {
|
|
183
|
-
if (length > bytes.length - pos) {
|
|
184
|
-
throw new Error('Unexpected end of data')
|
|
185
|
-
}
|
|
186
|
-
const out = bytes.subarray(pos, pos + length)
|
|
187
|
-
if (seek) {
|
|
188
|
-
pos += length
|
|
189
|
-
}
|
|
190
|
-
return out
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
seek (length) {
|
|
194
|
-
pos += length
|
|
195
|
-
},
|
|
196
|
-
|
|
197
|
-
get pos () {
|
|
198
|
-
return pos
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* @ignore
|
|
205
|
-
* reusable reader for streams and files, we just need a way to read an
|
|
206
|
-
* additional chunk (of some undetermined size) and a way to close the
|
|
207
|
-
* reader when finished
|
|
208
|
-
* @param {() => Promise<Uint8Array|null>} readChunk
|
|
209
|
-
* @returns {BytesReader}
|
|
210
|
-
*/
|
|
211
|
-
export function chunkReader (readChunk /*, closer */) {
|
|
212
|
-
let pos = 0
|
|
213
|
-
let have = 0
|
|
214
|
-
let offset = 0
|
|
215
|
-
let currentChunk = new Uint8Array(0)
|
|
216
|
-
|
|
217
|
-
const read = async (/** @type {number} */ length) => {
|
|
218
|
-
have = currentChunk.length - offset
|
|
219
|
-
const bufa = [currentChunk.subarray(offset)]
|
|
220
|
-
while (have < length) {
|
|
221
|
-
const chunk = await readChunk()
|
|
222
|
-
if (chunk == null) {
|
|
223
|
-
break
|
|
224
|
-
}
|
|
225
|
-
/* c8 ignore next 8 */
|
|
226
|
-
// undo this ignore ^ when we have a fd implementation that can seek()
|
|
227
|
-
if (have < 0) { // because of a seek()
|
|
228
|
-
/* c8 ignore next 4 */
|
|
229
|
-
// toohard to test the else
|
|
230
|
-
if (chunk.length > have) {
|
|
231
|
-
bufa.push(chunk.subarray(-have))
|
|
232
|
-
} // else discard
|
|
233
|
-
} else {
|
|
234
|
-
bufa.push(chunk)
|
|
235
|
-
}
|
|
236
|
-
have += chunk.length
|
|
237
|
-
}
|
|
238
|
-
currentChunk = new Uint8Array(bufa.reduce((p, c) => p + c.length, 0))
|
|
239
|
-
let off = 0
|
|
240
|
-
for (const b of bufa) {
|
|
241
|
-
currentChunk.set(b, off)
|
|
242
|
-
off += b.length
|
|
243
|
-
}
|
|
244
|
-
offset = 0
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/** @type {BytesReader} */
|
|
248
|
-
return {
|
|
249
|
-
async upTo (length) {
|
|
250
|
-
if (currentChunk.length - offset < length) {
|
|
251
|
-
await read(length)
|
|
252
|
-
}
|
|
253
|
-
return currentChunk.subarray(offset, offset + Math.min(currentChunk.length - offset, length))
|
|
254
|
-
},
|
|
255
|
-
|
|
256
|
-
async exactly (length, seek = false) {
|
|
257
|
-
if (currentChunk.length - offset < length) {
|
|
258
|
-
await read(length)
|
|
259
|
-
}
|
|
260
|
-
if (currentChunk.length - offset < length) {
|
|
261
|
-
throw new Error('Unexpected end of data')
|
|
262
|
-
}
|
|
263
|
-
const out = currentChunk.subarray(offset, offset + length)
|
|
264
|
-
if (seek) {
|
|
265
|
-
pos += length
|
|
266
|
-
offset += length
|
|
267
|
-
}
|
|
268
|
-
return out
|
|
269
|
-
},
|
|
270
|
-
|
|
271
|
-
seek (length) {
|
|
272
|
-
pos += length
|
|
273
|
-
offset += length
|
|
274
|
-
},
|
|
275
|
-
|
|
276
|
-
get pos () {
|
|
277
|
-
return pos
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Creates a `BytesReader` from an `AsyncIterable<Uint8Array>`, which allows for
|
|
284
|
-
* consumption of CAR data from a streaming source.
|
|
285
|
-
*
|
|
286
|
-
* @name decoder.asyncIterableReader(asyncIterable)
|
|
287
|
-
* @param {AsyncIterable<Uint8Array>} asyncIterable
|
|
288
|
-
* @returns {BytesReader}
|
|
289
|
-
*/
|
|
290
|
-
export function asyncIterableReader (asyncIterable) {
|
|
291
|
-
const iterator = asyncIterable[Symbol.asyncIterator]()
|
|
292
|
-
|
|
293
|
-
async function readChunk () {
|
|
294
|
-
const next = await iterator.next()
|
|
295
|
-
if (next.done) {
|
|
296
|
-
return null
|
|
297
|
-
}
|
|
298
|
-
return next.value
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
return chunkReader(readChunk)
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Wraps a `BytesReader` in a limiting `BytesReader` which limits maximum read
|
|
306
|
-
* to `byteLimit` bytes. It _does not_ update `pos` of the original
|
|
307
|
-
* `BytesReader`.
|
|
308
|
-
*
|
|
309
|
-
* @name decoder.limitReader(reader, byteLimit)
|
|
310
|
-
* @param {BytesReader} reader
|
|
311
|
-
* @param {number} byteLimit
|
|
312
|
-
* @returns {BytesReader}
|
|
313
|
-
*/
|
|
314
|
-
export function limitReader (reader, byteLimit) {
|
|
315
|
-
let bytesRead = 0
|
|
316
|
-
|
|
317
|
-
/** @type {BytesReader} */
|
|
318
|
-
return {
|
|
319
|
-
async upTo (length) {
|
|
320
|
-
let bytes = await reader.upTo(length)
|
|
321
|
-
if (bytes.length + bytesRead > byteLimit) {
|
|
322
|
-
bytes = bytes.subarray(0, byteLimit - bytesRead)
|
|
323
|
-
}
|
|
324
|
-
return bytes
|
|
325
|
-
},
|
|
326
|
-
|
|
327
|
-
async exactly (length, seek = false) {
|
|
328
|
-
const bytes = await reader.exactly(length, seek)
|
|
329
|
-
if (bytes.length + bytesRead > byteLimit) {
|
|
330
|
-
throw new Error('Unexpected end of data')
|
|
331
|
-
}
|
|
332
|
-
if (seek) {
|
|
333
|
-
bytesRead += length
|
|
334
|
-
}
|
|
335
|
-
return bytes
|
|
336
|
-
},
|
|
337
|
-
|
|
338
|
-
seek (length) {
|
|
339
|
-
bytesRead += length
|
|
340
|
-
reader.seek(length)
|
|
341
|
-
},
|
|
342
|
-
|
|
343
|
-
get pos () {
|
|
344
|
-
return reader.pos
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { encode as dagCborEncode } from "@fireproof/vendor/@ipld/dag-cbor"
|
|
2
|
-
import varint from 'varint'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @typedef {import('multiformats').CID} CID
|
|
6
|
-
* @typedef {import('./api').Block} Block
|
|
7
|
-
* @typedef {import('./coding').CarEncoder} CarEncoder
|
|
8
|
-
* @typedef {import('./coding').IteratorChannel_Writer<Uint8Array>} IteratorChannel_Writer
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const CAR_V1_VERSION = 1
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Create a header from an array of roots.
|
|
15
|
-
*
|
|
16
|
-
* @param {CID[]} roots
|
|
17
|
-
* @returns {Uint8Array}
|
|
18
|
-
*/
|
|
19
|
-
export function createHeader (roots) {
|
|
20
|
-
const headerBytes = dagCborEncode({ version: CAR_V1_VERSION, roots })
|
|
21
|
-
const varintBytes = varint.encode(headerBytes.length)
|
|
22
|
-
const header = new Uint8Array(varintBytes.length + headerBytes.length)
|
|
23
|
-
header.set(varintBytes, 0)
|
|
24
|
-
header.set(headerBytes, varintBytes.length)
|
|
25
|
-
return header
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @param {IteratorChannel_Writer} writer
|
|
30
|
-
* @returns {CarEncoder}
|
|
31
|
-
*/
|
|
32
|
-
function createEncoder (writer) {
|
|
33
|
-
// none of this is wrapped in a mutex, that needs to happen above this to
|
|
34
|
-
// avoid overwrites
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
/**
|
|
38
|
-
* @param {CID[]} roots
|
|
39
|
-
* @returns {Promise<void>}
|
|
40
|
-
*/
|
|
41
|
-
async setRoots (roots) {
|
|
42
|
-
const bytes = createHeader(roots)
|
|
43
|
-
await writer.write(bytes)
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @param {Block} block
|
|
48
|
-
* @returns {Promise<void>}
|
|
49
|
-
*/
|
|
50
|
-
async writeBlock (block) {
|
|
51
|
-
const { cid, bytes } = block
|
|
52
|
-
await writer.write(new Uint8Array(varint.encode(cid.bytes.length + bytes.length)))
|
|
53
|
-
await writer.write(cid.bytes)
|
|
54
|
-
if (bytes.length) {
|
|
55
|
-
// zero-length blocks are valid, but it'd be safer if we didn't write them
|
|
56
|
-
await writer.write(bytes)
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @returns {Promise<void>}
|
|
62
|
-
*/
|
|
63
|
-
async close () {
|
|
64
|
-
await writer.end()
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @returns {number}
|
|
69
|
-
*/
|
|
70
|
-
version () {
|
|
71
|
-
return CAR_V1_VERSION
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export { createEncoder }
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
/** Auto-generated with @ipld/schema@v4.2.0 at Thu Sep 14 2023 from IPLD Schema:
|
|
2
|
-
*
|
|
3
|
-
* # CarV1HeaderOrV2Pragma is a more relaxed form, and can parse {version:x} where
|
|
4
|
-
* # roots are optional. This is typically useful for the {verison:2} CARv2
|
|
5
|
-
* # pragma.
|
|
6
|
-
*
|
|
7
|
-
* type CarV1HeaderOrV2Pragma struct {
|
|
8
|
-
* roots optional [&Any]
|
|
9
|
-
* # roots is _not_ optional for CarV1 but we defer that check within code to
|
|
10
|
-
* # gracefully handle the V2 case where it's just {version:X}
|
|
11
|
-
* version Int
|
|
12
|
-
* }
|
|
13
|
-
*
|
|
14
|
-
* # CarV1Header is the strict form of the header, and requires roots to be
|
|
15
|
-
* # present. This is compatible with the CARv1 specification.
|
|
16
|
-
*
|
|
17
|
-
* # type CarV1Header struct {
|
|
18
|
-
* # roots [&Any]
|
|
19
|
-
* # version Int
|
|
20
|
-
* # }
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
const Kinds = {
|
|
25
|
-
Null: /** @returns {undefined|null} */ (/** @type {any} */ obj) => obj === null ? obj : undefined,
|
|
26
|
-
Int: /** @returns {undefined|number} */ (/** @type {any} */ obj) => Number.isInteger(obj) ? obj : undefined,
|
|
27
|
-
Float: /** @returns {undefined|number} */ (/** @type {any} */ obj) => typeof obj === 'number' && Number.isFinite(obj) ? obj : undefined,
|
|
28
|
-
String: /** @returns {undefined|string} */ (/** @type {any} */ obj) => typeof obj === 'string' ? obj : undefined,
|
|
29
|
-
Bool: /** @returns {undefined|boolean} */ (/** @type {any} */ obj) => typeof obj === 'boolean' ? obj : undefined,
|
|
30
|
-
Bytes: /** @returns {undefined|Uint8Array} */ (/** @type {any} */ obj) => obj instanceof Uint8Array ? obj : undefined,
|
|
31
|
-
Link: /** @returns {undefined|object} */ (/** @type {any} */ obj) => obj !== null && typeof obj === 'object' && obj.asCID === obj ? obj : undefined,
|
|
32
|
-
List: /** @returns {undefined|Array<any>} */ (/** @type {any} */ obj) => Array.isArray(obj) ? obj : undefined,
|
|
33
|
-
Map: /** @returns {undefined|object} */ (/** @type {any} */ obj) => obj !== null && typeof obj === 'object' && obj.asCID !== obj && !Array.isArray(obj) && !(obj instanceof Uint8Array) ? obj : undefined
|
|
34
|
-
}
|
|
35
|
-
/** @type {{ [k in string]: (obj:any)=>undefined|any}} */
|
|
36
|
-
const Types = {
|
|
37
|
-
'CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)': Kinds.Link,
|
|
38
|
-
'CarV1HeaderOrV2Pragma > roots (anon)': /** @returns {undefined|any} */ (/** @type {any} */ obj) => {
|
|
39
|
-
if (Kinds.List(obj) === undefined) {
|
|
40
|
-
return undefined
|
|
41
|
-
}
|
|
42
|
-
for (let i = 0; i < obj.length; i++) {
|
|
43
|
-
let v = obj[i]
|
|
44
|
-
v = Types['CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)'](v)
|
|
45
|
-
if (v === undefined) {
|
|
46
|
-
return undefined
|
|
47
|
-
}
|
|
48
|
-
if (v !== obj[i]) {
|
|
49
|
-
const ret = obj.slice(0, i)
|
|
50
|
-
for (let j = i; j < obj.length; j++) {
|
|
51
|
-
let v = obj[j]
|
|
52
|
-
v = Types['CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)'](v)
|
|
53
|
-
if (v === undefined) {
|
|
54
|
-
return undefined
|
|
55
|
-
}
|
|
56
|
-
ret.push(v)
|
|
57
|
-
}
|
|
58
|
-
return ret
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return obj
|
|
62
|
-
},
|
|
63
|
-
Int: Kinds.Int,
|
|
64
|
-
CarV1HeaderOrV2Pragma: /** @returns {undefined|any} */ (/** @type {any} */ obj) => {
|
|
65
|
-
if (Kinds.Map(obj) === undefined) {
|
|
66
|
-
return undefined
|
|
67
|
-
}
|
|
68
|
-
const entries = Object.entries(obj)
|
|
69
|
-
/** @type {{[k in string]: any}} */
|
|
70
|
-
let ret = obj
|
|
71
|
-
let requiredCount = 1
|
|
72
|
-
for (let i = 0; i < entries.length; i++) {
|
|
73
|
-
const [key, value] = entries[i]
|
|
74
|
-
switch (key) {
|
|
75
|
-
case 'roots':
|
|
76
|
-
{
|
|
77
|
-
const v = Types['CarV1HeaderOrV2Pragma > roots (anon)'](obj[key])
|
|
78
|
-
if (v === undefined) {
|
|
79
|
-
return undefined
|
|
80
|
-
}
|
|
81
|
-
if (v !== value || ret !== obj) {
|
|
82
|
-
if (ret === obj) {
|
|
83
|
-
/** @type {{[k in string]: any}} */
|
|
84
|
-
ret = {}
|
|
85
|
-
for (let j = 0; j < i; j++) {
|
|
86
|
-
ret[entries[j][0]] = entries[j][1]
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
ret.roots = v
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
break
|
|
93
|
-
case 'version':
|
|
94
|
-
{
|
|
95
|
-
requiredCount--
|
|
96
|
-
const v = Types.Int(obj[key])
|
|
97
|
-
if (v === undefined) {
|
|
98
|
-
return undefined
|
|
99
|
-
}
|
|
100
|
-
if (v !== value || ret !== obj) {
|
|
101
|
-
if (ret === obj) {
|
|
102
|
-
/** @type {{[k in string]: any}} */
|
|
103
|
-
ret = {}
|
|
104
|
-
for (let j = 0; j < i; j++) {
|
|
105
|
-
ret[entries[j][0]] = entries[j][1]
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
ret.version = v
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
break
|
|
112
|
-
default:
|
|
113
|
-
return undefined
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (requiredCount > 0) {
|
|
118
|
-
return undefined
|
|
119
|
-
}
|
|
120
|
-
return ret
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
/** @type {{ [k in string]: (obj:any)=>undefined|any}} */
|
|
124
|
-
const Reprs = {
|
|
125
|
-
'CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)': Kinds.Link,
|
|
126
|
-
'CarV1HeaderOrV2Pragma > roots (anon)': /** @returns {undefined|any} */ (/** @type {any} */ obj) => {
|
|
127
|
-
if (Kinds.List(obj) === undefined) {
|
|
128
|
-
return undefined
|
|
129
|
-
}
|
|
130
|
-
for (let i = 0; i < obj.length; i++) {
|
|
131
|
-
let v = obj[i]
|
|
132
|
-
v = Reprs['CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)'](v)
|
|
133
|
-
if (v === undefined) {
|
|
134
|
-
return undefined
|
|
135
|
-
}
|
|
136
|
-
if (v !== obj[i]) {
|
|
137
|
-
const ret = obj.slice(0, i)
|
|
138
|
-
for (let j = i; j < obj.length; j++) {
|
|
139
|
-
let v = obj[j]
|
|
140
|
-
v = Reprs['CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)'](v)
|
|
141
|
-
if (v === undefined) {
|
|
142
|
-
return undefined
|
|
143
|
-
}
|
|
144
|
-
ret.push(v)
|
|
145
|
-
}
|
|
146
|
-
return ret
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return obj
|
|
150
|
-
},
|
|
151
|
-
Int: Kinds.Int,
|
|
152
|
-
CarV1HeaderOrV2Pragma: /** @returns {undefined|any} */ (/** @type {any} */ obj) => {
|
|
153
|
-
if (Kinds.Map(obj) === undefined) {
|
|
154
|
-
return undefined
|
|
155
|
-
}
|
|
156
|
-
const entries = Object.entries(obj)
|
|
157
|
-
/** @type {{[k in string]: any}} */
|
|
158
|
-
let ret = obj
|
|
159
|
-
let requiredCount = 1
|
|
160
|
-
for (let i = 0; i < entries.length; i++) {
|
|
161
|
-
const [key, value] = entries[i]
|
|
162
|
-
switch (key) {
|
|
163
|
-
case 'roots':
|
|
164
|
-
{
|
|
165
|
-
const v = Reprs['CarV1HeaderOrV2Pragma > roots (anon)'](value)
|
|
166
|
-
if (v === undefined) {
|
|
167
|
-
return undefined
|
|
168
|
-
}
|
|
169
|
-
if (v !== value || ret !== obj) {
|
|
170
|
-
if (ret === obj) {
|
|
171
|
-
/** @type {{[k in string]: any}} */
|
|
172
|
-
ret = {}
|
|
173
|
-
for (let j = 0; j < i; j++) {
|
|
174
|
-
ret[entries[j][0]] = entries[j][1]
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
ret.roots = v
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
break
|
|
181
|
-
case 'version':
|
|
182
|
-
{
|
|
183
|
-
requiredCount--
|
|
184
|
-
const v = Reprs.Int(value)
|
|
185
|
-
if (v === undefined) {
|
|
186
|
-
return undefined
|
|
187
|
-
}
|
|
188
|
-
if (v !== value || ret !== obj) {
|
|
189
|
-
if (ret === obj) {
|
|
190
|
-
/** @type {{[k in string]: any}} */
|
|
191
|
-
ret = {}
|
|
192
|
-
for (let j = 0; j < i; j++) {
|
|
193
|
-
ret[entries[j][0]] = entries[j][1]
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
ret.version = v
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
break
|
|
200
|
-
default:
|
|
201
|
-
return undefined
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
if (requiredCount > 0) {
|
|
205
|
-
return undefined
|
|
206
|
-
}
|
|
207
|
-
return ret
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
export const CarV1HeaderOrV2Pragma = {
|
|
212
|
-
toTyped: Types.CarV1HeaderOrV2Pragma,
|
|
213
|
-
toRepresentation: Reprs.CarV1HeaderOrV2Pragma
|
|
214
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# CarV1HeaderOrV2Pragma is a more relaxed form, and can parse {version:x} where
|
|
2
|
-
# roots are optional. This is typically useful for the {verison:2} CARv2
|
|
3
|
-
# pragma.
|
|
4
|
-
|
|
5
|
-
type CarV1HeaderOrV2Pragma struct {
|
|
6
|
-
roots optional [&Any]
|
|
7
|
-
# roots is _not_ optional for CarV1 but we defer that check within code to
|
|
8
|
-
# gracefully handle the V2 case where it's just {version:X}
|
|
9
|
-
version Int
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
# CarV1Header is the strict form of the header, and requires roots to be
|
|
13
|
-
# present. This is compatible with the CARv1 specification.
|
|
14
|
-
|
|
15
|
-
# type CarV1Header struct {
|
|
16
|
-
# roots [&Any]
|
|
17
|
-
# version Int
|
|
18
|
-
# }
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { CarBufferReader } from './buffer-reader.js'
|
|
2
|
-
import * as CarBufferWriter from './buffer-writer.js'
|
|
3
|
-
import { CarIndexedReader } from './indexed-reader-browser.js'
|
|
4
|
-
import { CarIndexer } from './indexer.js'
|
|
5
|
-
import { CarBlockIterator, CarCIDIterator } from './iterator.js'
|
|
6
|
-
import { CarReader } from './reader-browser.js'
|
|
7
|
-
import { CarWriter } from './writer-browser.js'
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
CarReader,
|
|
11
|
-
CarIndexer,
|
|
12
|
-
CarBlockIterator,
|
|
13
|
-
CarCIDIterator,
|
|
14
|
-
CarWriter,
|
|
15
|
-
CarIndexedReader,
|
|
16
|
-
CarBufferReader,
|
|
17
|
-
CarBufferWriter
|
|
18
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { CarBufferReader } from './buffer-reader.js'
|
|
2
|
-
import * as CarBufferWriter from './buffer-writer.js'
|
|
3
|
-
import { CarIndexedReader } from './indexed-reader.js'
|
|
4
|
-
import { CarIndexer } from './indexer.js'
|
|
5
|
-
import { CarBlockIterator, CarCIDIterator } from './iterator.js'
|
|
6
|
-
import { CarReader } from './reader.js'
|
|
7
|
-
import { CarWriter } from './writer.js'
|
|
8
|
-
|
|
9
|
-
// @see https://www.iana.org/assignments/media-types/application/vnd.ipld.car
|
|
10
|
-
export const contentType = 'application/vnd.ipld.car'
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
CarReader,
|
|
14
|
-
CarBufferReader,
|
|
15
|
-
CarIndexer,
|
|
16
|
-
CarBlockIterator,
|
|
17
|
-
CarCIDIterator,
|
|
18
|
-
CarWriter,
|
|
19
|
-
CarIndexedReader,
|
|
20
|
-
CarBufferWriter
|
|
21
|
-
}
|