@backblaze-labs/b2-sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (512) hide show
  1. package/CHANGELOG.md +121 -0
  2. package/LICENSE +21 -0
  3. package/README.md +664 -0
  4. package/dist/auth/account-info.d.cts +51 -0
  5. package/dist/auth/account-info.d.cts.map +1 -0
  6. package/dist/auth/account-info.d.ts +51 -0
  7. package/dist/auth/account-info.d.ts.map +1 -0
  8. package/dist/auth/file.cjs +210 -0
  9. package/dist/auth/file.cjs.map +1 -0
  10. package/dist/auth/file.d.cts +157 -0
  11. package/dist/auth/file.d.cts.map +1 -0
  12. package/dist/auth/file.d.ts +157 -0
  13. package/dist/auth/file.d.ts.map +1 -0
  14. package/dist/auth/file.js +210 -0
  15. package/dist/auth/file.js.map +1 -0
  16. package/dist/auth/in-memory.cjs +184 -0
  17. package/dist/auth/in-memory.cjs.map +1 -0
  18. package/dist/auth/in-memory.d.cts +147 -0
  19. package/dist/auth/in-memory.d.cts.map +1 -0
  20. package/dist/auth/in-memory.d.ts +147 -0
  21. package/dist/auth/in-memory.d.ts.map +1 -0
  22. package/dist/auth/in-memory.js +184 -0
  23. package/dist/auth/in-memory.js.map +1 -0
  24. package/dist/auth/index.cjs +10 -0
  25. package/dist/auth/index.cjs.map +1 -0
  26. package/dist/auth/index.d.cts +6 -0
  27. package/dist/auth/index.d.cts.map +1 -0
  28. package/dist/auth/index.d.ts +6 -0
  29. package/dist/auth/index.d.ts.map +1 -0
  30. package/dist/auth/index.js +10 -0
  31. package/dist/auth/index.js.map +1 -0
  32. package/dist/auth/realms.cjs +12 -0
  33. package/dist/auth/realms.cjs.map +1 -0
  34. package/dist/auth/realms.d.cts +12 -0
  35. package/dist/auth/realms.d.cts.map +1 -0
  36. package/dist/auth/realms.d.ts +12 -0
  37. package/dist/auth/realms.d.ts.map +1 -0
  38. package/dist/auth/realms.js +12 -0
  39. package/dist/auth/realms.js.map +1 -0
  40. package/dist/auth/upload-url-pool.cjs +52 -0
  41. package/dist/auth/upload-url-pool.cjs.map +1 -0
  42. package/dist/auth/upload-url-pool.d.cts +35 -0
  43. package/dist/auth/upload-url-pool.d.cts.map +1 -0
  44. package/dist/auth/upload-url-pool.d.ts +35 -0
  45. package/dist/auth/upload-url-pool.d.ts.map +1 -0
  46. package/dist/auth/upload-url-pool.js +52 -0
  47. package/dist/auth/upload-url-pool.js.map +1 -0
  48. package/dist/bucket.cjs +789 -0
  49. package/dist/bucket.cjs.map +1 -0
  50. package/dist/bucket.d.cts +659 -0
  51. package/dist/bucket.d.cts.map +1 -0
  52. package/dist/bucket.d.ts +659 -0
  53. package/dist/bucket.d.ts.map +1 -0
  54. package/dist/bucket.js +789 -0
  55. package/dist/bucket.js.map +1 -0
  56. package/dist/client.cjs +230 -0
  57. package/dist/client.cjs.map +1 -0
  58. package/dist/client.d.cts +222 -0
  59. package/dist/client.d.cts.map +1 -0
  60. package/dist/client.d.ts +222 -0
  61. package/dist/client.d.ts.map +1 -0
  62. package/dist/client.js +230 -0
  63. package/dist/client.js.map +1 -0
  64. package/dist/copy/large.cjs +74 -0
  65. package/dist/copy/large.cjs.map +1 -0
  66. package/dist/copy/large.d.cts +53 -0
  67. package/dist/copy/large.d.cts.map +1 -0
  68. package/dist/copy/large.d.ts +53 -0
  69. package/dist/copy/large.d.ts.map +1 -0
  70. package/dist/copy/large.js +74 -0
  71. package/dist/copy/large.js.map +1 -0
  72. package/dist/download/parallel.cjs +122 -0
  73. package/dist/download/parallel.cjs.map +1 -0
  74. package/dist/download/parallel.d.cts +42 -0
  75. package/dist/download/parallel.d.cts.map +1 -0
  76. package/dist/download/parallel.d.ts +42 -0
  77. package/dist/download/parallel.d.ts.map +1 -0
  78. package/dist/download/parallel.js +122 -0
  79. package/dist/download/parallel.js.map +1 -0
  80. package/dist/download/single.cjs +117 -0
  81. package/dist/download/single.cjs.map +1 -0
  82. package/dist/download/single.d.cts +152 -0
  83. package/dist/download/single.d.cts.map +1 -0
  84. package/dist/download/single.d.ts +152 -0
  85. package/dist/download/single.d.ts.map +1 -0
  86. package/dist/download/single.js +117 -0
  87. package/dist/download/single.js.map +1 -0
  88. package/dist/errors/index.cjs +268 -0
  89. package/dist/errors/index.cjs.map +1 -0
  90. package/dist/errors/index.d.cts +264 -0
  91. package/dist/errors/index.d.cts.map +1 -0
  92. package/dist/errors/index.d.ts +264 -0
  93. package/dist/errors/index.d.ts.map +1 -0
  94. package/dist/errors/index.js +268 -0
  95. package/dist/errors/index.js.map +1 -0
  96. package/dist/http/retry.cjs +36 -0
  97. package/dist/http/retry.cjs.map +1 -0
  98. package/dist/http/retry.d.cts +34 -0
  99. package/dist/http/retry.d.cts.map +1 -0
  100. package/dist/http/retry.d.ts +34 -0
  101. package/dist/http/retry.d.ts.map +1 -0
  102. package/dist/http/retry.js +36 -0
  103. package/dist/http/retry.js.map +1 -0
  104. package/dist/http/transport.cjs +143 -0
  105. package/dist/http/transport.cjs.map +1 -0
  106. package/dist/http/transport.d.cts +122 -0
  107. package/dist/http/transport.d.cts.map +1 -0
  108. package/dist/http/transport.d.ts +122 -0
  109. package/dist/http/transport.d.ts.map +1 -0
  110. package/dist/http/transport.js +143 -0
  111. package/dist/http/transport.js.map +1 -0
  112. package/dist/http/url-guard.cjs +97 -0
  113. package/dist/http/url-guard.cjs.map +1 -0
  114. package/dist/http/url-guard.d.cts +88 -0
  115. package/dist/http/url-guard.d.cts.map +1 -0
  116. package/dist/http/url-guard.d.ts +88 -0
  117. package/dist/http/url-guard.d.ts.map +1 -0
  118. package/dist/http/url-guard.js +97 -0
  119. package/dist/http/url-guard.js.map +1 -0
  120. package/dist/http/user-agent.cjs +51 -0
  121. package/dist/http/user-agent.cjs.map +1 -0
  122. package/dist/http/user-agent.d.cts +28 -0
  123. package/dist/http/user-agent.d.cts.map +1 -0
  124. package/dist/http/user-agent.d.ts +28 -0
  125. package/dist/http/user-agent.d.ts.map +1 -0
  126. package/dist/http/user-agent.js +51 -0
  127. package/dist/http/user-agent.js.map +1 -0
  128. package/dist/index.cjs +78 -0
  129. package/dist/index.cjs.map +1 -0
  130. package/dist/index.d.cts +39 -0
  131. package/dist/index.d.cts.map +1 -0
  132. package/dist/index.d.ts +39 -0
  133. package/dist/index.d.ts.map +1 -0
  134. package/dist/index.js +78 -0
  135. package/dist/index.js.map +1 -0
  136. package/dist/notifications/index.cjs +7 -0
  137. package/dist/notifications/index.cjs.map +1 -0
  138. package/dist/notifications/index.d.cts +3 -0
  139. package/dist/notifications/index.d.cts.map +1 -0
  140. package/dist/notifications/index.d.ts +3 -0
  141. package/dist/notifications/index.d.ts.map +1 -0
  142. package/dist/notifications/index.js +7 -0
  143. package/dist/notifications/index.js.map +1 -0
  144. package/dist/notifications/webhook.cjs +106 -0
  145. package/dist/notifications/webhook.cjs.map +1 -0
  146. package/dist/notifications/webhook.d.cts +146 -0
  147. package/dist/notifications/webhook.d.cts.map +1 -0
  148. package/dist/notifications/webhook.d.ts +146 -0
  149. package/dist/notifications/webhook.d.ts.map +1 -0
  150. package/dist/notifications/webhook.js +106 -0
  151. package/dist/notifications/webhook.js.map +1 -0
  152. package/dist/object.cjs +212 -0
  153. package/dist/object.cjs.map +1 -0
  154. package/dist/object.d.cts +263 -0
  155. package/dist/object.d.cts.map +1 -0
  156. package/dist/object.d.ts +263 -0
  157. package/dist/object.d.ts.map +1 -0
  158. package/dist/object.js +212 -0
  159. package/dist/object.js.map +1 -0
  160. package/dist/package.json.cjs +9 -0
  161. package/dist/package.json.cjs.map +1 -0
  162. package/dist/package.json.js +9 -0
  163. package/dist/package.json.js.map +1 -0
  164. package/dist/raw/encoding.cjs +47 -0
  165. package/dist/raw/encoding.cjs.map +1 -0
  166. package/dist/raw/encoding.d.cts +46 -0
  167. package/dist/raw/encoding.d.cts.map +1 -0
  168. package/dist/raw/encoding.d.ts +46 -0
  169. package/dist/raw/encoding.d.ts.map +1 -0
  170. package/dist/raw/encoding.js +47 -0
  171. package/dist/raw/encoding.js.map +1 -0
  172. package/dist/raw/index.cjs +600 -0
  173. package/dist/raw/index.cjs.map +1 -0
  174. package/dist/raw/index.d.cts +381 -0
  175. package/dist/raw/index.d.cts.map +1 -0
  176. package/dist/raw/index.d.ts +381 -0
  177. package/dist/raw/index.d.ts.map +1 -0
  178. package/dist/raw/index.js +601 -0
  179. package/dist/raw/index.js.map +1 -0
  180. package/dist/s3/index.cjs +23 -0
  181. package/dist/s3/index.cjs.map +1 -0
  182. package/dist/s3/index.d.cts +74 -0
  183. package/dist/s3/index.d.cts.map +1 -0
  184. package/dist/s3/index.d.ts +74 -0
  185. package/dist/s3/index.d.ts.map +1 -0
  186. package/dist/s3/index.js +23 -0
  187. package/dist/s3/index.js.map +1 -0
  188. package/dist/simulator/capabilities.cjs +53 -0
  189. package/dist/simulator/capabilities.cjs.map +1 -0
  190. package/dist/simulator/capabilities.d.cts +15 -0
  191. package/dist/simulator/capabilities.d.cts.map +1 -0
  192. package/dist/simulator/capabilities.d.ts +15 -0
  193. package/dist/simulator/capabilities.d.ts.map +1 -0
  194. package/dist/simulator/capabilities.js +53 -0
  195. package/dist/simulator/capabilities.js.map +1 -0
  196. package/dist/simulator/index.cjs +1559 -0
  197. package/dist/simulator/index.cjs.map +1 -0
  198. package/dist/simulator/index.d.cts +495 -0
  199. package/dist/simulator/index.d.cts.map +1 -0
  200. package/dist/simulator/index.d.ts +495 -0
  201. package/dist/simulator/index.d.ts.map +1 -0
  202. package/dist/simulator/index.js +1560 -0
  203. package/dist/simulator/index.js.map +1 -0
  204. package/dist/simulator/validation.cjs +174 -0
  205. package/dist/simulator/validation.cjs.map +1 -0
  206. package/dist/simulator/validation.d.cts +104 -0
  207. package/dist/simulator/validation.d.cts.map +1 -0
  208. package/dist/simulator/validation.d.ts +104 -0
  209. package/dist/simulator/validation.d.ts.map +1 -0
  210. package/dist/simulator/validation.js +174 -0
  211. package/dist/simulator/validation.js.map +1 -0
  212. package/dist/streams/collect.cjs +26 -0
  213. package/dist/streams/collect.cjs.map +1 -0
  214. package/dist/streams/collect.d.cts +18 -0
  215. package/dist/streams/collect.d.cts.map +1 -0
  216. package/dist/streams/collect.d.ts +18 -0
  217. package/dist/streams/collect.d.ts.map +1 -0
  218. package/dist/streams/collect.js +26 -0
  219. package/dist/streams/collect.js.map +1 -0
  220. package/dist/streams/hash.cjs +123 -0
  221. package/dist/streams/hash.cjs.map +1 -0
  222. package/dist/streams/hash.d.cts +42 -0
  223. package/dist/streams/hash.d.cts.map +1 -0
  224. package/dist/streams/hash.d.ts +42 -0
  225. package/dist/streams/hash.d.ts.map +1 -0
  226. package/dist/streams/hash.js +101 -0
  227. package/dist/streams/hash.js.map +1 -0
  228. package/dist/streams/index.cjs +13 -0
  229. package/dist/streams/index.cjs.map +1 -0
  230. package/dist/streams/index.d.cts +7 -0
  231. package/dist/streams/index.d.cts.map +1 -0
  232. package/dist/streams/index.d.ts +7 -0
  233. package/dist/streams/index.d.ts.map +1 -0
  234. package/dist/streams/index.js +13 -0
  235. package/dist/streams/index.js.map +1 -0
  236. package/dist/streams/progress.cjs +47 -0
  237. package/dist/streams/progress.cjs.map +1 -0
  238. package/dist/streams/progress.d.cts +53 -0
  239. package/dist/streams/progress.d.cts.map +1 -0
  240. package/dist/streams/progress.d.ts +53 -0
  241. package/dist/streams/progress.d.ts.map +1 -0
  242. package/dist/streams/progress.js +47 -0
  243. package/dist/streams/progress.js.map +1 -0
  244. package/dist/streams/source.cjs +155 -0
  245. package/dist/streams/source.cjs.map +1 -0
  246. package/dist/streams/source.d.cts +140 -0
  247. package/dist/streams/source.d.cts.map +1 -0
  248. package/dist/streams/source.d.ts +140 -0
  249. package/dist/streams/source.d.ts.map +1 -0
  250. package/dist/streams/source.js +155 -0
  251. package/dist/streams/source.js.map +1 -0
  252. package/dist/sync/actions/index.cjs +191 -0
  253. package/dist/sync/actions/index.cjs.map +1 -0
  254. package/dist/sync/actions/index.d.cts +167 -0
  255. package/dist/sync/actions/index.d.cts.map +1 -0
  256. package/dist/sync/actions/index.d.ts +167 -0
  257. package/dist/sync/actions/index.d.ts.map +1 -0
  258. package/dist/sync/actions/index.js +191 -0
  259. package/dist/sync/actions/index.js.map +1 -0
  260. package/dist/sync/index.cjs +23 -0
  261. package/dist/sync/index.cjs.map +1 -0
  262. package/dist/sync/index.d.cts +21 -0
  263. package/dist/sync/index.d.cts.map +1 -0
  264. package/dist/sync/index.d.ts +21 -0
  265. package/dist/sync/index.d.ts.map +1 -0
  266. package/dist/sync/index.js +23 -0
  267. package/dist/sync/index.js.map +1 -0
  268. package/dist/sync/pairing.cjs +31 -0
  269. package/dist/sync/pairing.cjs.map +1 -0
  270. package/dist/sync/pairing.d.cts +13 -0
  271. package/dist/sync/pairing.d.cts.map +1 -0
  272. package/dist/sync/pairing.d.ts +13 -0
  273. package/dist/sync/pairing.d.ts.map +1 -0
  274. package/dist/sync/pairing.js +31 -0
  275. package/dist/sync/pairing.js.map +1 -0
  276. package/dist/sync/policies/compare.cjs +14 -0
  277. package/dist/sync/policies/compare.cjs.map +1 -0
  278. package/dist/sync/policies/compare.d.cts +13 -0
  279. package/dist/sync/policies/compare.d.cts.map +1 -0
  280. package/dist/sync/policies/compare.d.ts +13 -0
  281. package/dist/sync/policies/compare.d.ts.map +1 -0
  282. package/dist/sync/policies/compare.js +14 -0
  283. package/dist/sync/policies/compare.js.map +1 -0
  284. package/dist/sync/policies/index.cjs +74 -0
  285. package/dist/sync/policies/index.cjs.map +1 -0
  286. package/dist/sync/policies/index.d.cts +42 -0
  287. package/dist/sync/policies/index.d.cts.map +1 -0
  288. package/dist/sync/policies/index.d.ts +42 -0
  289. package/dist/sync/policies/index.d.ts.map +1 -0
  290. package/dist/sync/policies/index.js +74 -0
  291. package/dist/sync/policies/index.js.map +1 -0
  292. package/dist/sync/scanners/b2.cjs +57 -0
  293. package/dist/sync/scanners/b2.cjs.map +1 -0
  294. package/dist/sync/scanners/b2.d.cts +20 -0
  295. package/dist/sync/scanners/b2.d.cts.map +1 -0
  296. package/dist/sync/scanners/b2.d.ts +20 -0
  297. package/dist/sync/scanners/b2.d.ts.map +1 -0
  298. package/dist/sync/scanners/b2.js +57 -0
  299. package/dist/sync/scanners/b2.js.map +1 -0
  300. package/dist/sync/scanners/local.cjs +58 -0
  301. package/dist/sync/scanners/local.cjs.map +1 -0
  302. package/dist/sync/scanners/local.d.cts +24 -0
  303. package/dist/sync/scanners/local.d.cts.map +1 -0
  304. package/dist/sync/scanners/local.d.ts +24 -0
  305. package/dist/sync/scanners/local.d.ts.map +1 -0
  306. package/dist/sync/scanners/local.js +58 -0
  307. package/dist/sync/scanners/local.js.map +1 -0
  308. package/dist/sync/synchronizer.cjs +203 -0
  309. package/dist/sync/synchronizer.cjs.map +1 -0
  310. package/dist/sync/synchronizer.d.cts +52 -0
  311. package/dist/sync/synchronizer.d.cts.map +1 -0
  312. package/dist/sync/synchronizer.d.ts +52 -0
  313. package/dist/sync/synchronizer.d.ts.map +1 -0
  314. package/dist/sync/synchronizer.js +181 -0
  315. package/dist/sync/synchronizer.js.map +1 -0
  316. package/dist/sync/types.d.cts +121 -0
  317. package/dist/sync/types.d.cts.map +1 -0
  318. package/dist/sync/types.d.ts +121 -0
  319. package/dist/sync/types.d.ts.map +1 -0
  320. package/dist/types/auth.cjs +58 -0
  321. package/dist/types/auth.cjs.map +1 -0
  322. package/dist/types/auth.d.cts +150 -0
  323. package/dist/types/auth.d.cts.map +1 -0
  324. package/dist/types/auth.d.ts +150 -0
  325. package/dist/types/auth.d.ts.map +1 -0
  326. package/dist/types/auth.js +58 -0
  327. package/dist/types/auth.js.map +1 -0
  328. package/dist/types/bucket.cjs +44 -0
  329. package/dist/types/bucket.cjs.map +1 -0
  330. package/dist/types/bucket.d.cts +245 -0
  331. package/dist/types/bucket.d.cts.map +1 -0
  332. package/dist/types/bucket.d.ts +245 -0
  333. package/dist/types/bucket.d.ts.map +1 -0
  334. package/dist/types/bucket.js +44 -0
  335. package/dist/types/bucket.js.map +1 -0
  336. package/dist/types/download.d.cts +110 -0
  337. package/dist/types/download.d.cts.map +1 -0
  338. package/dist/types/download.d.ts +110 -0
  339. package/dist/types/download.d.ts.map +1 -0
  340. package/dist/types/encryption.cjs +343 -0
  341. package/dist/types/encryption.cjs.map +1 -0
  342. package/dist/types/encryption.d.cts +132 -0
  343. package/dist/types/encryption.d.cts.map +1 -0
  344. package/dist/types/encryption.d.ts +132 -0
  345. package/dist/types/encryption.d.ts.map +1 -0
  346. package/dist/types/encryption.js +321 -0
  347. package/dist/types/encryption.js.map +1 -0
  348. package/dist/types/errors.d.cts +16 -0
  349. package/dist/types/errors.d.cts.map +1 -0
  350. package/dist/types/errors.d.ts +16 -0
  351. package/dist/types/errors.d.ts.map +1 -0
  352. package/dist/types/file.cjs +23 -0
  353. package/dist/types/file.cjs.map +1 -0
  354. package/dist/types/file.d.cts +220 -0
  355. package/dist/types/file.d.cts.map +1 -0
  356. package/dist/types/file.d.ts +220 -0
  357. package/dist/types/file.d.ts.map +1 -0
  358. package/dist/types/file.js +23 -0
  359. package/dist/types/file.js.map +1 -0
  360. package/dist/types/ids.cjs +27 -0
  361. package/dist/types/ids.cjs.map +1 -0
  362. package/dist/types/ids.d.cts +84 -0
  363. package/dist/types/ids.d.cts.map +1 -0
  364. package/dist/types/ids.d.ts +84 -0
  365. package/dist/types/ids.d.ts.map +1 -0
  366. package/dist/types/ids.js +27 -0
  367. package/dist/types/ids.js.map +1 -0
  368. package/dist/types/index.d.cts +25 -0
  369. package/dist/types/index.d.cts.map +1 -0
  370. package/dist/types/index.d.ts +25 -0
  371. package/dist/types/index.d.ts.map +1 -0
  372. package/dist/types/key.d.cts +84 -0
  373. package/dist/types/key.d.cts.map +1 -0
  374. package/dist/types/key.d.ts +84 -0
  375. package/dist/types/key.d.ts.map +1 -0
  376. package/dist/types/lock.cjs +17 -0
  377. package/dist/types/lock.cjs.map +1 -0
  378. package/dist/types/lock.d.cts +92 -0
  379. package/dist/types/lock.d.cts.map +1 -0
  380. package/dist/types/lock.d.ts +92 -0
  381. package/dist/types/lock.d.ts.map +1 -0
  382. package/dist/types/lock.js +17 -0
  383. package/dist/types/lock.js.map +1 -0
  384. package/dist/types/notifications.cjs +24 -0
  385. package/dist/types/notifications.cjs.map +1 -0
  386. package/dist/types/notifications.d.cts +97 -0
  387. package/dist/types/notifications.d.cts.map +1 -0
  388. package/dist/types/notifications.d.ts +97 -0
  389. package/dist/types/notifications.d.ts.map +1 -0
  390. package/dist/types/notifications.js +24 -0
  391. package/dist/types/notifications.js.map +1 -0
  392. package/dist/types/replication.d.cts +42 -0
  393. package/dist/types/replication.d.cts.map +1 -0
  394. package/dist/types/replication.d.ts +42 -0
  395. package/dist/types/replication.d.ts.map +1 -0
  396. package/dist/types/upload.d.cts +219 -0
  397. package/dist/types/upload.d.cts.map +1 -0
  398. package/dist/types/upload.d.ts +219 -0
  399. package/dist/types/upload.d.ts.map +1 -0
  400. package/dist/upload/cancel.cjs +10 -0
  401. package/dist/upload/cancel.cjs.map +1 -0
  402. package/dist/upload/cancel.d.cts +23 -0
  403. package/dist/upload/cancel.d.cts.map +1 -0
  404. package/dist/upload/cancel.d.ts +23 -0
  405. package/dist/upload/cancel.d.ts.map +1 -0
  406. package/dist/upload/cancel.js +10 -0
  407. package/dist/upload/cancel.js.map +1 -0
  408. package/dist/upload/concurrency.cjs +54 -0
  409. package/dist/upload/concurrency.cjs.map +1 -0
  410. package/dist/upload/concurrency.d.cts +46 -0
  411. package/dist/upload/concurrency.d.cts.map +1 -0
  412. package/dist/upload/concurrency.d.ts +46 -0
  413. package/dist/upload/concurrency.d.ts.map +1 -0
  414. package/dist/upload/concurrency.js +54 -0
  415. package/dist/upload/concurrency.js.map +1 -0
  416. package/dist/upload/large.cjs +222 -0
  417. package/dist/upload/large.cjs.map +1 -0
  418. package/dist/upload/large.d.cts +71 -0
  419. package/dist/upload/large.d.cts.map +1 -0
  420. package/dist/upload/large.d.ts +71 -0
  421. package/dist/upload/large.d.ts.map +1 -0
  422. package/dist/upload/large.js +222 -0
  423. package/dist/upload/large.js.map +1 -0
  424. package/dist/upload/resume.cjs +34 -0
  425. package/dist/upload/resume.cjs.map +1 -0
  426. package/dist/upload/resume.d.cts +33 -0
  427. package/dist/upload/resume.d.cts.map +1 -0
  428. package/dist/upload/resume.d.ts +33 -0
  429. package/dist/upload/resume.d.ts.map +1 -0
  430. package/dist/upload/resume.js +34 -0
  431. package/dist/upload/resume.js.map +1 -0
  432. package/dist/upload/single.cjs +47 -0
  433. package/dist/upload/single.cjs.map +1 -0
  434. package/dist/upload/single.d.cts +51 -0
  435. package/dist/upload/single.d.cts.map +1 -0
  436. package/dist/upload/single.d.ts +51 -0
  437. package/dist/upload/single.d.ts.map +1 -0
  438. package/dist/upload/single.js +47 -0
  439. package/dist/upload/single.js.map +1 -0
  440. package/dist/upload/stream.cjs +198 -0
  441. package/dist/upload/stream.cjs.map +1 -0
  442. package/dist/upload/stream.d.cts +61 -0
  443. package/dist/upload/stream.d.cts.map +1 -0
  444. package/dist/upload/stream.d.ts +61 -0
  445. package/dist/upload/stream.d.ts.map +1 -0
  446. package/dist/upload/stream.js +198 -0
  447. package/dist/upload/stream.js.map +1 -0
  448. package/dist/util/best-effort.cjs +10 -0
  449. package/dist/util/best-effort.cjs.map +1 -0
  450. package/dist/util/best-effort.d.cts +31 -0
  451. package/dist/util/best-effort.d.cts.map +1 -0
  452. package/dist/util/best-effort.d.ts +31 -0
  453. package/dist/util/best-effort.d.ts.map +1 -0
  454. package/dist/util/best-effort.js +10 -0
  455. package/dist/util/best-effort.js.map +1 -0
  456. package/dist/util/defaults.cjs +11 -0
  457. package/dist/util/defaults.cjs.map +1 -0
  458. package/dist/util/defaults.d.cts +54 -0
  459. package/dist/util/defaults.d.cts.map +1 -0
  460. package/dist/util/defaults.d.ts +54 -0
  461. package/dist/util/defaults.d.ts.map +1 -0
  462. package/dist/util/defaults.js +11 -0
  463. package/dist/util/defaults.js.map +1 -0
  464. package/dist/util/normalize.cjs +16 -0
  465. package/dist/util/normalize.cjs.map +1 -0
  466. package/dist/util/normalize.d.cts +62 -0
  467. package/dist/util/normalize.d.cts.map +1 -0
  468. package/dist/util/normalize.d.ts +62 -0
  469. package/dist/util/normalize.d.ts.map +1 -0
  470. package/dist/util/normalize.js +16 -0
  471. package/dist/util/normalize.js.map +1 -0
  472. package/dist/util/paginator.cjs +20 -0
  473. package/dist/util/paginator.cjs.map +1 -0
  474. package/dist/util/paginator.d.cts +120 -0
  475. package/dist/util/paginator.d.cts.map +1 -0
  476. package/dist/util/paginator.d.ts +120 -0
  477. package/dist/util/paginator.d.ts.map +1 -0
  478. package/dist/util/paginator.js +20 -0
  479. package/dist/util/paginator.js.map +1 -0
  480. package/dist/util/plan-ranges.cjs +28 -0
  481. package/dist/util/plan-ranges.cjs.map +1 -0
  482. package/dist/util/plan-ranges.d.cts +56 -0
  483. package/dist/util/plan-ranges.d.cts.map +1 -0
  484. package/dist/util/plan-ranges.d.ts +56 -0
  485. package/dist/util/plan-ranges.d.ts.map +1 -0
  486. package/dist/util/plan-ranges.js +28 -0
  487. package/dist/util/plan-ranges.js.map +1 -0
  488. package/dist/util/text-codec.cjs +7 -0
  489. package/dist/util/text-codec.cjs.map +1 -0
  490. package/dist/util/text-codec.d.cts +26 -0
  491. package/dist/util/text-codec.d.cts.map +1 -0
  492. package/dist/util/text-codec.d.ts +26 -0
  493. package/dist/util/text-codec.d.ts.map +1 -0
  494. package/dist/util/text-codec.js +7 -0
  495. package/dist/util/text-codec.js.map +1 -0
  496. package/dist/util/to-error.cjs +7 -0
  497. package/dist/util/to-error.cjs.map +1 -0
  498. package/dist/util/to-error.d.cts +15 -0
  499. package/dist/util/to-error.d.cts.map +1 -0
  500. package/dist/util/to-error.d.ts +15 -0
  501. package/dist/util/to-error.d.ts.map +1 -0
  502. package/dist/util/to-error.js +7 -0
  503. package/dist/util/to-error.js.map +1 -0
  504. package/dist/version.cjs +6 -0
  505. package/dist/version.cjs.map +1 -0
  506. package/dist/version.d.cts +14 -0
  507. package/dist/version.d.cts.map +1 -0
  508. package/dist/version.d.ts +14 -0
  509. package/dist/version.d.ts.map +1 -0
  510. package/dist/version.js +6 -0
  511. package/dist/version.js.map +1 -0
  512. package/package.json +198 -0
