@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
package/dist/index.cjs CHANGED
@@ -4,30 +4,40 @@ const require_file = require("./types/file.cjs");
4
4
  const require_ids = require("./types/ids.cjs");
5
5
  const require_errors = require("./types/errors.cjs");
6
6
  const require_errors_index = require("./errors/index.cjs");
7
+ const require_download = require("./types/download.cjs");
8
+ const require_encryption = require("./types/encryption.cjs");
9
+ const require_lock = require("./types/lock.cjs");
7
10
  const require_hash = require("./streams/hash.cjs");
8
11
  const require_file_source = require("./streams/file-source.cjs");
9
12
  const require_source = require("./streams/source.cjs");
10
13
  const require_bucket = require("./types/bucket.cjs");
11
- const require_encryption = require("./types/encryption.cjs");
12
14
  const require_object = require("./object.cjs");
13
15
  const require_paginator = require("./util/paginator.cjs");
14
16
  const require_bucket$1 = require("./bucket.cjs");
17
+ const require_bucket_validation = require("./bucket-validation.cjs");
15
18
  const require_url_guard = require("./http/url-guard.cjs");
16
19
  const require_version = require("./version.cjs");
17
20
  const require_transport = require("./http/transport.cjs");
18
21
  const require_raw_index = require("./raw/index.cjs");
19
22
  const require_client = require("./client.cjs");
20
23
  const require_auth = require("./types/auth.cjs");
21
- const require_lock = require("./types/lock.cjs");
22
24
  const require_notifications = require("./types/notifications.cjs");
25
+ const require_partner = require("./types/partner.cjs");
23
26
  exports.AccessDeniedError = require_errors_index.AccessDeniedError;
27
+ exports.B2BucketConfigurationError = require_errors_index.B2BucketConfigurationError;
24
28
  exports.B2Client = require_client.B2Client;
25
29
  exports.B2Error = require_errors_index.B2Error;
26
30
  exports.B2InsufficientCapabilityError = require_errors_index.B2InsufficientCapabilityError;
27
31
  exports.B2Object = require_object.B2Object;
32
+ exports.B2PartnerAuthorizationError = require_errors_index.B2PartnerAuthorizationError;
28
33
  exports.B2RealmConfigurationError = require_errors_index.B2RealmConfigurationError;
29
34
  exports.B2RedirectError = require_errors_index.B2RedirectError;
30
35
  exports.B2SsrfError = require_errors_index.B2SsrfError;
36
+ exports.BUCKET_INFO_KEY_MAX_BYTES = require_bucket.BUCKET_INFO_KEY_MAX_BYTES;
37
+ exports.BUCKET_INFO_KEY_MIN_BYTES = require_bucket.BUCKET_INFO_KEY_MIN_BYTES;
38
+ exports.BUCKET_INFO_KEY_PATTERN = require_bucket.BUCKET_INFO_KEY_PATTERN;
39
+ exports.BUCKET_INFO_RESERVED_PREFIX = require_bucket.BUCKET_INFO_RESERVED_PREFIX;
40
+ exports.BUCKET_INFO_VALUES_MAX_BYTES = require_bucket.BUCKET_INFO_VALUES_MAX_BYTES;
31
41
  exports.BadAuthTokenError = require_errors_index.BadAuthTokenError;
32
42
  exports.BadBucketIdError = require_errors_index.BadBucketIdError;
33
43
  exports.BadJsonError = require_errors_index.BadJsonError;
@@ -35,14 +45,25 @@ exports.BadRequestError = require_errors_index.BadRequestError;
35
45
  exports.BadUploadUrlError = require_errors_index.BadUploadUrlError;
36
46
  exports.BlobSource = require_source.BlobSource;
37
47
  exports.Bucket = require_bucket$1.Bucket;
48
+ exports.BucketKeyOption = require_bucket.BucketKeyOption;
38
49
  exports.BucketRetentionMode = require_bucket.BucketRetentionMode;
39
50
  exports.BucketType = require_bucket.BucketType;
40
51
  exports.BufferSource = require_source.BufferSource;
52
+ exports.CORS_ALLOWED_OPERATIONS = require_bucket.CORS_ALLOWED_OPERATIONS;
53
+ exports.CORS_MAX_AGE_SECONDS_MAX = require_bucket.CORS_MAX_AGE_SECONDS_MAX;
54
+ exports.CORS_RULES_MAX_COUNT = require_bucket.CORS_RULES_MAX_COUNT;
55
+ exports.CORS_RULE_MAX_BYTES = require_bucket.CORS_RULE_MAX_BYTES;
56
+ exports.CORS_RULE_NAME_MAX_LENGTH = require_bucket.CORS_RULE_NAME_MAX_LENGTH;
57
+ exports.CORS_RULE_NAME_MIN_LENGTH = require_bucket.CORS_RULE_NAME_MIN_LENGTH;
58
+ exports.CORS_RULE_NAME_PATTERN = require_bucket.CORS_RULE_NAME_PATTERN;
59
+ exports.CORS_RULE_NAME_RESERVED_PREFIX = require_bucket.CORS_RULE_NAME_RESERVED_PREFIX;
41
60
  exports.CapExceededError = require_errors_index.CapExceededError;
42
61
  exports.Capability = require_auth.Capability;
43
62
  exports.ChecksumMismatchError = require_errors_index.ChecksumMismatchError;
44
63
  exports.ConflictError = require_errors_index.ConflictError;
45
64
  exports.CorsOperation = require_bucket.CorsOperation;
65
+ exports.DownloadClientUnauthorizedToReadMarker = require_download.DownloadClientUnauthorizedToReadMarker;
66
+ exports.DownloadHeaderName = require_download.DownloadHeaderName;
46
67
  exports.DuplicateBucketNameError = require_errors_index.DuplicateBucketNameError;
47
68
  exports.EncryptionAlgorithm = require_encryption.EncryptionAlgorithm;
48
69
  exports.EncryptionKey = require_encryption.EncryptionKey;
@@ -54,25 +75,40 @@ exports.FileAction = require_file.FileAction;
54
75
  exports.FileNotPresentError = require_errors_index.FileNotPresentError;
55
76
  exports.FileSource = require_file_source.FileSource;
56
77
  exports.FinishLargeFileResponseBodyError = require_errors_index.FinishLargeFileResponseBodyError;
78
+ exports.GroupMemberCreationFailedError = require_errors_index.GroupMemberCreationFailedError;
79
+ exports.HIDE_MARKER_CONTENT_TYPE = require_file.HIDE_MARKER_CONTENT_TYPE;
57
80
  exports.InMemoryAccountInfo = require_in_memory.InMemoryAccountInfo;
58
81
  exports.IncrementalSha1 = require_hash.IncrementalSha1;
82
+ exports.IncrementalSha256 = require_hash.IncrementalSha256;
59
83
  exports.InternalError = require_errors_index.InternalError;
84
+ exports.InvalidAccountIdError = require_errors_index.InvalidAccountIdError;
60
85
  exports.InvalidBucketIdError = require_errors_index.InvalidBucketIdError;
61
86
  exports.InvalidBucketInfoError = require_errors_index.InvalidBucketInfoError;
62
87
  exports.InvalidBucketNameError = require_errors_index.InvalidBucketNameError;
88
+ exports.InvalidComputerIdError = require_errors_index.InvalidComputerIdError;
89
+ exports.InvalidEmailError = require_errors_index.InvalidEmailError;
63
90
  exports.InvalidFileIdError = require_errors_index.InvalidFileIdError;
64
91
  exports.InvalidFileInfoError = require_errors_index.InvalidFileInfoError;
65
92
  exports.InvalidFileNameError = require_errors_index.InvalidFileNameError;
93
+ exports.InvalidGroupIdError = require_errors_index.InvalidGroupIdError;
94
+ exports.InvalidMemberAccountIdError = require_errors_index.InvalidMemberAccountIdError;
66
95
  exports.InvalidPartNumberError = require_errors_index.InvalidPartNumberError;
96
+ exports.InvalidRegionError = require_errors_index.InvalidRegionError;
97
+ exports.InvalidSmsPhoneError = require_errors_index.InvalidSmsPhoneError;
67
98
  exports.KNOWN_B2_ERROR_CODES = require_errors.KNOWN_B2_ERROR_CODES;
99
+ exports.KnownBucketResponseType = require_bucket.KnownBucketResponseType;
68
100
  exports.LegalHoldValue = require_lock.LegalHoldValue;
69
101
  exports.MetadataDirective = require_file.MetadataDirective;
102
+ exports.MethodFailureError = require_errors_index.MethodFailureError;
70
103
  exports.MethodNotAllowedError = require_errors_index.MethodNotAllowedError;
104
+ exports.MissingSmsPhoneError = require_errors_index.MissingSmsPhoneError;
71
105
  exports.NetworkError = require_errors_index.NetworkError;
72
106
  exports.NotFoundError = require_errors_index.NotFoundError;
73
107
  exports.OutOfRangeError = require_errors_index.OutOfRangeError;
108
+ exports.PartnerCapability = require_partner.PartnerCapability;
74
109
  exports.RangeNotSatisfiableError = require_errors_index.RangeNotSatisfiableError;
75
110
  exports.RawClient = require_raw_index.RawClient;
111
+ exports.Region = require_partner.Region;
76
112
  exports.RequestTimeoutError = require_errors_index.RequestTimeoutError;
77
113
  exports.ResumeFileIdMismatchError = require_errors_index.ResumeFileIdMismatchError;
78
114
  exports.RetentionMode = require_lock.RetentionMode;
@@ -83,20 +119,32 @@ exports.ServiceUnavailableError = require_errors_index.ServiceUnavailableError;
83
119
  exports.StreamSource = require_source.StreamSource;
84
120
  exports.TooManyBucketsError = require_errors_index.TooManyBucketsError;
85
121
  exports.TooManyFilesError = require_errors_index.TooManyFilesError;
122
+ exports.TooManyGroupMembersError = require_errors_index.TooManyGroupMembersError;
123
+ exports.TooManyMembersError = require_errors_index.TooManyMembersError;
86
124
  exports.TooManyRequestsError = require_errors_index.TooManyRequestsError;
87
125
  exports.UploadResponseBodyError = require_errors_index.UploadResponseBodyError;
88
126
  exports.UrlGuard = require_url_guard.UrlGuard;
