@fireproof/vendor 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (302) hide show
  1. package/package.json +97 -4
  2. package/src/@ipld/car/LICENSE +4 -0
  3. package/src/@ipld/car/README.md +1132 -0
  4. package/src/@ipld/car/dist/index.min.js +5 -0
  5. package/src/@ipld/car/dist/src/api.d.ts +72 -0
  6. package/src/@ipld/car/dist/src/api.d.ts.map +1 -0
  7. package/src/@ipld/car/dist/src/buffer-decoder.d.ts +67 -0
  8. package/src/@ipld/car/dist/src/buffer-decoder.d.ts.map +1 -0
  9. package/src/@ipld/car/dist/src/buffer-reader-browser.d.ts +116 -0
  10. package/src/@ipld/car/dist/src/buffer-reader-browser.d.ts.map +1 -0
  11. package/src/@ipld/car/dist/src/buffer-reader.d.ts +31 -0
  12. package/src/@ipld/car/dist/src/buffer-reader.d.ts.map +1 -0
  13. package/src/@ipld/car/dist/src/buffer-writer.d.ts +86 -0
  14. package/src/@ipld/car/dist/src/buffer-writer.d.ts.map +1 -0
  15. package/src/@ipld/car/dist/src/coding.d.ts +49 -0
  16. package/src/@ipld/car/dist/src/coding.d.ts.map +1 -0
  17. package/src/@ipld/car/dist/src/decoder-common.d.ts +43 -0
  18. package/src/@ipld/car/dist/src/decoder-common.d.ts.map +1 -0
  19. package/src/@ipld/car/dist/src/decoder.d.ts +87 -0
  20. package/src/@ipld/car/dist/src/decoder.d.ts.map +1 -0
  21. package/src/@ipld/car/dist/src/encoder.d.ts +17 -0
  22. package/src/@ipld/car/dist/src/encoder.d.ts.map +1 -0
  23. package/src/@ipld/car/dist/src/header-validator.d.ts +5 -0
  24. package/src/@ipld/car/dist/src/header-validator.d.ts.map +1 -0
  25. package/src/@ipld/car/dist/src/index-browser.d.ts +10 -0
  26. package/src/@ipld/car/dist/src/index-browser.d.ts.map +1 -0
  27. package/src/@ipld/car/dist/src/index.d.ts +11 -0
  28. package/src/@ipld/car/dist/src/index.d.ts.map +1 -0
  29. package/src/@ipld/car/dist/src/indexed-reader-browser.d.ts +5 -0
  30. package/src/@ipld/car/dist/src/indexed-reader-browser.d.ts.map +1 -0
  31. package/src/@ipld/car/dist/src/indexed-reader.d.ts +152 -0
  32. package/src/@ipld/car/dist/src/indexed-reader.d.ts.map +1 -0
  33. package/src/@ipld/car/dist/src/indexer.d.ts +95 -0
  34. package/src/@ipld/car/dist/src/indexer.d.ts.map +1 -0
  35. package/src/@ipld/car/dist/src/iterator-channel.d.ts +7 -0
  36. package/src/@ipld/car/dist/src/iterator-channel.d.ts.map +1 -0
  37. package/src/@ipld/car/dist/src/iterator.d.ts +174 -0
  38. package/src/@ipld/car/dist/src/iterator.d.ts.map +1 -0
  39. package/src/@ipld/car/dist/src/promise-fs-opts.d.ts +28 -0
  40. package/src/@ipld/car/dist/src/promise-fs-opts.d.ts.map +1 -0
  41. package/src/@ipld/car/dist/src/reader-browser.d.ts +151 -0
  42. package/src/@ipld/car/dist/src/reader-browser.d.ts.map +1 -0
  43. package/src/@ipld/car/dist/src/reader.d.ts +40 -0
  44. package/src/@ipld/car/dist/src/reader.d.ts.map +1 -0
  45. package/src/@ipld/car/dist/src/writer-browser.d.ts +155 -0
  46. package/src/@ipld/car/dist/src/writer-browser.d.ts.map +1 -0
  47. package/src/@ipld/car/dist/src/writer.d.ts +45 -0
  48. package/src/@ipld/car/dist/src/writer.d.ts.map +1 -0
  49. package/src/@ipld/car/src/api.ts +90 -0
  50. package/src/@ipld/car/src/buffer-decoder.js +213 -0
  51. package/src/@ipld/car/src/buffer-reader-browser.js +144 -0
  52. package/src/@ipld/car/src/buffer-reader.js +51 -0
  53. package/src/@ipld/car/src/buffer-writer.js +286 -0
  54. package/src/@ipld/car/src/coding.ts +68 -0
  55. package/src/@ipld/car/src/decoder-common.js +82 -0
  56. package/src/@ipld/car/src/decoder.js +347 -0
  57. package/src/@ipld/car/src/encoder.js +76 -0
  58. package/src/@ipld/car/src/header-validator.js +214 -0
  59. package/src/@ipld/car/src/header.ipldsch +18 -0
  60. package/src/@ipld/car/src/index-browser.js +18 -0
  61. package/src/@ipld/car/src/index.js +21 -0
  62. package/src/@ipld/car/src/indexed-reader-browser.js +7 -0
  63. package/src/@ipld/car/src/indexed-reader.js +211 -0
  64. package/src/@ipld/car/src/indexer.js +130 -0
  65. package/src/@ipld/car/src/iterator-channel.js +91 -0
  66. package/src/@ipld/car/src/iterator.js +267 -0
  67. package/src/@ipld/car/src/promise-fs-opts.js +46 -0
  68. package/src/@ipld/car/src/reader-browser.js +194 -0
  69. package/src/@ipld/car/src/reader.js +54 -0
  70. package/src/@ipld/car/src/writer-browser.js +250 -0
  71. package/src/@ipld/car/src/writer.js +81 -0
  72. package/src/@ipld/dag-cbor/LICENSE +4 -0
  73. package/src/@ipld/dag-cbor/README.md +80 -0
  74. package/src/@ipld/dag-cbor/dist/index.min.js +3 -0
  75. package/src/@ipld/dag-cbor/dist/src/index.d.ts +67 -0
  76. package/src/@ipld/dag-cbor/dist/src/index.d.ts.map +1 -0
  77. package/src/@ipld/dag-cbor/src/index.js +147 -0
  78. package/src/@ipld/dag-json/LICENSE +4 -0
  79. package/src/@ipld/dag-json/README.md +58 -0
  80. package/src/@ipld/dag-json/dist/index.min.js +3 -0
  81. package/src/@ipld/dag-json/dist/src/index.d.ts +12 -0
  82. package/src/@ipld/dag-json/dist/src/index.d.ts.map +1 -0
  83. package/src/@ipld/dag-json/src/index.js +291 -0
  84. package/src/@web3-storage/pail/dist/src/batch/index.d.ts +53 -1
  85. package/src/@web3-storage/pail/dist/src/batch/index.d.ts.map +1 -1
  86. package/src/@web3-storage/pail/dist/src/batch/shard.d.ts +1 -1
  87. package/src/@web3-storage/pail/dist/src/batch/shard.d.ts.map +1 -1
  88. package/src/@web3-storage/pail/dist/src/block.d.ts +2 -2
  89. package/src/@web3-storage/pail/dist/src/block.d.ts.map +1 -1
  90. package/src/@web3-storage/pail/dist/src/clock/index.d.ts +2 -2
  91. package/src/@web3-storage/pail/dist/src/clock/index.d.ts.map +1 -1
  92. package/src/@web3-storage/pail/dist/src/crdt/batch/index.d.ts.map +1 -1
  93. package/src/@web3-storage/pail/dist/src/crdt/index.d.ts +2 -2
  94. package/src/@web3-storage/pail/dist/src/crdt/index.d.ts.map +1 -1
  95. package/src/@web3-storage/pail/dist/src/diff.d.ts +3 -3
  96. package/src/@web3-storage/pail/dist/src/diff.d.ts.map +1 -1
  97. package/src/@web3-storage/pail/dist/src/index.d.ts +1 -1
  98. package/src/@web3-storage/pail/dist/src/index.d.ts.map +1 -1
  99. package/src/@web3-storage/pail/dist/src/merge.d.ts.map +1 -1
  100. package/src/@web3-storage/pail/dist/src/shard.d.ts +4 -4
  101. package/src/@web3-storage/pail/dist/src/shard.d.ts.map +1 -1
  102. package/src/@web3-storage/pail/dist/tsconfig.tsbuildinfo +1 -1
  103. package/src/@web3-storage/pail/src/api.ts +1 -1
  104. package/src/@web3-storage/pail/src/clock/index.js +1 -1
  105. package/src/@web3-storage/pail/src/shard.js +1 -1
  106. package/src/cborg/.github/dependabot.yml +16 -0
  107. package/src/cborg/.github/workflows/test-and-release.yml +52 -0
  108. package/src/cborg/CHANGELOG.md +513 -0
  109. package/src/cborg/LICENSE +13 -0
  110. package/src/cborg/README.md +515 -0
  111. package/src/cborg/bench/bench.js +117 -0
  112. package/src/cborg/bench/json.js +124 -0
  113. package/src/cborg/bench/package.json +8 -0
  114. package/src/cborg/cborg/bin.js +189 -0
  115. package/src/cborg/cborg/common.js +28 -0
  116. package/src/cborg/cborg/decode.js +211 -0
  117. package/src/cborg/cborg/diagnostic.js +158 -0
  118. package/src/cborg/cborg/diagnostic_test.js +117 -0
  119. package/src/cborg/cborg/encode.js +466 -0
  120. package/src/cborg/cborg/index.js +33 -0
  121. package/src/cborg/cborg/is.js +106 -0
  122. package/src/cborg/cborg/length.js +62 -0
  123. package/src/cborg/example-bytestrings.js +180 -0
  124. package/src/cborg/example-json.js +6 -0
  125. package/src/cborg/example.js +5 -0
  126. package/src/cborg/interface.ts +59 -0
  127. package/src/cborg/json/decode.js +462 -0
  128. package/src/cborg/json/encode.js +302 -0
  129. package/src/cborg/json/json.js +4 -0
  130. package/src/cborg/taglib.js +75 -0
  131. package/src/cborg/test/appendix_a.js +647 -0
  132. package/src/cborg/test/common.js +18 -0
  133. package/src/cborg/test/node-test-bin.js +402 -0
  134. package/src/cborg/test/noop-bin-test.js +3 -0
  135. package/src/cborg/test/test-0uint.js +103 -0
  136. package/src/cborg/test/test-1negint.js +96 -0
  137. package/src/cborg/test/test-2bytes.js +198 -0
  138. package/src/cborg/test/test-3string.js +136 -0
  139. package/src/cborg/test/test-4array.js +93 -0
  140. package/src/cborg/test/test-5map.js +284 -0
  141. package/src/cborg/test/test-6tag.js +84 -0
  142. package/src/cborg/test/test-7float.js +131 -0
  143. package/src/cborg/test/test-bl.js +37 -0
  144. package/src/cborg/test/test-cbor-vectors.js +107 -0
  145. package/src/cborg/test/test-decode-errors.js +65 -0
  146. package/src/cborg/test/test-fuzz.js +42 -0
  147. package/src/cborg/test/test-json.js +219 -0
  148. package/src/cborg/test/test-length.js +65 -0
  149. package/src/cborg/test/test-partial.js +111 -0
  150. package/src/cborg/tsconfig.json +48 -0
  151. package/src/cborg/types/cborg/decode.d.ts +43 -0
  152. package/src/cborg/types/cborg/decode.d.ts.map +1 -0
  153. package/src/cborg/types/cborg/encode.d.ts +51 -0
  154. package/src/cborg/types/cborg/encode.d.ts.map +1 -0
  155. package/src/cborg/types/cborg/index.d.ts +26 -0
  156. package/src/cborg/types/cborg/index.d.ts.map +1 -0
  157. package/src/cborg/types/cborg/is.d.ts +6 -0
  158. package/src/cborg/types/cborg/is.d.ts.map +1 -0
  159. package/src/cborg/types/example.d.ts +2 -0
  160. package/src/cborg/types/example.d.ts.map +1 -0
  161. package/src/cborg/types/interface.d.ts +49 -0
  162. package/src/cborg/types/interface.d.ts.map +1 -0
  163. package/src/cborg/types/json/decode.d.ts +67 -0
  164. package/src/cborg/types/json/decode.d.ts.map +1 -0
  165. package/src/cborg/types/json/encode.d.ts +11 -0
  166. package/src/cborg/types/json/encode.d.ts.map +1 -0
  167. package/src/cborg/types/json/json.d.ts +6 -0
  168. package/src/cborg/types/json/json.d.ts.map +1 -0
  169. package/src/cborg/types/taglib.d.ts +18 -0
  170. package/src/cborg/types/taglib.d.ts.map +1 -0
  171. package/src/cborg/types/tsconfig.tsbuildinfo +1 -0
  172. package/src/cborg/types/utils/0uint.d.ts +102 -0
  173. package/src/cborg/types/utils/0uint.d.ts.map +1 -0
  174. package/src/cborg/types/utils/1negint.d.ts +59 -0
  175. package/src/cborg/types/utils/1negint.d.ts.map +1 -0
  176. package/src/cborg/types/utils/2bytes.d.ts +69 -0
  177. package/src/cborg/types/utils/2bytes.d.ts.map +1 -0
  178. package/src/cborg/types/utils/3string.d.ts +46 -0
  179. package/src/cborg/types/utils/3string.d.ts.map +1 -0
  180. package/src/cborg/types/utils/4array.d.ts +66 -0
  181. package/src/cborg/types/utils/4array.d.ts.map +1 -0
  182. package/src/cborg/types/utils/5map.d.ts +66 -0
  183. package/src/cborg/types/utils/5map.d.ts.map +1 -0
  184. package/src/cborg/types/utils/6tag.d.ts +62 -0
  185. package/src/cborg/types/utils/6tag.d.ts.map +1 -0
  186. package/src/cborg/types/utils/7float.d.ts +60 -0
  187. package/src/cborg/types/utils/7float.d.ts.map +1 -0
  188. package/src/cborg/types/utils/bl.d.ts +26 -0
  189. package/src/cborg/types/utils/bl.d.ts.map +1 -0
  190. package/src/cborg/types/utils/byte-utils.d.ts +53 -0
  191. package/src/cborg/types/utils/byte-utils.d.ts.map +1 -0
  192. package/src/cborg/types/utils/common.d.ts +8 -0
  193. package/src/cborg/types/utils/common.d.ts.map +1 -0
  194. package/src/cborg/types/utils/index.d.ts +13 -0
  195. package/src/cborg/types/utils/index.d.ts.map +1 -0
  196. package/src/cborg/types/utils/jump.d.ts +16 -0
  197. package/src/cborg/types/utils/jump.d.ts.map +1 -0
  198. package/src/cborg/types/utils/token.d.ts +59 -0
  199. package/src/cborg/types/utils/token.d.ts.map +1 -0
  200. package/src/cborg/utils/0uint.js +229 -0
  201. package/src/cborg/utils/1negint.js +111 -0
  202. package/src/cborg/utils/2bytes.js +135 -0
  203. package/src/cborg/utils/3string.js +90 -0
  204. package/src/cborg/utils/4array.js +114 -0
  205. package/src/cborg/utils/5map.js +113 -0
  206. package/src/cborg/utils/6tag.js +81 -0
  207. package/src/cborg/utils/7float.js +310 -0
  208. package/src/cborg/utils/bl.js +124 -0
  209. package/src/cborg/utils/byte-utils.js +417 -0
  210. package/src/cborg/utils/common.js +11 -0
  211. package/src/cborg/utils/index.js +12 -0
  212. package/src/cborg/utils/jump.js +222 -0
  213. package/src/cborg/utils/token.js +76 -0
  214. package/src/ipfs-unixfs-exporter/LICENSE +4 -0
  215. package/src/ipfs-unixfs-exporter/README.md +105 -0
  216. package/src/ipfs-unixfs-exporter/dist/index.min.js +3 -0
  217. package/src/ipfs-unixfs-exporter/dist/src/errors.d.ts +57 -0
  218. package/src/ipfs-unixfs-exporter/dist/src/errors.d.ts.map +1 -0
  219. package/src/ipfs-unixfs-exporter/dist/src/errors.js +73 -0
  220. package/src/ipfs-unixfs-exporter/dist/src/errors.js.map +1 -0
  221. package/src/ipfs-unixfs-exporter/dist/src/index.d.ts +355 -0
  222. package/src/ipfs-unixfs-exporter/dist/src/index.d.ts.map +1 -0
  223. package/src/ipfs-unixfs-exporter/dist/src/index.js +197 -0
  224. package/src/ipfs-unixfs-exporter/dist/src/index.js.map +1 -0
  225. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.d.ts +4 -0
  226. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.d.ts.map +1 -0
  227. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.js +9 -0
  228. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.js.map +1 -0
  229. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.d.ts +4 -0
  230. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.d.ts.map +1 -0
  231. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.js +9 -0
  232. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.js.map +1 -0
  233. package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.d.ts +4 -0
  234. package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.d.ts.map +1 -0
  235. package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.js +38 -0
  236. package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.js.map +1 -0
  237. package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.d.ts +4 -0
  238. package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.d.ts.map +1 -0
  239. package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.js +30 -0
  240. package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.js.map +1 -0
  241. package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.d.ts +4 -0
  242. package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.d.ts.map +1 -0
  243. package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.js +9 -0
  244. package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.js.map +1 -0
  245. package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.d.ts +4 -0
  246. package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.d.ts.map +1 -0
  247. package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.js +37 -0
  248. package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.js.map +1 -0
  249. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.d.ts +4 -0
  250. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.d.ts.map +1 -0
  251. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.js +29 -0
  252. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.js.map +1 -0
  253. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.d.ts +4 -0
  254. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.d.ts.map +1 -0
  255. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.js +153 -0
  256. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.js.map +1 -0
  257. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.d.ts +4 -0
  258. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.d.ts.map +1 -0
  259. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.js +59 -0
  260. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.js.map +1 -0
  261. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.d.ts +4 -0
  262. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.d.ts.map +1 -0
  263. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.js +25 -0
  264. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.js.map +1 -0
  265. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.d.ts +4 -0
  266. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.d.ts.map +1 -0
  267. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.js +104 -0
  268. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.js.map +1 -0
  269. package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.d.ts +3 -0
  270. package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.d.ts.map +1 -0
  271. package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.js +20 -0
  272. package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.js.map +1 -0
  273. package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.d.ts +6 -0
  274. package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.d.ts.map +1 -0
  275. package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.js +116 -0
  276. package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.js.map +1 -0
  277. package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.d.ts +4 -0
  278. package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.d.ts.map +1 -0
  279. package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.js +57 -0
  280. package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.js.map +1 -0
  281. package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.d.ts +6 -0
  282. package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.d.ts.map +1 -0
  283. package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.js +30 -0
  284. package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.js.map +1 -0
  285. package/src/ipfs-unixfs-exporter/dist/typedoc-urls.json +58 -0
  286. package/src/ipfs-unixfs-exporter/src/errors.ts +87 -0
  287. package/src/ipfs-unixfs-exporter/src/index.ts +498 -0
  288. package/src/ipfs-unixfs-exporter/src/resolvers/dag-cbor.ts +12 -0
  289. package/src/ipfs-unixfs-exporter/src/resolvers/dag-json.ts +12 -0
  290. package/src/ipfs-unixfs-exporter/src/resolvers/identity.ts +49 -0
  291. package/src/ipfs-unixfs-exporter/src/resolvers/index.ts +35 -0
  292. package/src/ipfs-unixfs-exporter/src/resolvers/json.ts +12 -0
  293. package/src/ipfs-unixfs-exporter/src/resolvers/raw.ts +49 -0
  294. package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/directory.ts +39 -0
  295. package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/file.ts +198 -0
  296. package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/hamt-sharded-directory.ts +76 -0
  297. package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/raw.ts +37 -0
  298. package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/index.ts +121 -0
  299. package/src/ipfs-unixfs-exporter/src/utils/extract-data-from-block.ts +24 -0
  300. package/src/ipfs-unixfs-exporter/src/utils/find-cid-in-shard.ts +149 -0
  301. package/src/ipfs-unixfs-exporter/src/utils/resolve-object-path.ts +62 -0
  302. package/src/ipfs-unixfs-exporter/src/utils/validate-offset-and-length.ts +38 -0
