@backblaze-labs/b2-sdk 0.2.0 → 0.4.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 (590) hide show
  1. package/CHANGELOG.md +86 -1
  2. package/README.md +38 -7
  3. package/dist/_virtual/_b2-sdk-version-json.cjs +1 -1
  4. package/dist/_virtual/_b2-sdk-version-json.js +1 -1
  5. package/dist/auth/file.cjs.map +1 -1
  6. package/dist/auth/reauth-coalescer.cjs +65 -0
  7. package/dist/auth/reauth-coalescer.cjs.map +1 -0
  8. package/dist/auth/reauth-coalescer.d.cts +34 -0
  9. package/dist/auth/reauth-coalescer.d.cts.map +1 -0
  10. package/dist/auth/reauth-coalescer.d.ts +34 -0
  11. package/dist/auth/reauth-coalescer.d.ts.map +1 -0
  12. package/dist/auth/reauth-coalescer.js +65 -0
  13. package/dist/auth/reauth-coalescer.js.map +1 -0
  14. package/dist/backup/client.cjs +206 -0
  15. package/dist/backup/client.cjs.map +1 -0
  16. package/dist/backup/client.d.cts +238 -0
  17. package/dist/backup/client.d.cts.map +1 -0
  18. package/dist/backup/client.d.ts +238 -0
  19. package/dist/backup/client.d.ts.map +1 -0
  20. package/dist/backup/client.js +206 -0
  21. package/dist/backup/client.js.map +1 -0
  22. package/dist/backup/index.cjs +15 -0
  23. package/dist/backup/index.d.cts +22 -0
  24. package/dist/backup/index.d.cts.map +1 -0
  25. package/dist/backup/index.d.ts +22 -0
  26. package/dist/backup/index.d.ts.map +1 -0
  27. package/dist/backup/index.js +7 -0
  28. package/dist/backup/raw.cjs +168 -0
  29. package/dist/backup/raw.cjs.map +1 -0
  30. package/dist/backup/raw.d.cts +122 -0
  31. package/dist/backup/raw.d.cts.map +1 -0
  32. package/dist/backup/raw.d.ts +122 -0
  33. package/dist/backup/raw.d.ts.map +1 -0
  34. package/dist/backup/raw.js +168 -0
  35. package/dist/backup/raw.js.map +1 -0
  36. package/dist/bucket-validation.cjs +111 -0
  37. package/dist/bucket-validation.cjs.map +1 -0
  38. package/dist/bucket-validation.d.cts +27 -0
  39. package/dist/bucket-validation.d.cts.map +1 -0
  40. package/dist/bucket-validation.d.ts +27 -0
  41. package/dist/bucket-validation.d.ts.map +1 -0
  42. package/dist/bucket-validation.js +109 -0
  43. package/dist/bucket-validation.js.map +1 -0
  44. package/dist/bucket.cjs +125 -74
  45. package/dist/bucket.cjs.map +1 -1
  46. package/dist/bucket.d.cts +156 -61
  47. package/dist/bucket.d.cts.map +1 -1
  48. package/dist/bucket.d.ts +156 -61
  49. package/dist/bucket.d.ts.map +1 -1
  50. package/dist/bucket.js +125 -74
  51. package/dist/bucket.js.map +1 -1
  52. package/dist/client.cjs +29 -8
  53. package/dist/client.cjs.map +1 -1
  54. package/dist/client.d.cts +30 -9
  55. package/dist/client.d.cts.map +1 -1
  56. package/dist/client.d.ts +30 -9
  57. package/dist/client.d.ts.map +1 -1
  58. package/dist/client.js +29 -8
  59. package/dist/client.js.map +1 -1
  60. package/dist/copy/large.cjs +5 -3
  61. package/dist/copy/large.cjs.map +1 -1
  62. package/dist/copy/large.d.cts.map +1 -1
  63. package/dist/copy/large.d.ts.map +1 -1
  64. package/dist/copy/large.js +5 -3
  65. package/dist/copy/large.js.map +1 -1
  66. package/dist/download/checksum.cjs +6 -2
  67. package/dist/download/checksum.cjs.map +1 -1
  68. package/dist/download/checksum.js +6 -2
  69. package/dist/download/checksum.js.map +1 -1
  70. package/dist/download/parallel.cjs +52 -15
  71. package/dist/download/parallel.cjs.map +1 -1
  72. package/dist/download/parallel.d.cts +8 -1
  73. package/dist/download/parallel.d.cts.map +1 -1
  74. package/dist/download/parallel.d.ts +8 -1
  75. package/dist/download/parallel.d.ts.map +1 -1
  76. package/dist/download/parallel.js +52 -15
  77. package/dist/download/parallel.js.map +1 -1
  78. package/dist/download/single.cjs +179 -19
  79. package/dist/download/single.cjs.map +1 -1
  80. package/dist/download/single.d.cts +10 -4
  81. package/dist/download/single.d.cts.map +1 -1
  82. package/dist/download/single.d.ts +10 -4
  83. package/dist/download/single.d.ts.map +1 -1
  84. package/dist/download/single.js +179 -19
  85. package/dist/download/single.js.map +1 -1
  86. package/dist/errors/index.cjs +196 -3
  87. package/dist/errors/index.cjs.map +1 -1
  88. package/dist/errors/index.d.cts +134 -0
  89. package/dist/errors/index.d.cts.map +1 -1
  90. package/dist/errors/index.d.ts +134 -0
  91. package/dist/errors/index.d.ts.map +1 -1
  92. package/dist/errors/index.js +183 -4
  93. package/dist/errors/index.js.map +1 -1
  94. package/dist/http/non-idempotent-mutations.cjs +38 -0
  95. package/dist/http/non-idempotent-mutations.cjs.map +1 -0
  96. package/dist/http/non-idempotent-mutations.d.cts +25 -0
  97. package/dist/http/non-idempotent-mutations.d.cts.map +1 -0
  98. package/dist/http/non-idempotent-mutations.d.ts +25 -0
  99. package/dist/http/non-idempotent-mutations.d.ts.map +1 -0
  100. package/dist/http/non-idempotent-mutations.js +35 -0
  101. package/dist/http/non-idempotent-mutations.js.map +1 -0
  102. package/dist/http/retry.cjs +1 -1
  103. package/dist/http/retry.cjs.map +1 -1
  104. package/dist/http/retry.js +1 -1
  105. package/dist/http/retry.js.map +1 -1
  106. package/dist/http/transport.cjs +62 -23
  107. package/dist/http/transport.cjs.map +1 -1
  108. package/dist/http/transport.d.cts +30 -3
  109. package/dist/http/transport.d.cts.map +1 -1
  110. package/dist/http/transport.d.ts +30 -3
  111. package/dist/http/transport.d.ts.map +1 -1
  112. package/dist/http/transport.js +60 -22
  113. package/dist/http/transport.js.map +1 -1
  114. package/dist/http/user-agent.cjs +12 -1
  115. package/dist/http/user-agent.cjs.map +1 -1
  116. package/dist/http/user-agent.d.cts +8 -0
  117. package/dist/http/user-agent.d.cts.map +1 -1
  118. package/dist/http/user-agent.d.ts +8 -0
  119. package/dist/http/user-agent.d.ts.map +1 -1
  120. package/dist/http/user-agent.js +13 -3
  121. package/dist/http/user-agent.js.map +1 -1
  122. package/dist/index.cjs +50 -2
  123. package/dist/index.d.cts +15 -12
  124. package/dist/index.d.cts.map +1 -1
  125. package/dist/index.d.ts +15 -12
  126. package/dist/index.d.ts.map +1 -1
  127. package/dist/index.js +13 -10
  128. package/dist/notifications/index.cjs +3 -0
  129. package/dist/notifications/index.d.cts +2 -0
  130. package/dist/notifications/index.d.cts.map +1 -1
  131. package/dist/notifications/index.d.ts +2 -0
  132. package/dist/notifications/index.d.ts.map +1 -1
  133. package/dist/notifications/index.js +2 -1
  134. package/dist/object.cjs +13 -2
  135. package/dist/object.cjs.map +1 -1
  136. package/dist/object.d.cts +11 -3
  137. package/dist/object.d.cts.map +1 -1
  138. package/dist/object.d.ts +11 -3
  139. package/dist/object.d.ts.map +1 -1
  140. package/dist/object.js +13 -2
  141. package/dist/object.js.map +1 -1
  142. package/dist/partner/account-info.d.cts +43 -0
  143. package/dist/partner/account-info.d.cts.map +1 -0
  144. package/dist/partner/account-info.d.ts +43 -0
  145. package/dist/partner/account-info.d.ts.map +1 -0
  146. package/dist/partner/auth-clone.cjs +64 -0
  147. package/dist/partner/auth-clone.cjs.map +1 -0
  148. package/dist/partner/auth-clone.d.cts +27 -0
  149. package/dist/partner/auth-clone.d.cts.map +1 -0
  150. package/dist/partner/auth-clone.d.ts +27 -0
  151. package/dist/partner/auth-clone.d.ts.map +1 -0
  152. package/dist/partner/auth-clone.js +63 -0
  153. package/dist/partner/auth-clone.js.map +1 -0
  154. package/dist/partner/auth-core.cjs +156 -0
  155. package/dist/partner/auth-core.cjs.map +1 -0
  156. package/dist/partner/auth-core.d.cts +111 -0
  157. package/dist/partner/auth-core.d.cts.map +1 -0
  158. package/dist/partner/auth-core.d.ts +111 -0
  159. package/dist/partner/auth-core.d.ts.map +1 -0
  160. package/dist/partner/auth-core.js +156 -0
  161. package/dist/partner/auth-core.js.map +1 -0
  162. package/dist/partner/auth-shape.cjs +36 -0
  163. package/dist/partner/auth-shape.cjs.map +1 -0
  164. package/dist/partner/auth-shape.d.cts +12 -0
  165. package/dist/partner/auth-shape.d.cts.map +1 -0
  166. package/dist/partner/auth-shape.d.ts +12 -0
  167. package/dist/partner/auth-shape.d.ts.map +1 -0
  168. package/dist/partner/auth-shape.js +36 -0
  169. package/dist/partner/auth-shape.js.map +1 -0
  170. package/dist/partner/client.cjs +270 -0
  171. package/dist/partner/client.cjs.map +1 -0
  172. package/dist/partner/client.d.cts +357 -0
  173. package/dist/partner/client.d.cts.map +1 -0
  174. package/dist/partner/client.d.ts +357 -0
  175. package/dist/partner/client.d.ts.map +1 -0
  176. package/dist/partner/client.js +270 -0
  177. package/dist/partner/client.js.map +1 -0
  178. package/dist/partner/endpoint-url.cjs +109 -0
  179. package/dist/partner/endpoint-url.cjs.map +1 -0
  180. package/dist/partner/endpoint-url.d.cts +74 -0
  181. package/dist/partner/endpoint-url.d.cts.map +1 -0
  182. package/dist/partner/endpoint-url.d.ts +74 -0
  183. package/dist/partner/endpoint-url.d.ts.map +1 -0
  184. package/dist/partner/endpoint-url.js +106 -0
  185. package/dist/partner/endpoint-url.js.map +1 -0
  186. package/dist/partner/in-memory.cjs +135 -0
  187. package/dist/partner/in-memory.cjs.map +1 -0
  188. package/dist/partner/in-memory.d.cts +99 -0
  189. package/dist/partner/in-memory.d.cts.map +1 -0
  190. package/dist/partner/in-memory.d.ts +99 -0
  191. package/dist/partner/in-memory.d.ts.map +1 -0
  192. package/dist/partner/in-memory.js +135 -0
  193. package/dist/partner/in-memory.js.map +1 -0
  194. package/dist/partner/index.cjs +27 -0
  195. package/dist/partner/index.d.cts +32 -0
  196. package/dist/partner/index.d.cts.map +1 -0
  197. package/dist/partner/index.d.ts +32 -0
  198. package/dist/partner/index.d.ts.map +1 -0
  199. package/dist/partner/index.js +9 -0
  200. package/dist/partner/raw.cjs +400 -0
  201. package/dist/partner/raw.cjs.map +1 -0
  202. package/dist/partner/raw.d.cts +220 -0
  203. package/dist/partner/raw.d.cts.map +1 -0
  204. package/dist/partner/raw.d.ts +220 -0
  205. package/dist/partner/raw.d.ts.map +1 -0
  206. package/dist/partner/raw.js +398 -0
  207. package/dist/partner/raw.js.map +1 -0
  208. package/dist/partner/redaction-placeholders.cjs +10 -0
  209. package/dist/partner/redaction-placeholders.cjs.map +1 -0
  210. package/dist/partner/redaction-placeholders.d.cts +5 -0
  211. package/dist/partner/redaction-placeholders.d.cts.map +1 -0
  212. package/dist/partner/redaction-placeholders.d.ts +5 -0
  213. package/dist/partner/redaction-placeholders.d.ts.map +1 -0
  214. package/dist/partner/redaction-placeholders.js +9 -0
  215. package/dist/partner/redaction-placeholders.js.map +1 -0
  216. package/dist/partner/redaction.cjs +292 -0
  217. package/dist/partner/redaction.cjs.map +1 -0
  218. package/dist/partner/redaction.d.cts +158 -0
  219. package/dist/partner/redaction.d.cts.map +1 -0
  220. package/dist/partner/redaction.d.ts +158 -0
  221. package/dist/partner/redaction.d.ts.map +1 -0
  222. package/dist/partner/redaction.js +281 -0
  223. package/dist/partner/redaction.js.map +1 -0
  224. package/dist/raw/encoding.cjs +29 -10
  225. package/dist/raw/encoding.cjs.map +1 -1
  226. package/dist/raw/encoding.d.cts +3 -2
  227. package/dist/raw/encoding.d.cts.map +1 -1
  228. package/dist/raw/encoding.d.ts +3 -2
  229. package/dist/raw/encoding.d.ts.map +1 -1
  230. package/dist/raw/encoding.js +29 -10
  231. package/dist/raw/encoding.js.map +1 -1
  232. package/dist/raw/index.cjs +131 -44
  233. package/dist/raw/index.cjs.map +1 -1
  234. package/dist/raw/index.d.cts +21 -15
  235. package/dist/raw/index.d.cts.map +1 -1
  236. package/dist/raw/index.d.ts +21 -15
  237. package/dist/raw/index.d.ts.map +1 -1
  238. package/dist/raw/index.js +114 -45
  239. package/dist/raw/index.js.map +1 -1
  240. package/dist/raw/url.cjs +111 -0
  241. package/dist/raw/url.cjs.map +1 -0
  242. package/dist/raw/url.d.cts +41 -0
  243. package/dist/raw/url.d.cts.map +1 -0
  244. package/dist/raw/url.d.ts +41 -0
  245. package/dist/raw/url.d.ts.map +1 -0
  246. package/dist/raw/url.js +110 -0
  247. package/dist/raw/url.js.map +1 -0
  248. package/dist/s3/sigv4.cjs +15 -10
  249. package/dist/s3/sigv4.cjs.map +1 -1
  250. package/dist/s3/sigv4.js +15 -10
  251. package/dist/s3/sigv4.js.map +1 -1
  252. package/dist/simulator/index.cjs +1579 -257
  253. package/dist/simulator/index.cjs.map +1 -1
  254. package/dist/simulator/index.d.cts +124 -11
  255. package/dist/simulator/index.d.cts.map +1 -1
  256. package/dist/simulator/index.d.ts +124 -11
  257. package/dist/simulator/index.d.ts.map +1 -1
  258. package/dist/simulator/index.js +1568 -262
  259. package/dist/simulator/index.js.map +1 -1
  260. package/dist/simulator/partner-capabilities.cjs +77 -0
  261. package/dist/simulator/partner-capabilities.cjs.map +1 -0
  262. package/dist/simulator/partner-capabilities.d.cts +53 -0
  263. package/dist/simulator/partner-capabilities.d.cts.map +1 -0
  264. package/dist/simulator/partner-capabilities.d.ts +53 -0
  265. package/dist/simulator/partner-capabilities.d.ts.map +1 -0
  266. package/dist/simulator/partner-capabilities.js +73 -0
  267. package/dist/simulator/partner-capabilities.js.map +1 -0
  268. package/dist/simulator/partner.cjs +713 -0
  269. package/dist/simulator/partner.cjs.map +1 -0
  270. package/dist/simulator/partner.d.cts +186 -0
  271. package/dist/simulator/partner.d.cts.map +1 -0
  272. package/dist/simulator/partner.d.ts +186 -0
  273. package/dist/simulator/partner.d.ts.map +1 -0
  274. package/dist/simulator/partner.js +713 -0
  275. package/dist/simulator/partner.js.map +1 -0
  276. package/dist/simulator/validation.cjs +732 -25
  277. package/dist/simulator/validation.cjs.map +1 -1
  278. package/dist/simulator/validation.d.cts +145 -6
  279. package/dist/simulator/validation.d.cts.map +1 -1
  280. package/dist/simulator/validation.d.ts +145 -6
  281. package/dist/simulator/validation.d.ts.map +1 -1
  282. package/dist/simulator/validation.js +705 -26
  283. package/dist/simulator/validation.js.map +1 -1
  284. package/dist/streams/file-source.cjs +2 -2
  285. package/dist/streams/file-source.cjs.map +1 -1
  286. package/dist/streams/file-source.js +2 -2
  287. package/dist/streams/file-source.js.map +1 -1
  288. package/dist/streams/hash.cjs +246 -13
  289. package/dist/streams/hash.cjs.map +1 -1
  290. package/dist/streams/hash.d.cts +37 -12
  291. package/dist/streams/hash.d.cts.map +1 -1
  292. package/dist/streams/hash.d.ts +37 -12
  293. package/dist/streams/hash.d.ts.map +1 -1
  294. package/dist/streams/hash.js +246 -15
  295. package/dist/streams/hash.js.map +1 -1
  296. package/dist/streams/index.cjs +3 -1
  297. package/dist/streams/index.d.cts +1 -1
  298. package/dist/streams/index.d.cts.map +1 -1
  299. package/dist/streams/index.d.ts +1 -1
  300. package/dist/streams/index.d.ts.map +1 -1
  301. package/dist/streams/index.js +3 -3
  302. package/dist/streams/progress.cjs +63 -4
  303. package/dist/streams/progress.cjs.map +1 -1
  304. package/dist/streams/progress.d.cts +28 -2
  305. package/dist/streams/progress.d.cts.map +1 -1
  306. package/dist/streams/progress.d.ts +28 -2
  307. package/dist/streams/progress.d.ts.map +1 -1
  308. package/dist/streams/progress.js +63 -4
  309. package/dist/streams/progress.js.map +1 -1
  310. package/dist/streams/source.cjs +2 -1
  311. package/dist/streams/source.cjs.map +1 -1
  312. package/dist/streams/source.js +2 -1
  313. package/dist/streams/source.js.map +1 -1
  314. package/dist/sync/b2-sha1-reader.cjs +6 -2
  315. package/dist/sync/b2-sha1-reader.cjs.map +1 -1
  316. package/dist/sync/b2-sha1-reader.d.cts.map +1 -1
  317. package/dist/sync/b2-sha1-reader.d.ts.map +1 -1
  318. package/dist/sync/b2-sha1-reader.js +6 -2
  319. package/dist/sync/b2-sha1-reader.js.map +1 -1
  320. package/dist/sync/download-staging.cjs +156 -43
  321. package/dist/sync/download-staging.cjs.map +1 -1
  322. package/dist/sync/download-staging.d.cts +26 -2
  323. package/dist/sync/download-staging.d.cts.map +1 -1
  324. package/dist/sync/download-staging.d.ts +26 -2
  325. package/dist/sync/download-staging.d.ts.map +1 -1
  326. package/dist/sync/download-staging.js +155 -44
  327. package/dist/sync/download-staging.js.map +1 -1
  328. package/dist/sync/filters.cjs.map +1 -1
  329. package/dist/sync/filters.js.map +1 -1
  330. package/dist/sync/index.d.cts +1 -1
  331. package/dist/sync/index.d.cts.map +1 -1
  332. package/dist/sync/index.d.ts +1 -1
  333. package/dist/sync/index.d.ts.map +1 -1
  334. package/dist/sync/local-file-io.cjs +15 -6
  335. package/dist/sync/local-file-io.cjs.map +1 -1
  336. package/dist/sync/local-file-io.d.cts +3 -0
  337. package/dist/sync/local-file-io.d.cts.map +1 -1
  338. package/dist/sync/local-file-io.d.ts +3 -0
  339. package/dist/sync/local-file-io.d.ts.map +1 -1
  340. package/dist/sync/local-file-io.js +15 -6
  341. package/dist/sync/local-file-io.js.map +1 -1
  342. package/dist/sync/local-sha1.cjs +6 -15
  343. package/dist/sync/local-sha1.cjs.map +1 -1
  344. package/dist/sync/local-sha1.d.cts +0 -8
  345. package/dist/sync/local-sha1.d.cts.map +1 -1
  346. package/dist/sync/local-sha1.d.ts +0 -8
  347. package/dist/sync/local-sha1.d.ts.map +1 -1
  348. package/dist/sync/local-sha1.js +7 -15
  349. package/dist/sync/local-sha1.js.map +1 -1
  350. package/dist/sync/pairing.cjs +1 -0
  351. package/dist/sync/pairing.cjs.map +1 -1
  352. package/dist/sync/pairing.js +1 -0
  353. package/dist/sync/pairing.js.map +1 -1
  354. package/dist/sync/policies/compare.cjs +5 -3
  355. package/dist/sync/policies/compare.cjs.map +1 -1
  356. package/dist/sync/policies/compare.d.cts.map +1 -1
  357. package/dist/sync/policies/compare.d.ts.map +1 -1
  358. package/dist/sync/policies/compare.js +6 -4
  359. package/dist/sync/policies/compare.js.map +1 -1
  360. package/dist/sync/policies/index.cjs +4 -10
  361. package/dist/sync/policies/index.cjs.map +1 -1
  362. package/dist/sync/policies/index.js +4 -10
  363. package/dist/sync/policies/index.js.map +1 -1
  364. package/dist/sync/scanners/b2.cjs +4 -2
  365. package/dist/sync/scanners/b2.cjs.map +1 -1
  366. package/dist/sync/scanners/b2.d.cts.map +1 -1
  367. package/dist/sync/scanners/b2.d.ts.map +1 -1
  368. package/dist/sync/scanners/b2.js +4 -2
  369. package/dist/sync/scanners/b2.js.map +1 -1
  370. package/dist/sync/scanners/local.cjs +150 -33
  371. package/dist/sync/scanners/local.cjs.map +1 -1
  372. package/dist/sync/scanners/local.d.cts +6 -0
  373. package/dist/sync/scanners/local.d.cts.map +1 -1
  374. package/dist/sync/scanners/local.d.ts +6 -0
  375. package/dist/sync/scanners/local.d.ts.map +1 -1
  376. package/dist/sync/scanners/local.js +150 -33
  377. package/dist/sync/scanners/local.js.map +1 -1
  378. package/dist/sync/synchronizer.cjs +79 -31
  379. package/dist/sync/synchronizer.cjs.map +1 -1
  380. package/dist/sync/synchronizer.d.cts +1 -0
  381. package/dist/sync/synchronizer.d.cts.map +1 -1
  382. package/dist/sync/synchronizer.d.ts +1 -0
  383. package/dist/sync/synchronizer.d.ts.map +1 -1
  384. package/dist/sync/synchronizer.js +79 -31
  385. package/dist/sync/synchronizer.js.map +1 -1
  386. package/dist/sync/types.d.cts +19 -3
  387. package/dist/sync/types.d.cts.map +1 -1
  388. package/dist/sync/types.d.ts +19 -3
  389. package/dist/sync/types.d.ts.map +1 -1
  390. package/dist/types/auth.cjs +4 -0
  391. package/dist/types/auth.cjs.map +1 -1
  392. package/dist/types/auth.d.cts +4 -0
  393. package/dist/types/auth.d.cts.map +1 -1
  394. package/dist/types/auth.d.ts +4 -0
  395. package/dist/types/auth.d.ts.map +1 -1
  396. package/dist/types/auth.js +4 -0
  397. package/dist/types/auth.js.map +1 -1
  398. package/dist/types/backup.d.cts +85 -0
  399. package/dist/types/backup.d.cts.map +1 -0
  400. package/dist/types/backup.d.ts +85 -0
  401. package/dist/types/backup.d.ts.map +1 -0
  402. package/dist/types/bucket.cjs +81 -11
  403. package/dist/types/bucket.cjs.map +1 -1
  404. package/dist/types/bucket.d.cts +194 -41
  405. package/dist/types/bucket.d.cts.map +1 -1
  406. package/dist/types/bucket.d.ts +194 -41
  407. package/dist/types/bucket.d.ts.map +1 -1
  408. package/dist/types/bucket.js +67 -12
  409. package/dist/types/bucket.js.map +1 -1
  410. package/dist/types/download.cjs +62 -0
  411. package/dist/types/download.cjs.map +1 -0
  412. package/dist/types/download.d.cts +100 -16
  413. package/dist/types/download.d.cts.map +1 -1
  414. package/dist/types/download.d.ts +100 -16
  415. package/dist/types/download.d.ts.map +1 -1
  416. package/dist/types/download.js +61 -0
  417. package/dist/types/download.js.map +1 -0
  418. package/dist/types/encryption.cjs +76 -229
  419. package/dist/types/encryption.cjs.map +1 -1
  420. package/dist/types/encryption.d.cts +48 -6
  421. package/dist/types/encryption.d.cts.map +1 -1
  422. package/dist/types/encryption.d.ts +48 -6
  423. package/dist/types/encryption.d.ts.map +1 -1
  424. package/dist/types/encryption.js +74 -229
  425. package/dist/types/encryption.js.map +1 -1
  426. package/dist/types/errors.cjs +9 -0
  427. package/dist/types/errors.cjs.map +1 -1
  428. package/dist/types/errors.d.cts +1 -1
  429. package/dist/types/errors.d.cts.map +1 -1
  430. package/dist/types/errors.d.ts +1 -1
  431. package/dist/types/errors.d.ts.map +1 -1
  432. package/dist/types/errors.js +9 -0
  433. package/dist/types/errors.js.map +1 -1
  434. package/dist/types/file.cjs +3 -0
  435. package/dist/types/file.cjs.map +1 -1
  436. package/dist/types/file.d.cts +140 -18
  437. package/dist/types/file.d.cts.map +1 -1
  438. package/dist/types/file.d.ts +140 -18
  439. package/dist/types/file.d.ts.map +1 -1
  440. package/dist/types/file.js +3 -1
  441. package/dist/types/file.js.map +1 -1
  442. package/dist/types/ids.cjs +30 -0
  443. package/dist/types/ids.cjs.map +1 -1
  444. package/dist/types/ids.d.cts +32 -0
  445. package/dist/types/ids.d.cts.map +1 -1
  446. package/dist/types/ids.d.ts +32 -0
  447. package/dist/types/ids.d.ts.map +1 -1
  448. package/dist/types/ids.js +28 -1
  449. package/dist/types/ids.js.map +1 -1
  450. package/dist/types/index.d.cts +16 -12
  451. package/dist/types/index.d.cts.map +1 -1
  452. package/dist/types/index.d.ts +16 -12
  453. package/dist/types/index.d.ts.map +1 -1
  454. package/dist/types/key.d.cts +4 -3
  455. package/dist/types/key.d.cts.map +1 -1
  456. package/dist/types/key.d.ts +4 -3
  457. package/dist/types/key.d.ts.map +1 -1
  458. package/dist/types/lock.cjs.map +1 -1
  459. package/dist/types/lock.d.cts +14 -0
  460. package/dist/types/lock.d.cts.map +1 -1
  461. package/dist/types/lock.d.ts +14 -0
  462. package/dist/types/lock.d.ts.map +1 -1
  463. package/dist/types/lock.js.map +1 -1
  464. package/dist/types/notifications.cjs +31 -1
  465. package/dist/types/notifications.cjs.map +1 -1
  466. package/dist/types/notifications.d.cts +31 -4
  467. package/dist/types/notifications.d.cts.map +1 -1
  468. package/dist/types/notifications.d.ts +31 -4
  469. package/dist/types/notifications.d.ts.map +1 -1
  470. package/dist/types/notifications.js +30 -2
  471. package/dist/types/notifications.js.map +1 -1
  472. package/dist/types/partner.cjs +32 -0
  473. package/dist/types/partner.cjs.map +1 -0
  474. package/dist/types/partner.d.cts +386 -0
  475. package/dist/types/partner.d.cts.map +1 -0
  476. package/dist/types/partner.d.ts +386 -0
  477. package/dist/types/partner.d.ts.map +1 -0
  478. package/dist/types/partner.js +29 -0
  479. package/dist/types/partner.js.map +1 -0
  480. package/dist/types/upload.d.cts +35 -18
  481. package/dist/types/upload.d.cts.map +1 -1
  482. package/dist/types/upload.d.ts +35 -18
  483. package/dist/types/upload.d.ts.map +1 -1
  484. package/dist/upload/abort-scope.cjs +0 -45
  485. package/dist/upload/abort-scope.cjs.map +1 -1
  486. package/dist/upload/abort-scope.d.cts +0 -22
  487. package/dist/upload/abort-scope.d.cts.map +1 -1
  488. package/dist/upload/abort-scope.d.ts +0 -22
  489. package/dist/upload/abort-scope.d.ts.map +1 -1
  490. package/dist/upload/abort-scope.js +1 -44
  491. package/dist/upload/abort-scope.js.map +1 -1
  492. package/dist/upload/finish.cjs +3 -8
  493. package/dist/upload/finish.cjs.map +1 -1
  494. package/dist/upload/finish.d.cts.map +1 -1
  495. package/dist/upload/finish.d.ts.map +1 -1
  496. package/dist/upload/finish.js +1 -6
  497. package/dist/upload/finish.js.map +1 -1
  498. package/dist/upload/large.cjs +15 -8
  499. package/dist/upload/large.cjs.map +1 -1
  500. package/dist/upload/large.d.cts +31 -8
  501. package/dist/upload/large.d.cts.map +1 -1
  502. package/dist/upload/large.d.ts +31 -8
  503. package/dist/upload/large.d.ts.map +1 -1
  504. package/dist/upload/large.js +15 -8
  505. package/dist/upload/large.js.map +1 -1
  506. package/dist/upload/options.cjs.map +1 -1
  507. package/dist/upload/options.d.cts +24 -0
  508. package/dist/upload/options.d.cts.map +1 -1
  509. package/dist/upload/options.d.ts +24 -0
  510. package/dist/upload/options.d.ts.map +1 -1
  511. package/dist/upload/options.js.map +1 -1
  512. package/dist/upload/resume.cjs +6 -4
  513. package/dist/upload/resume.cjs.map +1 -1
  514. package/dist/upload/resume.d.cts +9 -5
  515. package/dist/upload/resume.d.cts.map +1 -1
  516. package/dist/upload/resume.d.ts +9 -5
  517. package/dist/upload/resume.d.ts.map +1 -1
  518. package/dist/upload/resume.js +6 -4
  519. package/dist/upload/resume.js.map +1 -1
  520. package/dist/upload/retry.cjs +25 -13
  521. package/dist/upload/retry.cjs.map +1 -1
  522. package/dist/upload/retry.d.cts.map +1 -1
  523. package/dist/upload/retry.d.ts.map +1 -1
  524. package/dist/upload/retry.js +25 -13
  525. package/dist/upload/retry.js.map +1 -1
  526. package/dist/upload/single.cjs +35 -30
  527. package/dist/upload/single.cjs.map +1 -1
  528. package/dist/upload/single.d.cts +12 -0
  529. package/dist/upload/single.d.cts.map +1 -1
  530. package/dist/upload/single.d.ts +12 -0
  531. package/dist/upload/single.d.ts.map +1 -1
  532. package/dist/upload/single.js +35 -30
  533. package/dist/upload/single.js.map +1 -1
  534. package/dist/upload/stream.cjs +18 -5
  535. package/dist/upload/stream.cjs.map +1 -1
  536. package/dist/upload/stream.d.cts +12 -0
  537. package/dist/upload/stream.d.cts.map +1 -1
  538. package/dist/upload/stream.d.ts +12 -0
  539. package/dist/upload/stream.d.ts.map +1 -1
  540. package/dist/upload/stream.js +15 -2
  541. package/dist/upload/stream.js.map +1 -1
  542. package/dist/util/abort.cjs +114 -0
  543. package/dist/util/abort.cjs.map +1 -0
  544. package/dist/util/abort.d.cts +65 -0
  545. package/dist/util/abort.d.cts.map +1 -0
  546. package/dist/util/abort.d.ts +65 -0
  547. package/dist/util/abort.d.ts.map +1 -0
  548. package/dist/util/abort.js +109 -0
  549. package/dist/util/abort.js.map +1 -0
  550. package/dist/util/defaults.cjs +3 -0
  551. package/dist/util/defaults.cjs.map +1 -1
  552. package/dist/util/defaults.d.cts +2 -0
  553. package/dist/util/defaults.d.cts.map +1 -1
  554. package/dist/util/defaults.d.ts +2 -0
  555. package/dist/util/defaults.d.ts.map +1 -1
  556. package/dist/util/defaults.js +3 -1
  557. package/dist/util/defaults.js.map +1 -1
  558. package/dist/util/md5.cjs +211 -0
  559. package/dist/util/md5.cjs.map +1 -0
  560. package/dist/util/md5.d.cts +43 -0
  561. package/dist/util/md5.d.cts.map +1 -0
  562. package/dist/util/md5.d.ts +43 -0
  563. package/dist/util/md5.d.ts.map +1 -0
  564. package/dist/util/md5.js +209 -0
  565. package/dist/util/md5.js.map +1 -0
  566. package/dist/util/normalize.cjs +5 -5
  567. package/dist/util/normalize.cjs.map +1 -1
  568. package/dist/util/normalize.d.cts +7 -7
  569. package/dist/util/normalize.d.cts.map +1 -1
  570. package/dist/util/normalize.d.ts +7 -7
  571. package/dist/util/normalize.d.ts.map +1 -1
  572. package/dist/util/normalize.js +5 -5
  573. package/dist/util/normalize.js.map +1 -1
  574. package/dist/util/paginator.cjs +7 -1
  575. package/dist/util/paginator.cjs.map +1 -1
  576. package/dist/util/paginator.d.cts +3 -1
  577. package/dist/util/paginator.d.cts.map +1 -1
  578. package/dist/util/paginator.d.ts +3 -1
  579. package/dist/util/paginator.d.ts.map +1 -1
  580. package/dist/util/paginator.js +7 -1
  581. package/dist/util/paginator.js.map +1 -1
  582. package/dist/version.cjs +56 -4
  583. package/dist/version.cjs.map +1 -1
  584. package/dist/version.d.cts +53 -4
  585. package/dist/version.d.cts.map +1 -1
  586. package/dist/version.d.ts +53 -4
  587. package/dist/version.d.ts.map +1 -1
  588. package/dist/version.js +52 -5
  589. package/dist/version.js.map +1 -1
  590. package/package.json +47 -18