89
127
  exports.VERSION = require_version.VERSION;
90
128
  exports.accountId = require_ids.accountId;
91
129
  exports.applicationKeyId = require_ids.applicationKeyId;
130
+ exports.assertValidBucketConfiguration = require_bucket_validation.assertValidBucketConfiguration;
131
+ exports.assertValidBucketInfo = require_bucket_validation.assertValidBucketInfo;
132
+ exports.assertValidCorsRules = require_bucket_validation.assertValidCorsRules;
92
133
  exports.bucketId = require_ids.bucketId;
93
134
  exports.classifyError = require_errors_index.classifyError;
135
+ exports.computerId = require_ids.computerId;
94
136
  exports.deriveAllowedSuffixes = require_url_guard.deriveAllowedSuffixes;
95
137
  exports.fileId = require_ids.fileId;
138
+ exports.getTransportUrlGuard = require_transport.getTransportUrlGuard;
139
+ exports.groupId = require_ids.groupId;
96
140
  exports.keyId = require_ids.keyId;
97
141
  exports.largeFileId = require_ids.largeFileId;
142
+ exports.notificationCustomHeadersToRecord = require_notifications.notificationCustomHeadersToRecord;
98
143
  exports.paginateItems = require_paginator.paginateItems;
99
144
  exports.paginatePages = require_paginator.paginatePages;
145
+ exports.partnerToken = require_ids.partnerToken;
146
+ exports.recordToNotificationCustomHeaders = require_notifications.recordToNotificationCustomHeaders;
100
147
  exports.sha1Hex = require_hash.sha1Hex;
148
+ exports.sha256Hex = require_hash.sha256Hex;
101
149
  exports.sseCustomer = require_encryption.sseCustomer;
102
150
  exports.toContentSource = require_source.toContentSource;
package/dist/index.d.cts CHANGED
@@ -9,30 +9,33 @@
9
9
  */
10
10
  export type { AccountInfo, AuthContextAwareAccountInfo, UploadUrlEntry, } from './auth/account-info.js';
11
11
  export { InMemoryAccountInfo } from './auth/in-memory.js';
12
- export { Bucket, type DeleteAllDeleteEvent, type DeleteAllErrorEvent, type DeleteAllEvent, type DeleteAllSkipEvent, type DeleteError, type DeleteManyResult, type DeleteTarget, } from './bucket.js';
13
- export { B2Client, type B2ClientOptions, type CapabilityCheckResult } from './client.js';
12
+ export { Bucket, type BucketListFileNamesBaseOptions, type BucketListFileNamesMaybeDelimiterOptions, type BucketListFileNamesOptions, type BucketListFileNamesWithDelimiterOptions, type BucketListFileVersionsBaseOptions, type BucketListFileVersionsMaybeDelimiterOptions, type BucketListFileVersionsOptions, type BucketListFileVersionsWithDelimiterOptions, type BucketPaginateFileNamesMaybeDelimiterOptions, type BucketPaginateFileNamesOptions, type BucketPaginateFileNamesWithDelimiterOptions, type BucketPaginateFileVersionsMaybeDelimiterOptions, type BucketPaginateFileVersionsOptions, type BucketPaginateFileVersionsWithDelimiterOptions, type DeleteAllDeleteEvent, type DeleteAllErrorEvent, type DeleteAllEvent, type DeleteAllSkipEvent, type DeleteError, type DeleteManyResult, type DeleteTarget, } from './bucket.js';
13
+ export { assertValidBucketConfiguration, assertValidBucketInfo, assertValidCorsRules, } from './bucket-validation.js';
14
+ export { B2Client, type B2ClientAuthorizeOptions, type B2ClientOptions, type CapabilityCheckResult, } from './client.js';
14
15
  export type { DownloadResult, HeadResult } from './download/single.js';
15
- export type { B2ErrorOptions } from './errors/index.js';
16
- export { AccessDeniedError, B2Error, B2InsufficientCapabilityError, B2RealmConfigurationError, B2RedirectError, B2SsrfError, BadAuthTokenError, BadBucketIdError, BadJsonError, BadRequestError, BadUploadUrlError, CapExceededError, ChecksumMismatchError, ConflictError, classifyError, DuplicateBucketNameError, ExpiredAuthTokenError, FileNotPresentError, FinishLargeFileResponseBodyError, InternalError, InvalidBucketIdError, InvalidBucketInfoError, InvalidBucketNameError, InvalidFileIdError, InvalidFileInfoError, InvalidFileNameError, InvalidPartNumberError, MethodNotAllowedError, NetworkError, NotFoundError, OutOfRangeError, RangeNotSatisfiableError, RequestTimeoutError, ResumeFileIdMismatchError, ServiceUnavailableError, TooManyBucketsError, TooManyFilesError, TooManyRequestsError, UploadResponseBodyError, } from './errors/index.js';
16
+ export type { B2BucketConfigurationErrorField, B2ErrorOptions } from './errors/index.js';
17
+ export { AccessDeniedError, B2BucketConfigurationError, B2Error, B2InsufficientCapabilityError, B2PartnerAuthorizationError, B2RealmConfigurationError, B2RedirectError, B2SsrfError, BadAuthTokenError, BadBucketIdError, BadJsonError, BadRequestError, BadUploadUrlError, CapExceededError, ChecksumMismatchError, ConflictError, classifyError, DuplicateBucketNameError, ExpiredAuthTokenError, FileNotPresentError, FinishLargeFileResponseBodyError, GroupMemberCreationFailedError, InternalError, InvalidAccountIdError, InvalidBucketIdError, InvalidBucketInfoError, InvalidBucketNameError, InvalidComputerIdError, InvalidEmailError, InvalidFileIdError, InvalidFileInfoError, InvalidFileNameError, InvalidGroupIdError, InvalidMemberAccountIdError, InvalidPartNumberError, InvalidRegionError, InvalidSmsPhoneError, MethodFailureError, MethodNotAllowedError, MissingSmsPhoneError, NetworkError, NotFoundError, OutOfRangeError, RangeNotSatisfiableError, RequestTimeoutError, ResumeFileIdMismatchError, ServiceUnavailableError, TooManyBucketsError, TooManyFilesError, TooManyGroupMembersError, TooManyMembersError, TooManyRequestsError, UploadResponseBodyError, } from './errors/index.js';
17
18
  export type { RetryOptions } from './http/retry.js';
18
- export type { HttpRequest, HttpResponse, HttpTransport, RetryTransportOptions, } from './http/transport.js';
19
- export { FetchTransport, RetryTransport } from './http/transport.js';
19
+ export type { HttpRequest, HttpResponse, HttpTransport, RetryTransportOptions, UrlGuardedTransport, } from './http/transport.js';
20
+ export { FetchTransport, getTransportUrlGuard, RetryTransport } from './http/transport.js';
20
21
  export { deriveAllowedSuffixes, UrlGuard } from './http/url-guard.js';
21
22
  export { B2Object, type DownloadCallOptions, type HeadCallOptions } from './object.js';
22
- export { type DownloadFileOptions, RawClient, type RawClientOptions, type RawRequestOptions, type SseCDownloadKey, } from './raw/index.js';
23
- export { IncrementalSha1, sha1Hex } from './streams/hash.js';
23
+ export { type AuthorizeAccountOptions, type DownloadFileOptions, RawClient, type RawClientOptions, type RawRequestOptions, type SseCDownloadKey, } from './raw/index.js';
24
+ export { IncrementalSha1, IncrementalSha256, sha1Hex, sha256Hex } from './streams/hash.js';
24
25
  export type { ProgressEvent, ProgressListener } from './streams/progress.js';
25
26
  export type { ContentSource, FileSourcePath } from './streams/source.js';
26
27
  export { BlobSource, BufferSource, FileSource, StreamSource, toContentSource, } from './streams/source.js';
27
28
  export { Capability } from './types/auth.js';
28
- export { BucketRetentionMode, BucketType, CorsOperation } from './types/bucket.js';
29
+ 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_RULE_MAX_BYTES, CORS_RULE_NAME_MAX_LENGTH, CORS_RULE_NAME_MIN_LENGTH, CORS_RULE_NAME_PATTERN, CORS_RULE_NAME_RESERVED_PREFIX, CORS_RULES_MAX_COUNT, CorsOperation, KnownBucketResponseType, } from './types/bucket.js';
30
+ export { DownloadClientUnauthorizedToReadMarker, DownloadHeaderName, } from './types/download.js';
29
31
  export { EncryptionAlgorithm, EncryptionKey, EncryptionMode, SSE_B2, SSE_NONE, sseCustomer, } from './types/encryption.js';
30
32
  export { KNOWN_B2_ERROR_CODES } from './types/errors.js';
31
- export { FileAction, MetadataDirective } from './types/file.js';
32
- export { accountId, applicationKeyId, bucketId, fileId, keyId, largeFileId, } from './types/ids.js';
33
+ export { FileAction, HIDE_MARKER_CONTENT_TYPE, MetadataDirective } from './types/file.js';
34
+ export { accountId, applicationKeyId, bucketId, computerId, fileId, groupId, keyId, largeFileId, partnerToken, } from './types/ids.js';
33
35
  export type * from './types/index.js';
34
36
  export { LegalHoldValue, RetentionMode } from './types/lock.js';
35
- export { EventType } from './types/notifications.js';
37
+ export { EventType, notificationCustomHeadersToRecord, recordToNotificationCustomHeaders, } from './types/notifications.js';
38
+ export { PartnerCapability, Region } from './types/partner.js';
36
39
  export type { AmbiguousFinishCleanupFailureEvent, CancelLargeFileCleanupFailureEvent, CleanupFailureEvent, CleanupFailureListener, CleanupFailureOptions, } from './upload/cancel.js';
37
40
  export type { ResumePartReusedEvent, ResumePartReusedListener, } from './upload/large.js';
38
41
  export type { B2ObjectUploadOptions, B2ObjectWriteStreamOptions, BucketUploadOptions, HighLevelUploadOptions, UploadOptions, } from './upload/options.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,YAAY,EACV,WAAW,EACX,2BAA2B,EAC3B,cAAc,GACf,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EACL,MAAM,EACN,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,YAAY,GAClB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACxF,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EACL,iBAAiB,EACjB,OAAO,EACP,6BAA6B,EAC7B,yBAAyB,EACzB,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,gBAAgB,E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,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EACV,qBAAqB,EACrB,0BAA0B,EAC1B,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,GACd,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EACV,4BAA4B,EAC5B,+BAA+B,EAC/B,6BAA6B,GAC9B,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAClG,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAIxE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA"}