@@ -0,0 +1,647 @@
1
+ const fixtures = [
2
+ {
3
+ cbor: 'AA==',
4
+ hex: '00',
5
+ roundtrip: true,
6
+ decoded: 0
7
+ },
8
+ {
9
+ cbor: 'AQ==',
10
+ hex: '01',
11
+ roundtrip: true,
12
+ decoded: 1
13
+ },
14
+ {
15
+ cbor: 'Cg==',
16
+ hex: '0a',
17
+ roundtrip: true,
18
+ decoded: 10
19
+ },
20
+ {
21
+ cbor: 'Fw==',
22
+ hex: '17',
23
+ roundtrip: true,
24
+ decoded: 23
25
+ },
26
+ {
27
+ cbor: 'GBg=',
28
+ hex: '1818',
29
+ roundtrip: true,
30
+ decoded: 24
31
+ },
32
+ {
33
+ cbor: 'GBk=',
34
+ hex: '1819',
35
+ roundtrip: true,
36
+ decoded: 25
37
+ },
38
+ {
39
+ cbor: 'GGQ=',
40
+ hex: '1864',
41
+ roundtrip: true,
42
+ decoded: 100
43
+ },
44
+ {
45
+ cbor: 'GQPo',
46
+ hex: '1903e8',
47
+ roundtrip: true,
48
+ decoded: 1000
49
+ },
50
+ {
51
+ cbor: 'GgAPQkA=',
52
+ hex: '1a000f4240',
53
+ roundtrip: true,
54
+ decoded: 1000000
55
+ },
56
+ {
57
+ cbor: 'GwAAAOjUpRAA',
58
+ hex: '1b000000e8d4a51000',
59
+ roundtrip: true,
60
+ decoded: 1000000000000
61
+ },
62
+ {
63
+ cbor: 'G///////////',
64
+ hex: '1bffffffffffffffff',
65
+ roundtrip: true,
66
+ decoded: BigInt('18446744073709551615')
67
+ },
68
+ {
69
+ cbor: 'wkkBAAAAAAAAAAA=',
70
+ hex: 'c249010000000000000000',
71
+ roundtrip: true,
72
+ decoded: BigInt('18446744073709551616'),
73
+ noTagDecodeError: /tag not supported \(2\)/,
74
+ noTagEncodeError: /BigInt larger than allowable range/
75
+ },
76
+ {
77
+ cbor: 'O///////////',
78
+ hex: '3bffffffffffffffff',
79
+ roundtrip: true,
80
+ decoded: BigInt('-18446744073709551616')
81
+ },
82
+ {
83
+ cbor: 'w0kBAAAAAAAAAAA=',
84
+ hex: 'c349010000000000000000',
85
+ roundtrip: true,
86
+ decoded: BigInt('-18446744073709551617'),
87
+ noTagDecodeError: /tag not supported \(3\)/,
88
+ noTagEncodeError: /BigInt larger than allowable range/
89
+ },
90
+ {
91
+ cbor: 'IA==',
92
+ hex: '20',
93
+ roundtrip: true,
94
+ decoded: -1
95
+ },
96
+ {
97
+ cbor: 'KQ==',
98
+ hex: '29',
99
+ roundtrip: true,
100
+ decoded: -10
101
+ },
102
+ {
103
+ cbor: 'OGM=',
104
+ hex: '3863',
105
+ roundtrip: true,
106
+ decoded: -100
107
+ },
108
+ {
109
+ cbor: 'OQPn',
110
+ hex: '3903e7',
111
+ roundtrip: true,
112
+ decoded: -1000
113
+ },
114
+ {
115
+ cbor: '+QAA',
116
+ hex: 'f90000',
117
+ roundtrip: false, // indistinguishable float
118
+ decoded: 0.0
119
+ },
120
+ {
121
+ cbor: '+YAA',
122
+ hex: 'f98000',
123
+ roundtrip: false, // indistinguishable float
124
+ decoded: -0.0
125
+ },
126
+ {
127
+ cbor: '+TwA',
128
+ hex: 'f93c00',
129
+ roundtrip: false, // indistinguishable float
130
+ decoded: 1.0
131
+ },
132
+ {
133
+ cbor: '+z/xmZmZmZma',
134
+ hex: 'fb3ff199999999999a',
135
+ roundtrip: true,
136
+ decoded: 1.1
137
+ },
138
+ {
139
+ cbor: '+T4A',
140
+ hex: 'f93e00',
141
+ roundtrip: true,
142
+ decoded: 1.5
143
+ },
144
+ {
145
+ cbor: '+Xv/',
146
+ hex: 'f97bff',
147
+ roundtrip: false, // indistinguishable float
148
+ decoded: 65504.0
149
+ },
150
+ {
151
+ cbor: '+kfDUAA=',
152
+ hex: 'fa47c35000',
153
+ roundtrip: false, // indistinguishable float
154
+ decoded: 100000.0
155
+ },
156
+ {
157
+ cbor: '+n9///8=',
158
+ hex: 'fa7f7fffff',
159
+ roundtrip: true,
160
+ decoded: 3.4028234663852886e+38
161
+ },
162
+ {
163
+ cbor: '+3435DyIAHWc',
164
+ hex: 'fb7e37e43c8800759c',
165
+ roundtrip: true,
166
+ decoded: 1.0e+300
167
+ },
168
+ {
169
+ cbor: '+QAB',
170
+ hex: 'f90001',
171
+ roundtrip: true,
172
+ decoded: 5.960464477539063e-08
173
+ },
174
+ {
175
+ cbor: '+QQA',
176
+ hex: 'f90400',
177
+ roundtrip: true,
178
+ decoded: 6.103515625e-05
179
+ },
180
+ {
181
+ cbor: '+cQA',
182
+ hex: 'f9c400',
183
+ roundtrip: false, // indistinguishable float
184
+ decoded: -4.0
185
+ },
186
+ {
187
+ cbor: '+8AQZmZmZmZm',
188
+ hex: 'fbc010666666666666',
189
+ roundtrip: true,
190
+ decoded: -4.1
191
+ },
192
+ {
193
+ cbor: '+XwA',
194
+ hex: 'f97c00',
195
+ roundtrip: true,
196
+ diagnostic: Infinity
197
+ },
198
+ {
199
+ cbor: '+X4A',
200
+ hex: 'f97e00',
201
+ roundtrip: true,
202
+ diagnostic: NaN
203
+ },
204
+ {
205
+ cbor: '+fwA',
206
+ hex: 'f9fc00',
207
+ roundtrip: true,
208
+ diagnostic: -Infinity
209
+ },
210
+ {
211
+ cbor: '+n+AAAA=',
212
+ hex: 'fa7f800000',
213
+ roundtrip: false,
214
+ diagnostic: Infinity
215
+ },
216
+ {
217
+ cbor: '+n/AAAA=',
218
+ hex: 'fa7fc00000',
219
+ roundtrip: false,
220
+ diagnostic: NaN
221
+ },
222
+ {
223
+ cbor: '+v+AAAA=',
224
+ hex: 'faff800000',
225
+ roundtrip: false,
226
+ diagnostic: -Infinity
227
+ },
228
+ {
229
+ cbor: '+3/wAAAAAAAA',
230
+ hex: 'fb7ff0000000000000',
231
+ roundtrip: false,
232
+ diagnostic: Infinity
233
+ },
234
+ {
235
+ cbor: '+3/4AAAAAAAA',
236
+ hex: 'fb7ff8000000000000',
237
+ roundtrip: false,
238
+ diagnostic: NaN
239
+ },
240
+ {
241
+ cbor: '+//wAAAAAAAA',
242
+ hex: 'fbfff0000000000000',
243
+ roundtrip: false,
244
+ diagnostic: -Infinity
245
+ },
246
+ {
247
+ cbor: '9A==',
248
+ hex: 'f4',
249
+ roundtrip: true,
250
+ decoded: false
251
+ },
252
+ {
253
+ cbor: '9Q==',
254
+ hex: 'f5',
255
+ roundtrip: true,
256
+ decoded: true
257
+ },
258
+ {
259
+ cbor: '9g==',
260
+ hex: 'f6',
261
+ roundtrip: true,
262
+ decoded: null
263
+ },
264
+ {
265
+ cbor: '9w==',
266
+ hex: 'f7',
267
+ roundtrip: true,
268
+ diagnostic: undefined
269
+ },
270
+ {
271
+ cbor: '8A==',
272
+ hex: 'f0',
273
+ roundtrip: true,
274
+ diagnostic: 'simple(16)',
275
+ error: /simple values are not supported/
276
+ },
277
+ {
278
+ cbor: '+Bg=',
279
+ hex: 'f818',
280
+ roundtrip: true,
281
+ diagnostic: 'simple(24)',
282
+ error: /simple values are not supported/
283
+ },
284
+ {
285
+ cbor: '+P8=',
286
+ hex: 'f8ff',
287
+ roundtrip: true,
288
+ diagnostic: 'simple(255)',
289
+ error: /simple values are not supported/
290
+ },
291
+ {
292
+ cbor: 'wHQyMDEzLTAzLTIxVDIwOjA0OjAwWg==',
293
+ hex: 'c074323031332d30332d32315432303a30343a30305a',
294
+ roundtrip: false, // tags
295
+ diagnostic: '0("2013-03-21T20:04:00Z")'
296
+ },
297
+ {
298
+ cbor: 'wRpRS2ew',
299
+ hex: 'c11a514b67b0',
300
+ roundtrip: false, // tags
301
+ diagnostic: '1(1363896240)'
302
+ },
303
+ {
304
+ cbor: 'wftB1FLZ7CAAAA==',
305
+ hex: 'c1fb41d452d9ec200000',
306
+ roundtrip: false, // tags
307
+ diagnostic: '1(1363896240.5)'
308
+ },
309
+ {
310
+ cbor: '10QBAgME',
311
+ hex: 'd74401020304',
312
+ roundtrip: false, // tags
313
+ diagnostic: "23(h'01020304')"
314
+ },
315
+ {
316
+ cbor: '2BhFZElFVEY=',
317
+ hex: 'd818456449455446',
318
+ roundtrip: false, // tags
319
+ diagnostic: "24(h'6449455446')"
320
+ },
321
+ {
322
+ cbor: '2CB2aHR0cDovL3d3dy5leGFtcGxlLmNvbQ==',
323
+ hex: 'd82076687474703a2f2f7777772e6578616d706c652e636f6d',
324
+ roundtrip: false, // tags
325
+ diagnostic: '32("http://www.example.com")'
326
+ },
327
+ {
328
+ cbor: 'QA==',
329
+ hex: '40',
330
+ roundtrip: true,
331
+ diagnostic: "h''"
332
+ },
333
+ {
334
+ cbor: 'RAECAwQ=',
335
+ hex: '4401020304',
336
+ roundtrip: true,
337
+ diagnostic: "h'01020304'"
338
+ },
339
+ {
340
+ cbor: 'YA==',
341
+ hex: '60',
342
+ roundtrip: true,
343
+ decoded: ''
344
+ },
345
+ {
346
+ cbor: 'YWE=',
347
+ hex: '6161',
348
+ roundtrip: true,
349
+ decoded: 'a'
350
+ },
351
+ {
352
+ cbor: 'ZElFVEY=',
353
+ hex: '6449455446',
354
+ roundtrip: true,
355
+ decoded: 'IETF'
356
+ },
357
+ {
358
+ cbor: 'YiJc',
359
+ hex: '62225c',
360
+ roundtrip: true,
361
+ decoded: '"\\'
362
+ },
363
+ {
364
+ cbor: 'YsO8',
365
+ hex: '62c3bc',
366
+ roundtrip: true,
367
+ decoded: 'ü'
368
+ },
369
+ {
370
+ cbor: 'Y+awtA==',
371
+ hex: '63e6b0b4',
372
+ roundtrip: true,
373
+ decoded: '水'
374
+ },
375
+ {
376
+ cbor: 'ZPCQhZE=',
377
+ hex: '64f0908591',
378
+ roundtrip: true,
379
+ decoded: '𐅑'
380
+ },
381
+ {
382
+ cbor: 'gA==',
383
+ hex: '80',
384
+ roundtrip: true,
385
+ decoded: [
386
+ ]
387
+ },
388
+ {
389
+ cbor: 'gwECAw==',
390
+ hex: '83010203',
391
+ roundtrip: true,
392
+ decoded: [
393
+ 1,
394
+ 2,
395
+ 3
396
+ ]
397
+ },
398
+ {
399
+ cbor: 'gwGCAgOCBAU=',
400
+ hex: '8301820203820405',
401
+ roundtrip: true,
402
+ decoded: [
403
+ 1,
404
+ [
405
+ 2,
406
+ 3
407
+ ],
408
+ [
409
+ 4,
410
+ 5
411
+ ]
412
+ ]
413
+ },
414
+ {
415
+ cbor: 'mBkBAgMEBQYHCAkKCwwNDg8QERITFBUWFxgYGBk=',
416
+ hex: '98190102030405060708090a0b0c0d0e0f101112131415161718181819',
417
+ roundtrip: true,
418
+ decoded: [
419
+ 1,
420
+ 2,
421
+ 3,
422
+ 4,
423
+ 5,
424
+ 6,
425
+ 7,
426
+ 8,
427
+ 9,
428
+ 10,
429
+ 11,
430
+ 12,
431
+ 13,
432
+ 14,
433
+ 15,
434
+ 16,
435
+ 17,
436
+ 18,
437
+ 19,
438
+ 20,
439
+ 21,
440
+ 22,
441
+ 23,
442
+ 24,
443
+ 25
444
+ ]
445
+ },
446
+ {
447
+ cbor: 'oA==',
448
+ hex: 'a0',
449
+ roundtrip: true,
450
+ decoded: {
451
+ }
452
+ },
453
+ {
454
+ cbor: 'ogECAwQ=',
455
+ hex: 'a201020304',
456
+ roundtrip: true,
457
+ diagnostic: '{1: 2, 3: 4}',
458
+ error: /non-string keys not supported/
459
+ },
460
+ {
461
+ cbor: 'omFhAWFiggID',
462
+ hex: 'a26161016162820203',
463
+ roundtrip: true,
464
+ decoded: {
465
+ a: 1,
466
+ b: [
467
+ 2,
468
+ 3
469
+ ]
470
+ }
471
+ },
472
+ {
473
+ cbor: 'gmFhoWFiYWM=',
474
+ hex: '826161a161626163',
475
+ roundtrip: true,
476
+ decoded: [
477
+ 'a',
478
+ {
479
+ b: 'c'
480
+ }
481
+ ]
482
+ },
483
+ {
484
+ cbor: 'pWFhYUFhYmFCYWNhQ2FkYURhZWFF',
485
+ hex: 'a56161614161626142616361436164614461656145',
486
+ roundtrip: true,
487
+ decoded: {
488
+ a: 'A',
489
+ b: 'B',
490
+ c: 'C',
491
+ d: 'D',
492
+ e: 'E'
493
+ }
494
+ },
495
+ {
496
+ cbor: 'X0IBAkMDBAX/',
497
+ hex: '5f42010243030405ff',
498
+ roundtrip: false,
499
+ diagnostic: "(_ h'0102', h'030405')",
500
+ error: /indefinite length bytes\/strings are not supported/
501
+ },
502
+ {
503
+ cbor: 'f2VzdHJlYWRtaW5n/w==',
504
+ hex: '7f657374726561646d696e67ff',
505
+ roundtrip: false,
506
+ decoded: 'streaming',
507
+ error: /indefinite length bytes\/strings are not supported/
508
+ },
509
+ {
510
+ cbor: 'n/8=',
511
+ hex: '9fff',
512
+ roundtrip: false,
513
+ decoded: [
514
+
515
+ ]
516
+ },
517
+ {
518
+ cbor: 'nwGCAgOfBAX//w==',
519
+ hex: '9f018202039f0405ffff',
520
+ roundtrip: false,
521
+ decoded: [
522
+ 1,
523
+ [
524
+ 2,
525
+ 3
526
+ ],
527
+ [
528
+ 4,
529
+ 5
530
+ ]
531
+ ]
532
+ },
533
+ {
534
+ cbor: 'nwGCAgOCBAX/',
535
+ hex: '9f01820203820405ff',
536
+ roundtrip: false,
537
+ decoded: [
538
+ 1,
539
+ [
540
+ 2,
541
+ 3
542
+ ],
543
+ [
544
+ 4,
545
+ 5
546
+ ]
547
+ ]
548
+ },
549
+ {
550
+ cbor: 'gwGCAgOfBAX/',
551
+ hex: '83018202039f0405ff',
552
+ roundtrip: false,
553
+ decoded: [
554
+ 1,
555
+ [
556
+ 2,
557
+ 3
558
+ ],
559
+ [
560
+ 4,
561
+ 5
562
+ ]
563
+ ]
564
+ },
565
+ {
566
+ cbor: 'gwGfAgP/ggQF',
567
+ hex: '83019f0203ff820405',
568
+ roundtrip: false,
569
+ decoded: [
570
+ 1,
571
+ [
572
+ 2,
573
+ 3
574
+ ],
575
+ [
576
+ 4,
577
+ 5
578
+ ]
579
+ ]
580
+ },
581
+ {
582
+ cbor: 'nwECAwQFBgcICQoLDA0ODxAREhMUFRYXGBgYGf8=',
583
+ hex: '9f0102030405060708090a0b0c0d0e0f101112131415161718181819ff',
584
+ roundtrip: false,
585
+ decoded: [
586
+ 1,
587
+ 2,
588
+ 3,
589
+ 4,
590
+ 5,
591
+ 6,
592
+ 7,
593
+ 8,
594
+ 9,
595
+ 10,
596
+ 11,
597
+ 12,
598
+ 13,
599
+ 14,
600
+ 15,
601
+ 16,
602
+ 17,
603
+ 18,
604
+ 19,
605
+ 20,
606
+ 21,
607
+ 22,
608
+ 23,
609
+ 24,
610
+ 25
611
+ ]
612
+ },
613
+ {
614
+ cbor: 'v2FhAWFinwID//8=',
615
+ hex: 'bf61610161629f0203ffff',
616
+ roundtrip: false,
617
+ decoded: {
618
+ a: 1,
619
+ b: [
620
+ 2,
621
+ 3
622
+ ]
623
+ }
624
+ },
625
+ {
626
+ cbor: 'gmFhv2FiYWP/',
627
+ hex: '826161bf61626163ff',
628
+ roundtrip: false,
629
+ decoded: [
630
+ 'a',
631
+ {
632
+ b: 'c'
633
+ }
634
+ ]
635
+ },
636
+ {
637
+ cbor: 'v2NGdW71Y0FtdCH/',
638
+ hex: 'bf6346756ef563416d7421ff',
639
+ roundtrip: false,
640
+ decoded: {
641
+ Fun: true,
642
+ Amt: -2
643
+ }
644
+ }
645
+ ]
646
+
647
+ export { fixtures }
@@ -0,0 +1,18 @@
1
+ import { Token, Type } from "@fireproof/vendor/cborg/utils"
2
+
3
+ export function dateDecoder (obj) {
4
+ if (typeof obj !== 'string') {
5
+ throw new Error('expected string for tag 1')
6
+ }
7
+ return new Date(obj)
8
+ }
9
+
10
+ export function dateEncoder (obj) {
11
+ if (!(obj instanceof Date)) {
12
+ throw new Error('expected Date for "Date" encoder')
13
+ }
14
+ return [
15
+ new Token(Type.tag, 0),
16
+ new Token(Type.string, obj.toISOString().replace(/\.000Z$/, 'Z'))
17
+ ];
18
+ }