@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,87 @@
1
+ /**
2
+ * @typedef {import('./api').Block} Block
3
+ * @typedef {import('./api').BlockHeader} BlockHeader
4
+ * @typedef {import('./api').BlockIndex} BlockIndex
5
+ * @typedef {import('./coding').BytesReader} BytesReader
6
+ * @typedef {import('./coding').CarHeader} CarHeader
7
+ * @typedef {import('./coding').CarV2Header} CarV2Header
8
+ * @typedef {import('./coding').CarV2FixedHeader} CarV2FixedHeader
9
+ * @typedef {import('./coding').CarDecoder} CarDecoder
10
+ */
11
+ /**
12
+ * Reads header data from a `BytesReader`. The header may either be in the form
13
+ * of a `CarHeader` or `CarV2Header` depending on the CAR being read.
14
+ *
15
+ * @name async decoder.readHeader(reader)
16
+ * @param {BytesReader} reader
17
+ * @param {number} [strictVersion]
18
+ * @returns {Promise<CarHeader|CarV2Header>}
19
+ */
20
+ export function readHeader(reader: BytesReader, strictVersion?: number | undefined): Promise<CarHeader | CarV2Header>;
21
+ /**
22
+ * Reads the leading data of an individual block from CAR data from a
23
+ * `BytesReader`. Returns a `BlockHeader` object which contains
24
+ * `{ cid, length, blockLength }` which can be used to either index the block
25
+ * or read the block binary data.
26
+ *
27
+ * @name async decoder.readBlockHead(reader)
28
+ * @param {BytesReader} reader
29
+ * @returns {Promise<BlockHeader>}
30
+ */
31
+ export function readBlockHead(reader: BytesReader): Promise<BlockHeader>;
32
+ /**
33
+ * Creates a `CarDecoder` from a `BytesReader`. The `CarDecoder` is as async
34
+ * interface that will consume the bytes from the `BytesReader` to yield a
35
+ * `header()` and either `blocks()` or `blocksIndex()` data.
36
+ *
37
+ * @name decoder.createDecoder(reader)
38
+ * @param {BytesReader} reader
39
+ * @returns {CarDecoder}
40
+ */
41
+ export function createDecoder(reader: BytesReader): CarDecoder;
42
+ /**
43
+ * Creates a `BytesReader` from a `Uint8Array`.
44
+ *
45
+ * @name decoder.bytesReader(bytes)
46
+ * @param {Uint8Array} bytes
47
+ * @returns {BytesReader}
48
+ */
49
+ export function bytesReader(bytes: Uint8Array): BytesReader;
50
+ /**
51
+ * @ignore
52
+ * reusable reader for streams and files, we just need a way to read an
53
+ * additional chunk (of some undetermined size) and a way to close the
54
+ * reader when finished
55
+ * @param {() => Promise<Uint8Array|null>} readChunk
56
+ * @returns {BytesReader}
57
+ */
58
+ export function chunkReader(readChunk: () => Promise<Uint8Array | null>): BytesReader;
59
+ /**
60
+ * Creates a `BytesReader` from an `AsyncIterable<Uint8Array>`, which allows for
61
+ * consumption of CAR data from a streaming source.
62
+ *
63
+ * @name decoder.asyncIterableReader(asyncIterable)
64
+ * @param {AsyncIterable<Uint8Array>} asyncIterable
65
+ * @returns {BytesReader}
66
+ */
67
+ export function asyncIterableReader(asyncIterable: AsyncIterable<Uint8Array>): BytesReader;
68
+ /**
69
+ * Wraps a `BytesReader` in a limiting `BytesReader` which limits maximum read
70
+ * to `byteLimit` bytes. It _does not_ update `pos` of the original
71
+ * `BytesReader`.
72
+ *
73
+ * @name decoder.limitReader(reader, byteLimit)
74
+ * @param {BytesReader} reader
75
+ * @param {number} byteLimit
76
+ * @returns {BytesReader}
77
+ */
78
+ export function limitReader(reader: BytesReader, byteLimit: number): BytesReader;
79
+ export type Block = import('./api').Block;
80
+ export type BlockHeader = import('./api').BlockHeader;
81
+ export type BlockIndex = import('./api').BlockIndex;
82
+ export type BytesReader = import('./coding').BytesReader;
83
+ export type CarHeader = import('./coding').CarHeader;
84
+ export type CarV2Header = import('./coding').CarV2Header;
85
+ export type CarV2FixedHeader = import('./coding').CarV2FixedHeader;
86
+ export type CarDecoder = import('./coding').CarDecoder;
87
+ //# sourceMappingURL=decoder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decoder.d.ts","sourceRoot":"","sources":["../../src/decoder.js"],"names":[],"mappings":"AAMA;;;;;;;;;GASG;AAEH;;;;;;;;GAQG;AACH,mCAJW,WAAW,uCAET,QAAQ,SAAS,GAAC,WAAW,CAAC,CA8B1C;AAyBD;;;;;;;;;GASG;AACH,sCAHW,WAAW,GACT,QAAQ,WAAW,CAAC,CAehC;AAwBD;;;;;;;;GAQG;AACH,sCAHW,WAAW,GACT,UAAU,CA6BtB;AAED;;;;;;GAMG;AACH,mCAHW,UAAU,GACR,WAAW,CA+BvB;AAED;;;;;;;GAOG;AACH,uCAHW,MAAM,QAAQ,UAAU,GAAC,IAAI,CAAC,GAC5B,WAAW,CAuEvB;AAED;;;;;;;GAOG;AACH,mDAHW,cAAc,UAAU,CAAC,GACvB,WAAW,CAcvB;AAED;;;;;;;;;GASG;AACH,oCAJW,WAAW,aACX,MAAM,GACJ,WAAW,CAmCvB;oBAnVY,OAAO,OAAO,EAAE,KAAK;0BACrB,OAAO,OAAO,EAAE,WAAW;yBAC3B,OAAO,OAAO,EAAE,UAAU;0BAC1B,OAAO,UAAU,EAAE,WAAW;wBAC9B,OAAO,UAAU,EAAE,SAAS;0BAC5B,OAAO,UAAU,EAAE,WAAW;+BAC9B,OAAO,UAAU,EAAE,gBAAgB;yBACnC,OAAO,UAAU,EAAE,UAAU"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Create a header from an array of roots.
3
+ *
4
+ * @param {CID[]} roots
5
+ * @returns {Uint8Array}
6
+ */
7
+ export function createHeader(roots: CID[]): Uint8Array;
8
+ export type CID = import('multiformats').CID;
9
+ export type Block = import('./api').Block;
10
+ export type CarEncoder = import('./coding').CarEncoder;
11
+ export type IteratorChannel_Writer = import('./coding').IteratorChannel_Writer<Uint8Array>;
12
+ /**
13
+ * @param {IteratorChannel_Writer} writer
14
+ * @returns {CarEncoder}
15
+ */
16
+ export function createEncoder(writer: import("./coding").IteratorChannel_Writer<Uint8Array>): CarEncoder;
17
+ //# sourceMappingURL=encoder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../src/encoder.js"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,oCAHW,GAAG,EAAE,GACH,UAAU,CAStB;kBArBY,OAAO,cAAc,EAAE,GAAG;oBAC1B,OAAO,OAAO,EAAE,KAAK;yBACrB,OAAO,UAAU,EAAE,UAAU;qCAC7B,OAAO,UAAU,EAAE,sBAAsB,CAAC,UAAU,CAAC;AAoBlE;;;GAGG;AACH,8FAFa,UAAU,CA4CtB"}
@@ -0,0 +1,5 @@
1
+ export namespace CarV1HeaderOrV2Pragma {
2
+ function toTyped(obj: any): any;
3
+ function toRepresentation(obj: any): any;
4
+ }
5
+ //# sourceMappingURL=header-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"header-validator.d.ts","sourceRoot":"","sources":["../../src/header-validator.js"],"names":[],"mappings":";IAkC4B,gCAAwB;IAwFxB,yCAAwB"}
@@ -0,0 +1,10 @@
1
+ import { CarReader } from './reader-browser.js';
2
+ import { CarIndexer } from './indexer.js';
3
+ import { CarBlockIterator } from './iterator.js';
4
+ import { CarCIDIterator } from './iterator.js';
5
+ import { CarWriter } from './writer-browser.js';
6
+ import { CarIndexedReader } from './indexed-reader-browser.js';
7
+ import { CarBufferReader } from './buffer-reader.js';
8
+ import * as CarBufferWriter from './buffer-writer.js';
9
+ export { CarReader, CarIndexer, CarBlockIterator, CarCIDIterator, CarWriter, CarIndexedReader, CarBufferReader, CarBufferWriter };
10
+ //# sourceMappingURL=index-browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-browser.d.ts","sourceRoot":"","sources":["../../src/index-browser.js"],"names":[],"mappings":"0BAK0B,qBAAqB;2BAFpB,cAAc;iCACQ,eAAe;+BAAf,eAAe;0BAEtC,qBAAqB;iCAJd,6BAA6B;gCAF9B,oBAAoB;iCACnB,oBAAoB"}
@@ -0,0 +1,11 @@
1
+ export const contentType: "application/vnd.ipld.car";
2
+ import { CarReader } from './reader.js';
3
+ import { CarBufferReader } from './buffer-reader.js';
4
+ import { CarIndexer } from './indexer.js';
5
+ import { CarBlockIterator } from './iterator.js';
6
+ import { CarCIDIterator } from './iterator.js';
7
+ import { CarWriter } from './writer.js';
8
+ import { CarIndexedReader } from './indexed-reader.js';
9
+ import * as CarBufferWriter from './buffer-writer.js';
10
+ export { CarReader, CarBufferReader, CarIndexer, CarBlockIterator, CarCIDIterator, CarWriter, CarIndexedReader, CarBufferWriter };
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":"AASA,qDAAqD;0BAJ3B,aAAa;gCALP,oBAAoB;2BAGzB,cAAc;iCACQ,eAAe;+BAAf,eAAe;0BAEtC,aAAa;iCAJN,qBAAqB;iCADrB,oBAAoB"}
@@ -0,0 +1,5 @@
1
+ export class CarIndexedReader {
2
+ static fromFile(): Promise<void>;
3
+ }
4
+ export const __browser: true;
5
+ //# sourceMappingURL=indexed-reader-browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indexed-reader-browser.d.ts","sourceRoot":"","sources":["../../src/indexed-reader-browser.js"],"names":[],"mappings":"AAAA;IACE,iCAEC;CACF;AAED,6BAA6B"}
@@ -0,0 +1,152 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * @typedef {import('fs').promises.FileHandle} FileHandle
4
+ * @typedef {import('./api').Block} Block
5
+ * @typedef {import('./api').BlockIndex} BlockIndex
6
+ * @typedef {import('./api').CarReader} CarReaderIface
7
+ * @typedef {import('./reader-browser').CarReader} CarReader
8
+ * @typedef {{ blockLength:number, blockOffset:number }} RawLocation
9
+ */
10
+ /**
11
+ * A form of {@link CarReader} that pre-indexes a CAR archive from a file and
12
+ * provides random access to blocks within the file using the index data. This
13
+ * function is **only available in Node.js** and not a browser environment.
14
+ *
15
+ * For large CAR files, using this form of `CarReader` can be singificantly more
16
+ * efficient in terms of memory. The index consists of a list of `CID`s and
17
+ * their location within the archive (see {@link CarIndexer}). For large numbers
18
+ * of blocks, this index can also occupy a significant amount of memory. In some
19
+ * cases it may be necessary to expand the memory capacity of a Node.js instance
20
+ * to allow this index to fit. (e.g. by running with
21
+ * `NODE_OPTIONS="--max-old-space-size=16384"`).
22
+ *
23
+ * As an `CarIndexedReader` instance maintains an open file descriptor for its
24
+ * CAR file, an additional {@link CarReader#close} method is attached. This
25
+ * _must_ be called to have full clean-up of resources after use.
26
+ *
27
+ * Load this class with either
28
+ * `import { CarIndexedReader } from '@ipld/car/indexed-reader'`
29
+ * (`const { CarIndexedReader } = require('@ipld/car/indexed-reader')`). Or
30
+ * `import { CarIndexedReader } from '@ipld/car'`
31
+ * (`const { CarIndexedReader } = require('@ipld/car')`). The former will likely
32
+ * result in smaller bundle sizes where this is important.
33
+ *
34
+ * @name CarIndexedReader
35
+ * @class
36
+ * @implements {CarReaderIface}
37
+ * @extends {CarReader}
38
+ * @property {number} version The version number of the CAR referenced by this
39
+ * reader (should be `1`).
40
+ */
41
+ export class CarIndexedReader implements CarReaderIface {
42
+ /**
43
+ * Instantiate an {@link CarIndexedReader} from a file with the provided
44
+ * `path`. The CAR file is first indexed with a full path that collects `CID`s
45
+ * and block locations. This index is maintained in memory. Subsequent reads
46
+ * operate on a read-only file descriptor, fetching the block from its in-file
47
+ * location.
48
+ *
49
+ * For large archives, the initial indexing may take some time. The returned
50
+ * `Promise` will resolve only after this is complete.
51
+ *
52
+ * @async
53
+ * @static
54
+ * @memberof CarIndexedReader
55
+ * @param {string} path
56
+ * @returns {Promise<CarIndexedReader>}
57
+ */
58
+ static fromFile(path: string): Promise<CarIndexedReader>;
59
+ /**
60
+ * @param {number} version
61
+ * @param {string} path
62
+ * @param {CID[]} roots
63
+ * @param {Map<string, RawLocation>} index
64
+ * @param {string[]} order
65
+ */
66
+ constructor(version: number, path: string, roots: CID[], index: Map<string, RawLocation>, order: string[]);
67
+ _version: number;
68
+ _path: string;
69
+ _roots: CID<any, number, number, import("multiformats/cid").Version>[];
70
+ _index: Map<string, RawLocation>;
71
+ _order: string[];
72
+ _fd: fs.promises.FileHandle | null;
73
+ get version(): number;
74
+ /**
75
+ * See {@link CarReader#getRoots}
76
+ *
77
+ * @function
78
+ * @memberof CarIndexedReader
79
+ * @instance
80
+ * @async
81
+ * @returns {Promise<CID[]>}
82
+ */
83
+ getRoots(): Promise<CID[]>;
84
+ /**
85
+ * See {@link CarReader#has}
86
+ *
87
+ * @function
88
+ * @memberof CarIndexedReader
89
+ * @instance
90
+ * @async
91
+ * @param {CID} key
92
+ * @returns {Promise<boolean>}
93
+ */
94
+ has(key: CID): Promise<boolean>;
95
+ /**
96
+ * See {@link CarReader#get}
97
+ *
98
+ * @function
99
+ * @memberof CarIndexedReader
100
+ * @instance
101
+ * @async
102
+ * @param {CID} key
103
+ * @returns {Promise<Block | undefined>}
104
+ */
105
+ get(key: CID): Promise<Block | undefined>;
106
+ /**
107
+ * See {@link CarReader#blocks}
108
+ *
109
+ * @function
110
+ * @memberof CarIndexedReader
111
+ * @instance
112
+ * @async
113
+ * @generator
114
+ * @returns {AsyncGenerator<Block>}
115
+ */
116
+ blocks(): AsyncGenerator<Block>;
117
+ /**
118
+ * See {@link CarReader#cids}
119
+ *
120
+ * @function
121
+ * @memberof CarIndexedReader
122
+ * @instance
123
+ * @async
124
+ * @generator
125
+ * @returns {AsyncGenerator<CID>}
126
+ */
127
+ cids(): AsyncGenerator<CID>;
128
+ /**
129
+ * Close the underlying file descriptor maintained by this `CarIndexedReader`.
130
+ * This must be called for proper resource clean-up to occur.
131
+ *
132
+ * @function
133
+ * @memberof CarIndexedReader
134
+ * @instance
135
+ * @async
136
+ * @returns {Promise<void>}
137
+ */
138
+ close(): Promise<void>;
139
+ }
140
+ export const __browser: false;
141
+ export type FileHandle = import('fs').promises.FileHandle;
142
+ export type Block = import('./api').Block;
143
+ export type BlockIndex = import('./api').BlockIndex;
144
+ export type CarReaderIface = import('./api').CarReader;
145
+ export type CarReader = import('./reader-browser').CarReader;
146
+ export type RawLocation = {
147
+ blockLength: number;
148
+ blockOffset: number;
149
+ };
150
+ import { CID } from 'multiformats/cid';
151
+ import fs from 'fs';
152
+ //# sourceMappingURL=indexed-reader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indexed-reader.d.ts","sourceRoot":"","sources":["../../src/indexed-reader.js"],"names":[],"mappings":";AAMA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH;IAiIE;;;;;;;;;;;;;;;OAeG;IACH,sBAHW,MAAM,GACJ,QAAQ,gBAAgB,CAAC,CAkBrC;IAhKD;;;;;;OAMG;IACH,qBANW,MAAM,QACN,MAAM,SACN,GAAG,EAAE,SACL,IAAI,MAAM,EAAE,WAAW,CAAC,SACxB,MAAM,EAAE,EASlB;IANC,iBAAuB;IACvB,cAAiB;IACjB,uEAAmB;IACnB,iCAAmB;IACnB,iBAAmB;IACnB,mCAAe;IAGjB,sBAEC;IAED;;;;;;;;OAQG;IACH,YAFa,QAAQ,GAAG,EAAE,CAAC,CAI1B;IAED;;;;;;;;;OASG;IACH,SAHW,GAAG,GACD,QAAQ,OAAO,CAAC,CAI5B;IAED;;;;;;;;;OASG;IACH,SAHW,GAAG,GACD,QAAQ,KAAK,GAAG,SAAS,CAAC,CAkBtC;IAED;;;;;;;;;OASG;IACH,UAFa,eAAe,KAAK,CAAC,CAWjC;IAED;;;;;;;;;OASG;IACH,QAFa,eAAe,GAAG,CAAC,CAM/B;IAED;;;;;;;;;OASG;IACH,SAFa,QAAQ,IAAI,CAAC,CAMzB;CAmCF;AAED,8BAA8B;yBA3MjB,OAAO,IAAI,EAAE,QAAQ,CAAC,UAAU;oBAChC,OAAO,OAAO,EAAE,KAAK;yBACrB,OAAO,OAAO,EAAE,UAAU;6BAC1B,OAAO,OAAO,EAAE,SAAS;wBACzB,OAAO,kBAAkB,EAAE,SAAS;0BACpC;IAAE,WAAW,EAAC,MAAM,CAAC;IAAC,WAAW,EAAC,MAAM,CAAA;CAAE;oBAVnC,kBAAkB;eAFvB,IAAI"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * @typedef {import('multiformats').CID} CID
3
+ * @typedef {import('./api').Block} Block
4
+ * @typedef {import('./api').RootsReader} RootsReader
5
+ * @typedef {import('./api').BlockIndex} BlockIndex
6
+ * @typedef {import('./coding').BytesReader} BytesReader
7
+ */
8
+ /**
9
+ * Provides an iterator over all of the `Block`s in a CAR, returning their CIDs
10
+ * and byte-location information. Implements an `AsyncIterable<BlockIndex>`.
11
+ * Where a `BlockIndex` is a
12
+ * `{ cid:CID, length:number, offset:number, blockLength:number, blockOffset:number }`.
13
+ *
14
+ * As an implementer of `AsyncIterable`, this class can be used directly in a
15
+ * `for await (const blockIndex of iterator) {}` loop. Where the `iterator` is
16
+ * constructed using {@link CarIndexer.fromBytes} or
17
+ * {@link CarIndexer.fromIterable}.
18
+ *
19
+ * An iteration can only be performce _once_ per instantiation.
20
+ *
21
+ * `CarIndexer` also implements the `RootsReader` interface and provides
22
+ * the {@link CarIndexer.getRoots `getRoots()`} method.
23
+ *
24
+ * Load this class with either
25
+ * `import { CarIndexer } from '@ipld/car/indexer'`
26
+ * (`const { CarIndexer } = require('@ipld/car/indexer')`). Or
27
+ * `import { CarIndexer } from '@ipld/car'`
28
+ * (`const { CarIndexer } = require('@ipld/car')`). The former will likely
29
+ * result in smaller bundle sizes where this is important.
30
+ *
31
+ * @name CarIndexer
32
+ * @class
33
+ * @implements {RootsReader}
34
+ * @implements {AsyncIterable<BlockIndex>}
35
+ * @property {number} version The version number of the CAR referenced by this
36
+ * reader (should be `1`).
37
+ */
38
+ export class CarIndexer implements RootsReader, AsyncIterable<BlockIndex> {
39
+ /**
40
+ * Instantiate a {@link CarIndexer} from a `Uint8Array` blob. Only the header
41
+ * is decoded initially, the remainder is processed and emitted via the
42
+ * iterator as it is consumed.
43
+ *
44
+ * @async
45
+ * @static
46
+ * @memberof CarIndexer
47
+ * @param {Uint8Array} bytes
48
+ * @returns {Promise<CarIndexer>}
49
+ */
50
+ static fromBytes(bytes: Uint8Array): Promise<CarIndexer>;
51
+ /**
52
+ * Instantiate a {@link CarIndexer} from a `AsyncIterable<Uint8Array>`,
53
+ * such as a [modern Node.js stream](https://nodejs.org/api/stream.html#stream_streams_compatibility_with_async_generators_and_async_iterators).
54
+ * is decoded initially, the remainder is processed and emitted via the
55
+ * iterator as it is consumed.
56
+ *
57
+ * @async
58
+ * @static
59
+ * @memberof CarIndexer
60
+ * @param {AsyncIterable<Uint8Array>} asyncIterable
61
+ * @returns {Promise<CarIndexer>}
62
+ */
63
+ static fromIterable(asyncIterable: AsyncIterable<Uint8Array>): Promise<CarIndexer>;
64
+ /**
65
+ * @param {number} version
66
+ * @param {CID[]} roots
67
+ * @param {AsyncGenerator<BlockIndex>} iterator
68
+ */
69
+ constructor(version: number, roots: CID[], iterator: AsyncGenerator<BlockIndex>);
70
+ _version: number;
71
+ _roots: import("multiformats").CID<any, number, number, import("multiformats").Version>[];
72
+ _iterator: AsyncGenerator<import("./api").BlockIndex, any, any>;
73
+ get version(): number;
74
+ /**
75
+ * Get the list of roots defined by the CAR referenced by this indexer. May be
76
+ * zero or more `CID`s.
77
+ *
78
+ * @function
79
+ * @memberof CarIndexer
80
+ * @instance
81
+ * @async
82
+ * @returns {Promise<CID[]>}
83
+ */
84
+ getRoots(): Promise<CID[]>;
85
+ /**
86
+ * @returns {AsyncIterator<BlockIndex>}
87
+ */
88
+ [Symbol.asyncIterator](): AsyncIterator<BlockIndex>;
89
+ }
90
+ export type CID = import('multiformats').CID;
91
+ export type Block = import('./api').Block;
92
+ export type RootsReader = import('./api').RootsReader;
93
+ export type BlockIndex = import('./api').BlockIndex;
94
+ export type BytesReader = import('./coding').BytesReader;
95
+ //# sourceMappingURL=indexer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../../src/indexer.js"],"names":[],"mappings":"AAMA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,8DAJ8B,UAAU;IAyCtC;;;;;;;;;;OAUG;IACH,wBAHW,UAAU,GACR,QAAQ,UAAU,CAAC,CAO/B;IAED;;;;;;;;;;;OAWG;IACH,mCAHW,cAAc,UAAU,CAAC,GACvB,QAAQ,UAAU,CAAC,CAO/B;IAvED;;;;OAIG;IACH,qBAJW,MAAM,SACN,GAAG,EAAE,YACL,eAAe,UAAU,CAAC,EAMpC;IAHC,iBAAuB;IACvB,0FAAmB;IACnB,gEAAyB;IAG3B,sBAEC;IAED;;;;;;;;;OASG;IACH,YAFa,QAAQ,GAAG,EAAE,CAAC,CAI1B;IAED;;OAEG;IACH,0BAFa,cAAc,UAAU,CAAC,CAIrC;CAsCF;kBA9GY,OAAO,cAAc,EAAE,GAAG;oBAC1B,OAAO,OAAO,EAAE,KAAK;0BACrB,OAAO,OAAO,EAAE,WAAW;yBAC3B,OAAO,OAAO,EAAE,UAAU;0BAC1B,OAAO,UAAU,EAAE,WAAW"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @template {any} T
3
+ * @returns {IteratorChannel<T>}
4
+ */
5
+ export function create<T extends unknown>(): import("./coding").IteratorChannel<T>;
6
+ export type IteratorChannel<T extends unknown> = import('./coding').IteratorChannel<T>;
7
+ //# sourceMappingURL=iterator-channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iterator-channel.d.ts","sourceRoot":"","sources":["../../src/iterator-channel.js"],"names":[],"mappings":"AAOA;;;GAGG;AACH,mFA+EC;iDAxFY,OAAO,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC"}
@@ -0,0 +1,174 @@
1
+ /**
2
+ * @typedef {import('multiformats').CID} CID
3
+ * @typedef {import('./api').Block} Block
4
+ * @typedef {import('./api').RootsReader} RootsReader
5
+ * @typedef {import('./coding').BytesReader} BytesReader
6
+ */
7
+ /**
8
+ * @class
9
+ * @implements {RootsReader}
10
+ * @property {number} version The version number of the CAR referenced by this reader (should be `1`).
11
+ */
12
+ export class CarIteratorBase implements RootsReader {
13
+ /**
14
+ * @param {number} version
15
+ * @param {CID[]} roots
16
+ * @param {AsyncIterable<Block>|void} iterable
17
+ */
18
+ constructor(version: number, roots: CID[], iterable: AsyncIterable<Block> | void);
19
+ _version: number;
20
+ _roots: import("multiformats").CID<any, number, number, import("multiformats").Version>[];
21
+ _iterable: void | AsyncIterable<import("./api").Block>;
22
+ _decoded: boolean;
23
+ get version(): number;
24
+ /**
25
+ * @returns {Promise<CID[]>}
26
+ */
27
+ getRoots(): Promise<CID[]>;
28
+ }
29
+ /**
30
+ * Provides an iterator over all of the `Block`s in a CAR. Implements a
31
+ * `BlockIterator` interface, or `AsyncIterable<Block>`. Where a `Block` is
32
+ * a `{ cid:CID, bytes:Uint8Array }` pair.
33
+ *
34
+ * As an implementer of `AsyncIterable`, this class can be used directly in a
35
+ * `for await (const block of iterator) {}` loop. Where the `iterator` is
36
+ * constructed using {@link CarBlockiterator.fromBytes} or
37
+ * {@link CarBlockiterator.fromIterable}.
38
+ *
39
+ * An iteration can only be performce _once_ per instantiation.
40
+ *
41
+ * `CarBlockIterator` also implements the `RootsReader` interface and provides
42
+ * the {@link CarBlockiterator.getRoots `getRoots()`} method.
43
+ *
44
+ * Load this class with either
45
+ * `import { CarBlockIterator } from '@ipld/car/iterator'`
46
+ * (`const { CarBlockIterator } = require('@ipld/car/iterator')`). Or
47
+ * `import { CarBlockIterator } from '@ipld/car'`
48
+ * (`const { CarBlockIterator } = require('@ipld/car')`).
49
+ *
50
+ * @name CarBlockIterator
51
+ * @class
52
+ * @implements {RootsReader}
53
+ * @implements {AsyncIterable<Block>}
54
+ * @property {number} version The version number of the CAR referenced by this
55
+ * iterator (should be `1`).
56
+ */
57
+ export class CarBlockIterator extends CarIteratorBase implements RootsReader, AsyncIterable<Block> {
58
+ /**
59
+ * Instantiate a {@link CarBlockIterator} from a `Uint8Array` blob. Rather
60
+ * than decoding the entire byte array prior to returning the iterator, as in
61
+ * {@link CarReader.fromBytes}, only the header is decoded and the remainder
62
+ * of the CAR is parsed as the `Block`s as yielded.
63
+ *
64
+ * @async
65
+ * @static
66
+ * @memberof CarBlockIterator
67
+ * @param {Uint8Array} bytes
68
+ * @returns {Promise<CarBlockIterator>}
69
+ */
70
+ static fromBytes(bytes: Uint8Array): Promise<CarBlockIterator>;
71
+ /**
72
+ * Instantiate a {@link CarBlockIterator} from a `AsyncIterable<Uint8Array>`,
73
+ * such as a [modern Node.js stream](https://nodejs.org/api/stream.html#stream_streams_compatibility_with_async_generators_and_async_iterators).
74
+ * Rather than decoding the entire byte array prior to returning the iterator,
75
+ * as in {@link CarReader.fromIterable}, only the header is decoded and the
76
+ * remainder of the CAR is parsed as the `Block`s as yielded.
77
+ *
78
+ * @async
79
+ * @static
80
+ * @param {AsyncIterable<Uint8Array>} asyncIterable
81
+ * @returns {Promise<CarBlockIterator>}
82
+ */
83
+ static fromIterable(asyncIterable: AsyncIterable<Uint8Array>): Promise<CarBlockIterator>;
84
+ /**
85
+ * Get the list of roots defined by the CAR referenced by this iterator. May be
86
+ * zero or more `CID`s.
87
+ *
88
+ * @function getRoots
89
+ * @memberof CarBlockIterator
90
+ * @instance
91
+ * @async
92
+ * @returns {Promise<CID[]>}
93
+ */
94
+ /**
95
+ * @returns {AsyncIterator<Block>}
96
+ */
97
+ [Symbol.asyncIterator](): AsyncIterator<Block>;
98
+ }
99
+ /**
100
+ * Provides an iterator over all of the `CID`s in a CAR. Implements a
101
+ * `CIDIterator` interface, or `AsyncIterable<CID>`. Similar to
102
+ * {@link CarBlockIterator} but only yields the CIDs in the CAR.
103
+ *
104
+ * As an implementer of `AsyncIterable`, this class can be used directly in a
105
+ * `for await (const cid of iterator) {}` loop. Where the `iterator` is
106
+ * constructed using {@link CarCIDiterator.fromBytes} or
107
+ * {@link CarCIDiterator.fromIterable}.
108
+ *
109
+ * An iteration can only be performce _once_ per instantiation.
110
+ *
111
+ * `CarCIDIterator` also implements the `RootsReader` interface and provides
112
+ * the {@link CarCIDiterator.getRoots `getRoots()`} method.
113
+ *
114
+ * Load this class with either
115
+ * `import { CarCIDIterator } from '@ipld/car/iterator'`
116
+ * (`const { CarCIDIterator } = require('@ipld/car/iterator')`). Or
117
+ * `import { CarCIDIterator } from '@ipld/car'`
118
+ * (`const { CarCIDIterator } = require('@ipld/car')`).
119
+ *
120
+ * @name CarCIDIterator
121
+ * @class
122
+ * @implements {RootsReader}
123
+ * @implements {AsyncIterable<CID>}
124
+ * @property {number} version The version number of the CAR referenced by this
125
+ * iterator (should be `1`).
126
+ */
127
+ export class CarCIDIterator extends CarIteratorBase implements RootsReader, AsyncIterable<CID> {
128
+ /**
129
+ * Instantiate a {@link CarCIDIterator} from a `Uint8Array` blob. Rather
130
+ * than decoding the entire byte array prior to returning the iterator, as in
131
+ * {@link CarReader.fromBytes}, only the header is decoded and the remainder
132
+ * of the CAR is parsed as the `CID`s as yielded.
133
+ *
134
+ * @async
135
+ * @static
136
+ * @memberof CarCIDIterator
137
+ * @param {Uint8Array} bytes
138
+ * @returns {Promise<CarCIDIterator>}
139
+ */
140
+ static fromBytes(bytes: Uint8Array): Promise<CarCIDIterator>;
141
+ /**
142
+ * Instantiate a {@link CarCIDIterator} from a `AsyncIterable<Uint8Array>`,
143
+ * such as a [modern Node.js stream](https://nodejs.org/api/stream.html#stream_streams_compatibility_with_async_generators_and_async_iterators).
144
+ * Rather than decoding the entire byte array prior to returning the iterator,
145
+ * as in {@link CarReader.fromIterable}, only the header is decoded and the
146
+ * remainder of the CAR is parsed as the `CID`s as yielded.
147
+ *
148
+ * @async
149
+ * @static
150
+ * @memberof CarCIDIterator
151
+ * @param {AsyncIterable<Uint8Array>} asyncIterable
152
+ * @returns {Promise<CarCIDIterator>}
153
+ */
154
+ static fromIterable(asyncIterable: AsyncIterable<Uint8Array>): Promise<CarCIDIterator>;
155
+ /**
156
+ * Get the list of roots defined by the CAR referenced by this iterator. May be
157
+ * zero or more `CID`s.
158
+ *
159
+ * @function getRoots
160
+ * @memberof CarCIDIterator
161
+ * @instance
162
+ * @async
163
+ * @returns {Promise<CID[]>}
164
+ */
165
+ /**
166
+ * @returns {AsyncIterator<CID>}
167
+ */
168
+ [Symbol.asyncIterator](): AsyncIterator<CID>;
169
+ }
170
+ export type CID = import('multiformats').CID;
171
+ export type Block = import('./api').Block;
172
+ export type RootsReader = import('./api').RootsReader;
173
+ export type BytesReader = import('./coding').BytesReader;
174
+ //# sourceMappingURL=iterator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iterator.d.ts","sourceRoot":"","sources":["../../src/iterator.js"],"names":[],"mappings":"AAMA;;;;;GAKG;AAEH;;;;GAIG;AACH;IACE;;;;OAIG;IACH,qBAJW,MAAM,SACN,GAAG,EAAE,YACL,cAAc,KAAK,CAAC,GAAC,IAAI,EAOnC;IAJC,iBAAuB;IACvB,0FAAmB;IACnB,uDAAyB;IACzB,kBAAqB;IAGvB,sBAEC;IAED;;OAEG;IACH,YAFa,QAAQ,GAAG,EAAE,CAAC,CAI1B;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,4FAJ8B,KAAK;IAgCjC;;;;;;;;;;;OAWG;IACH,wBAHW,UAAU,GACR,QAAQ,gBAAgB,CAAC,CAKrC;IAED;;;;;;;;;;;OAWG;IACH,mCAHW,cAAc,UAAU,CAAC,GACvB,QAAQ,gBAAgB,CAAC,CAKrC;IA1DD;;;;;;;;;OASG;IAEH;;OAEG;IACH,0BAFa,cAAc,KAAK,CAAC,CAYhC;CAmCF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,0FAJ8B,GAAG;IAyC/B;;;;;;;;;;;OAWG;IACH,wBAHW,UAAU,GACR,QAAQ,cAAc,CAAC,CAKnC;IAED;;;;;;;;;;;;OAYG;IACH,mCAHW,cAAc,UAAU,CAAC,GACvB,QAAQ,cAAc,CAAC,CAKnC;IApED;;;;;;;;;OASG;IAEH;;OAEG;IACH,0BAFa,cAAc,GAAG,CAAC,CAqB9B;CAoCF;kBAlOY,OAAO,cAAc,EAAE,GAAG;oBAC1B,OAAO,OAAO,EAAE,KAAK;0BACrB,OAAO,OAAO,EAAE,WAAW;0BAC3B,OAAO,UAAU,EAAE,WAAW"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @description This function is needed not to initialize the `fs.read` on load time. To run in cf workers without polyfill.
3
+ * @param {number} fd
4
+ * @param {Uint8Array} buffer
5
+ * @param {number} offset
6
+ * @param {number} length
7
+ * @param {number} position
8
+ * @returns {Promise<{ bytesRead: number, buffer: Uint8Array }>}
9
+ */
10
+ export function fsread(fd: number, buffer: Uint8Array, offset: number, length: number, position: number): Promise<{
11
+ bytesRead: number;
12
+ buffer: Uint8Array;
13
+ }>;
14
+ /**
15
+ * @description This function is needed not to initialize the `fs.write` on load time. To run in cf workers without polyfill.
16
+ * @param {number} fd
17
+ * @param {Uint8Array} buffer
18
+ * @param {number} offset
19
+ * @param {number} length
20
+ * @param {number} position
21
+ * @returns {Promise<{ bytesRead: number, buffer: Uint8Array }>}
22
+ */
23
+ export function fswrite(fd: number, buffer: Uint8Array, offset: number, length: number, position: number): Promise<{
24
+ bytesRead: number;
25
+ buffer: Uint8Array;
26
+ }>;
27
+ export const hasFS: boolean;
28
+ //# sourceMappingURL=promise-fs-opts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promise-fs-opts.d.ts","sourceRoot":"","sources":["../../src/promise-fs-opts.js"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,2BAPW,MAAM,UACN,UAAU,UACV,MAAM,UACN,MAAM,YACN,MAAM,GACJ,QAAQ;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC,CAO9D;AAMD;;;;;;;;GAQG;AACH,4BAPW,MAAM,UACN,UAAU,UACV,MAAM,UACN,MAAM,YACN,MAAM,GACJ,QAAQ;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC,CAO9D;AA1CD,4BAAyB"}