package/dist/index.d.ts CHANGED
@@ -9,30 +9,33 @@
9
9
  */
10
10
  export type { AccountInfo, AuthContextAwareAccountInfo, UploadUrlEntry, } from './auth/account-info.js';
11
11
  export { InMemoryAccountInfo } from './auth/in-memory.js';
12
- export { Bucket, type DeleteAllDeleteEvent, type DeleteAllErrorEvent, type DeleteAllEvent, type DeleteAllSkipEvent, type DeleteError, type DeleteManyResult, type DeleteTarget, } from './bucket.js';
13
- export { B2Client, type B2ClientOptions, type CapabilityCheckResult } from './client.js';
12
+ export { Bucket, type BucketListFileNamesBaseOptions, type BucketListFileNamesMaybeDelimiterOptions, type BucketListFileNamesOptions, type BucketListFileNamesWithDelimiterOptions, type BucketListFileVersionsBaseOptions, type BucketListFileVersionsMaybeDelimiterOptions, type BucketListFileVersionsOptions, type BucketListFileVersionsWithDelimiterOptions, type BucketPaginateFileNamesMaybeDelimiterOptions, type BucketPaginateFileNamesOptions, type BucketPaginateFileNamesWithDelimiterOptions, type BucketPaginateFileVersionsMaybeDelimiterOptions, type BucketPaginateFileVersionsOptions, type BucketPaginateFileVersionsWithDelimiterOptions, type DeleteAllDeleteEvent, type DeleteAllErrorEvent, type DeleteAllEvent, type DeleteAllSkipEvent, type DeleteError, type DeleteManyResult, type DeleteTarget, } from './bucket.js';
13
+ export { assertValidBucketConfiguration, assertValidBucketInfo, assertValidCorsRules, } from './bucket-validation.js';
14
+ export { B2Client, type B2ClientAuthorizeOptions, type B2ClientOptions, type CapabilityCheckResult, } from './client.js';
14
15
  export type { DownloadResult, HeadResult } from './download/single.js';
15
- export type { B2ErrorOptions } from './errors/index.js';
16
- export { AccessDeniedError, B2Error, B2InsufficientCapabilityError, B2RealmConfigurationError, B2RedirectError, B2SsrfError, BadAuthTokenError, BadBucketIdError, BadJsonError, BadRequestError, BadUploadUrlError, CapExceededError, ChecksumMismatchError, ConflictError, classifyError, DuplicateBucketNameError, ExpiredAuthTokenError, FileNotPresentError, FinishLargeFileResponseBodyError, InternalError, InvalidBucketIdError, InvalidBucketInfoError, InvalidBucketNameError, InvalidFileIdError, InvalidFileInfoError, InvalidFileNameError, InvalidPartNumberError, MethodNotAllowedError, NetworkError, NotFoundError, OutOfRangeError, RangeNotSatisfiableError, RequestTimeoutError, ResumeFileIdMismatchError, ServiceUnavailableError, TooManyBucketsError, TooManyFilesError, TooManyRequestsError, UploadResponseBodyError, } from './errors/index.js';
16
+ export type { B2BucketConfigurationErrorField, B2ErrorOptions } from './errors/index.js';
17
+ export { AccessDeniedError, B2BucketConfigurationError, B2Error, B2InsufficientCapabilityError, B2PartnerAuthorizationError, B2RealmConfigurationError, B2RedirectError, B2SsrfError, BadAuthTokenError, BadBucketIdError, BadJsonError, BadRequestError, BadUploadUrlError, CapExceededError, ChecksumMismatchError, ConflictError, classifyError, DuplicateBucketNameError, ExpiredAuthTokenError, FileNotPresentError, FinishLargeFileResponseBodyError, GroupMemberCreationFailedError, InternalError, InvalidAccountIdError, InvalidBucketIdError, InvalidBucketInfoError, InvalidBucketNameError, InvalidComputerIdError, InvalidEmailError, InvalidFileIdError, InvalidFileInfoError, InvalidFileNameError, InvalidGroupIdError, InvalidMemberAccountIdError, InvalidPartNumberError, InvalidRegionError, InvalidSmsPhoneError, MethodFailureError, MethodNotAllowedError, MissingSmsPhoneError, NetworkError, NotFoundError, OutOfRangeError, RangeNotSatisfiableError, RequestTimeoutError, ResumeFileIdMismatchError, ServiceUnavailableError, TooManyBucketsError, TooManyFilesError, TooManyGroupMembersError, TooManyMembersError, TooManyRequestsError, UploadResponseBodyError, } from './errors/index.js';
17
18
  export type { RetryOptions } from './http/retry.js';
18
- export type { HttpRequest, HttpResponse, HttpTransport, RetryTransportOptions, } from './http/transport.js';
19
- export { FetchTransport, RetryTransport } from './http/transport.js';
19
+ export type { HttpRequest, HttpResponse, HttpTransport, RetryTransportOptions, UrlGuardedTransport, } from './http/transport.js';
20
+ export { FetchTransport, getTransportUrlGuard, RetryTransport } from './http/transport.js';
20
21
  export { deriveAllowedSuffixes, UrlGuard } from './http/url-guard.js';
21
22
  export { B2Object, type DownloadCallOptions, type HeadCallOptions } from './object.js';
22
- export { type DownloadFileOptions, RawClient, type RawClientOptions, type RawRequestOptions, type SseCDownloadKey, } from './raw/index.js';
23
- export { IncrementalSha1, sha1Hex } from './streams/hash.js';
23
+ export { type AuthorizeAccountOptions, type DownloadFileOptions, RawClient, type RawClientOptions, type RawRequestOptions, type SseCDownloadKey, } from './raw/index.js';
24
+ export { IncrementalSha1, IncrementalSha256, sha1Hex, sha256Hex } from './streams/hash.js';
24
25
  export type { ProgressEvent, ProgressListener } from './streams/progress.js';
25
26
  export type { ContentSource, FileSourcePath } from './streams/source.js';
26
27
  export { BlobSource, BufferSource, FileSource, StreamSource, toContentSource, } from './streams/source.js';
27
28
  export { Capability } from './types/auth.js';
28
- export { BucketRetentionMode, BucketType, CorsOperation } from './types/bucket.js';
29
+ 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_RULE_MAX_BYTES, CORS_RULE_NAME_MAX_LENGTH, CORS_RULE_NAME_MIN_LENGTH, CORS_RULE_NAME_PATTERN, CORS_RULE_NAME_RESERVED_PREFIX, CORS_RULES_MAX_COUNT, CorsOperation, KnownBucketResponseType, } from './types/bucket.js';
30
+ export { DownloadClientUnauthorizedToReadMarker, DownloadHeaderName, } from './types/download.js';
29
31
  export { EncryptionAlgorithm, EncryptionKey, EncryptionMode, SSE_B2, SSE_NONE, sseCustomer, } from './types/encryption.js';
30
32
  export { KNOWN_B2_ERROR_CODES } from './types/errors.js';
31
- export { FileAction, MetadataDirective } from './types/file.js';
32
- export { accountId, applicationKeyId, bucketId, fileId, keyId, largeFileId, } from './types/ids.js';
33
+ export { FileAction, HIDE_MARKER_CONTENT_TYPE, MetadataDirective } from './types/file.js';
34
+ export { accountId, applicationKeyId, bucketId, computerId, fileId, groupId, keyId, largeFileId, partnerToken, } from './types/ids.js';
33
35
  export type * from './types/index.js';
34
36
  export { LegalHoldValue, RetentionMode } from './types/lock.js';
35
- export { EventType } from './types/notifications.js';
37
+ export { EventType, notificationCustomHeadersToRecord, recordToNotificationCustomHeaders, } from './types/notifications.js';
38
+ export { PartnerCapability, Region } from './types/partner.js';
36
39
  export type { AmbiguousFinishCleanupFailureEvent, CancelLargeFileCleanupFailureEvent, CleanupFailureEvent, CleanupFailureListener, CleanupFailureOptions, } from './upload/cancel.js';
37
40
  export type { ResumePartReusedEvent, ResumePartReusedListener, } from './upload/large.js';
38
41
  export type { B2ObjectUploadOptions, B2ObjectWriteStreamOptions, BucketUploadOptions, HighLevelUploadOptions, UploadOptions, } from './upload/options.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":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,MAAM,qBAAqB,CAAA;AAIxE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA"}
package/dist/index.js CHANGED
@@ -1,22 +1,25 @@
1
1
  import { InMemoryAccountInfo } from "./auth/in-memory.js";
2
- import { FileAction, MetadataDirective } from "./types/file.js";
3
- import { accountId, applicationKeyId, bucketId, fileId, keyId, largeFileId } from "./types/ids.js";
2
+ import { FileAction, HIDE_MARKER_CONTENT_TYPE, MetadataDirective } from "./types/file.js";
3
+ import { accountId, applicationKeyId, bucketId, computerId, fileId, groupId, keyId, largeFileId, partnerToken } from "./types/ids.js";
4
4
  import { KNOWN_B2_ERROR_CODES } from "./types/errors.js";