@@ -1,12 +1,8 @@
1
- import { EncryptionSetting } from './encryption.js';
1
+ import { NoEncryption, PublicEncryptionSetting, SseB2Setting } from './encryption.js';
2
2
  import { AccountId, BucketId } from './ids.js';
3
3
  import { ReplicationConfiguration } from './replication.js';
4
4
  /**
5
- * Named constants for the bucket access level.
6
- *
7
- * The {@link BucketType} type alias is derived from the values of this
8
- * object, so the const is the single source of truth: adding a key here
9
- * automatically widens the type union.
5
+ * Named constants for bucket types accepted by create/update bucket requests.
10
6
  *
11
7
  * @example
12
8
  * ```ts
@@ -23,14 +19,78 @@ export declare const BucketType: {
23
19
  /** B2-restricted bucket (e.g., for S3-compatible workflows). */
24
20
  readonly Restricted: "restricted";
25
21
  };
26
- /** Access level for a B2 bucket. Derived from {@link BucketType}. */
22
+ /** Bucket access levels accepted by B2 bucket create/update requests. */
27
23
  export type BucketType = (typeof BucketType)[keyof typeof BucketType];
24
+ /** Named constants for documented bucket response types known to the SDK. */
25
+ export declare const KnownBucketResponseType: {
26
+ /** Response-only bucket type for buckets shared with the account. */
27
+ readonly Shared: "shared";
28
+ /** Publicly downloadable without authentication. */
29
+ readonly AllPublic: "allPublic";
30
+ /** Requires a valid auth token to download. */
31
+ readonly AllPrivate: "allPrivate";
32
+ /** Internal snapshot bucket type, generally not user-created. */
33
+ readonly Snapshot: "snapshot";
34
+ /** B2-restricted bucket (e.g., for S3-compatible workflows). */
35
+ readonly Restricted: "restricted";
36
+ };
37
+ /** Closed union of documented bucket response types known to the SDK. */
38
+ export type KnownBucketResponseType = (typeof KnownBucketResponseType)[keyof typeof KnownBucketResponseType];
39
+ /** Bucket type returned by B2 bucket responses, including future B2-added values. */
40
+ export type BucketResponseType = KnownBucketResponseType | (string & {});
41
+ /**
42
+ * Bucket type value accepted by `b2_list_buckets.bucketTypes`.
43
+ *
44
+ * This includes future B2-added strings, so TypeScript cannot statically exclude
45
+ * the special `'all'` value from this open string type. Runtime validation still
46
+ * enforces that `'all'` is only valid as `['all']` and that filters are non-empty.
47
+ */
48
+ export type BucketListType = BucketResponseType;
49
+ /**
50
+ * Bucket type filter accepted by `b2_list_buckets`.
51
+ *
52
+ * Use `['all']` by itself to request all bucket types. Other filters may include
53
+ * documented response types such as `'shared'` and future B2-added type strings.
54
+ * Because future bucket types are modeled as an open string, TypeScript cannot
55
+ * reject empty arrays or mixed arrays containing `'all'`; B2 and the simulator
56
+ * reject them at runtime.
57
+ */
58
+ export type BucketTypesFilter = readonly ['all'] | readonly BucketListType[];
59
+ /**
60
+ * Named constants for option flags returned on buckets and application keys.
61
+ *
62
+ * B2 currently documents only the S3-compatible API option.
63
+ */
64
+ export declare const BucketKeyOption: {
65
+ /** Enables the S3-compatible API surface for the bucket or key. */
66
+ readonly S3: "s3";
67
+ };
68
+ /** Documented option flag returned on bucket and application key metadata. */
69
+ export type KnownBucketKeyOption = (typeof BucketKeyOption)[keyof typeof BucketKeyOption];
70
+ /** Option flag returned on bucket and application key metadata, open to future B2-added strings. */
71
+ export type BucketKeyOption = KnownBucketKeyOption | (string & {});
72
+ /** Minimum UTF-8 byte length for each bucketInfo key. */
73
+ export declare const BUCKET_INFO_KEY_MIN_BYTES = 1;
74
+ /** Maximum UTF-8 byte length for each bucketInfo key. */
75
+ export declare const BUCKET_INFO_KEY_MAX_BYTES = 50;
76
+ /** Maximum aggregate UTF-8 byte length of all bucketInfo values. */
77
+ export declare const BUCKET_INFO_VALUES_MAX_BYTES = 10000;
78
+ /** Reserved bucketInfo key prefix used by Backblaze. */
79
+ export declare const BUCKET_INFO_RESERVED_PREFIX = "b2-";
80
+ /**
81
+ * BucketInfo keys must match this regular-expression source. B2 accepts
82
+ * letters, digits, and these characters: `. _ ~ ! # $ % ^ & * ' | + -` plus the
83
+ * backtick.
84
+ */
85
+ export declare const BUCKET_INFO_KEY_PATTERN = "^[A-Za-z0-9._`~!#$%^&*'|+-]+$";
28
86
  /** Rule that automatically hides or deletes files after a specified number of days. */
