@fireproof/vendor 1.0.4 → 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 (302) 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/promise-fs-opts.d.ts +0 -30
  62. package/src/@ipld/car/dist/src/promise-fs-opts.d.ts.map +0 -1
  63. package/src/@ipld/car/dist/src/reader-browser.d.ts +0 -151
  64. package/src/@ipld/car/dist/src/reader-browser.d.ts.map +0 -1
  65. package/src/@ipld/car/dist/src/reader.d.ts +0 -39
  66. package/src/@ipld/car/dist/src/reader.d.ts.map +0 -1
  67. package/src/@ipld/car/dist/src/writer-browser.d.ts +0 -155
  68. package/src/@ipld/car/dist/src/writer-browser.d.ts.map +0 -1
  69. package/src/@ipld/car/dist/src/writer.d.ts +0 -44
  70. package/src/@ipld/car/dist/src/writer.d.ts.map +0 -1
  71. package/src/@ipld/car/src/api.ts +0 -90
  72. package/src/@ipld/car/src/buffer-decoder.js +0 -213
  73. package/src/@ipld/car/src/buffer-reader-browser.js +0 -144
  74. package/src/@ipld/car/src/buffer-reader.js +0 -51
  75. package/src/@ipld/car/src/buffer-writer.js +0 -286
  76. package/src/@ipld/car/src/coding.ts +0 -68
  77. package/src/@ipld/car/src/decoder-common.js +0 -82
  78. package/src/@ipld/car/src/decoder.js +0 -347
  79. package/src/@ipld/car/src/encoder.js +0 -76
  80. package/src/@ipld/car/src/header-validator.js +0 -214
  81. package/src/@ipld/car/src/header.ipldsch +0 -18
  82. package/src/@ipld/car/src/index-browser.js +0 -18
  83. package/src/@ipld/car/src/index.js +0 -21
  84. package/src/@ipld/car/src/indexed-reader-browser.js +0 -7
  85. package/src/@ipld/car/src/indexed-reader.js +0 -211
  86. package/src/@ipld/car/src/indexer.js +0 -130
  87. package/src/@ipld/car/src/iterator-channel.js +0 -91
  88. package/src/@ipld/car/src/iterator.js +0 -267
  89. package/src/@ipld/car/src/promise-fs-opts.js +0 -42
  90. package/src/@ipld/car/src/reader-browser.js +0 -194
  91. package/src/@ipld/car/src/reader.js +0 -53
  92. package/src/@ipld/car/src/writer-browser.js +0 -250
  93. package/src/@ipld/car/src/writer.js +0 -80
  94. package/src/@ipld/dag-cbor/LICENSE +0 -4
  95. package/src/@ipld/dag-cbor/README.md +0 -80
  96. package/src/@ipld/dag-cbor/dist/index.min.js +0 -3
  97. package/src/@ipld/dag-cbor/dist/src/index.d.ts +0 -67
  98. package/src/@ipld/dag-cbor/dist/src/index.d.ts.map +0 -1
  99. package/src/@ipld/dag-cbor/src/index.js +0 -147
  100. package/src/@ipld/dag-json/LICENSE +0 -4
  101. package/src/@ipld/dag-json/README.md +0 -58
  102. package/src/@ipld/dag-json/dist/index.min.js +0 -3
  103. package/src/@ipld/dag-json/dist/src/index.d.ts +0 -12
  104. package/src/@ipld/dag-json/dist/src/index.d.ts.map +0 -1
  105. package/src/@ipld/dag-json/src/index.js +0 -291
  106. package/src/cborg/.github/dependabot.yml +0 -16
  107. package/src/cborg/.github/workflows/test-and-release.yml +0 -52
  108. package/src/cborg/CHANGELOG.md +0 -513
  109. package/src/cborg/LICENSE +0 -13
  110. package/src/cborg/README.md +0 -515
  111. package/src/cborg/bench/bench.js +0 -117
  112. package/src/cborg/bench/json.js +0 -124
  113. package/src/cborg/bench/package.json +0 -8
  114. package/src/cborg/cborg/bin.js +0 -189
  115. package/src/cborg/cborg/common.js +0 -28
  116. package/src/cborg/cborg/decode.js +0 -211
  117. package/src/cborg/cborg/diagnostic.js +0 -158
  118. package/src/cborg/cborg/diagnostic_test.js +0 -117
  119. package/src/cborg/cborg/encode.js +0 -466
  120. package/src/cborg/cborg/index.js +0 -33
  121. package/src/cborg/cborg/is.js +0 -106
  122. package/src/cborg/cborg/length.js +0 -62
  123. package/src/cborg/example-bytestrings.js +0 -180
  124. package/src/cborg/example-json.js +0 -6
  125. package/src/cborg/example.js +0 -5
  126. package/src/cborg/interface.ts +0 -59
  127. package/src/cborg/json/decode.js +0 -462
  128. package/src/cborg/json/encode.js +0 -302
  129. package/src/cborg/json/json.js +0 -4
  130. package/src/cborg/taglib.js +0 -75
  131. package/src/cborg/test/appendix_a.js +0 -647
  132. package/src/cborg/test/common.js +0 -18
  133. package/src/cborg/test/node-test-bin.js +0 -402
  134. package/src/cborg/test/noop-bin-test.js +0 -3
  135. package/src/cborg/test/test-0uint.js +0 -103
  136. package/src/cborg/test/test-1negint.js +0 -96
  137. package/src/cborg/test/test-2bytes.js +0 -198
  138. package/src/cborg/test/test-3string.js +0 -136
  139. package/src/cborg/test/test-4array.js +0 -93
  140. package/src/cborg/test/test-5map.js +0 -284
  141. package/src/cborg/test/test-6tag.js +0 -84
  142. package/src/cborg/test/test-7float.js +0 -131
  143. package/src/cborg/test/test-bl.js +0 -37
  144. package/src/cborg/test/test-cbor-vectors.js +0 -107
  145. package/src/cborg/test/test-decode-errors.js +0 -65
  146. package/src/cborg/test/test-fuzz.js +0 -42
  147. package/src/cborg/test/test-json.js +0 -219
  148. package/src/cborg/test/test-length.js +0 -65
  149. package/src/cborg/test/test-partial.js +0 -111
  150. package/src/cborg/tsconfig.json +0 -48
  151. package/src/cborg/types/cborg/decode.d.ts +0 -43
  152. package/src/cborg/types/cborg/decode.d.ts.map +0 -1
  153. package/src/cborg/types/cborg/encode.d.ts +0 -51
  154. package/src/cborg/types/cborg/encode.d.ts.map +0 -1
  155. package/src/cborg/types/cborg/index.d.ts +0 -26
  156. package/src/cborg/types/cborg/index.d.ts.map +0 -1
  157. package/src/cborg/types/cborg/is.d.ts +0 -6
  158. package/src/cborg/types/cborg/is.d.ts.map +0 -1
  159. package/src/cborg/types/example.d.ts +0 -2
  160. package/src/cborg/types/example.d.ts.map +0 -1
  161. package/src/cborg/types/interface.d.ts +0 -49
  162. package/src/cborg/types/interface.d.ts.map +0 -1
  163. package/src/cborg/types/json/decode.d.ts +0 -67
  164. package/src/cborg/types/json/decode.d.ts.map +0 -1
  165. package/src/cborg/types/json/encode.d.ts +0 -11
  166. package/src/cborg/types/json/encode.d.ts.map +0 -1
  167. package/src/cborg/types/json/json.d.ts +0 -6
  168. package/src/cborg/types/json/json.d.ts.map +0 -1
  169. package/src/cborg/types/taglib.d.ts +0 -18
  170. package/src/cborg/types/taglib.d.ts.map +0 -1
  171. package/src/cborg/types/tsconfig.tsbuildinfo +0 -1
  172. package/src/cborg/types/utils/0uint.d.ts +0 -102
  173. package/src/cborg/types/utils/0uint.d.ts.map +0 -1
  174. package/src/cborg/types/utils/1negint.d.ts +0 -59
  175. package/src/cborg/types/utils/1negint.d.ts.map +0 -1
  176. package/src/cborg/types/utils/2bytes.d.ts +0 -69
  177. package/src/cborg/types/utils/2bytes.d.ts.map +0 -1
  178. package/src/cborg/types/utils/3string.d.ts +0 -46
  179. package/src/cborg/types/utils/3string.d.ts.map +0 -1
  180. package/src/cborg/types/utils/4array.d.ts +0 -66
  181. package/src/cborg/types/utils/4array.d.ts.map +0 -1
  182. package/src/cborg/types/utils/5map.d.ts +0 -66
  183. package/src/cborg/types/utils/5map.d.ts.map +0 -1
  184. package/src/cborg/types/utils/6tag.d.ts +0 -62
  185. package/src/cborg/types/utils/6tag.d.ts.map +0 -1
  186. package/src/cborg/types/utils/7float.d.ts +0 -60
  187. package/src/cborg/types/utils/7float.d.ts.map +0 -1
  188. package/src/cborg/types/utils/bl.d.ts +0 -26
  189. package/src/cborg/types/utils/bl.d.ts.map +0 -1
  190. package/src/cborg/types/utils/byte-utils.d.ts +0 -53
  191. package/src/cborg/types/utils/byte-utils.d.ts.map +0 -1
  192. package/src/cborg/types/utils/common.d.ts +0 -8
  193. package/src/cborg/types/utils/common.d.ts.map +0 -1
  194. package/src/cborg/types/utils/index.d.ts +0 -13
  195. package/src/cborg/types/utils/index.d.ts.map +0 -1
  196. package/src/cborg/types/utils/jump.d.ts +0 -16
  197. package/src/cborg/types/utils/jump.d.ts.map +0 -1
  198. package/src/cborg/types/utils/token.d.ts +0 -59
  199. package/src/cborg/types/utils/token.d.ts.map +0 -1
  200. package/src/cborg/utils/0uint.js +0 -229
  201. package/src/cborg/utils/1negint.js +0 -111
  202. package/src/cborg/utils/2bytes.js +0 -135
  203. package/src/cborg/utils/3string.js +0 -90
  204. package/src/cborg/utils/4array.js +0 -114
  205. package/src/cborg/utils/5map.js +0 -113
  206. package/src/cborg/utils/6tag.js +0 -81
  207. package/src/cborg/utils/7float.js +0 -310
  208. package/src/cborg/utils/bl.js +0 -124
  209. package/src/cborg/utils/byte-utils.js +0 -417
  210. package/src/cborg/utils/common.js +0 -11
  211. package/src/cborg/utils/index.js +0 -12
  212. package/src/cborg/utils/jump.js +0 -222
  213. package/src/cborg/utils/token.js +0 -76
  214. package/src/ipfs-unixfs-exporter/LICENSE +0 -4
  215. package/src/ipfs-unixfs-exporter/README.md +0 -105
  216. package/src/ipfs-unixfs-exporter/dist/index.min.js +0 -3
  217. package/src/ipfs-unixfs-exporter/dist/src/errors.d.ts +0 -57
  218. package/src/ipfs-unixfs-exporter/dist/src/errors.d.ts.map +0 -1
  219. package/src/ipfs-unixfs-exporter/dist/src/errors.js +0 -73
  220. package/src/ipfs-unixfs-exporter/dist/src/errors.js.map +0 -1
  221. package/src/ipfs-unixfs-exporter/dist/src/index.d.ts +0 -355
  222. package/src/ipfs-unixfs-exporter/dist/src/index.d.ts.map +0 -1
  223. package/src/ipfs-unixfs-exporter/dist/src/index.js +0 -197
  224. package/src/ipfs-unixfs-exporter/dist/src/index.js.map +0 -1
  225. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.d.ts +0 -4
  226. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.d.ts.map +0 -1
  227. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.js +0 -9
  228. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.js.map +0 -1
  229. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.d.ts +0 -4
  230. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.d.ts.map +0 -1
  231. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.js +0 -9
  232. package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.js.map +0 -1
  233. package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.d.ts +0 -4
  234. package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.d.ts.map +0 -1
  235. package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.js +0 -38
  236. package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.js.map +0 -1
  237. package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.d.ts +0 -4
  238. package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.d.ts.map +0 -1
  239. package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.js +0 -30
  240. package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.js.map +0 -1
  241. package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.d.ts +0 -4
  242. package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.d.ts.map +0 -1
  243. package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.js +0 -9
  244. package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.js.map +0 -1
  245. package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.d.ts +0 -4
  246. package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.d.ts.map +0 -1
  247. package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.js +0 -37
  248. package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.js.map +0 -1
  249. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.d.ts +0 -4
  250. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.d.ts.map +0 -1
  251. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.js +0 -29
  252. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.js.map +0 -1
  253. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.d.ts +0 -4
  254. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.d.ts.map +0 -1
  255. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.js +0 -153
  256. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.js.map +0 -1
  257. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.d.ts +0 -4
  258. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.d.ts.map +0 -1
  259. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.js +0 -59
  260. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.js.map +0 -1
  261. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.d.ts +0 -4
  262. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.d.ts.map +0 -1
  263. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.js +0 -25
  264. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.js.map +0 -1
  265. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.d.ts +0 -4
  266. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.d.ts.map +0 -1
  267. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.js +0 -104
  268. package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.js.map +0 -1
  269. package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.d.ts +0 -3
  270. package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.d.ts.map +0 -1
  271. package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.js +0 -20
  272. package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.js.map +0 -1
  273. package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.d.ts +0 -6
  274. package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.d.ts.map +0 -1
  275. package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.js +0 -116
  276. package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.js.map +0 -1
  277. package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.d.ts +0 -4
  278. package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.d.ts.map +0 -1
  279. package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.js +0 -57
  280. package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.js.map +0 -1
  281. package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.d.ts +0 -6
  282. package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.d.ts.map +0 -1
  283. package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.js +0 -30
  284. package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.js.map +0 -1
  285. package/src/ipfs-unixfs-exporter/dist/typedoc-urls.json +0 -58
  286. package/src/ipfs-unixfs-exporter/src/errors.ts +0 -87
  287. package/src/ipfs-unixfs-exporter/src/index.ts +0 -498
  288. package/src/ipfs-unixfs-exporter/src/resolvers/dag-cbor.ts +0 -12
  289. package/src/ipfs-unixfs-exporter/src/resolvers/dag-json.ts +0 -12
  290. package/src/ipfs-unixfs-exporter/src/resolvers/identity.ts +0 -49
  291. package/src/ipfs-unixfs-exporter/src/resolvers/index.ts +0 -35
  292. package/src/ipfs-unixfs-exporter/src/resolvers/json.ts +0 -12
  293. package/src/ipfs-unixfs-exporter/src/resolvers/raw.ts +0 -49
  294. package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/directory.ts +0 -39
  295. package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/file.ts +0 -198
  296. package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/hamt-sharded-directory.ts +0 -76
  297. package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/raw.ts +0 -37
  298. package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/index.ts +0 -121
  299. package/src/ipfs-unixfs-exporter/src/utils/extract-data-from-block.ts +0 -24
  300. package/src/ipfs-unixfs-exporter/src/utils/find-cid-in-shard.ts +0 -149
  301. package/src/ipfs-unixfs-exporter/src/utils/resolve-object-path.ts +0 -62
  302. package/src/ipfs-unixfs-exporter/src/utils/validate-offset-and-length.ts +0 -38
