@fireproof/vendor 0.0.0-smoke → 0.0.2-dev-test

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 (489) hide show
  1. package/merge-package.ts +207 -0
  2. package/p-limit/index.d.ts +81 -0
  3. package/p-limit/index.js +104 -0
  4. package/p-limit/index.test-d.ts +19 -0
  5. package/p-limit/license +9 -0
  6. package/p-limit/package.json +59 -0
  7. package/p-limit/readme.md +128 -0
  8. package/p-limit/test.js +241 -0
  9. package/package.json +12 -9
  10. package/to-esm-transform.ts +42 -0
  11. package/patched/@ipld/dag-json/.github/dependabot.yml +0 -11
  12. package/patched/@ipld/dag-json/.github/workflows/js-test-and-release.yml +0 -28
  13. package/patched/@ipld/dag-json/CHANGELOG.md +0 -202
  14. package/patched/@ipld/dag-json/LICENSE +0 -4
  15. package/patched/@ipld/dag-json/LICENSE-APACHE +0 -5
  16. package/patched/@ipld/dag-json/LICENSE-MIT +0 -19
  17. package/patched/@ipld/dag-json/README.md +0 -58
  18. package/patched/@ipld/dag-json/ipld-dag-json-10.2.3.tgz +0 -0
  19. package/patched/@ipld/dag-json/package.json +0 -173
  20. package/patched/@ipld/dag-json/src/index.js +0 -291
  21. package/patched/@ipld/dag-json/test/test-basics.spec.js +0 -290
  22. package/patched/@ipld/dag-json/test/ts-use/package.json +0 -11
  23. package/patched/@ipld/dag-json/test/ts-use/src/main.ts +0 -54
  24. package/patched/@ipld/dag-json/test/ts-use/tsconfig.json +0 -9
  25. package/patched/@ipld/dag-json/tsconfig.json +0 -14
  26. package/patched/cborg/.github/dependabot.yml +0 -16
  27. package/patched/cborg/.github/workflows/test-and-release.yml +0 -52
  28. package/patched/cborg/CHANGELOG.md +0 -513
  29. package/patched/cborg/LICENSE +0 -13
  30. package/patched/cborg/README.md +0 -515
  31. package/patched/cborg/bench/bench.js +0 -117
  32. package/patched/cborg/bench/json.js +0 -124
  33. package/patched/cborg/bench/package.json +0 -8
  34. package/patched/cborg/cborg-4.2.7.tgz +0 -0
  35. package/patched/cborg/cborg.js +0 -31
  36. package/patched/cborg/example-bytestrings.js +0 -180
  37. package/patched/cborg/example-json.js +0 -6
  38. package/patched/cborg/example.js +0 -5
  39. package/patched/cborg/interface.ts +0 -56
  40. package/patched/cborg/lib/0uint.js +0 -227
  41. package/patched/cborg/lib/1negint.js +0 -111
  42. package/patched/cborg/lib/2bytes.js +0 -133
  43. package/patched/cborg/lib/3string.js +0 -90
  44. package/patched/cborg/lib/4array.js +0 -113
  45. package/patched/cborg/lib/5map.js +0 -113
  46. package/patched/cborg/lib/6tag.js +0 -80
  47. package/patched/cborg/lib/7float.js +0 -308
  48. package/patched/cborg/lib/bin.js +0 -189
  49. package/patched/cborg/lib/bl.js +0 -124
  50. package/patched/cborg/lib/byte-utils.js +0 -417
  51. package/patched/cborg/lib/common.js +0 -27
  52. package/patched/cborg/lib/decode.js +0 -209
  53. package/patched/cborg/lib/diagnostic.js +0 -156
  54. package/patched/cborg/lib/diagnostic_test.js +0 -117
  55. package/patched/cborg/lib/encode.js +0 -464
  56. package/patched/cborg/lib/is.js +0 -106
  57. package/patched/cborg/lib/json/decode.js +0 -462
  58. package/patched/cborg/lib/json/encode.js +0 -299
  59. package/patched/cborg/lib/json/json.js +0 -4
  60. package/patched/cborg/lib/jump.js +0 -209
  61. package/patched/cborg/lib/length.js +0 -61
  62. package/patched/cborg/lib/token.js +0 -76
  63. package/patched/cborg/package.json +0 -169
  64. package/patched/cborg/pnpm-lock.yaml +0 -6096
  65. package/patched/cborg/taglib.js +0 -73
  66. package/patched/cborg/test/appendix_a.js +0 -647
  67. package/patched/cborg/test/common.js +0 -18
  68. package/patched/cborg/test/node-test-bin.js +0 -402
  69. package/patched/cborg/test/noop-bin-test.js +0 -3
  70. package/patched/cborg/test/test-0uint.js +0 -103
  71. package/patched/cborg/test/test-1negint.js +0 -96
  72. package/patched/cborg/test/test-2bytes.js +0 -198
  73. package/patched/cborg/test/test-3string.js +0 -136
  74. package/patched/cborg/test/test-4array.js +0 -93
  75. package/patched/cborg/test/test-5map.js +0 -284
  76. package/patched/cborg/test/test-6tag.js +0 -85
  77. package/patched/cborg/test/test-7float.js +0 -131
  78. package/patched/cborg/test/test-bl.js +0 -37
  79. package/patched/cborg/test/test-cbor-vectors.js +0 -107
  80. package/patched/cborg/test/test-decode-errors.js +0 -65
  81. package/patched/cborg/test/test-fuzz.js +0 -42
  82. package/patched/cborg/test/test-json.js +0 -219
  83. package/patched/cborg/test/test-length.js +0 -65
  84. package/patched/cborg/test/test-partial.js +0 -111
  85. package/patched/cborg/tsconfig.json +0 -45
  86. package/patched/cborg/types/cborg.d.ts +0 -28
  87. package/patched/cborg/types/cborg.d.ts.map +0 -1
  88. package/patched/cborg/types/example.d.ts +0 -2
  89. package/patched/cborg/types/example.d.ts.map +0 -1
  90. package/patched/cborg/types/interface.d.ts +0 -47
  91. package/patched/cborg/types/interface.d.ts.map +0 -1
  92. package/patched/cborg/types/lib/0uint.d.ts +0 -100
  93. package/patched/cborg/types/lib/0uint.d.ts.map +0 -1
  94. package/patched/cborg/types/lib/1negint.d.ts +0 -58
  95. package/patched/cborg/types/lib/1negint.d.ts.map +0 -1
  96. package/patched/cborg/types/lib/2bytes.d.ts +0 -68
  97. package/patched/cborg/types/lib/2bytes.d.ts.map +0 -1
  98. package/patched/cborg/types/lib/3string.d.ts +0 -46
  99. package/patched/cborg/types/lib/3string.d.ts.map +0 -1
  100. package/patched/cborg/types/lib/4array.d.ts +0 -65
  101. package/patched/cborg/types/lib/4array.d.ts.map +0 -1
  102. package/patched/cborg/types/lib/5map.d.ts +0 -65
  103. package/patched/cborg/types/lib/5map.d.ts.map +0 -1
  104. package/patched/cborg/types/lib/6tag.d.ts +0 -61
  105. package/patched/cborg/types/lib/6tag.d.ts.map +0 -1
  106. package/patched/cborg/types/lib/7float.d.ts +0 -60
  107. package/patched/cborg/types/lib/7float.d.ts.map +0 -1
  108. package/patched/cborg/types/lib/bin.d.ts +0 -4
  109. package/patched/cborg/types/lib/bin.d.ts.map +0 -1
  110. package/patched/cborg/types/lib/bl.d.ts +0 -26
  111. package/patched/cborg/types/lib/bl.d.ts.map +0 -1
  112. package/patched/cborg/types/lib/byte-utils.d.ts +0 -53
  113. package/patched/cborg/types/lib/byte-utils.d.ts.map +0 -1
  114. package/patched/cborg/types/lib/common.d.ts +0 -10
  115. package/patched/cborg/types/lib/common.d.ts.map +0 -1
  116. package/patched/cborg/types/lib/decode.d.ts +0 -41
  117. package/patched/cborg/types/lib/decode.d.ts.map +0 -1
  118. package/patched/cborg/types/lib/diagnostic.d.ts +0 -12
  119. package/patched/cborg/types/lib/diagnostic.d.ts.map +0 -1
  120. package/patched/cborg/types/lib/diagnostic_test.d.ts +0 -2
  121. package/patched/cborg/types/lib/diagnostic_test.d.ts.map +0 -1
  122. package/patched/cborg/types/lib/encode.d.ts +0 -50
  123. package/patched/cborg/types/lib/encode.d.ts.map +0 -1
  124. package/patched/cborg/types/lib/is.d.ts +0 -6
  125. package/patched/cborg/types/lib/is.d.ts.map +0 -1
  126. package/patched/cborg/types/lib/json/decode.d.ts +0 -67
  127. package/patched/cborg/types/lib/json/decode.d.ts.map +0 -1
  128. package/patched/cborg/types/lib/json/encode.d.ts +0 -11
  129. package/patched/cborg/types/lib/json/encode.d.ts.map +0 -1
  130. package/patched/cborg/types/lib/json/forward-cborg.d.ts +0 -6
  131. package/patched/cborg/types/lib/json/forward-cborg.d.ts.map +0 -1
  132. package/patched/cborg/types/lib/json/json.d.ts +0 -6
  133. package/patched/cborg/types/lib/json/json.d.ts.map +0 -1
  134. package/patched/cborg/types/lib/jump.d.ts +0 -12
  135. package/patched/cborg/types/lib/jump.d.ts.map +0 -1
  136. package/patched/cborg/types/lib/length.d.ts +0 -27
  137. package/patched/cborg/types/lib/length.d.ts.map +0 -1
  138. package/patched/cborg/types/lib/token.d.ts +0 -59
  139. package/patched/cborg/types/lib/token.d.ts.map +0 -1
  140. package/patched/cborg/types/taglib.d.ts +0 -18
  141. package/patched/cborg/types/taglib.d.ts.map +0 -1
  142. package/patched/cborg/types/tsconfig.tsbuildinfo +0 -1
  143. package/src/@ipld/car/car/LICENSE +0 -4
  144. package/src/@ipld/car/car/README.md +0 -1078
  145. package/src/@ipld/car/car/dist/index.min.js +0 -5
  146. package/src/@ipld/car/car/dist/src/api.d.ts +0 -72
  147. package/src/@ipld/car/car/dist/src/api.d.ts.map +0 -1
  148. package/src/@ipld/car/car/dist/src/buffer-decoder.d.ts +0 -67
  149. package/src/@ipld/car/car/dist/src/buffer-decoder.d.ts.map +0 -1
  150. package/src/@ipld/car/car/dist/src/buffer-reader-browser.d.ts +0 -116
  151. package/src/@ipld/car/car/dist/src/buffer-reader-browser.d.ts.map +0 -1
  152. package/src/@ipld/car/car/dist/src/buffer-reader.d.ts +0 -31
  153. package/src/@ipld/car/car/dist/src/buffer-reader.d.ts.map +0 -1
  154. package/src/@ipld/car/car/dist/src/buffer-writer.d.ts +0 -86
  155. package/src/@ipld/car/car/dist/src/buffer-writer.d.ts.map +0 -1
  156. package/src/@ipld/car/car/dist/src/coding.d.ts +0 -49
  157. package/src/@ipld/car/car/dist/src/coding.d.ts.map +0 -1
  158. package/src/@ipld/car/car/dist/src/decoder-common.d.ts +0 -43
  159. package/src/@ipld/car/car/dist/src/decoder-common.d.ts.map +0 -1
  160. package/src/@ipld/car/car/dist/src/decoder.d.ts +0 -87
  161. package/src/@ipld/car/car/dist/src/decoder.d.ts.map +0 -1
  162. package/src/@ipld/car/car/dist/src/encoder.d.ts +0 -17
  163. package/src/@ipld/car/car/dist/src/encoder.d.ts.map +0 -1
  164. package/src/@ipld/car/car/dist/src/header-validator.d.ts +0 -5
  165. package/src/@ipld/car/car/dist/src/header-validator.d.ts.map +0 -1
  166. package/src/@ipld/car/car/dist/src/index-browser.d.ts +0 -10
  167. package/src/@ipld/car/car/dist/src/index-browser.d.ts.map +0 -1
  168. package/src/@ipld/car/car/dist/src/index.d.ts +0 -11
  169. package/src/@ipld/car/car/dist/src/index.d.ts.map +0 -1
  170. package/src/@ipld/car/car/dist/src/indexed-reader-browser.d.ts +0 -5
  171. package/src/@ipld/car/car/dist/src/indexed-reader-browser.d.ts.map +0 -1
  172. package/src/@ipld/car/car/dist/src/indexed-reader.d.ts +0 -152
  173. package/src/@ipld/car/car/dist/src/indexed-reader.d.ts.map +0 -1
  174. package/src/@ipld/car/car/dist/src/indexer.d.ts +0 -95
  175. package/src/@ipld/car/car/dist/src/indexer.d.ts.map +0 -1
  176. package/src/@ipld/car/car/dist/src/iterator-channel.d.ts +0 -7
  177. package/src/@ipld/car/car/dist/src/iterator-channel.d.ts.map +0 -1
  178. package/src/@ipld/car/car/dist/src/iterator.d.ts +0 -174
  179. package/src/@ipld/car/car/dist/src/iterator.d.ts.map +0 -1
  180. package/src/@ipld/car/car/dist/src/reader-browser.d.ts +0 -151
  181. package/src/@ipld/car/car/dist/src/reader-browser.d.ts.map +0 -1
  182. package/src/@ipld/car/car/dist/src/reader.d.ts +0 -35
  183. package/src/@ipld/car/car/dist/src/reader.d.ts.map +0 -1
  184. package/src/@ipld/car/car/dist/src/writer-browser.d.ts +0 -155
  185. package/src/@ipld/car/car/dist/src/writer-browser.d.ts.map +0 -1
  186. package/src/@ipld/car/car/dist/src/writer.d.ts +0 -45
  187. package/src/@ipld/car/car/dist/src/writer.d.ts.map +0 -1
  188. package/src/@ipld/car/car/node_modules/.bin/cborg +0 -17
  189. package/src/@ipld/car/car/package.json +0 -235
  190. package/src/@ipld/car/car/src/api.ts +0 -90
  191. package/src/@ipld/car/car/src/buffer-decoder.js +0 -213
  192. package/src/@ipld/car/car/src/buffer-reader-browser.js +0 -144
  193. package/src/@ipld/car/car/src/buffer-reader.js +0 -51
  194. package/src/@ipld/car/car/src/buffer-writer.js +0 -286
  195. package/src/@ipld/car/car/src/coding.ts +0 -68
  196. package/src/@ipld/car/car/src/decoder-common.js +0 -82
  197. package/src/@ipld/car/car/src/decoder.js +0 -347
  198. package/src/@ipld/car/car/src/encoder.js +0 -76
  199. package/src/@ipld/car/car/src/header-validator.js +0 -214
  200. package/src/@ipld/car/car/src/header.ipldsch +0 -18
  201. package/src/@ipld/car/car/src/index-browser.js +0 -18
  202. package/src/@ipld/car/car/src/index.js +0 -21
  203. package/src/@ipld/car/car/src/indexed-reader-browser.js +0 -7
  204. package/src/@ipld/car/car/src/indexed-reader.js +0 -211
  205. package/src/@ipld/car/car/src/indexer.js +0 -130
  206. package/src/@ipld/car/car/src/iterator-channel.js +0 -91
  207. package/src/@ipld/car/car/src/iterator.js +0 -267
  208. package/src/@ipld/car/car/src/reader-browser.js +0 -194
  209. package/src/@ipld/car/car/src/reader.js +0 -56
  210. package/src/@ipld/car/car/src/writer-browser.js +0 -250
  211. package/src/@ipld/car/car/src/writer.js +0 -84
  212. package/src/@ipld/dag-cbor/dag-cbor/LICENSE +0 -4
  213. package/src/@ipld/dag-cbor/dag-cbor/README.md +0 -80
  214. package/src/@ipld/dag-cbor/dag-cbor/dist/index.min.js +0 -3
  215. package/src/@ipld/dag-cbor/dag-cbor/dist/src/index.d.ts +0 -67
  216. package/src/@ipld/dag-cbor/dag-cbor/dist/src/index.d.ts.map +0 -1
  217. package/src/@ipld/dag-cbor/dag-cbor/node_modules/.bin/cborg +0 -17
  218. package/src/@ipld/dag-cbor/dag-cbor/package.json +0 -171
  219. package/src/@ipld/dag-cbor/dag-cbor/src/index.js +0 -147
  220. package/src/@ipld/dag-json/dag-json/LICENSE +0 -4
  221. package/src/@ipld/dag-json/dag-json/README.md +0 -58
  222. package/src/@ipld/dag-json/dag-json/dist/index.min.js +0 -3
  223. package/src/@ipld/dag-json/dag-json/dist/src/index.d.ts +0 -12
  224. package/src/@ipld/dag-json/dag-json/dist/src/index.d.ts.map +0 -1
  225. package/src/@ipld/dag-json/dag-json/node_modules/.bin/cborg +0 -17
  226. package/src/@ipld/dag-json/dag-json/package.json +0 -173
  227. package/src/@ipld/dag-json/dag-json/src/index.js +0 -291
  228. package/src/@web3-storage/pail/pail/LICENSE.md +0 -232
  229. package/src/@web3-storage/pail/pail/README.md +0 -84
  230. package/src/@web3-storage/pail/pail/cli.js +0 -218
  231. package/src/@web3-storage/pail/pail/dist/src/api.d.ts +0 -59
  232. package/src/@web3-storage/pail/pail/dist/src/api.d.ts.map +0 -1
  233. package/src/@web3-storage/pail/pail/dist/src/batch/api.d.ts +0 -31
  234. package/src/@web3-storage/pail/pail/dist/src/batch/api.d.ts.map +0 -1
  235. package/src/@web3-storage/pail/pail/dist/src/batch/index.d.ts +0 -75
  236. package/src/@web3-storage/pail/pail/dist/src/batch/index.d.ts.map +0 -1
  237. package/src/@web3-storage/pail/pail/dist/src/batch/shard.d.ts +0 -3
  238. package/src/@web3-storage/pail/pail/dist/src/batch/shard.d.ts.map +0 -1
  239. package/src/@web3-storage/pail/pail/dist/src/block.d.ts +0 -35
  240. package/src/@web3-storage/pail/pail/dist/src/block.d.ts.map +0 -1
  241. package/src/@web3-storage/pail/pail/dist/src/clock/api.d.ts +0 -10
  242. package/src/@web3-storage/pail/pail/dist/src/clock/api.d.ts.map +0 -1
  243. package/src/@web3-storage/pail/pail/dist/src/clock/index.d.ts +0 -48
  244. package/src/@web3-storage/pail/pail/dist/src/clock/index.d.ts.map +0 -1
  245. package/src/@web3-storage/pail/pail/dist/src/crdt/api.d.ts +0 -26
  246. package/src/@web3-storage/pail/pail/dist/src/crdt/api.d.ts.map +0 -1
  247. package/src/@web3-storage/pail/pail/dist/src/crdt/batch/api.d.ts +0 -11
  248. package/src/@web3-storage/pail/pail/dist/src/crdt/batch/api.d.ts.map +0 -1
  249. package/src/@web3-storage/pail/pail/dist/src/crdt/batch/index.d.ts +0 -5
  250. package/src/@web3-storage/pail/pail/dist/src/crdt/batch/index.d.ts.map +0 -1
  251. package/src/@web3-storage/pail/pail/dist/src/crdt/index.d.ts +0 -9
  252. package/src/@web3-storage/pail/pail/dist/src/crdt/index.d.ts.map +0 -1
  253. package/src/@web3-storage/pail/pail/dist/src/diff.d.ts +0 -13
  254. package/src/@web3-storage/pail/pail/dist/src/diff.d.ts.map +0 -1
  255. package/src/@web3-storage/pail/pail/dist/src/index.d.ts +0 -10
  256. package/src/@web3-storage/pail/pail/dist/src/index.d.ts.map +0 -1
  257. package/src/@web3-storage/pail/pail/dist/src/merge.d.ts +0 -5
  258. package/src/@web3-storage/pail/pail/dist/src/merge.d.ts.map +0 -1
  259. package/src/@web3-storage/pail/pail/dist/src/shard.d.ts +0 -43
  260. package/src/@web3-storage/pail/pail/dist/src/shard.d.ts.map +0 -1
  261. package/src/@web3-storage/pail/pail/dist/tsconfig.tsbuildinfo +0 -1
  262. package/src/@web3-storage/pail/pail/node_modules/.bin/pail +0 -17
  263. package/src/@web3-storage/pail/pail/package.json +0 -173
  264. package/src/@web3-storage/pail/pail/src/api.js +0 -1
  265. package/src/@web3-storage/pail/pail/src/api.ts +0 -90
  266. package/src/@web3-storage/pail/pail/src/batch/api.js +0 -1
  267. package/src/@web3-storage/pail/pail/src/batch/api.ts +0 -59
  268. package/src/@web3-storage/pail/pail/src/batch/index.js +0 -258
  269. package/src/@web3-storage/pail/pail/src/batch/shard.js +0 -13
  270. package/src/@web3-storage/pail/pail/src/block.js +0 -75
  271. package/src/@web3-storage/pail/pail/src/clock/api.js +0 -1
  272. package/src/@web3-storage/pail/pail/src/clock/api.ts +0 -12
  273. package/src/@web3-storage/pail/pail/src/clock/index.js +0 -182
  274. package/src/@web3-storage/pail/pail/src/crdt/api.js +0 -1
  275. package/src/@web3-storage/pail/pail/src/crdt/api.ts +0 -33
  276. package/src/@web3-storage/pail/pail/src/crdt/batch/api.js +0 -1
  277. package/src/@web3-storage/pail/pail/src/crdt/batch/api.ts +0 -30
  278. package/src/@web3-storage/pail/pail/src/crdt/batch/index.js +0 -155
  279. package/src/@web3-storage/pail/pail/src/crdt/index.js +0 -354
  280. package/src/@web3-storage/pail/pail/src/diff.js +0 -151
  281. package/src/@web3-storage/pail/pail/src/index.js +0 -406
  282. package/src/@web3-storage/pail/pail/src/merge.js +0 -43
  283. package/src/@web3-storage/pail/pail/src/shard.js +0 -180
  284. package/src/cborg/cborg/.github/dependabot.yml +0 -16
  285. package/src/cborg/cborg/.github/workflows/test-and-release.yml +0 -52
  286. package/src/cborg/cborg/CHANGELOG.md +0 -513
  287. package/src/cborg/cborg/LICENSE +0 -13
  288. package/src/cborg/cborg/README.md +0 -515
  289. package/src/cborg/cborg/bench/bench.js +0 -117
  290. package/src/cborg/cborg/bench/json.js +0 -124
  291. package/src/cborg/cborg/bench/package.json +0 -8
  292. package/src/cborg/cborg/cborg.js +0 -31
  293. package/src/cborg/cborg/example-bytestrings.js +0 -180
  294. package/src/cborg/cborg/example-json.js +0 -6
  295. package/src/cborg/cborg/example.js +0 -5
  296. package/src/cborg/cborg/interface.ts +0 -56
  297. package/src/cborg/cborg/lib/0uint.js +0 -227
  298. package/src/cborg/cborg/lib/1negint.js +0 -111
  299. package/src/cborg/cborg/lib/2bytes.js +0 -133
  300. package/src/cborg/cborg/lib/3string.js +0 -90
  301. package/src/cborg/cborg/lib/4array.js +0 -113
  302. package/src/cborg/cborg/lib/5map.js +0 -113
  303. package/src/cborg/cborg/lib/6tag.js +0 -80
  304. package/src/cborg/cborg/lib/7float.js +0 -308
  305. package/src/cborg/cborg/lib/bin.js +0 -189
  306. package/src/cborg/cborg/lib/bl.js +0 -124
  307. package/src/cborg/cborg/lib/byte-utils.js +0 -417
  308. package/src/cborg/cborg/lib/common.js +0 -27
  309. package/src/cborg/cborg/lib/decode.js +0 -209
  310. package/src/cborg/cborg/lib/diagnostic.js +0 -156
  311. package/src/cborg/cborg/lib/diagnostic_test.js +0 -117
  312. package/src/cborg/cborg/lib/encode.js +0 -464
  313. package/src/cborg/cborg/lib/is.js +0 -106
  314. package/src/cborg/cborg/lib/json/decode.js +0 -462
  315. package/src/cborg/cborg/lib/json/encode.js +0 -299
  316. package/src/cborg/cborg/lib/json/json.js +0 -4
  317. package/src/cborg/cborg/lib/jump.js +0 -209
  318. package/src/cborg/cborg/lib/length.js +0 -61
  319. package/src/cborg/cborg/lib/token.js +0 -76
  320. package/src/cborg/cborg/node_modules/.bin/cborg +0 -17
  321. package/src/cborg/cborg/package.json +0 -168
  322. package/src/cborg/cborg/taglib.js +0 -73
  323. package/src/cborg/cborg/test/appendix_a.js +0 -647
  324. package/src/cborg/cborg/test/common.js +0 -18
  325. package/src/cborg/cborg/test/node-test-bin.js +0 -402
  326. package/src/cborg/cborg/test/noop-bin-test.js +0 -3
  327. package/src/cborg/cborg/test/test-0uint.js +0 -103
  328. package/src/cborg/cborg/test/test-1negint.js +0 -96
  329. package/src/cborg/cborg/test/test-2bytes.js +0 -198
  330. package/src/cborg/cborg/test/test-3string.js +0 -136
  331. package/src/cborg/cborg/test/test-4array.js +0 -93
  332. package/src/cborg/cborg/test/test-5map.js +0 -284
  333. package/src/cborg/cborg/test/test-6tag.js +0 -85
  334. package/src/cborg/cborg/test/test-7float.js +0 -131
  335. package/src/cborg/cborg/test/test-bl.js +0 -37
  336. package/src/cborg/cborg/test/test-cbor-vectors.js +0 -107
  337. package/src/cborg/cborg/test/test-decode-errors.js +0 -65
  338. package/src/cborg/cborg/test/test-fuzz.js +0 -42
  339. package/src/cborg/cborg/test/test-json.js +0 -219
  340. package/src/cborg/cborg/test/test-length.js +0 -65
  341. package/src/cborg/cborg/test/test-partial.js +0 -111
  342. package/src/cborg/cborg/tsconfig.json +0 -45
  343. package/src/cborg/cborg/types/cborg.d.ts +0 -28
  344. package/src/cborg/cborg/types/cborg.d.ts.map +0 -1
  345. package/src/cborg/cborg/types/example.d.ts +0 -2
  346. package/src/cborg/cborg/types/example.d.ts.map +0 -1
  347. package/src/cborg/cborg/types/interface.d.ts +0 -47
  348. package/src/cborg/cborg/types/interface.d.ts.map +0 -1
  349. package/src/cborg/cborg/types/lib/0uint.d.ts +0 -100
  350. package/src/cborg/cborg/types/lib/0uint.d.ts.map +0 -1
  351. package/src/cborg/cborg/types/lib/1negint.d.ts +0 -58
  352. package/src/cborg/cborg/types/lib/1negint.d.ts.map +0 -1
  353. package/src/cborg/cborg/types/lib/2bytes.d.ts +0 -68
  354. package/src/cborg/cborg/types/lib/2bytes.d.ts.map +0 -1
  355. package/src/cborg/cborg/types/lib/3string.d.ts +0 -46
  356. package/src/cborg/cborg/types/lib/3string.d.ts.map +0 -1
  357. package/src/cborg/cborg/types/lib/4array.d.ts +0 -65
  358. package/src/cborg/cborg/types/lib/4array.d.ts.map +0 -1
  359. package/src/cborg/cborg/types/lib/5map.d.ts +0 -65
  360. package/src/cborg/cborg/types/lib/5map.d.ts.map +0 -1
  361. package/src/cborg/cborg/types/lib/6tag.d.ts +0 -61
  362. package/src/cborg/cborg/types/lib/6tag.d.ts.map +0 -1
  363. package/src/cborg/cborg/types/lib/7float.d.ts +0 -60
  364. package/src/cborg/cborg/types/lib/7float.d.ts.map +0 -1
  365. package/src/cborg/cborg/types/lib/bin.d.ts +0 -4
  366. package/src/cborg/cborg/types/lib/bin.d.ts.map +0 -1
  367. package/src/cborg/cborg/types/lib/bl.d.ts +0 -26
  368. package/src/cborg/cborg/types/lib/bl.d.ts.map +0 -1
  369. package/src/cborg/cborg/types/lib/byte-utils.d.ts +0 -53
  370. package/src/cborg/cborg/types/lib/byte-utils.d.ts.map +0 -1
  371. package/src/cborg/cborg/types/lib/common.d.ts +0 -10
  372. package/src/cborg/cborg/types/lib/common.d.ts.map +0 -1
  373. package/src/cborg/cborg/types/lib/decode.d.ts +0 -41
  374. package/src/cborg/cborg/types/lib/decode.d.ts.map +0 -1
  375. package/src/cborg/cborg/types/lib/diagnostic.d.ts +0 -12
  376. package/src/cborg/cborg/types/lib/diagnostic.d.ts.map +0 -1
  377. package/src/cborg/cborg/types/lib/diagnostic_test.d.ts +0 -2
  378. package/src/cborg/cborg/types/lib/diagnostic_test.d.ts.map +0 -1
  379. package/src/cborg/cborg/types/lib/encode.d.ts +0 -50
  380. package/src/cborg/cborg/types/lib/encode.d.ts.map +0 -1
  381. package/src/cborg/cborg/types/lib/is.d.ts +0 -6
  382. package/src/cborg/cborg/types/lib/is.d.ts.map +0 -1
  383. package/src/cborg/cborg/types/lib/json/decode.d.ts +0 -67
  384. package/src/cborg/cborg/types/lib/json/decode.d.ts.map +0 -1
  385. package/src/cborg/cborg/types/lib/json/encode.d.ts +0 -11
  386. package/src/cborg/cborg/types/lib/json/encode.d.ts.map +0 -1
  387. package/src/cborg/cborg/types/lib/json/forward-cborg.d.ts +0 -6
  388. package/src/cborg/cborg/types/lib/json/forward-cborg.d.ts.map +0 -1
  389. package/src/cborg/cborg/types/lib/json/json.d.ts +0 -6
  390. package/src/cborg/cborg/types/lib/json/json.d.ts.map +0 -1
  391. package/src/cborg/cborg/types/lib/jump.d.ts +0 -12
  392. package/src/cborg/cborg/types/lib/jump.d.ts.map +0 -1
  393. package/src/cborg/cborg/types/lib/length.d.ts +0 -27
  394. package/src/cborg/cborg/types/lib/length.d.ts.map +0 -1
  395. package/src/cborg/cborg/types/lib/token.d.ts +0 -59
  396. package/src/cborg/cborg/types/lib/token.d.ts.map +0 -1
  397. package/src/cborg/cborg/types/taglib.d.ts +0 -18
  398. package/src/cborg/cborg/types/taglib.d.ts.map +0 -1
  399. package/src/cborg/cborg/types/tsconfig.tsbuildinfo +0 -1
  400. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/LICENSE +0 -4
  401. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/README.md +0 -105
  402. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/index.min.js +0 -3
  403. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/errors.d.ts +0 -57
  404. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/errors.d.ts.map +0 -1
  405. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/errors.js +0 -73
  406. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/errors.js.map +0 -1
  407. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/index.d.ts +0 -355
  408. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/index.d.ts.map +0 -1
  409. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/index.js +0 -197
  410. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/index.js.map +0 -1
  411. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.d.ts +0 -4
  412. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.d.ts.map +0 -1
  413. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.js +0 -9
  414. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.js.map +0 -1
  415. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.d.ts +0 -4
  416. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.d.ts.map +0 -1
  417. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.js +0 -9
  418. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.js.map +0 -1
  419. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/identity.d.ts +0 -4
  420. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/identity.d.ts.map +0 -1
  421. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/identity.js +0 -38
  422. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/identity.js.map +0 -1
  423. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/index.d.ts +0 -4
  424. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/index.d.ts.map +0 -1
  425. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/index.js +0 -30
  426. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/index.js.map +0 -1
  427. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/json.d.ts +0 -4
  428. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/json.d.ts.map +0 -1
  429. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/json.js +0 -9
  430. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/json.js.map +0 -1
  431. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/raw.d.ts +0 -4
  432. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/raw.d.ts.map +0 -1
  433. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/raw.js +0 -37
  434. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/raw.js.map +0 -1
  435. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.d.ts +0 -4
  436. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.d.ts.map +0 -1
  437. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.js +0 -29
  438. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.js.map +0 -1
  439. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.d.ts +0 -4
  440. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.d.ts.map +0 -1
  441. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.js +0 -153
  442. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.js.map +0 -1
  443. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.d.ts +0 -4
  444. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.d.ts.map +0 -1
  445. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.js +0 -59
  446. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.js.map +0 -1
  447. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.d.ts +0 -4
  448. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.d.ts.map +0 -1
  449. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.js +0 -25
  450. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.js.map +0 -1
  451. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.d.ts +0 -4
  452. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.d.ts.map +0 -1
  453. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.js +0 -104
  454. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.js.map +0 -1
  455. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.d.ts +0 -3
  456. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.d.ts.map +0 -1
  457. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.js +0 -20
  458. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.js.map +0 -1
  459. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.d.ts +0 -6
  460. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.d.ts.map +0 -1
  461. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.js +0 -116
  462. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.js.map +0 -1
  463. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.d.ts +0 -4
  464. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.d.ts.map +0 -1
  465. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.js +0 -57
  466. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.js.map +0 -1
  467. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.d.ts +0 -6
  468. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.d.ts.map +0 -1
  469. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.js +0 -30
  470. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.js.map +0 -1
  471. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/typedoc-urls.json +0 -58
  472. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/package.json +0 -180
  473. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/errors.ts +0 -87
  474. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/index.ts +0 -498
  475. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/dag-cbor.ts +0 -12
  476. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/dag-json.ts +0 -12
  477. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/identity.ts +0 -49
  478. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/index.ts +0 -35
  479. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/json.ts +0 -12
  480. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/raw.ts +0 -49
  481. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/directory.ts +0 -39
  482. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/file.ts +0 -198
  483. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/hamt-sharded-directory.ts +0 -76
  484. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/raw.ts +0 -37
  485. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/index.ts +0 -121
  486. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/utils/extract-data-from-block.ts +0 -24
  487. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/utils/find-cid-in-shard.ts +0 -149
  488. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/utils/resolve-object-path.ts +0 -62
  489. package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/utils/validate-offset-and-length.ts +0 -38
