@fireproof/vendor 1.0.3 → 1.1.0-dev

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 (299) hide show
  1. package/package.json +4 -97
  2. package/src/@web3-storage/pail/dist/src/batch/index.d.ts +1 -53
  3. package/src/@web3-storage/pail/dist/src/batch/index.d.ts.map +1 -1
  4. package/src/@web3-storage/pail/dist/src/batch/shard.d.ts +1 -1
  5. package/src/@web3-storage/pail/dist/src/batch/shard.d.ts.map +1 -1
  6. package/src/@web3-storage/pail/dist/src/block.d.ts +2 -2
  7. package/src/@web3-storage/pail/dist/src/block.d.ts.map +1 -1
  8. package/src/@web3-storage/pail/dist/src/clock/index.d.ts +2 -2
  9. package/src/@web3-storage/pail/dist/src/clock/index.d.ts.map +1 -1
  10. package/src/@web3-storage/pail/dist/src/crdt/batch/index.d.ts.map +1 -1
  11. package/src/@web3-storage/pail/dist/src/crdt/index.d.ts +2 -2
  12. package/src/@web3-storage/pail/dist/src/crdt/index.d.ts.map +1 -1
  13. package/src/@web3-storage/pail/dist/src/diff.d.ts +3 -3
  14. package/src/@web3-storage/pail/dist/src/diff.d.ts.map +1 -1
  15. package/src/@web3-storage/pail/dist/src/index.d.ts +1 -1
  16. package/src/@web3-storage/pail/dist/src/index.d.ts.map +1 -1
  17. package/src/@web3-storage/pail/dist/src/merge.d.ts.map +1 -1
  18. package/src/@web3-storage/pail/dist/src/shard.d.ts +4 -4
  19. package/src/@web3-storage/pail/dist/src/shard.d.ts.map +1 -1
  20. package/src/@web3-storage/pail/dist/tsconfig.tsbuildinfo +1 -1
  21. package/src/@web3-storage/pail/src/api.ts +1 -1
  22. package/src/@web3-storage/pail/src/clock/index.js +1 -1
  23. package/src/@web3-storage/pail/src/shard.js +1 -1
  24. package/src/@ipld/car/LICENSE +0 -4
  25. package/src/@ipld/car/README.md +0 -1132
  26. package/src/@ipld/car/dist/index.min.js +0 -5
  27. package/src/@ipld/car/dist/src/api.d.ts +0 -72
  28. package/src/@ipld/car/dist/src/api.d.ts.map +0 -1
  29. package/src/@ipld/car/dist/src/buffer-decoder.d.ts +0 -67
  30. package/src/@ipld/car/dist/src/buffer-decoder.d.ts.map +0 -1
  31. package/src/@ipld/car/dist/src/buffer-reader-browser.d.ts +0 -116
  32. package/src/@ipld/car/dist/src/buffer-reader-browser.d.ts.map +0 -1
  33. package/src/@ipld/car/dist/src/buffer-reader.d.ts +0 -31
  34. package/src/@ipld/car/dist/src/buffer-reader.d.ts.map +0 -1
  35. package/src/@ipld/car/dist/src/buffer-writer.d.ts +0 -86
  36. package/src/@ipld/car/dist/src/buffer-writer.d.ts.map +0 -1
  37. package/src/@ipld/car/dist/src/coding.d.ts +0 -49
  38. package/src/@ipld/car/dist/src/coding.d.ts.map +0 -1
  39. package/src/@ipld/car/dist/src/decoder-common.d.ts +0 -43
  40. package/src/@ipld/car/dist/src/decoder-common.d.ts.map +0 -1
  41. package/src/@ipld/car/dist/src/decoder.d.ts +0 -87
  42. package/src/@ipld/car/dist/src/decoder.d.ts.map +0 -1
  43. package/src/@ipld/car/dist/src/encoder.d.ts +0 -17
  44. package/src/@ipld/car/dist/src/encoder.d.ts.map +0 -1
  45. package/src/@ipld/car/dist/src/header-validator.d.ts +0 -5
  46. package/src/@ipld/car/dist/src/header-validator.d.ts.map +0 -1
  47. package/src/@ipld/car/dist/src/index-browser.d.ts +0 -10
  48. package/src/@ipld/car/dist/src/index-browser.d.ts.map +0 -1
  49. package/src/@ipld/car/dist/src/index.d.ts +0 -11
  50. package/src/@ipld/car/dist/src/index.d.ts.map +0 -1
  51. package/src/@ipld/car/dist/src/indexed-reader-browser.d.ts +0 -5
  52. package/src/@ipld/car/dist/src/indexed-reader-browser.d.ts.map +0 -1
  53. package/src/@ipld/car/dist/src/indexed-reader.d.ts +0 -152
  54. package/src/@ipld/car/dist/src/indexed-reader.d.ts.map +0 -1
  55. package/src/@ipld/car/dist/src/indexer.d.ts +0 -95
  56. package/src/@ipld/car/dist/src/indexer.d.ts.map +0 -1
  57. package/src/@ipld/car/dist/src/iterator-channel.d.ts +0 -7
  58. package/src/@ipld/car/dist/src/iterator-channel.d.ts.map +0 -1
  59. package/src/@ipld/car/dist/src/iterator.d.ts +0 -174
  60. package/src/@ipld/car/dist/src/iterator.d.ts.map +0 -1
  61. package/src/@ipld/car/dist/src/reader-browser.d.ts +0 -151
  62. package/src/@ipld/car/dist/src/reader-browser.d.ts.map +0 -1
  63. package/src/@ipld/car/dist/src/reader.d.ts +0 -35
  64. package/src/@ipld/car/dist/src/reader.d.ts.map +0 -1
  65. package/src/@ipld/car/dist/src/writer-browser.d.ts +0 -155
  66. package/src/@ipld/car/dist/src/writer-browser.d.ts.map +0 -1
  67. package/src/@ipld/car/dist/src/writer.d.ts +0 -45
  68. package/src/@ipld/car/dist/src/writer.d.ts.map +0 -1
  69. package/src/@ipld/car/src/api.ts +0 -90
  70. package/src/@ipld/car/src/buffer-decoder.js +0 -213
  71. package/src/@ipld/car/src/buffer-reader-browser.js +0 -144
  72. package/src/@ipld/car/src/buffer-reader.js +0 -51
  73. package/src/@ipld/car/src/buffer-writer.js +0 -286
  74. package/src/@ipld/car/src/coding.ts +0 -68
  75. package/src/@ipld/car/src/decoder-common.js +0 -82
  76. package/src/@ipld/car/src/decoder.js +0 -347
  77. package/src/@ipld/car/src/encoder.js +0 -76
  78. package/src/@ipld/car/src/header-validator.js +0 -214
  79. package/src/@ipld/car/src/header.ipldsch +0 -18
  80. package/src/@ipld/car/src/index-browser.js +0 -18
  81. package/src/@ipld/car/src/index.js +0 -21
  82. package/src/@ipld/car/src/indexed-reader-browser.js +0 -7
  83. package/src/@ipld/car/src/indexed-reader.js +0 -211
  84. package/src/@ipld/car/src/indexer.js +0 -130
  85. package/src/@ipld/car/src/iterator-channel.js +0 -91
  86. package/src/@ipld/car/src/iterator.js +0 -267
  87. package/src/@ipld/car/src/reader-browser.js +0 -194
  88. package/src/@ipld/car/src/reader.js +0 -73
  89. package/src/@ipld/car/src/writer-browser.js +0 -250
  90. package/src/@ipld/car/src/writer.js +0 -84
  91. package/src/@ipld/dag-cbor/LICENSE +0 -4
  92. package/src/@ipld/dag-cbor/README.md +0 -80
  93. package/src/@ipld/dag-cbor/dist/index.min.js +0 -3
  94. package/src/@ipld/dag-cbor/dist/src/index.d.ts +0 -67
  95. package/src/@ipld/dag-cbor/dist/src/index.d.ts.map +0 -1
  96. package/src/@ipld/dag-cbor/src/index.js +0 -147
  97. package/src/@ipld/dag-json/LICENSE +0 -4
  98. package/src/@ipld/dag-json/README.md +0 -58
  99. package/src/@ipld/dag-json/dist/index.min.js +0 -3
  100. package/src/@ipld/dag-json/dist/src/index.d.ts +0 -12
  101. package/src/@ipld/dag-json/dist/src/index.d.ts.map +0 -1
  102. package/src/@ipld/dag-json/src/index.js +0 -291
  103. package/src/cborg/.github/dependabot.yml +0 -16
  104. package/src/cborg/.github/workflows/test-and-release.yml +0 -52
  105. package/src/cborg/CHANGELOG.md +0 -513
  106. package/src/cborg/LICENSE +0 -13
  107. package/src/cborg/README.md +0 -515
  108. package/src/cborg/bench/bench.js +0 -117
  109. package/src/cborg/bench/json.js +0 -124
  110. package/src/cborg/bench/package.json +0 -8
  111. package/src/cborg/cborg/bin.js +0 -189
  112. package/src/cborg/cborg/common.js +0 -28
  113. package/src/cborg/cborg/decode.js +0 -211
  114. package/src/cborg/cborg/diagnostic.js +0 -158
  115. package/src/cborg/cborg/diagnostic_test.js +0 -117
  116. package/src/cborg/cborg/encode.js +0 -466
  117. package/src/cborg/cborg/index.js +0 -33
  118. package/src/cborg/cborg/is.js +0 -106
  119. package/src/cborg/cborg/length.js +0 -62
  120. package/src/cborg/example-bytestrings.js +0 -180
  121. package/src/cborg/example-json.js +0 -6
  122. package/src/cborg/example.js +0 -5
  123. package/src/cborg/interface.ts +0 -59
  124. package/src/cborg/json/decode.js +0 -462
  125. package/src/cborg/json/encode.js +0 -302
  126. package/src/cborg/json/json.js +0 -4
  127. package/src/cborg/taglib.js +0 -75
  128. package/src/cborg/test/appendix_a.js +0 -647
  129. package/src/cborg/test/common.js +0 -18
  130. package/src/cborg/test/node-test-bin.js +0 -402
  131. package/src/cborg/test/noop-bin-test.js +0 -3
  132. package/src/cborg/test/test-0uint.js +0 -103
  133. package/src/cborg/test/test-1negint.js +0 -96
  134. package/src/cborg/test/test-2bytes.js +0 -198
  135. package/src/cborg/test/test-3string.js +0 -136
  136. package/src/cborg/test/test-4array.js +0 -93
  137. package/src/cborg/test/test-5map.js +0 -284
  138. package/src/cborg/test/test-6tag.js +0 -84
  139. package/src/cborg/test/test-7float.js +0 -131
  140. package/src/cborg/test/test-bl.js +0 -37
  141. package/src/cborg/test/test-cbor-vectors.js +0 -107
  142. package/src/cborg/test/test-decode-errors.js +0 -65
  143. package/src/cborg/test/test-fuzz.js +0 -42
  144. package/src/cborg/test/test-json.js +0 -219
  145. package/src/cborg/test/test-length.js +0 -65
  146. package/src/cborg/test/test-partial.js +0 -111
  147. package/src/cborg/tsconfig.json +0 -48
  148. package/src/cborg/types/cborg/decode.d.ts +0 -43
  149. package/src/cborg/types/cborg/decode.d.ts.map +0 -1
  150. package/src/cborg/types/cborg/encode.d.ts +0 -51
  151. package/src/cborg/types/cborg/encode.d.ts.map +0 -1
  152. package/src/cborg/types/cborg/index.d.ts +0 -26
  153. package/src/cborg/types/cborg/index.d.ts.map +0 -1
  154. package/src/cborg/types/cborg/is.d.ts +0 -6
  155. package/src/cborg/types/cborg/is.d.ts.map +0 -1
  156. package/src/cborg/types/example.d.ts +0 -2
  157. package/src/cborg/types/example.d.ts.map +0 -1
  158. package/src/cborg/types/interface.d.ts +0 -49
  159. package/src/cborg/types/interface.d.ts.map +0 -1
  160. package/src/cborg/types/json/decode.d.ts +0 -67
  161. package/src/cborg/types/json/decode.d.ts.map +0 -1
  162. package/src/cborg/types/json/encode.d.ts +0 -11
  163. package/src/cborg/types/json/encode.d.ts.map +0 -1
  164. package/src/cborg/types/json/json.d.ts +0 -6
  165. package/src/cborg/types/json/json.d.ts.map +0 -1
  166. package/src/cborg/types/taglib.d.ts +0 -18
  167. package/src/cborg/types/taglib.d.ts.map +0 -1
  168. package/src/cborg/types/tsconfig.tsbuildinfo +0 -1
  169. package/src/cborg/types/utils/0uint.d.ts +0 -102
  170. package/src/cborg/types/utils/0uint.d.ts.map +0 -1
  171. package/src/cborg/types/utils/1negint.d.ts +0 -59
  172. package/src/cborg/types/utils/1negint.d.ts.map +0 -1
  173. package/src/cborg/types/utils/2bytes.d.ts +0 -69
  174. package/src/cborg/types/utils/2bytes.d.ts.map +0 -1
  175. package/src/cborg/types/utils/3string.d.ts +0 -46
  176. package/src/cborg/types/utils/3string.d.ts.map +0 -1
  177. package/src/cborg/types/utils/4array.d.ts +0 -66
  178. package/src/cborg/types/utils/4array.d.ts.map +0 -1
  179. package/src/cborg/types/utils/5map.d.ts +0 -66
  180. package/src/cborg/types/utils/5map.d.ts.map +0 -1
  181. package/src/cborg/types/utils/6tag.d.ts +0 -62
  182. package/src/cborg/types/utils/6tag.d.ts.map +0 -1
  183. package/src/cborg/types/utils/7float.d.ts +0 -60
  184. package/src/cborg/types/utils/7float.d.ts.map +0 -1
  185. package/src/cborg/types/utils/bl.d.ts +0 -26
  186. package/src/cborg/types/utils/bl.d.ts.map +0 -1
  187. package/src/cborg/types/utils/byte-utils.d.ts +0 -53
  188. package/src/cborg/types/utils/byte-utils.d.ts.map +0 -1
  189. package/src/cborg/types/utils/common.d.ts +0 -8
  190. package/src/cborg/types/utils/common.d.ts.map +0 -1
  191. package/src/cborg/types/utils/index.d.ts +0 -13
  192. package/src/cborg/types/utils/index.d.ts.map +0 -1
  193. package/src/cborg/types/utils/jump.d.ts +0 -16
  194. package/src/cborg/types/utils/jump.d.ts.map +0 -1
  195. package/src/cborg/types/utils/token.d.ts +0 -59
  196. package/src/cborg/types/utils/token.d.ts.map +0 -1
  197. package/src/cborg/utils/0uint.js +0 -229
  198. package/src/cborg/utils/1negint.js +0 -111
  199. package/src/cborg/utils/2bytes.js +0 -135
  200. package/src/cborg/utils/3string.js +0 -90
  201. package/src/cborg/utils/4array.js +0 -114
  202. package/src/cborg/utils/5map.js +0 -113
  203. package/src/cborg/utils/6tag.js +0 -81
  204. package/src/cborg/utils/7float.js +0 -310
  205. package/src/cborg/utils/bl.js +0 -124
  206. package/src/cborg/utils/byte-utils.js +0 -417
  207. package/src/cborg/utils/common.js +0 -11
  208. package/src/cborg/utils/index.js +0 -12
  209. package/src/cborg/utils/jump.js +0 -222
  210. package/src/cborg/utils/token.js +0 -76
  211. package/src/ipfs-unixfs-exporter/LICENSE +0 -4
  212. package/src/ipfs-unixfs-exporter/README.md +0 -105
  213. package/src/ipfs-unixfs-exporter/dist/index.min.js +0 -3
  214. package/src/ipfs-unixfs-exporter/dist/src/errors.d.ts +0 -57
  215. package/src/ipfs-unixfs-exporter/dist/src/errors.d.ts.map +0 -1
  216. package/src/ipfs-unixfs-exporter/dist/src/errors.js +0 -73
  217. package/src/ipfs-unixfs-exporter/dist/src/errors.js.map +0 -1
  218. package/src/ipfs-unixfs-exporter/dist/src/index.d.ts +0 -355
  219. package/src/ipfs-unixfs-exporter/dist/src/index.d.ts.map +0 -1
  220. package/src/ipfs-unixfs-exporter/dist/src/index.js +0 -197
  221. package/src/ipfs-unixfs-exporter/dist/src/index.js.map +0 -1
  222. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.d.ts +0 -4
  223. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.d.ts.map +0 -1
  224. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.js +0 -9
  225. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.js.map +0 -1
  226. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.d.ts +0 -4
  227. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.d.ts.map +0 -1
  228. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.js +0 -9
  229. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.js.map +0 -1
  230. package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.d.ts +0 -4
  231. package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.d.ts.map +0 -1
  232. package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.js +0 -38
  233. package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.js.map +0 -1
  234. package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.d.ts +0 -4
  235. package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.d.ts.map +0 -1
  236. package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.js +0 -30
  237. package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.js.map +0 -1
  238. package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.d.ts +0 -4
  239. package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.d.ts.map +0 -1
  240. package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.js +0 -9
  241. package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.js.map +0 -1
  242. package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.d.ts +0 -4
  243. package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.d.ts.map +0 -1
  244. package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.js +0 -37
  245. package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.js.map +0 -1
  246. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.d.ts +0 -4
  247. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.d.ts.map +0 -1
  248. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.js +0 -29
  249. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.js.map +0 -1
  250. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.d.ts +0 -4
  251. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.d.ts.map +0 -1
  252. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.js +0 -153
  253. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.js.map +0 -1
  254. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.d.ts +0 -4
  255. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.d.ts.map +0 -1
  256. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.js +0 -59
  257. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.js.map +0 -1
  258. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.d.ts +0 -4
  259. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.d.ts.map +0 -1
  260. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.js +0 -25
  261. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.js.map +0 -1
  262. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.d.ts +0 -4
  263. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.d.ts.map +0 -1
  264. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.js +0 -104
  265. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.js.map +0 -1
  266. package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.d.ts +0 -3
  267. package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.d.ts.map +0 -1
  268. package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.js +0 -20
  269. package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.js.map +0 -1
  270. package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.d.ts +0 -6
  271. package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.d.ts.map +0 -1
  272. package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.js +0 -116
  273. package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.js.map +0 -1
  274. package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.d.ts +0 -4
  275. package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.d.ts.map +0 -1
  276. package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.js +0 -57
  277. package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.js.map +0 -1
  278. package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.d.ts +0 -6
  279. package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.d.ts.map +0 -1
  280. package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.js +0 -30
  281. package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.js.map +0 -1
  282. package/src/ipfs-unixfs-exporter/dist/typedoc-urls.json +0 -58
  283. package/src/ipfs-unixfs-exporter/src/errors.ts +0 -87
  284. package/src/ipfs-unixfs-exporter/src/index.ts +0 -498
  285. package/src/ipfs-unixfs-exporter/src/resolvers/dag-cbor.ts +0 -12
  286. package/src/ipfs-unixfs-exporter/src/resolvers/dag-json.ts +0 -12
  287. package/src/ipfs-unixfs-exporter/src/resolvers/identity.ts +0 -49
  288. package/src/ipfs-unixfs-exporter/src/resolvers/index.ts +0 -35
  289. package/src/ipfs-unixfs-exporter/src/resolvers/json.ts +0 -12
  290. package/src/ipfs-unixfs-exporter/src/resolvers/raw.ts +0 -49
  291. package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/directory.ts +0 -39
  292. package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/file.ts +0 -198
  293. package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/hamt-sharded-directory.ts +0 -76
  294. package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/raw.ts +0 -37
  295. package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/index.ts +0 -121
  296. package/src/ipfs-unixfs-exporter/src/utils/extract-data-from-block.ts +0 -24
  297. package/src/ipfs-unixfs-exporter/src/utils/find-cid-in-shard.ts +0 -149
  298. package/src/ipfs-unixfs-exporter/src/utils/resolve-object-path.ts +0 -62
  299. package/src/ipfs-unixfs-exporter/src/utils/validate-offset-and-length.ts +0 -38