5
- import { AccessDeniedError, B2Error, B2InsufficientCapabilityError, B2RealmConfigurationError, B2RedirectError, B2SsrfError, BadAuthTokenError, BadBucketIdError, BadJsonError, BadRequestError, BadUploadUrlError, CapExceededError, ChecksumMismatchError, ConflictError, DuplicateBucketNameError, ExpiredAuthTokenError, FileNotPresentError, FinishLargeFileResponseBodyError, InternalError, InvalidBucketIdError, InvalidBucketInfoError, InvalidBucketNameError, InvalidFileIdError, InvalidFileInfoError, InvalidFileNameError, InvalidPartNumberError, MethodNotAllowedError, NetworkError, NotFoundError, OutOfRangeError, RangeNotSatisfiableError, RequestTimeoutError, ResumeFileIdMismatchError, ServiceUnavailableError, TooManyBucketsError, TooManyFilesError, TooManyRequestsError, UploadResponseBodyError, classifyError } from "./errors/index.js";
6
- import { IncrementalSha1, sha1Hex } from "./streams/hash.js";
5
+ import { AccessDeniedError, B2BucketConfigurationError, B2Error, B2InsufficientCapabilityError, B2PartnerAuthorizationError, B2RealmConfigurationError, B2RedirectError, B2SsrfError, BadAuthTokenError, BadBucketIdError, BadJsonError, BadRequestError, BadUploadUrlError, CapExceededError, ChecksumMismatchError, ConflictError, DuplicateBucketNameError, ExpiredAuthTokenError, FileNotPresentError, FinishLargeFileResponseBodyError, GroupMemberCreationFailedError, InternalError, InvalidAccountIdError, InvalidBucketIdError, InvalidBucketInfoError, InvalidBucketNameError, InvalidComputerIdError, InvalidEmailError, InvalidFileIdError, InvalidFileInfoError, InvalidFileNameError, InvalidGroupIdError, InvalidMemberAccountIdError, InvalidPartNumberError, InvalidRegionError, InvalidSmsPhoneError, MethodFailureError, MethodNotAllowedError, MissingSmsPhoneError, NetworkError, NotFoundError, OutOfRangeError, RangeNotSatisfiableError, RequestTimeoutError, ResumeFileIdMismatchError, ServiceUnavailableError, TooManyBucketsError, TooManyFilesError, TooManyGroupMembersError, TooManyMembersError, TooManyRequestsError, UploadResponseBodyError, classifyError } from "./errors/index.js";
6
+ import { DownloadClientUnauthorizedToReadMarker, DownloadHeaderName } from "./types/download.js";
7
+ import { EncryptionAlgorithm, EncryptionKey, EncryptionMode, SSE_B2, SSE_NONE, sseCustomer } from "./types/encryption.js";
8
+ import { LegalHoldValue, RetentionMode } from "./types/lock.js";
9
+ import { IncrementalSha1, IncrementalSha256, sha1Hex, sha256Hex } from "./streams/hash.js";
7
10
  import { FileSource } from "./streams/file-source.js";
8
11
  import { BlobSource, BufferSource, StreamSource, toContentSource } from "./streams/source.js";
9
- import { BucketRetentionMode, BucketType, CorsOperation } from "./types/bucket.js";
10
- import { EncryptionAlgorithm, EncryptionKey, EncryptionMode, SSE_B2, SSE_NONE, sseCustomer } from "./types/encryption.js";
12
+ import { 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 } from "./types/bucket.js";
11
13
  import { B2Object } from "./object.js";
12
14
  import { paginateItems, paginatePages } from "./util/paginator.js";
13
15
  import { Bucket } from "./bucket.js";
16
+ import { assertValidBucketConfiguration, assertValidBucketInfo, assertValidCorsRules } from "./bucket-validation.js";
14
17
  import { UrlGuard, deriveAllowedSuffixes } from "./http/url-guard.js";
15
18
  import { VERSION } from "./version.js";
16
- import { FetchTransport, RetryTransport } from "./http/transport.js";
19
+ import { FetchTransport, RetryTransport, getTransportUrlGuard } from "./http/transport.js";
17
20
  import { RawClient } from "./raw/index.js";
18
21
  import { B2Client } from "./client.js";
19
22
  import { Capability } from "./types/auth.js";
20
- import { LegalHoldValue, RetentionMode } from "./types/lock.js";
21
- import { EventType } from "./types/notifications.js";
22
- export { AccessDeniedError, B2Client, B2Error, B2InsufficientCapabilityError, B2Object, B2RealmConfigurationError, B2RedirectError, B2SsrfError, BadAuthTokenError, BadBucketIdError, BadJsonError, BadRequestError, BadUploadUrlError, BlobSource, Bucket, BucketRetentionMode, BucketType, BufferSource, CapExceededError, Capability, ChecksumMismatchError, ConflictError, CorsOperation, DuplicateBucketNameError, EncryptionAlgorithm, EncryptionKey, EncryptionMode, EventType, ExpiredAuthTokenError, FetchTransport, FileAction, FileNotPresentError, FileSource, FinishLargeFileResponseBodyError, InMemoryAccountInfo, IncrementalSha1, InternalError, InvalidBucketIdError, InvalidBucketInfoError, InvalidBucketNameError, InvalidFileIdError, InvalidFileInfoError, InvalidFileNameError, InvalidPartNumberError, KNOWN_B2_ERROR_CODES, LegalHoldValue, MetadataDirective, MethodNotAllowedError, NetworkError, NotFoundError, OutOfRangeError, RangeNotSatisfiableError, RawClient, RequestTimeoutError, ResumeFileIdMismatchError, RetentionMode, RetryTransport, SSE_B2, SSE_NONE, ServiceUnavailableError, StreamSource, TooManyBucketsError, TooManyFilesError, TooManyRequestsError, UploadResponseBodyError, UrlGuard, VERSION, accountId, applicationKeyId, bucketId, classifyError, deriveAllowedSuffixes, fileId, keyId, largeFileId, paginateItems, paginatePages, sha1Hex, sseCustomer, toContentSource };
23
+ import { EventType, notificationCustomHeadersToRecord, recordToNotificationCustomHeaders } from "./types/notifications.js";
24
+ import { PartnerCapability, Region } from "./types/partner.js";
25
+ export { AccessDeniedError, B2BucketConfigurationError, B2Client, B2Error, B2InsufficientCapabilityError, B2Object, B2PartnerAuthorizationError, B2RealmConfigurationError, B2RedirectError, B2SsrfError, BUCKET_INFO_KEY_MAX_BYTES, BUCKET_INFO_KEY_MIN_BYTES, BUCKET_INFO_KEY_PATTERN, BUCKET_INFO_RESERVED_PREFIX, BUCKET_INFO_VALUES_MAX_BYTES, BadAuthTokenError, BadBucketIdError, BadJsonError, BadRequestError, BadUploadUrlError, BlobSource, Bucket, BucketKeyOption, BucketRetentionMode, BucketType, BufferSource, 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, CapExceededError, Capability, ChecksumMismatchError, ConflictError, CorsOperation, DownloadClientUnauthorizedToReadMarker, DownloadHeaderName, DuplicateBucketNameError, EncryptionAlgorithm, EncryptionKey, EncryptionMode, EventType, ExpiredAuthTokenError, FetchTransport, FileAction, FileNotPresentError, FileSource, FinishLargeFileResponseBodyError, GroupMemberCreationFailedError, HIDE_MARKER_CONTENT_TYPE, InMemoryAccountInfo, IncrementalSha1, IncrementalSha256, InternalError, InvalidAccountIdError, InvalidBucketIdError, InvalidBucketInfoError, InvalidBucketNameError, InvalidComputerIdError, InvalidEmailError, InvalidFileIdError, InvalidFileInfoError, InvalidFileNameError, InvalidGroupIdError, InvalidMemberAccountIdError, InvalidPartNumberError, InvalidRegionError, InvalidSmsPhoneError, KNOWN_B2_ERROR_CODES, KnownBucketResponseType, LegalHoldValue, MetadataDirective, MethodFailureError, MethodNotAllowedError, MissingSmsPhoneError, NetworkError, NotFoundError, OutOfRangeError, PartnerCapability, RangeNotSatisfiableError, RawClient, Region, RequestTimeoutError, ResumeFileIdMismatchError, RetentionMode, RetryTransport, SSE_B2, SSE_NONE, ServiceUnavailableError, StreamSource, TooManyBucketsError, TooManyFilesError, TooManyGroupMembersError, TooManyMembersError, TooManyRequestsError, UploadResponseBodyError, UrlGuard, VERSION, accountId, applicationKeyId, assertValidBucketConfiguration, assertValidBucketInfo, assertValidCorsRules, bucketId, classifyError, computerId, deriveAllowedSuffixes, fileId, getTransportUrlGuard, groupId, keyId, largeFileId, notificationCustomHeadersToRecord, paginateItems, paginatePages, partnerToken, recordToNotificationCustomHeaders, sha1Hex, sha256Hex, sseCustomer, toContentSource };
@@ -1,5 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_notifications = require("../types/notifications.cjs");
2
3
  const require_webhook = require("./webhook.cjs");
3
4
  exports.B2_WEBHOOK_SIGNATURE_HEADER = require_webhook.B2_WEBHOOK_SIGNATURE_HEADER;
5
+ exports.notificationCustomHeadersToRecord = require_notifications.notificationCustomHeadersToRecord;
6
+ exports.recordToNotificationCustomHeaders = require_notifications.recordToNotificationCustomHeaders;
4
7
  exports.requireValidWebhook = require_webhook.requireValidWebhook;
5
8
  exports.verifyWebhookSignature = require_webhook.verifyWebhookSignature;
@@ -1,3 +1,5 @@
1
+ export type { EventNotificationCustomHeader, EventNotificationRule, } from '../types/notifications.js';
2
+ export { notificationCustomHeadersToRecord, recordToNotificationCustomHeaders, } from '../types/notifications.js';
1
3
  export type { VerifyWebhookOptions, VerifyWebhookResult, WebhookEvent, WebhookPayload, } from './webhook.js';
2
4
  export { B2_WEBHOOK_SIGNATURE_HEADER, requireValidWebhook, verifyWebhookSignature, } from './webhook.js';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.js"],"names":[],"mappings":"AAAA,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACZ,cAAc,GACf,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.js"],"names":[],"mappings":"AAAA,YAAY,EACV,6BAA6B,EAC7B,qBAAqB,GACtB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,iCAAiC,EACjC,iCAAiC,GAClC,MAAM,2BAA2B,CAAA;AAClC,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACZ,cAAc,GACf,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,cAAc,CAAA"}
@@ -1,3 +1,5 @@
1
+ export type { EventNotificationCustomHeader, EventNotificationRule, } from '../types/notifications.js';
2
+ export { notificationCustomHeadersToRecord, recordToNotificationCustomHeaders, } from '../types/notifications.js';
1
3
  export type { VerifyWebhookOptions, VerifyWebhookResult, WebhookEvent, WebhookPayload, } from './webhook.js';
2
4
  export { B2_WEBHOOK_SIGNATURE_HEADER, requireValidWebhook, verifyWebhookSignature, } from './webhook.js';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.js"],"names":[],"mappings":"AAAA,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACZ,cAAc,GACf,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.js"],"names":[],"mappings":"AAAA,YAAY,EACV,6BAA6B,EAC7B,qBAAqB,GACtB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,iCAAiC,EACjC,iCAAiC,GAClC,MAAM,2BAA2B,CAAA;AAClC,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACZ,cAAc,GACf,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,cAAc,CAAA"}