29
87
  export interface LifecycleRule {
30
88
  /** Days after hiding before automatic deletion, or null to never auto-delete hidden files. */
31
- readonly daysFromHidingToDeleting: number | null;
89
+ readonly daysFromHidingToDeleting?: number | null;
32
90
  /** Days after upload before automatic hiding, or null to never auto-hide. */
33
- readonly daysFromUploadingToHiding: number | null;
91
+ readonly daysFromUploadingToHiding?: number | null;
92
+ /** Days after starting before automatic cancellation of unfinished large files, or null to never auto-cancel. */
93
+ readonly daysFromStartingToCancelingUnfinishedLargeFiles?: number | null;
34
94
  /** File name prefix this rule applies to. Empty string matches all files. */
35
95
  readonly fileNamePrefix: string;
36
96
  }
@@ -60,35 +120,81 @@ export declare const CorsOperation: {
60
120
  readonly B2UploadFile: "b2_upload_file";
61
121
  /** Native B2 multipart-part upload. */
62
122
  readonly B2UploadPart: "b2_upload_part";
63
- /** S3-compatible DELETE. */
64
- readonly S3Delete: "s3_delete";
65
123
  /** S3-compatible GET. */
66
124
  readonly S3Get: "s3_get";
67
- /** S3-compatible HEAD. */
68
- readonly S3Head: "s3_head";
69
- /** S3-compatible POST. */
125
+ /**
126
+ * S3-compatible POST.
127
+ *
128
+ * @deprecated B2 bucket CORS rules do not accept `s3_post`. This member is
129
+ * preserved so existing imports continue to compile. Use one of
130
+ * {@link CORS_ALLOWED_OPERATIONS} for newly validated bucket CORS rules.
131
+ */
70
132
  readonly S3Post: "s3_post";
71
133
  /** S3-compatible PUT. */
72
134
  readonly S3Put: "s3_put";
135
+ /** S3-compatible HEAD. */
136
+ readonly S3Head: "s3_head";
137
+ /** S3-compatible DELETE. */
138
+ readonly S3Delete: "s3_delete";
73
139
  };
