@fireproof/vendor 0.0.0-smoke → 1.0.1
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 +155 -8
- package/src/@ipld/car/{car/README.md → README.md} +229 -175
- package/src/@ipld/car/dist/src/reader.d.ts.map +1 -0
- package/src/@ipld/car/{car/src → src}/reader.js +19 -2
- package/src/cborg/cborg/{lib/bin.js → bin.js} +2 -2
- package/src/cborg/cborg/common.js +28 -0
- package/{patched/cborg/lib → src/cborg/cborg}/decode.js +24 -22
- package/src/cborg/cborg/{lib/diagnostic.js → diagnostic.js} +6 -4
- package/{patched/cborg/lib → src/cborg/cborg}/diagnostic_test.js +1 -1
- package/src/cborg/cborg/{lib/encode.js → encode.js} +23 -21
- package/{patched/cborg/cborg.js → src/cborg/cborg/index.js} +12 -10
- package/src/cborg/cborg/{lib/length.js → length.js} +3 -2
- package/{patched → src}/cborg/interface.ts +7 -4
- package/src/cborg/{cborg/lib/json → json}/decode.js +25 -25
- package/src/cborg/{cborg/lib/json → json}/encode.js +19 -16
- package/src/cborg/{cborg/package.json → package.json} +15 -11
- package/src/cborg/{cborg/taglib.js → taglib.js} +3 -1
- package/src/cborg/{cborg/test → test}/common.js +1 -1
- package/{patched → src}/cborg/test/noop-bin-test.js +1 -1
- package/{patched → src}/cborg/test/test-0uint.js +2 -2
- package/src/cborg/{cborg/test → test}/test-1negint.js +2 -2
- package/src/cborg/{cborg/test → test}/test-2bytes.js +2 -2
- package/src/cborg/{cborg/test → test}/test-3string.js +2 -2
- package/{patched → src}/cborg/test/test-4array.js +2 -2
- package/{patched → src}/cborg/test/test-5map.js +2 -2
- package/src/cborg/{cborg/test → test}/test-6tag.js +2 -3
- package/{patched → src}/cborg/test/test-7float.js +2 -2
- package/{patched → src}/cborg/test/test-bl.js +1 -1
- package/src/cborg/{cborg/test → test}/test-cbor-vectors.js +2 -2
- package/src/cborg/{cborg/test → test}/test-decode-errors.js +2 -2
- package/{patched → src}/cborg/test/test-fuzz.js +1 -1
- package/src/cborg/{cborg/test → test}/test-json.js +25 -25
- package/{patched → src}/cborg/test/test-length.js +3 -3
- package/src/cborg/{cborg/test → test}/test-partial.js +2 -2
- package/src/cborg/{cborg/tsconfig.json → tsconfig.json} +5 -2
- package/{patched/cborg/types/lib → src/cborg/types/cborg}/decode.d.ts +5 -3
- package/src/cborg/types/cborg/decode.d.ts.map +1 -0
- package/{patched/cborg/types/lib → src/cborg/types/cborg}/encode.d.ts +4 -3
- package/src/cborg/types/cborg/encode.d.ts.map +1 -0
- package/src/cborg/types/cborg/index.d.ts +26 -0
- package/src/cborg/types/cborg/index.d.ts.map +1 -0
- package/src/cborg/types/cborg/is.d.ts.map +1 -0
- package/src/cborg/{cborg/types → types}/interface.d.ts +6 -4
- package/src/cborg/types/interface.d.ts.map +1 -0
- package/{patched/cborg/types/lib → src/cborg/types}/json/decode.d.ts +7 -7
- package/src/cborg/types/json/decode.d.ts.map +1 -0
- package/src/cborg/types/json/encode.d.ts +11 -0
- package/src/cborg/types/json/encode.d.ts.map +1 -0
- package/src/cborg/types/json/json.d.ts.map +1 -0
- package/{patched → src}/cborg/types/taglib.d.ts +1 -1
- package/{patched → src}/cborg/types/taglib.d.ts.map +1 -1
- package/src/cborg/types/tsconfig.tsbuildinfo +1 -0
- package/{patched/cborg/types/lib → src/cborg/types/utils}/0uint.d.ts +6 -4
- package/src/cborg/types/utils/0uint.d.ts.map +1 -0
- package/{patched/cborg/types/lib → src/cborg/types/utils}/1negint.d.ts +4 -3
- package/src/cborg/types/utils/1negint.d.ts.map +1 -0
- package/src/cborg/{cborg/types/lib → types/utils}/2bytes.d.ts +5 -4
- package/src/cborg/types/utils/2bytes.d.ts.map +1 -0
- package/src/cborg/{cborg/types/lib → types/utils}/3string.d.ts +1 -1
- package/src/cborg/types/utils/3string.d.ts.map +1 -0
- package/{patched/cborg/types/lib → src/cborg/types/utils}/4array.d.ts +3 -2
- package/src/cborg/types/utils/4array.d.ts.map +1 -0
- package/src/cborg/{cborg/types/lib → types/utils}/5map.d.ts +3 -2
- package/src/cborg/types/utils/5map.d.ts.map +1 -0
- package/{patched/cborg/types/lib → src/cborg/types/utils}/6tag.d.ts +4 -3
- package/src/cborg/types/utils/6tag.d.ts.map +1 -0
- package/src/cborg/{cborg/types/lib → types/utils}/7float.d.ts +2 -2
- package/src/cborg/types/utils/7float.d.ts.map +1 -0
- package/src/cborg/types/utils/bl.d.ts.map +1 -0
- package/src/cborg/types/utils/byte-utils.d.ts.map +1 -0
- package/src/cborg/types/utils/common.d.ts +8 -0
- package/src/cborg/types/utils/common.d.ts.map +1 -0
- package/src/cborg/types/utils/index.d.ts +13 -0
- package/src/cborg/types/utils/index.d.ts.map +1 -0
- package/src/cborg/types/utils/jump.d.ts +16 -0
- package/src/cborg/types/utils/jump.d.ts.map +1 -0
- package/src/cborg/types/utils/token.d.ts.map +1 -0
- package/src/cborg/{cborg/lib → utils}/0uint.js +16 -14
- package/src/cborg/{cborg/lib → utils}/1negint.js +5 -5
- package/src/cborg/{cborg/lib → utils}/2bytes.js +16 -14
- package/src/cborg/{cborg/lib → utils}/3string.js +4 -4
- package/src/cborg/{cborg/lib → utils}/4array.js +7 -6
- package/{patched/cborg/lib → src/cborg/utils}/5map.js +6 -6
- package/{patched/cborg/lib → src/cborg/utils}/6tag.js +4 -3
- package/src/cborg/{cborg/lib → utils}/7float.js +23 -21
- package/{patched/cborg/lib → src/cborg/utils}/bl.js +1 -1
- package/src/cborg/utils/common.js +11 -0
- package/src/cborg/utils/index.js +12 -0
- package/src/cborg/utils/jump.js +222 -0
- package/patched/@ipld/dag-json/.github/dependabot.yml +0 -11
- package/patched/@ipld/dag-json/.github/workflows/js-test-and-release.yml +0 -28
- package/patched/@ipld/dag-json/CHANGELOG.md +0 -202
- package/patched/@ipld/dag-json/LICENSE-APACHE +0 -5
- package/patched/@ipld/dag-json/LICENSE-MIT +0 -19
- package/patched/@ipld/dag-json/ipld-dag-json-10.2.3.tgz +0 -0
- package/patched/@ipld/dag-json/src/index.js +0 -291
- package/patched/@ipld/dag-json/test/test-basics.spec.js +0 -290
- package/patched/@ipld/dag-json/test/ts-use/package.json +0 -11
- package/patched/@ipld/dag-json/test/ts-use/src/main.ts +0 -54
- package/patched/@ipld/dag-json/test/ts-use/tsconfig.json +0 -9
- package/patched/@ipld/dag-json/tsconfig.json +0 -14
- package/patched/cborg/cborg-4.2.7.tgz +0 -0
- package/patched/cborg/example-json.js +0 -6
- package/patched/cborg/example.js +0 -5
- package/patched/cborg/lib/0uint.js +0 -227
- package/patched/cborg/lib/1negint.js +0 -111
- package/patched/cborg/lib/2bytes.js +0 -133
- package/patched/cborg/lib/3string.js +0 -90
- package/patched/cborg/lib/4array.js +0 -113
- package/patched/cborg/lib/7float.js +0 -308
- package/patched/cborg/lib/bin.js +0 -189
- package/patched/cborg/lib/common.js +0 -27
- package/patched/cborg/lib/diagnostic.js +0 -156
- package/patched/cborg/lib/encode.js +0 -464
- package/patched/cborg/lib/json/decode.js +0 -462
- package/patched/cborg/lib/json/encode.js +0 -299
- package/patched/cborg/lib/jump.js +0 -209
- package/patched/cborg/lib/length.js +0 -61
- package/patched/cborg/package.json +0 -169
- package/patched/cborg/pnpm-lock.yaml +0 -6096
- package/patched/cborg/taglib.js +0 -73
- package/patched/cborg/test/common.js +0 -18
- package/patched/cborg/test/test-1negint.js +0 -96
- package/patched/cborg/test/test-2bytes.js +0 -198
- package/patched/cborg/test/test-3string.js +0 -136
- package/patched/cborg/test/test-6tag.js +0 -85
- package/patched/cborg/test/test-cbor-vectors.js +0 -107
- package/patched/cborg/test/test-decode-errors.js +0 -65
- package/patched/cborg/test/test-json.js +0 -219
- package/patched/cborg/test/test-partial.js +0 -111
- package/patched/cborg/tsconfig.json +0 -45
- package/patched/cborg/types/cborg.d.ts +0 -28
- package/patched/cborg/types/cborg.d.ts.map +0 -1
- package/patched/cborg/types/interface.d.ts +0 -47
- package/patched/cborg/types/interface.d.ts.map +0 -1
- package/patched/cborg/types/lib/0uint.d.ts.map +0 -1
- package/patched/cborg/types/lib/1negint.d.ts.map +0 -1
- package/patched/cborg/types/lib/2bytes.d.ts +0 -68
- package/patched/cborg/types/lib/2bytes.d.ts.map +0 -1
- package/patched/cborg/types/lib/3string.d.ts +0 -46
- package/patched/cborg/types/lib/3string.d.ts.map +0 -1
- package/patched/cborg/types/lib/4array.d.ts.map +0 -1
- package/patched/cborg/types/lib/5map.d.ts +0 -65
- package/patched/cborg/types/lib/5map.d.ts.map +0 -1
- package/patched/cborg/types/lib/6tag.d.ts.map +0 -1
- package/patched/cborg/types/lib/7float.d.ts +0 -60
- package/patched/cborg/types/lib/7float.d.ts.map +0 -1
- package/patched/cborg/types/lib/bin.d.ts +0 -4
- package/patched/cborg/types/lib/bin.d.ts.map +0 -1
- package/patched/cborg/types/lib/bl.d.ts.map +0 -1
- package/patched/cborg/types/lib/byte-utils.d.ts.map +0 -1
- package/patched/cborg/types/lib/common.d.ts +0 -10
- package/patched/cborg/types/lib/common.d.ts.map +0 -1
- package/patched/cborg/types/lib/decode.d.ts.map +0 -1
- package/patched/cborg/types/lib/diagnostic.d.ts +0 -12
- package/patched/cborg/types/lib/diagnostic.d.ts.map +0 -1
- package/patched/cborg/types/lib/diagnostic_test.d.ts +0 -2
- package/patched/cborg/types/lib/diagnostic_test.d.ts.map +0 -1
- package/patched/cborg/types/lib/encode.d.ts.map +0 -1
- package/patched/cborg/types/lib/is.d.ts.map +0 -1
- package/patched/cborg/types/lib/json/decode.d.ts.map +0 -1
- package/patched/cborg/types/lib/json/encode.d.ts +0 -11
- package/patched/cborg/types/lib/json/encode.d.ts.map +0 -1
- package/patched/cborg/types/lib/json/forward-cborg.d.ts +0 -6
- package/patched/cborg/types/lib/json/forward-cborg.d.ts.map +0 -1
- package/patched/cborg/types/lib/json/json.d.ts.map +0 -1
- package/patched/cborg/types/lib/jump.d.ts +0 -12
- package/patched/cborg/types/lib/jump.d.ts.map +0 -1
- package/patched/cborg/types/lib/length.d.ts +0 -27
- package/patched/cborg/types/lib/length.d.ts.map +0 -1
- package/patched/cborg/types/lib/token.d.ts.map +0 -1
- package/patched/cborg/types/tsconfig.tsbuildinfo +0 -1
- package/src/@ipld/car/car/dist/src/reader.d.ts.map +0 -1
- package/src/@ipld/car/car/node_modules/.bin/cborg +0 -17
- package/src/@ipld/dag-cbor/dag-cbor/node_modules/.bin/cborg +0 -17
- package/src/@ipld/dag-json/dag-json/README.md +0 -58
- package/src/@ipld/dag-json/dag-json/node_modules/.bin/cborg +0 -17
- package/src/@ipld/dag-json/dag-json/package.json +0 -173
- package/src/@web3-storage/pail/pail/node_modules/.bin/pail +0 -17
- package/src/cborg/cborg/.github/dependabot.yml +0 -16
- package/src/cborg/cborg/.github/workflows/test-and-release.yml +0 -52
- package/src/cborg/cborg/CHANGELOG.md +0 -513
- package/src/cborg/cborg/LICENSE +0 -13
- package/src/cborg/cborg/README.md +0 -515
- package/src/cborg/cborg/bench/bench.js +0 -117
- package/src/cborg/cborg/bench/json.js +0 -124
- package/src/cborg/cborg/bench/package.json +0 -8
- package/src/cborg/cborg/cborg.js +0 -31
- package/src/cborg/cborg/example-bytestrings.js +0 -180
- package/src/cborg/cborg/interface.ts +0 -56
- package/src/cborg/cborg/lib/5map.js +0 -113
- package/src/cborg/cborg/lib/6tag.js +0 -80
- package/src/cborg/cborg/lib/bl.js +0 -124
- package/src/cborg/cborg/lib/byte-utils.js +0 -417
- package/src/cborg/cborg/lib/common.js +0 -27
- package/src/cborg/cborg/lib/decode.js +0 -209
- package/src/cborg/cborg/lib/diagnostic_test.js +0 -117
- package/src/cborg/cborg/lib/is.js +0 -106
- package/src/cborg/cborg/lib/json/json.js +0 -4
- package/src/cborg/cborg/lib/jump.js +0 -209
- package/src/cborg/cborg/lib/token.js +0 -76
- package/src/cborg/cborg/node_modules/.bin/cborg +0 -17
- package/src/cborg/cborg/test/appendix_a.js +0 -647
- package/src/cborg/cborg/test/node-test-bin.js +0 -402
- package/src/cborg/cborg/test/noop-bin-test.js +0 -3
- package/src/cborg/cborg/test/test-0uint.js +0 -103
- package/src/cborg/cborg/test/test-4array.js +0 -93
- package/src/cborg/cborg/test/test-5map.js +0 -284
- package/src/cborg/cborg/test/test-7float.js +0 -131
- package/src/cborg/cborg/test/test-bl.js +0 -37
- package/src/cborg/cborg/test/test-fuzz.js +0 -42
- package/src/cborg/cborg/test/test-length.js +0 -65
- package/src/cborg/cborg/types/cborg.d.ts +0 -28
- package/src/cborg/cborg/types/cborg.d.ts.map +0 -1
- package/src/cborg/cborg/types/example.d.ts +0 -2
- package/src/cborg/cborg/types/example.d.ts.map +0 -1
- package/src/cborg/cborg/types/interface.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/0uint.d.ts +0 -100
- package/src/cborg/cborg/types/lib/0uint.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/1negint.d.ts +0 -58
- package/src/cborg/cborg/types/lib/1negint.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/2bytes.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/3string.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/4array.d.ts +0 -65
- package/src/cborg/cborg/types/lib/4array.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/5map.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/6tag.d.ts +0 -61
- package/src/cborg/cborg/types/lib/6tag.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/7float.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/bin.d.ts +0 -4
- package/src/cborg/cborg/types/lib/bin.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/bl.d.ts +0 -26
- package/src/cborg/cborg/types/lib/bl.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/byte-utils.d.ts +0 -53
- package/src/cborg/cborg/types/lib/byte-utils.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/common.d.ts +0 -10
- package/src/cborg/cborg/types/lib/common.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/decode.d.ts +0 -41
- package/src/cborg/cborg/types/lib/decode.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/diagnostic.d.ts +0 -12
- package/src/cborg/cborg/types/lib/diagnostic.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/diagnostic_test.d.ts +0 -2
- package/src/cborg/cborg/types/lib/diagnostic_test.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/encode.d.ts +0 -50
- package/src/cborg/cborg/types/lib/encode.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/is.d.ts +0 -6
- package/src/cborg/cborg/types/lib/is.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/json/decode.d.ts +0 -67
- package/src/cborg/cborg/types/lib/json/decode.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/json/encode.d.ts +0 -11
- package/src/cborg/cborg/types/lib/json/encode.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/json/forward-cborg.d.ts +0 -6
- package/src/cborg/cborg/types/lib/json/forward-cborg.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/json/json.d.ts +0 -6
- package/src/cborg/cborg/types/lib/json/json.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/jump.d.ts +0 -12
- package/src/cborg/cborg/types/lib/jump.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/length.d.ts +0 -27
- package/src/cborg/cborg/types/lib/length.d.ts.map +0 -1
- package/src/cborg/cborg/types/lib/token.d.ts +0 -59
- package/src/cborg/cborg/types/lib/token.d.ts.map +0 -1
- package/src/cborg/cborg/types/taglib.d.ts +0 -18
- package/src/cborg/cborg/types/taglib.d.ts.map +0 -1
- package/src/cborg/cborg/types/tsconfig.tsbuildinfo +0 -1
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/LICENSE +0 -4
- /package/{patched/@ipld/dag-json → src/@ipld/car}/LICENSE +0 -0
- /package/src/@ipld/car/{car/dist → dist}/index.min.js +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/api.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/api.d.ts.map +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/buffer-decoder.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/buffer-decoder.d.ts.map +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/buffer-reader-browser.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/buffer-reader-browser.d.ts.map +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/buffer-reader.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/buffer-reader.d.ts.map +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/buffer-writer.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/buffer-writer.d.ts.map +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/coding.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/coding.d.ts.map +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/decoder-common.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/decoder-common.d.ts.map +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/decoder.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/decoder.d.ts.map +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/encoder.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/encoder.d.ts.map +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/header-validator.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/header-validator.d.ts.map +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/index-browser.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/index-browser.d.ts.map +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/index.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/index.d.ts.map +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/indexed-reader-browser.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/indexed-reader-browser.d.ts.map +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/indexed-reader.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/indexed-reader.d.ts.map +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/indexer.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/indexer.d.ts.map +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/iterator-channel.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/iterator-channel.d.ts.map +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/iterator.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/iterator.d.ts.map +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/reader-browser.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/reader-browser.d.ts.map +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/reader.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/writer-browser.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/writer-browser.d.ts.map +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/writer.d.ts +0 -0
- /package/src/@ipld/car/{car/dist → dist}/src/writer.d.ts.map +0 -0
- /package/src/@ipld/car/{car/package.json → package.json} +0 -0
- /package/src/@ipld/car/{car/src → src}/api.ts +0 -0
- /package/src/@ipld/car/{car/src → src}/buffer-decoder.js +0 -0
- /package/src/@ipld/car/{car/src → src}/buffer-reader-browser.js +0 -0
- /package/src/@ipld/car/{car/src → src}/buffer-reader.js +0 -0
- /package/src/@ipld/car/{car/src → src}/buffer-writer.js +0 -0
- /package/src/@ipld/car/{car/src → src}/coding.ts +0 -0
- /package/src/@ipld/car/{car/src → src}/decoder-common.js +0 -0
- /package/src/@ipld/car/{car/src → src}/decoder.js +0 -0
- /package/src/@ipld/car/{car/src → src}/encoder.js +0 -0
- /package/src/@ipld/car/{car/src → src}/header-validator.js +0 -0
- /package/src/@ipld/car/{car/src → src}/header.ipldsch +0 -0
- /package/src/@ipld/car/{car/src → src}/index-browser.js +0 -0
- /package/src/@ipld/car/{car/src → src}/index.js +0 -0
- /package/src/@ipld/car/{car/src → src}/indexed-reader-browser.js +0 -0
- /package/src/@ipld/car/{car/src → src}/indexed-reader.js +0 -0
- /package/src/@ipld/car/{car/src → src}/indexer.js +0 -0
- /package/src/@ipld/car/{car/src → src}/iterator-channel.js +0 -0
- /package/src/@ipld/car/{car/src → src}/iterator.js +0 -0
- /package/src/@ipld/car/{car/src → src}/reader-browser.js +0 -0
- /package/src/@ipld/car/{car/src → src}/writer-browser.js +0 -0
- /package/src/@ipld/car/{car/src → src}/writer.js +0 -0
- /package/src/@ipld/{car/car → dag-cbor}/LICENSE +0 -0
- /package/src/@ipld/dag-cbor/{dag-cbor/README.md → README.md} +0 -0
- /package/src/@ipld/dag-cbor/{dag-cbor/dist → dist}/index.min.js +0 -0
- /package/src/@ipld/dag-cbor/{dag-cbor/dist → dist}/src/index.d.ts +0 -0
- /package/src/@ipld/dag-cbor/{dag-cbor/dist → dist}/src/index.d.ts.map +0 -0
- /package/src/@ipld/dag-cbor/{dag-cbor/package.json → package.json} +0 -0
- /package/src/@ipld/dag-cbor/{dag-cbor/src → src}/index.js +0 -0
- /package/src/@ipld/{dag-cbor/dag-cbor → dag-json}/LICENSE +0 -0
- /package/{patched → src}/@ipld/dag-json/README.md +0 -0
- /package/src/@ipld/dag-json/{dag-json/dist → dist}/index.min.js +0 -0
- /package/src/@ipld/dag-json/{dag-json/dist → dist}/src/index.d.ts +0 -0
- /package/src/@ipld/dag-json/{dag-json/dist → dist}/src/index.d.ts.map +0 -0
- /package/{patched → src}/@ipld/dag-json/package.json +0 -0
- /package/src/@ipld/dag-json/{dag-json/src → src}/index.js +0 -0
- /package/src/@web3-storage/pail/{pail/LICENSE.md → LICENSE.md} +0 -0
- /package/src/@web3-storage/pail/{pail/README.md → README.md} +0 -0
- /package/src/@web3-storage/pail/{pail/cli.js → cli.js} +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/api.d.ts +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/api.d.ts.map +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/batch/api.d.ts +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/batch/api.d.ts.map +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/batch/index.d.ts +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/batch/index.d.ts.map +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/batch/shard.d.ts +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/batch/shard.d.ts.map +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/block.d.ts +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/block.d.ts.map +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/clock/api.d.ts +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/clock/api.d.ts.map +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/clock/index.d.ts +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/clock/index.d.ts.map +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/crdt/api.d.ts +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/crdt/api.d.ts.map +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/crdt/batch/api.d.ts +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/crdt/batch/api.d.ts.map +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/crdt/batch/index.d.ts +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/crdt/batch/index.d.ts.map +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/crdt/index.d.ts +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/crdt/index.d.ts.map +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/diff.d.ts +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/diff.d.ts.map +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/index.d.ts +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/index.d.ts.map +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/merge.d.ts +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/merge.d.ts.map +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/shard.d.ts +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/src/shard.d.ts.map +0 -0
- /package/src/@web3-storage/pail/{pail/dist → dist}/tsconfig.tsbuildinfo +0 -0
- /package/src/@web3-storage/pail/{pail/package.json → package.json} +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/api.js +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/api.ts +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/batch/api.js +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/batch/api.ts +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/batch/index.js +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/batch/shard.js +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/block.js +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/clock/api.js +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/clock/api.ts +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/clock/index.js +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/crdt/api.js +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/crdt/api.ts +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/crdt/batch/api.js +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/crdt/batch/api.ts +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/crdt/batch/index.js +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/crdt/index.js +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/diff.js +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/index.js +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/merge.js +0 -0
- /package/src/@web3-storage/pail/{pail/src → src}/shard.js +0 -0
- /package/{patched → src}/cborg/.github/dependabot.yml +0 -0
- /package/{patched → src}/cborg/.github/workflows/test-and-release.yml +0 -0
- /package/{patched → src}/cborg/CHANGELOG.md +0 -0
- /package/{patched → src}/cborg/LICENSE +0 -0
- /package/{patched → src}/cborg/README.md +0 -0
- /package/{patched → src}/cborg/bench/bench.js +0 -0
- /package/{patched → src}/cborg/bench/json.js +0 -0
- /package/{patched → src}/cborg/bench/package.json +0 -0
- /package/{patched/cborg/lib → src/cborg/cborg}/is.js +0 -0
- /package/{patched → src}/cborg/example-bytestrings.js +0 -0
- /package/src/cborg/{cborg/example-json.js → example-json.js} +0 -0
- /package/src/cborg/{cborg/example.js → example.js} +0 -0
- /package/{patched/cborg/lib → src/cborg}/json/json.js +0 -0
- /package/{patched → src}/cborg/test/appendix_a.js +0 -0
- /package/{patched → src}/cborg/test/node-test-bin.js +0 -0
- /package/{patched/cborg/types/lib → src/cborg/types/cborg}/is.d.ts +0 -0
- /package/{patched → src}/cborg/types/example.d.ts +0 -0
- /package/{patched → src}/cborg/types/example.d.ts.map +0 -0
- /package/{patched/cborg/types/lib → src/cborg/types}/json/json.d.ts +0 -0
- /package/{patched/cborg/types/lib → src/cborg/types/utils}/bl.d.ts +0 -0
- /package/{patched/cborg/types/lib → src/cborg/types/utils}/byte-utils.d.ts +0 -0
- /package/{patched/cborg/types/lib → src/cborg/types/utils}/token.d.ts +0 -0
- /package/{patched/cborg/lib → src/cborg/utils}/byte-utils.js +0 -0
- /package/{patched/cborg/lib → src/cborg/utils}/token.js +0 -0
- /package/src/{@ipld/dag-json/dag-json → ipfs-unixfs-exporter}/LICENSE +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/README.md → README.md} +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/index.min.js +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/errors.d.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/errors.d.ts.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/errors.js +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/errors.js.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/index.d.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/index.d.ts.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/index.js +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/index.js.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/dag-cbor.d.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/dag-cbor.d.ts.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/dag-cbor.js +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/dag-cbor.js.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/dag-json.d.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/dag-json.d.ts.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/dag-json.js +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/dag-json.js.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/identity.d.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/identity.d.ts.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/identity.js +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/identity.js.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/index.d.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/index.d.ts.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/index.js +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/index.js.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/json.d.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/json.d.ts.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/json.js +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/json.js.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/raw.d.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/raw.d.ts.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/raw.js +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/raw.js.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/content/directory.d.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/content/directory.d.ts.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/content/directory.js +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/content/directory.js.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/content/file.d.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/content/file.d.ts.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/content/file.js +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/content/file.js.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/content/hamt-sharded-directory.d.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/content/hamt-sharded-directory.d.ts.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/content/hamt-sharded-directory.js +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/content/hamt-sharded-directory.js.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/content/raw.d.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/content/raw.d.ts.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/content/raw.js +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/content/raw.js.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/index.d.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/index.d.ts.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/index.js +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/resolvers/unixfs-v1/index.js.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/utils/extract-data-from-block.d.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/utils/extract-data-from-block.d.ts.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/utils/extract-data-from-block.js +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/utils/extract-data-from-block.js.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/utils/find-cid-in-shard.d.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/utils/find-cid-in-shard.d.ts.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/utils/find-cid-in-shard.js +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/utils/find-cid-in-shard.js.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/utils/resolve-object-path.d.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/utils/resolve-object-path.d.ts.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/utils/resolve-object-path.js +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/utils/resolve-object-path.js.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/utils/validate-offset-and-length.d.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/utils/validate-offset-and-length.d.ts.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/utils/validate-offset-and-length.js +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/src/utils/validate-offset-and-length.js.map +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/dist → dist}/typedoc-urls.json +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/package.json → package.json} +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/src → src}/errors.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/src → src}/index.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/src → src}/resolvers/dag-cbor.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/src → src}/resolvers/dag-json.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/src → src}/resolvers/identity.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/src → src}/resolvers/index.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/src → src}/resolvers/json.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/src → src}/resolvers/raw.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/src → src}/resolvers/unixfs-v1/content/directory.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/src → src}/resolvers/unixfs-v1/content/file.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/src → src}/resolvers/unixfs-v1/content/hamt-sharded-directory.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/src → src}/resolvers/unixfs-v1/content/raw.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/src → src}/resolvers/unixfs-v1/index.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/src → src}/utils/extract-data-from-block.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/src → src}/utils/find-cid-in-shard.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/src → src}/utils/resolve-object-path.ts +0 -0
- /package/src/ipfs-unixfs-exporter/{ipfs-unixfs-exporter/src → src}/utils/validate-offset-and-length.ts +0 -0
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
// can be run in a browser with `polendina --runner=bare-sync --timeout 6000 --cleanup bench.js`
|
|
2
|
-
// with additional dependencies for cborg installed here
|
|
3
|
-
|
|
4
|
-
import assert from 'assert'
|
|
5
|
-
import { garbage } from 'ipld-garbage'
|
|
6
|
-
import { decode, encode } from '../lib/json/json.js'
|
|
7
|
-
|
|
8
|
-
let writebuf = ''
|
|
9
|
-
const write = process.stdout
|
|
10
|
-
? process.stdout.write.bind(process.stdout)
|
|
11
|
-
: (str) => {
|
|
12
|
-
writebuf += str
|
|
13
|
-
if (str.endsWith('\n')) {
|
|
14
|
-
console.log(writebuf.replace(/\n$/, ''))
|
|
15
|
-
writebuf = ''
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const textEncoder = new TextEncoder()
|
|
20
|
-
const textDecoder = new TextDecoder()
|
|
21
|
-
|
|
22
|
-
function jencode (obj) {
|
|
23
|
-
return textEncoder.encode(JSON.stringify(obj))
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function jdecode (buf) {
|
|
27
|
-
return JSON.parse(textDecoder.decode(buf))
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function runWith (description, count, targetTime, size, options) {
|
|
31
|
-
const fixtures = []
|
|
32
|
-
|
|
33
|
-
console.log(`${description} @ ${count.toLocaleString()}`)
|
|
34
|
-
for (let i = 0; i < count; i++) {
|
|
35
|
-
const obj = garbage(size, options)
|
|
36
|
-
const cbyts = encode(obj)
|
|
37
|
-
/*
|
|
38
|
-
const jbyts = jencode(obj)
|
|
39
|
-
if (Buffer.compare(Buffer.from(cbyts), jbyts) !== 0) {
|
|
40
|
-
console.log(`mismatch for obj: ${JSON.stringify(obj)}`)
|
|
41
|
-
console.log('\tc> ', Buffer.from(cbyts).toString('utf8'))
|
|
42
|
-
console.log('\tj> ', Buffer.from(jbyts).toString('utf8'))
|
|
43
|
-
}
|
|
44
|
-
*/
|
|
45
|
-
if (cbyts.length <= size * 2) {
|
|
46
|
-
fixtures.push([obj, cbyts])
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
const avgSize = Math.round(fixtures.reduce((p, c) => p + c[1].length, 0) / fixtures.length)
|
|
50
|
-
|
|
51
|
-
const enc = (encoder) => {
|
|
52
|
-
for (const [obj, byts] of fixtures) {
|
|
53
|
-
const ebyts = encoder(obj)
|
|
54
|
-
if (byts.length !== ebyts.length) {
|
|
55
|
-
throw new Error('bork')
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return fixtures.length
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const bench = (bfn) => {
|
|
62
|
-
const start = Date.now()
|
|
63
|
-
let opcount = 0
|
|
64
|
-
do {
|
|
65
|
-
opcount += bfn()
|
|
66
|
-
} while (Date.now() - start < targetTime)
|
|
67
|
-
const ops = Math.round(opcount / ((Date.now() - start) / 1000))
|
|
68
|
-
return ops
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const dec = (decoder) => {
|
|
72
|
-
for (const [obj, byts] of fixtures) {
|
|
73
|
-
let cobj
|
|
74
|
-
try {
|
|
75
|
-
cobj = decoder(byts)
|
|
76
|
-
} catch (e) {
|
|
77
|
-
console.log('Failed to decode:', Buffer.from(byts).toString('utf8'))
|
|
78
|
-
throw e
|
|
79
|
-
}
|
|
80
|
-
if (obj != null && typeof obj === 'object') {
|
|
81
|
-
assert.deepStrictEqual(Object.keys(cobj).length, Object.keys(obj).length)
|
|
82
|
-
} else {
|
|
83
|
-
assert.deepStrictEqual(obj, cobj)
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return fixtures.length
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const cmp = (desc, cbfn, bofn) => {
|
|
90
|
-
write(`\t${desc} (avg ${avgSize.toLocaleString()} b):`)
|
|
91
|
-
const cborgOps = bench(cbfn)
|
|
92
|
-
write(` cborg @ ${cborgOps.toLocaleString()} op/s`)
|
|
93
|
-
const jOps = bench(bofn)
|
|
94
|
-
write(` / JSON @ ${jOps.toLocaleString()} op/s`)
|
|
95
|
-
const percent = Math.round((cborgOps / jOps) * 1000) / 10
|
|
96
|
-
write(` = ${(percent).toLocaleString()} %\n`)
|
|
97
|
-
return percent
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return [
|
|
101
|
-
cmp('encode', () => enc(encode), () => enc(jencode)),
|
|
102
|
-
cmp('decode', () => dec(decode), () => dec(jdecode))
|
|
103
|
-
]
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const targetTime = 1000
|
|
107
|
-
const accum = []
|
|
108
|
-
accum.push(runWith('rnd-100', 1000, targetTime, 100, { weights: { CID: 0, bytes: 0 } }))
|
|
109
|
-
accum.push(runWith('rnd-300', 1000, targetTime, 300, { weights: { CID: 0, bytes: 0 } }))
|
|
110
|
-
accum.push(runWith('rnd-nomap-300', 1000, targetTime, 300, { weights: { CID: 0, bytes: 0, map: 0 } }))
|
|
111
|
-
accum.push(runWith('rnd-nolist-300', 1000, targetTime, 300, { weights: { CID: 0, bytes: 0, list: 0 } }))
|
|
112
|
-
accum.push(runWith('rnd-nofloat-300', 1000, targetTime, 300, { weights: { CID: 0, bytes: 0, float: 0 } }))
|
|
113
|
-
accum.push(runWith('rnd-nomaj7-300', 1000, targetTime, 300, { weights: { CID: 0, bytes: 0, float: 0, null: 0, boolean: 0 } }))
|
|
114
|
-
accum.push(runWith('rnd-nostr-300', 1000, targetTime, 300, { weights: { CID: 0, bytes: 0, string: 0 } }))
|
|
115
|
-
accum.push(runWith('rnd-nostrbyts-300', 1000, targetTime, 300, { weights: { CID: 0, bytes: 0, string: 0 } }))
|
|
116
|
-
accum.push(runWith('rnd-1000', 1000, targetTime, 1000, { weights: { CID: 0, bytes: 0 } }))
|
|
117
|
-
accum.push(runWith('rnd-2000', 1000, targetTime, 2000, { weights: { CID: 0, bytes: 0 } }))
|
|
118
|
-
accum.push(runWith('rnd-fil-100', 1000, targetTime, 100, { weights: { float: 0, map: 0, CID: 0, bytes: 0 } }))
|
|
119
|
-
accum.push(runWith('rnd-fil-300', 1000, targetTime, 300, { weights: { float: 0, map: 0, CID: 0, bytes: 0 } }))
|
|
120
|
-
accum.push(runWith('rnd-fil-500', 1000, targetTime, 500, { weights: { float: 0, map: 0, CID: 0, bytes: 0 } }))
|
|
121
|
-
accum.push(runWith('rnd-fil-1000', 1000, targetTime, 1000, { weights: { float: 0, map: 0, CID: 0, bytes: 0 } }))
|
|
122
|
-
accum.push(runWith('rnd-fil-2000', 1000, targetTime, 2000, { weights: { float: 0, map: 0, CID: 0, bytes: 0 } }))
|
|
123
|
-
console.log(`Avg encode: ${Math.round(accum.reduce((p, c) => p + c[0], 0) / accum.length).toLocaleString()} %`)
|
|
124
|
-
console.log(`Avg decode: ${Math.round(accum.reduce((p, c) => p + c[1], 0) / accum.length).toLocaleString()} %`)
|
package/src/cborg/cborg/cborg.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { encode } from './lib/encode.js'
|
|
2
|
-
import { decode, decodeFirst, Tokeniser, tokensToObject } from './lib/decode.js'
|
|
3
|
-
import { Token, Type } from './lib/token.js'
|
|
4
|
-
|
|
5
|
-
// is this needed for the json module and other independ encoders
|
|
6
|
-
export { encodeCustom } from './lib/encode.js'
|
|
7
|
-
export { encodeErrPrefix, decodeErrPrefix } from './lib/common.js'
|
|
8
|
-
export { asU8A, fromString, decodeCodePointsArray } from './lib/byte-utils.js'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Export the types that were present in the original manual cborg.d.ts
|
|
12
|
-
* @typedef {import('./interface').TagDecoder} TagDecoder
|
|
13
|
-
* There was originally just `TypeEncoder` so don't break types by renaming or not exporting
|
|
14
|
-
* @typedef {import('./interface').OptionalTypeEncoder} TypeEncoder
|
|
15
|
-
* @typedef {import('./interface').DecodeOptions} DecodeOptions
|
|
16
|
-
* @typedef {import('./interface').EncodeOptions} EncodeOptions
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
export {
|
|
20
|
-
// this is needed to prevent the bundleing trouble which happens
|
|
21
|
-
// due to the fact that token.js is used in lib/json and so in
|
|
22
|
-
// cborg/json which ends up on bundling to have two copies of token.js
|
|
23
|
-
// which will fail stmts like token.type === Type.array
|
|
24
|
-
decode,
|
|
25
|
-
decodeFirst,
|
|
26
|
-
Tokeniser as Tokenizer,
|
|
27
|
-
tokensToObject,
|
|
28
|
-
encode,
|
|
29
|
-
Token,
|
|
30
|
-
Type
|
|
31
|
-
}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
RFC 8746 defines a set of tags to use for typed arrays. Out of the box, cborg doesn't care about
|
|
3
|
-
tags and just squashes all concerns around byte arrays to Uint8Array with major type 2. This is
|
|
4
|
-
fine for most use cases, but it is lossy, you can't round-trip and retain your original type.
|
|
5
|
-
|
|
6
|
-
This example shows how to use cborg to round-trip a typed array with tags.
|
|
7
|
-
|
|
8
|
-
https://www.rfc-editor.org/rfc/rfc8746.html
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { encode, decode, Token, Tokenizer, Type } from 'cborg.js'
|
|
12
|
-
|
|
13
|
-
const tagUint8Array = 64
|
|
14
|
-
const tagUint64Array = 71
|
|
15
|
-
// etc... see https://www.rfc-editor.org/rfc/rfc8746.html#name-iana-considerations
|
|
16
|
-
|
|
17
|
-
/* ENCODERS */
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @param {any} obj
|
|
21
|
-
* @returns {[Token]}
|
|
22
|
-
*/
|
|
23
|
-
function uint8ArrayEncoder (obj) {
|
|
24
|
-
if (!(obj instanceof Uint8Array)) {
|
|
25
|
-
throw new Error('expected Uint8Array')
|
|
26
|
-
}
|
|
27
|
-
return [
|
|
28
|
-
new Token(Type.tag, tagUint8Array),
|
|
29
|
-
new Token(Type.bytes, obj)
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @param {any} obj
|
|
35
|
-
* @returns {[Token]}
|
|
36
|
-
*/
|
|
37
|
-
function uint64ArrayEncoder (obj) {
|
|
38
|
-
if (!(obj instanceof BigUint64Array)) {
|
|
39
|
-
throw new Error('expected BigUint64Array')
|
|
40
|
-
}
|
|
41
|
-
return [
|
|
42
|
-
new Token(Type.tag, tagUint64Array),
|
|
43
|
-
// BigUint64Array to a Uint8Array, but we have to pay attention to the possibility of it being
|
|
44
|
-
// a view of a larger ArrayBuffer.
|
|
45
|
-
new Token(Type.bytes, new Uint8Array(obj.buffer, obj.byteOffset, obj.byteLength))
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// etc...
|
|
50
|
-
|
|
51
|
-
const typeEncoders = {
|
|
52
|
-
Uint8Array: uint8ArrayEncoder,
|
|
53
|
-
BigUint64Array: uint64ArrayEncoder
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/* DECODERS */
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @param {ArrayBuffer} bytes
|
|
60
|
-
* @returns {any}
|
|
61
|
-
*/
|
|
62
|
-
function uint8ArrayDecoder (bytes) {
|
|
63
|
-
if (!(bytes instanceof ArrayBuffer)) {
|
|
64
|
-
throw new Error('expected ArrayBuffer')
|
|
65
|
-
}
|
|
66
|
-
return new Uint8Array(bytes)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* @param {ArrayBuffer} bytes
|
|
71
|
-
* @returns {any}
|
|
72
|
-
*/
|
|
73
|
-
function uint64ArrayDecoder (bytes) {
|
|
74
|
-
if (!(bytes instanceof ArrayBuffer)) {
|
|
75
|
-
throw new Error('expected ArrayBuffer')
|
|
76
|
-
}
|
|
77
|
-
return new BigUint64Array(bytes)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// etc...
|
|
81
|
-
|
|
82
|
-
const tags = []
|
|
83
|
-
tags[tagUint8Array] = uint8ArrayDecoder
|
|
84
|
-
tags[tagUint64Array] = uint64ArrayDecoder
|
|
85
|
-
|
|
86
|
-
/* TOKENIZER */
|
|
87
|
-
|
|
88
|
-
// We have to deal with the fact that cborg talks in Uint8Arrays but we now want it to treat major 2
|
|
89
|
-
// as ArrayBuffers, so we have to transform the token stream to replace the Uint8Array with an
|
|
90
|
-
// ArrayBuffer.
|
|
91
|
-
|
|
92
|
-
class ArrayBufferTransformingTokeniser extends Tokenizer {
|
|
93
|
-
next () {
|
|
94
|
-
const nextToken = super.next()
|
|
95
|
-
if (nextToken.type.equals(Type.bytes)) {
|
|
96
|
-
// Transform the (assumed) Uint8Array value to an ArrayBuffer of the same bytes, note though
|
|
97
|
-
// that all tags we care about are going to be <tag><bytes>, so we're also transforming those
|
|
98
|
-
// into ArrayBuffers, so our tag decoders need to also assume they are getting ArrayBuffers
|
|
99
|
-
// now. An alternative would be to watch the token stream for <tag> and not transform the next
|
|
100
|
-
// token if it's <bytes>, but that's a bit more complicated for demo purposes.
|
|
101
|
-
nextToken.value = nextToken.value.buffer
|
|
102
|
-
}
|
|
103
|
-
return nextToken
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Optional: a new decode() wrapper, mainly so we don't have to deal with the complications of\
|
|
108
|
-
// instantiating a Tokenizer which needs both data and the options.
|
|
109
|
-
function byteStringDecoder (data, options) {
|
|
110
|
-
options = Object.assign({}, options, {
|
|
111
|
-
tags,
|
|
112
|
-
tokenizer: new ArrayBufferTransformingTokeniser(data, options)
|
|
113
|
-
})
|
|
114
|
-
return decode(data, options)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/* ROUND-TRIP */
|
|
118
|
-
|
|
119
|
-
const original = {
|
|
120
|
-
u8: new Uint8Array([1, 2, 3, 4, 5]),
|
|
121
|
-
u64: new BigUint64Array([10000000000000000n, 20000000000000000n, 30000000000000000n, 40000000000000000n, 50000000000000000n]),
|
|
122
|
-
ab: new Uint8Array([6, 7, 8, 9, 10]).buffer
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const encoded = encode(original, { typeEncoders })
|
|
126
|
-
|
|
127
|
-
const decoded = byteStringDecoder(encoded)
|
|
128
|
-
|
|
129
|
-
console.log('Original:', original)
|
|
130
|
-
console.log('Encoded:', Buffer.from(encoded).toString('hex')) // excuse the Buffer, sorry browser peeps
|
|
131
|
-
console.log('Decoded:', decoded)
|
|
132
|
-
|
|
133
|
-
/* Output:
|
|
134
|
-
|
|
135
|
-
Original: {
|
|
136
|
-
u8: Uint8Array(5) [ 1, 2, 3, 4, 5 ],
|
|
137
|
-
u64: BigUint64Array(5) [
|
|
138
|
-
10000000000000000n,
|
|
139
|
-
20000000000000000n,
|
|
140
|
-
30000000000000000n,
|
|
141
|
-
40000000000000000n,
|
|
142
|
-
50000000000000000n
|
|
143
|
-
],
|
|
144
|
-
ab: ArrayBuffer { [Uint8Contents]: <06 07 08 09 0a>, byteLength: 5 }
|
|
145
|
-
}
|
|
146
|
-
Encoded: a362616245060708090a627538d84045010203040563753634d84758280000c16ff2862300000082dfe40d47000000434fd7946a00000004bfc91b8e000000c52ebca2b100
|
|
147
|
-
Decoded: {
|
|
148
|
-
ab: ArrayBuffer { [Uint8Contents]: <06 07 08 09 0a>, byteLength: 5 },
|
|
149
|
-
u8: Uint8Array(5) [ 1, 2, 3, 4, 5 ],
|
|
150
|
-
u64: BigUint64Array(5) [
|
|
151
|
-
10000000000000000n,
|
|
152
|
-
20000000000000000n,
|
|
153
|
-
30000000000000000n,
|
|
154
|
-
40000000000000000n,
|
|
155
|
-
50000000000000000n
|
|
156
|
-
]
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
*/
|
|
160
|
-
|
|
161
|
-
/* Diagnostic:
|
|
162
|
-
|
|
163
|
-
$ cborg hex2diag a362616245060708090a627538d84045010203040563753634d84758280000c16ff2862300000082dfe40d47000000434fd7946a00000004bfc91b8e000000c52ebca2b100
|
|
164
|
-
a3 # map(3)
|
|
165
|
-
62 # string(2)
|
|
166
|
-
6162 # "ab"
|
|
167
|
-
45 # bytes(5)
|
|
168
|
-
060708090a # "\x06\x07\x08\x09\x0a"
|
|
169
|
-
62 # string(2)
|
|
170
|
-
7538 # "u8"
|
|
171
|
-
d8 40 # tag(64)
|
|
172
|
-
45 # bytes(5)
|
|
173
|
-
0102030405 # "\x01\x02\x03\x04\x05"
|
|
174
|
-
63 # string(3)
|
|
175
|
-
753634 # "u64"
|
|
176
|
-
d8 47 # tag(71)
|
|
177
|
-
58 28 # bytes(40)
|
|
178
|
-
0000c16ff2862300000082dfe40d47000000434fd7 # "\x00\x00Áoò\x86#\x00\x00\x00\x82ßä\x0dG\x00\x00\x00CO×"
|
|
179
|
-
946a00000004bfc91b8e000000c52ebca2b100 # "\x94j\x00\x00\x00\x04¿É\x1b\x8e\x00\x00\x00Å.¼¢±\x00
|
|
180
|
-
*/
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Token } from './lib/token'
|
|
2
|
-
import { Bl } from './lib/bl'
|
|
3
|
-
|
|
4
|
-
export type TokenOrNestedTokens = Token | Token[] | TokenOrNestedTokens[]
|
|
5
|
-
|
|
6
|
-
export interface Reference {
|
|
7
|
-
parent: Reference | undefined
|
|
8
|
-
obj: object | any[]
|
|
9
|
-
includes(obj: object | any[]): boolean
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type OptionalTypeEncoder = (data: any, typ: string, options: EncodeOptions, refStack?: Reference) => TokenOrNestedTokens | null
|
|
13
|
-
|
|
14
|
-
export type StrictTypeEncoder = (data: any, typ: string, options: EncodeOptions, refStack?: Reference) => TokenOrNestedTokens
|
|
15
|
-
|
|
16
|
-
export type TokenTypeEncoder = {
|
|
17
|
-
(buf: Bl, token: Token, options?: EncodeOptions): void;
|
|
18
|
-
compareTokens(t1: Token, t2: Token): number;
|
|
19
|
-
// TODO: make this non-optional as a breaking change and remove the throw in length.js
|
|
20
|
-
encodedSize?(token: Token, options?: EncodeOptions): number;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type MapSorter = (e1: (Token | Token[])[], e2: (Token | Token[])[]) => number
|
|
24
|
-
|
|
25
|
-
export type QuickEncodeToken = (token: Token) => Uint8Array | undefined
|
|
26
|
-
|
|
27
|
-
export interface DecodeTokenizer {
|
|
28
|
-
done(): boolean,
|
|
29
|
-
next(): Token,
|
|
30
|
-
pos(): number,
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export type TagDecoder = (inner: any) => any
|
|
34
|
-
|
|
35
|
-
export interface DecodeOptions {
|
|
36
|
-
allowIndefinite?: boolean
|
|
37
|
-
allowUndefined?: boolean
|
|
38
|
-
coerceUndefinedToNull?: boolean
|
|
39
|
-
allowInfinity?: boolean
|
|
40
|
-
allowNaN?: boolean
|
|
41
|
-
allowBigInt?: boolean
|
|
42
|
-
strict?: boolean
|
|
43
|
-
useMaps?: boolean
|
|
44
|
-
rejectDuplicateMapKeys?: boolean
|
|
45
|
-
retainStringBytes?: boolean
|
|
46
|
-
tags?: TagDecoder[],
|
|
47
|
-
tokenizer?: DecodeTokenizer
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface EncodeOptions {
|
|
51
|
-
float64?: boolean,
|
|
52
|
-
addBreakTokens?: boolean,
|
|
53
|
-
mapSorter?: MapSorter,
|
|
54
|
-
quickEncodeToken?: QuickEncodeToken,
|
|
55
|
-
typeEncoders?: { [typeName: string]: OptionalTypeEncoder }
|
|
56
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { Token, Type } from './token.js'
|
|
2
|
-
import * as uint from './0uint.js'
|
|
3
|
-
import { decodeErrPrefix } from './common.js'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @typedef {import('./bl.js').Bl} Bl
|
|
7
|
-
* @typedef {import('../interface').DecodeOptions} DecodeOptions
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @param {Uint8Array} _data
|
|
12
|
-
* @param {number} _pos
|
|
13
|
-
* @param {number} prefix
|
|
14
|
-
* @param {number} length
|
|
15
|
-
* @returns {Token}
|
|
16
|
-
*/
|
|
17
|
-
function toToken (_data, _pos, prefix, length) {
|
|
18
|
-
return new Token(Type.map, length, prefix)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @param {Uint8Array} data
|
|
23
|
-
* @param {number} pos
|
|
24
|
-
* @param {number} minor
|
|
25
|
-
* @param {DecodeOptions} _options
|
|
26
|
-
* @returns {Token}
|
|
27
|
-
*/
|
|
28
|
-
export function decodeMapCompact (data, pos, minor, _options) {
|
|
29
|
-
return toToken(data, pos, 1, minor)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @param {Uint8Array} data
|
|
34
|
-
* @param {number} pos
|
|
35
|
-
* @param {number} _minor
|
|
36
|
-
* @param {DecodeOptions} options
|
|
37
|
-
* @returns {Token}
|
|
38
|
-
*/
|
|
39
|
-
export function decodeMap8 (data, pos, _minor, options) {
|
|
40
|
-
return toToken(data, pos, 2, uint.readUint8(data, pos + 1, options))
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @param {Uint8Array} data
|
|
45
|
-
* @param {number} pos
|
|
46
|
-
* @param {number} _minor
|
|
47
|
-
* @param {DecodeOptions} options
|
|
48
|
-
* @returns {Token}
|
|
49
|
-
*/
|
|
50
|
-
export function decodeMap16 (data, pos, _minor, options) {
|
|
51
|
-
return toToken(data, pos, 3, uint.readUint16(data, pos + 1, options))
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @param {Uint8Array} data
|
|
56
|
-
* @param {number} pos
|
|
57
|
-
* @param {number} _minor
|
|
58
|
-
* @param {DecodeOptions} options
|
|
59
|
-
* @returns {Token}
|
|
60
|
-
*/
|
|
61
|
-
export function decodeMap32 (data, pos, _minor, options) {
|
|
62
|
-
return toToken(data, pos, 5, uint.readUint32(data, pos + 1, options))
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// TODO: maybe we shouldn't support this ..
|
|
66
|
-
/**
|
|
67
|
-
* @param {Uint8Array} data
|
|
68
|
-
* @param {number} pos
|
|
69
|
-
* @param {number} _minor
|
|
70
|
-
* @param {DecodeOptions} options
|
|
71
|
-
* @returns {Token}
|
|
72
|
-
*/
|
|
73
|
-
export function decodeMap64 (data, pos, _minor, options) {
|
|
74
|
-
const l = uint.readUint64(data, pos + 1, options)
|
|
75
|
-
if (typeof l === 'bigint') {
|
|
76
|
-
throw new Error(`${decodeErrPrefix} 64-bit integer map lengths not supported`)
|
|
77
|
-
}
|
|
78
|
-
return toToken(data, pos, 9, l)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* @param {Uint8Array} data
|
|
83
|
-
* @param {number} pos
|
|
84
|
-
* @param {number} _minor
|
|
85
|
-
* @param {DecodeOptions} options
|
|
86
|
-
* @returns {Token}
|
|
87
|
-
*/
|
|
88
|
-
export function decodeMapIndefinite (data, pos, _minor, options) {
|
|
89
|
-
if (options.allowIndefinite === false) {
|
|
90
|
-
throw new Error(`${decodeErrPrefix} indefinite length items not allowed`)
|
|
91
|
-
}
|
|
92
|
-
return toToken(data, pos, 1, Infinity)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* @param {Bl} buf
|
|
97
|
-
* @param {Token} token
|
|
98
|
-
*/
|
|
99
|
-
export function encodeMap (buf, token) {
|
|
100
|
-
uint.encodeUintValue(buf, Type.map.majorEncoded, token.value)
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// using a map as a map key, are you sure about this? we can only sort
|
|
104
|
-
// by map length here, it's up to the encoder to decide to look deeper
|
|
105
|
-
encodeMap.compareTokens = uint.encodeUint.compareTokens
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @param {Token} token
|
|
109
|
-
* @returns {number}
|
|
110
|
-
*/
|
|
111
|
-
encodeMap.encodedSize = function encodedSize (token) {
|
|
112
|
-
return uint.encodeUintValue.encodedSize(token.value)
|
|
113
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { Token, Type } from './token.js'
|
|
2
|
-
import * as uint from './0uint.js'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @typedef {import('./bl.js').Bl} Bl
|
|
6
|
-
* @typedef {import('../interface').DecodeOptions} DecodeOptions
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @param {Uint8Array} _data
|
|
11
|
-
* @param {number} _pos
|
|
12
|
-
* @param {number} minor
|
|
13
|
-
* @param {DecodeOptions} _options
|
|
14
|
-
* @returns {Token}
|
|
15
|
-
*/
|
|
16
|
-
export function decodeTagCompact (_data, _pos, minor, _options) {
|
|
17
|
-
return new Token(Type.tag, minor, 1)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @param {Uint8Array} data
|
|
22
|
-
* @param {number} pos
|
|
23
|
-
* @param {number} _minor
|
|
24
|
-
* @param {DecodeOptions} options
|
|
25
|
-
* @returns {Token}
|
|
26
|
-
*/
|
|
27
|
-
export function decodeTag8 (data, pos, _minor, options) {
|
|
28
|
-
return new Token(Type.tag, uint.readUint8(data, pos + 1, options), 2)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @param {Uint8Array} data
|
|
33
|
-
* @param {number} pos
|
|
34
|
-
* @param {number} _minor
|
|
35
|
-
* @param {DecodeOptions} options
|
|
36
|
-
* @returns {Token}
|
|
37
|
-
*/
|
|
38
|
-
export function decodeTag16 (data, pos, _minor, options) {
|
|
39
|
-
return new Token(Type.tag, uint.readUint16(data, pos + 1, options), 3)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @param {Uint8Array} data
|
|
44
|
-
* @param {number} pos
|
|
45
|
-
* @param {number} _minor
|
|
46
|
-
* @param {DecodeOptions} options
|
|
47
|
-
* @returns {Token}
|
|
48
|
-
*/
|
|
49
|
-
export function decodeTag32 (data, pos, _minor, options) {
|
|
50
|
-
return new Token(Type.tag, uint.readUint32(data, pos + 1, options), 5)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* @param {Uint8Array} data
|
|
55
|
-
* @param {number} pos
|
|
56
|
-
* @param {number} _minor
|
|
57
|
-
* @param {DecodeOptions} options
|
|
58
|
-
* @returns {Token}
|
|
59
|
-
*/
|
|
60
|
-
export function decodeTag64 (data, pos, _minor, options) {
|
|
61
|
-
return new Token(Type.tag, uint.readUint64(data, pos + 1, options), 9)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @param {Bl} buf
|
|
66
|
-
* @param {Token} token
|
|
67
|
-
*/
|
|
68
|
-
export function encodeTag (buf, token) {
|
|
69
|
-
uint.encodeUintValue(buf, Type.tag.majorEncoded, token.value)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
encodeTag.compareTokens = uint.encodeUint.compareTokens
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* @param {Token} token
|
|
76
|
-
* @returns {number}
|
|
77
|
-
*/
|
|
78
|
-
encodeTag.encodedSize = function encodedSize (token) {
|
|
79
|
-
return uint.encodeUintValue.encodedSize(token.value)
|
|
80
|
-
}
|