@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,284 +0,0 @@
|
|
|
1
|
-
/* eslint-env mocha */
|
|
2
|
-
|
|
3
|
-
import * as chai from 'chai'
|
|
4
|
-
|
|
5
|
-
import { decode, encode } from '../cborg.js'
|
|
6
|
-
import { fromHex, toHex } from '../lib/byte-utils.js'
|
|
7
|
-
|
|
8
|
-
const { assert } = chai
|
|
9
|
-
|
|
10
|
-
// TODO: reject duplicate keys from encoded form
|
|
11
|
-
|
|
12
|
-
const fixtures = [
|
|
13
|
-
{ data: 'a0', expected: {}, type: 'map empty' },
|
|
14
|
-
{ data: 'a0', expected: new Map(), type: 'map empty (useMaps)', useMaps: true },
|
|
15
|
-
{ data: 'a1616101', expected: { a: 1 }, type: 'map 1 pair' },
|
|
16
|
-
{ data: 'a161316161', expected: { 1: 'a' }, type: 'map 1 pair (rev)' },
|
|
17
|
-
{
|
|
18
|
-
data: 'a1016161',
|
|
19
|
-
expected: toMap([[1, 'a']]),
|
|
20
|
-
type: 'map 1 pair (int key as Map w/ useMaps)',
|
|
21
|
-
useMaps: true
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
data: 'a243010203633132334302030463323334',
|
|
25
|
-
expected: toMap([[Uint8Array.from([1, 2, 3]), '123'], [Uint8Array.from([2, 3, 4]), '234']]),
|
|
26
|
-
type: 'map 2 pair (bytes keys Map w/ useMaps)',
|
|
27
|
-
useMaps: true
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
data: 'a1666f626a656374a16477697468a26134666e6573746564676f626a65637473a161216121',
|
|
31
|
-
expected: { object: { with: { 4: 'nested', objects: { '!': '!' } } } },
|
|
32
|
-
type: 'map nested'
|
|
33
|
-
},
|
|
34
|
-
{ // same as previous but as a Map and an int key
|
|
35
|
-
data: 'a1666f626a656374a16477697468a204666e6573746564676f626a65637473a161216121',
|
|
36
|
-
expected: toMap([['object', toMap([['with', toMap([[4, 'nested'], ['objects', toMap([['!', '!']])]])]])]]),
|
|
37
|
-
type: 'map nested w/ useMaps',
|
|
38
|
-
useMaps: true
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
data: 'ae636f6e651b0016db6db6db6db763736978206374656e3b0016db6db6db6db76374776f1a0001000064666976650064666f757202646e696e653aa5f702b365656967687438ff65736576656e226574687265651901f466656c6576656e426131667477656c76656fc48c6175657320c39f76c49b74652168666f75727465656ea4616664666f7572616f016174026274680368746869727465656e840203046466697665',
|
|
42
|
-
encode: {
|
|
43
|
-
one: Number.MAX_SAFE_INTEGER / 1.4,
|
|
44
|
-
two: 65536,
|
|
45
|
-
three: 500,
|
|
46
|
-
four: 2,
|
|
47
|
-
five: 0,
|
|
48
|
-
six: -1,
|
|
49
|
-
seven: -3,
|
|
50
|
-
eight: -256,
|
|
51
|
-
nine: -2784428724,
|
|
52
|
-
ten: Number.MIN_SAFE_INTEGER / 1.4 - 1,
|
|
53
|
-
eleven: new TextEncoder().encode('a1'),
|
|
54
|
-
twelve: 'Čaues ßvěte!',
|
|
55
|
-
thirteen: [2, 3, 4, 'five'],
|
|
56
|
-
fourteen: { o: 1, t: 2, th: 3, f: 'four' }
|
|
57
|
-
},
|
|
58
|
-
expected: {
|
|
59
|
-
one: Number.MAX_SAFE_INTEGER / 1.4,
|
|
60
|
-
six: -1,
|
|
61
|
-
ten: Number.MIN_SAFE_INTEGER / 1.4 - 1,
|
|
62
|
-
two: 65536,
|
|
63
|
-
five: 0,
|
|
64
|
-
four: 2,
|
|
65
|
-
nine: -2784428724,
|
|
66
|
-
eight: -256,
|
|
67
|
-
seven: -3,
|
|
68
|
-
three: 500,
|
|
69
|
-
eleven: new TextEncoder().encode('a1'),
|
|
70
|
-
twelve: 'Čaues ßvěte!',
|
|
71
|
-
fourteen: { f: 'four', o: 1, t: 2, th: 3 },
|
|
72
|
-
thirteen: [2, 3, 4, 'five']
|
|
73
|
-
},
|
|
74
|
-
type: 'map with complex entries',
|
|
75
|
-
label: '{}'
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
data: 'ad01636f6e65026374776f1901f46c666976652068756e647265641902586b7369782068756e647265641a00010000636269671b0016db6db6db6db76662696767657220696d696e7573206f6e6521696d696e75732074776f38ff781f6d696e75732074776f2068756e6472656420616e64206669667479207369783901f4781a6d696e757820666976652068756e6472656420616e64206f6e653901f5781a6d696e757820666976652068756e6472656420616e642074776f3aa5f702b367626967206e65673b0016db6db6db6db76a626967676572206e6567',
|
|
79
|
-
encode: toMap([
|
|
80
|
-
[2, 'two'],
|
|
81
|
-
[1, 'one'],
|
|
82
|
-
[-2, 'minus two'],
|
|
83
|
-
[-1, 'minus one'],
|
|
84
|
-
[600, 'six hundred'],
|
|
85
|
-
[500, 'five hundred'],
|
|
86
|
-
[-256, 'minus two hundred and fifty six'],
|
|
87
|
-
[-502, 'minux five hundred and two'],
|
|
88
|
-
[-501, 'minux five hundred and one'],
|
|
89
|
-
[65536, 'big'],
|
|
90
|
-
[-2784428724, 'big neg'],
|
|
91
|
-
[6433713753386423, 'bigger'],
|
|
92
|
-
[-6433713753386424, 'bigger neg']
|
|
93
|
-
]),
|
|
94
|
-
expected: toMap([
|
|
95
|
-
[1, 'one'],
|
|
96
|
-
[2, 'two'],
|
|
97
|
-
[500, 'five hundred'],
|
|
98
|
-
[600, 'six hundred'],
|
|
99
|
-
[65536, 'big'],
|
|
100
|
-
[6433713753386423, 'bigger'],
|
|
101
|
-
[-1, 'minus one'],
|
|
102
|
-
[-2, 'minus two'],
|
|
103
|
-
[-256, 'minus two hundred and fifty six'],
|
|
104
|
-
[-501, 'minux five hundred and one'],
|
|
105
|
-
[-502, 'minux five hundred and two'],
|
|
106
|
-
[-2784428724, 'big neg'],
|
|
107
|
-
[-6433713753386424, 'bigger neg']
|
|
108
|
-
]),
|
|
109
|
-
type: 'map with ints and negints',
|
|
110
|
-
useMaps: true
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
data: 'a44104636f6e65430102026374776f430102036574687265654301020464666f7572',
|
|
114
|
-
encode: toMap([
|
|
115
|
-
[Uint8Array.from([1, 2, 3]), 'three'],
|
|
116
|
-
[Uint8Array.from([4]), 'one'],
|
|
117
|
-
[Uint8Array.from([1, 2, 4]), 'four'],
|
|
118
|
-
[Uint8Array.from([1, 2, 2]), 'two']
|
|
119
|
-
]),
|
|
120
|
-
expected: toMap([
|
|
121
|
-
[Uint8Array.from([4]), 'one'],
|
|
122
|
-
[Uint8Array.from([1, 2, 2]), 'two'],
|
|
123
|
-
[Uint8Array.from([1, 2, 3]), 'three'],
|
|
124
|
-
[Uint8Array.from([1, 2, 4]), 'four']
|
|
125
|
-
]),
|
|
126
|
-
type: 'map with bytes keys',
|
|
127
|
-
useMaps: true
|
|
128
|
-
},
|
|
129
|
-
// testing lengths encoded as too-large ints
|
|
130
|
-
{ data: 'b801616101', expected: { a: 1 }, type: 'map 1 pair, length8', strict: false },
|
|
131
|
-
{ data: 'b90001616101', expected: { a: 1 }, type: 'map 1 pair, length16', strict: false },
|
|
132
|
-
{ data: 'ba00000001616101', expected: { a: 1 }, type: 'map 1 pair, length32', strict: false },
|
|
133
|
-
{ data: 'bb0000000000000001616101', expected: { a: 1 }, type: 'map 1 pair, length64', strict: false }
|
|
134
|
-
]
|
|
135
|
-
|
|
136
|
-
function toMap (arr) {
|
|
137
|
-
const m = new Map()
|
|
138
|
-
for (const [key, value] of arr) {
|
|
139
|
-
m.set(key, value)
|
|
140
|
-
}
|
|
141
|
-
return m
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function entries (map) {
|
|
145
|
-
function nest (a) {
|
|
146
|
-
for (const e of a) {
|
|
147
|
-
e[0] = entries(e[0])
|
|
148
|
-
e[1] = entries(e[1])
|
|
149
|
-
}
|
|
150
|
-
return a
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (Object.getPrototypeOf(map) === Map.prototype) {
|
|
154
|
-
return nest([...map.entries()])
|
|
155
|
-
}
|
|
156
|
-
if (typeof map === 'object') {
|
|
157
|
-
return nest([...Object.entries(map)])
|
|
158
|
-
}
|
|
159
|
-
return map
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
describe('map', () => {
|
|
163
|
-
describe('decode', () => {
|
|
164
|
-
for (const fixture of fixtures) {
|
|
165
|
-
const data = fromHex(fixture.data)
|
|
166
|
-
it(`should decode ${fixture.type}=${fixture.label || JSON.stringify(fixture.expected)}`, () => {
|
|
167
|
-
let options = fixture.useMaps ? { useMaps: true } : undefined
|
|
168
|
-
const decoded = decode(data, options)
|
|
169
|
-
|
|
170
|
-
if (fixture.useMaps) {
|
|
171
|
-
assert.strictEqual(Object.getPrototypeOf(decoded), Map.prototype, 'is Map')
|
|
172
|
-
} else {
|
|
173
|
-
assert.isObject(decoded, 'is object')
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
assert.deepStrictEqual(entries(decoded), entries(fixture.expected), `decode ${fixture.type}`)
|
|
177
|
-
|
|
178
|
-
options = Object.assign({ strict: true }, options)
|
|
179
|
-
if (fixture.strict === false) {
|
|
180
|
-
assert.throws(() => decode(data, options), Error, 'CBOR decode error: integer encoded in more bytes than necessary (strict decode)')
|
|
181
|
-
} else {
|
|
182
|
-
assert.deepStrictEqual(
|
|
183
|
-
entries(decode(data, options)),
|
|
184
|
-
entries(fixture.expected),
|
|
185
|
-
`decode ${fixture.type}`)
|
|
186
|
-
}
|
|
187
|
-
})
|
|
188
|
-
|
|
189
|
-
it('should fail to decode very large length', () => {
|
|
190
|
-
assert.throws(
|
|
191
|
-
() => decode(fromHex('bba5f702b3a5f70201616101')),
|
|
192
|
-
/CBOR decode error: 64-bit integer map lengths not supported/)
|
|
193
|
-
})
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
it('errors', () => {
|
|
197
|
-
assert.throws(() => decode(fromHex('a1016161')), /non-string keys not supported \(got number\)/)
|
|
198
|
-
})
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
describe('encode', () => {
|
|
202
|
-
for (const fixture of fixtures) {
|
|
203
|
-
it(`should encode ${fixture.type}=${fixture.label || JSON.stringify(fixture.expected)}`, () => {
|
|
204
|
-
const toEncode = fixture.encode || fixture.expected
|
|
205
|
-
if (fixture.unsafe) {
|
|
206
|
-
assert.throws(encode.bind(null, toEncode), Error, /^CBOR encode error: number too large to encode \(\d+\)$/)
|
|
207
|
-
} else if (fixture.strict === false || fixture.roundtrip === false) {
|
|
208
|
-
assert.notDeepEqual(toHex(encode(toEncode)), fixture.data, `encode ${fixture.type} !strict`)
|
|
209
|
-
} else {
|
|
210
|
-
assert.strictEqual(toHex(encode(toEncode)), fixture.data, `encode ${fixture.type}`)
|
|
211
|
-
}
|
|
212
|
-
})
|
|
213
|
-
}
|
|
214
|
-
})
|
|
215
|
-
|
|
216
|
-
// mostly unnecessary, but feels good
|
|
217
|
-
describe('roundtrip', () => {
|
|
218
|
-
for (const fixture of fixtures) {
|
|
219
|
-
if (!fixture.unsafe && fixture.strict !== false && fixture.roundtrip !== false) {
|
|
220
|
-
it(`should roundtrip ${fixture.type}=${fixture.label || JSON.stringify(fixture.expected)}`, () => {
|
|
221
|
-
const toEncode = fixture.encode || fixture.expected
|
|
222
|
-
const options = fixture.useMaps ? { useMaps: true } : undefined
|
|
223
|
-
const rt = decode(encode(toEncode), options)
|
|
224
|
-
|
|
225
|
-
if (fixture.useMaps) {
|
|
226
|
-
assert.strictEqual(Object.getPrototypeOf(rt), Map.prototype, 'is Map')
|
|
227
|
-
} else {
|
|
228
|
-
assert.isObject(rt, 'is object')
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
assert.deepStrictEqual(entries(rt), entries(fixture.expected), `roundtrip ${fixture.type}`)
|
|
232
|
-
})
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
})
|
|
236
|
-
|
|
237
|
-
describe('specials', () => {
|
|
238
|
-
it('can decode indefinite length items', () => {
|
|
239
|
-
assert.deepStrictEqual(decode(fromHex('bf616f01617402ff')), { o: 1, t: 2 })
|
|
240
|
-
})
|
|
241
|
-
|
|
242
|
-
it('can switch off indefinite length support', () => {
|
|
243
|
-
assert.throws(() => decode(fromHex('bf616f01617402ff'), { allowIndefinite: false }), /indefinite/)
|
|
244
|
-
})
|
|
245
|
-
})
|
|
246
|
-
|
|
247
|
-
describe('sorting', () => {
|
|
248
|
-
it('sorts int map keys', () => {
|
|
249
|
-
assert.strictEqual(toHex(encode(new Map([[1, 1], [2, 2]]))), 'a201010202')
|
|
250
|
-
assert.strictEqual(toHex(encode(new Map([[2, 1], [1, 2]]))), 'a201020201')
|
|
251
|
-
})
|
|
252
|
-
|
|
253
|
-
it('sorts negint map keys', () => {
|
|
254
|
-
assert.strictEqual(toHex(encode(new Map([[-1, 1], [-2, 2]]))), 'a220012102')
|
|
255
|
-
assert.strictEqual(toHex(encode(new Map([[-2, 1], [-1, 2]]))), 'a220022101')
|
|
256
|
-
})
|
|
257
|
-
|
|
258
|
-
it('sorts bytes map keys', () => {
|
|
259
|
-
assert.strictEqual(toHex(encode(new Map([[Uint8Array.from([1, 2]), 1], [Uint8Array.from([2, 1]), 2]]))), 'a24201020142020102')
|
|
260
|
-
assert.strictEqual(toHex(encode(new Map([[Uint8Array.from([2, 1]), 1], [Uint8Array.from([1, 2]), 2]]))), 'a24201020242020101')
|
|
261
|
-
// shortest first
|
|
262
|
-
assert.strictEqual(toHex(encode(new Map([[Uint8Array.from([1, 2]), 1], [Uint8Array.from([2, 1]), 2], [Uint8Array.from([200]), 3]]))), 'a341c8034201020142020102')
|
|
263
|
-
})
|
|
264
|
-
|
|
265
|
-
it('sorts bytes map keys', () => {
|
|
266
|
-
assert.strictEqual(toHex(encode(new Map([[Uint8Array.from([1, 2]), 1], [Uint8Array.from([2, 1]), 2]]))), 'a24201020142020102')
|
|
267
|
-
assert.strictEqual(toHex(encode(new Map([[Uint8Array.from([2, 1]), 1], [Uint8Array.from([1, 2]), 2]]))), 'a24201020242020101')
|
|
268
|
-
// shortest first
|
|
269
|
-
assert.strictEqual(toHex(encode(new Map([[Uint8Array.from([1, 2]), 1], [Uint8Array.from([2, 1]), 2], [Uint8Array.from([200]), 3]]))), 'a341c8034201020142020102')
|
|
270
|
-
})
|
|
271
|
-
|
|
272
|
-
it('sorts array map keys (length only)', () => {
|
|
273
|
-
assert.strictEqual(toHex(encode(new Map([[[1], 1], [[1, 1], 2]]))), 'a281010182010102')
|
|
274
|
-
assert.strictEqual(toHex(encode(new Map([[[1, 1], 1], [[1], 2]]))), 'a281010282010101')
|
|
275
|
-
})
|
|
276
|
-
|
|
277
|
-
it('sorts map map keys (length only)', () => {
|
|
278
|
-
assert.strictEqual(toHex(encode(new Map([[{ a: 1 }, 1], [{ a: 1, b: 1 }, 2]]))), 'a2a161610101a261610161620102')
|
|
279
|
-
assert.strictEqual(toHex(encode(new Map([[{ a: 1, b: 1 }, 1], [{ a: 1 }, 2]]))), 'a2a161610102a261610161620101')
|
|
280
|
-
})
|
|
281
|
-
|
|
282
|
-
// TODO: tag keys .. but why would you do this!?
|
|
283
|
-
})
|
|
284
|
-
})
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/* eslint-env mocha */
|
|
2
|
-
|
|
3
|
-
import * as chai from 'chai'
|
|
4
|
-
|
|
5
|
-
import { decode, encode } from '../cborg.js'
|
|
6
|
-
import { fromHex, toHex } from '../lib/byte-utils.js'
|
|
7
|
-
|
|
8
|
-
const { assert } = chai
|
|
9
|
-
|
|
10
|
-
const fixtures = [
|
|
11
|
-
{ data: '8601f5f4f6f720', expected: [1, true, false, null, undefined, -1], type: 'array of float specials' },
|
|
12
|
-
{ data: 'f93800', expected: 0.5, type: 'float16' },
|
|
13
|
-
{ data: 'f9b800', expected: -0.5, type: 'float16' },
|
|
14
|
-
{ data: 'fa33c00000', expected: 8.940696716308594e-08, type: 'float32' },
|
|
15
|
-
{ data: 'fab3c00000', expected: -8.940696716308594e-08, type: 'float32' },
|
|
16
|
-
{ data: 'fb3ff199999999999a', expected: 1.1, type: 'float64' },
|
|
17
|
-
{ data: 'fbbff199999999999a', expected: -1.1, type: 'float64' },
|
|
18
|
-
{ data: 'fb3ff1c71c71c71c72', expected: 1.11111111111111111111111111111, type: 'float64' }, // eslint-disable-line
|
|
19
|
-
{ data: 'fb0000000000000002', expected: 1e-323, type: 'float64' },
|
|
20
|
-
{ data: 'fb8000000000000002', expected: -1e-323, type: 'float64' },
|
|
21
|
-
{ data: 'fb3fefffffffffffff', expected: 0.9999999999999999, type: 'float64' },
|
|
22
|
-
{ data: 'fbbfefffffffffffff', expected: -0.9999999999999999, type: 'float64' },
|
|
23
|
-
{ data: 'f97c00', expected: Infinity, type: 'Infinity' }, // special CBOR token for -Infinity
|
|
24
|
-
{ data: 'fb7ff0000000000000', expected: Infinity, type: 'Infinity', strict: false }, // an IEEE 754 representation of Infinity
|
|
25
|
-
{ data: 'f9fc00', expected: -Infinity, type: '-Infinity' }, // special CBOR token for -Infinity
|
|
26
|
-
{ data: 'fbfff0000000000000', expected: -Infinity, type: '-Infinity', strict: false }, // an IEEE 754 representation of Infinity
|
|
27
|
-
{ data: 'f97e00', expected: NaN, type: 'NaN' }, // special CBOR token for NaN
|
|
28
|
-
{ data: 'f97ff8', expected: NaN, type: 'NaN', strict: false }, // one of the many IEEE 754 representations of NaN
|
|
29
|
-
{ data: 'fa7ff80000', expected: NaN, type: 'NaN', strict: false },
|
|
30
|
-
{ data: 'fb7ff8000000000000', expected: NaN, type: 'NaN', strict: false },
|
|
31
|
-
{ data: 'fb7ff8cafedeadbeef', expected: NaN, type: 'NaN', strict: false }, // yep, that's NaN too
|
|
32
|
-
{ data: 'fb40f4241a31a5a515', expected: 82497.63712086187, type: 'float64' }
|
|
33
|
-
]
|
|
34
|
-
|
|
35
|
-
describe('float', () => {
|
|
36
|
-
describe('decode', () => {
|
|
37
|
-
for (const fixture of fixtures) {
|
|
38
|
-
const data = fromHex(fixture.data)
|
|
39
|
-
it(`should decode ${fixture.type}=${fixture.expected}`, () => {
|
|
40
|
-
assert.deepStrictEqual(decode(data), fixture.expected, `decode ${fixture.type}`)
|
|
41
|
-
assert.deepStrictEqual(decode(data, { strict: true }), fixture.expected, `decode ${fixture.type}`)
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
it('error', () => {
|
|
47
|
-
// minor number 28, too high for uint
|
|
48
|
-
assert.throws(() => decode(fromHex('f80000')), Error, 'simple values are not supported')
|
|
49
|
-
assert.throws(() => decode(fromHex('f900')), Error, 'not enough data for float16')
|
|
50
|
-
assert.throws(() => decode(fromHex('fa0000')), Error, 'not enough data for float32')
|
|
51
|
-
assert.throws(() => decode(fromHex('fb00000000')), Error, 'not enough data for float64')
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
describe('encode', () => {
|
|
55
|
-
for (const fixture of fixtures) {
|
|
56
|
-
if (fixture.strict !== false) {
|
|
57
|
-
it(`should encode ${fixture.type}=${fixture.expected}`, () => {
|
|
58
|
-
assert.strictEqual(toHex(encode(fixture.expected)), fixture.data, `encode ${fixture.type}`)
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
describe('encode float64', () => {
|
|
65
|
-
for (const fixture of fixtures) {
|
|
66
|
-
if (fixture.type.startsWith('float')) {
|
|
67
|
-
it(`should encode ${fixture.type}=${fixture.expected}`, () => {
|
|
68
|
-
const encoded = encode(fixture.expected, { float64: true })
|
|
69
|
-
assert.strictEqual(encoded.length, 9) // always encode as 9 bytes, regardless of size
|
|
70
|
-
assert.strictEqual(encoded[0], 0xfb)
|
|
71
|
-
assert.strictEqual(decode(encoded), fixture.expected, `encode float64 ${fixture.type}`)
|
|
72
|
-
})
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
describe('roundtrip', () => {
|
|
78
|
-
for (const fixture of fixtures) {
|
|
79
|
-
if (!fixture.unsafe && fixture.strict !== false) {
|
|
80
|
-
it(`should roundtrip ${fixture.type}=${fixture.expected}`, () => {
|
|
81
|
-
assert.deepStrictEqual(decode(encode(fixture.expected)), fixture.expected, `roundtrip ${fixture.type}`)
|
|
82
|
-
})
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
describe('specials', () => {
|
|
88
|
-
// This is a bit of a hack, the CBOR is invalid because it's a standard fixed-length array
|
|
89
|
-
// followed by a BREAK, which should normally error ("too many terminals"), but we want to
|
|
90
|
-
// exercise the allowIndefinite switch in the major-7 decode and it should error before it
|
|
91
|
-
// even gets to looking at terminals and whether the tokens make sense.
|
|
92
|
-
it('indefinite length switch fails on BREAK', () => {
|
|
93
|
-
// sanity check, BREAK doesn't belong there
|
|
94
|
-
assert.throws(() => decode(Uint8Array.from([131, 1, 2, 0xff])), /unexpected break to lengthed array/)
|
|
95
|
-
// throw earlier because we're disallowing BREAK entirely
|
|
96
|
-
assert.throws(() => decode(Uint8Array.from([131, 1, 2, 0xff]), { allowIndefinite: false }), /indefinite/)
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
it('can switch off undefined support', () => {
|
|
100
|
-
assert.deepStrictEqual(decode(fromHex('f7')), undefined)
|
|
101
|
-
assert.throws(() => decode(fromHex('f7'), { allowUndefined: false }), /undefined/)
|
|
102
|
-
assert.deepStrictEqual(decode(fromHex('830102f7')), [1, 2, undefined])
|
|
103
|
-
assert.throws(() => decode(fromHex('830102f7'), { allowUndefined: false }), /undefined/)
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
it('can coerce undefined to null', () => {
|
|
107
|
-
assert.deepStrictEqual(decode(fromHex('f7'), { coerceUndefinedToNull: false }), undefined)
|
|
108
|
-
assert.deepStrictEqual(decode(fromHex('f7'), { coerceUndefinedToNull: true }), null)
|
|
109
|
-
assert.deepStrictEqual(decode(fromHex('830102f7'), { coerceUndefinedToNull: false }), [1, 2, undefined])
|
|
110
|
-
assert.deepStrictEqual(decode(fromHex('830102f7'), { coerceUndefinedToNull: true }), [1, 2, null])
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
it('can switch off Infinity support', () => {
|
|
114
|
-
assert.deepStrictEqual(decode(fromHex('830102f97c00')), [1, 2, Infinity])
|
|
115
|
-
assert.deepStrictEqual(decode(fromHex('830102f9fc00')), [1, 2, -Infinity])
|
|
116
|
-
assert.throws(() => decode(fromHex('830102f97c00'), { allowInfinity: false }), /Infinity/)
|
|
117
|
-
assert.throws(() => decode(fromHex('830102f9fc00'), { allowInfinity: false }), /Infinity/)
|
|
118
|
-
for (const fixture of fixtures.filter((f) => f.type.endsWith('Infinity'))) {
|
|
119
|
-
assert.throws(() => decode(fromHex(fixture.data), { allowInfinity: false }), /Infinity/)
|
|
120
|
-
}
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
it('can switch off NaN support', () => {
|
|
124
|
-
assert.deepStrictEqual(decode(fromHex('830102f97e00')), [1, 2, NaN])
|
|
125
|
-
assert.throws(() => decode(fromHex('830102f97e00'), { allowNaN: false }), /NaN/)
|
|
126
|
-
for (const fixture of fixtures.filter((f) => f.type === 'NaN')) {
|
|
127
|
-
assert.throws(() => decode(fromHex(fixture.data), { allowNaN: false }), /NaN/)
|
|
128
|
-
}
|
|
129
|
-
})
|
|
130
|
-
})
|
|
131
|
-
})
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/* eslint-env mocha */
|
|
2
|
-
|
|
3
|
-
import * as chai from 'chai'
|
|
4
|
-
import { Bl } from '../lib/bl.js'
|
|
5
|
-
|
|
6
|
-
const { assert } = chai
|
|
7
|
-
|
|
8
|
-
describe('Internal bytes list', () => {
|
|
9
|
-
describe('push', () => {
|
|
10
|
-
it('push bits', () => {
|
|
11
|
-
const bl = new Bl(10)
|
|
12
|
-
const expected = []
|
|
13
|
-
for (let i = 0; i < 25; i++) {
|
|
14
|
-
bl.push([i + 1])
|
|
15
|
-
expected.push(i + 1)
|
|
16
|
-
}
|
|
17
|
-
assert.deepEqual([...bl.toBytes()], expected)
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
for (let i = 4; i < 21; i++) {
|
|
21
|
-
it(`push Bl(${i})`, () => {
|
|
22
|
-
const bl = new Bl(i)
|
|
23
|
-
const expected = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 110, 120, 11, 12, 130, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
|
|
24
|
-
for (let i = 0; i < 5; i++) {
|
|
25
|
-
bl.push([i + 1])
|
|
26
|
-
}
|
|
27
|
-
bl.push(Uint8Array.from([6, 7, 8, 9, 10]))
|
|
28
|
-
bl.push([100])
|
|
29
|
-
bl.push(Uint8Array.from([110, 120]))
|
|
30
|
-
bl.push(Uint8Array.from([11, 12]))
|
|
31
|
-
bl.push([130])
|
|
32
|
-
bl.push(Uint8Array.from([13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]))
|
|
33
|
-
assert.deepEqual([...bl.toBytes()], expected)
|
|
34
|
-
})
|
|
35
|
-
}
|
|
36
|
-
})
|
|
37
|
-
})
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/* eslint-env mocha */
|
|
2
|
-
|
|
3
|
-
import { garbage } from 'ipld-garbage'
|
|
4
|
-
import { decode, encode } from '../cborg.js'
|
|
5
|
-
import * as chai from 'chai'
|
|
6
|
-
|
|
7
|
-
const { assert } = chai
|
|
8
|
-
|
|
9
|
-
describe('Fuzz round-trip', () => {
|
|
10
|
-
it('random objects', function () {
|
|
11
|
-
this.timeout(5000)
|
|
12
|
-
for (let i = 0; i < 1000; i++) {
|
|
13
|
-
const obj = garbage(300, { weights: { CID: 0 } })
|
|
14
|
-
const byts = encode(obj)
|
|
15
|
-
const decoded = decode(byts)
|
|
16
|
-
assert.deepEqual(decoded, obj)
|
|
17
|
-
}
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
it('circular references error', () => {
|
|
21
|
-
let obj = {}
|
|
22
|
-
obj.obj = obj
|
|
23
|
-
assert.throws(() => encode(obj), /circular references/)
|
|
24
|
-
|
|
25
|
-
obj = { blip: [1, 2, { blop: {} }] }
|
|
26
|
-
obj.blip[2].blop.boop = obj
|
|
27
|
-
assert.throws(() => encode(obj), /circular references/)
|
|
28
|
-
|
|
29
|
-
obj = { blip: [1, 2, { blop: {} }] }
|
|
30
|
-
obj.blip[2].blop.boop = obj.blip
|
|
31
|
-
assert.throws(() => encode(obj), /circular references/)
|
|
32
|
-
|
|
33
|
-
// not circular but a naive check might decide it is
|
|
34
|
-
obj = { blip: {}, bloop: {} }
|
|
35
|
-
obj.bloop = obj.blip
|
|
36
|
-
assert.doesNotThrow(() => encode(obj))
|
|
37
|
-
|
|
38
|
-
const arr = []
|
|
39
|
-
arr[0] = arr
|
|
40
|
-
assert.throws(() => encode(arr), /circular references/)
|
|
41
|
-
})
|
|
42
|
-
})
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/* eslint-env mocha */
|
|
2
|
-
|
|
3
|
-
import * as chai from 'chai'
|
|
4
|
-
import { garbage } from 'ipld-garbage'
|
|
5
|
-
import { uintBoundaries } from '../lib/0uint.js'
|
|
6
|
-
import { encode } from '../cborg.js'
|
|
7
|
-
import { encodedLength } from '../lib/length.js'
|
|
8
|
-
import { dateEncoder } from './common.js'
|
|
9
|
-
|
|
10
|
-
const { assert } = chai
|
|
11
|
-
|
|
12
|
-
function verifyLength (object, options) {
|
|
13
|
-
const len = encodedLength(object, options)
|
|
14
|
-
const encoded = encode(object, options)
|
|
15
|
-
const actual = encoded.length
|
|
16
|
-
assert.strictEqual(actual, len, JSON.stringify(object))
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
describe('encodedLength', () => {
|
|
20
|
-
it('int boundaries', () => {
|
|
21
|
-
for (let ii = 0; ii < 4; ii++) {
|
|
22
|
-
verifyLength(uintBoundaries[ii])
|
|
23
|
-
verifyLength(uintBoundaries[ii] - 1)
|
|
24
|
-
verifyLength(uintBoundaries[ii] + 1)
|
|
25
|
-
verifyLength(-1 * uintBoundaries[ii])
|
|
26
|
-
verifyLength(-1 * uintBoundaries[ii] - 1)
|
|
27
|
-
verifyLength(-1 * uintBoundaries[ii] + 1)
|
|
28
|
-
}
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
it('tags', () => {
|
|
32
|
-
verifyLength({ date: new Date('2013-03-21T20:04:00Z') }, { typeEncoders: { Date: dateEncoder } })
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
it('floats', () => {
|
|
36
|
-
verifyLength(0.5)
|
|
37
|
-
verifyLength(0.5, { float64: true })
|
|
38
|
-
verifyLength(8.940696716308594e-08)
|
|
39
|
-
verifyLength(8.940696716308594e-08, { float64: true })
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
it('small garbage', function () {
|
|
43
|
-
this.timeout(10000)
|
|
44
|
-
for (let ii = 0; ii < 1000; ii++) {
|
|
45
|
-
const gbg = garbage(1 << 6, { weights: { CID: 0 } })
|
|
46
|
-
verifyLength(gbg)
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
it('medium garbage', function () {
|
|
51
|
-
this.timeout(10000)
|
|
52
|
-
for (let ii = 0; ii < 100; ii++) {
|
|
53
|
-
const gbg = garbage(1 << 16, { weights: { CID: 0 } })
|
|
54
|
-
verifyLength(gbg)
|
|
55
|
-
}
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
it('large garbage', function () {
|
|
59
|
-
this.timeout(10000)
|
|
60
|
-
for (let ii = 0; ii < 10; ii++) {
|
|
61
|
-
const gbg = garbage(1 << 20, { weights: { CID: 0 } })
|
|
62
|
-
verifyLength(gbg)
|
|
63
|
-
}
|
|
64
|
-
})
|
|
65
|
-
})
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export { encodeCustom } from "./lib/encode.js";
|
|
2
|
-
/**
|
|
3
|
-
* There was originally just `TypeEncoder` so don't break types by renaming or not exporting
|
|
4
|
-
*/
|
|
5
|
-
export type TagDecoder = import("./interface").TagDecoder;
|
|
6
|
-
/**
|
|
7
|
-
* Export the types that were present in the original manual cborg.d.ts
|
|
8
|
-
*/
|
|
9
|
-
export type TypeEncoder = import("./interface").OptionalTypeEncoder;
|
|
10
|
-
/**
|
|
11
|
-
* Export the types that were present in the original manual cborg.d.ts
|
|
12
|
-
*/
|
|
13
|
-
export type DecodeOptions = import("./interface").DecodeOptions;
|
|
14
|
-
/**
|
|
15
|
-
* Export the types that were present in the original manual cborg.d.ts
|
|
16
|
-
*/
|
|
17
|
-
export type EncodeOptions = import("./interface").EncodeOptions;
|
|
18
|
-
import { decode } from './lib/decode.js';
|
|
19
|
-
import { decodeFirst } from './lib/decode.js';
|
|
20
|
-
import { Tokeniser } from './lib/decode.js';
|
|
21
|
-
import { tokensToObject } from './lib/decode.js';
|
|
22
|
-
import { encode } from './lib/encode.js';
|
|
23
|
-
import { Token } from './lib/token.js';
|
|
24
|
-
import { Type } from './lib/token.js';
|
|
25
|
-
export { decode, decodeFirst, Tokeniser as Tokenizer, tokensToObject, encode, Token, Type };
|
|
26
|
-
export { encodeErrPrefix, decodeErrPrefix } from "./lib/common.js";
|
|
27
|
-
export { asU8A, fromString, decodeCodePointsArray } from "./lib/byte-utils.js";
|
|
28
|
-
//# sourceMappingURL=cborg.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cborg.d.ts","sourceRoot":"","sources":["../cborg.js"],"names":[],"mappings":";;;;yBAWa,OAAO,aAAa,EAAE,UAAU;;;;0BAEhC,OAAO,aAAa,EAAE,mBAAmB;;;;4BACzC,OAAO,aAAa,EAAE,aAAa;;;;4BACnC,OAAO,aAAa,EAAE,aAAa;uBAde,iBAAiB;4BAAjB,iBAAiB;0BAAjB,iBAAiB;+BAAjB,iBAAiB;uBADzD,iBAAiB;sBAEZ,gBAAgB;qBAAhB,gBAAgB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../example.js"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAA;AAE7B,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,KAAK,EAAE,GAAG,mBAAmB,EAAE,CAAA;AAEzE,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,SAAS,GAAG,SAAS,CAAA;IAC7B,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,CAAA;IACnB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,GAAG,OAAO,CAAA;CACvC;AAED,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,CAAC,EAAE,SAAS,KAAK,mBAAmB,GAAG,IAAI,CAAA;AAEtI,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,CAAC,EAAE,SAAS,KAAK,mBAAmB,CAAA;AAE7H,MAAM,MAAM,gBAAgB,GAAG;IAC7B,CAAC,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IACvD,aAAa,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,GAAG,MAAM,CAAC;IAE5C,WAAW,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC;CAC7D,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,CAAC,EAAE,EAAE,CAAC,KAAK,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,GAAG,KAAK,EAAE,CAAC,EAAE,KAAK,MAAM,CAAA;AAEpF,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,UAAU,GAAG,SAAS,CAAA;AAEvE,MAAM,WAAW,eAAe;IAC9B,IAAI,IAAI,OAAO,CAAC;IAChB,IAAI,IAAI,KAAK,CAAC;IACd,GAAG,IAAI,MAAM,CAAC;CACf;AAED,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAA;AAE5C,MAAM,WAAW,aAAa;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,eAAe,CAAA;CAC5B;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,YAAY,CAAC,EAAE;QAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,CAAA;KAAE,CAAA;CAC3D"}
|