@@ -0,0 +1,219 @@
1
+ import { EncryptionSetting } from './encryption.js';
2
+ import { BucketId, LargeFileId } from './ids.js';
3
+ import { FileRetentionValue, LegalHoldValue } from './lock.js';
4
+ /** Request parameters for the `b2_get_upload_url` API call. */
5
+ export interface GetUploadUrlRequest {
6
+ /** Bucket to get an upload URL for. */
7
+ readonly bucketId: BucketId;
8
+ }
9
+ /** Response from the `b2_get_upload_url` API call. Contains a one-time upload URL and auth token. */
10
+ export interface GetUploadUrlResponse {
11
+ /** Bucket this upload URL targets. */
12
+ readonly bucketId: BucketId;
13
+ /** URL to POST file data to. */
14
+ readonly uploadUrl: string;
15
+ /** Authorization token to include in the upload request. */
16
+ readonly authorizationToken: string;
17
+ }
18
+ /**
19
+ * Headers required when uploading a file via `b2_upload_file`.
20
+ * Sent as HTTP headers on the upload POST request.
21
+ */
22
+ export interface UploadFileHeaders {
23
+ /** Authorization token from `b2_get_upload_url`. */
24
+ readonly authorization: string;
25
+ /** URL-encoded file name including path within the bucket. */
26
+ readonly fileName: string;
27
+ /** MIME type of the file. Use `'b2/x-auto'` for automatic detection. */
28
+ readonly contentType: string;
29
+ /** Size of the file content in bytes. */
30
+ readonly contentLength: number;
31
+ /** SHA-1 checksum of the content, or `'hex_digits_at_end'` / `'do_not_verify'` for deferred verification. */
32
+ readonly contentSha1: string | 'hex_digits_at_end' | 'do_not_verify';
33
+ /** Optional user-defined key-value metadata for the file. */
34
+ readonly fileInfo?: Record<string, string>;
35
+ /** Optional server-side encryption setting. */
36
+ readonly serverSideEncryption?: EncryptionSetting;
37
+ /** Optional Object Lock retention for the file. */
38
+ readonly fileRetention?: FileRetentionValue;
39
+ /** Optional legal hold for the file. */
40
+ readonly legalHold?: LegalHoldValue;
41
+ /** Optional last-modified timestamp in milliseconds (stored as `src_last_modified_millis` in file info). */
42
+ readonly lastModifiedMillis?: number;
43
+ /** Optional Content-Disposition header value for downloads. */
44
+ readonly contentDisposition?: string;
45
+ /** Optional Content-Language header value for downloads. */
46
+ readonly contentLanguage?: string;
47
+ /** Optional Expires header value for downloads. */
48
+ readonly expires?: string;
49
+ /** Optional Cache-Control header value for downloads. */
50
+ readonly cacheControl?: string;
51
+ /** Optional Content-Encoding header value for downloads. */
52
+ readonly contentEncoding?: string;
53
+ }
54
+ /** Request parameters for the `b2_start_large_file` API call. Initiates a multi-part upload. */
55
+ export interface StartLargeFileRequest {
56
+ /** Bucket to upload the large file to. */
57
+ readonly bucketId: BucketId;
58
+ /** Full path and name of the file within the bucket. */
59
+ readonly fileName: string;
60
+ /** MIME type of the file. Use `'b2/x-auto'` for automatic detection. */
61
+ readonly contentType: string;
62
+ /** Optional user-defined key-value metadata for the file. */
63
+ readonly fileInfo?: Record<string, string>;
64
+ /** Optional server-side encryption setting. */
65
+ readonly serverSideEncryption?: EncryptionSetting;
66
+ /** Optional Object Lock retention for the file. */
67
+ readonly fileRetention?: FileRetentionValue;
68
+ /** Optional legal hold for the file. */
69
+ readonly legalHold?: LegalHoldValue;
70
+ }
71
+ /** Response from the `b2_start_large_file` API call. */
72
+ export interface StartLargeFileResponse {
73
+ /** ID assigned to this large file upload. Use this to upload parts and finish the file. */
74
+ readonly fileId: LargeFileId;
75
+ /** Name of the file being uploaded. */
76
+ readonly fileName: string;
77
+ /** Account that owns this file. */
78
+ readonly accountId: string;
79
+ /** Bucket the file is being uploaded to. */
80
+ readonly bucketId: BucketId;
81
+ /** MIME type of the file. */
82
+ readonly contentType: string;
83
+ /** User-defined key-value metadata stored with the file. */
84
+ readonly fileInfo: Record<string, string>;
85
+ }
86
+ /** Request parameters for the `b2_get_upload_part_url` API call. */
87
+ export interface GetUploadPartUrlRequest {
88
+ /** ID of the large file to get a part upload URL for. */
89
+ readonly fileId: LargeFileId;
90
+ }
91
+ /** Response from the `b2_get_upload_part_url` API call. Contains a one-time part upload URL and auth token. */
92
+ export interface GetUploadPartUrlResponse {
93
+ /** ID of the large file this upload URL targets. */
94
+ readonly fileId: LargeFileId;
95
+ /** URL to POST part data to. */
96
+ readonly uploadUrl: string;
97
+ /** Authorization token to include in the part upload request. */
98
+ readonly authorizationToken: string;
99
+ }
100
+ /**
101
+ * Headers required when uploading a part via `b2_upload_part`.
102
+ * Sent as HTTP headers on the part upload POST request.
103
+ */
104
+ export interface UploadPartHeaders {
105
+ /** Authorization token from `b2_get_upload_part_url`. */
106
+ readonly authorization: string;
107
+ /** Part number (1 to 10000). Parts are assembled in order to form the complete file. */
108
+ readonly partNumber: number;
109
+ /** Size of this part in bytes. */
110
+ readonly contentLength: number;
111
+ /** SHA-1 checksum of the part content, or `'hex_digits_at_end'` / `'do_not_verify'` for deferred verification. */
112
+ readonly contentSha1: string | 'hex_digits_at_end' | 'do_not_verify';
113
+ /** Optional server-side encryption setting for this part. */
114
+ readonly serverSideEncryption?: EncryptionSetting;
115
+ }
116
+ /** Response from the `b2_upload_part` API call. */
117
+ export interface UploadPartResponse {
118
+ /** ID of the large file this part belongs to. */
119
+ readonly fileId: LargeFileId;
120
+ /** Part number within the large file. */
121
+ readonly partNumber: number;
122
+ /** Size of the uploaded part in bytes. */
123
+ readonly contentLength: number;
124
+ /** SHA-1 checksum of the uploaded part content. */
125
+ readonly contentSha1: string;
126
+ /** Server-side encryption applied to this part. */
127
+ readonly serverSideEncryption: EncryptionSetting;
128
+ /** UTC timestamp (milliseconds) when this part was uploaded. */
129
+ readonly uploadTimestamp: number;
130
+ }
131
+ /**
132
+ * Request parameters for the `b2_finish_large_file` API call.
133
+ * Assembles previously uploaded parts into a single complete file.
134
+ */
135
+ export interface FinishLargeFileRequest {
136
+ /** ID of the large file to finish. */
137
+ readonly fileId: LargeFileId;
138
+ /** Ordered array of SHA-1 checksums, one per part, matching the upload order. */
139
+ readonly partSha1Array: readonly string[];
140
+ }
141
+ /** Request parameters for the `b2_cancel_large_file` API call. */
142
+ export interface CancelLargeFileRequest {
143
+ /** ID of the large file upload to cancel. */
144
+ readonly fileId: LargeFileId;
145
+ }
146
+ /** Response from the `b2_cancel_large_file` API call. */
147
+ export interface CancelLargeFileResponse {
148
+ /** ID of the cancelled large file. */
149
+ readonly fileId: LargeFileId;
150
+ /** Account that owned the large file. */
151
+ readonly accountId: string;
152
+ /** Bucket the large file was being uploaded to. */
153
+ readonly bucketId: BucketId;
154
+ /** Name of the cancelled file. */
155
+ readonly fileName: string;
156
+ }
157
+ /** Request parameters for the `b2_list_unfinished_large_files` API call. */
158
+ export interface ListUnfinishedLargeFilesRequest {
159
+ /** Bucket to list unfinished large files from. */
160
+ readonly bucketId: BucketId;
161
+ /** Only return files whose names start with this prefix. */
162
+ readonly namePrefix?: string;
163
+ /** File ID to start listing from (exclusive). Used for pagination. */
164
+ readonly startFileId?: LargeFileId;
165
+ /** Maximum number of files to return. */
166
+ readonly maxFileCount?: number;
167
+ }
168
+ /** Metadata for an in-progress large file upload that has not yet been finished or cancelled. */
169
+ export interface UnfinishedLargeFile {
170
+ /** ID of the large file. */
171
+ readonly fileId: LargeFileId;
172
+ /** Name of the file. */
173
+ readonly fileName: string;
174
+ /** Account that owns this file. */
175
+ readonly accountId: string;
176
+ /** Bucket the file is being uploaded to. */
177
+ readonly bucketId: BucketId;
178
+ /** MIME type of the file. */
179
+ readonly contentType: string;
180
+ /** User-defined key-value metadata stored with the file. */
181
+ readonly fileInfo: Record<string, string>;
182
+ }
183
+ /** Response from the `b2_list_unfinished_large_files` API call. */
184
+ export interface ListUnfinishedLargeFilesResponse {
185
+ /** Array of unfinished large files. */
186
+ readonly files: readonly UnfinishedLargeFile[];
187
+ /** Next file ID to use for pagination, or null if all files have been listed. */
188
+ readonly nextFileId: LargeFileId | null;
189
+ }
190
+ /** Request parameters for the `b2_list_parts` API call. Lists parts uploaded for a large file. */
191
+ export interface ListPartsRequest {
192
+ /** ID of the large file to list parts for. */
193
+ readonly fileId: LargeFileId;
194
+ /** Part number to start listing from (inclusive). Used for pagination. */
195
+ readonly startPartNumber?: number;
196
+ /** Maximum number of parts to return. */
197
+ readonly maxPartCount?: number;
198
+ }
199
+ /** Metadata for a single uploaded part of a large file. */
200
+ export interface PartInfo {
201
+ /** ID of the large file this part belongs to. */
202
+ readonly fileId: LargeFileId;
203
+ /** Part number within the large file. */
204
+ readonly partNumber: number;
205
+ /** Size of this part in bytes. */
206
+ readonly contentLength: number;
207
+ /** SHA-1 checksum of this part's content. */
208
+ readonly contentSha1: string;
209
+ /** UTC timestamp (milliseconds) when this part was uploaded. */
210
+ readonly uploadTimestamp: number;
211
+ }
212
+ /** Response from the `b2_list_parts` API call. */
213
+ export interface ListPartsResponse {
214
+ /** Array of uploaded parts. */
215
+ readonly parts: readonly PartInfo[];
216
+ /** Next part number to use for pagination, or null if all parts have been listed. */
217
+ readonly nextPartNumber: number | null;
218
+ }
219
+ //# sourceMappingURL=upload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/types/upload.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAEnE,+DAA+D;AAC/D,MAAM,WAAW,mBAAmB;IAClC,uCAAuC;IACvC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;CAC5B;AAED,qGAAqG;AACrG,MAAM,WAAW,oBAAoB;IACnC,sCAAsC;IACtC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;IAC3B,gCAAgC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,4DAA4D;IAC5D,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAA;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,oDAAo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ACzC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,kCAAkC;IAClC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,6CAA6C;IAC7C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,gEAAgE;IAChE,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;CACjC;AAED,kDAAkD;AAClD,MAAM,WAAW,iBAAiB;IAChC,+BAA+B;IAC/B,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAA;IACnC,qFAAqF;IACrF,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CACvC"}
@@ -0,0 +1,219 @@
1
+ import { EncryptionSetting } from './encryption.js';
2
+ import { BucketId, LargeFileId } from './ids.js';
3
+ import { FileRetentionValue, LegalHoldValue } from './lock.js';
4
+ /** Request parameters for the `b2_get_upload_url` API call. */
5
+ export interface GetUploadUrlRequest {
6
+ /** Bucket to get an upload URL for. */
7
+ readonly bucketId: BucketId;
8
+ }
9
+ /** Response from the `b2_get_upload_url` API call. Contains a one-time upload URL and auth token. */
10
+ export interface GetUploadUrlResponse {
11
+ /** Bucket this upload URL targets. */
12
+ readonly bucketId: BucketId;
13
+ /** URL to POST file data to. */
14
+ readonly uploadUrl: string;
15
+ /** Authorization token to include in the upload request. */
16
+ readonly authorizationToken: string;
17
+ }
18
+ /**
19
+ * Headers required when uploading a file via `b2_upload_file`.
20
+ * Sent as HTTP headers on the upload POST request.
21
+ */
22
+ export interface UploadFileHeaders {
23
+ /** Authorization token from `b2_get_upload_url`. */
24
+ readonly authorization: string;
25
+ /** URL-encoded file name including path within the bucket. */
26
+ readonly fileName: string;
27
+ /** MIME type of the file. Use `'b2/x-auto'` for automatic detection. */
28
+ readonly contentType: string;
29
+ /** Size of the file content in bytes. */
30
+ readonly contentLength: number;
31
+ /** SHA-1 checksum of the content, or `'hex_digits_at_end'` / `'do_not_verify'` for deferred verification. */
32
+ readonly contentSha1: string | 'hex_digits_at_end' | 'do_not_verify';
33
+ /** Optional user-defined key-value metadata for the file. */
34
+ readonly fileInfo?: Record<string, string>;
35
+ /** Optional server-side encryption setting. */
36
+ readonly serverSideEncryption?: EncryptionSetting;
37
+ /** Optional Object Lock retention for the file. */
38
+ readonly fileRetention?: FileRetentionValue;
39
+ /** Optional legal hold for the file. */
40
+ readonly legalHold?: LegalHoldValue;
41
+ /** Optional last-modified timestamp in milliseconds (stored as `src_last_modified_millis` in file info). */
42
+ readonly lastModifiedMillis?: number;
43
+ /** Optional Content-Disposition header value for downloads. */
44
+ readonly contentDisposition?: string;
45
+ /** Optional Content-Language header value for downloads. */
46
+ readonly contentLanguage?: string;
47
+ /** Optional Expires header value for downloads. */
48
+ readonly expires?: string;
49
+ /** Optional Cache-Control header value for downloads. */
50
+ readonly cacheControl?: string;
51
+ /** Optional Content-Encoding header value for downloads. */
52
+ readonly contentEncoding?: string;
53
+ }
54
+ /** Request parameters for the `b2_start_large_file` API call. Initiates a multi-part upload. */
55
+ export interface StartLargeFileRequest {
56
+ /** Bucket to upload the large file to. */
57
+ readonly bucketId: BucketId;
58
+ /** Full path and name of the file within the bucket. */
59
+ readonly fileName: string;
60
+ /** MIME type of the file. Use `'b2/x-auto'` for automatic detection. */
61
+ readonly contentType: string;
62
+ /** Optional user-defined key-value metadata for the file. */
63
+ readonly fileInfo?: Record<string, string>;
64
+ /** Optional server-side encryption setting. */
65
+ readonly serverSideEncryption?: EncryptionSetting;
66
+ /** Optional Object Lock retention for the file. */
67
+ readonly fileRetention?: FileRetentionValue;
68
+ /** Optional legal hold for the file. */
69
+ readonly legalHold?: LegalHoldValue;
70
+ }
71
+ /** Response from the `b2_start_large_file` API call. */
72
+ export interface StartLargeFileResponse {
73
+ /** ID assigned to this large file upload. Use this to upload parts and finish the file. */
74
+ readonly fileId: LargeFileId;
75
+ /** Name of the file being uploaded. */
76
+ readonly fileName: string;
77
+ /** Account that owns this file. */
78
+ readonly accountId: string;
79
+ /** Bucket the file is being uploaded to. */
80
+ readonly bucketId: BucketId;
81
+ /** MIME type of the file. */
82
+ readonly contentType: string;
83
+ /** User-defined key-value metadata stored with the file. */
84
+ readonly fileInfo: Record<string, string>;
85
+ }
86
+ /** Request parameters for the `b2_get_upload_part_url` API call. */
87
+ export interface GetUploadPartUrlRequest {
88
+ /** ID of the large file to get a part upload URL for. */
89
+ readonly fileId: LargeFileId;
90
+ }
91
+ /** Response from the `b2_get_upload_part_url` API call. Contains a one-time part upload URL and auth token. */
92
+ export interface GetUploadPartUrlResponse {
93
+ /** ID of the large file this upload URL targets. */
94
+ readonly fileId: LargeFileId;
95
+ /** URL to POST part data to. */
96
+ readonly uploadUrl: string;
97
+ /** Authorization token to include in the part upload request. */
98
+ readonly authorizationToken: string;
99
+ }
100
+ /**
101
+ * Headers required when uploading a part via `b2_upload_part`.
102
+ * Sent as HTTP headers on the part upload POST request.
103
+ */
104
+ export interface UploadPartHeaders {
105
+ /** Authorization token from `b2_get_upload_part_url`. */
106
+ readonly authorization: string;
107
+ /** Part number (1 to 10000). Parts are assembled in order to form the complete file. */
108
+ readonly partNumber: number;
109
+ /** Size of this part in bytes. */
110
+ readonly contentLength: number;
111
+ /** SHA-1 checksum of the part content, or `'hex_digits_at_end'` / `'do_not_verify'` for deferred verification. */
112
+ readonly contentSha1: string | 'hex_digits_at_end' | 'do_not_verify';
113
+ /** Optional server-side encryption setting for this part. */
114
+ readonly serverSideEncryption?: EncryptionSetting;
115
+ }
116
+ /** Response from the `b2_upload_part` API call. */
117
+ export interface UploadPartResponse {
118
+ /** ID of the large file this part belongs to. */
119
+ readonly fileId: LargeFileId;
120
+ /** Part number within the large file. */
121
+ readonly partNumber: number;
122
+ /** Size of the uploaded part in bytes. */
123
+ readonly contentLength: number;
124
+ /** SHA-1 checksum of the uploaded part content. */
125
+ readonly contentSha1: string;
126
+ /** Server-side encryption applied to this part. */
127
+ readonly serverSideEncryption: EncryptionSetting;
128
+ /** UTC timestamp (milliseconds) when this part was uploaded. */
129
+ readonly uploadTimestamp: number;
130
+ }
131
+ /**
132
+ * Request parameters for the `b2_finish_large_file` API call.
133
+ * Assembles previously uploaded parts into a single complete file.
134
+ */
135
+ export interface FinishLargeFileRequest {
136
+ /** ID of the large file to finish. */
137
+ readonly fileId: LargeFileId;
138
+ /** Ordered array of SHA-1 checksums, one per part, matching the upload order. */
139
+ readonly partSha1Array: readonly string[];
140
+ }
141
+ /** Request parameters for the `b2_cancel_large_file` API call. */
142
+ export interface CancelLargeFileRequest {
143
+ /** ID of the large file upload to cancel. */
144
+ readonly fileId: LargeFileId;
145
+ }
146
+ /** Response from the `b2_cancel_large_file` API call. */
147
+ export interface CancelLargeFileResponse {
148
+ /** ID of the cancelled large file. */
149
+ readonly fileId: LargeFileId;
150
+ /** Account that owned the large file. */
151
+ readonly accountId: string;
152
+ /** Bucket the large file was being uploaded to. */
153
+ readonly bucketId: BucketId;
154
+ /** Name of the cancelled file. */
155
+ readonly fileName: string;
156
+ }
157
+ /** Request parameters for the `b2_list_unfinished_large_files` API call. */
158
+ export interface ListUnfinishedLargeFilesRequest {
159
+ /** Bucket to list unfinished large files from. */
160
+ readonly bucketId: BucketId;
161
+ /** Only return files whose names start with this prefix. */
162
+ readonly namePrefix?: string;
163
+ /** File ID to start listing from (exclusive). Used for pagination. */
164
+ readonly startFileId?: LargeFileId;
165
+ /** Maximum number of files to return. */
166
+ readonly maxFileCount?: number;
167
+ }
168
+ /** Metadata for an in-progress large file upload that has not yet been finished or cancelled. */
169
+ export interface UnfinishedLargeFile {
170
+ /** ID of the large file. */
171
+ readonly fileId: LargeFileId;
172
+ /** Name of the file. */
173
+ readonly fileName: string;
174
+ /** Account that owns this file. */
175
+ readonly accountId: string;
176
+ /** Bucket the file is being uploaded to. */
177
+ readonly bucketId: BucketId;
178
+ /** MIME type of the file. */
179
+ readonly contentType: string;
180
+ /** User-defined key-value metadata stored with the file. */
181
+ readonly fileInfo: Record<string, string>;
182
+ }
183
+ /** Response from the `b2_list_unfinished_large_files` API call. */
184
+ export interface ListUnfinishedLargeFilesResponse {
185
+ /** Array of unfinished large files. */
186
+ readonly files: readonly UnfinishedLargeFile[];
187
+ /** Next file ID to use for pagination, or null if all files have been listed. */
188
+ readonly nextFileId: LargeFileId | null;
189
+ }
190
+ /** Request parameters for the `b2_list_parts` API call. Lists parts uploaded for a large file. */
191
+ export interface ListPartsRequest {
192
+ /** ID of the large file to list parts for. */
193
+ readonly fileId: LargeFileId;
194
+ /** Part number to start listing from (inclusive). Used for pagination. */
195
+ readonly startPartNumber?: number;
196
+ /** Maximum number of parts to return. */
197
+ readonly maxPartCount?: number;
198
+ }
199
+ /** Metadata for a single uploaded part of a large file. */
200
+ export interface PartInfo {
201
+ /** ID of the large file this part belongs to. */
202
+ readonly fileId: LargeFileId;
203
+ /** Part number within the large file. */
204
+ readonly partNumber: number;
205
+ /** Size of this part in bytes. */
206
+ readonly contentLength: number;
207
+ /** SHA-1 checksum of this part's content. */
208
+ readonly contentSha1: string;
209
+ /** UTC timestamp (milliseconds) when this part was uploaded. */
210
+ readonly uploadTimestamp: number;
211
+ }
212
+ /** Response from the `b2_list_parts` API call. */
213
+ export interface ListPartsResponse {
214
+ /** Array of uploaded parts. */
215
+ readonly parts: readonly PartInfo[];
216
+ /** Next part number to use for pagination, or null if all parts have been listed. */
217
+ readonly nextPartNumber: number | null;
218
+ }
219
+ //# sourceMappingURL=upload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/types/upload.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAEnE,+DAA+D;AAC/D,MAAM,WAAW,mBAAmB;IAClC,uCAAuC;IACvC,QAAQ,CAAC,Q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AC/B,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;IAC5B,0EAA0E;IAC1E,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAA;IACjC,yCAAyC;IACzC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAC/B;AAED,2DAA2D;AAC3D,MAAM,WAAW,QAAQ;IACvB,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;IAC5B,yCAAyC;IACzC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,kCAAkC;IAClC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,6CAA6C;IAC7C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,gEAAgE;IAChE,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;CACjC;AAED,kDAAkD;AAClD,MAAM,WAAW,iBAAiB;IAChC,+BAA+B;IAC/B,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAA;IACnC,qFAAqF;IACrF,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CACvC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const bestEffort = require("../util/best-effort.cjs");
4
+ async function cancelLargeFileBestEffort(raw, accountInfo, fileId) {
5
+ await bestEffort.bestEffort(
6
+ () => raw.cancelLargeFile(accountInfo.getApiUrl(), accountInfo.getAuthToken(), { fileId })
7
+ );
8
+ }
9
+ exports.cancelLargeFileBestEffort = cancelLargeFileBestEffort;
10
+ //# sourceMappingURL=cancel.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancel.cjs","sources":["../../src/upload/cancel.ts"],"sourcesContent":["import type { AccountInfo } from '../auth/account-info.ts'\nimport type { RawClient } from '../raw/index.ts'\nimport type { LargeFileId } from '../types/ids.ts'\nimport { bestEffort } from '../util/best-effort.ts'\n\n/**\n * Cancels an unfinished large file on a best-effort basis. Used at every\n * error-handling boundary in the multipart upload, write-stream, and\n * server-side copy paths to roll back in-progress uploads without\n * letting a cancellation failure mask the underlying error the caller\n * is about to see.\n *\n * Centralising the call removes a five-line `bestEffort` block that\n * recurred at six sites with identical shape — the only thing that\n * changed was the captured `fileId` and the surrounding error trail.\n *\n * @param raw - Low-level B2 API client.\n * @param accountInfo - Authorized account state for the API URL + token.\n * @param fileId - The in-progress large file ID to cancel.\n *\n * @returns A promise that always resolves, regardless of the cancel\n * call's outcome.\n */\nexport async function cancelLargeFileBestEffort(\n raw: RawClient,\n accountInfo: AccountInfo,\n fileId: LargeFileId,\n): Promise<void> {\n await bestEffort(() =>\n raw.cancelLargeFile(accountInfo.getApiUrl(), accountInfo.getAuthToken(), { fileId }),\n )\n}\n"],"names":["bestEffort"],"mappings":";;;AAuBA,eAAsB,0BACpB,KACA,aACA,QACe;AACf,QAAMA,WAAAA;AAAAA,IAAW,MACf,IAAI,gBAAgB,YAAY,UAAA,GAAa,YAAY,gBAAgB,EAAE,OAAA,CAAQ;AAAA,EAAA;AAEvF;;"}
@@ -0,0 +1,23 @@
1
+ import { AccountInfo } from '../auth/account-info.js';
2
+ import { RawClient } from '../raw/index.js';
3
+ import { LargeFileId } from '../types/ids.js';
4
+ /**
5
+ * Cancels an unfinished large file on a best-effort basis. Used at every
6
+ * error-handling boundary in the multipart upload, write-stream, and
7
+ * server-side copy paths to roll back in-progress uploads without
8
+ * letting a cancellation failure mask the underlying error the caller
9
+ * is about to see.
10
+ *
11
+ * Centralising the call removes a five-line `bestEffort` block that
12
+ * recurred at six sites with identical shape — the only thing that
13
+ * changed was the captured `fileId` and the surrounding error trail.
14
+ *
15
+ * @param raw - Low-level B2 API client.
16
+ * @param accountInfo - Authorized account state for the API URL + token.
17
+ * @param fileId - The in-progress large file ID to cancel.
18
+ *
19
+ * @returns A promise that always resolves, regardless of the cancel
20
+ * call's outcome.
21
+ */
22
+ export declare function cancelLargeFileBestEffort(raw: RawClient, accountInfo: AccountInfo, fileId: LargeFileId): Promise<void>;
23
+ //# sourceMappingURL=cancel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancel.d.ts","sourceRoot":"","sources":["../../src/upload/cancel.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGlD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,SAAS,EACd,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,IAAI,CAAC,CAIf"}
@@ -0,0 +1,23 @@
1
+ import { AccountInfo } from '../auth/account-info.js';
2
+ import { RawClient } from '../raw/index.js';
3
+ import { LargeFileId } from '../types/ids.js';
4
+ /**
5
+ * Cancels an unfinished large file on a best-effort basis. Used at every
6
+ * error-handling boundary in the multipart upload, write-stream, and
7
+ * server-side copy paths to roll back in-progress uploads without
8
+ * letting a cancellation failure mask the underlying error the caller
9
+ * is about to see.
10
+ *
11
+ * Centralising the call removes a five-line `bestEffort` block that
12
+ * recurred at six sites with identical shape — the only thing that
13
+ * changed was the captured `fileId` and the surrounding error trail.
14
+ *
15
+ * @param raw - Low-level B2 API client.
16
+ * @param accountInfo - Authorized account state for the API URL + token.
17
+ * @param fileId - The in-progress large file ID to cancel.
18
+ *
19
+ * @returns A promise that always resolves, regardless of the cancel
20
+ * call's outcome.
21
+ */
22
+ export declare function cancelLargeFileBestEffort(raw: RawClient, accountInfo: AccountInfo, fileId: LargeFileId): Promise<void>;
23
+ //# sourceMappingURL=cancel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancel.d.ts","sourceRoot":"","sources":["../../src/upload/cancel.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGlD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,SAAS,EACd,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,IAAI,CAAC,CAIf"}
@@ -0,0 +1,10 @@
1
+ import { bestEffort } from "../util/best-effort.js";
2
+ async function cancelLargeFileBestEffort(raw, accountInfo, fileId) {
3
+ await bestEffort(
4
+ () => raw.cancelLargeFile(accountInfo.getApiUrl(), accountInfo.getAuthToken(), { fileId })
5
+ );
6
+ }
7
+ export {
8
+ cancelLargeFileBestEffort
9
+ };
10
+ //# sourceMappingURL=cancel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancel.js","sources":["../../src/upload/cancel.ts"],"sourcesContent":["import type { AccountInfo } from '../auth/account-info.ts'\nimport type { RawClient } from '../raw/index.ts'\nimport type { LargeFileId } from '../types/ids.ts'\nimport { bestEffort } from '../util/best-effort.ts'\n\n/**\n * Cancels an unfinished large file on a best-effort basis. Used at every\n * error-handling boundary in the multipart upload, write-stream, and\n * server-side copy paths to roll back in-progress uploads without\n * letting a cancellation failure mask the underlying error the caller\n * is about to see.\n *\n * Centralising the call removes a five-line `bestEffort` block that\n * recurred at six sites with identical shape — the only thing that\n * changed was the captured `fileId` and the surrounding error trail.\n *\n * @param raw - Low-level B2 API client.\n * @param accountInfo - Authorized account state for the API URL + token.\n * @param fileId - The in-progress large file ID to cancel.\n *\n * @returns A promise that always resolves, regardless of the cancel\n * call's outcome.\n */\nexport async function cancelLargeFileBestEffort(\n raw: RawClient,\n accountInfo: AccountInfo,\n fileId: LargeFileId,\n): Promise<void> {\n await bestEffort(() =>\n raw.cancelLargeFile(accountInfo.getApiUrl(), accountInfo.getAuthToken(), { fileId }),\n )\n}\n"],"names":[],"mappings":";AAuBA,eAAsB,0BACpB,KACA,aACA,QACe;AACf,QAAM;AAAA,IAAW,MACf,IAAI,gBAAgB,YAAY,UAAA,GAAa,YAAY,gBAAgB,EAAE,OAAA,CAAQ;AAAA,EAAA;AAEvF;"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ class Semaphore {
4
+ /**
5
+ * @param limit - Maximum number of concurrent acquisitions. Must be a
6
+ * positive integer; values `<= 0` would create a semaphore that
7
+ * never lets anything through (all `acquire()` calls would queue
8
+ * forever), so the constructor throws fast instead.
9
+ *
10
+ * @throws `RangeError` when `limit` is not a positive integer.
11
+ */
12
+ constructor(limit) {
13
+ this.limit = limit;
14
+ if (!Number.isInteger(limit) || limit <= 0) {
15
+ throw new RangeError(
16
+ `Semaphore limit must be a positive integer; received ${limit}. A non-positive limit produces a deadlocked semaphore — fail fast at construction instead.`
17
+ );
18
+ }
19
+ }
20
+ current = 0;
21
+ queue = [];
22
+ /**
23
+ * Acquires a slot, waiting if the limit has been reached.
24
+ * @returns A promise that resolves when a slot is available.
25
+ */
26
+ async acquire() {
27
+ if (this.current < this.limit) {
28
+ this.current++;
29
+ return;
30
+ }
31
+ return new Promise((resolve) => {
32
+ this.queue.push(resolve);
33
+ });
34
+ }
35
+ /** Releases a slot, unblocking the next queued caller if any. */
36
+ release() {
37
+ const next = this.queue.shift();
38
+ if (next) {
39
+ next();
40
+ } else {
41
+ this.current--;
42
+ }
43
+ }
44
+ /**
45
+ * Number of slots currently available.
46
+ *
47
+ * @returns The count of free concurrency slots.
48
+ */
49
+ get available() {
50
+ return this.limit - this.current;
51
+ }
52
+ }
53
+ exports.Semaphore = Semaphore;
54
+ //# sourceMappingURL=concurrency.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concurrency.cjs","sources":["../../src/upload/concurrency.ts"],"sourcesContent":["/**\n * Bounded concurrency primitive.\n *\n * Limits the number of concurrent operations to a fixed maximum. Callers\n * {@link acquire} a slot before starting work and {@link release} it when done.\n * If all slots are taken, `acquire` returns a promise that resolves when a slot\n * becomes available.\n */\nexport class Semaphore {\n private current = 0\n private readonly queue: (() => void)[] = []\n\n /**\n * @param limit - Maximum number of concurrent acquisitions. Must be a\n * positive integer; values `<= 0` would create a semaphore that\n * never lets anything through (all `acquire()` calls would queue\n * forever), so the constructor throws fast instead.\n *\n * @throws `RangeError` when `limit` is not a positive integer.\n */\n constructor(private readonly limit: number) {\n if (!Number.isInteger(limit) || limit <= 0) {\n throw new RangeError(\n `Semaphore limit must be a positive integer; received ${limit}. A non-positive limit produces a deadlocked semaphore — fail fast at construction instead.`,\n )\n }\n }\n\n /**\n * Acquires a slot, waiting if the limit has been reached.\n * @returns A promise that resolves when a slot is available.\n */\n async acquire(): Promise<void> {\n if (this.current < this.limit) {\n this.current++\n return\n }\n return new Promise<void>((resolve) => {\n this.queue.push(resolve)\n })\n }\n\n /** Releases a slot, unblocking the next queued caller if any. */\n release(): void {\n const next = this.queue.shift()\n if (next) {\n next()\n } else {\n this.current--\n }\n }\n\n /**\n * Number of slots currently available.\n *\n * @returns The count of free concurrency slots.\n */\n get available(): number {\n return this.limit - this.current\n }\n}\n\n/**\n * Maps over an array with bounded concurrency.\n *\n * @param items - Input items to process.\n * @param concurrency - Maximum number of items processed in parallel.\n * @param fn - Async function applied to each item.\n *\n * @returns Results in the same order as the input items.\n */\nexport async function mapConcurrent<T, R>(\n items: readonly T[],\n concurrency: number,\n fn: (item: T, index: number) => Promise<R>,\n): Promise<R[]> {\n const sem = new Semaphore(concurrency)\n const results: R[] = new Array(items.length)\n const tasks = items.map(async (item, i) => {\n await sem.acquire()\n try {\n results[i] = await fn(item, i)\n } finally {\n sem.release()\n }\n })\n await Promise.all(tasks)\n return results\n}\n"],"names":[],"mappings":";;AAQO,MAAM,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYrB,YAA6B,OAAe;AAAf,SAAA,QAAA;AAC3B,QAAI,CAAC,OAAO,UAAU,KAAK,KAAK,SAAS,GAAG;AAC1C,YAAM,IAAI;AAAA,QACR,wDAAwD,KAAK;AAAA,MAAA;AAAA,IAEjE;AAAA,EACF;AAAA,EAjBQ,UAAU;AAAA,EACD,QAAwB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsBzC,MAAM,UAAyB;AAC7B,QAAI,KAAK,UAAU,KAAK,OAAO;AAC7B,WAAK;AACL;AAAA,IACF;AACA,WAAO,IAAI,QAAc,CAAC,YAAY;AACpC,WAAK,MAAM,KAAK,OAAO;AAAA,IACzB,CAAC;AAAA,EACH;AAAA;AAAA,EAGA,UAAgB;AACd,UAAM,OAAO,KAAK,MAAM,MAAA;AACxB,QAAI,MAAM;AACR,WAAA;AAAA,IACF,OAAO;AACL,WAAK;AAAA,IACP;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,YAAoB;AACtB,WAAO,KAAK,QAAQ,KAAK;AAAA,EAC3B;AACF;;"}