@@ -1,91 +0,0 @@
1
- /**
2
- * @template {any} T
3
- * @typedef {import('./coding').IteratorChannel<T>} IteratorChannel
4
- */
5
-
6
- function noop () {}
7
-
8
- /**
9
- * @template {any} T
10
- * @returns {IteratorChannel<T>}
11
- */
12
- export function create () {
13
- /** @type {T[]} */
14
- const chunkQueue = []
15
- /** @type {Promise<void> | null} */
16
- let drainer = null
17
- let drainerResolver = noop
18
- let ended = false
19
- /** @type {Promise<IteratorResult<T>> | null} */
20
- let outWait = null
21
- let outWaitResolver = noop
22
-
23
- const makeDrainer = () => {
24
- if (!drainer) {
25
- drainer = new Promise((resolve) => {
26
- drainerResolver = () => {
27
- drainer = null
28
- drainerResolver = noop
29
- resolve()
30
- }
31
- })
32
- }
33
- return drainer
34
- }
35
-
36
- /**
37
- * @returns {IteratorChannel<T>}
38
- */
39
- const writer = {
40
- /**
41
- * @param {T} chunk
42
- * @returns {Promise<void>}
43
- */
44
- write (chunk) {
45
- chunkQueue.push(chunk)
46
- const drainer = makeDrainer()
47
- outWaitResolver()
48
- return drainer
49
- },
50
-
51
- async end () {
52
- ended = true
53
- const drainer = makeDrainer()
54
- outWaitResolver()
55
- await drainer
56
- }
57
- }
58
-
59
- /** @type {AsyncIterator<T>} */
60
- const iterator = {
61
- /** @returns {Promise<IteratorResult<T>>} */
62
- async next () {
63
- const chunk = chunkQueue.shift()
64
- if (chunk) {
65
- if (chunkQueue.length === 0) {
66
- drainerResolver()
67
- }
68
- return { done: false, value: chunk }
69
- }
70
-
71
- if (ended) {
72
- drainerResolver()
73
- return { done: true, value: undefined }
74
- }
75
-
76
- if (!outWait) {
77
- outWait = new Promise((resolve) => {
78
- outWaitResolver = () => {
79
- outWait = null
80
- outWaitResolver = noop
81
- return resolve(iterator.next())
82
- }
83
- })
84
- }
85
-
86
- return outWait
87
- }
88
- }
89
-
90
- return { writer, iterator }
91
- }
@@ -1,267 +0,0 @@
1
- import {
2
- asyncIterableReader,
3
- bytesReader,
4
- createDecoder
5
- } from './decoder.js'
6
-
7
- /**
8
- * @typedef {import('multiformats').CID} CID
9
- * @typedef {import('./api').Block} Block
10
- * @typedef {import('./api').RootsReader} RootsReader
11
- * @typedef {import('./coding').BytesReader} BytesReader
12
- */
13
-
14
- /**
15
- * @class
16
- * @implements {RootsReader}
17
- * @property {number} version The version number of the CAR referenced by this reader (should be `1`).
18
- */
19
- export class CarIteratorBase {
20
- /**
21
- * @param {number} version
22
- * @param {CID[]} roots
23
- * @param {AsyncIterable<Block>|void} iterable
24
- */
25
- constructor (version, roots, iterable) {
26
- this._version = version
27
- this._roots = roots
28
- this._iterable = iterable
29
- this._decoded = false
30
- }
31
-
32
- get version () {
33
- return this._version
34
- }
35
-
36
- /**
37
- * @returns {Promise<CID[]>}
38
- */
39
- async getRoots () {
40
- return this._roots
41
- }
42
- }
43
-
44
- /**
45
- * Provides an iterator over all of the `Block`s in a CAR. Implements a
46
- * `BlockIterator` interface, or `AsyncIterable<Block>`. Where a `Block` is
47
- * a `{ cid:CID, bytes:Uint8Array }` pair.
48
- *
49
- * As an implementer of `AsyncIterable`, this class can be used directly in a
50
- * `for await (const block of iterator) {}` loop. Where the `iterator` is
51
- * constructed using {@link CarBlockiterator.fromBytes} or
52
- * {@link CarBlockiterator.fromIterable}.
53
- *
54
- * An iteration can only be performce _once_ per instantiation.
55
- *
56
- * `CarBlockIterator` also implements the `RootsReader` interface and provides
57
- * the {@link CarBlockiterator.getRoots `getRoots()`} method.
58
- *
59
- * Load this class with either
60
- * `import { CarBlockIterator } from '@ipld/car/iterator'`
61
- * (`const { CarBlockIterator } = require('@ipld/car/iterator')`). Or
62
- * `import { CarBlockIterator } from '@ipld/car'`
63
- * (`const { CarBlockIterator } = require('@ipld/car')`).
64
- *
65
- * @name CarBlockIterator
66
- * @class
67
- * @implements {RootsReader}
68
- * @implements {AsyncIterable<Block>}
69
- * @property {number} version The version number of the CAR referenced by this
70
- * iterator (should be `1`).
71
- */
72
- export class CarBlockIterator extends CarIteratorBase {
73
- // inherited method
74
- /**
75
- * Get the list of roots defined by the CAR referenced by this iterator. May be
76
- * zero or more `CID`s.
77
- *
78
- * @function getRoots
79
- * @memberof CarBlockIterator
80
- * @instance
81
- * @async
82
- * @returns {Promise<CID[]>}
83
- */
84
-
85
- /**
86
- * @returns {AsyncIterator<Block>}
87
- */
88
- [Symbol.asyncIterator] () {
89
- if (this._decoded) {
90
- throw new Error('Cannot decode more than once')
91
- }
92
- /* c8 ignore next 3 */
93
- if (!this._iterable) {
94
- throw new Error('Block iterable not found')
95
- }
96
- this._decoded = true
97
- return this._iterable[Symbol.asyncIterator]()
98
- }
99
-
100
- /**
101
- * Instantiate a {@link CarBlockIterator} from a `Uint8Array` blob. Rather
102
- * than decoding the entire byte array prior to returning the iterator, as in
103
- * {@link CarReader.fromBytes}, only the header is decoded and the remainder
104
- * of the CAR is parsed as the `Block`s as yielded.
105
- *
106
- * @async
107
- * @static
108
- * @memberof CarBlockIterator
109
- * @param {Uint8Array} bytes
110
- * @returns {Promise<CarBlockIterator>}
111
- */
112
- static async fromBytes (bytes) {
113
- const { version, roots, iterator } = await fromBytes(bytes)
114
- return new CarBlockIterator(version, roots, iterator)
115
- }
116
-
117
- /**
118
- * Instantiate a {@link CarBlockIterator} from a `AsyncIterable<Uint8Array>`,
119
- * such as a [modern Node.js stream](https://nodejs.org/api/stream.html#stream_streams_compatibility_with_async_generators_and_async_iterators).
120
- * Rather than decoding the entire byte array prior to returning the iterator,
121
- * as in {@link CarReader.fromIterable}, only the header is decoded and the
122
- * remainder of the CAR is parsed as the `Block`s as yielded.
123
- *
124
- * @async
125
- * @static
126
- * @param {AsyncIterable<Uint8Array>} asyncIterable
127
- * @returns {Promise<CarBlockIterator>}
128
- */
129
- static async fromIterable (asyncIterable) {
130
- const { version, roots, iterator } = await fromIterable(asyncIterable)
131
- return new CarBlockIterator(version, roots, iterator)
132
- }
133
- }
134
-
135
- /**
136
- * Provides an iterator over all of the `CID`s in a CAR. Implements a
137
- * `CIDIterator` interface, or `AsyncIterable<CID>`. Similar to
138
- * {@link CarBlockIterator} but only yields the CIDs in the CAR.
139
- *
140
- * As an implementer of `AsyncIterable`, this class can be used directly in a
141
- * `for await (const cid of iterator) {}` loop. Where the `iterator` is
142
- * constructed using {@link CarCIDiterator.fromBytes} or
143
- * {@link CarCIDiterator.fromIterable}.
144
- *
145
- * An iteration can only be performce _once_ per instantiation.
146
- *
147
- * `CarCIDIterator` also implements the `RootsReader` interface and provides
148
- * the {@link CarCIDiterator.getRoots `getRoots()`} method.
149
- *
150
- * Load this class with either
151
- * `import { CarCIDIterator } from '@ipld/car/iterator'`
152
- * (`const { CarCIDIterator } = require('@ipld/car/iterator')`). Or
153
- * `import { CarCIDIterator } from '@ipld/car'`
154
- * (`const { CarCIDIterator } = require('@ipld/car')`).
155
- *
156
- * @name CarCIDIterator
157
- * @class
158
- * @implements {RootsReader}
159
- * @implements {AsyncIterable<CID>}
160
- * @property {number} version The version number of the CAR referenced by this
161
- * iterator (should be `1`).
162
- */
163
- export class CarCIDIterator extends CarIteratorBase {
164
- // inherited method
165
- /**
166
- * Get the list of roots defined by the CAR referenced by this iterator. May be
167
- * zero or more `CID`s.
168
- *
169
- * @function getRoots
170
- * @memberof CarCIDIterator
171
- * @instance
172
- * @async
173
- * @returns {Promise<CID[]>}
174
- */
175
-
176
- /**
177
- * @returns {AsyncIterator<CID>}
178
- */
179
- [Symbol.asyncIterator] () {
180
- if (this._decoded) {
181
- throw new Error('Cannot decode more than once')
182
- }
183
- /* c8 ignore next 3 */
184
- if (!this._iterable) {
185
- throw new Error('Block iterable not found')
186
- }
187
- this._decoded = true
188
- const iterable = this._iterable[Symbol.asyncIterator]()
189
- return {
190
- async next () {
191
- const next = await iterable.next()
192
- if (next.done) {
193
- return next
194
- }
195
- return { done: false, value: next.value.cid }
196
- }
197
- }
198
- }
199
-
200
- /**
201
- * Instantiate a {@link CarCIDIterator} from a `Uint8Array` blob. Rather
202
- * than decoding the entire byte array prior to returning the iterator, as in
203
- * {@link CarReader.fromBytes}, only the header is decoded and the remainder
204
- * of the CAR is parsed as the `CID`s as yielded.
205
- *
206
- * @async
207
- * @static
208
- * @memberof CarCIDIterator
209
- * @param {Uint8Array} bytes
210
- * @returns {Promise<CarCIDIterator>}
211
- */
212
- static async fromBytes (bytes) {
213
- const { version, roots, iterator } = await fromBytes(bytes)
214
- return new CarCIDIterator(version, roots, iterator)
215
- }
216
-
217
- /**
218
- * Instantiate a {@link CarCIDIterator} from a `AsyncIterable<Uint8Array>`,
219
- * such as a [modern Node.js stream](https://nodejs.org/api/stream.html#stream_streams_compatibility_with_async_generators_and_async_iterators).
220
- * Rather than decoding the entire byte array prior to returning the iterator,
221
- * as in {@link CarReader.fromIterable}, only the header is decoded and the
222
- * remainder of the CAR is parsed as the `CID`s as yielded.
223
- *
224
- * @async
225
- * @static
226
- * @memberof CarCIDIterator
227
- * @param {AsyncIterable<Uint8Array>} asyncIterable
228
- * @returns {Promise<CarCIDIterator>}
229
- */
230
- static async fromIterable (asyncIterable) {
231
- const { version, roots, iterator } = await fromIterable(asyncIterable)
232
- return new CarCIDIterator(version, roots, iterator)
233
- }
234
- }
235
-
236
- /**
237
- * @param {Uint8Array} bytes
238
- * @returns {Promise<{ version:number, roots:CID[], iterator:AsyncIterable<Block>}>}
239
- */
240
- async function fromBytes (bytes) {
241
- if (!(bytes instanceof Uint8Array)) {
242
- throw new TypeError('fromBytes() requires a Uint8Array')
243
- }
244
- return decodeIterator(bytesReader(bytes))
245
- }
246
-
247
- /**
248
- * @param {AsyncIterable<Uint8Array>} asyncIterable
249
- * @returns {Promise<{ version:number, roots:CID[], iterator:AsyncIterable<Block>}>}
250
- */
251
- async function fromIterable (asyncIterable) {
252
- if (!asyncIterable || !(typeof asyncIterable[Symbol.asyncIterator] === 'function')) {
253
- throw new TypeError('fromIterable() requires an async iterable')
254
- }
255
- return decodeIterator(asyncIterableReader(asyncIterable))
256
- }
257
-
258
- /**
259
- * @private
260
- * @param {BytesReader} reader
261
- * @returns {Promise<{ version:number, roots:CID[], iterator:AsyncIterable<Block>}>}
262
- */
263
- async function decodeIterator (reader) {
264
- const decoder = createDecoder(reader)
265
- const { version, roots } = await decoder.header()
266
- return { version, roots, iterator: decoder.blocks() }
267
- }
@@ -1,194 +0,0 @@
1
- import { asyncIterableReader, bytesReader, createDecoder } from './decoder.js'
2
-
3
- /**
4
- * @typedef {import('multiformats').CID} CID
5
- * @typedef {import('./api').Block} Block
6
- * @typedef {import('./api').CarReader} CarReaderIface
7
- * @typedef {import('./coding').BytesReader} BytesReader
8
- * @typedef {import('./coding').CarHeader} CarHeader
9
- * @typedef {import('./coding').CarV2Header} CarV2Header
10
- */
11
-
12
- /**
13
- * Provides blockstore-like access to a CAR.
14
- *
15
- * Implements the `RootsReader` interface:
16
- * {@link CarReader.getRoots `getRoots()`}. And the `BlockReader` interface:
17
- * {@link CarReader.get `get()`}, {@link CarReader.has `has()`},
18
- * {@link CarReader.blocks `blocks()`} (defined as a `BlockIterator`) and
19
- * {@link CarReader.cids `cids()`} (defined as a `CIDIterator`).
20
- *
21
- * Load this class with either `import { CarReader } from '@ipld/car/reader'`
22
- * (`const { CarReader } = require('@ipld/car/reader')`). Or
23
- * `import { CarReader } from '@ipld/car'` (`const { CarReader } = require('@ipld/car')`).
24
- * The former will likely result in smaller bundle sizes where this is
25
- * important.
26
- *
27
- * @name CarReader
28
- * @class
29
- * @implements {CarReaderIface}
30
- * @property {number} version The version number of the CAR referenced by this
31
- * reader (should be `1` or `2`).
32
- */
33
- export class CarReader {
34
- /**
35
- * @constructs CarReader
36
- * @param {CarHeader|CarV2Header} header
37
- * @param {Block[]} blocks
38
- */
39
- constructor (header, blocks) {
40
- this._header = header
41
- this._blocks = blocks
42
- this._keys = blocks.map((b) => b.cid.toString())
43
- }
44
-
45
- /**
46
- * @property
47
- * @memberof CarReader
48
- * @instance
49
- */
50
- get version () {
51
- return this._header.version
52
- }
53
-
54
- /**
55
- * Get the list of roots defined by the CAR referenced by this reader. May be
56
- * zero or more `CID`s.
57
- *
58
- * @function
59
- * @memberof CarReader
60
- * @instance
61
- * @async
62
- * @returns {Promise<CID[]>}
63
- */
64
- async getRoots () {
65
- return this._header.roots
66
- }
67
-
68
- /**
69
- * Check whether a given `CID` exists within the CAR referenced by this
70
- * reader.
71
- *
72
- * @function
73
- * @memberof CarReader
74
- * @instance
75
- * @async
76
- * @param {CID} key
77
- * @returns {Promise<boolean>}
78
- */
79
- async has (key) {
80
- return this._keys.indexOf(key.toString()) > -1
81
- }
82
-
83
- /**
84
- * Fetch a `Block` (a `{ cid:CID, bytes:Uint8Array }` pair) from the CAR
85
- * referenced by this reader matching the provided `CID`. In the case where
86
- * the provided `CID` doesn't exist within the CAR, `undefined` will be
87
- * returned.
88
- *
89
- * @function
90
- * @memberof CarReader
91
- * @instance
92
- * @async
93
- * @param {CID} key
94
- * @returns {Promise<Block | undefined>}
95
- */
96
- async get (key) {
97
- const index = this._keys.indexOf(key.toString())
98
- return index > -1 ? this._blocks[index] : undefined
99
- }
100
-
101
- /**
102
- * Returns a `BlockIterator` (`AsyncIterable<Block>`) that iterates over all
103
- * of the `Block`s (`{ cid:CID, bytes:Uint8Array }` pairs) contained within
104
- * the CAR referenced by this reader.
105
- *
106
- * @function
107
- * @memberof CarReader
108
- * @instance
109
- * @async
110
- * @generator
111
- * @returns {AsyncGenerator<Block>}
112
- */
113
- async * blocks () {
114
- for (const block of this._blocks) {
115
- yield block
116
- }
117
- }
118
-
119
- /**
120
- * Returns a `CIDIterator` (`AsyncIterable<CID>`) that iterates over all of
121
- * the `CID`s contained within the CAR referenced by this reader.
122
- *
123
- * @function
124
- * @memberof CarReader
125
- * @instance
126
- * @async
127
- * @generator
128
- * @returns {AsyncGenerator<CID>}
129
- */
130
- async * cids () {
131
- for (const block of this._blocks) {
132
- yield block.cid
133
- }
134
- }
135
-
136
- /**
137
- * Instantiate a {@link CarReader} from a `Uint8Array` blob. This performs a
138
- * decode fully in memory and maintains the decoded state in memory for full
139
- * access to the data via the `CarReader` API.
140
- *
141
- * @async
142
- * @static
143
- * @memberof CarReader
144
- * @param {Uint8Array} bytes
145
- * @returns {Promise<CarReader>}
146
- */
147
- static async fromBytes (bytes) {
148
- if (!(bytes instanceof Uint8Array)) {
149
- throw new TypeError('fromBytes() requires a Uint8Array')
150
- }
151
- return decodeReaderComplete(bytesReader(bytes))
152
- }
153
-
154
- /**
155
- * Instantiate a {@link CarReader} from a `AsyncIterable<Uint8Array>`, such as
156
- * a [modern Node.js stream](https://nodejs.org/api/stream.html#stream_streams_compatibility_with_async_generators_and_async_iterators).
157
- * This performs a decode fully in memory and maintains the decoded state in
158
- * memory for full access to the data via the `CarReader` API.
159
- *
160
- * Care should be taken for large archives; this API may not be appropriate
161
- * where memory is a concern or the archive is potentially larger than the
162
- * amount of memory that the runtime can handle.
163
- *
164
- * @async
165
- * @static
166
- * @memberof CarReader
167
- * @param {AsyncIterable<Uint8Array>} asyncIterable
168
- * @returns {Promise<CarReader>}
169
- */
170
- static async fromIterable (asyncIterable) {
171
- if (!asyncIterable || !(typeof asyncIterable[Symbol.asyncIterator] === 'function')) {
172
- throw new TypeError('fromIterable() requires an async iterable')
173
- }
174
- return decodeReaderComplete(asyncIterableReader(asyncIterable))
175
- }
176
- }
177
-
178
- /**
179
- * @private
180
- * @param {BytesReader} reader
181
- * @returns {Promise<CarReader>}
182
- */
183
- export async function decodeReaderComplete (reader) {
184
- const decoder = createDecoder(reader)
185
- const header = await decoder.header()
186
- const blocks = []
187
- for await (const block of decoder.blocks()) {
188
- blocks.push(block)
189
- }
190
-
191
- return new CarReader(header, blocks)
192
- }
193
-
194
- export const __browser = true
@@ -1,73 +0,0 @@
1
- import fs from 'fs'
2
- import { promisify } from 'util'
3
- import { CarReader as BrowserCarReader } from './reader-browser.js'
4
-
5
- /**
6
- * @typedef {import('./api').Block} Block
7
- * @typedef {import('./api').BlockIndex} BlockIndex
8
- * @typedef {import('./api').CarReader} CarReaderIface
9
- */
10
-
11
- /**
12
- * @description not happy with typing here, but it's needed for the `promisify(fs.read)` function.
13
- * @type {any}
14
- */
15
- let _fsReadFn
16
- /**
17
- * @description This function is needed not to initialize the `fs.read` on load time. To run in cf workers without polyfill.
18
- * @param {number} fd
19
- * @param {Uint8Array} buffer
20
- * @param {number} offset
21
- * @param {number} length
22
- * @param {number} position
23
- * @returns {Promise<{ bytesRead: number, buffer: Uint8Array }>}
24
- */
25
- function fsread (fd, buffer, offset, length, position) {
26
- _fsReadFn = _fsReadFn || promisify(fs.read)
27
- return _fsReadFn(fd, buffer, offset, length, position)
28
- }
29
-
30
- /**
31
- * @class
32
- * @implements {CarReaderIface}
33
- */
34
- export class CarReader extends BrowserCarReader {
35
- /**
36
- * Reads a block directly from a file descriptor for an open CAR file. This
37
- * function is **only available in Node.js** and not a browser environment.
38
- *
39
- * This function can be used in connection with {@link CarIndexer} which emits
40
- * the `BlockIndex` objects that are required by this function.
41
- *
42
- * The user is responsible for opening and closing the file used in this call.
43
- *
44
- * @async
45
- * @static
46
- * @memberof CarReader
47
- * @param {fs.promises.FileHandle | number} fd - A file descriptor from the
48
- * Node.js `fs` module. Either an integer, from `fs.open()` or a `FileHandle`
49
- * from `fs.promises.open()`.
50
- * @param {BlockIndex} blockIndex - An index pointing to the location of the
51
- * Block required. This `BlockIndex` should take the form:
52
- * `{cid:CID, blockLength:number, blockOffset:number}`.
53
- * @returns {Promise<Block>} A `{ cid:CID, bytes:Uint8Array }` pair.
54
- */
55
- static async readRaw (fd, blockIndex) {
56
- const { cid, blockLength, blockOffset } = blockIndex
57
- const bytes = new Uint8Array(blockLength)
58
- let read
59
- if (typeof fd === 'number') {
60
- read = (await fsread(fd, bytes, 0, blockLength, blockOffset)).bytesRead
61
- } else if (typeof fd === 'object' && typeof fd.read === 'function') { // FileDescriptor
62
- read = (await fd.read(bytes, 0, blockLength, blockOffset)).bytesRead
63
- } else {
64
- throw new TypeError('Bad fd')
65
- }
66
- if (read !== blockLength) {
67
- throw new Error(`Failed to read entire block (${read} instead of ${blockLength})`)
68
- }
69
- return { cid, bytes }
70
- }
71
- }
72
-
73
- export const __browser = !fs