@@ -1,124 +0,0 @@
1
- // can be run in a browser with `polendina --runner=bare-sync --timeout 6000 --cleanup bench.js`
2
- // with additional dependencies for cborg installed here
3
-
4
- import assert from 'assert'
5
- import { garbage } from 'ipld-garbage'
6
- import { decode, encode } from '../lib/json/json.js'
7
-
8
- let writebuf = ''
9
- const write = process.stdout
10
- ? process.stdout.write.bind(process.stdout)
11
- : (str) => {
12
- writebuf += str
13
- if (str.endsWith('\n')) {
14
- console.log(writebuf.replace(/\n$/, ''))
15
- writebuf = ''
16
- }
17
- }
18
-
19
- const textEncoder = new TextEncoder()
20
- const textDecoder = new TextDecoder()
21
-
22
- function jencode (obj) {
23
- return textEncoder.encode(JSON.stringify(obj))
24
- }
25
-
26
- function jdecode (buf) {
27
- return JSON.parse(textDecoder.decode(buf))
28
- }
29
-
30
- function runWith (description, count, targetTime, size, options) {
31
- const fixtures = []
32
-
33
- console.log(`${description} @ ${count.toLocaleString()}`)
34
- for (let i = 0; i < count; i++) {
35
- const obj = garbage(size, options)
36
- const cbyts = encode(obj)
37
- /*
38
- const jbyts = jencode(obj)
39
- if (Buffer.compare(Buffer.from(cbyts), jbyts) !== 0) {
40
- console.log(`mismatch for obj: ${JSON.stringify(obj)}`)
41
- console.log('\tc> ', Buffer.from(cbyts).toString('utf8'))
42
- console.log('\tj> ', Buffer.from(jbyts).toString('utf8'))
43
- }
44
- */
45
- if (cbyts.length <= size * 2) {
46
- fixtures.push([obj, cbyts])
47
- }
48
- }
49
- const avgSize = Math.round(fixtures.reduce((p, c) => p + c[1].length, 0) / fixtures.length)
50
-
51
- const enc = (encoder) => {
52
- for (const [obj, byts] of fixtures) {
53
- const ebyts = encoder(obj)
54
- if (byts.length !== ebyts.length) {
55
- throw new Error('bork')
56
- }
57
- }
58
- return fixtures.length
59
- }
60
-
61
- const bench = (bfn) => {
62
- const start = Date.now()
63
- let opcount = 0
64
- do {
65
- opcount += bfn()
66
- } while (Date.now() - start < targetTime)
67
- const ops = Math.round(opcount / ((Date.now() - start) / 1000))
68
- return ops
69
- }
70
-
71
- const dec = (decoder) => {
72
- for (const [obj, byts] of fixtures) {
73
- let cobj
74
- try {
75
- cobj = decoder(byts)
76
- } catch (e) {
77
- console.log('Failed to decode:', Buffer.from(byts).toString('utf8'))
78
- throw e
79
- }
80
- if (obj != null && typeof obj === 'object') {
81
- assert.deepStrictEqual(Object.keys(cobj).length, Object.keys(obj).length)
82
- } else {
83
- assert.deepStrictEqual(obj, cobj)
84
- }
85
- }
86
- return fixtures.length
87
- }
88
-
89
- const cmp = (desc, cbfn, bofn) => {
90
- write(`\t${desc} (avg ${avgSize.toLocaleString()} b):`)
91
- const cborgOps = bench(cbfn)
92
- write(` cborg @ ${cborgOps.toLocaleString()} op/s`)
93
- const jOps = bench(bofn)
94
- write(` / JSON @ ${jOps.toLocaleString()} op/s`)
95
- const percent = Math.round((cborgOps / jOps) * 1000) / 10
96
- write(` = ${(percent).toLocaleString()} %\n`)
97
- return percent
98
- }
99
-
100
- return [
101
- cmp('encode', () => enc(encode), () => enc(jencode)),
102
- cmp('decode', () => dec(decode), () => dec(jdecode))
103
- ]
104
- }
105
-
106
- const targetTime = 1000
107
- const accum = []
108
- accum.push(runWith('rnd-100', 1000, targetTime, 100, { weights: { CID: 0, bytes: 0 } }))
109
- accum.push(runWith('rnd-300', 1000, targetTime, 300, { weights: { CID: 0, bytes: 0 } }))
110
- accum.push(runWith('rnd-nomap-300', 1000, targetTime, 300, { weights: { CID: 0, bytes: 0, map: 0 } }))
111
- accum.push(runWith('rnd-nolist-300', 1000, targetTime, 300, { weights: { CID: 0, bytes: 0, list: 0 } }))
112
- accum.push(runWith('rnd-nofloat-300', 1000, targetTime, 300, { weights: { CID: 0, bytes: 0, float: 0 } }))
113
- accum.push(runWith('rnd-nomaj7-300', 1000, targetTime, 300, { weights: { CID: 0, bytes: 0, float: 0, null: 0, boolean: 0 } }))
114
- accum.push(runWith('rnd-nostr-300', 1000, targetTime, 300, { weights: { CID: 0, bytes: 0, string: 0 } }))
115
- accum.push(runWith('rnd-nostrbyts-300', 1000, targetTime, 300, { weights: { CID: 0, bytes: 0, string: 0 } }))
116
- accum.push(runWith('rnd-1000', 1000, targetTime, 1000, { weights: { CID: 0, bytes: 0 } }))
117
- accum.push(runWith('rnd-2000', 1000, targetTime, 2000, { weights: { CID: 0, bytes: 0 } }))
118
- accum.push(runWith('rnd-fil-100', 1000, targetTime, 100, { weights: { float: 0, map: 0, CID: 0, bytes: 0 } }))
119
- accum.push(runWith('rnd-fil-300', 1000, targetTime, 300, { weights: { float: 0, map: 0, CID: 0, bytes: 0 } }))
120
- accum.push(runWith('rnd-fil-500', 1000, targetTime, 500, { weights: { float: 0, map: 0, CID: 0, bytes: 0 } }))
121
- accum.push(runWith('rnd-fil-1000', 1000, targetTime, 1000, { weights: { float: 0, map: 0, CID: 0, bytes: 0 } }))
122
- accum.push(runWith('rnd-fil-2000', 1000, targetTime, 2000, { weights: { float: 0, map: 0, CID: 0, bytes: 0 } }))
123
- console.log(`Avg encode: ${Math.round(accum.reduce((p, c) => p + c[0], 0) / accum.length).toLocaleString()} %`)
124
- console.log(`Avg decode: ${Math.round(accum.reduce((p, c) => p + c[1], 0) / accum.length).toLocaleString()} %`)
@@ -1,8 +0,0 @@
1
- {
2
- "name": "cborg-bench",
3
- "type": "module",
4
- "dependencies": {
5
- "borc": "^2.1.2",
6
- "ipld-garbage": "^3.0.3"
7
- }
8
- }
@@ -1,189 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import process from 'process'
4
- import { decode, encode } from "@fireproof/vendor/cborg"
5
- import { tokensToDiagnostic, fromDiag } from './diagnostic.js'
6
- import { fromHex as _fromHex, toHex } from "@fireproof/vendor/cborg/utils"
7
-
8
- /**
9
- * @param {number} code
10
- */
11
- function usage (code) {
12
- console.error('Usage: cborg <command> <args>')
13
- console.error('Valid commands:')
14
- console.error('\tbin2diag [--width <width>] [binary input]')
15
- console.error('\tbin2hex [binary input]')
16
- console.error('\tbin2json [--pretty] [binary input]')
17
- console.error('\tdiag2bin [diagnostic input]')
18
- console.error('\tdiag2hex [diagnostic input]')
19
- console.error('\tdiag2json [--pretty] [diagnostic input]')
20
- console.error('\thex2bin [hex input]')
21
- console.error('\thex2diag [--width <width>] [hex input]')
22
- console.error('\thex2json [--pretty] [hex input]')
23
- console.error('\tjson2bin \'[json input]\'')
24
- console.error('\tjson2diag [--width <width>] \'[json input]\'')
25
- console.error('\tjson2hex \'[json input]\'')
26
- console.error('Input may either be supplied as an argument or piped via stdin')
27
- process.exit(code || 0)
28
- }
29
-
30
- async function fromStdin () {
31
- const chunks = []
32
- for await (const chunk of process.stdin) {
33
- chunks.push(chunk)
34
- }
35
- return Buffer.concat(chunks)
36
- }
37
-
38
- /**
39
- * @param {string} str
40
- * @returns {Uint8Array}
41
- */
42
- function fromHex (str) {
43
- str = str.replace(/\r?\n/g, '') // let's be charitable
44
- /* c8 ignore next 3 */
45
- if (!(/^([0-9a-f]{2})*$/i).test(str)) {
46
- throw new Error('Input string is not hexadecimal format')
47
- }
48
- return _fromHex(str)
49
- }
50
-
51
- function argvPretty () {
52
- const argv = process.argv.filter((s) => s !== '--pretty')
53
- const pretty = argv.length !== process.argv.length
54
- return { argv, pretty }
55
- }
56
-
57
- function argvWidth () {
58
- const widthIndex = process.argv.findIndex((s) => s === '--width')
59
- if (widthIndex <= 0 || widthIndex + 1 >= process.argv.length) {
60
- return { argv: process.argv.filter((s) => s !== '--width'), width: undefined }
61
- }
62
- const width = parseInt(process.argv[widthIndex + 1], 10)
63
- if (!width || width < 20) {
64
- return { argv: process.argv.filter((s) => s !== '--width'), width: undefined }
65
- }
66
- const argv = process.argv
67
- argv.splice(widthIndex, 2)
68
- return { argv, width }
69
- }
70
-
71
- async function run () {
72
- const cmd = process.argv[2]
73
-
74
- switch (cmd) {
75
- case 'help': {
76
- return usage(0)
77
- }
78
-
79
- case 'bin2diag': {
80
- /* c8 ignore next 1 */
81
- const { argv, width } = argvWidth()
82
- const bin = argv.length < 4 ? (await fromStdin()) : new TextEncoder().encode(argv[3])
83
- for (const line of tokensToDiagnostic(bin, width)) {
84
- console.log(line)
85
- }
86
- return
87
- }
88
-
89
- case 'bin2hex': {
90
- // this is really nothing to do with cbor.. just handy
91
- /* c8 ignore next 1 */
92
- const bin = process.argv.length < 4 ? (await fromStdin()) : new TextEncoder().encode(process.argv[3])
93
- return console.log(toHex(bin))
94
- }
95
-
96
- case 'bin2json': {
97
- const { argv, pretty } = argvPretty()
98
- /* c8 ignore next 1 */
99
- const bin = argv.length < 4 ? (await fromStdin()) : new TextEncoder().encode(argv[3])
100
- return console.log(JSON.stringify(decode(bin), undefined, pretty ? 2 : undefined))
101
- }
102
-
103
- case 'diag2bin': {
104
- // no coverage on windows for non-stdin input
105
- /* c8 ignore next 1 */
106
- const bin = fromDiag(process.argv.length < 4 ? (await fromStdin()).toString() : process.argv[3])
107
- return process.stdout.write(bin)
108
- }
109
-
110
- case 'diag2hex': {
111
- // no coverage on windows for non-stdin input
112
- /* c8 ignore next 1 */
113
- const bin = fromDiag(process.argv.length < 4 ? (await fromStdin()).toString() : process.argv[3])
114
- return console.log(toHex(bin))
115
- }
116
-
117
- case 'diag2json': {
118
- const { argv, pretty } = argvPretty()
119
- // no coverage on windows for non-stdin input
120
- /* c8 ignore next 1 */
121
- const bin = fromDiag(argv.length < 4 ? (await fromStdin()).toString() : argv[3])
122
- return console.log(JSON.stringify(decode(bin), undefined, pretty ? 2 : undefined))
123
- }
124
-
125
- case 'hex2bin': {
126
- // this is really nothing to do with cbor.. just handy
127
- const bin = fromHex(process.argv.length < 4 ? (await fromStdin()).toString() : process.argv[3])
128
- return process.stdout.write(bin)
129
- }
130
-
131
- case 'hex2diag': {
132
- const { argv, width } = argvWidth()
133
- const bin = fromHex(argv.length < 4 ? (await fromStdin()).toString() : argv[3])
134
- for (const line of tokensToDiagnostic(bin, width)) {
135
- console.log(line)
136
- }
137
- return
138
- }
139
-
140
- case 'hex2json': {
141
- const { argv, pretty } = argvPretty()
142
- const bin = fromHex(argv.length < 4 ? (await fromStdin()).toString() : argv[3])
143
- return console.log(JSON.stringify(decode(bin), undefined, pretty ? 2 : undefined))
144
- }
145
-
146
- case 'json2bin': {
147
- const inp = process.argv.length < 4 ? (await fromStdin()).toString() : process.argv[3]
148
- const obj = JSON.parse(inp)
149
- return process.stdout.write(encode(obj))
150
- }
151
-
152
- case 'json2diag': {
153
- const { argv, width } = argvWidth()
154
- const inp = argv.length < 4 ? (await fromStdin()).toString() : argv[3]
155
- const obj = JSON.parse(inp)
156
- for (const line of tokensToDiagnostic(encode(obj), width)) {
157
- console.log(line)
158
- }
159
- return
160
- }
161
-
162
- case 'json2hex': {
163
- const inp = process.argv.length < 4 ? (await fromStdin()).toString() : process.argv[3]
164
- const obj = JSON.parse(inp)
165
- return console.log(toHex(encode(obj)))
166
- }
167
-
168
- default: { // no, or unknown cmd
169
- // this is a dirty hack to allow import of this package by the tests
170
- // for inclusion in ipjs bundling, but to silently ignore it so we don't
171
- // print usage and exit(1).
172
- if (process.argv.findIndex((a) => a.endsWith('mocha')) === -1) {
173
- if (cmd) {
174
- console.error(`Unknown command: '${cmd}'`)
175
- }
176
- usage(1)
177
- }
178
- }
179
- }
180
- }
181
-
182
- run().catch((err) => {
183
- /* c8 ignore next 2 */
184
- console.error(err)
185
- process.exit(1)
186
- })
187
-
188
- // for ipjs, to get it to compile
189
- export default true
@@ -1,28 +0,0 @@
1
- // const decodeErrPrefix = 'CBOR decode error:'
2
- // const encodeErrPrefix = 'CBOR encode error:'
3
-
4
- const uintMinorPrefixBytes = []
5
- uintMinorPrefixBytes[23] = 1
6
- uintMinorPrefixBytes[24] = 2
7
- uintMinorPrefixBytes[25] = 3
8
- uintMinorPrefixBytes[26] = 5
9
- uintMinorPrefixBytes[27] = 9
10
-
11
- // /**
12
- // * @param {Uint8Array} data
13
- // * @param {number} pos
14
- // * @param {number} need
15
- // * @param {string} decodeErrPrefix
16
- // */
17
- // function assertEnoughData (data, pos, need, decodeErrPrefix) {
18
- // if (data.length - pos < need) {
19
- // throw new Error(`${decodeErrPrefix} not enough data for type`)
20
- // }
21
- // }
22
-
23
- export {
24
- // decodeErrPrefix,
25
- // encodeErrPrefix,
26
- uintMinorPrefixBytes
27
- // assertEnoughData
28
- }
@@ -1,211 +0,0 @@
1
- import { jump, quick, Type } from "@fireproof/vendor/cborg/utils"
2
-
3
- /**
4
- * @typedef {import('cborg/utils').Token} Token
5
- * @typedef {import('../interface').DecodeOptions} DecodeOptions
6
- * @typedef {import('../interface').DecodeTokenizer} DecodeTokenizer
7
- * @typedef {import('../interface').DecodeFunction} DecodeFunction
8
- */
9
-
10
- const /** @type {DecodeOptions} */defaultDecodeOptions = {
11
- strict: false,
12
- allowIndefinite: true,
13
- allowUndefined: true,
14
- allowBigInt: true,
15
- decodeErrPrefix: 'CBOR decode error:'
16
- }
17
-
18
- /**
19
- * @implements {DecodeTokenizer}
20
- */
21
- class Tokeniser {
22
- /**
23
- * @param {Uint8Array} data
24
- * @param {DecodeOptions} options
25
- */
26
- constructor (data, options) {
27
- this._pos = 0
28
- this.data = data
29
- this.options = options
30
- this.jump = jump(options.decodeErrPrefix)
31
- }
32
-
33
- pos () {
34
- return this._pos
35
- }
36
-
37
- done () {
38
- return this._pos >= this.data.length
39
- }
40
-
41
- next () {
42
- const byt = this.data[this._pos]
43
- let token = quick[byt]
44
- if (token === undefined) {
45
- const decoder = this.jump[byt]
46
- /* c8 ignore next 4 */
47
- // if we're here then there's something wrong with our jump or quick lists!
48
- if (!decoder) {
49
- throw new Error(`${this.options.decodeErrPrefix} no decoder for major type ${byt >>> 5} (byte 0x${byt.toString(16).padStart(2, '0')})`)
50
- }
51
- const minor = byt & 31
52
- token = decoder(this.data, this._pos, minor, this.options)
53
- }
54
- // @ts-ignore we get to assume encodedLength is set (crossing fingers slightly)
55
- this._pos += token.encodedLength
56
- return token
57
- }
58
- }
59
-
60
- const DONE = Symbol.for('DONE')
61
- const BREAK = Symbol.for('BREAK')
62
-
63
- /**
64
- * @param {Token} token
65
- * @param {DecodeTokenizer} tokeniser
66
- * @param {DecodeOptions} options
67
- * @returns {any|BREAK|DONE}
68
- */
69
- function tokenToArray (token, tokeniser, options) {
70
- const arr = []
71
- for (let i = 0; i < token.value; i++) {
72
- const value = tokensToObject(tokeniser, options)
73
- if (value === BREAK) {
74
- if (token.value === Infinity) {
75
- // normal end to indefinite length array
76
- break
77
- }
78
- throw new Error(`${options.decodeErrPrefix} got unexpected break to lengthed array`)
79
- }
80
- if (value === DONE) {
81
- throw new Error(`${options.decodeErrPrefix} found array but not enough entries (got ${i}, expected ${token.value})`)
82
- }
83
- arr[i] = value
84
- }
85
- return arr
86
- }
87
-
88
- /**
89
- * @param {Token} token
90
- * @param {DecodeTokenizer} tokeniser
91
- * @param {DecodeOptions} options
92
- * @returns {any|BREAK|DONE}
93
- */
94
- function tokenToMap (token, tokeniser, options) {
95
- const useMaps = options.useMaps === true
96
- const obj = useMaps ? undefined : {}
97
- const m = useMaps ? new Map() : undefined
98
- for (let i = 0; i < token.value; i++) {
99
- const key = tokensToObject(tokeniser, options)
100
- if (key === BREAK) {
101
- if (token.value === Infinity) {
102
- // normal end to indefinite length map
103
- break
104
- }
105
- throw new Error(`${options.decodeErrPrefix} got unexpected break to lengthed map`)
106
- }
107
- if (key === DONE) {
108
- throw new Error(`${options.decodeErrPrefix} found map but not enough entries (got ${i} [no key], expected ${token.value})`)
109
- }
110
- if (useMaps !== true && typeof key !== 'string') {
111
- throw new Error(`${options.decodeErrPrefix} non-string keys not supported (got ${typeof key})`)
112
- }
113
- if (options.rejectDuplicateMapKeys === true) {
114
- // @ts-ignore
115
- if ((useMaps && m.has(key)) || (!useMaps && (key in obj))) {
116
- throw new Error(`${options.decodeErrPrefix} found repeat map key "${key}"`)
117
- }
118
- }
119
- const value = tokensToObject(tokeniser, options)
120
- if (value === DONE) {
121
- throw new Error(`${options.decodeErrPrefix} found map but not enough entries (got ${i} [no value], expected ${token.value})`)
122
- }
123
- if (useMaps) {
124
- // @ts-ignore TODO reconsider this .. maybe needs to be strict about key types
125
- m.set(key, value)
126
- } else {
127
- // @ts-ignore TODO reconsider this .. maybe needs to be strict about key types
128
- obj[key] = value
129
- }
130
- }
131
- // @ts-ignore c'mon man
132
- return useMaps ? m : obj
133
- }
134
-
135
- /**
136
- * @param {DecodeTokenizer} tokeniser
137
- * @param {DecodeOptions} options
138
- * @returns {any|BREAK|DONE}
139
- */
140
- function tokensToObject (tokeniser, options) {
141
- // should we support array as an argument?
142
- // check for tokenIter[Symbol.iterator] and replace tokenIter with what that returns?
143
- if (tokeniser.done()) {
144
- return DONE
145
- }
146
-
147
- const token = tokeniser.next()
148
-
149
- if (token.type.equals(Type.break)) {
150
- return BREAK
151
- }
152
-
153
- if (token.type.terminal) {
154
- return token.value
155
- }
156
-
157
- if (token.type.equals(Type.array)) {
158
- return tokenToArray(token, tokeniser, options)
159
- }
160
-
161
- if (token.type.equals(Type.map)) {
162
- return tokenToMap(token, tokeniser, options)
163
- }
164
-
165
- if (token.type.equals(Type.tag)) {
166
- if (options.tags && typeof options.tags[token.value] === 'function') {
167
- const tagged = tokensToObject(tokeniser, options)
168
- return options.tags[token.value](tagged)
169
- }
170
- throw new Error(`${options.decodeErrPrefix} tag not supported (${token.value})`)
171
- }
172
- /* c8 ignore next */
173
- throw new Error('unsupported')
174
- }
175
-
176
- /**
177
- * @param {Uint8Array} data
178
- * @param {DecodeOptions} [options]
179
- * @returns {[any, Uint8Array]}
180
- */
181
- function decodeFirst (data, options) {
182
- options = Object.assign({}, defaultDecodeOptions, options)
183
- if (!(data instanceof Uint8Array)) {
184
- throw new Error(`${options.decodeErrPrefix} data to decode must be a Uint8Array`)
185
- }
186
- const tokeniser = options.tokenizer || new Tokeniser(data, options)
187
- const decoded = tokensToObject(tokeniser, options)
188
- if (decoded === DONE) {
189
- throw new Error(`${options.decodeErrPrefix} did not find any content to decode`)
190
- }
191
- if (decoded === BREAK) {
192
- throw new Error(`${options.decodeErrPrefix} got unexpected break`)
193
- }
194
- return [decoded, data.subarray(tokeniser.pos())]
195
- }
196
-
197
- /**
198
- * @param {Uint8Array} data
199
- * @param {DecodeOptions} [options]
200
- * @returns {any}
201
- */
202
- function decode (data, options) {
203
- options = Object.assign({}, defaultDecodeOptions, options)
204
- const [decoded, remainder] = decodeFirst(data, options)
205
- if (remainder.length > 0) {
206
- throw new Error(`${options.decodeErrPrefix} too many terminals, data makes no sense:${remainder.length}`)
207
- }
208
- return decoded
209
- }
210
-
211
- export { Tokeniser, tokensToObject, decode, decodeFirst }