74
140
  /**
75
141
  * A B2 or S3 operation that a CORS rule can permit. Derived from
76
142
  * {@link CorsOperation}.
143
+ *
144
+ * @remarks This includes the deprecated `s3_post` compatibility member. Use
145
+ * {@link CorsAllowedOperation} for bucket CORS rules accepted by B2.
77
146
  */
78
147
  export type CorsOperation = (typeof CorsOperation)[keyof typeof CorsOperation];
79
- /** Cross-Origin Resource Sharing (CORS) rule for browser-based access to a bucket. */
148
+ /** All CORS operations accepted by B2 bucket CORS rules. */
149
+ export declare const CORS_ALLOWED_OPERATIONS: readonly ["b2_download_file_by_name", "b2_download_file_by_id", "b2_upload_file", "b2_upload_part", "s3_get", "s3_put", "s3_head", "s3_delete"];
150
+ /** B2 bucket CORS operation values accepted by validated CORS rules. */
151
+ export type CorsAllowedOperation = (typeof CORS_ALLOWED_OPERATIONS)[number];
152
+ /** Maximum number of CORS rules allowed on a bucket. */
153
+ export declare const CORS_RULES_MAX_COUNT = 100;
154
+ /** Minimum character length for a CORS rule name. */
155
+ export declare const CORS_RULE_NAME_MIN_LENGTH = 6;
156
+ /** Maximum character length for a CORS rule name. */
157
+ export declare const CORS_RULE_NAME_MAX_LENGTH = 63;
158
+ /** CORS rule names must match this regular-expression source. */
159
+ export declare const CORS_RULE_NAME_PATTERN = "^[A-Za-z0-9-]+$";
160
+ /** Reserved CORS rule-name prefix used by Backblaze. */
161
+ export declare const CORS_RULE_NAME_RESERVED_PREFIX = "b2-";
162
+ /** Exclusive UTF-8 byte-size ceiling for each CORS rule definition. */
163
+ export declare const CORS_RULE_MAX_BYTES = 1000;
164
+ /** Maximum accepted CORS preflight cache duration in seconds. */
165
+ export declare const CORS_MAX_AGE_SECONDS_MAX = 86400;
166
+ /**
167
+ * Cross-Origin Resource Sharing (CORS) rule for browser-based access to a bucket.
168
+ * A bucket may have up to {@link CORS_RULES_MAX_COUNT} rules, and each rule's
169
+ * name, allowed origins, allowed operations, allowed headers, and exposed
170
+ * headers must total less than {@link CORS_RULE_MAX_BYTES} UTF-8 bytes.
171
+ */
80
172
  export interface CorsRule {
81
- /** Unique name identifying this CORS rule within the bucket. */
173
+ /**
174
+ * Unique name identifying this CORS rule within the bucket.
175
+ * Must be 6-63 characters, match `[A-Za-z0-9-]`, and not start with `b2-`.
176
+ */
82
177
  readonly corsRuleName: string;
83
- /** Origins allowed to make cross-origin requests (e.g., `'https://example.com'`). */
178
+ /**
179
+ * Origins allowed to make cross-origin requests (e.g., `'https://example.com'`).
180
+ * At least one origin is required.
181
+ */
84
182
  readonly allowedOrigins: readonly string[];
85
- /** B2 and S3 operations permitted by this rule. */
86
- readonly allowedOperations: readonly CorsOperation[];
87
- /** Request headers allowed in preflight requests, or null if none are allowed. */
88
- readonly allowedHeaders: readonly string[] | null;
89
- /** Response headers exposed to the browser, or null if none are exposed. */
90
- readonly exposeHeaders: readonly string[] | null;
91
- /** Maximum time (in seconds) browsers may cache the preflight response. */
183
+ /**
184
+ * B2 and S3 operations permitted by this rule.
185
+ * At least one operation is required, and every value must be from
186
+ * {@link CORS_ALLOWED_OPERATIONS}.
187
+ */
188
+ readonly allowedOperations: readonly CorsAllowedOperation[];
189
+ /**
190
+ * Request headers allowed in preflight requests, or null/omitted if none are allowed.
191
+ */
192
+ readonly allowedHeaders?: readonly string[] | null;
193
+ /**
194
+ * Response headers exposed to the browser, or null/omitted if none are exposed.
195
+ */
196
+ readonly exposeHeaders?: readonly string[] | null;
197
+ /** Maximum time (0-86400 seconds) browsers may cache the preflight response. */
92
198
  readonly maxAgeSeconds: number;
93
199
  }
94
200
  /**
@@ -121,6 +227,26 @@ export interface BucketRetentionPolicy {
121
227
  /** Retention period, or null when mode is `'none'`. */
122
228
  readonly period: RetentionPeriod | null;
123
229
  }
230
+ /** B2 response shape for a bucket with no default Object Lock retention. */
231
+ export interface NoBucketDefaultRetention {
232
+ /** B2 returns null when no bucket default retention policy is configured. */
233
+ readonly mode: null;
234
+ /** No retention period is configured. */
235
+ readonly period: null;
236
+ }
237
+ /** Default Object Lock retention as returned in bucket metadata. */
238
+ export type BucketDefaultRetention = BucketRetentionPolicy | NoBucketDefaultRetention;
239
+ /** Cross-region replication settings as returned by readable B2 bucket metadata. */
240
+ export interface ReadableReplicationConfiguration {
241
+ /** Whether the caller is authorized to read replication settings. */
242
+ readonly isClientAuthorizedToRead: boolean;
243
+ /** Replication settings, or null when none are configured or the caller is not authorized to read them. */
244
+ readonly value: ReplicationConfiguration | null;
245
+ }
246
+ /** Bucket default server-side encryption setting returned by B2 bucket responses. */
247
+ export type BucketDefaultServerSideEncryption = PublicEncryptionSetting;
248
+ /** Bucket default server-side encryption setting accepted by B2 bucket requests. */
249
+ export type BucketDefaultServerSideEncryptionSetting = SseB2Setting | NoEncryption;
124
250
  /**
125
251
  * Complete bucket metadata as returned by the B2 API.
126
252
  * Corresponds to the bucket object in responses from `b2_list_buckets`, `b2_create_bucket`, and `b2_update_bucket`.
@@ -132,14 +258,19 @@ export interface BucketInfo {
132
258
  readonly bucketId: BucketId;
133
259
  /** Globally unique name of this bucket. */
134
260
  readonly bucketName: string;
135
- /** Access level of this bucket. */
136
- readonly bucketType: BucketType;
261
+ /** Access level or response-only type of this bucket. */
262
+ readonly bucketType: BucketResponseType;
137
263
  /** User-defined key-value metadata stored on the bucket. */
138
264
  readonly bucketInfo: Record<string, string>;
139
265
  /** CORS rules configured on this bucket. */
140
266
  readonly corsRules: readonly CorsRule[];
141
267
  /** Default server-side encryption setting for new files in this bucket. */
142
- readonly defaultServerSideEncryption: EncryptionSetting;
268
+ readonly defaultServerSideEncryption: {
269
+ /** Whether the caller is authorized to read default server-side encryption settings. */
270
+ readonly isClientAuthorizedToRead: boolean;
271
+ /** Default server-side encryption settings, or null if the caller lacks read authorization. */
272
+ readonly value: BucketDefaultServerSideEncryption | null;
273
+ };
143
274
  /** File Lock configuration including authorization status and current settings. */
144
275
  readonly fileLockConfiguration: {
145
276
  /** Whether the caller is authorized to read file lock settings. */
@@ -149,19 +280,17 @@ export interface BucketInfo {
149
280
  /** Whether Object Lock is enabled on this bucket. */
150
281
  readonly isFileLockEnabled: boolean;
151
282
  /** Default retention policy for newly uploaded files. */
152
- readonly defaultRetention: BucketRetentionPolicy;
283
+ readonly defaultRetention: BucketDefaultRetention;
153
284
  } | null;
154
285
  };
155
286
  /** Lifecycle rules configured on this bucket. */
156
287
  readonly lifecycleRules: readonly LifecycleRule[];
157
- /** Set of options enabled on this bucket (e.g., `'s3'`). */
158
- readonly options: readonly string[];
288
+ /** Set of options enabled on this bucket (e.g., {@link BucketKeyOption.S3}). */
289
+ readonly options: readonly BucketKeyOption[];
159
290
  /** Monotonically increasing revision number, incremented on each bucket update. */
160
291
  readonly revision: number;
161
- /** Default retention policy for newly uploaded files. */
162
- readonly defaultRetention: BucketRetentionPolicy;
163
- /** Cross-region replication configuration for this bucket. */
164
- readonly replicationConfiguration: ReplicationConfiguration;
292
+ /** Cross-region replication configuration, filtered by caller authorization. */
293
+ readonly replicationConfiguration: ReadableReplicationConfiguration;
165
294
  }
166
295
  /**
167
296
  * Request parameters for the `b2_create_bucket` API call.
@@ -173,12 +302,24 @@ export interface CreateBucketRequest {
173
302
  readonly bucketName: string;
174
303
  /** Access level for the bucket. */
175
304
  readonly bucketType: BucketType;
176
- /** Optional user-defined key-value metadata. */
305
+ /**
306
+ * Optional user-defined key-value metadata.
307
+ * Keys must be 1-50 UTF-8 bytes and must not start with `b2-`; the aggregate
308
+ * UTF-8 byte length of all values must be at most 10,000 bytes. Keys must
309
+ * match {@link BUCKET_INFO_KEY_PATTERN}. BucketInfo has no documented
310
+ * pair-count cap.
311
+ */
177
312
  readonly bucketInfo?: Record<string, string>;
178
- /** Optional CORS rules. */
313
+ /**
314
+ * Optional CORS rules.
315
+ * A bucket may have at most 100 rules. Each rule name must be unique, 6-63
316
+ * characters, match `[A-Za-z0-9-]`, and not start with `b2-`. Each rule's
317
+ * name, origins, operations, allowed headers, and exposed headers must total
318
+ * less than 1,000 UTF-8 bytes. `maxAgeSeconds` must be at most 86,400.
319
+ */
179
320
  readonly corsRules?: readonly CorsRule[];
180
321
  /** Optional default server-side encryption setting. */
181
- readonly defaultServerSideEncryption?: EncryptionSetting;
322
+ readonly defaultServerSideEncryption?: BucketDefaultServerSideEncryptionSetting;
182
323
  /** Optional default Object Lock retention policy. */
183
324
  readonly defaultRetention?: BucketRetentionPolicy;
184
325
  /** Whether to enable Object Lock on the bucket. Cannot be changed after creation. */