@@ -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,56 +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
- const fsread = promisify(fs.read)
12
-
13
- /**
14
- * @class
15
- * @implements {CarReaderIface}
16
- */
17
- export class CarReader extends BrowserCarReader {
18
- /**
19
- * Reads a block directly from a file descriptor for an open CAR file. This
20
- * function is **only available in Node.js** and not a browser environment.
21
- *
22
- * This function can be used in connection with {@link CarIndexer} which emits
23
- * the `BlockIndex` objects that are required by this function.
24
- *
25
- * The user is responsible for opening and closing the file used in this call.
26
- *
27
- * @async
28
- * @static
29
- * @memberof CarReader
30
- * @param {fs.promises.FileHandle | number} fd - A file descriptor from the
31
- * Node.js `fs` module. Either an integer, from `fs.open()` or a `FileHandle`
32
- * from `fs.promises.open()`.
33
- * @param {BlockIndex} blockIndex - An index pointing to the location of the
34
- * Block required. This `BlockIndex` should take the form:
35
- * `{cid:CID, blockLength:number, blockOffset:number}`.
36
- * @returns {Promise<Block>} A `{ cid:CID, bytes:Uint8Array }` pair.
37
- */
38
- static async readRaw (fd, blockIndex) {
39
- const { cid, blockLength, blockOffset } = blockIndex
40
- const bytes = new Uint8Array(blockLength)
41
- let read
42
- if (typeof fd === 'number') {
43
- read = (await fsread(fd, bytes, 0, blockLength, blockOffset)).bytesRead
44
- } else if (typeof fd === 'object' && typeof fd.read === 'function') { // FileDescriptor
45
- read = (await fd.read(bytes, 0, blockLength, blockOffset)).bytesRead
46
- } else {
47
- throw new TypeError('Bad fd')
48
- }
49
- if (read !== blockLength) {
50
- throw new Error(`Failed to read entire block (${read} instead of ${blockLength})`)
51
- }
52
- return { cid, bytes }
53
- }
54
- }
55
-
56
- export const __browser = false
@@ -1,250 +0,0 @@
1
- import { CID } from 'multiformats/cid'
2
- import { bytesReader, readHeader } from './decoder.js'
3
- import { createEncoder, createHeader } from './encoder.js'
4
- import { create as iteratorChannel } from './iterator-channel.js'
5
-
6
- /**
7
- * @typedef {import('./api').Block} Block
8
- * @typedef {import('./api').BlockWriter} BlockWriter
9
- * @typedef {import('./api').WriterChannel} WriterChannel
10
- * @typedef {import('./coding').CarEncoder} CarEncoder
11
- * @typedef {import('./coding').IteratorChannel<Uint8Array>} IteratorChannel
12
- */
13
-
14
- /**
15
- * Provides a writer interface for the creation of CAR files.
16
- *
17
- * Creation of a `CarWriter` involves the instatiation of an input / output pair
18
- * in the form of a `WriterChannel`, which is a
19
- * `{ writer:CarWriter, out:AsyncIterable<Uint8Array> }` pair. These two
20
- * components form what can be thought of as a stream-like interface. The
21
- * `writer` component (an instantiated `CarWriter`), has methods to
22
- * {@link CarWriter.put `put()`} new blocks and {@link CarWriter.put `close()`}
23
- * the writing operation (finalising the CAR archive). The `out` component is
24
- * an `AsyncIterable` that yields the bytes of the archive. This can be
25
- * redirected to a file or other sink. In Node.js, you can use the
26
- * [`Readable.from()`](https://nodejs.org/api/stream.html#stream_stream_readable_from_iterable_options)
27
- * API to convert this to a standard Node.js stream, or it can be directly fed
28
- * to a
29
- * [`stream.pipeline()`](https://nodejs.org/api/stream.html#stream_stream_pipeline_source_transforms_destination_callback).
30
- *
31
- * The channel will provide a form of backpressure. The `Promise` from a
32
- * `write()` won't resolve until the resulting data is drained from the `out`
33
- * iterable.
34
- *
35
- * It is also possible to ignore the `Promise` from `write()` calls and allow
36
- * the generated data to queue in memory. This should be avoided for large CAR
37
- * archives of course due to the memory costs and potential for memory overflow.
38
- *
39
- * Load this class with either
40
- * `import { CarWriter } from '@ipld/car/writer'`
41
- * (`const { CarWriter } = require('@ipld/car/writer')`). Or
42
- * `import { CarWriter } from '@ipld/car'`
43
- * (`const { CarWriter } = require('@ipld/car')`). The former will likely
44
- * result in smaller bundle sizes where this is important.
45
- *
46
- * @name CarWriter
47
- * @class
48
- * @implements {BlockWriter}
49
- */
50
- export class CarWriter {
51
- /**
52
- * @param {CID[]} roots
53
- * @param {CarEncoder} encoder
54
- */
55
- constructor (roots, encoder) {
56
- this._encoder = encoder
57
- /** @type {Promise<void>} */
58
- this._mutex = encoder.setRoots(roots)
59
- this._ended = false
60
- }
61
-
62
- /**
63
- * Write a `Block` (a `{ cid:CID, bytes:Uint8Array }` pair) to the archive.
64
- *
65
- * @function
66
- * @memberof CarWriter
67
- * @instance
68
- * @async
69
- * @param {Block} block - A `{ cid:CID, bytes:Uint8Array }` pair.
70
- * @returns {Promise<void>} The returned promise will only resolve once the
71
- * bytes this block generates are written to the `out` iterable.
72
- */
73
- async put (block) {
74
- if (!(block.bytes instanceof Uint8Array) || !block.cid) {
75
- throw new TypeError('Can only write {cid, bytes} objects')
76
- }
77
- if (this._ended) {
78
- throw new Error('Already closed')
79
- }
80
- const cid = CID.asCID(block.cid)
81
- if (!cid) {
82
- throw new TypeError('Can only write {cid, bytes} objects')
83
- }
84
- this._mutex = this._mutex.then(() => this._encoder.writeBlock({ cid, bytes: block.bytes }))
85
- return this._mutex
86
- }
87
-
88
- /**
89
- * Finalise the CAR archive and signal that the `out` iterable should end once
90
- * any remaining bytes are written.
91
- *
92
- * @function
93
- * @memberof CarWriter
94
- * @instance
95
- * @async
96
- * @returns {Promise<void>}
97
- */
98
- async close () {
99
- if (this._ended) {
100
- throw new Error('Already closed')
101
- }
102
- await this._mutex
103
- this._ended = true
104
- return this._encoder.close()
105
- }
106
-
107
- /**
108
- * Returns the version number of the CAR file being written
109
- *
110
- * @returns {number}
111
- */
112
- version () {
113
- return this._encoder.version()
114
- }
115
-
116
- /**
117
- * Create a new CAR writer "channel" which consists of a
118
- * `{ writer:CarWriter, out:AsyncIterable<Uint8Array> }` pair.
119
- *
120
- * @async
121
- * @static
122
- * @memberof CarWriter
123
- * @param {CID[] | CID | void} roots
124
- * @returns {WriterChannel} The channel takes the form of
125
- * `{ writer:CarWriter, out:AsyncIterable<Uint8Array> }`.
126
- */
127
- static create (roots) {
128
- roots = toRoots(roots)
129
- const { encoder, iterator } = encodeWriter()
130
- const writer = new CarWriter(roots, encoder)
131
- const out = new CarWriterOut(iterator)
132
- return { writer, out }
133
- }
134
-
135
- /**
136
- * Create a new CAR appender "channel" which consists of a
137
- * `{ writer:CarWriter, out:AsyncIterable<Uint8Array> }` pair.
138
- * This appender does not consider roots and does not produce a CAR header.
139
- * It is designed to append blocks to an _existing_ CAR archive. It is
140
- * expected that `out` will be concatenated onto the end of an existing
141
- * archive that already has a properly formatted header.
142
- *
143
- * @async
144
- * @static
145
- * @memberof CarWriter
146
- * @returns {WriterChannel} The channel takes the form of
147
- * `{ writer:CarWriter, out:AsyncIterable<Uint8Array> }`.
148
- */
149
- static createAppender () {
150
- const { encoder, iterator } = encodeWriter()
151
- encoder.setRoots = () => Promise.resolve()
152
- const writer = new CarWriter([], encoder)
153
- const out = new CarWriterOut(iterator)
154
- return { writer, out }
155
- }
156
-
157
- /**
158
- * Update the list of roots in the header of an existing CAR as represented
159
- * in a Uint8Array.
160
- *
161
- * This operation is an _overwrite_, the total length of the CAR will not be
162
- * modified. A rejection will occur if the new header will not be the same
163
- * length as the existing header, in which case the CAR will not be modified.
164
- * It is the responsibility of the user to ensure that the roots being
165
- * replaced encode as the same length as the new roots.
166
- *
167
- * The byte array passed in an argument will be modified and also returned
168
- * upon successful modification.
169
- *
170
- * @async
171
- * @static
172
- * @memberof CarWriter
173
- * @param {Uint8Array} bytes
174
- * @param {CID[]} roots - A new list of roots to replace the existing list in
175
- * the CAR header. The new header must take up the same number of bytes as the
176
- * existing header, so the roots should collectively be the same byte length
177
- * as the existing roots.
178
- * @returns {Promise<Uint8Array>}
179
- */
180
- static async updateRootsInBytes (bytes, roots) {
181
- const reader = bytesReader(bytes)
182
- await readHeader(reader)
183
- const newHeader = createHeader(roots)
184
- if (Number(reader.pos) !== newHeader.length) {
185
- throw new Error(`updateRoots() can only overwrite a header of the same length (old header is ${reader.pos} bytes, new header is ${newHeader.length} bytes)`)
186
- }
187
- bytes.set(newHeader, 0)
188
- return bytes
189
- }
190
- }
191
-
192
- /**
193
- * @class
194
- * @implements {AsyncIterable<Uint8Array>}
195
- */
196
- export class CarWriterOut {
197
- /**
198
- * @param {AsyncIterator<Uint8Array>} iterator
199
- */
200
- constructor (iterator) {
201
- this._iterator = iterator
202
- }
203
-
204
- [Symbol.asyncIterator] () {
205
- if (this._iterating) {
206
- throw new Error('Multiple iterator not supported')
207
- }
208
- this._iterating = true
209
- return this._iterator
210
- }
211
- }
212
-
213
- function encodeWriter () {
214
- /** @type {IteratorChannel} */
215
- const iw = iteratorChannel()
216
- const { writer, iterator } = iw
217
- const encoder = createEncoder(writer)
218
- return { encoder, iterator }
219
- }
220
-
221
- /**
222
- * @private
223
- * @param {CID[] | CID | void} roots
224
- * @returns {CID[]}
225
- */
226
- function toRoots (roots) {
227
- if (roots === undefined) {
228
- return []
229
- }
230
-
231
- if (!Array.isArray(roots)) {
232
- const cid = CID.asCID(roots)
233
- if (!cid) {
234
- throw new TypeError('roots must be a single CID or an array of CIDs')
235
- }
236
- return [cid]
237
- }
238
-
239
- const _roots = []
240
- for (const root of roots) {
241
- const _root = CID.asCID(root)
242
- if (!_root) {
243
- throw new TypeError('roots must be a single CID or an array of CIDs')
244
- }
245
- _roots.push(_root)
246
- }
247
- return _roots
248
- }
249
-
250
- export const __browser = true
@@ -1,84 +0,0 @@
1
- import fs from 'fs'
2
- import { promisify } from 'util'
3
- import { readHeader, chunkReader } from './decoder.js'
4
- import { createHeader } from './encoder.js'
5
- import { CarWriter as BrowserCarWriter } from './writer-browser.js'
6
-
7
- const fsread = promisify(fs.read)
8
- const fswrite = promisify(fs.write)
9
-
10
- /**
11
- * @typedef {import('multiformats/cid').CID} CID
12
- * @typedef {import('./api').BlockWriter} BlockWriter
13
- */
14
-
15
- /**
16
- * @class
17
- * @implements {BlockWriter}
18
- */
19
- export class CarWriter extends BrowserCarWriter {
20
- /**
21
- * Update the list of roots in the header of an existing CAR file. The first
22
- * argument must be a file descriptor for CAR file that is open in read and
23
- * write mode (not append), e.g. `fs.open` or `fs.promises.open` with `'r+'`
24
- * mode.
25
- *
26
- * This operation is an _overwrite_, the total length of the CAR will not be
27
- * modified. A rejection will occur if the new header will not be the same
28
- * length as the existing header, in which case the CAR will not be modified.
29
- * It is the responsibility of the user to ensure that the roots being
30
- * replaced encode as the same length as the new roots.
31
- *
32
- * This function is **only available in Node.js** and not a browser
33
- * environment.
34
- *
35
- * @async
36
- * @static
37
- * @memberof CarWriter
38
- * @param {fs.promises.FileHandle | number} fd - A file descriptor from the
39
- * Node.js `fs` module. Either an integer, from `fs.open()` or a `FileHandle`
40
- * from `fs.promises.open()`.
41
- * @param {CID[]} roots - A new list of roots to replace the existing list in
42
- * the CAR header. The new header must take up the same number of bytes as the
43
- * existing header, so the roots should collectively be the same byte length
44
- * as the existing roots.
45
- * @returns {Promise<void>}
46
- */
47
- static async updateRootsInFile (fd, roots) {
48
- const chunkSize = 256
49
- /** @type {Uint8Array} */
50
- let bytes
51
- let offset = 0
52
-
53
- /** @type {() => Promise<number>} */
54
- let readChunk
55
- if (typeof fd === 'number') {
56
- readChunk = async () => (await fsread(fd, bytes, 0, chunkSize, offset)).bytesRead
57
- } else if (typeof fd === 'object' && typeof fd.read === 'function') { // FileDescriptor
58
- readChunk = async () => (await fd.read(bytes, 0, chunkSize, offset)).bytesRead
59
- } else {
60
- throw new TypeError('Bad fd')
61
- }
62
- const fdReader = chunkReader(async () => {
63
- bytes = new Uint8Array(chunkSize) // need a new chunk each time, can't reuse old
64
- const read = await readChunk()
65
- offset += read
66
- /* eslint no-warning-comments: 0 */
67
- // TODO: test header > 256 bytes
68
- return read < chunkSize ? bytes.subarray(0, read) : bytes
69
- })
70
-
71
- await readHeader(fdReader)
72
- const newHeader = createHeader(roots)
73
- if (fdReader.pos !== newHeader.length) {
74
- throw new Error(`updateRoots() can only overwrite a header of the same length (old header is ${fdReader.pos} bytes, new header is ${newHeader.length} bytes)`)
75
- }
76
- if (typeof fd === 'number') {
77
- await fswrite(fd, newHeader, 0, newHeader.length, 0)
78
- } else if (typeof fd === 'object' && typeof fd.read === 'function') { // FileDescriptor
79
- await fd.write(newHeader, 0, newHeader.length, 0)
80
- }
81
- }
82
- }
83
-
84
- export const __browser = false
@@ -1,4 +0,0 @@
1
- This project is dual licensed under MIT and Apache-2.0.
2
-
3
- MIT: https://www.opensource.org/licenses/mit
4
- Apache-2.0: https://www.apache.org/licenses/license-2.0
@@ -1,80 +0,0 @@
1
- # @ipld/dag-cbor <!-- omit in toc -->
2
-
3
- [![codecov](https://img.shields.io/codecov/c/github/ipld/js-dag-cbor.svg?style=flat-square)](https://codecov.io/gh/ipld/js-dag-cbor)
4
- [![CI](https://img.shields.io/github/workflow/status/ipld/js-dag-cbor/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipld/js-dag-cbor/actions/workflows/js-test-and-release.yml)
5
-
6
- > JS implementation of DAG-CBOR
7
-
8
- ## Table of contents <!-- omit in toc -->
9
-
10
- - [Install](#install)
11
- - [Spec](#spec)
12
- - [License](#license)
13
- - [Contribute](#contribute)
14
-
15
- ## Install
16
-
17
- ```console
18
- $ npm i @ipld/dag-cbor
19
- ```
20
-
21
- This is the *new* interface meant for use by itself or with `multiformats` and
22
- `@ipld/block`. It is not used by `js-ipld-format` which is currently
23
- used in IPFS. That library is [here](https://github.com/ipld/js-ipld-dag-cbor).
24
-
25
- Usage:
26
-
27
- ```javascript
28
- import { encode, decode } from '@ipld/dag-cbor'
29
- import { CID } from 'multiformats'
30
-
31
- const obj = {
32
- x: 1,
33
- /* CID instances are encoded as links */
34
- y: [2, 3, CID.parse('QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4')],
35
- z: {
36
- a: CID.parse('QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4'),
37
- b: null,
38
- c: 'string'
39
- }
40
- }
41
-
42
- let data = encode(obj)
43
- let decoded = decode(data)
44
- decoded.y[0] // 2
45
- CID.asCID(decoded.z.a) // cid instance
46
-
47
- // encode/decode options are exported for use with cborg's encodedLength and decodeFirst
48
- import { encodeOptions, decodeOptions } from '@ipld/dag-cbor'
49
- import { encodedLength } from 'cborg/length'
50
- import { decodeFirst } from 'cborg'
51
-
52
- // dag-cbor encoded length of obj in bytes
53
- const byteLength = encodedLength(obj, encodeOptions)
54
- byteLength // 104
55
-
56
- // concatenate two dag-cbor encoded obj
57
- const concatenatedData = new Uint8Array(data.length * 2)
58
- concatenatedData.set(data)
59
- concatenatedData.set(data, data.length)
60
-
61
- // returns dag-cbor decoded obj at the beginning of the buffer as well as the remaining bytes
62
- const [first, remainder] = decodeFirst(concatenatedData, decodeOptions)
63
- assert.deepStrictEqual(first, obj)
64
- assert.deepStrictEqual(remainder, data)
65
- ```
66
-
67
- ## Spec
68
-
69
- The [`dag-cbor` specification is in the IPLD specs repo](https://github.com/ipld/specs/blob/master/block-layer/codecs/dag-cbor.md).
70
-
71
- ## License
72
-
73
- Licensed under either of
74
-
75
- - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
76
- - MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
77
-
78
- ## Contribute
79
-
80
- Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.