@fireproof/vendor 1.2.0 → 2.0.0
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/package.json +19 -109
- package/src/@web3-storage/pail/dist/src/batch/index.d.ts +1 -53
- package/src/@web3-storage/pail/dist/src/batch/index.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/src/batch/shard.d.ts +1 -1
- package/src/@web3-storage/pail/dist/src/batch/shard.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/src/block.d.ts +2 -2
- package/src/@web3-storage/pail/dist/src/block.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/src/clock/index.d.ts +2 -2
- package/src/@web3-storage/pail/dist/src/clock/index.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/src/crdt/batch/index.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/src/crdt/index.d.ts +2 -2
- package/src/@web3-storage/pail/dist/src/crdt/index.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/src/diff.d.ts +3 -3
- package/src/@web3-storage/pail/dist/src/diff.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/src/index.d.ts +1 -1
- package/src/@web3-storage/pail/dist/src/index.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/src/merge.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/src/shard.d.ts +4 -4
- package/src/@web3-storage/pail/dist/src/shard.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/tsconfig.tsbuildinfo +1 -1
- package/src/@web3-storage/pail/src/api.ts +1 -1
- package/src/@web3-storage/pail/src/clock/index.js +1 -1
- package/src/@web3-storage/pail/src/shard.js +1 -1
- package/src/@ipld/car/LICENSE +0 -4
- package/src/@ipld/car/README.md +0 -1132
- package/src/@ipld/car/dist/index.min.js +0 -5
- package/src/@ipld/car/dist/src/api.d.ts +0 -72
- package/src/@ipld/car/dist/src/api.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/buffer-decoder.d.ts +0 -67
- package/src/@ipld/car/dist/src/buffer-decoder.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/buffer-reader-browser.d.ts +0 -116
- package/src/@ipld/car/dist/src/buffer-reader-browser.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/buffer-reader.d.ts +0 -31
- package/src/@ipld/car/dist/src/buffer-reader.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/buffer-writer.d.ts +0 -86
- package/src/@ipld/car/dist/src/buffer-writer.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/coding.d.ts +0 -49
- package/src/@ipld/car/dist/src/coding.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/decoder-common.d.ts +0 -43
- package/src/@ipld/car/dist/src/decoder-common.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/decoder.d.ts +0 -87
- package/src/@ipld/car/dist/src/decoder.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/encoder.d.ts +0 -17
- package/src/@ipld/car/dist/src/encoder.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/header-validator.d.ts +0 -5
- package/src/@ipld/car/dist/src/header-validator.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/index-browser.d.ts +0 -10
- package/src/@ipld/car/dist/src/index-browser.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/index.d.ts +0 -11
- package/src/@ipld/car/dist/src/index.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/indexed-reader-browser.d.ts +0 -5
- package/src/@ipld/car/dist/src/indexed-reader-browser.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/indexed-reader.d.ts +0 -152
- package/src/@ipld/car/dist/src/indexed-reader.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/indexer.d.ts +0 -95
- package/src/@ipld/car/dist/src/indexer.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/iterator-channel.d.ts +0 -7
- package/src/@ipld/car/dist/src/iterator-channel.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/iterator.d.ts +0 -174
- package/src/@ipld/car/dist/src/iterator.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/promise-fs-opts.d.ts +0 -28
- package/src/@ipld/car/dist/src/promise-fs-opts.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/reader-browser.d.ts +0 -151
- package/src/@ipld/car/dist/src/reader-browser.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/reader.d.ts +0 -40
- package/src/@ipld/car/dist/src/reader.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/writer-browser.d.ts +0 -155
- package/src/@ipld/car/dist/src/writer-browser.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/writer.d.ts +0 -45
- package/src/@ipld/car/dist/src/writer.d.ts.map +0 -1
- package/src/@ipld/car/src/api.ts +0 -90
- package/src/@ipld/car/src/buffer-decoder.js +0 -213
- package/src/@ipld/car/src/buffer-reader-browser.js +0 -144
- package/src/@ipld/car/src/buffer-reader.js +0 -51
- package/src/@ipld/car/src/buffer-writer.js +0 -286
- package/src/@ipld/car/src/coding.ts +0 -68
- package/src/@ipld/car/src/decoder-common.js +0 -82
- package/src/@ipld/car/src/decoder.js +0 -347
- package/src/@ipld/car/src/encoder.js +0 -76
- package/src/@ipld/car/src/header-validator.js +0 -214
- package/src/@ipld/car/src/header.ipldsch +0 -18
- package/src/@ipld/car/src/index-browser.js +0 -18
- package/src/@ipld/car/src/index.js +0 -21
- package/src/@ipld/car/src/indexed-reader-browser.js +0 -7
- package/src/@ipld/car/src/indexed-reader.js +0 -211
- package/src/@ipld/car/src/indexer.js +0 -130
- package/src/@ipld/car/src/iterator-channel.js +0 -91
- package/src/@ipld/car/src/iterator.js +0 -267
- package/src/@ipld/car/src/promise-fs-opts.js +0 -46
- package/src/@ipld/car/src/reader-browser.js +0 -194
- package/src/@ipld/car/src/reader.js +0 -54
- package/src/@ipld/car/src/writer-browser.js +0 -250
- package/src/@ipld/car/src/writer.js +0 -81
- package/src/@ipld/dag-cbor/LICENSE +0 -4
- package/src/@ipld/dag-cbor/README.md +0 -80
- package/src/@ipld/dag-cbor/dist/index.min.js +0 -3
- package/src/@ipld/dag-cbor/dist/src/index.d.ts +0 -67
- package/src/@ipld/dag-cbor/dist/src/index.d.ts.map +0 -1
- package/src/@ipld/dag-cbor/src/index.js +0 -147
- package/src/@ipld/dag-json/LICENSE +0 -4
- package/src/@ipld/dag-json/README.md +0 -58
- package/src/@ipld/dag-json/dist/index.min.js +0 -3
- package/src/@ipld/dag-json/dist/src/index.d.ts +0 -12
- package/src/@ipld/dag-json/dist/src/index.d.ts.map +0 -1
- package/src/@ipld/dag-json/src/index.js +0 -291
- package/src/cborg/.github/dependabot.yml +0 -16
- package/src/cborg/.github/workflows/test-and-release.yml +0 -52
- package/src/cborg/CHANGELOG.md +0 -513
- package/src/cborg/LICENSE +0 -13
- package/src/cborg/README.md +0 -515
- package/src/cborg/bench/bench.js +0 -117
- package/src/cborg/bench/json.js +0 -124
- package/src/cborg/bench/package.json +0 -8
- package/src/cborg/cborg/bin.js +0 -189
- package/src/cborg/cborg/common.js +0 -28
- package/src/cborg/cborg/decode.js +0 -211
- package/src/cborg/cborg/diagnostic.js +0 -158
- package/src/cborg/cborg/diagnostic_test.js +0 -117
- package/src/cborg/cborg/encode.js +0 -466
- package/src/cborg/cborg/index.js +0 -33
- package/src/cborg/cborg/is.js +0 -106
- package/src/cborg/cborg/length.js +0 -62
- package/src/cborg/example-bytestrings.js +0 -180
- package/src/cborg/example-json.js +0 -6
- package/src/cborg/example.js +0 -5
- package/src/cborg/interface.ts +0 -59
- package/src/cborg/json/decode.js +0 -462
- package/src/cborg/json/encode.js +0 -302
- package/src/cborg/json/json.js +0 -4
- package/src/cborg/taglib.js +0 -75
- package/src/cborg/test/appendix_a.js +0 -647
- package/src/cborg/test/common.js +0 -18
- package/src/cborg/test/node-test-bin.js +0 -402
- package/src/cborg/test/noop-bin-test.js +0 -3
- package/src/cborg/test/test-0uint.js +0 -103
- package/src/cborg/test/test-1negint.js +0 -96
- package/src/cborg/test/test-2bytes.js +0 -198
- package/src/cborg/test/test-3string.js +0 -136
- package/src/cborg/test/test-4array.js +0 -93
- package/src/cborg/test/test-5map.js +0 -284
- package/src/cborg/test/test-6tag.js +0 -84
- package/src/cborg/test/test-7float.js +0 -131
- package/src/cborg/test/test-bl.js +0 -37
- package/src/cborg/test/test-cbor-vectors.js +0 -107
- package/src/cborg/test/test-decode-errors.js +0 -65
- package/src/cborg/test/test-fuzz.js +0 -42
- package/src/cborg/test/test-json.js +0 -219
- package/src/cborg/test/test-length.js +0 -65
- package/src/cborg/test/test-partial.js +0 -111
- package/src/cborg/tsconfig.json +0 -48
- package/src/cborg/types/cborg/decode.d.ts +0 -43
- package/src/cborg/types/cborg/decode.d.ts.map +0 -1
- package/src/cborg/types/cborg/encode.d.ts +0 -51
- package/src/cborg/types/cborg/encode.d.ts.map +0 -1
- package/src/cborg/types/cborg/index.d.ts +0 -26
- package/src/cborg/types/cborg/index.d.ts.map +0 -1
- package/src/cborg/types/cborg/is.d.ts +0 -6
- package/src/cborg/types/cborg/is.d.ts.map +0 -1
- package/src/cborg/types/example.d.ts +0 -2
- package/src/cborg/types/example.d.ts.map +0 -1
- package/src/cborg/types/interface.d.ts +0 -49
- package/src/cborg/types/interface.d.ts.map +0 -1
- package/src/cborg/types/json/decode.d.ts +0 -67
- package/src/cborg/types/json/decode.d.ts.map +0 -1
- package/src/cborg/types/json/encode.d.ts +0 -11
- package/src/cborg/types/json/encode.d.ts.map +0 -1
- package/src/cborg/types/json/json.d.ts +0 -6
- package/src/cborg/types/json/json.d.ts.map +0 -1
- package/src/cborg/types/taglib.d.ts +0 -18
- package/src/cborg/types/taglib.d.ts.map +0 -1
- package/src/cborg/types/tsconfig.tsbuildinfo +0 -1
- package/src/cborg/types/utils/0uint.d.ts +0 -102
- package/src/cborg/types/utils/0uint.d.ts.map +0 -1
- package/src/cborg/types/utils/1negint.d.ts +0 -59
- package/src/cborg/types/utils/1negint.d.ts.map +0 -1
- package/src/cborg/types/utils/2bytes.d.ts +0 -69
- package/src/cborg/types/utils/2bytes.d.ts.map +0 -1
- package/src/cborg/types/utils/3string.d.ts +0 -46
- package/src/cborg/types/utils/3string.d.ts.map +0 -1
- package/src/cborg/types/utils/4array.d.ts +0 -66
- package/src/cborg/types/utils/4array.d.ts.map +0 -1
- package/src/cborg/types/utils/5map.d.ts +0 -66
- package/src/cborg/types/utils/5map.d.ts.map +0 -1
- package/src/cborg/types/utils/6tag.d.ts +0 -62
- package/src/cborg/types/utils/6tag.d.ts.map +0 -1
- package/src/cborg/types/utils/7float.d.ts +0 -60
- package/src/cborg/types/utils/7float.d.ts.map +0 -1
- package/src/cborg/types/utils/bl.d.ts +0 -26
- package/src/cborg/types/utils/bl.d.ts.map +0 -1
- package/src/cborg/types/utils/byte-utils.d.ts +0 -53
- package/src/cborg/types/utils/byte-utils.d.ts.map +0 -1
- package/src/cborg/types/utils/common.d.ts +0 -8
- package/src/cborg/types/utils/common.d.ts.map +0 -1
- package/src/cborg/types/utils/index.d.ts +0 -13
- package/src/cborg/types/utils/index.d.ts.map +0 -1
- package/src/cborg/types/utils/jump.d.ts +0 -16
- package/src/cborg/types/utils/jump.d.ts.map +0 -1
- package/src/cborg/types/utils/token.d.ts +0 -59
- package/src/cborg/types/utils/token.d.ts.map +0 -1
- package/src/cborg/utils/0uint.js +0 -229
- package/src/cborg/utils/1negint.js +0 -111
- package/src/cborg/utils/2bytes.js +0 -135
- package/src/cborg/utils/3string.js +0 -90
- package/src/cborg/utils/4array.js +0 -114
- package/src/cborg/utils/5map.js +0 -113
- package/src/cborg/utils/6tag.js +0 -81
- package/src/cborg/utils/7float.js +0 -310
- package/src/cborg/utils/bl.js +0 -124
- package/src/cborg/utils/byte-utils.js +0 -417
- package/src/cborg/utils/common.js +0 -11
- package/src/cborg/utils/index.js +0 -12
- package/src/cborg/utils/jump.js +0 -222
- package/src/cborg/utils/token.js +0 -76
- package/src/ipfs-unixfs-exporter/LICENSE +0 -4
- package/src/ipfs-unixfs-exporter/README.md +0 -105
- package/src/ipfs-unixfs-exporter/dist/index.min.js +0 -3
- package/src/ipfs-unixfs-exporter/dist/src/errors.d.ts +0 -57
- package/src/ipfs-unixfs-exporter/dist/src/errors.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/errors.js +0 -73
- package/src/ipfs-unixfs-exporter/dist/src/errors.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/index.d.ts +0 -355
- package/src/ipfs-unixfs-exporter/dist/src/index.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/index.js +0 -197
- package/src/ipfs-unixfs-exporter/dist/src/index.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.js +0 -9
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.js +0 -9
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.js +0 -38
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.js +0 -30
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.js +0 -9
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.js +0 -37
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.js +0 -29
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.js +0 -153
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.js +0 -59
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.js +0 -25
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.js +0 -104
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.d.ts +0 -3
- package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.js +0 -20
- package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.d.ts +0 -6
- package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.js +0 -116
- package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.js +0 -57
- package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.d.ts +0 -6
- package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.js +0 -30
- package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/typedoc-urls.json +0 -58
- package/src/ipfs-unixfs-exporter/src/errors.ts +0 -87
- package/src/ipfs-unixfs-exporter/src/index.ts +0 -498
- package/src/ipfs-unixfs-exporter/src/resolvers/dag-cbor.ts +0 -12
- package/src/ipfs-unixfs-exporter/src/resolvers/dag-json.ts +0 -12
- package/src/ipfs-unixfs-exporter/src/resolvers/identity.ts +0 -49
- package/src/ipfs-unixfs-exporter/src/resolvers/index.ts +0 -35
- package/src/ipfs-unixfs-exporter/src/resolvers/json.ts +0 -12
- package/src/ipfs-unixfs-exporter/src/resolvers/raw.ts +0 -49
- package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/directory.ts +0 -39
- package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/file.ts +0 -198
- package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/hamt-sharded-directory.ts +0 -76
- package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/raw.ts +0 -37
- package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/index.ts +0 -121
- package/src/ipfs-unixfs-exporter/src/utils/extract-data-from-block.ts +0 -24
- package/src/ipfs-unixfs-exporter/src/utils/find-cid-in-shard.ts +0 -149
- package/src/ipfs-unixfs-exporter/src/utils/resolve-object-path.ts +0 -62
- package/src/ipfs-unixfs-exporter/src/utils/validate-offset-and-length.ts +0 -38
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.IpldCar = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var IpldCar=(()=>{var Nn=Object.create;var Ie=Object.defineProperty;var On=Object.getOwnPropertyDescriptor;var Dn=Object.getOwnPropertyNames;var Rn=Object.getPrototypeOf,Mn=Object.prototype.hasOwnProperty;var he=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),zt=(e,t)=>{for(var r in t)Ie(e,r,{get:t[r],enumerable:!0})},$t=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Dn(t))!Mn.call(e,o)&&o!==r&&Ie(e,o,{get:()=>t[o],enumerable:!(n=On(t,o))||n.enumerable});return e};var Se=(e,t,r)=>(r=e!=null?Nn(Rn(e)):{},$t(t||!e||!e.__esModule?Ie(r,"default",{value:e,enumerable:!0}):r,e)),zn=e=>$t(Ie({},"__esModule",{value:!0}),e);var sn=he((ia,on)=>{on.exports=At;var nn=128,Jo=127,Wo=~Jo,Qo=Math.pow(2,31);function At(e,t,r){if(Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw (At.bytes=0, new RangeError("Could not encode varint"));t=t||[],r=r||0;for(var n=r;e>=Qo;)t[r++]=e&255|nn,e/=128;for(;e&Wo;)t[r++]=e&255|nn,e>>>=7;return t[r]=e|0,At.bytes=r-n+1,t}});var fn=he((sa,cn)=>{cn.exports=Tt;var Yo=128,an=127;function Tt(e,n){var r=0,n=n||0,o=0,i=n,a,c=e.length;do{if(i>=c||o>49)throw (Tt.bytes=0, new RangeError("Could not decode varint"));a=e[i++],r+=o<28?(a&an)<<o:(a&an)*Math.pow(2,o),o+=7}while(a>=Yo);return Tt.bytes=i-n,r}});var dn=he((aa,un)=>{var Zo=Math.pow(2,7),jo=Math.pow(2,14),ei=Math.pow(2,21),ti=Math.pow(2,28),ri=Math.pow(2,35),ni=Math.pow(2,42),oi=Math.pow(2,49),ii=Math.pow(2,56),si=Math.pow(2,63);un.exports=function(e){return e<Zo?1:e<jo?2:e<ei?3:e<ti?4:e<ri?5:e<ni?6:e<oi?7:e<ii?8:e<si?9:10}});var Xe=he((ca,ln)=>{ln.exports={encode:sn(),decode:fn(),encodingLength:dn()}});var xn=he(()=>{});var Ti={};zt(Ti,{CarBlockIterator:()=>rt,CarBufferReader:()=>Ze,CarBufferWriter:()=>Ot,CarCIDIterator:()=>nt,CarIndexedReader:()=>et,CarIndexer:()=>Y,CarReader:()=>Z,CarWriter:()=>it,contentType:()=>Ai});var $n=["string","number","bigint","symbol"],Vn=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function Vt(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if($n.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(Ln(e))return"Buffer";let r=Fn(e);return r||"Object"}function Ln(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function Fn(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Vn.includes(t))return t}var s=class{constructor(t,r,n){this.major=t,this.majorEncoded=t<<5,this.name=r,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(t){return this.major<t.major?-1:this.major>t.major?1:0}};s.uint=new s(0,"uint",!0);s.negint=new s(1,"negint",!0);s.bytes=new s(2,"bytes",!0);s.string=new s(3,"string",!0);s.array=new s(4,"array",!1);s.map=new s(5,"map",!1);s.tag=new s(6,"tag",!1);s.float=new s(7,"float",!0);s.false=new s(7,"false",!0);s.true=new s(7,"true",!0);s.null=new s(7,"null",!0);s.undefined=new s(7,"undefined",!0);s.break=new s(7,"break",!0);var f=class{constructor(t,r,n){this.type=t,this.value=r,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};var ee=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Hn=new TextDecoder,Pn=new TextEncoder;function Be(e){return ee&&globalThis.Buffer.isBuffer(e)}function at(e){return e instanceof Uint8Array?Be(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Pt=ee?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):Ft(e,t,r):(e,t,r)=>r-t>64?Hn.decode(e.subarray(t,r)):Ft(e,t,r),qt=ee?e=>e.length>64?globalThis.Buffer.from(e):Lt(e):e=>e.length>64?Pn.encode(e):Lt(e),R=e=>Uint8Array.from(e),te=ee?(e,t,r)=>Be(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Gt=ee?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),at(globalThis.Buffer.concat(e,t))):(e,t)=>{let r=new Uint8Array(t),n=0;for(let o of e)n+o.length>r.length&&(o=o.subarray(0,r.length-n)),r.set(o,n),n+=o.length;return r},Kt=ee?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Xt(e,t){if(Be(e)&&Be(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}function Lt(e){let t=[],r=0;for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);o<128?t[r++]=o:o<2048?(t[r++]=o>>6|192,t[r++]=o&63|128):(o&64512)===55296&&n+1<e.length&&(e.charCodeAt(n+1)&64512)===56320?(o=65536+((o&1023)<<10)+(e.charCodeAt(++n)&1023),t[r++]=o>>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=o&63|128):(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=o&63|128)}return t}function Ft(e,t,r){let n=[];for(;t<r;){let o=e[t],i=null,a=o>239?4:o>223?3:o>191?2:1;if(t+a<=r){let c,d,h,p;switch(a){case 1:o<128&&(i=o);break;case 2:c=e[t+1],(c&192)===128&&(p=(o&31)<<6|c&63,p>127&&(i=p));break;case 3:c=e[t+1],d=e[t+2],(c&192)===128&&(d&192)===128&&(p=(o&15)<<12|(c&63)<<6|d&63,p>2047&&(p<55296||p>57343)&&(i=p));break;case 4:c=e[t+1],d=e[t+2],h=e[t+3],(c&192)===128&&(d&192)===128&&(h&192)===128&&(p=(o&15)<<18|(c&63)<<12|(d&63)<<6|h&63,p>65535&&p<1114112&&(i=p))}}i===null?(i=65533,a=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),t+=a}return qn(n)}var Ht=4096;function qn(e){let t=e.length;if(t<=Ht)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Ht));return r}var Gn=256,pe=class{constructor(t=Gn){this.chunkSize=t,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(t){let r=this.chunks[this.chunks.length-1];if(this.cursor+t.length<=this.maxCursor+1){let o=r.length-(this.maxCursor-this.cursor)-1;r.set(t,o)}else{if(r){let o=r.length-(this.maxCursor-this.cursor)-1;o<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,o),this.maxCursor=this.cursor-1)}t.length<64&&t.length<this.chunkSize?(r=Kt(this.chunkSize),this.chunks.push(r),this.maxCursor+=r.length,this._initReuseChunk===null&&(this._initReuseChunk=r),r.set(t,0)):(this.chunks.push(t),this.maxCursor+=t.length)}this.cursor+=t.length}toBytes(t=!1){let r;if(this.chunks.length===1){let n=this.chunks[0];t&&this.cursor>n.length/2?(r=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=te(n,0,this.cursor)}else r=Gt(this.chunks,this.cursor);return t&&this.reset(),r}};var l="CBOR decode error:",ct="CBOR encode error:",ye=[];ye[23]=1;ye[24]=2;ye[25]=3;ye[26]=5;ye[27]=9;function V(e,t,r){if(e.length-t<r)throw new Error(`${l} not enough data for type`)}var g=[24,256,65536,4294967296,BigInt("18446744073709551616")];function v(e,t,r){V(e,t,1);let n=e[t];if(r.strict===!0&&n<g[0])throw new Error(`${l} integer encoded in more bytes than necessary (strict decode)`);return n}function E(e,t,r){V(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<g[1])throw new Error(`${l} integer encoded in more bytes than necessary (strict decode)`);return n}function k(e,t,r){V(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<g[2])throw new Error(`${l} integer encoded in more bytes than necessary (strict decode)`);return n}function _(e,t,r){V(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],o=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],i=(BigInt(n)<<BigInt(32))+BigInt(o);if(r.strict===!0&&i<g[3])throw new Error(`${l} integer encoded in more bytes than necessary (strict decode)`);if(i<=Number.MAX_SAFE_INTEGER)return Number(i);if(r.allowBigInt===!0)return i;throw new Error(`${l} integers outside of the safe integer range are not supported`)}function Jt(e,t,r,n){return new f(s.uint,v(e,t+1,n),2)}function Wt(e,t,r,n){return new f(s.uint,E(e,t+1,n),3)}function Qt(e,t,r,n){return new f(s.uint,k(e,t+1,n),5)}function Yt(e,t,r,n){return new f(s.uint,_(e,t+1,n),9)}function T(e,t){return x(e,0,t.value)}function x(e,t,r){if(r<g[0]){let n=Number(r);e.push([t|n])}else if(r<g[1]){let n=Number(r);e.push([t|24,n])}else if(r<g[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<g[3]){let n=Number(r);e.push([t|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<g[4]){let o=[t|27,0,0,0,0,0,0,0],i=Number(n&BigInt(4294967295)),a=Number(n>>BigInt(32)&BigInt(4294967295));o[8]=i&255,i=i>>8,o[7]=i&255,i=i>>8,o[6]=i&255,i=i>>8,o[5]=i&255,o[4]=a&255,a=a>>8,o[3]=a&255,a=a>>8,o[2]=a&255,a=a>>8,o[1]=a&255,e.push(o)}else throw new Error(`${l} encountered BigInt larger than allowable range`)}}T.encodedSize=function(t){return x.encodedSize(t.value)};x.encodedSize=function(t){return t<g[0]?1:t<g[1]?2:t<g[2]?3:t<g[3]?5:9};T.compareTokens=function(t,r){return t.value<r.value?-1:t.value>r.value?1:0};function Zt(e,t,r,n){return new f(s.negint,-1-v(e,t+1,n),2)}function jt(e,t,r,n){return new f(s.negint,-1-E(e,t+1,n),3)}function er(e,t,r,n){return new f(s.negint,-1-k(e,t+1,n),5)}var ft=BigInt(-1),tr=BigInt(1);function rr(e,t,r,n){let o=_(e,t+1,n);if(typeof o!="bigint"){let i=-1-o;if(i>=Number.MIN_SAFE_INTEGER)return new f(s.negint,i,9)}if(n.allowBigInt!==!0)throw new Error(`${l} integers outside of the safe integer range are not supported`);return new f(s.negint,ft-BigInt(o),9)}function Ne(e,t){let r=t.value,n=typeof r=="bigint"?r*ft-tr:r*-1-1;x(e,t.type.majorEncoded,n)}Ne.encodedSize=function(t){let r=t.value,n=typeof r=="bigint"?r*ft-tr:r*-1-1;return n<g[0]?1:n<g[1]?2:n<g[2]?3:n<g[3]?5:9};Ne.compareTokens=function(t,r){return t.value<r.value?1:t.value>r.value?-1:0};function me(e,t,r,n){V(e,t,r+n);let o=te(e,t+r,t+r+n);return new f(s.bytes,o,r+n)}function nr(e,t,r,n){return me(e,t,1,r)}function or(e,t,r,n){return me(e,t,2,v(e,t+1,n))}function ir(e,t,r,n){return me(e,t,3,E(e,t+1,n))}function sr(e,t,r,n){return me(e,t,5,k(e,t+1,n))}function ar(e,t,r,n){let o=_(e,t+1,n);if(typeof o=="bigint")throw new Error(`${l} 64-bit integer bytes lengths not supported`);return me(e,t,9,o)}function Oe(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===s.string?qt(e.value):e.value),e.encodedBytes}function re(e,t){let r=Oe(t);x(e,t.type.majorEncoded,r.length),e.push(r)}re.encodedSize=function(t){let r=Oe(t);return x.encodedSize(r.length)+r.length};re.compareTokens=function(t,r){return Xn(Oe(t),Oe(r))};function Xn(e,t){return e.length<t.length?-1:e.length>t.length?1:Xt(e,t)}function ge(e,t,r,n,o){let i=r+n;V(e,t,i);let a=new f(s.string,Pt(e,t+r,t+i),i);return o.retainStringBytes===!0&&(a.byteValue=te(e,t+r,t+i)),a}function cr(e,t,r,n){return ge(e,t,1,r,n)}function fr(e,t,r,n){return ge(e,t,2,v(e,t+1,n),n)}function ur(e,t,r,n){return ge(e,t,3,E(e,t+1,n),n)}function dr(e,t,r,n){return ge(e,t,5,k(e,t+1,n),n)}function lr(e,t,r,n){let o=_(e,t+1,n);if(typeof o=="bigint")throw new Error(`${l} 64-bit integer string lengths not supported`);return ge(e,t,9,o,n)}var hr=re;function ne(e,t,r,n){return new f(s.array,n,r)}function pr(e,t,r,n){return ne(e,t,1,r)}function yr(e,t,r,n){return ne(e,t,2,v(e,t+1,n))}function mr(e,t,r,n){return ne(e,t,3,E(e,t+1,n))}function gr(e,t,r,n){return ne(e,t,5,k(e,t+1,n))}function wr(e,t,r,n){let o=_(e,t+1,n);if(typeof o=="bigint")throw new Error(`${l} 64-bit integer array lengths not supported`);return ne(e,t,9,o)}function xr(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${l} indefinite length items not allowed`);return ne(e,t,1,1/0)}function De(e,t){x(e,s.array.majorEncoded,t.value)}De.compareTokens=T.compareTokens;De.encodedSize=function(t){return x.encodedSize(t.value)};function oe(e,t,r,n){return new f(s.map,n,r)}function br(e,t,r,n){return oe(e,t,1,r)}function vr(e,t,r,n){return oe(e,t,2,v(e,t+1,n))}function Er(e,t,r,n){return oe(e,t,3,E(e,t+1,n))}function kr(e,t,r,n){return oe(e,t,5,k(e,t+1,n))}function _r(e,t,r,n){let o=_(e,t+1,n);if(typeof o=="bigint")throw new Error(`${l} 64-bit integer map lengths not supported`);return oe(e,t,9,o)}function Ar(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${l} indefinite length items not allowed`);return oe(e,t,1,1/0)}function Re(e,t){x(e,s.map.majorEncoded,t.value)}Re.compareTokens=T.compareTokens;Re.encodedSize=function(t){return x.encodedSize(t.value)};function Tr(e,t,r,n){return new f(s.tag,r,1)}function Ur(e,t,r,n){return new f(s.tag,v(e,t+1,n),2)}function Cr(e,t,r,n){return new f(s.tag,E(e,t+1,n),3)}function Ir(e,t,r,n){return new f(s.tag,k(e,t+1,n),5)}function Sr(e,t,r,n){return new f(s.tag,_(e,t+1,n),9)}function Me(e,t){x(e,s.tag.majorEncoded,t.value)}Me.compareTokens=T.compareTokens;Me.encodedSize=function(t){return x.encodedSize(t.value)};var jn=20,eo=21,to=22,ro=23;function Br(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${l} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new f(s.null,null,1):new f(s.undefined,void 0,1)}function Nr(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${l} indefinite length items not allowed`);return new f(s.break,void 0,1)}function ut(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${l} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${l} Infinity values are not supported`)}return new f(s.float,e,t)}function Or(e,t,r,n){return ut(dt(e,t+1),3,n)}function Dr(e,t,r,n){return ut(lt(e,t+1),5,n)}function Rr(e,t,r,n){return ut(Vr(e,t+1),9,n)}function ze(e,t,r){let n=t.value;if(n===!1)e.push([s.float.majorEncoded|jn]);else if(n===!0)e.push([s.float.majorEncoded|eo]);else if(n===null)e.push([s.float.majorEncoded|to]);else if(n===void 0)e.push([s.float.majorEncoded|ro]);else{let o,i=!1;(!r||r.float64!==!0)&&(zr(n),o=dt(S,1),n===o||Number.isNaN(n)?(S[0]=249,e.push(S.slice(0,3)),i=!0):($r(n),o=lt(S,1),n===o&&(S[0]=250,e.push(S.slice(0,5)),i=!0))),i||(no(n),o=Vr(S,1),S[0]=251,e.push(S.slice(0,9)))}}ze.encodedSize=function(t,r){let n=t.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){zr(n);let o=dt(S,1);if(n===o||Number.isNaN(n))return 3;if($r(n),o=lt(S,1),n===o)return 5}return 9};var Mr=new ArrayBuffer(9),U=new DataView(Mr,1),S=new Uint8Array(Mr,0);function zr(e){if(e===1/0)U.setUint16(0,31744,!1);else if(e===-1/0)U.setUint16(0,64512,!1);else if(Number.isNaN(e))U.setUint16(0,32256,!1);else{U.setFloat32(0,e);let t=U.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)U.setUint16(0,31744,!1);else if(r===0)U.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let o=r-127;o<-24?U.setUint16(0,0):o<-14?U.setUint16(0,(t&2147483648)>>16|1<<24+o,!1):U.setUint16(0,(t&2147483648)>>16|o+15<<10|n>>13,!1)}}}function dt(e,t){if(e.length-t<2)throw new Error(`${l} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,o=r&1023,i;return n===0?i=o*2**-24:n!==31?i=(o+1024)*2**(n-25):i=o===0?1/0:NaN,r&32768?-i:i}function $r(e){U.setFloat32(0,e,!1)}function lt(e,t){if(e.length-t<4)throw new Error(`${l} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function no(e){U.setFloat64(0,e,!1)}function Vr(e,t){if(e.length-t<8)throw new Error(`${l} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}ze.compareTokens=T.compareTokens;function y(e,t,r){throw new Error(`${l} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function $e(e){return()=>{throw new Error(`${l} ${e}`)}}var u=[];for(let e=0;e<=23;e++)u[e]=y;u[24]=Jt;u[25]=Wt;u[26]=Qt;u[27]=Yt;u[28]=y;u[29]=y;u[30]=y;u[31]=y;for(let e=32;e<=55;e++)u[e]=y;u[56]=Zt;u[57]=jt;u[58]=er;u[59]=rr;u[60]=y;u[61]=y;u[62]=y;u[63]=y;for(let e=64;e<=87;e++)u[e]=nr;u[88]=or;u[89]=ir;u[90]=sr;u[91]=ar;u[92]=y;u[93]=y;u[94]=y;u[95]=$e("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)u[e]=cr;u[120]=fr;u[121]=ur;u[122]=dr;u[123]=lr;u[124]=y;u[125]=y;u[126]=y;u[127]=$e("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)u[e]=pr;u[152]=yr;u[153]=mr;u[154]=gr;u[155]=wr;u[156]=y;u[157]=y;u[158]=y;u[159]=xr;for(let e=160;e<=183;e++)u[e]=br;u[184]=vr;u[185]=Er;u[186]=kr;u[187]=_r;u[188]=y;u[189]=y;u[190]=y;u[191]=Ar;for(let e=192;e<=215;e++)u[e]=Tr;u[216]=Ur;u[217]=Cr;u[218]=Ir;u[219]=Sr;u[220]=y;u[221]=y;u[222]=y;u[223]=y;for(let e=224;e<=243;e++)u[e]=$e("simple values are not supported");u[244]=y;u[245]=y;u[246]=y;u[247]=Br;u[248]=$e("simple values are not supported");u[249]=Or;u[250]=Dr;u[251]=Rr;u[252]=y;u[253]=y;u[254]=y;u[255]=Nr;var B=[];for(let e=0;e<24;e++)B[e]=new f(s.uint,e,1);for(let e=-1;e>=-24;e--)B[31-e]=new f(s.negint,e,1);B[64]=new f(s.bytes,new Uint8Array(0),1);B[96]=new f(s.string,"",1);B[128]=new f(s.array,0,1);B[160]=new f(s.map,0,1);B[244]=new f(s.false,!1,1);B[245]=new f(s.true,!0,1);B[246]=new f(s.null,null,1);function Ve(e){switch(e.type){case s.false:return R([244]);case s.true:return R([245]);case s.null:return R([246]);case s.bytes:return e.value.length?void 0:R([64]);case s.string:return e.value===""?R([96]):void 0;case s.array:return e.value===0?R([128]):void 0;case s.map:return e.value===0?R([160]):void 0;case s.uint:return e.value<24?R([Number(e.value)]):void 0;case s.negint:if(e.value>=-24)return R([31-Number(e.value)])}}var io={float64:!1,mapSorter:ao,quickEncodeToken:Ve};function pt(){let e=[];return e[s.uint.major]=T,e[s.negint.major]=Ne,e[s.bytes.major]=re,e[s.string.major]=hr,e[s.array.major]=De,e[s.map.major]=Re,e[s.tag.major]=Me,e[s.float.major]=ze,e}var Lr=pt(),ht=new pe,Le=class e{constructor(t,r){this.obj=t,this.parent=r}includes(t){let r=this;do if(r.obj===t)return!0;while(r=r.parent);return!1}static createCheck(t,r){if(t&&t.includes(r))throw new Error(`${ct} object contains circular references`);return new e(r,t)}},H={null:new f(s.null,null),undefined:new f(s.undefined,void 0),true:new f(s.true,!0),false:new f(s.false,!1),emptyArray:new f(s.array,0),emptyMap:new f(s.map,0)},P={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new f(s.float,e):e>=0?new f(s.uint,e):new f(s.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new f(s.uint,e):new f(s.negint,e)},Uint8Array(e,t,r,n){return new f(s.bytes,e)},string(e,t,r,n){return new f(s.string,e)},boolean(e,t,r,n){return e?H.true:H.false},null(e,t,r,n){return H.null},undefined(e,t,r,n){return H.undefined},ArrayBuffer(e,t,r,n){return new f(s.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new f(s.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[H.emptyArray,new f(s.break)]:H.emptyArray;n=Le.createCheck(n,e);let o=[],i=0;for(let a of e)o[i++]=we(a,r,n);return r.addBreakTokens?[new f(s.array,e.length),o,new f(s.break)]:[new f(s.array,e.length),o]},Object(e,t,r,n){let o=t!=="Object",i=o?e.keys():Object.keys(e),a=o?e.size:i.length;if(!a)return r.addBreakTokens===!0?[H.emptyMap,new f(s.break)]:H.emptyMap;n=Le.createCheck(n,e);let c=[],d=0;for(let h of i)c[d++]=[we(h,r,n),we(o?e.get(h):e[h],r,n)];return so(c,r),r.addBreakTokens?[new f(s.map,a),c,new f(s.break)]:[new f(s.map,a),c]}};P.Map=P.Object;P.Buffer=P.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))P[`${e}Array`]=P.DataView;function we(e,t={},r){let n=Vt(e),o=t&&t.typeEncoders&&t.typeEncoders[n]||P[n];if(typeof o=="function"){let a=o(e,n,t,r);if(a!=null)return a}let i=P[n];if(!i)throw new Error(`${ct} unsupported type: ${n}`);return i(e,n,t,r)}function so(e,t){t.mapSorter&&e.sort(t.mapSorter)}function ao(e,t){let r=Array.isArray(e[0])?e[0][0]:e[0],n=Array.isArray(t[0])?t[0][0]:t[0];if(r.type!==n.type)return r.type.compare(n.type);let o=r.type.major,i=Lr[o].compareTokens(r,n);return i===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),i}function Fr(e,t,r,n){if(Array.isArray(t))for(let o of t)Fr(e,o,r,n);else r[t.type.major](e,t,n)}function co(e,t,r){let n=we(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){let o=r.quickEncodeToken(n);if(o)return o;let i=t[n.type.major];if(i.encodedSize){let a=i.encodedSize(n,r),c=new pe(a);if(i(c,n,r),c.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return at(c.chunks[0])}}return ht.reset(),Fr(ht,n,t,r),ht.toBytes(!0)}function yt(e,t){return t=Object.assign({},io,t),co(e,Lr,t)}var fo={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Fe=class{constructor(t,r={}){this._pos=0,this.data=t,this.options=r}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let t=this.data[this._pos],r=B[t];if(r===void 0){let n=u[t];if(!n)throw new Error(`${l} no decoder for major type ${t>>>5} (byte 0x${t.toString(16).padStart(2,"0")})`);let o=t&31;r=n(this.data,this._pos,o,this.options)}return this._pos+=r.encodedLength,r}},xe=Symbol.for("DONE"),He=Symbol.for("BREAK");function uo(e,t,r){let n=[];for(let o=0;o<e.value;o++){let i=ie(t,r);if(i===He){if(e.value===1/0)break;throw new Error(`${l} got unexpected break to lengthed array`)}if(i===xe)throw new Error(`${l} found array but not enough entries (got ${o}, expected ${e.value})`);n[o]=i}return n}function lo(e,t,r){let n=r.useMaps===!0,o=n?void 0:{},i=n?new Map:void 0;for(let a=0;a<e.value;a++){let c=ie(t,r);if(c===He){if(e.value===1/0)break;throw new Error(`${l} got unexpected break to lengthed map`)}if(c===xe)throw new Error(`${l} found map but not enough entries (got ${a} [no key], expected ${e.value})`);if(n!==!0&&typeof c!="string")throw new Error(`${l} non-string keys not supported (got ${typeof c})`);if(r.rejectDuplicateMapKeys===!0&&(n&&i.has(c)||!n&&c in o))throw new Error(`${l} found repeat map key "${c}"`);let d=ie(t,r);if(d===xe)throw new Error(`${l} found map but not enough entries (got ${a} [no value], expected ${e.value})`);n?i.set(c,d):o[c]=d}return n?i:o}function ie(e,t){if(e.done())return xe;let r=e.next();if(r.type===s.break)return He;if(r.type.terminal)return r.value;if(r.type===s.array)return uo(r,e,t);if(r.type===s.map)return lo(r,e,t);if(r.type===s.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=ie(e,t);return t.tags[r.value](n)}throw new Error(`${l} tag not supported (${r.value})`)}throw new Error("unsupported")}function Hr(e,t){if(!(e instanceof Uint8Array))throw new Error(`${l} data to decode must be a Uint8Array`);t=Object.assign({},fo,t);let r=t.tokenizer||new Fe(e,t),n=ie(r,t);if(n===xe)throw new Error(`${l} did not find any content to decode`);if(n===He)throw new Error(`${l} got unexpected break`);return[n,e.subarray(r.pos())]}function mt(e,t){let[r,n]=Hr(e,t);if(n.length>0)throw new Error(`${l} too many terminals, data makes no sense`);return r}var As=new Uint8Array(0);function Pr(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function se(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function po(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<e.length;o++){var i=e.charAt(o),a=i.charCodeAt(0);if(r[a]!==255)throw new TypeError(i+" is ambiguous");r[a]=o}var c=e.length,d=e.charAt(0),h=Math.log(c)/Math.log(256),p=Math.log(256)/Math.log(c);function j(m){if(m instanceof Uint8Array||(ArrayBuffer.isView(m)?m=new Uint8Array(m.buffer,m.byteOffset,m.byteLength):Array.isArray(m)&&(m=Uint8Array.from(m))),!(m instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(m.length===0)return"";for(var b=0,W=0,C=0,N=m.length;C!==N&&m[C]===0;)C++,b++;for(var O=(N-C)*p+1>>>0,A=new Uint8Array(O);C!==N;){for(var D=m[C],F=0,I=O-1;(D!==0||F<W)&&I!==-1;I--,F++)D+=256*A[I]>>>0,A[I]=D%c>>>0,D=D/c>>>0;if(D!==0)throw new Error("Non-zero carry");W=F,C++}for(var $=O-W;$!==O&&A[$]===0;)$++;for(var Ce=d.repeat(b);$<O;++$)Ce+=e.charAt(A[$]);return Ce}function Ue(m){if(typeof m!="string")throw new TypeError("Expected String");if(m.length===0)return new Uint8Array;var b=0;if(m[b]!==" "){for(var W=0,C=0;m[b]===d;)W++,b++;for(var N=(m.length-b)*h+1>>>0,O=new Uint8Array(N);m[b];){var A=r[m.charCodeAt(b)];if(A===255)return;for(var D=0,F=N-1;(A!==0||D<C)&&F!==-1;F--,D++)A+=c*O[F]>>>0,O[F]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");C=D,b++}if(m[b]!==" "){for(var I=N-C;I!==N&&O[I]===0;)I++;for(var $=new Uint8Array(W+(N-I)),Ce=W;I!==N;)$[Ce++]=O[I++];return $}}}function Bn(m){var b=Ue(m);if(b)return b;throw new Error(`Non-${t} character`)}return{encode:j,decodeUnsafe:Ue,decode:Bn}}var yo=po,mo=yo,qr=mo;var gt=class{name;prefix;baseEncode;constructor(t,r,n){this.name=t,this.prefix=r,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},wt=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,r,n){this.name=t,this.prefix=r;let o=r.codePointAt(0);if(o===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=o,this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Gr(this,t)}},xt=class{decoders;constructor(t){this.decoders=t}or(t){return Gr(this,t)}decode(t){let r=t[0],n=this.decoders[r];if(n!=null)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Gr(e,t){return new xt({...(e.decoders ?? {[e.prefix]:e}),...(t.decoders ?? {[t.prefix]:t})});}var bt=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,r,n,o){this.name=t,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new gt(t,r,n),this.decoder=new wt(t,r,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function Kr({name:e,prefix:t,encode:r,decode:n}){return new bt(e,t,r,n)}function ae({name:e,prefix:t,alphabet:r}){let{encode:n,decode:o}=qr(r,e);return Kr({prefix:t,name:e,encode:n,decode:i=>se(o(i))})}function go(e,t,r,n){let o={};for(let p=0;p<t.length;++p)o[t[p]]=p;let i=e.length;for(;e[i-1]==="=";)--i;let a=new Uint8Array(i*r/8|0),c=0,d=0,h=0;for(let p=0;p<i;++p){let j=o[e[p]];if(j===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<r|j,c+=r,c>=8&&(c-=8,a[h++]=255&d>>c)}if(c>=r||(255&d<<8-c)!==0)throw new SyntaxError("Unexpected end of data");return a}function wo(e,t,r){let n=t[t.length-1]==="=",o=(1<<r)-1,i="",a=0,c=0;for(let d=0;d<e.length;++d)for(c=c<<8|e[d],a+=8;a>r;)a-=r,i+=t[o&c>>a];if(a!==0&&(i+=t[o&c<<r-a]),n)for(;(i.length*r&7)!==0;)i+="=";return i}function M({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return Kr({prefix:t,name:e,encode(o){return wo(o,n,r)},decode(o){return go(o,n,r,e)}})}var be=M({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ns=M({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Os=M({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ds=M({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Rs=M({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ms=M({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),zs=M({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),$s=M({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Vs=M({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Pe=ae({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Hs=ae({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var L=ae({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Gs=ae({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var xo=Wr,Xr=128,bo=127,vo=~bo,Eo=Math.pow(2,31);function Wr(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Eo;)t[r++]=e&255|Xr,e/=128;for(;e&vo;)t[r++]=e&255|Xr,e>>>=7;return t[r]=e|0,Wr.bytes=r-n+1,t}var ko=vt,_o=128,Jr=127;function vt(e,n){var r=0,n=n||0,o=0,i=n,a,c=e.length;do{if(i>=c)throw (vt.bytes=0, new RangeError("Could not decode varint"));a=e[i++],r+=o<28?(a&Jr)<<o:(a&Jr)*Math.pow(2,o),o+=7}while(a>=_o);return vt.bytes=i-n,r}var Ao=Math.pow(2,7),To=Math.pow(2,14),Uo=Math.pow(2,21),Co=Math.pow(2,28),Io=Math.pow(2,35),So=Math.pow(2,42),Bo=Math.pow(2,49),No=Math.pow(2,56),Oo=Math.pow(2,63),Do=function(e){return e<Ao?1:e<To?2:e<Uo?3:e<Co?4:e<Io?5:e<So?6:e<Bo?7:e<No?8:e<Oo?9:10},Ro={encode:xo,decode:ko,encodingLength:Do},Mo=Ro,ve=Mo;function Ee(e,t=0){return[ve.decode(e,t),ve.decode.bytes]}function ce(e,t,r=0){return ve.encode(e,t,r),t}function fe(e){return ve.encodingLength(e)}function Yr(e,t){let r=t.byteLength,n=fe(e),o=n+fe(r),i=new Uint8Array(o+r);return ce(e,i,0),ce(r,i,n),i.set(t,o),new ue(e,r,t,i)}function q(e){let t=se(e),[r,n]=Ee(t),[o,i]=Ee(t.subarray(n)),a=t.subarray(n+i);if(a.byteLength!==o)throw new Error("Incorrect length");return new ue(r,o,a,t)}function Zr(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Pr(e.bytes,r.bytes)}}var ue=class{code;size;digest;bytes;constructor(t,r,n,o){this.code=t,this.size=r,this.digest=n,this.bytes=o}};function jr(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return $o(r,kt(e),t??L.encoder);default:return Vo(r,kt(e),t??be.encoder)}}var en=new WeakMap;function kt(e){let t=en.get(e);if(t==null){let r=new Map;return en.set(e,r),r}return t}var w=class e{code;version;multihash;bytes;"/";constructor(t,r,n,o){this.code=r,this.version=t,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==ke)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Lo)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return e.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=Yr(t,r);return e.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return e.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&Zr(t.multihash,n.multihash)}toString(t){return jr(this,t)}toJSON(){return{"/":jr(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof e)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:i,bytes:a}=r;return new e(n,o,i,a??tn(n,o,i.bytes))}else if(r[Fo]===!0){let{version:n,multihash:o,code:i}=r,a=q(o);return e.create(n,i,a)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==ke)throw new Error(`Version 0 CID must use dag-pb (code: ${ke}) block encoding`);return new e(t,r,n,n.bytes)}case 1:{let o=tn(t,r,n.bytes);return new e(t,r,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return e.create(0,ke,t)}static createV1(t,r){return e.create(1,t,r)}static decode(t){let[r,n]=e.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=e.inspectBytes(t),n=r.size-r.multihashSize,o=se(t.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let i=o.subarray(r.multihashSize-r.digestSize),a=new ue(r.multihashCode,r.digestSize,i,o);return[r.version===0?e.createV0(a):e.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[j,Ue]=Ee(t.subarray(r));return r+=Ue,j},o=n(),i=ke;if(o===18?(o=0,r=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let a=r,c=n(),d=n(),h=r+d,p=h-a;return{version:o,codec:i,multihashCode:c,digestSize:d,multihashSize:p,size:h}}static parse(t,r){let[n,o]=zo(t,r),i=e.decode(o);if(i.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return kt(i).set(n,t),i}};function zo(e,t){switch(e[0]){case"Q":{let r=t??L;return[L.prefix,r.decode(`${L.prefix}${e}`)]}case L.prefix:{let r=t??L;return[L.prefix,r.decode(e)]}case be.prefix:{let r=t??be;return[be.prefix,r.decode(e)]}case Pe.prefix:{let r=t??Pe;return[Pe.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function $o(e,t,r){let{prefix:n}=r;if(n!==L.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=t.get(n);if(o==null){let i=r.encode(e).slice(1);return t.set(n,i),i}else return o}function Vo(e,t,r){let{prefix:n}=r,o=t.get(n);if(o==null){let i=r.encode(e);return t.set(n,i),i}else return o}var ke=112,Lo=18;function tn(e,t,r){let n=fe(e),o=n+fe(t),i=new Uint8Array(o+r.byteLength);return ce(e,i,0),ce(t,i,n),i.set(r,o),i}var Fo=Symbol.for("@ipld/js-cid/CID");var rn=42;function Ho(e){return e instanceof ArrayBuffer?new Uint8Array(e,0,e.byteLength):e}function Po(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=w.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new f(s.tag,rn),new f(s.bytes,r)]}function qo(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function Go(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}var _t={float64:!0,typeEncoders:{Object:Po,undefined:qo,number:Go}},na={..._t,typeEncoders:{..._t.typeEncoders}};function Ko(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return w.decode(e.subarray(1))}var qe={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};qe.tags[rn]=Ko;var oa={...qe,tags:qe.tags.slice()};var Ge=e=>yt(e,_t),Ke=e=>mt(Ho(e),qe);var G=Se(Xe(),1),K={SHA2_256:18,LENGTH:32,DAG_PB:112},Je=40;function z(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=G.default.decode(e);return t.seek(G.default.decode.bytes),r}function We(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=0;return{version:2,characteristics:[t.getBigUint64(r,!0),t.getBigUint64(r+=8,!0)],dataOffset:Number(t.getBigUint64(r+=8,!0)),dataSize:Number(t.getBigUint64(r+=8,!0)),indexOffset:Number(t.getBigUint64(r+=8,!0))}}function Qe(e){G.default.decode(e);let t=G.default.decode.bytes,r=G.default.decode(e.subarray(G.default.decode.bytes)),n=G.default.decode.bytes;return t+n+r}var X={Null:e=>e===null?e:void 0,Int:e=>Number.isInteger(e)?e:void 0,Float:e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,String:e=>typeof e=="string"?e:void 0,Bool:e=>typeof e=="boolean"?e:void 0,Bytes:e=>e instanceof Uint8Array?e:void 0,Link:e=>e!==null&&typeof e=="object"&&e.asCID===e?e:void 0,List:e=>Array.isArray(e)?e:void 0,Map:e=>e!==null&&typeof e=="object"&&e.asCID!==e&&!Array.isArray(e)&&!(e instanceof Uint8Array)?e:void 0},_e={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":X.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(X.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=_e["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let o=t;o<e.length;o++){let i=e[o];if(i=_e["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](i),i===void 0)return;n.push(i)}return n}}return e}},Int:X.Int,CarV1HeaderOrV2Pragma:e=>{if(X.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let o=0;o<t.length;o++){let[i,a]=t[o];switch(i){case"roots":{let c=_e["CarV1HeaderOrV2Pragma > roots (anon)"](e[i]);if(c===void 0)return;if(c!==a||r!==e){if(r===e){r={};for(let d=0;d<o;d++)r[t[d][0]]=t[d][1]}r.roots=c}}break;case"version":{n--;let c=_e.Int(e[i]);if(c===void 0)return;if(c!==a||r!==e){if(r===e){r={};for(let d=0;d<o;d++)r[t[d][0]]=t[d][1]}r.version=c}}break;default:return}}if(!(n>0))return r}},Ae={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":X.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(X.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Ae["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let o=t;o<e.length;o++){let i=e[o];if(i=Ae["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](i),i===void 0)return;n.push(i)}return n}}return e}},Int:X.Int,CarV1HeaderOrV2Pragma:e=>{if(X.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let o=0;o<t.length;o++){let[i,a]=t[o];switch(i){case"roots":{let c=Ae["CarV1HeaderOrV2Pragma > roots (anon)"](a);if(c===void 0)return;if(c!==a||r!==e){if(r===e){r={};for(let d=0;d<o;d++)r[t[d][0]]=t[d][1]}r.roots=c}}break;case"version":{n--;let c=Ae.Int(a);if(c===void 0)return;if(c!==a||r!==e){if(r===e){r={};for(let d=0;d<o;d++)r[t[d][0]]=t[d][1]}r.version=c}}break;default:return}}if(!(n>0))return r}},Ye={toTyped:_e.CarV1HeaderOrV2Pragma,toRepresentation:Ae.CarV1HeaderOrV2Pragma};function hn(e,t){let r=z(e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=e.exactly(r,!0),o=Ke(n);if(Ye.toTyped(o)===void 0)throw new Error("Invalid CAR header format");if(o.version!==1&&o.version!==2||t!==void 0&&o.version!==t)throw new Error(`Invalid CAR version: ${o.version}${t!==void 0?` (expected ${t})`:""}`);if(o.version===1){if(!Array.isArray(o.roots))throw new Error("Invalid CAR header format");return o}if(o.roots!==void 0)throw new Error("Invalid CAR header format");let i=We(e.exactly(Je,!0));e.seek(i.dataOffset-e.pos);let a=hn(e,1);return Object.assign(a,i)}function ai(e){let t=e.exactly(2,!1);if(t[0]===K.SHA2_256&&t[1]===K.LENGTH){let a=e.exactly(34,!0),c=q(a);return w.create(0,K.DAG_PB,c)}let r=z(e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=z(e.upTo(8),e),o=e.exactly(Qe(e.upTo(8)),!0),i=q(o);return w.create(r,n,i)}function ci(e){let t=e.pos,r=z(e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=ai(e),o=r-Number(e.pos-t);return{cid:n,length:r,blockLength:o}}function pn(e){let t=fi(e),r=hn(t);if(r.version===2){let o=t.pos-r.dataOffset;t=ui(t,r.dataSize-o)}let n=[];for(;t.upTo(8).length>0;){let{cid:o,blockLength:i}=ci(t);n.push({cid:o,bytes:t.exactly(i,!0)})}return{header:r,blocks:n}}function fi(e){let t=0;return{upTo(r){return e.subarray(t,t+Math.min(r,e.length-t))},exactly(r,n=!1){if(r>e.length-t)throw new Error("Unexpected end of data");let o=e.subarray(t,t+r);return n&&(t+=r),o},seek(r){t+=r},get pos(){return t}}}function ui(e,t){let r=0;return{upTo(n){let o=e.upTo(n);return o.length+r>t&&(o=o.subarray(0,t-r)),o},exactly(n,o=!1){let i=e.exactly(n,o);if(i.length+r>t)throw new Error("Unexpected end of data");return o&&(r+=n),i},seek(n){r+=n,e.seek(n)},get pos(){return e.pos}}}var Ze=class e{constructor(t,r){this._header=t,this._blocks=r,this._cids=void 0}get version(){return this._header.version}getRoots(){return this._header.roots}has(t){return this._blocks.some(r=>r.cid.equals(t))}get(t){return this._blocks.find(r=>r.cid.equals(t))}blocks(){return this._blocks}cids(){return this._cids||(this._cids=this._blocks.map(t=>t.cid)),this._cids}static fromBytes(t){if(!(t instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");let{header:r,blocks:n}=pn(t);return new e(r,n)}};var Ot={};zt(Ot,{addBlock:()=>gn,addRoot:()=>mn,blockLength:()=>pi,calculateHeaderLength:()=>Bt,close:()=>wn,createWriter:()=>wi,estimateHeaderLength:()=>gi,headerLength:()=>Nt,resizeHeader:()=>St});var li=pt(),hi={float64:!1,quickEncodeToken:Ve};function Ut(e,t=li,r=hi){if(Array.isArray(e)){let n=0;for(let o of e)n+=Ut(o,t,r);return n}else{let n=t[e.type.major];if(n.encodedSize===void 0||typeof n.encodedSize!="function")throw new Error(`Encoder for ${e.type.name} does not have an encodedSize()`);return n.encodedSize(e,r)}}var Te=Se(Xe(),1),It=class{constructor(t,r){this.bytes=t,this.byteOffset=r,this.roots=[],this.headerSize=r}addRoot(t,r){return mn(this,t,r),this}write(t){return gn(this,t),this}close(t){return wn(this,t)}},mn=(e,t,r={})=>{let{resize:n=!1}=r,{bytes:o,headerSize:i,byteOffset:a,roots:c}=e;e.roots.push(t);let d=Nt(e);if(d>i)if(d-i+a<o.byteLength)if(n)St(e,d);else throw (c.pop(), new RangeError(`Header of size ${i} has no capacity for new root ${t}.
|
|
3
|
-
However there is a space in the buffer and you could call addRoot(root, { resize: root }) to resize header to make a space for this root.`));else throw (c.pop(), new RangeError(`Buffer has no capacity for a new root ${t}`))},pi=({cid:e,bytes:t})=>{let r=e.bytes.byteLength+t.byteLength;return Te.default.encodingLength(r)+r},gn=(e,{cid:t,bytes:r})=>{let n=t.bytes.byteLength+r.byteLength,o=Te.default.encode(n);if(e.byteOffset+o.length+n>e.bytes.byteLength)throw new RangeError("Buffer has no capacity for this block");Ct(e,o),Ct(e,t.bytes),Ct(e,r)},wn=(e,t={})=>{let{resize:r=!1}=t,{roots:n,bytes:o,byteOffset:i,headerSize:a}=e,c=Ge({version:1,roots:n}),d=Te.default.encode(c.length),h=d.length+c.byteLength;if(a-h===0)return yn(e,d,c),o.subarray(0,i);if(r)return St(e,h),yn(e,d,c),o.subarray(0,e.byteOffset);throw new RangeError(`Header size was overestimated.
|
|
4
|
-
You can use close({ resize: true }) to resize header`)},St=(e,t)=>{let{bytes:r,headerSize:n}=e;r.set(r.subarray(n,e.byteOffset),t),e.byteOffset+=t-n,e.headerSize=t},Ct=(e,t)=>{e.bytes.set(t,e.byteOffset),e.byteOffset+=t.length},yn=({bytes:e},t,r)=>{e.set(t),e.set(r,t.length)},yi=[new f(s.map,2),new f(s.string,"version"),new f(s.uint,1),new f(s.string,"roots")],mi=new f(s.tag,42),Bt=e=>{let t=[...yi];t.push(new f(s.array,e.length));for(let n of e)t.push(mi),t.push(new f(s.bytes,{length:n+1}));let r=Ut(t);return Te.default.encodingLength(r)+r},Nt=({roots:e})=>Bt(e.map(t=>t.bytes.byteLength)),gi=(e,t=36)=>Bt(new Array(e).fill(t)),wi=(e,t={})=>{let{roots:r=[],byteOffset:n=0,byteLength:o=e.byteLength,headerSize:i=Nt({roots:r})}=t,a=new Uint8Array(e,n,o),c=new It(a,i);for(let d of r)c.addRoot(d);return c};var Dt=Se(xn(),1);async function je(e,t){let r=z(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),o=Ke(n);if(Ye.toTyped(o)===void 0)throw new Error("Invalid CAR header format");if(o.version!==1&&o.version!==2||t!==void 0&&o.version!==t)throw new Error(`Invalid CAR version: ${o.version}${t!==void 0?` (expected ${t})`:""}`);if(o.version===1){if(!Array.isArray(o.roots))throw new Error("Invalid CAR header format");return o}if(o.roots!==void 0)throw new Error("Invalid CAR header format");let i=We(await e.exactly(Je,!0));e.seek(i.dataOffset-e.pos);let a=await je(e,1);return Object.assign(a,i)}async function xi(e){let t=await e.exactly(2,!1);if(t[0]===K.SHA2_256&&t[1]===K.LENGTH){let a=await e.exactly(34,!0),c=q(a);return w.create(0,K.DAG_PB,c)}let r=z(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=z(await e.upTo(8),e),o=await e.exactly(Qe(await e.upTo(8)),!0),i=q(o);return w.create(r,n,i)}async function bn(e){let t=e.pos,r=z(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await xi(e),o=r-Number(e.pos-t);return{cid:n,length:r,blockLength:o}}async function bi(e){let{cid:t,blockLength:r}=await bn(e);return{bytes:await e.exactly(r,!0),cid:t}}async function vi(e){let t=e.pos,{cid:r,length:n,blockLength:o}=await bn(e),i={cid:r,length:n,blockLength:o,offset:t,blockOffset:e.pos};return e.seek(i.blockLength),i}function de(e){let t=(async()=>{let r=await je(e);if(r.version===2){let n=e.pos-r.dataOffset;e=ki(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await bi(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await vi(e)}}}function J(e){let t=0;return{async upTo(r){return e.subarray(t,t+Math.min(r,e.length-t))},async exactly(r,n=!1){if(r>e.length-t)throw new Error("Unexpected end of data");let o=e.subarray(t,t+r);return n&&(t+=r),o},seek(r){t+=r},get pos(){return t}}}function Ei(e){let t=0,r=0,n=0,o=new Uint8Array(0),i=async a=>{r=o.length-n;let c=[o.subarray(n)];for(;r<a;){let h=await e();if(h==null)break;r<0?h.length>r&&c.push(h.subarray(-r)):c.push(h),r+=h.length}o=new Uint8Array(c.reduce((h,p)=>h+p.length,0));let d=0;for(let h of c)o.set(h,d),d+=h.length;n=0};return {async upTo(a){return o.length-n<a&&(await i(a)),o.subarray(n,n+Math.min(o.length-n,a));},async exactly(a,c=!1){if(o.length-n<a&&(await i(a)),o.length-n<a)throw new Error("Unexpected end of data");let d=o.subarray(n,n+a);return c&&(t+=a,n+=a),d},seek(a){t+=a,n+=a},get pos(){return t}};}function le(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return Ei(r)}function ki(e,t){let r=0;return{async upTo(n){let o=await e.upTo(n);return o.length+r>t&&(o=o.subarray(0,t-r)),o},async exactly(n,o=!1){let i=await e.exactly(n,o);if(i.length+r>t)throw new Error("Unexpected end of data");return o&&(r+=n),i},seek(n){r+=n,e.seek(n)},get pos(){return e.pos}}}var Y=class{constructor(t,r,n){this._version=t,this._roots=r,this._iterator=n}get version(){return this._version}async getRoots(){return this._roots}[Symbol.asyncIterator](){return this._iterator}static async fromBytes(t){if(!(t instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return vn(J(t))}static async fromIterable(t){if(!t||typeof t[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return vn(le(t))}};async function vn(e){let t=de(e),{version:r,roots:n}=await t.header();return new Y(r,n,t.blocksIndex())}var Z=class{constructor(t,r){this._header=t,this._blocks=r,this._keys=r.map(n=>n.cid.toString())}get version(){return this._header.version}async getRoots(){return this._header.roots}async has(t){return this._keys.indexOf(t.toString())>-1}async get(t){let r=this._keys.indexOf(t.toString());return r>-1?this._blocks[r]:void 0}async*blocks(){for(let t of this._blocks)yield t}async*cids(){for(let t of this._blocks)yield t.cid}static async fromBytes(t){if(!(t instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return En(J(t))}static async fromIterable(t){if(!t||typeof t[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return En(le(t))}};async function En(e){let t=de(e),r=await t.header(),n=[];for await(let o of t.blocks())n.push(o);return new Z(r,n)}var et=class e{constructor(t,r,n,o,i){this._version=t,this._path=r,this._roots=n,this._index=o,this._order=i,this._fd=null}get version(){return this._version}async getRoots(){return this._roots}async has(t){return this._index.has(t.toString())}async get(t){let r=this._index.get(t.toString());if(!r)return;this._fd||(this._fd=await Dt.default.promises.open(this._path,"r"));let n={cid:t,length:0,offset:0,blockLength:r.blockLength,blockOffset:r.blockOffset};return Z.readRaw(this._fd,n)}async*blocks(){for(let t of this._order){let r=await this.get(w.parse(t));if(!r)throw new Error("Unexpected internal error");yield r}}async*cids(){for(let t of this._order)yield w.parse(t)}async close(){if(this._fd)return this._fd.close()}static async fromFile(t){if(typeof t!="string")throw new TypeError("fromFile() requires a file path string");let r=await Y.fromIterable((void 0).from(Dt.default.createReadStream(t))),n=new Map,o=[];for await(let{cid:i,blockLength:a,blockOffset:c}of r){let d=i.toString();n.set(d,{blockLength:a,blockOffset:c}),o.push(d)}return new e(r.version,t,await r.getRoots(),n,o)}};var tt=class{constructor(t,r,n){this._version=t,this._roots=r,this._iterable=n,this._decoded=!1}get version(){return this._version}async getRoots(){return this._roots}},rt=class e extends tt{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");return this._decoded=!0,this._iterable[Symbol.asyncIterator]()}static async fromBytes(t){let{version:r,roots:n,iterator:o}=await _n(t);return new e(r,n,o)}static async fromIterable(t){let{version:r,roots:n,iterator:o}=await An(t);return new e(r,n,o)}},nt=class e extends tt{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");this._decoded=!0;let t=this._iterable[Symbol.asyncIterator]();return{async next(){let r=await t.next();return r.done?r:{done:!1,value:r.value.cid}}}}static async fromBytes(t){let{version:r,roots:n,iterator:o}=await _n(t);return new e(r,n,o)}static async fromIterable(t){let{version:r,roots:n,iterator:o}=await An(t);return new e(r,n,o)}};async function _n(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Tn(J(e))}async function An(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Tn(le(e))}async function Tn(e){let t=de(e),{version:r,roots:n}=await t.header();return{version:r,roots:n,iterator:t.blocks()}}var Rt=Se(Xe(),1),Un=1;function Mt(e){let t=Ge({version:Un,roots:e}),r=Rt.default.encode(t.length),n=new Uint8Array(r.length+t.length);return n.set(r,0),n.set(t,r.length),n}function Cn(e){return {async setRoots(t){let r=Mt(t);await e.write(r)},async writeBlock(t){let{cid:r,bytes:n}=t;await e.write(new Uint8Array(Rt.default.encode(r.bytes.length+n.length))),await e.write(r.bytes),n.length&&(await e.write(n))},async close(){await e.end()},version(){return Un}};}function ot(){}function In(){let e=[],t=null,r=ot,n=!1,o=null,i=ot,a=()=>(t||(t=new Promise(h=>{r=()=>{t=null,r=ot,h()}})),t),c={write(h){e.push(h);let p=a();return i(),p},async end(){n=!0;let h=a();i(),await h}},d={async next(){let h=e.shift();return h?(e.length===0&&r(),{done:!1,value:h}):n?(r(),{done:!0,value:void 0}):(o||(o=new Promise(p=>{i=()=>(o=null,i=ot,p(d.next()))})),o)}};return{writer:c,iterator:d}}var it=class e{constructor(t,r){this._encoder=r,this._mutex=r.setRoots(t),this._ended=!1}async put(t){if(!(t.bytes instanceof Uint8Array)||!t.cid)throw new TypeError("Can only write {cid, bytes} objects");if(this._ended)throw new Error("Already closed");let r=w.asCID(t.cid);if(!r)throw new TypeError("Can only write {cid, bytes} objects");return this._mutex=this._mutex.then(()=>this._encoder.writeBlock({cid:r,bytes:t.bytes})),this._mutex}async close(){if(this._ended)throw new Error("Already closed");return await this._mutex,this._ended=!0,this._encoder.close()}version(){return this._encoder.version()}static create(t){t=_i(t);let{encoder:r,iterator:n}=Sn(),o=new e(t,r),i=new st(n);return{writer:o,out:i}}static createAppender(){let{encoder:t,iterator:r}=Sn();t.setRoots=()=>Promise.resolve();let n=new e([],t),o=new st(r);return{writer:n,out:o}}static async updateRootsInBytes(t,r){let n=J(t);await je(n);let o=Mt(r);if(Number(n.pos)!==o.length)throw new Error(`updateRoots() can only overwrite a header of the same length (old header is ${n.pos} bytes, new header is ${o.length} bytes)`);return t.set(o,0),t}},st=class{constructor(t){this._iterator=t}[Symbol.asyncIterator](){if(this._iterating)throw new Error("Multiple iterator not supported");return this._iterating=!0,this._iterator}};function Sn(){let e=In(),{writer:t,iterator:r}=e;return{encoder:Cn(t),iterator:r}}function _i(e){if(e===void 0)return[];if(!Array.isArray(e)){let r=w.asCID(e);if(!r)throw new TypeError("roots must be a single CID or an array of CIDs");return[r]}let t=[];for(let r of e){let n=w.asCID(r);if(!n)throw new TypeError("roots must be a single CID or an array of CIDs");t.push(n)}return t}var Ai="application/vnd.ipld.car";return zn(Ti);})();
|
|
5
|
-
return IpldCar}));
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import type { CID } from 'multiformats/cid';
|
|
2
|
-
/**
|
|
3
|
-
* Literally any `Iterable` (async or regular).
|
|
4
|
-
*/
|
|
5
|
-
export type AwaitIterable<T> = Iterable<T> | AsyncIterable<T>;
|
|
6
|
-
export type { CID };
|
|
7
|
-
export interface Block {
|
|
8
|
-
cid: CID;
|
|
9
|
-
bytes: Uint8Array;
|
|
10
|
-
}
|
|
11
|
-
export interface BlockHeader {
|
|
12
|
-
cid: CID;
|
|
13
|
-
length: number;
|
|
14
|
-
blockLength: number;
|
|
15
|
-
}
|
|
16
|
-
export interface BlockIndex extends BlockHeader {
|
|
17
|
-
offset: number;
|
|
18
|
-
blockOffset: number;
|
|
19
|
-
}
|
|
20
|
-
export interface RootsReader {
|
|
21
|
-
version: number;
|
|
22
|
-
getRoots(): Promise<CID[]>;
|
|
23
|
-
}
|
|
24
|
-
export interface RootsBufferReader {
|
|
25
|
-
version: number;
|
|
26
|
-
getRoots(): CID[];
|
|
27
|
-
}
|
|
28
|
-
export interface BlockIterator extends AsyncIterable<Block> {
|
|
29
|
-
}
|
|
30
|
-
export interface CIDIterator extends AsyncIterable<CID> {
|
|
31
|
-
}
|
|
32
|
-
export interface BlockReader {
|
|
33
|
-
has(key: CID): Promise<boolean>;
|
|
34
|
-
get(key: CID): Promise<Block | undefined>;
|
|
35
|
-
blocks(): BlockIterator;
|
|
36
|
-
cids(): CIDIterator;
|
|
37
|
-
}
|
|
38
|
-
export interface BlockBufferReader {
|
|
39
|
-
has(key: CID): boolean;
|
|
40
|
-
get(key: CID): Block | undefined;
|
|
41
|
-
blocks(): Iterable<Block>;
|
|
42
|
-
cids(): Iterable<CID>;
|
|
43
|
-
}
|
|
44
|
-
export interface BlockWriter {
|
|
45
|
-
put(block: Block): Promise<void>;
|
|
46
|
-
close(): Promise<void>;
|
|
47
|
-
version(): number;
|
|
48
|
-
}
|
|
49
|
-
export interface CarBufferWriter {
|
|
50
|
-
addRoot(root: CID, options?: {
|
|
51
|
-
resize?: boolean;
|
|
52
|
-
}): CarBufferWriter;
|
|
53
|
-
write(block: Block): CarBufferWriter;
|
|
54
|
-
close(options?: {
|
|
55
|
-
resize?: boolean;
|
|
56
|
-
}): Uint8Array;
|
|
57
|
-
}
|
|
58
|
-
export interface CarBufferWriterOptions {
|
|
59
|
-
roots?: CID[];
|
|
60
|
-
byteOffset?: number;
|
|
61
|
-
byteLength?: number;
|
|
62
|
-
headerSize?: number;
|
|
63
|
-
}
|
|
64
|
-
export interface WriterChannel {
|
|
65
|
-
writer: BlockWriter;
|
|
66
|
-
out: AsyncIterable<Uint8Array>;
|
|
67
|
-
}
|
|
68
|
-
export interface CarReader extends BlockReader, RootsReader {
|
|
69
|
-
}
|
|
70
|
-
export interface CarBufferReader extends BlockBufferReader, RootsBufferReader {
|
|
71
|
-
}
|
|
72
|
-
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAE3C;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAA;AAE7D,YAAY,EAAE,GAAG,EAAE,CAAA;AAGnB,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,GAAG,CAAA;IACR,KAAK,EAAE,UAAU,CAAA;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,GAAG,CAAA;IACR,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,UAAW,SAAQ,WAAW;IAC7C,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,IAAI,GAAG,EAAE,CAAA;CAClB;AAED,MAAM,WAAW,aAAc,SAAQ,aAAa,CAAC,KAAK,CAAC;CAAG;AAE9D,MAAM,WAAW,WAAY,SAAQ,aAAa,CAAC,GAAG,CAAC;CAAG;AAE1D,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC/B,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAAA;IACzC,MAAM,IAAI,aAAa,CAAA;IACvB,IAAI,IAAI,WAAW,CAAA;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAA;IACtB,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,KAAK,GAAG,SAAS,CAAA;IAChC,MAAM,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAA;IACzB,IAAI,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAA;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAChC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB,OAAO,IAAI,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,eAAe,CAAA;IACnE,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,eAAe,CAAA;IACpC,KAAK,CAAC,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,UAAU,CAAA;CAClD;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,WAAW,CAAA;IACnB,GAAG,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;CAC/B;AAED,MAAM,WAAW,SAAU,SAAQ,WAAW,EAAE,WAAW;CAAG;AAC9D,MAAM,WAAW,eAAgB,SAAQ,iBAAiB,EAAE,iBAAiB;CAAG"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {import('./api').Block} Block
|
|
3
|
-
* @typedef {import('./api').BlockHeader} BlockHeader
|
|
4
|
-
* @typedef {import('./api').BlockIndex} BlockIndex
|
|
5
|
-
* @typedef {import('./coding').BytesBufferReader} BytesBufferReader
|
|
6
|
-
* @typedef {import('./coding').CarHeader} CarHeader
|
|
7
|
-
* @typedef {import('./coding').CarV2Header} CarV2Header
|
|
8
|
-
* @typedef {import('./coding').CarV2FixedHeader} CarV2FixedHeader
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Reads header data from a `BytesReader`. The header may either be in the form
|
|
12
|
-
* of a `CarHeader` or `CarV2Header` depending on the CAR being read.
|
|
13
|
-
*
|
|
14
|
-
* @name decoder.readHeader(reader)
|
|
15
|
-
* @param {BytesBufferReader} reader
|
|
16
|
-
* @param {number} [strictVersion]
|
|
17
|
-
* @returns {CarHeader | CarV2Header}
|
|
18
|
-
*/
|
|
19
|
-
export function readHeader(reader: BytesBufferReader, strictVersion?: number | undefined): CarHeader | CarV2Header;
|
|
20
|
-
/**
|
|
21
|
-
* Reads the leading data of an individual block from CAR data from a
|
|
22
|
-
* `BytesBufferReader`. Returns a `BlockHeader` object which contains
|
|
23
|
-
* `{ cid, length, blockLength }` which can be used to either index the block
|
|
24
|
-
* or read the block binary data.
|
|
25
|
-
*
|
|
26
|
-
* @name async decoder.readBlockHead(reader)
|
|
27
|
-
* @param {BytesBufferReader} reader
|
|
28
|
-
* @returns {BlockHeader}
|
|
29
|
-
*/
|
|
30
|
-
export function readBlockHead(reader: BytesBufferReader): BlockHeader;
|
|
31
|
-
/**
|
|
32
|
-
* Returns Car header and blocks from a Uint8Array
|
|
33
|
-
*
|
|
34
|
-
* @param {Uint8Array} bytes
|
|
35
|
-
* @returns {{ header : CarHeader | CarV2Header , blocks: Block[]}}
|
|
36
|
-
*/
|
|
37
|
-
export function fromBytes(bytes: Uint8Array): {
|
|
38
|
-
header: CarHeader | CarV2Header;
|
|
39
|
-
blocks: Block[];
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Creates a `BytesBufferReader` from a `Uint8Array`.
|
|
43
|
-
*
|
|
44
|
-
* @name decoder.bytesReader(bytes)
|
|
45
|
-
* @param {Uint8Array} bytes
|
|
46
|
-
* @returns {BytesBufferReader}
|
|
47
|
-
*/
|
|
48
|
-
export function bytesReader(bytes: Uint8Array): BytesBufferReader;
|
|
49
|
-
/**
|
|
50
|
-
* Wraps a `BytesBufferReader` in a limiting `BytesBufferReader` which limits maximum read
|
|
51
|
-
* to `byteLimit` bytes. It _does not_ update `pos` of the original
|
|
52
|
-
* `BytesBufferReader`.
|
|
53
|
-
*
|
|
54
|
-
* @name decoder.limitReader(reader, byteLimit)
|
|
55
|
-
* @param {BytesBufferReader} reader
|
|
56
|
-
* @param {number} byteLimit
|
|
57
|
-
* @returns {BytesBufferReader}
|
|
58
|
-
*/
|
|
59
|
-
export function limitReader(reader: BytesBufferReader, byteLimit: number): BytesBufferReader;
|
|
60
|
-
export type Block = import('./api').Block;
|
|
61
|
-
export type BlockHeader = import('./api').BlockHeader;
|
|
62
|
-
export type BlockIndex = import('./api').BlockIndex;
|
|
63
|
-
export type BytesBufferReader = import('./coding').BytesBufferReader;
|
|
64
|
-
export type CarHeader = import('./coding').CarHeader;
|
|
65
|
-
export type CarV2Header = import('./coding').CarV2Header;
|
|
66
|
-
export type CarV2FixedHeader = import('./coding').CarV2FixedHeader;
|
|
67
|
-
//# sourceMappingURL=buffer-decoder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buffer-decoder.d.ts","sourceRoot":"","sources":["../../src/buffer-decoder.js"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AAEH;;;;;;;;GAQG;AACH,mCAJW,iBAAiB,uCAEf,SAAS,GAAG,WAAW,CA8BnC;AA2BD;;;;;;;;;GASG;AACH,sCAHW,iBAAiB,GACf,WAAW,CAevB;AAED;;;;;GAKG;AACH,iCAHW,UAAU,GACR;IAAE,MAAM,EAAG,SAAS,GAAG,WAAW,CAAE;IAAC,MAAM,EAAE,KAAK,EAAE,CAAA;CAAC,CAoBjE;AAED;;;;;;GAMG;AACH,mCAHW,UAAU,GACR,iBAAiB,CA+B7B;AAED;;;;;;;;;GASG;AACH,oCAJW,iBAAiB,aACjB,MAAM,GACJ,iBAAiB,CAmC7B;oBA7MY,OAAO,OAAO,EAAE,KAAK;0BACrB,OAAO,OAAO,EAAE,WAAW;yBAC3B,OAAO,OAAO,EAAE,UAAU;gCAC1B,OAAO,UAAU,EAAE,iBAAiB;wBACpC,OAAO,UAAU,EAAE,SAAS;0BAC5B,OAAO,UAAU,EAAE,WAAW;+BAC9B,OAAO,UAAU,EAAE,gBAAgB"}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {import('multiformats').CID} CID
|
|
3
|
-
* @typedef {import('./api').Block} Block
|
|
4
|
-
* @typedef {import('./api').CarBufferReader} ICarBufferReader
|
|
5
|
-
* @typedef {import('./coding').CarHeader} CarHeader
|
|
6
|
-
* @typedef {import('./coding').CarV2Header} CarV2Header
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Provides blockstore-like access to a CAR.
|
|
10
|
-
*
|
|
11
|
-
* Implements the `RootsBufferReader` interface:
|
|
12
|
-
* {@link ICarBufferReader.getRoots `getRoots()`}. And the `BlockBufferReader` interface:
|
|
13
|
-
* {@link ICarBufferReader.get `get()`}, {@link ICarBufferReader.has `has()`},
|
|
14
|
-
* {@link ICarBufferReader.blocks `blocks()`} and
|
|
15
|
-
* {@link ICarBufferReader.cids `cids()`}.
|
|
16
|
-
*
|
|
17
|
-
* Load this class with either `import { CarBufferReader } from '@ipld/car/buffer-reader'`
|
|
18
|
-
* (`const { CarBufferReader } = require('@ipld/car/buffer-reader')`). Or
|
|
19
|
-
* `import { CarBufferReader } from '@ipld/car'` (`const { CarBufferReader } = require('@ipld/car')`).
|
|
20
|
-
* The former will likely result in smaller bundle sizes where this is
|
|
21
|
-
* important.
|
|
22
|
-
*
|
|
23
|
-
* @name CarBufferReader
|
|
24
|
-
* @class
|
|
25
|
-
* @implements {ICarBufferReader}
|
|
26
|
-
* @property {number} version The version number of the CAR referenced by this
|
|
27
|
-
* reader (should be `1` or `2`).
|
|
28
|
-
*/
|
|
29
|
-
export class CarBufferReader implements ICarBufferReader {
|
|
30
|
-
/**
|
|
31
|
-
* Instantiate a {@link CarBufferReader} from a `Uint8Array` blob. This performs a
|
|
32
|
-
* decode fully in memory and maintains the decoded state in memory for full
|
|
33
|
-
* access to the data via the `CarReader` API.
|
|
34
|
-
*
|
|
35
|
-
* @static
|
|
36
|
-
* @memberof CarBufferReader
|
|
37
|
-
* @param {Uint8Array} bytes
|
|
38
|
-
* @returns {CarBufferReader}
|
|
39
|
-
*/
|
|
40
|
-
static fromBytes(bytes: Uint8Array): CarBufferReader;
|
|
41
|
-
/**
|
|
42
|
-
* @constructs CarBufferReader
|
|
43
|
-
* @param {CarHeader|CarV2Header} header
|
|
44
|
-
* @param {Block[]} blocks
|
|
45
|
-
*/
|
|
46
|
-
constructor(header: CarHeader | CarV2Header, blocks: Block[]);
|
|
47
|
-
_header: import("./coding").CarHeader | import("./coding").CarV2Header;
|
|
48
|
-
_blocks: import("./api").Block[];
|
|
49
|
-
_cids: import("multiformats").CID<unknown, number, number, import("multiformats").Version>[] | undefined;
|
|
50
|
-
/**
|
|
51
|
-
* @property version
|
|
52
|
-
* @memberof CarBufferReader
|
|
53
|
-
* @instance
|
|
54
|
-
*/
|
|
55
|
-
get version(): 1 | 2;
|
|
56
|
-
/**
|
|
57
|
-
* Get the list of roots defined by the CAR referenced by this reader. May be
|
|
58
|
-
* zero or more `CID`s.
|
|
59
|
-
*
|
|
60
|
-
* @function
|
|
61
|
-
* @memberof CarBufferReader
|
|
62
|
-
* @instance
|
|
63
|
-
* @returns {CID[]}
|
|
64
|
-
*/
|
|
65
|
-
getRoots(): CID[];
|
|
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: CID): boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Fetch a `Block` (a `{ cid:CID, bytes:Uint8Array }` pair) from the CAR
|
|
79
|
-
* referenced by this reader matching the provided `CID`. In the case where
|
|
80
|
-
* the provided `CID` doesn't exist within the CAR, `undefined` will be
|
|
81
|
-
* returned.
|
|
82
|
-
*
|
|
83
|
-
* @function
|
|
84
|
-
* @memberof CarBufferReader
|
|
85
|
-
* @instance
|
|
86
|
-
* @param {CID} key
|
|
87
|
-
* @returns {Block | undefined}
|
|
88
|
-
*/
|
|
89
|
-
get(key: CID): Block | undefined;
|
|
90
|
-
/**
|
|
91
|
-
* Returns a `Block[]` of the `Block`s (`{ cid:CID, bytes:Uint8Array }` pairs) contained within
|
|
92
|
-
* the CAR referenced by this reader.
|
|
93
|
-
*
|
|
94
|
-
* @function
|
|
95
|
-
* @memberof CarBufferReader
|
|
96
|
-
* @instance
|
|
97
|
-
* @returns {Block[]}
|
|
98
|
-
*/
|
|
99
|
-
blocks(): Block[];
|
|
100
|
-
/**
|
|
101
|
-
* Returns a `CID[]` of the `CID`s contained within the CAR referenced by this reader.
|
|
102
|
-
*
|
|
103
|
-
* @function
|
|
104
|
-
* @memberof CarBufferReader
|
|
105
|
-
* @instance
|
|
106
|
-
* @returns {CID[]}
|
|
107
|
-
*/
|
|
108
|
-
cids(): CID[];
|
|
109
|
-
}
|
|
110
|
-
export const __browser: true;
|
|
111
|
-
export type CID = import('multiformats').CID;
|
|
112
|
-
export type Block = import('./api').Block;
|
|
113
|
-
export type ICarBufferReader = import('./api').CarBufferReader;
|
|
114
|
-
export type CarHeader = import('./coding').CarHeader;
|
|
115
|
-
export type CarV2Header = import('./coding').CarV2Header;
|
|
116
|
-
//# sourceMappingURL=buffer-reader-browser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buffer-reader-browser.d.ts","sourceRoot":"","sources":["../../src/buffer-reader-browser.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IA4FE;;;;;;;;;OASG;IACH,wBAHW,UAAU,GACR,eAAe,CAS3B;IA5GD;;;;OAIG;IACH,oBAHW,SAAS,GAAC,WAAW,UACrB,KAAK,EAAE,EAMjB;IAHC,uEAAqB;IACrB,iCAAqB;IACrB,yGAAsB;IAGxB;;;;OAIG;IACH,qBAEC;IAED;;;;;;;;OAQG;IACH,YAFa,GAAG,EAAE,CAIjB;IAED;;;;;;;;;OASG;IACH,SAHW,GAAG,GACD,OAAO,CAInB;IAED;;;;;;;;;;;OAWG;IACH,SAHW,GAAG,GACD,KAAK,GAAG,SAAS,CAI7B;IAED;;;;;;;;OAQG;IACH,UAFa,KAAK,EAAE,CAInB;IAED;;;;;;;OAOG;IACH,QAFa,GAAG,EAAE,CAOjB;CAoBF;AAED,6BAA6B;kBA5IhB,OAAO,cAAc,EAAE,GAAG;oBAC1B,OAAO,OAAO,EAAE,KAAK;+BACrB,OAAO,OAAO,EAAE,eAAe;wBAC/B,OAAO,UAAU,EAAE,SAAS;0BAC5B,OAAO,UAAU,EAAE,WAAW"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @class
|
|
3
|
-
* @implements {ICarBufferReader}
|
|
4
|
-
*/
|
|
5
|
-
export class CarBufferReader extends BrowserCarBufferReader implements ICarBufferReader {
|
|
6
|
-
/**
|
|
7
|
-
* Reads a block directly from a file descriptor for an open CAR file. This
|
|
8
|
-
* function is **only available in Node.js** and not a browser environment.
|
|
9
|
-
*
|
|
10
|
-
* This function can be used in connection with {@link CarIndexer} which emits
|
|
11
|
-
* the `BlockIndex` objects that are required by this function.
|
|
12
|
-
*
|
|
13
|
-
* The user is responsible for opening and closing the file used in this call.
|
|
14
|
-
*
|
|
15
|
-
* @static
|
|
16
|
-
* @memberof CarBufferReader
|
|
17
|
-
* @param {number} fd - A file descriptor from the
|
|
18
|
-
* Node.js `fs` module. An integer, from `fs.open()`.
|
|
19
|
-
* @param {BlockIndex} blockIndex - An index pointing to the location of the
|
|
20
|
-
* Block required. This `BlockIndex` should take the form:
|
|
21
|
-
* `{cid:CID, blockLength:number, blockOffset:number}`.
|
|
22
|
-
* @returns {Block} A `{ cid:CID, bytes:Uint8Array }` pair.
|
|
23
|
-
*/
|
|
24
|
-
static readRaw(fd: number, blockIndex: BlockIndex): Block;
|
|
25
|
-
}
|
|
26
|
-
export const __browser: false;
|
|
27
|
-
export type Block = import('./api').Block;
|
|
28
|
-
export type BlockIndex = import('./api').BlockIndex;
|
|
29
|
-
export type ICarBufferReader = import('./api').CarBufferReader;
|
|
30
|
-
import { CarBufferReader as BrowserCarBufferReader } from './buffer-reader-browser.js';
|
|
31
|
-
//# sourceMappingURL=buffer-reader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buffer-reader.d.ts","sourceRoot":"","sources":["../../src/buffer-reader.js"],"names":[],"mappings":"AAWA;;;GAGG;AACH;IACE;;;;;;;;;;;;;;;;;OAiBG;IACH,mBAPW,MAAM,cAEN,UAAU,GAGR,KAAK,CAejB;CACF;AAED,8BAA8B;oBA9CjB,OAAO,OAAO,EAAE,KAAK;yBACrB,OAAO,OAAO,EAAE,UAAU;+BAC1B,OAAO,OAAO,EAAE,eAAe;0DALc,4BAA4B"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
export function addRoot(writer: CarBufferWriter, root: CID, options?: {
|
|
2
|
-
resize?: boolean | undefined;
|
|
3
|
-
} | undefined): void;
|
|
4
|
-
export function blockLength({ cid, bytes }: Block): number;
|
|
5
|
-
export function addBlock(writer: CarBufferWriter, { cid, bytes }: Block): void;
|
|
6
|
-
export function close(writer: CarBufferWriter, options?: {
|
|
7
|
-
resize?: boolean | undefined;
|
|
8
|
-
} | undefined): Uint8Array;
|
|
9
|
-
export function resizeHeader(writer: CarBufferWriter, byteLength: number): void;
|
|
10
|
-
export function calculateHeaderLength(rootLengths: number[]): number;
|
|
11
|
-
export function headerLength({ roots }: {
|
|
12
|
-
roots: CID[];
|
|
13
|
-
}): number;
|
|
14
|
-
export function estimateHeaderLength(rootCount: number, rootByteLength?: number | undefined): number;
|
|
15
|
-
export function createWriter(buffer: ArrayBuffer, options?: {
|
|
16
|
-
roots?: import("multiformats/dist/src/cid").CID<any, number, number, import("multiformats/dist/src").Version>[] | undefined;
|
|
17
|
-
byteOffset?: number | undefined;
|
|
18
|
-
byteLength?: number | undefined;
|
|
19
|
-
headerSize?: number | undefined;
|
|
20
|
-
} | undefined): CarBufferWriter;
|
|
21
|
-
export type CID = import('./api').CID;
|
|
22
|
-
export type Block = import('./api').Block;
|
|
23
|
-
export type Writer = import('./api').CarBufferWriter;
|
|
24
|
-
export type Options = import('./api').CarBufferWriterOptions;
|
|
25
|
-
export type CarEncoder = import('./coding').CarEncoder;
|
|
26
|
-
/**
|
|
27
|
-
* @typedef {import('./api').CID} CID
|
|
28
|
-
* @typedef {import('./api').Block} Block
|
|
29
|
-
* @typedef {import('./api').CarBufferWriter} Writer
|
|
30
|
-
* @typedef {import('./api').CarBufferWriterOptions} Options
|
|
31
|
-
* @typedef {import('./coding').CarEncoder} CarEncoder
|
|
32
|
-
*/
|
|
33
|
-
/**
|
|
34
|
-
* A simple CAR writer that writes to a pre-allocated buffer.
|
|
35
|
-
*
|
|
36
|
-
* @class
|
|
37
|
-
* @name CarBufferWriter
|
|
38
|
-
* @implements {Writer}
|
|
39
|
-
*/
|
|
40
|
-
declare class CarBufferWriter implements Writer {
|
|
41
|
-
/**
|
|
42
|
-
* @param {Uint8Array} bytes
|
|
43
|
-
* @param {number} headerSize
|
|
44
|
-
*/
|
|
45
|
-
constructor(bytes: Uint8Array, headerSize: number);
|
|
46
|
-
/** @readonly */
|
|
47
|
-
readonly bytes: Uint8Array;
|
|
48
|
-
byteOffset: number;
|
|
49
|
-
/**
|
|
50
|
-
* @readonly
|
|
51
|
-
* @type {CID[]}
|
|
52
|
-
*/
|
|
53
|
-
readonly roots: CID[];
|
|
54
|
-
headerSize: number;
|
|
55
|
-
/**
|
|
56
|
-
* Add a root to this writer, to be used to create a header when the CAR is
|
|
57
|
-
* finalized with {@link CarBufferWriter.close `close()`}
|
|
58
|
-
*
|
|
59
|
-
* @param {CID} root
|
|
60
|
-
* @param {{resize?:boolean}} [options]
|
|
61
|
-
* @returns {CarBufferWriter}
|
|
62
|
-
*/
|
|
63
|
-
addRoot(root: CID, options?: {
|
|
64
|
-
resize?: boolean | undefined;
|
|
65
|
-
} | undefined): CarBufferWriter;
|
|
66
|
-
/**
|
|
67
|
-
* Write a `Block` (a `{ cid:CID, bytes:Uint8Array }` pair) to the archive.
|
|
68
|
-
* Throws if there is not enough capacity.
|
|
69
|
-
*
|
|
70
|
-
* @param {Block} block - A `{ cid:CID, bytes:Uint8Array }` pair.
|
|
71
|
-
* @returns {CarBufferWriter}
|
|
72
|
-
*/
|
|
73
|
-
write(block: Block): CarBufferWriter;
|
|
74
|
-
/**
|
|
75
|
-
* Finalize the CAR and return it as a `Uint8Array`.
|
|
76
|
-
*
|
|
77
|
-
* @param {object} [options]
|
|
78
|
-
* @param {boolean} [options.resize]
|
|
79
|
-
* @returns {Uint8Array}
|
|
80
|
-
*/
|
|
81
|
-
close(options?: {
|
|
82
|
-
resize?: boolean | undefined;
|
|
83
|
-
} | undefined): Uint8Array;
|
|
84
|
-
}
|
|
85
|
-
export {};
|
|
86
|
-
//# sourceMappingURL=buffer-writer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buffer-writer.d.ts","sourceRoot":"","sources":["../../src/buffer-writer.js"],"names":[],"mappings":"AAgFO,gCAJI,eAAe,QACf,GAAG;;qBA2Bb;AAUM,4CAHI,KAAK,GACH,MAAM,CAKlB;AAMM,iCAHI,eAAe,kBACf,KAAK,QAYf;AAOM,8BAJI,eAAe;;2BA4BzB;AAMM,qCAHI,eAAe,cACf,MAAM,QAShB;AAqCM,mDAHI,MAAM,EAAE,GACN,MAAM,CAWlB;AAUM;IAHmB,KAAK,EAApB,GAAG,EAAE;IACH,MAAM,CAG4C;AAYxD,gDAJI,MAAM,wCAEJ,MAAM,CAG+C;AAuB3D,qCARI,WAAW;;;;;gBAMT,eAAe,CAiB3B;kBAvRY,OAAO,OAAO,EAAE,GAAG;oBACnB,OAAO,OAAO,EAAE,KAAK;qBACrB,OAAO,OAAO,EAAE,eAAe;sBAC/B,OAAO,OAAO,EAAE,sBAAsB;yBACtC,OAAO,UAAU,EAAE,UAAU;AAL1C;;;;;;GAMG;AAEH;;;;;;GAMG;AACH;IACE;;;OAGG;IACH,mBAHW,UAAU,cACV,MAAM,EAahB;IAVC,gBAAgB;IAChB,2BAAkB;IAClB,mBAA4B;IAE5B;;;OAGG;IACH,gBAFU,GAAG,EAAE,CAEA;IACf,mBAA4B;IAG9B;;;;;;;OAOG;IACH,cAJW,GAAG;;oBAED,eAAe,CAK3B;IAED;;;;;;OAMG;IACH,aAHW,KAAK,GACH,eAAe,CAK3B;IAED;;;;;;OAMG;IACH;;oBAFa,UAAU,CAItB;CACF"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { Block, BlockIndex } from './api.js';
|
|
2
|
-
import type { CID } from 'multiformats/cid';
|
|
3
|
-
export interface CarEncoder {
|
|
4
|
-
setRoots(roots: CID[]): Promise<void>;
|
|
5
|
-
writeBlock(block: Block): Promise<void>;
|
|
6
|
-
close(): Promise<void>;
|
|
7
|
-
version(): number;
|
|
8
|
-
}
|
|
9
|
-
export interface IteratorChannel_Writer<T> {
|
|
10
|
-
write(chunk: T): Promise<void>;
|
|
11
|
-
end(): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
export interface IteratorChannel<T> {
|
|
14
|
-
writer: IteratorChannel_Writer<T>;
|
|
15
|
-
iterator: AsyncIterator<T>;
|
|
16
|
-
}
|
|
17
|
-
export interface CarHeader {
|
|
18
|
-
version: 1;
|
|
19
|
-
roots: CID[];
|
|
20
|
-
}
|
|
21
|
-
export interface CarV2FixedHeader {
|
|
22
|
-
characteristics: [bigint, bigint];
|
|
23
|
-
dataOffset: number;
|
|
24
|
-
dataSize: number;
|
|
25
|
-
indexOffset: number;
|
|
26
|
-
}
|
|
27
|
-
export interface CarV2Header extends CarV2FixedHeader {
|
|
28
|
-
version: 2;
|
|
29
|
-
roots: CID[];
|
|
30
|
-
}
|
|
31
|
-
export interface CarDecoder {
|
|
32
|
-
header(): Promise<CarHeader | CarV2Header>;
|
|
33
|
-
blocks(): AsyncGenerator<Block>;
|
|
34
|
-
blocksIndex(): AsyncGenerator<BlockIndex>;
|
|
35
|
-
}
|
|
36
|
-
export interface Seekable {
|
|
37
|
-
seek(length: number): void;
|
|
38
|
-
}
|
|
39
|
-
export interface BytesReader extends Seekable {
|
|
40
|
-
upTo(length: number): Promise<Uint8Array>;
|
|
41
|
-
exactly(length: number, seek?: boolean): Promise<Uint8Array>;
|
|
42
|
-
pos: number;
|
|
43
|
-
}
|
|
44
|
-
export interface BytesBufferReader extends Seekable {
|
|
45
|
-
upTo(length: number): Uint8Array;
|
|
46
|
-
exactly(length: number, seek?: boolean): Uint8Array;
|
|
47
|
-
pos: number;
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=coding.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"coding.d.ts","sourceRoot":"","sources":["../../src/coding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACjD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAE3C,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAErC,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEvC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAEtB,OAAO,IAAI,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,KAAK,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9B,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACrB;AAED,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,MAAM,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAA;IAEjC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;CAC3B;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,CAAC,CAAA;IACV,KAAK,EAAE,GAAG,EAAE,CAAA;CACb;AAED,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACnD,OAAO,EAAE,CAAC,CAAA;IACV,KAAK,EAAE,GAAG,EAAE,CAAA;CACb;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,IAAI,OAAO,CAAC,SAAS,GAAG,WAAW,CAAC,CAAA;IAE1C,MAAM,IAAI,cAAc,CAAC,KAAK,CAAC,CAAA;IAE/B,WAAW,IAAI,cAAc,CAAC,UAAU,CAAC,CAAA;CAC1C;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AAED,MAAM,WAAW,WAAY,SAAQ,QAAQ;IAC3C,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IAEzC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IAE5D,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,iBAAkB,SAAQ,QAAQ;IACjD,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAAA;IAEhC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,CAAA;IAEnD,GAAG,EAAE,MAAM,CAAA;CACZ"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Decodes varint and seeks the buffer
|
|
3
|
-
*
|
|
4
|
-
* ```js
|
|
5
|
-
* // needs bytes to be read first
|
|
6
|
-
* const bytes = reader.upTo(8) // maybe async
|
|
7
|
-
* ```
|
|
8
|
-
*
|
|
9
|
-
* @param {Uint8Array} bytes
|
|
10
|
-
* @param {import('./coding').Seekable} seeker
|
|
11
|
-
* @returns {number}
|
|
12
|
-
*/
|
|
13
|
-
export function decodeVarint(bytes: Uint8Array, seeker: import('./coding').Seekable): number;
|
|
14
|
-
/**
|
|
15
|
-
* Decode v2 header
|
|
16
|
-
*
|
|
17
|
-
* ```js
|
|
18
|
-
* // needs bytes to be read first
|
|
19
|
-
* const bytes = reader.exactly(V2_HEADER_LENGTH, true) // maybe async
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @param {Uint8Array} bytes
|
|
23
|
-
* @returns {import('./coding').CarV2FixedHeader}
|
|
24
|
-
*/
|
|
25
|
-
export function decodeV2Header(bytes: Uint8Array): import('./coding').CarV2FixedHeader;
|
|
26
|
-
/**
|
|
27
|
-
* Checks the length of the multihash to be read afterwards
|
|
28
|
-
*
|
|
29
|
-
* ```js
|
|
30
|
-
* // needs bytes to be read first
|
|
31
|
-
* const bytes = reader.upTo(8) // maybe async
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* @param {Uint8Array} bytes
|
|
35
|
-
*/
|
|
36
|
-
export function getMultihashLength(bytes: Uint8Array): number;
|
|
37
|
-
export namespace CIDV0_BYTES {
|
|
38
|
-
let SHA2_256: number;
|
|
39
|
-
let LENGTH: number;
|
|
40
|
-
let DAG_PB: number;
|
|
41
|
-
}
|
|
42
|
-
export const V2_HEADER_LENGTH: number;
|
|
43
|
-
//# sourceMappingURL=decoder-common.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decoder-common.d.ts","sourceRoot":"","sources":["../../src/decoder-common.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;GAWG;AACH,oCAJW,UAAU,UACV,OAAO,UAAU,EAAE,QAAQ,GACzB,MAAM,CASlB;AAED;;;;;;;;;;GAUG;AACH,sCAHW,UAAU,GACR,OAAO,UAAU,EAAE,gBAAgB,CAiB/C;AAED;;;;;;;;;GASG;AACH,0CAFW,UAAU,UAcpB;;;;;;AAzED,sCAAqH"}
|