@@ -198,12 +339,24 @@ export interface UpdateBucketRequest {
198
339
  readonly bucketId: BucketId;
199
340
  /** New access level for the bucket. */
200
341
  readonly bucketType?: BucketType;
201
- /** Updated user-defined key-value metadata. Replaces all existing metadata. */
342
+ /**
343
+ * Updated user-defined key-value metadata. Replaces all existing metadata.
344
+ * Keys must be 1-50 UTF-8 bytes and must not start with `b2-`; the aggregate
345
+ * UTF-8 byte length of all values must be at most 10,000 bytes. Keys must
346
+ * match {@link BUCKET_INFO_KEY_PATTERN}. BucketInfo has no documented
347
+ * pair-count cap.
348
+ */
202
349
  readonly bucketInfo?: Record<string, string>;
203
- /** Updated CORS rules. Replaces all existing rules. */
350
+ /**
351
+ * Updated CORS rules. Replaces all existing rules.
352
+ * A bucket may have at most 100 rules. Each rule name must be unique, 6-63
353
+ * characters, match `[A-Za-z0-9-]`, and not start with `b2-`. Each rule's
354
+ * name, origins, operations, allowed headers, and exposed headers must total
355
+ * less than 1,000 UTF-8 bytes. `maxAgeSeconds` must be at most 86,400.
356
+ */
204
357
  readonly corsRules?: readonly CorsRule[];
205
358
  /** Updated default server-side encryption setting. */
206
- readonly defaultServerSideEncryption?: EncryptionSetting;
359
+ readonly defaultServerSideEncryption?: BucketDefaultServerSideEncryptionSetting;
207
360
  /** Updated default Object Lock retention policy. */
208
361
  readonly defaultRetention?: BucketRetentionPolicy;
209
362
  /** Whether to enable Object Lock. Can only transition from disabled to enabled. */
@@ -226,7 +379,7 @@ export interface ListBucketsRequest {
226
379
  /** Optional filter to return only the bucket with this name. */
227
380
  readonly bucketName?: string;
228
381
  /** Optional filter to return only buckets of these types. */
229
- readonly bucketTypes?: readonly BucketType[];
382
+ readonly bucketTypes?: BucketTypesFilter;
230
383
  }
231
384
  /** Response from the `b2_list_buckets` API call. */
232
385
  export interface ListBucketsResponse {
@@ -1 +1 @@
1
- {"version":3,"file":"bucket.d.ts","sourceRoot":"","sources":["../../src/types/bucket.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAEhE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU;IACrB,oDAAoD;;IAEpD,+CAA+C;;IAE/C,iEAAiE;;IAEjE,gEAAgE;;CAExD,CAAA;AAEV,qEAAqE;AACrE,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAA;AAErE,uFAAuF;AACvF,MAAM,WAAW,aAAa;IAC5B,8FAA8F;IAC9F,QAAQ,CAAC,wBAAwB,EAAE,MAAM,GAAG,IAAI,CAAA;IAChD,6EAA6E;IAC7E,QAAQ,CAAC,yBAAyB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjD,6EAA6E;IAC7E,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;CAChC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa;IACxB,0CAA0C;;IAE1C,wCAAwC;;IAExC,mCAAmC;;IAEnC,uCAAuC;;IAEvC,4BAA4B;;IAE5B,yBAAyB;;IAEzB,0BAA0B;;IAE1B,0BAA0B;;IAE1B,yBAAyB;;CAEjB,CAAA;AAEV;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAA;AAE9E,sFAAsF;AACtF,MAAM,WAAW,QAAQ;IACvB,gEAAgE;IAChE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,qFAAqF;I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AAE,qBAAqB,CAAA;IACjD,mFAAmF;IACnF,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAA;IAClC,4DAA4D;IAC5D,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,aAAa,EAAE,CAAA;IAClD,yCAAyC;IACzC,QAAQ,CAAC,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;IAC5D,2FAA2F;IAC3F,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,qCAAqC;IACrC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;IAC5B,gEAAgE;IAChE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,6DAA6D;IAC7D,QAAQ,CAAC,WAAW,CAAC,EAAE,iBAAiB,CAAA;CACzC;AAED,oDAAoD;AACpD,MAAM,WAAW,mBAAmB;IAClC,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAA;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,oCAAoC;IACpC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;CAC5B"}
@@ -1,10 +1,6 @@
1
1
  //#region src/types/bucket.ts
2
2
  /**
3
- * Named constants for the bucket access level.
4
- *
5
- * The {@link BucketType} type alias is derived from the values of this
6
- * object, so the const is the single source of truth: adding a key here
7
- * automatically widens the type union.
3
+ * Named constants for bucket types accepted by create/update bucket requests.
8
4
  *
9
5
  * @example
10
6
  * ```ts
@@ -21,6 +17,34 @@ var BucketType = {
21
17
  /** B2-restricted bucket (e.g., for S3-compatible workflows). */
22
18
  Restricted: "restricted"
23
19
  };
20
+ /** Named constants for documented bucket response types known to the SDK. */
21
+ var KnownBucketResponseType = {
22
+ ...BucketType,
23
+ /** Response-only bucket type for buckets shared with the account. */
24
+ Shared: "shared"
25
+ };
26
+ /**
27
+ * Named constants for option flags returned on buckets and application keys.
28
+ *
29
+ * B2 currently documents only the S3-compatible API option.
30
+ */
31
+ var BucketKeyOption = {
32
+ /** Enables the S3-compatible API surface for the bucket or key. */
33
+ S3: "s3" };
34
+ /** Minimum UTF-8 byte length for each bucketInfo key. */
35
+ var BUCKET_INFO_KEY_MIN_BYTES = 1;
36
+ /** Maximum UTF-8 byte length for each bucketInfo key. */
37
+ var BUCKET_INFO_KEY_MAX_BYTES = 50;
38
+ /** Maximum aggregate UTF-8 byte length of all bucketInfo values. */
39
+ var BUCKET_INFO_VALUES_MAX_BYTES = 1e4;
40
+ /** Reserved bucketInfo key prefix used by Backblaze. */
41
+ var BUCKET_INFO_RESERVED_PREFIX = "b2-";
42
+ /**
43
+ * BucketInfo keys must match this regular-expression source. B2 accepts
44
+ * letters, digits, and these characters: `. _ ~ ! # $ % ^ & * ' | + -` plus the
45
+ * backtick.
46
+ */
47
+ var BUCKET_INFO_KEY_PATTERN = "^[A-Za-z0-9._`~!#$%^&*'|+-]+$";
24
48
  /**
25
49
  * Named constants for the B2 + S3 operations a CORS rule can permit.
26
50
  *
@@ -47,17 +71,48 @@ var CorsOperation = {
47
71
  B2UploadFile: "b2_upload_file",
48
72
  /** Native B2 multipart-part upload. */
49
73
  B2UploadPart: "b2_upload_part",
50
- /** S3-compatible DELETE. */
51
- S3Delete: "s3_delete",
52
74
  /** S3-compatible GET. */
53
75
  S3Get: "s3_get",
54
- /** S3-compatible HEAD. */
55
- S3Head: "s3_head",
56
- /** S3-compatible POST. */
76
+ /**
77
+ * S3-compatible POST.
78
+ *
79
+ * @deprecated B2 bucket CORS rules do not accept `s3_post`. This member is
80
+ * preserved so existing imports continue to compile. Use one of
81
+ * {@link CORS_ALLOWED_OPERATIONS} for newly validated bucket CORS rules.
82
+ */
57
83
  S3Post: "s3_post",
58
84
  /** S3-compatible PUT. */
59
- S3Put: "s3_put"
85
+ S3Put: "s3_put",
86
+ /** S3-compatible HEAD. */
87
+ S3Head: "s3_head",
88
+ /** S3-compatible DELETE. */
89
+ S3Delete: "s3_delete"
60
90
  };
91
+ /** All CORS operations accepted by B2 bucket CORS rules. */
92
+ var CORS_ALLOWED_OPERATIONS = [
93
+ CorsOperation.B2DownloadFileByName,
94
+ CorsOperation.B2DownloadFileById,
95
+ CorsOperation.B2UploadFile,
96
+ CorsOperation.B2UploadPart,
97
+ CorsOperation.S3Get,
98
+ CorsOperation.S3Put,
99
+ CorsOperation.S3Head,
100
+ CorsOperation.S3Delete
101
+ ];
102
+ /** Maximum number of CORS rules allowed on a bucket. */
103
+ var CORS_RULES_MAX_COUNT = 100;
104
+ /** Minimum character length for a CORS rule name. */
105
+ var CORS_RULE_NAME_MIN_LENGTH = 6;
106
+ /** Maximum character length for a CORS rule name. */
107
+ var CORS_RULE_NAME_MAX_LENGTH = 63;
108
+ /** CORS rule names must match this regular-expression source. */
109
+ var CORS_RULE_NAME_PATTERN = "^[A-Za-z0-9-]+$";
110
+ /** Reserved CORS rule-name prefix used by Backblaze. */
111
+ var CORS_RULE_NAME_RESERVED_PREFIX = "b2-";
112
+ /** Exclusive UTF-8 byte-size ceiling for each CORS rule definition. */
113
+ var CORS_RULE_MAX_BYTES = 1e3;
114
+ /** Maximum accepted CORS preflight cache duration in seconds. */
115
+ var CORS_MAX_AGE_SECONDS_MAX = 86400;
61
116
  /**
62
117
  * Named constants for the bucket-level Object Lock retention mode.
63
118
  *
@@ -73,6 +128,6 @@ var BucketRetentionMode = {
73
128
  None: "none"
74
129
  };
75
130
  //#endregion
76
- export { BucketRetentionMode, BucketType, CorsOperation };
131
+ export { BUCKET_INFO_KEY_MAX_BYTES, BUCKET_INFO_KEY_MIN_BYTES, BUCKET_INFO_KEY_PATTERN, BUCKET_INFO_RESERVED_PREFIX, BUCKET_INFO_VALUES_MAX_BYTES, BucketKeyOption, BucketRetentionMode, BucketType, CORS_ALLOWED_OPERATIONS, CORS_MAX_AGE_SECONDS_MAX, CORS_RULES_MAX_COUNT, CORS_RULE_MAX_BYTES, CORS_RULE_NAME_MAX_LENGTH, CORS_RULE_NAME_MIN_LENGTH, CORS_RULE_NAME_PATTERN, CORS_RULE_NAME_RESERVED_PREFIX, CorsOperation, KnownBucketResponseType };
77
132
 
78
133
  //# sourceMappingURL=bucket.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bucket.js","names":[],"sources":["../../src/types/bucket.ts"],"sourcesContent":["import type { EncryptionSetting } from './encryption.ts'\nimport type { AccountId, BucketId } from './ids.ts'\nimport type { ReplicationConfiguration } from './replication.ts'\n\n/**\n * Named constants for the bucket access level.\n *\n * The {@link BucketType} type alias is derived from the values of this\n * object, so the const is the single source of truth: adding a key here\n * automatically widens the type union.\n *\n * @example\n * ```ts\n * await client.createBucket({ bucketName: 'my-app-logs', bucketType: BucketType.AllPrivate })\n * ```\n */\nexport const BucketType = {\n /** Publicly downloadable without authentication. */\n AllPublic: 'allPublic',\n /** Requires a valid auth token to download. */\n AllPrivate: 'allPrivate',\n /** Internal snapshot bucket type, generally not user-created. */\n Snapshot: 'snapshot',\n /** B2-restricted bucket (e.g., for S3-compatible workflows). */\n Restricted: 'restricted',\n} as const\n\n/** Access level for a B2 bucket. Derived from {@link BucketType}. */\nexport type BucketType = (typeof BucketType)[keyof typeof BucketType]\n\n/** Rule that automatically hides or deletes files after a specified number of days. */\nexport interface LifecycleRule {\n /** Days after hiding before automatic deletion, or null to never auto-delete hidden files. */\n readonly daysFromHidingToDeleting: number | null\n /** Days after upload before automatic hiding, or null to never auto-hide. */\n readonly daysFromUploadingToHiding: number | null\n /** File name prefix this rule applies to. Empty string matches all files. */\n readonly fileNamePrefix: string\n}\n\n/**\n * Named constants for the B2 + S3 operations a CORS rule can permit.\n *\n * @example\n * ```ts\n * await bucket.update({\n * corsRules: [{\n * corsRuleName: 'browser-downloads',\n * allowedOrigins: ['https://example.com'],\n * allowedOperations: [CorsOperation.B2DownloadFileByName, CorsOperation.S3Get],\n * allowedHeaders: null,\n * exposeHeaders: null,\n * maxAgeSeconds: 3600,\n * }],\n * })\n * ```\n */\nexport const CorsOperation = {\n /** Native B2 download-by-name request. */\n B2DownloadFileByName: 'b2_download_file_by_name',\n /** Native B2 download-by-id request. */\n B2DownloadFileById: 'b2_download_file_by_id',\n /** Native B2 small-file upload. */\n B2UploadFile: 'b2_upload_file',\n /** Native B2 multipart-part upload. */\n B2UploadPart: 'b2_upload_part',\n /** S3-compatible DELETE. */\n S3Delete: 's3_delete',\n /** S3-compatible GET. */\n S3Get: 's3_get',\n /** S3-compatible HEAD. */\n S3Head: 's3_head',\n /** S3-compatible POST. */\n S3Post: 's3_post',\n /** S3-compatible PUT. */\n S3Put: 's3_put',\n} as const\n\n/**\n * A B2 or S3 operation that a CORS rule can permit. Derived from\n * {@link CorsOperation}.\n */\nexport type CorsOperation = (typeof CorsOperation)[keyof typeof CorsOperation]\n\n/** Cross-Origin Resource Sharing (CORS) rule for browser-based access to a bucket. */\nexport interface CorsRule {\n /** Unique name identifying this CORS rule within the bucket. */\n readonly corsRuleName: string\n /** Origins allowed to make cross-origin requests (e.g., `'https://example.com'`). */\n readonly allowedOrigins: readonly string[]\n /** B2 and S3 operations permitted by this rule. */\n readonly allowedOperations: readonly CorsOperation[]\n /** Request headers allowed in preflight requests, or null if none are allowed. */\n readonly allowedHeaders: readonly string[] | null\n /** Response headers exposed to the browser, or null if none are exposed. */\n readonly exposeHeaders: readonly string[] | null\n /** Maximum time (in seconds) browsers may cache the preflight response. */\n readonly maxAgeSeconds: number\n}\n\n/**\n * Named constants for the bucket-level Object Lock retention mode.\n *\n * Pair with {@link BucketRetentionPolicy} when setting a bucket's default\n * retention: `{ mode: BucketRetentionMode.Compliance, period: { duration: 30, unit: 'days' } }`.\n */\nexport const BucketRetentionMode = {\n /** Files cannot be deleted or modified during the retention period, even by the account owner. */\n Compliance: 'compliance',\n /** Files cannot be deleted during retention except by callers with the `bypassGovernance` capability. */\n Governance: 'governance',\n /** No default retention is applied to new uploads. */\n None: 'none',\n} as const\n\n/** Bucket-level Object Lock retention mode. Derived from {@link BucketRetentionMode}. */\nexport type BucketRetentionMode = (typeof BucketRetentionMode)[keyof typeof BucketRetentionMode]\n\n/** Duration and unit for a retention period. */\nexport interface RetentionPeriod {\n /** Length of the retention period. */\n readonly duration: number\n /** Time unit for the retention period. */\n readonly unit: 'days' | 'years'\n}\n\n/** Default Object Lock retention policy applied to new files in a bucket. */\nexport interface BucketRetentionPolicy {\n /** Retention mode for the policy. */\n readonly mode: BucketRetentionMode\n /** Retention period, or null when mode is `'none'`. */\n readonly period: RetentionPeriod | null\n}\n\n/**\n * Complete bucket metadata as returned by the B2 API.\n * Corresponds to the bucket object in responses from `b2_list_buckets`, `b2_create_bucket`, and `b2_update_bucket`.\n */\nexport interface BucketInfo {\n /** Account that owns this bucket. */\n readonly accountId: AccountId\n /** Unique identifier for this bucket. */\n readonly bucketId: BucketId\n /** Globally unique name of this bucket. */\n readonly bucketName: string\n /** Access level of this bucket. */\n readonly bucketType: BucketType\n /** User-defined key-value metadata stored on the bucket. */\n readonly bucketInfo: Record<string, string>\n /** CORS rules configured on this bucket. */\n readonly corsRules: readonly CorsRule[]\n /** Default server-side encryption setting for new files in this bucket. */\n readonly defaultServerSideEncryption: EncryptionSetting\n /** File Lock configuration including authorization status and current settings. */\n readonly fileLockConfiguration: {\n /** Whether the caller is authorized to read file lock settings. */\n readonly isClientAuthorizedToRead: boolean\n /** File lock settings, or null if the caller lacks read authorization. */\n readonly value: {\n /** Whether Object Lock is enabled on this bucket. */\n readonly isFileLockEnabled: boolean\n /** Default retention policy for newly uploaded files. */\n readonly defaultRetention: BucketRetentionPolicy\n } | null\n }\n /** Lifecycle rules configured on this bucket. */\n readonly lifecycleRules: readonly LifecycleRule[]\n /** Set of options enabled on this bucket (e.g., `'s3'`). */\n readonly options: readonly string[]\n /** Monotonically increasing revision number, incremented on each bucket update. */\n readonly revision: number\n /** Default retention policy for newly uploaded files. */\n readonly defaultRetention: BucketRetentionPolicy\n /** Cross-region replication configuration for this bucket. */\n readonly replicationConfiguration: ReplicationConfiguration\n}\n\n/**\n * Request parameters for the `b2_create_bucket` API call.\n */\nexport interface CreateBucketRequest {\n /** Account that will own the new bucket. */\n readonly accountId: AccountId\n /** Globally unique name for the bucket. */\n readonly bucketName: string\n /** Access level for the bucket. */\n readonly bucketType: BucketType\n /** Optional user-defined key-value metadata. */\n readonly bucketInfo?: Record<string, string>\n /** Optional CORS rules. */\n readonly corsRules?: readonly CorsRule[]\n /** Optional default server-side encryption setting. */\n readonly defaultServerSideEncryption?: EncryptionSetting\n /** Optional default Object Lock retention policy. */\n readonly defaultRetention?: BucketRetentionPolicy\n /** Whether to enable Object Lock on the bucket. Cannot be changed after creation. */\n readonly fileLockEnabled?: boolean\n /** Optional lifecycle rules. */\n readonly lifecycleRules?: readonly LifecycleRule[]\n /** Optional replication configuration. */\n readonly replicationConfiguration?: ReplicationConfiguration\n}\n\n/**\n * Request parameters for the `b2_update_bucket` API call.\n */\nexport interface UpdateBucketRequest {\n /** Account that owns the bucket. */\n readonly accountId: AccountId\n /** ID of the bucket to update. */\n readonly bucketId: BucketId\n /** New access level for the bucket. */\n readonly bucketType?: BucketType\n /** Updated user-defined key-value metadata. Replaces all existing metadata. */\n readonly bucketInfo?: Record<string, string>\n /** Updated CORS rules. Replaces all existing rules. */\n readonly corsRules?: readonly CorsRule[]\n /** Updated default server-side encryption setting. */\n readonly defaultServerSideEncryption?: EncryptionSetting\n /** Updated default Object Lock retention policy. */\n readonly defaultRetention?: BucketRetentionPolicy\n /** Whether to enable Object Lock. Can only transition from disabled to enabled. */\n readonly fileLockEnabled?: boolean\n /** Updated lifecycle rules. Replaces all existing rules. */\n readonly lifecycleRules?: readonly LifecycleRule[]\n /** Updated replication configuration. */\n readonly replicationConfiguration?: ReplicationConfiguration\n /** Optimistic locking: only update if the bucket's current revision matches this value. */\n readonly ifRevisionIs?: number\n}\n\n/**\n * Request parameters for the `b2_list_buckets` API call.\n */\nexport interface ListBucketsRequest {\n /** Account whose buckets to list. */\n readonly accountId: AccountId\n /** Optional filter to return only the bucket with this ID. */\n readonly bucketId?: BucketId\n /** Optional filter to return only the bucket with this name. */\n readonly bucketName?: string\n /** Optional filter to return only buckets of these types. */\n readonly bucketTypes?: readonly BucketType[]\n}\n\n/** Response from the `b2_list_buckets` API call. */\nexport interface ListBucketsResponse {\n /** Array of buckets matching the request filters. */\n readonly buckets: readonly BucketInfo[]\n}\n\n/**\n * Request parameters for the `b2_delete_bucket` API call.\n */\nexport interface DeleteBucketRequest {\n /** Account that owns the bucket. */\n readonly accountId: AccountId\n /** ID of the bucket to delete. The bucket must be empty. */\n readonly bucketId: BucketId\n}\n"],"mappings":";;;;;;;;;;;;;AAgBA,IAAa,aAAa;;CAExB,WAAW;;CAEX,YAAY;;CAEZ,UAAU;;CAEV,YAAY;AACd;;;;;;;;;;;;;;;;;;AAgCA,IAAa,gBAAgB;;CAE3B,sBAAsB;;CAEtB,oBAAoB;;CAEpB,cAAc;;CAEd,cAAc;;CAEd,UAAU;;CAEV,OAAO;;CAEP,QAAQ;;CAER,QAAQ;;CAER,OAAO;AACT;;;;;;;AA8BA,IAAa,sBAAsB;;CAEjC,YAAY;;CAEZ,YAAY;;CAEZ,MAAM;AACR"}
1
+ {"version":3,"file":"bucket.js","names":[],"sources":["../../src/types/bucket.ts"],"sourcesContent":["import type { NoEncryption, PublicEncryptionSetting, SseB2Setting } from './encryption.ts'\nimport type { AccountId, BucketId } from './ids.ts'\nimport type { ReplicationConfiguration } from './replication.ts'\n\n/**\n * Named constants for bucket types accepted by create/update bucket requests.\n *\n * @example\n * ```ts\n * await client.createBucket({ bucketName: 'my-app-logs', bucketType: BucketType.AllPrivate })\n * ```\n */\nexport const BucketType = {\n /** Publicly downloadable without authentication. */\n AllPublic: 'allPublic',\n /** Requires a valid auth token to download. */\n AllPrivate: 'allPrivate',\n /** Internal snapshot bucket type, generally not user-created. */\n Snapshot: 'snapshot',\n /** B2-restricted bucket (e.g., for S3-compatible workflows). */\n Restricted: 'restricted',\n} as const\n\n/** Bucket access levels accepted by B2 bucket create/update requests. */\nexport type BucketType = (typeof BucketType)[keyof typeof BucketType]\n\n/** Named constants for documented bucket response types known to the SDK. */\nexport const KnownBucketResponseType = {\n ...BucketType,\n /** Response-only bucket type for buckets shared with the account. */\n Shared: 'shared',\n} as const\n\n/** Closed union of documented bucket response types known to the SDK. */\nexport type KnownBucketResponseType =\n (typeof KnownBucketResponseType)[keyof typeof KnownBucketResponseType]\n\n/** Bucket type returned by B2 bucket responses, including future B2-added values. */\nexport type BucketResponseType = KnownBucketResponseType | (string & {})\n\n/**\n * Bucket type value accepted by `b2_list_buckets.bucketTypes`.\n *\n * This includes future B2-added strings, so TypeScript cannot statically exclude\n * the special `'all'` value from this open string type. Runtime validation still\n * enforces that `'all'` is only valid as `['all']` and that filters are non-empty.\n */\nexport type BucketListType = BucketResponseType\n\n/**\n * Bucket type filter accepted by `b2_list_buckets`.\n *\n * Use `['all']` by itself to request all bucket types. Other filters may include\n * documented response types such as `'shared'` and future B2-added type strings.\n * Because future bucket types are modeled as an open string, TypeScript cannot\n * reject empty arrays or mixed arrays containing `'all'`; B2 and the simulator\n * reject them at runtime.\n */\nexport type BucketTypesFilter = readonly ['all'] | readonly BucketListType[]\n\n/**\n * Named constants for option flags returned on buckets and application keys.\n *\n * B2 currently documents only the S3-compatible API option.\n */\nexport const BucketKeyOption = {\n /** Enables the S3-compatible API surface for the bucket or key. */\n S3: 's3',\n} as const\n\n/** Documented option flag returned on bucket and application key metadata. */\nexport type KnownBucketKeyOption = (typeof BucketKeyOption)[keyof typeof BucketKeyOption]\n\n/** Option flag returned on bucket and application key metadata, open to future B2-added strings. */\nexport type BucketKeyOption = KnownBucketKeyOption | (string & {})\n\n/** Minimum UTF-8 byte length for each bucketInfo key. */\nexport const BUCKET_INFO_KEY_MIN_BYTES = 1\n/** Maximum UTF-8 byte length for each bucketInfo key. */\nexport const BUCKET_INFO_KEY_MAX_BYTES = 50\n/** Maximum aggregate UTF-8 byte length of all bucketInfo values. */\nexport const BUCKET_INFO_VALUES_MAX_BYTES = 10_000\n/** Reserved bucketInfo key prefix used by Backblaze. */\nexport const BUCKET_INFO_RESERVED_PREFIX = 'b2-'\n/**\n * BucketInfo keys must match this regular-expression source. B2 accepts\n * letters, digits, and these characters: `. _ ~ ! # $ % ^ & * ' | + -` plus the\n * backtick.\n */\nexport const BUCKET_INFO_KEY_PATTERN = \"^[A-Za-z0-9._`~!#$%^&*'|+-]+$\"\n\n/** Rule that automatically hides or deletes files after a specified number of days. */\nexport interface LifecycleRule {\n /** Days after hiding before automatic deletion, or null to never auto-delete hidden files. */\n readonly daysFromHidingToDeleting?: number | null\n /** Days after upload before automatic hiding, or null to never auto-hide. */\n readonly daysFromUploadingToHiding?: number | null\n /** Days after starting before automatic cancellation of unfinished large files, or null to never auto-cancel. */\n readonly daysFromStartingToCancelingUnfinishedLargeFiles?: number | null\n /** File name prefix this rule applies to. Empty string matches all files. */\n readonly fileNamePrefix: string\n}\n\n/**\n * Named constants for the B2 + S3 operations a CORS rule can permit.\n *\n * @example\n * ```ts\n * await bucket.update({\n * corsRules: [{\n * corsRuleName: 'browser-downloads',\n * allowedOrigins: ['https://example.com'],\n * allowedOperations: [CorsOperation.B2DownloadFileByName, CorsOperation.S3Get],\n * allowedHeaders: null,\n * exposeHeaders: null,\n * maxAgeSeconds: 3600,\n * }],\n * })\n * ```\n */\nexport const CorsOperation = {\n /** Native B2 download-by-name request. */\n B2DownloadFileByName: 'b2_download_file_by_name',\n /** Native B2 download-by-id request. */\n B2DownloadFileById: 'b2_download_file_by_id',\n /** Native B2 small-file upload. */\n B2UploadFile: 'b2_upload_file',\n /** Native B2 multipart-part upload. */\n B2UploadPart: 'b2_upload_part',\n /** S3-compatible GET. */\n S3Get: 's3_get',\n /**\n * S3-compatible POST.\n *\n * @deprecated B2 bucket CORS rules do not accept `s3_post`. This member is\n * preserved so existing imports continue to compile. Use one of\n * {@link CORS_ALLOWED_OPERATIONS} for newly validated bucket CORS rules.\n */\n S3Post: 's3_post',\n /** S3-compatible PUT. */\n S3Put: 's3_put',\n /** S3-compatible HEAD. */\n S3Head: 's3_head',\n /** S3-compatible DELETE. */\n S3Delete: 's3_delete',\n} as const\n\n/**\n * A B2 or S3 operation that a CORS rule can permit. Derived from\n * {@link CorsOperation}.\n *\n * @remarks This includes the deprecated `s3_post` compatibility member. Use\n * {@link CorsAllowedOperation} for bucket CORS rules accepted by B2.\n */\nexport type CorsOperation = (typeof CorsOperation)[keyof typeof CorsOperation]\n\n/** All CORS operations accepted by B2 bucket CORS rules. */\nexport const CORS_ALLOWED_OPERATIONS = [\n CorsOperation.B2DownloadFileByName,\n CorsOperation.B2DownloadFileById,\n CorsOperation.B2UploadFile,\n CorsOperation.B2UploadPart,\n CorsOperation.S3Get,\n CorsOperation.S3Put,\n CorsOperation.S3Head,\n CorsOperation.S3Delete,\n] as const satisfies readonly CorsOperation[]\n\n/** B2 bucket CORS operation values accepted by validated CORS rules. */\nexport type CorsAllowedOperation = (typeof CORS_ALLOWED_OPERATIONS)[number]\n\n/** Maximum number of CORS rules allowed on a bucket. */\nexport const CORS_RULES_MAX_COUNT = 100\n/** Minimum character length for a CORS rule name. */\nexport const CORS_RULE_NAME_MIN_LENGTH = 6\n/** Maximum character length for a CORS rule name. */\nexport const CORS_RULE_NAME_MAX_LENGTH = 63\n/** CORS rule names must match this regular-expression source. */\nexport const CORS_RULE_NAME_PATTERN = '^[A-Za-z0-9-]+$'\n/** Reserved CORS rule-name prefix used by Backblaze. */\nexport const CORS_RULE_NAME_RESERVED_PREFIX = 'b2-'\n/** Exclusive UTF-8 byte-size ceiling for each CORS rule definition. */\nexport const CORS_RULE_MAX_BYTES = 1_000\n/** Maximum accepted CORS preflight cache duration in seconds. */\nexport const CORS_MAX_AGE_SECONDS_MAX = 86_400\n\n/**\n * Cross-Origin Resource Sharing (CORS) rule for browser-based access to a bucket.\n * A bucket may have up to {@link CORS_RULES_MAX_COUNT} rules, and each rule's\n * name, allowed origins, allowed operations, allowed headers, and exposed\n * headers must total less than {@link CORS_RULE_MAX_BYTES} UTF-8 bytes.\n */\nexport interface CorsRule {\n /**\n * Unique name identifying this CORS rule within the bucket.\n * Must be 6-63 characters, match `[A-Za-z0-9-]`, and not start with `b2-`.\n */\n readonly corsRuleName: string\n /**\n * Origins allowed to make cross-origin requests (e.g., `'https://example.com'`).\n * At least one origin is required.\n */\n readonly allowedOrigins: readonly string[]\n /**\n * B2 and S3 operations permitted by this rule.\n * At least one operation is required, and every value must be from\n * {@link CORS_ALLOWED_OPERATIONS}.\n */\n readonly allowedOperations: readonly CorsAllowedOperation[]\n /**\n * Request headers allowed in preflight requests, or null/omitted if none are allowed.\n */\n readonly allowedHeaders?: readonly string[] | null\n /**\n * Response headers exposed to the browser, or null/omitted if none are exposed.\n */\n readonly exposeHeaders?: readonly string[] | null\n /** Maximum time (0-86400 seconds) browsers may cache the preflight response. */\n readonly maxAgeSeconds: number\n}\n\n/**\n * Named constants for the bucket-level Object Lock retention mode.\n *\n * Pair with {@link BucketRetentionPolicy} when setting a bucket's default\n * retention: `{ mode: BucketRetentionMode.Compliance, period: { duration: 30, unit: 'days' } }`.\n */\nexport const BucketRetentionMode = {\n /** Files cannot be deleted or modified during the retention period, even by the account owner. */\n Compliance: 'compliance',\n /** Files cannot be deleted during retention except by callers with the `bypassGovernance` capability. */\n Governance: 'governance',\n /** No default retention is applied to new uploads. */\n None: 'none',\n} as const\n\n/** Bucket-level Object Lock retention mode. Derived from {@link BucketRetentionMode}. */\nexport type BucketRetentionMode = (typeof BucketRetentionMode)[keyof typeof BucketRetentionMode]\n\n/** Duration and unit for a retention period. */\nexport interface RetentionPeriod {\n /** Length of the retention period. */\n readonly duration: number\n /** Time unit for the retention period. */\n readonly unit: 'days' | 'years'\n}\n\n/** Default Object Lock retention policy applied to new files in a bucket. */\nexport interface BucketRetentionPolicy {\n /** Retention mode for the policy. */\n readonly mode: BucketRetentionMode\n /** Retention period, or null when mode is `'none'`. */\n readonly period: RetentionPeriod | null\n}\n\n/** B2 response shape for a bucket with no default Object Lock retention. */\nexport interface NoBucketDefaultRetention {\n /** B2 returns null when no bucket default retention policy is configured. */\n readonly mode: null\n /** No retention period is configured. */\n readonly period: null\n}\n\n/** Default Object Lock retention as returned in bucket metadata. */\nexport type BucketDefaultRetention = BucketRetentionPolicy | NoBucketDefaultRetention\n\n/** Cross-region replication settings as returned by readable B2 bucket metadata. */\nexport interface ReadableReplicationConfiguration {\n /** Whether the caller is authorized to read replication settings. */\n readonly isClientAuthorizedToRead: boolean\n /** Replication settings, or null when none are configured or the caller is not authorized to read them. */\n readonly value: ReplicationConfiguration | null\n}\n\n/** Bucket default server-side encryption setting returned by B2 bucket responses. */\nexport type BucketDefaultServerSideEncryption = PublicEncryptionSetting\n\n/** Bucket default server-side encryption setting accepted by B2 bucket requests. */\nexport type BucketDefaultServerSideEncryptionSetting = SseB2Setting | NoEncryption\n\n/**\n * Complete bucket metadata as returned by the B2 API.\n * Corresponds to the bucket object in responses from `b2_list_buckets`, `b2_create_bucket`, and `b2_update_bucket`.\n */\nexport interface BucketInfo {\n /** Account that owns this bucket. */\n readonly accountId: AccountId\n /** Unique identifier for this bucket. */\n readonly bucketId: BucketId\n /** Globally unique name of this bucket. */\n readonly bucketName: string\n /** Access level or response-only type of this bucket. */\n readonly bucketType: BucketResponseType\n /** User-defined key-value metadata stored on the bucket. */\n readonly bucketInfo: Record<string, string>\n /** CORS rules configured on this bucket. */\n readonly corsRules: readonly CorsRule[]\n /** Default server-side encryption setting for new files in this bucket. */\n readonly defaultServerSideEncryption: {\n /** Whether the caller is authorized to read default server-side encryption settings. */\n readonly isClientAuthorizedToRead: boolean\n /** Default server-side encryption settings, or null if the caller lacks read authorization. */\n readonly value: BucketDefaultServerSideEncryption | null\n }\n /** File Lock configuration including authorization status and current settings. */\n readonly fileLockConfiguration: {\n /** Whether the caller is authorized to read file lock settings. */\n readonly isClientAuthorizedToRead: boolean\n /** File lock settings, or null if the caller lacks read authorization. */\n readonly value: {\n /** Whether Object Lock is enabled on this bucket. */\n readonly isFileLockEnabled: boolean\n /** Default retention policy for newly uploaded files. */\n readonly defaultRetention: BucketDefaultRetention\n } | null\n }\n /** Lifecycle rules configured on this bucket. */\n readonly lifecycleRules: readonly LifecycleRule[]\n /** Set of options enabled on this bucket (e.g., {@link BucketKeyOption.S3}). */\n readonly options: readonly BucketKeyOption[]\n /** Monotonically increasing revision number, incremented on each bucket update. */\n readonly revision: number\n /** Cross-region replication configuration, filtered by caller authorization. */\n readonly replicationConfiguration: ReadableReplicationConfiguration\n}\n\n/**\n * Request parameters for the `b2_create_bucket` API call.\n */\nexport interface CreateBucketRequest {\n /** Account that will own the new bucket. */\n readonly accountId: AccountId\n /** Globally unique name for the bucket. */\n readonly bucketName: string\n /** Access level for the bucket. */\n readonly bucketType: BucketType\n /**\n * Optional user-defined key-value metadata.\n * Keys must be 1-50 UTF-8 bytes and must not start with `b2-`; the aggregate\n * UTF-8 byte length of all values must be at most 10,000 bytes. Keys must\n * match {@link BUCKET_INFO_KEY_PATTERN}. BucketInfo has no documented\n * pair-count cap.\n */\n readonly bucketInfo?: Record<string, string>\n /**\n * Optional CORS rules.\n * A bucket may have at most 100 rules. Each rule name must be unique, 6-63\n * characters, match `[A-Za-z0-9-]`, and not start with `b2-`. Each rule's\n * name, origins, operations, allowed headers, and exposed headers must total\n * less than 1,000 UTF-8 bytes. `maxAgeSeconds` must be at most 86,400.\n */\n readonly corsRules?: readonly CorsRule[]\n /** Optional default server-side encryption setting. */\n readonly defaultServerSideEncryption?: BucketDefaultServerSideEncryptionSetting\n /** Optional default Object Lock retention policy. */\n readonly defaultRetention?: BucketRetentionPolicy\n /** Whether to enable Object Lock on the bucket. Cannot be changed after creation. */\n readonly fileLockEnabled?: boolean\n /** Optional lifecycle rules. */\n readonly lifecycleRules?: readonly LifecycleRule[]\n /** Optional replication configuration. */\n readonly replicationConfiguration?: ReplicationConfiguration\n}\n\n/**\n * Request parameters for the `b2_update_bucket` API call.\n */\nexport interface UpdateBucketRequest {\n /** Account that owns the bucket. */\n readonly accountId: AccountId\n /** ID of the bucket to update. */\n readonly bucketId: BucketId\n /** New access level for the bucket. */\n readonly bucketType?: BucketType\n /**\n * Updated user-defined key-value metadata. Replaces all existing metadata.\n * Keys must be 1-50 UTF-8 bytes and must not start with `b2-`; the aggregate\n * UTF-8 byte length of all values must be at most 10,000 bytes. Keys must\n * match {@link BUCKET_INFO_KEY_PATTERN}. BucketInfo has no documented\n * pair-count cap.\n */\n readonly bucketInfo?: Record<string, string>\n /**\n * Updated CORS rules. Replaces all existing rules.\n * A bucket may have at most 100 rules. Each rule name must be unique, 6-63\n * characters, match `[A-Za-z0-9-]`, and not start with `b2-`. Each rule's\n * name, origins, operations, allowed headers, and exposed headers must total\n * less than 1,000 UTF-8 bytes. `maxAgeSeconds` must be at most 86,400.\n */\n readonly corsRules?: readonly CorsRule[]\n /** Updated default server-side encryption setting. */\n readonly defaultServerSideEncryption?: BucketDefaultServerSideEncryptionSetting\n /** Updated default Object Lock retention policy. */\n readonly defaultRetention?: BucketRetentionPolicy\n /** Whether to enable Object Lock. Can only transition from disabled to enabled. */\n readonly fileLockEnabled?: boolean\n /** Updated lifecycle rules. Replaces all existing rules. */\n readonly lifecycleRules?: readonly LifecycleRule[]\n /** Updated replication configuration. */\n readonly replicationConfiguration?: ReplicationConfiguration\n /** Optimistic locking: only update if the bucket's current revision matches this value. */\n readonly ifRevisionIs?: number\n}\n\n/**\n * Request parameters for the `b2_list_buckets` API call.\n */\nexport interface ListBucketsRequest {\n /** Account whose buckets to list. */\n readonly accountId: AccountId\n /** Optional filter to return only the bucket with this ID. */\n readonly bucketId?: BucketId\n /** Optional filter to return only the bucket with this name. */\n readonly bucketName?: string\n /** Optional filter to return only buckets of these types. */\n readonly bucketTypes?: BucketTypesFilter\n}\n\n/** Response from the `b2_list_buckets` API call. */\nexport interface ListBucketsResponse {\n /** Array of buckets matching the request filters. */\n readonly buckets: readonly BucketInfo[]\n}\n\n/**\n * Request parameters for the `b2_delete_bucket` API call.\n */\nexport interface DeleteBucketRequest {\n /** Account that owns the bucket. */\n readonly accountId: AccountId\n /** ID of the bucket to delete. The bucket must be empty. */\n readonly bucketId: BucketId\n}\n"],"mappings":";;;;;;;;;AAYA,IAAa,aAAa;;CAExB,WAAW;;CAEX,YAAY;;CAEZ,UAAU;;CAEV,YAAY;AACd;;AAMA,IAAa,0BAA0B;CACrC,GAAG;;CAEH,QAAQ;AACV;;;;;;AAkCA,IAAa,kBAAkB;;AAE7B,IAAI,KACN;;AASA,IAAa,4BAA4B;;AAEzC,IAAa,4BAA4B;;AAEzC,IAAa,+BAA+B;;AAE5C,IAAa,8BAA8B;;;;;;AAM3C,IAAa,0BAA0B;;;;;;;;;;;;;;;;;;AA+BvC,IAAa,gBAAgB;;CAE3B,sBAAsB;;CAEtB,oBAAoB;;CAEpB,cAAc;;CAEd,cAAc;;CAEd,OAAO;;;;;;;;CAQP,QAAQ;;CAER,OAAO;;CAEP,QAAQ;;CAER,UAAU;AACZ;;AAYA,IAAa,0BAA0B;CACrC,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;AAChB;;AAMA,IAAa,uBAAuB;;AAEpC,IAAa,4BAA4B;;AAEzC,IAAa,4BAA4B;;AAEzC,IAAa,yBAAyB;;AAEtC,IAAa,iCAAiC;;AAE9C,IAAa,sBAAsB;;AAEnC,IAAa,2BAA2B;;;;;;;AA2CxC,IAAa,sBAAsB;;CAEjC,YAAY;;CAEZ,YAAY;;CAEZ,MAAM;AACR"}
@@ -0,0 +1,62 @@
1
+ //#region src/types/download.ts
2
+ /** HTTP response header names returned by B2 download endpoints. */
3
+ var DownloadHeaderName = {
4
+ /** Header carrying the response content disposition. */
5
+ ContentDisposition: "Content-Disposition",
6
+ /** Header carrying the response content language. */
7
+ ContentLanguage: "Content-Language",
8
+ /** Header carrying the response content encoding. */
9
+ ContentEncoding: "Content-Encoding",
10
+ /** Header carrying the response content type. */
11
+ ContentType: "Content-Type",
12
+ /** Header carrying the response cache policy. */
13
+ CacheControl: "Cache-Control",
14
+ /** Header carrying the response expiration time. */
15
+ Expires: "Expires",
16
+ /** Header carrying the byte range returned for partial downloads. */
17
+ ContentRange: "Content-Range",
18
+ /** Header carrying the response content length. */
19
+ ContentLength: "Content-Length",
20
+ /** Header carrying the B2 SHA-1 metadata value. */
21
+ ContentSha1: "X-Bz-Content-Sha1",
22
+ /** Header carrying the downloaded file version ID. */
23
+ FileId: "X-Bz-File-Id",
24
+ /** Header carrying the URL-encoded downloaded file name. */
25
+ FileName: "X-Bz-File-Name",
26
+ /** Header carrying the file upload timestamp. */
27
+ UploadTimestamp: "X-Bz-Upload-Timestamp",
28
+ /** Header carrying the B2-managed server-side encryption algorithm. */
29
+ ServerSideEncryption: "X-Bz-Server-Side-Encryption",
30
+ /** Header carrying the SSE-C algorithm echo. */
31
+ ServerSideEncryptionCustomerAlgorithm: "X-Bz-Server-Side-Encryption-Customer-Algorithm",
32
+ /** Header carrying the SSE-C customer-key MD5 echo. */
33
+ ServerSideEncryptionCustomerKeyMd5: "X-Bz-Server-Side-Encryption-Customer-Key-Md5",
34
+ /** Header carrying the Object Lock retention mode. */
35
+ FileRetentionMode: "X-Bz-File-Retention-Mode",
36
+ /** Header carrying the Object Lock retain-until timestamp. */
37
+ FileRetentionRetainUntilTimestamp: "X-Bz-File-Retention-Retain-Until-Timestamp",
38
+ /** Header carrying the Object Lock legal-hold value. */
39
+ FileLegalHold: "X-Bz-File-Legal-Hold",
40
+ /** Header carrying names of metadata headers hidden by missing capabilities. */
41
+ ClientUnauthorizedToRead: "X-Bz-Client-Unauthorized-To-Read"
42
+ };
43
+ /** Documented download metadata markers B2 may hide when the caller lacks read capabilities. */
44
+ var DownloadClientUnauthorizedToReadMarker = {
45
+ /** B2-managed encryption metadata is hidden. */
46
+ ServerSideEncryption: DownloadHeaderName.ServerSideEncryption,
47
+ /** SSE-C algorithm metadata is hidden. */
48
+ ServerSideEncryptionCustomerAlgorithm: DownloadHeaderName.ServerSideEncryptionCustomerAlgorithm,
49
+ /** SSE-C customer-key MD5 metadata is hidden. */
50
+ ServerSideEncryptionCustomerKeyMd5: DownloadHeaderName.ServerSideEncryptionCustomerKeyMd5,
51
+ /** Object Lock retention mode metadata is hidden. */
52
+ FileRetentionMode: DownloadHeaderName.FileRetentionMode,
53
+ /** Object Lock retain-until timestamp metadata is hidden. */
54
+ FileRetentionRetainUntilTimestamp: DownloadHeaderName.FileRetentionRetainUntilTimestamp,
55
+ /** Object Lock legal-hold metadata is hidden. */
56
+ FileLegalHold: DownloadHeaderName.FileLegalHold
57
+ };
58
+ //#endregion
59
+ exports.DownloadClientUnauthorizedToReadMarker = DownloadClientUnauthorizedToReadMarker;
60
+ exports.DownloadHeaderName = DownloadHeaderName;
61
+
62
+ //# sourceMappingURL=download.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download.cjs","names":[],"sources":["../../src/types/download.ts"],"sourcesContent":["import type { SseB2Setting, SseCKeyMaterial, SseCPublicSetting } from './encryption.ts'\nimport type { BucketId, FileId } from './ids.ts'\nimport type { ReadableFileRetention, ReadableLegalHold } from './lock.ts'\n\n/** HTTP response header names returned by B2 download endpoints. */\nexport const DownloadHeaderName = {\n /** Header carrying the response content disposition. */\n ContentDisposition: 'Content-Disposition',\n /** Header carrying the response content language. */\n ContentLanguage: 'Content-Language',\n /** Header carrying the response content encoding. */\n ContentEncoding: 'Content-Encoding',\n /** Header carrying the response content type. */\n ContentType: 'Content-Type',\n /** Header carrying the response cache policy. */\n CacheControl: 'Cache-Control',\n /** Header carrying the response expiration time. */\n Expires: 'Expires',\n /** Header carrying the byte range returned for partial downloads. */\n ContentRange: 'Content-Range',\n /** Header carrying the response content length. */\n ContentLength: 'Content-Length',\n /** Header carrying the B2 SHA-1 metadata value. */\n ContentSha1: 'X-Bz-Content-Sha1',\n /** Header carrying the downloaded file version ID. */\n FileId: 'X-Bz-File-Id',\n /** Header carrying the URL-encoded downloaded file name. */\n FileName: 'X-Bz-File-Name',\n /** Header carrying the file upload timestamp. */\n UploadTimestamp: 'X-Bz-Upload-Timestamp',\n /** Header carrying the B2-managed server-side encryption algorithm. */\n ServerSideEncryption: 'X-Bz-Server-Side-Encryption',\n /** Header carrying the SSE-C algorithm echo. */\n ServerSideEncryptionCustomerAlgorithm: 'X-Bz-Server-Side-Encryption-Customer-Algorithm',\n /** Header carrying the SSE-C customer-key MD5 echo. */\n ServerSideEncryptionCustomerKeyMd5: 'X-Bz-Server-Side-Encryption-Customer-Key-Md5',\n /** Header carrying the Object Lock retention mode. */\n FileRetentionMode: 'X-Bz-File-Retention-Mode',\n /** Header carrying the Object Lock retain-until timestamp. */\n FileRetentionRetainUntilTimestamp: 'X-Bz-File-Retention-Retain-Until-Timestamp',\n /** Header carrying the Object Lock legal-hold value. */\n FileLegalHold: 'X-Bz-File-Legal-Hold',\n /** Header carrying names of metadata headers hidden by missing capabilities. */\n ClientUnauthorizedToRead: 'X-Bz-Client-Unauthorized-To-Read',\n} as const\n\n/** HTTP response header name returned by B2 download endpoints. */\nexport type DownloadHeaderName = (typeof DownloadHeaderName)[keyof typeof DownloadHeaderName]\n\n/** Documented download metadata markers B2 may hide when the caller lacks read capabilities. */\nexport const DownloadClientUnauthorizedToReadMarker = {\n /** B2-managed encryption metadata is hidden. */\n ServerSideEncryption: DownloadHeaderName.ServerSideEncryption,\n /** SSE-C algorithm metadata is hidden. */\n ServerSideEncryptionCustomerAlgorithm: DownloadHeaderName.ServerSideEncryptionCustomerAlgorithm,\n /** SSE-C customer-key MD5 metadata is hidden. */\n ServerSideEncryptionCustomerKeyMd5: DownloadHeaderName.ServerSideEncryptionCustomerKeyMd5,\n /** Object Lock retention mode metadata is hidden. */\n FileRetentionMode: DownloadHeaderName.FileRetentionMode,\n /** Object Lock retain-until timestamp metadata is hidden. */\n FileRetentionRetainUntilTimestamp: DownloadHeaderName.FileRetentionRetainUntilTimestamp,\n /** Object Lock legal-hold metadata is hidden. */\n FileLegalHold: DownloadHeaderName.FileLegalHold,\n} as const\n\n/** Documented download metadata marker B2 may hide when the caller lacks read capabilities. */\nexport type DownloadClientUnauthorizedToReadMarker =\n (typeof DownloadClientUnauthorizedToReadMarker)[keyof typeof DownloadClientUnauthorizedToReadMarker]\n\n/** Request parameters for downloading a file by its ID via `b2_download_file_by_id`. */\nexport interface DownloadByIdRequest {\n /** ID of the file version to download. */\n readonly fileId: FileId\n /** Optional byte range to download (e.g., `'bytes=0-999'`). */\n readonly range?: string\n /** SSE-C decryption parameters, required if the file was uploaded with SSE-C. */\n readonly serverSideEncryption?: SseCKeyMaterial\n /** Override the Content-Disposition header in the download response. */\n readonly b2ContentDisposition?: string\n /** Override the Content-Language header in the download response. */\n readonly b2ContentLanguage?: string\n /** Override the Content-Encoding header in the download response. */\n readonly b2ContentEncoding?: string\n /** Override the Content-Type header in the download response. */\n readonly b2ContentType?: string\n /** Override the Cache-Control header in the download response. */\n readonly b2CacheControl?: string\n /** Override the Expires header in the download response. */\n readonly b2Expires?: string\n}\n\n/** Request parameters for downloading a file by bucket name and file name via `b2_download_file_by_name`. */\nexport interface DownloadByNameRequest {\n /** Name of the bucket containing the file. */\n readonly bucketName: string\n /** Full path and name of the file within the bucket. */\n readonly fileName: string\n /** Optional byte range to download (e.g., `'bytes=0-999'`). */\n readonly range?: string\n /** SSE-C decryption parameters, required if the file was uploaded with SSE-C. */\n readonly serverSideEncryption?: SseCKeyMaterial\n /** Override the Content-Disposition header in the download response. */\n readonly b2ContentDisposition?: string\n /** Override the Content-Language header in the download response. */\n readonly b2ContentLanguage?: string\n /** Override the Content-Encoding header in the download response. */\n readonly b2ContentEncoding?: string\n /** Override the Content-Type header in the download response. */\n readonly b2ContentType?: string\n /** Override the Cache-Control header in the download response. */\n readonly b2CacheControl?: string\n /** Override the Expires header in the download response. */\n readonly b2Expires?: string\n}\n\n/**\n * Request parameters for the `b2_get_download_authorization` API call.\n * Creates a time-limited token that authorizes downloads of files matching a prefix.\n */\nexport interface DownloadAuthorizationRequest {\n /** Bucket to authorize downloads from. */\n readonly bucketId: BucketId\n /** Only files with names starting with this prefix are authorized. */\n readonly fileNamePrefix: string\n /** Duration in seconds that the authorization token remains valid. */\n readonly validDurationInSeconds: number\n /** Override the Content-Disposition header in authorized download responses. */\n readonly b2ContentDisposition?: string\n /** Override the Content-Language header in authorized download responses. */\n readonly b2ContentLanguage?: string\n /** Override the Content-Encoding header in authorized download responses. */\n readonly b2ContentEncoding?: string\n /** Override the Content-Type header in authorized download responses. */\n readonly b2ContentType?: string\n /** Override the Cache-Control header in authorized download responses. */\n readonly b2CacheControl?: string\n /** Override the Expires header in authorized download responses. */\n readonly b2Expires?: string\n}\n\n/** Response from the `b2_get_download_authorization` API call. */\nexport interface DownloadAuthorizationResponse {\n /** Bucket the authorization applies to. */\n readonly bucketId: BucketId\n /** File name prefix the authorization is scoped to. */\n readonly fileNamePrefix: string\n /** Authorization token to include in download requests. */\n readonly authorizationToken: string\n}\n\n/** Customer-managed server-side encryption metadata echoed in B2 download response headers. */\nexport interface SseCDownloadSetting extends SseCPublicSetting {\n /** MD5 digest echoed by `X-Bz-Server-Side-Encryption-Customer-Key-Md5`. */\n readonly customerKeyMd5: string\n}\n\n/** Server-side encryption metadata echoed in B2 download response headers. */\nexport type DownloadServerSideEncryption = SseB2Setting | SseCDownloadSetting\n\n/** Diagnostic for a present download metadata header the SDK could not parse narrowly. */\nexport interface DownloadHeaderParseIssue {\n /** Header whose value could not be parsed into the current typed SDK model. */\n readonly headerName: DownloadHeaderName\n /** Raw header value that could not be parsed. */\n readonly value: string\n}\n\n/** Parsed headers from a B2 file download response. */\nexport interface DownloadHeaders {\n /** MIME type of the downloaded file content. */\n readonly contentType: string\n /** Size of the downloaded content in bytes. */\n readonly contentLength: number\n /** Content-Disposition value computed from upload metadata or the download request. */\n readonly contentDisposition?: string\n /** Content-Language value computed from upload metadata or the download request. */\n readonly contentLanguage?: string\n /** Content-Encoding value computed from upload metadata or the download request. */\n readonly contentEncoding?: string\n /** Cache-Control value computed from upload metadata, bucket defaults, or the download request. */\n readonly cacheControl?: string\n /** Expires value computed from upload metadata or the download request. */\n readonly expires?: string\n /** Content-Range value returned for satisfiable range downloads. */\n readonly contentRange?: string\n /** SHA-1 checksum of the full file content, or null for large files. */\n readonly contentSha1: string | null\n /** ID of the downloaded file version. */\n readonly fileId: FileId\n /** Full path and name of the downloaded file. */\n readonly fileName: string\n /** User-defined key-value metadata stored with the file. */\n readonly fileInfo: Record<string, string>\n /** UTC timestamp (milliseconds) when the file was uploaded. */\n readonly uploadTimestamp: number\n /** Server-side encryption metadata echoed by B2, when the caller is authorized to read it. */\n readonly serverSideEncryption?: DownloadServerSideEncryption\n /** Object Lock retention metadata, including whether the caller may read it. */\n readonly fileRetention?: ReadableFileRetention\n /** Object Lock legal hold metadata, including whether the caller may read it. */\n readonly legalHold?: ReadableLegalHold\n /** Header names B2 omitted because the caller lacks capability to read them. */\n readonly clientUnauthorizedToRead?: readonly DownloadClientUnauthorizedToReadMarker[]\n /** Present metadata headers the SDK could not parse into its current narrow typed model. */\n readonly headerParseIssues?: readonly DownloadHeaderParseIssue[]\n}\n"],"mappings":";;AAKA,IAAa,qBAAqB;;CAEhC,oBAAoB;;CAEpB,iBAAiB;;CAEjB,iBAAiB;;CAEjB,aAAa;;CAEb,cAAc;;CAEd,SAAS;;CAET,cAAc;;CAEd,eAAe;;CAEf,aAAa;;CAEb,QAAQ;;CAER,UAAU;;CAEV,iBAAiB;;CAEjB,sBAAsB;;CAEtB,uCAAuC;;CAEvC,oCAAoC;;CAEpC,mBAAmB;;CAEnB,mCAAmC;;CAEnC,eAAe;;CAEf,0BAA0B;AAC5B;;AAMA,IAAa,yCAAyC;;CAEpD,sBAAsB,mBAAmB;;CAEzC,uCAAuC,mBAAmB;;CAE1D,oCAAoC,mBAAmB;;CAEvD,mBAAmB,mBAAmB;;CAEtC,mCAAmC,mBAAmB;;CAEtD,eAAe,mBAAmB;AACpC"}