@@ -1,2 +1,3 @@
1
+ import { notificationCustomHeadersToRecord, recordToNotificationCustomHeaders } from "../types/notifications.js";
1
2
  import { B2_WEBHOOK_SIGNATURE_HEADER, requireValidWebhook, verifyWebhookSignature } from "./webhook.js";
2
- export { B2_WEBHOOK_SIGNATURE_HEADER, requireValidWebhook, verifyWebhookSignature };
3
+ export { B2_WEBHOOK_SIGNATURE_HEADER, notificationCustomHeadersToRecord, recordToNotificationCustomHeaders, requireValidWebhook, verifyWebhookSignature };
package/dist/object.cjs CHANGED
@@ -15,6 +15,15 @@ function bucketDefaultRetentionSnapshot(info) {
15
15
  unreadable: false
16
16
  };
17
17
  }
18
+ function bucketDefaultServerSideEncryptionSnapshot(info) {
19
+ const encryption = info.defaultServerSideEncryption;
20
+ if (!encryption.isClientAuthorizedToRead) return { unreadable: true };
21
+ if (encryption.value === null) return { unreadable: false };
22
+ return {
23
+ encryption: encryption.value,
24
+ unreadable: false
25
+ };
26
+ }
18
27
  function resumeNeedsFreshBucketDefaults(options) {
19
28
  return (options.resume === true || options.resumeFileId !== void 0) && (options.serverSideEncryption === void 0 || options.fileRetention === void 0);
20
29
  }
@@ -64,12 +73,14 @@ var B2Object = class {
64
73
  if (isLarge) {
65
74
  const bucketInfo = resumeNeedsFreshBucketDefaults(options) ? await this.fetchFreshBucketInfo() : this.bucket.info;
66
75
  const bucketDefaultRetention = bucketDefaultRetentionSnapshot(bucketInfo);
76
+ const bucketDefaultSse = bucketDefaultServerSideEncryptionSnapshot(bucketInfo);
67
77
  return require_large.uploadLargeFile(this.client.raw, this.client.accountInfo, {
68
78
  ...options,
69
79
  bucketId: this.bucket.id,
70
80
  fileName: this.fileName,
71
81
  retry: uploadRetryOptions,
72
- bucketDefaultServerSideEncryption: bucketInfo.defaultServerSideEncryption,
82
+ ...bucketDefaultSse.encryption !== void 0 ? { bucketDefaultServerSideEncryption: bucketDefaultSse.encryption } : {},
83
+ ...bucketDefaultSse.unreadable ? { bucketDefaultServerSideEncryptionUnreadable: true } : {},
73
84
  ...bucketDefaultRetention.retention !== void 0 ? { bucketDefaultRetention: bucketDefaultRetention.retention } : {},
74
85
  ...bucketDefaultRetention.unreadable ? { bucketDefaultRetentionUnreadable: true } : {}
75
86
  });
@@ -155,7 +166,7 @@ var B2Object = class {
155
166
  * Creates a parallel-download ReadableStream that fetches the file in concurrent ranged chunks.
156
167
  * @param fileId - The file version ID to download.
157
168
  * @param totalSize - Total file size in bytes (needed to compute range boundaries).
158
- * @param options - Concurrency, range size, and abort signal.
169
+ * @param options - Concurrency, range size, SSE-C decryption, and abort signal.
159
170
  *
160
171
  * @returns A Web ReadableStream of file data in sequential order.
161
172
  */
@@ -1 +1 @@
1
- {"version":3,"file":"object.cjs","names":[],"sources":["../src/object.ts"],"sourcesContent":["import type { Bucket } from './bucket.ts'\nimport type { B2Client } from './client.ts'\nimport { createParallelDownloadStream } from './download/parallel.ts'\nimport {\n type DownloadResult,\n downloadById,\n downloadByName,\n type HeadResult,\n headById,\n headByName,\n} from './download/single.ts'\nimport type { RetryOptions } from './http/retry.ts'\nimport { mergeUploadRetryOptions } from './internal/upload-retry-options.ts'\nimport type { SseCDownloadKey } from './raw/index.ts'\nimport type { ProgressListener } from './streams/progress.ts'\nimport type { BucketRetentionPolicy } from './types/bucket.ts'\nimport type { FileVersion } from './types/file.ts'\nimport type { FileId } from './types/ids.ts'\nimport type { FileRetentionValue, LegalHoldValue } from './types/lock.ts'\nimport { uploadLargeFile } from './upload/large.ts'\nimport {\n type B2ObjectUploadOptions,\n type B2ObjectWriteStreamOptions,\n rejectSmallResumeFileId,\n stripResumeOnlyOptions,\n} from './upload/options.ts'\nimport { uploadSmallFile } from './upload/single.ts'\nimport { createWriteStream, type UploadWriteHandle } from './upload/stream.ts'\n\ninterface BucketDefaultRetentionSnapshot {\n readonly retention?: BucketRetentionPolicy\n readonly unreadable: boolean\n}\n\nfunction bucketDefaultRetentionSnapshot(info: Bucket['info']): BucketDefaultRetentionSnapshot {\n const fileLock = info.fileLockConfiguration\n if (!fileLock.isClientAuthorizedToRead) return { unreadable: true }\n if (fileLock.value === null) return { unreadable: false }\n return { retention: fileLock.value.defaultRetention, unreadable: false }\n}\n\nfunction resumeNeedsFreshBucketDefaults(options: B2ObjectUploadOptions): boolean {\n const resumeRequested = options.resume === true || options.resumeFileId !== undefined\n return (\n resumeRequested &&\n (options.serverSideEncryption === undefined || options.fileRetention === undefined)\n )\n}\n\n/** Options accepted by {@link B2Object.download} and {@link B2Object.downloadById}. */\nexport interface DownloadCallOptions {\n /**\n * HTTP method. Defaults to `'GET'`. Use `'HEAD'` to fetch only\n * response headers. Prefer the dedicated {@link B2Object.head} /\n * {@link Bucket.head} method over this option — those return a\n * body-less result so callers never have to remember to drain the\n * empty body of a HEAD response.\n */\n readonly method?: 'GET' | 'HEAD'\n /** HTTP Range header value (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?: SseCDownloadKey\n /** Override the response `Content-Disposition` header. */\n readonly b2ContentDisposition?: string\n /** Override the response `Content-Language` header. */\n readonly b2ContentLanguage?: string\n /** Override the response `Content-Encoding` header. */\n readonly b2ContentEncoding?: string\n /** Override the response `Content-Type` header. */\n readonly b2ContentType?: string\n /** Override the response `Cache-Control` header. */\n readonly b2CacheControl?: string\n /** Override the response `Expires` header. */\n readonly b2Expires?: string\n /** Abort signal for cancelling the download. */\n readonly signal?: AbortSignal\n /**\n * Callback invoked as the response body is consumed.\n *\n * Progress is byte-driven, not request-driven: the callback fires per\n * chunk as the caller reads the returned `body` stream, and the final\n * `partsCompleted: 1` event only fires once the stream is read to\n * completion. Downloads that are dropped or aborted partway through\n * will NOT emit a `completePart()` event.\n */\n readonly onProgress?: ProgressListener\n}\n\n/**\n * Options accepted by {@link B2Object.head} / {@link Bucket.head}.\n * Same shape as {@link DownloadCallOptions} minus `method` (always\n * HEAD) and `onProgress` (no body to track).\n */\nexport type HeadCallOptions = Omit<DownloadCallOptions, 'method' | 'onProgress'>\n\n/**\n * Handle to a specific file (by name) within a B2 bucket.\n *\n * Provides file-scoped upload, download, and management operations.\n * Obtained via {@link Bucket.file}.\n *\n * @example\n * ```ts\n * const obj = bucket.file('photos/2026/sunset.jpg')\n * await obj.upload({ source: new BufferSource(data) })\n * const result = await obj.download()\n * ```\n */\nexport class B2Object {\n /** The file name (path) within the bucket. */\n readonly fileName: string\n private readonly client: B2Client\n private readonly bucket: Bucket\n private readonly uploadRetryOptions: RetryOptions\n\n /**\n * @param client - The parent B2Client instance.\n * @param bucket - The parent Bucket this object belongs to.\n * @param fileName - The file path within the bucket.\n * @param uploadRetryOptions - Resolved client upload retry defaults.\n *\n * @internal\n */\n constructor(\n client: B2Client,\n bucket: Bucket,\n fileName: string,\n uploadRetryOptions: RetryOptions,\n ) {\n this.client = client\n this.bucket = bucket\n this.fileName = fileName\n this.uploadRetryOptions = uploadRetryOptions\n }\n\n /**\n * Uploads data to this file name. Automatically uses multipart upload for large files.\n * @param options - Upload configuration including data source and optional settings.\n *\n * @returns Metadata for the uploaded file version.\n */\n async upload(options: B2ObjectUploadOptions): Promise<FileVersion> {\n const recommendedPartSize = this.client.accountInfo.getRecommendedPartSize()\n const isLarge = options.source.size > recommendedPartSize\n const uploadRetryOptions = mergeUploadRetryOptions(this.uploadRetryOptions, options.retry)\n\n if (isLarge) {\n const bucketInfo = resumeNeedsFreshBucketDefaults(options)\n ? await this.fetchFreshBucketInfo()\n : this.bucket.info\n const bucketDefaultRetention = bucketDefaultRetentionSnapshot(bucketInfo)\n return uploadLargeFile(this.client.raw, this.client.accountInfo, {\n ...options,\n bucketId: this.bucket.id,\n fileName: this.fileName,\n retry: uploadRetryOptions,\n bucketDefaultServerSideEncryption: bucketInfo.defaultServerSideEncryption,\n ...(bucketDefaultRetention.retention !== undefined\n ? { bucketDefaultRetention: bucketDefaultRetention.retention }\n : {}),\n ...(bucketDefaultRetention.unreadable ? { bucketDefaultRetentionUnreadable: true } : {}),\n })\n }\n rejectSmallResumeFileId(options, 'B2Object.upload')\n const smallOptions = stripResumeOnlyOptions(options)\n return uploadSmallFile(this.client.raw, this.client.accountInfo, {\n ...smallOptions,\n bucketId: this.bucket.id,\n fileName: this.fileName,\n retry: uploadRetryOptions,\n })\n }\n\n private async fetchFreshBucketInfo(): Promise<Bucket['info']> {\n const fresh = await this.client.listBuckets({ bucketId: this.bucket.id })\n const found = fresh[0]\n if (!found) throw new Error(`Bucket ${this.bucket.id} not found`)\n return found.info\n }\n\n /**\n * Downloads this file by name. Pass `method: 'HEAD'` to fetch only the\n * response headers (file metadata) without streaming the body.\n * @param options - Optional method, range, SSE-C decryption, response-header overrides, and abort signal.\n *\n * @returns The download result with response headers and body stream.\n */\n async download(options?: DownloadCallOptions): Promise<DownloadResult> {\n return downloadByName(this.client.raw, this.client.accountInfo, {\n bucketName: this.bucket.name,\n fileName: this.fileName,\n ...options,\n })\n }\n\n /**\n * Fetches response headers for this file via HTTP HEAD. Returns a\n * body-less result so callers never have to drain the (logically\n * empty) HEAD body themselves.\n *\n * @param options - Optional range, SSE-C decryption, response-header\n * overrides, and abort signal. Same shape as {@link B2Object.download}'s\n * options minus `method` (always HEAD) and `onProgress` (no body).\n *\n * @returns Parsed download headers (content type, SHA-1, file info, etc.).\n */\n async head(options?: HeadCallOptions): Promise<HeadResult> {\n return headByName(this.client.raw, this.client.accountInfo, {\n bucketName: this.bucket.name,\n fileName: this.fileName,\n ...options,\n })\n }\n\n /**\n * Downloads a specific version of this file by ID. Pass `method: 'HEAD'`\n * to fetch only the response headers (file metadata) without streaming the body.\n * @param fileId - The file version ID to download.\n * @param options - Optional method, range, SSE-C decryption, response-header overrides, and abort signal.\n *\n * @returns The download result with response headers and body stream.\n */\n async downloadById(fileId: FileId, options?: DownloadCallOptions): Promise<DownloadResult> {\n return downloadById(this.client.raw, this.client.accountInfo, {\n fileId,\n ...options,\n })\n }\n\n /**\n * Fetches response headers for a specific version of this file by ID\n * via HTTP HEAD. Returns a body-less result so callers never have to\n * drain the (logically empty) HEAD body themselves.\n *\n * @param fileId - The file version ID to inspect.\n * @param options - Optional range, SSE-C decryption, response-header\n * overrides, and abort signal.\n *\n * @returns Parsed download headers.\n */\n async headById(fileId: FileId, options?: HeadCallOptions): Promise<HeadResult> {\n return headById(this.client.raw, this.client.accountInfo, {\n fileId,\n ...options,\n })\n }\n\n /**\n * Creates a parallel-download ReadableStream that fetches the file in concurrent ranged chunks.\n * @param fileId - The file version ID to download.\n * @param totalSize - Total file size in bytes (needed to compute range boundaries).\n * @param options - Concurrency, range size, and abort signal.\n *\n * @returns A Web ReadableStream of file data in sequential order.\n */\n createReadStream(\n fileId: FileId,\n totalSize: number,\n options?: {\n /** Size of each ranged GET request in bytes. Defaults to 8 MB. */\n rangeSize?: number\n /** Number of concurrent range requests. Defaults to 4. */\n concurrency?: number\n /** Abort signal for cancelling the download. */\n signal?: AbortSignal\n },\n ): ReadableStream<Uint8Array> {\n return createParallelDownloadStream(this.client.raw, this.client.accountInfo, {\n fileId,\n totalSize,\n ...options,\n })\n }\n\n /**\n * Creates a Web `WritableStream` that uploads streamed data into this file\n * using the multipart protocol. Pipe a `ReadableStream<Uint8Array>` into the\n * returned `writable` and await `done` to get the final {@link FileVersion}.\n *\n * Note: streaming uploads do not support resume because the size and per-part\n * hashes are not known in advance. Use {@link upload} with a buffered source\n * when resume is required.\n *\n * @param options - Streaming upload parameters (part size, concurrency, encryption).\n *\n * @returns A handle with the writable sink and a completion promise.\n */\n createWriteStream(options?: B2ObjectWriteStreamOptions): UploadWriteHandle {\n const uploadRetryOptions = mergeUploadRetryOptions(this.uploadRetryOptions, options?.retry)\n return createWriteStream(this.client.raw, this.client.accountInfo, {\n ...(options ?? {}),\n bucketId: this.bucket.id,\n fileName: this.fileName,\n retry: uploadRetryOptions,\n })\n }\n\n /**\n * Retrieves metadata for a specific file version.\n * @param fileId - The file version ID to look up.\n *\n * @returns The file version metadata.\n */\n async getFileInfo(fileId: FileId): Promise<FileVersion> {\n return this.client.raw.getFileInfo(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n { fileId },\n )\n }\n\n /**\n * Hides this file by creating a hide marker at this file name.\n *\n * @returns Metadata for the newly created hide marker.\n */\n async hide(): Promise<FileVersion> {\n return this.bucket.hideFile(this.fileName)\n }\n\n /**\n * Permanently deletes a specific version of this file.\n * @param fileId - The unique identifier of the file version to delete.\n */\n async deleteVersion(fileId: FileId): Promise<void> {\n await this.bucket.deleteFileVersion(this.fileName, fileId)\n }\n\n /**\n * Sets or updates the Object Lock retention policy on a specific file\n * version of this file.\n *\n * The bucket must have Object Lock enabled (`fileLockEnabled: true` at\n * creation time). Governance-mode retention can be shortened or removed\n * by passing `bypassGovernance: true` together with an application key\n * that carries the `bypassGovernance` capability; compliance-mode\n * retention cannot be shortened by anyone until the\n * `retainUntilTimestamp` elapses.\n *\n * @param fileId - The file version to apply the policy to.\n * @param retention - The retention policy to apply.\n * @param options - Optional flag for shortening governance-mode retention.\n *\n * @returns Metadata for the updated file version.\n */\n async setRetention(\n fileId: FileId,\n retention: FileRetentionValue,\n options?: { bypassGovernance?: boolean },\n ) {\n return this.bucket.updateFileRetention(this.fileName, fileId, retention, options)\n }\n\n /**\n * Toggles the legal hold flag on a specific file version of this file.\n *\n * Legal hold is independent of retention: a file can be on legal hold\n * without any retention policy, and vice versa. The bucket must have\n * Object Lock enabled, and any caller must hold the `writeFileLegalHolds`\n * capability.\n *\n * @param fileId - The file version to apply the flag to.\n * @param legalHold - `'on'` to apply the hold, `'off'` to remove it.\n *\n * @returns Metadata for the updated file version.\n */\n async setLegalHold(fileId: FileId, legalHold: LegalHoldValue) {\n return this.bucket.updateFileLegalHold(this.fileName, fileId, legalHold)\n }\n}\n"],"mappings":";;;;;;;;AAkCA,SAAS,+BAA+B,MAAsD;CAC5F,MAAM,WAAW,KAAK;CACtB,IAAI,CAAC,SAAS,0BAA0B,OAAO,EAAE,YAAY,KAAK;CAClE,IAAI,SAAS,UAAU,MAAM,OAAO,EAAE,YAAY,MAAM;CACxD,OAAO;EAAE,WAAW,SAAS,MAAM;EAAkB,YAAY;CAAM;AACzE;AAEA,SAAS,+BAA+B,SAAyC;CAE/E,QADwB,QAAQ,WAAW,QAAQ,QAAQ,iBAAiB,KAAA,OAGzE,QAAQ,yBAAyB,KAAA,KAAa,QAAQ,kBAAkB,KAAA;AAE7E;;;;;;;;;;;;;;AA8DA,IAAa,WAAb,MAAsB;;CAEpB;CACA;CACA;CACA;;;;;;;;;CAUA,YACE,QACA,QACA,UACA,oBACA;EACA,KAAK,SAAS;EACd,KAAK,SAAS;EACd,KAAK,WAAW;EAChB,KAAK,qBAAqB;CAC5B;;;;;;;CAQA,MAAM,OAAO,SAAsD;EACjE,MAAM,sBAAsB,KAAK,OAAO,YAAY,uBAAuB;EAC3E,MAAM,UAAU,QAAQ,OAAO,OAAO;EACtC,MAAM,qBAAqB,6BAAA,wBAAwB,KAAK,oBAAoB,QAAQ,KAAK;EAEzF,IAAI,SAAS;GACX,MAAM,aAAa,+BAA+B,OAAO,IACrD,MAAM,KAAK,qBAAqB,IAChC,KAAK,OAAO;GAChB,MAAM,yBAAyB,+BAA+B,UAAU;GACxE,OAAO,cAAA,gBAAgB,KAAK,OAAO,KAAK,KAAK,OAAO,aAAa;IAC/D,GAAG;IACH,UAAU,KAAK,OAAO;IACtB,UAAU,KAAK;IACf,OAAO;IACP,mCAAmC,WAAW;IAC9C,GAAI,uBAAuB,cAAc,KAAA,IACrC,EAAE,wBAAwB,uBAAuB,UAAU,IAC3D,CAAC;IACL,GAAI,uBA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ACH;;;;;;;;;;;;;;CAeA,kBAAkB,SAAyD;EACzE,MAAM,qBAAqB,6BAAA,wBAAwB,KAAK,oBAAoB,SAAS,KAAK;EAC1F,OAAO,eAAA,kBAAkB,KAAK,OAAO,KAAK,KAAK,OAAO,aAAa;GACjE,GAAI,WAAW,CAAC;GAChB,UAAU,KAAK,OAAO;GACtB,UAAU,KAAK;GACf,OAAO;EACT,CAAC;CACH;;;;;;;CAQA,MAAM,YAAY,QAAsC;EACtD,OAAO,KAAK,OAAO,IAAI,YACrB,KAAK,OAAO,YAAY,UAAU,GAClC,KAAK,OAAO,YAAY,aAAa,GACrC,EAAE,OAAO,CACX;CACF;;;;;;CAOA,MAAM,OAA6B;EACjC,OAAO,KAAK,OAAO,SAAS,KAAK,QAAQ;CAC3C;;;;;CAMA,MAAM,cAAc,QAA+B;EACjD,MAAM,KAAK,OAAO,kBAAkB,KAAK,UAAU,MAAM;CAC3D;;;;;;;;;;;;;;;;;;CAmBA,MAAM,aACJ,QACA,WACA,SACA;EACA,OAAO,KAAK,OAAO,oBAAoB,KAAK,UAAU,QAAQ,WAAW,OAAO;CAClF;;;;;;;;;;;;;;CAeA,MAAM,aAAa,QAAgB,WAA2B;EAC5D,OAAO,KAAK,OAAO,oBAAoB,KAAK,UAAU,QAAQ,SAAS;CACzE;AACF"}
1
+ {"version":3,"file":"object.cjs","names":[],"sources":["../src/object.ts"],"sourcesContent":["import type { Bucket } from './bucket.ts'\nimport type { B2Client } from './client.ts'\nimport { createParallelDownloadStream } from './download/parallel.ts'\nimport {\n type DownloadResult,\n downloadById,\n downloadByName,\n type HeadResult,\n headById,\n headByName,\n} from './download/single.ts'\nimport type { RetryOptions } from './http/retry.ts'\nimport { mergeUploadRetryOptions } from './internal/upload-retry-options.ts'\nimport type { SseCDownloadKey } from './raw/index.ts'\nimport type { ProgressListener } from './streams/progress.ts'\nimport type { BucketDefaultRetention, BucketDefaultServerSideEncryption } from './types/bucket.ts'\nimport type { FileVersion } from './types/file.ts'\nimport type { FileId } from './types/ids.ts'\nimport type { FileRetentionValue, LegalHoldValue } from './types/lock.ts'\nimport { uploadLargeFile } from './upload/large.ts'\nimport {\n type B2ObjectUploadOptions,\n type B2ObjectWriteStreamOptions,\n rejectSmallResumeFileId,\n stripResumeOnlyOptions,\n} from './upload/options.ts'\nimport { uploadSmallFile } from './upload/single.ts'\nimport { createWriteStream, type UploadWriteHandle } from './upload/stream.ts'\n\ninterface BucketDefaultRetentionSnapshot {\n readonly retention?: BucketDefaultRetention\n readonly unreadable: boolean\n}\n\ninterface BucketDefaultServerSideEncryptionSnapshot {\n readonly encryption?: BucketDefaultServerSideEncryption\n readonly unreadable: boolean\n}\n\nfunction bucketDefaultRetentionSnapshot(info: Bucket['info']): BucketDefaultRetentionSnapshot {\n const fileLock = info.fileLockConfiguration\n if (!fileLock.isClientAuthorizedToRead) return { unreadable: true }\n if (fileLock.value === null) return { unreadable: false }\n return { retention: fileLock.value.defaultRetention, unreadable: false }\n}\n\nfunction bucketDefaultServerSideEncryptionSnapshot(\n info: Bucket['info'],\n): BucketDefaultServerSideEncryptionSnapshot {\n const encryption = info.defaultServerSideEncryption\n if (!encryption.isClientAuthorizedToRead) return { unreadable: true }\n if (encryption.value === null) return { unreadable: false }\n return { encryption: encryption.value, unreadable: false }\n}\n\nfunction resumeNeedsFreshBucketDefaults(options: B2ObjectUploadOptions): boolean {\n const resumeRequested = options.resume === true || options.resumeFileId !== undefined\n return (\n resumeRequested &&\n (options.serverSideEncryption === undefined || options.fileRetention === undefined)\n )\n}\n\n/** Options accepted by {@link B2Object.download} and {@link B2Object.downloadById}. */\nexport interface DownloadCallOptions {\n /**\n * HTTP method. Defaults to `'GET'`. Use `'HEAD'` to fetch only\n * response headers. Prefer the dedicated {@link B2Object.head} /\n * {@link Bucket.head} method over this option — those return a\n * body-less result so callers never have to remember to drain the\n * empty body of a HEAD response.\n */\n readonly method?: 'GET' | 'HEAD'\n /** HTTP Range header value (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?: SseCDownloadKey\n /** Override the response `Content-Disposition` header. */\n readonly b2ContentDisposition?: string\n /** Override the response `Content-Language` header. */\n readonly b2ContentLanguage?: string\n /** Override the response `Content-Encoding` header. */\n readonly b2ContentEncoding?: string\n /** Override the response `Content-Type` header. */\n readonly b2ContentType?: string\n /** Override the response `Cache-Control` header. */\n readonly b2CacheControl?: string\n /** Override the response `Expires` header. */\n readonly b2Expires?: string\n /** Abort signal for cancelling the download. */\n readonly signal?: AbortSignal\n /**\n * Callback invoked as the response body is consumed.\n *\n * Progress is byte-driven, not request-driven: the callback fires per\n * chunk as the caller reads the returned `body` stream, and the final\n * `partsCompleted: 1` event only fires once the stream is read to\n * completion. Downloads that are dropped or aborted partway through\n * will NOT emit a `completePart()` event.\n */\n readonly onProgress?: ProgressListener\n /**\n * Minimum milliseconds between byte-only progress callbacks. Defaults to\n * the SDK's 100 ms progress interval; set to 0 for per-chunk callbacks.\n * The final completion callback is always emitted immediately.\n */\n readonly progressIntervalMillis?: number\n}\n\n/**\n * Options accepted by {@link B2Object.head} / {@link Bucket.head}.\n * Same shape as {@link DownloadCallOptions} minus `method` (always\n * HEAD) and `onProgress` (no body to track).\n */\nexport type HeadCallOptions = Omit<\n DownloadCallOptions,\n 'method' | 'onProgress' | 'progressIntervalMillis'\n>\n\n/**\n * Handle to a specific file (by name) within a B2 bucket.\n *\n * Provides file-scoped upload, download, and management operations.\n * Obtained via {@link Bucket.file}.\n *\n * @example\n * ```ts\n * const obj = bucket.file('photos/2026/sunset.jpg')\n * await obj.upload({ source: new BufferSource(data) })\n * const result = await obj.download()\n * ```\n */\nexport class B2Object {\n /** The file name (path) within the bucket. */\n readonly fileName: string\n private readonly client: B2Client\n private readonly bucket: Bucket\n private readonly uploadRetryOptions: RetryOptions\n\n /**\n * @param client - The parent B2Client instance.\n * @param bucket - The parent Bucket this object belongs to.\n * @param fileName - The file path within the bucket.\n * @param uploadRetryOptions - Resolved client upload retry defaults.\n *\n * @internal\n */\n constructor(\n client: B2Client,\n bucket: Bucket,\n fileName: string,\n uploadRetryOptions: RetryOptions,\n ) {\n this.client = client\n this.bucket = bucket\n this.fileName = fileName\n this.uploadRetryOptions = uploadRetryOptions\n }\n\n /**\n * Uploads data to this file name. Automatically uses multipart upload for large files.\n * @param options - Upload configuration including data source and optional settings.\n *\n * @returns Metadata for the uploaded file version.\n */\n async upload(options: B2ObjectUploadOptions): Promise<FileVersion> {\n const recommendedPartSize = this.client.accountInfo.getRecommendedPartSize()\n const isLarge = options.source.size > recommendedPartSize\n const uploadRetryOptions = mergeUploadRetryOptions(this.uploadRetryOptions, options.retry)\n\n if (isLarge) {\n const bucketInfo = resumeNeedsFreshBucketDefaults(options)\n ? await this.fetchFreshBucketInfo()\n : this.bucket.info\n const bucketDefaultRetention = bucketDefaultRetentionSnapshot(bucketInfo)\n const bucketDefaultSse = bucketDefaultServerSideEncryptionSnapshot(bucketInfo)\n return uploadLargeFile(this.client.raw, this.client.accountInfo, {\n ...options,\n bucketId: this.bucket.id,\n fileName: this.fileName,\n retry: uploadRetryOptions,\n ...(bucketDefaultSse.encryption !== undefined\n ? { bucketDefaultServerSideEncryption: bucketDefaultSse.encryption }\n : {}),\n ...(bucketDefaultSse.unreadable\n ? { bucketDefaultServerSideEncryptionUnreadable: true }\n : {}),\n ...(bucketDefaultRetention.retention !== undefined\n ? { bucketDefaultRetention: bucketDefaultRetention.retention }\n : {}),\n ...(bucketDefaultRetention.unreadable ? { bucketDefaultRetentionUnreadable: true } : {}),\n })\n }\n rejectSmallResumeFileId(options, 'B2Object.upload')\n const smallOptions = stripResumeOnlyOptions(options)\n return uploadSmallFile(this.client.raw, this.client.accountInfo, {\n ...smallOptions,\n bucketId: this.bucket.id,\n fileName: this.fileName,\n retry: uploadRetryOptions,\n })\n }\n\n private async fetchFreshBucketInfo(): Promise<Bucket['info']> {\n const fresh = await this.client.listBuckets({ bucketId: this.bucket.id })\n const found = fresh[0]\n if (!found) throw new Error(`Bucket ${this.bucket.id} not found`)\n return found.info\n }\n\n /**\n * Downloads this file by name. Pass `method: 'HEAD'` to fetch only the\n * response headers (file metadata) without streaming the body.\n * @param options - Optional method, range, SSE-C decryption, response-header overrides, and abort signal.\n *\n * @returns The download result with response headers and body stream.\n */\n async download(options?: DownloadCallOptions): Promise<DownloadResult> {\n return downloadByName(this.client.raw, this.client.accountInfo, {\n bucketName: this.bucket.name,\n fileName: this.fileName,\n ...options,\n })\n }\n\n /**\n * Fetches response headers for this file via HTTP HEAD. Returns a\n * body-less result so callers never have to drain the (logically\n * empty) HEAD body themselves.\n *\n * @param options - Optional range, SSE-C decryption, response-header\n * overrides, and abort signal. Same shape as {@link B2Object.download}'s\n * options minus `method` (always HEAD) and `onProgress` (no body).\n *\n * @returns Parsed download headers (content type, SHA-1, file info, etc.).\n */\n async head(options?: HeadCallOptions): Promise<HeadResult> {\n return headByName(this.client.raw, this.client.accountInfo, {\n bucketName: this.bucket.name,\n fileName: this.fileName,\n ...options,\n })\n }\n\n /**\n * Downloads a specific version of this file by ID. Pass `method: 'HEAD'`\n * to fetch only the response headers (file metadata) without streaming the body.\n * @param fileId - The file version ID to download.\n * @param options - Optional method, range, SSE-C decryption, response-header overrides, and abort signal.\n *\n * @returns The download result with response headers and body stream.\n */\n async downloadById(fileId: FileId, options?: DownloadCallOptions): Promise<DownloadResult> {\n return downloadById(this.client.raw, this.client.accountInfo, {\n fileId,\n ...options,\n })\n }\n\n /**\n * Fetches response headers for a specific version of this file by ID\n * via HTTP HEAD. Returns a body-less result so callers never have to\n * drain the (logically empty) HEAD body themselves.\n *\n * @param fileId - The file version ID to inspect.\n * @param options - Optional range, SSE-C decryption, response-header\n * overrides, and abort signal.\n *\n * @returns Parsed download headers.\n */\n async headById(fileId: FileId, options?: HeadCallOptions): Promise<HeadResult> {\n return headById(this.client.raw, this.client.accountInfo, {\n fileId,\n ...options,\n })\n }\n\n /**\n * Creates a parallel-download ReadableStream that fetches the file in concurrent ranged chunks.\n * @param fileId - The file version ID to download.\n * @param totalSize - Total file size in bytes (needed to compute range boundaries).\n * @param options - Concurrency, range size, SSE-C decryption, and abort signal.\n *\n * @returns A Web ReadableStream of file data in sequential order.\n */\n createReadStream(\n fileId: FileId,\n totalSize: number,\n options?: {\n /** Size of each ranged GET request in bytes. Defaults to 10 MB. */\n rangeSize?: number\n /** Number of concurrent range requests. Defaults to 4. */\n concurrency?: number\n /** SSE-C decryption parameters, required if the file was uploaded with SSE-C. */\n serverSideEncryption?: SseCDownloadKey\n /** Abort signal for cancelling the download. */\n signal?: AbortSignal\n },\n ): ReadableStream<Uint8Array> {\n return createParallelDownloadStream(this.client.raw, this.client.accountInfo, {\n fileId,\n totalSize,\n ...options,\n })\n }\n\n /**\n * Creates a Web `WritableStream` that uploads streamed data into this file\n * using the multipart protocol. Pipe a `ReadableStream<Uint8Array>` into the\n * returned `writable` and await `done` to get the final {@link FileVersion}.\n *\n * Note: streaming uploads do not support resume because the size and per-part\n * hashes are not known in advance. Use {@link upload} with a buffered source\n * when resume is required.\n *\n * @param options - Streaming upload parameters (part size, concurrency, encryption).\n *\n * @returns A handle with the writable sink and a completion promise.\n */\n createWriteStream(options?: B2ObjectWriteStreamOptions): UploadWriteHandle {\n const uploadRetryOptions = mergeUploadRetryOptions(this.uploadRetryOptions, options?.retry)\n return createWriteStream(this.client.raw, this.client.accountInfo, {\n ...(options ?? {}),\n bucketId: this.bucket.id,\n fileName: this.fileName,\n retry: uploadRetryOptions,\n })\n }\n\n /**\n * Retrieves metadata for a specific file version.\n * @param fileId - The file version ID to look up.\n *\n * @returns The file version metadata.\n */\n async getFileInfo(fileId: FileId): Promise<FileVersion> {\n return this.client.raw.getFileInfo(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n { fileId },\n )\n }\n\n /**\n * Hides this file by creating a hide marker at this file name.\n *\n * @returns Metadata for the newly created hide marker.\n */\n async hide(): Promise<FileVersion> {\n return this.bucket.hideFile(this.fileName)\n }\n\n /**\n * Permanently deletes a specific version of this file.\n * @param fileId - The unique identifier of the file version to delete.\n */\n async deleteVersion(fileId: FileId): Promise<void> {\n await this.bucket.deleteFileVersion(this.fileName, fileId)\n }\n\n /**\n * Sets or updates the Object Lock retention policy on a specific file\n * version of this file.\n *\n * The bucket must have Object Lock enabled (`fileLockEnabled: true` at\n * creation time). Governance-mode retention can be shortened or removed\n * by passing `bypassGovernance: true` together with an application key\n * that carries the `bypassGovernance` capability; compliance-mode\n * retention cannot be shortened by anyone until the\n * `retainUntilTimestamp` elapses.\n *\n * @param fileId - The file version to apply the policy to.\n * @param retention - The retention policy to apply.\n * @param options - Optional flag for shortening governance-mode retention.\n *\n * @returns Metadata for the updated file version.\n */\n async setRetention(\n fileId: FileId,\n retention: FileRetentionValue,\n options?: { bypassGovernance?: boolean },\n ) {\n return this.bucket.updateFileRetention(this.fileName, fileId, retention, options)\n }\n\n /**\n * Toggles the legal hold flag on a specific file version of this file.\n *\n * Legal hold is independent of retention: a file can be on legal hold\n * without any retention policy, and vice versa. The bucket must have\n * Object Lock enabled, and any caller must hold the `writeFileLegalHolds`\n * capability.\n *\n * @param fileId - The file version to apply the flag to.\n * @param legalHold - `'on'` to apply the hold, `'off'` to remove it.\n *\n * @returns Metadata for the updated file version.\n */\n async setLegalHold(fileId: FileId, legalHold: LegalHoldValue) {\n return this.bucket.updateFileLegalHold(this.fileName, fileId, legalHold)\n }\n}\n"],"mappings":";;;;;;;;AAuCA,SAAS,+BAA+B,MAAsD;CAC5F,MAAM,WAAW,KAAK;CACtB,IAAI,CAAC,SAAS,0BAA0B,OAAO,EAAE,YAAY,KAAK;CAClE,IAAI,SAAS,UAAU,MAAM,OAAO,EAAE,YAAY,MAAM;CACxD,OAAO;EAAE,WAAW,SAAS,MAAM;EAAkB,YAAY;CAAM;AACzE;AAEA,SAAS,0CACP,MAC2C;CAC3C,MAAM,aAAa,KAAK;CACxB,IAAI,CAAC,WAAW,0BAA0B,OAA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A,wBAAwB,KAAK,oBAAoB,SAAS,KAAK;EAC1F,OAAO,eAAA,kBAAkB,KAAK,OAAO,KAAK,KAAK,OAAO,aAAa;GACjE,GAAI,WAAW,CAAC;GAChB,UAAU,KAAK,OAAO;GACtB,UAAU,KAAK;GACf,OAAO;EACT,CAAC;CACH;;;;;;;CAQA,MAAM,YAAY,QAAsC;EACtD,OAAO,KAAK,OAAO,IAAI,YACrB,KAAK,OAAO,YAAY,UAAU,GAClC,KAAK,OAAO,YAAY,aAAa,GACrC,EAAE,OAAO,CACX;CACF;;;;;;CAOA,MAAM,OAA6B;EACjC,OAAO,KAAK,OAAO,SAAS,KAAK,QAAQ;CAC3C;;;;;CAMA,MAAM,cAAc,QAA+B;EACjD,MAAM,KAAK,OAAO,kBAAkB,KAAK,UAAU,MAAM;CAC3D;;;;;;;;;;;;;;;;;;CAmBA,MAAM,aACJ,QACA,WACA,SACA;EACA,OAAO,KAAK,OAAO,oBAAoB,KAAK,UAAU,QAAQ,WAAW,OAAO;CAClF;;;;;;;;;;;;;;CAeA,MAAM,aAAa,QAAgB,WAA2B;EAC5D,OAAO,KAAK,OAAO,oBAAoB,KAAK,UAAU,QAAQ,SAAS;CACzE;AACF"}
package/dist/object.d.cts CHANGED
@@ -47,13 +47,19 @@ export interface DownloadCallOptions {
47
47
  * will NOT emit a `completePart()` event.
48
48
  */
49
49
  readonly onProgress?: ProgressListener;
50
+ /**
51
+ * Minimum milliseconds between byte-only progress callbacks. Defaults to
52
+ * the SDK's 100 ms progress interval; set to 0 for per-chunk callbacks.
53
+ * The final completion callback is always emitted immediately.
54
+ */
55
+ readonly progressIntervalMillis?: number;
50
56
  }
51
57
  /**
52
58
  * Options accepted by {@link B2Object.head} / {@link Bucket.head}.
53
59
  * Same shape as {@link DownloadCallOptions} minus `method` (always
54
60
  * HEAD) and `onProgress` (no body to track).
55
61
  */
56
- export type HeadCallOptions = Omit<DownloadCallOptions, 'method' | 'onProgress'>;
62
+ export type HeadCallOptions = Omit<DownloadCallOptions, 'method' | 'onProgress' | 'progressIntervalMillis'>;
57
63
  /**
58
64
  * Handle to a specific file (by name) within a B2 bucket.
59
65
  *
@@ -135,15 +141,17 @@ export declare class B2Object {
135
141
  * Creates a parallel-download ReadableStream that fetches the file in concurrent ranged chunks.
136
142
  * @param fileId - The file version ID to download.
137
143
  * @param totalSize - Total file size in bytes (needed to compute range boundaries).
138
- * @param options - Concurrency, range size, and abort signal.
144
+ * @param options - Concurrency, range size, SSE-C decryption, and abort signal.
139
145
  *
140
146
  * @returns A Web ReadableStream of file data in sequential order.
141
147
  */
142
148
  createReadStream(fileId: FileId, totalSize: number, options?: {
143
- /** Size of each ranged GET request in bytes. Defaults to 8 MB. */
149
+ /** Size of each ranged GET request in bytes. Defaults to 10 MB. */
144
150
  rangeSize?: number;
145
151
  /** Number of concurrent range requests. Defaults to 4. */
146
152
  concurrency?: number;
153
+ /** SSE-C decryption parameters, required if the file was uploaded with SSE-C. */
154
+ serverSideEncryption?: SseCDownloadKey;
147
155
  /** Abort signal for cancelling the download. */
148
156
  signal?: AbortSignal;
149
157
  }): ReadableStream<Uint8Array>;
@@ -1 +1 @@
1
- {"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../src/object.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,OAAO,EACL,KAAK,cAAc,EAGnB,KAAK,UAAU,EAGhB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM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