@backblaze-labs/b2-sdk 0.2.0 → 0.3.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 (460) hide show
  1. package/CHANGELOG.md +42 -1
  2. package/README.md +20 -2
  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/backup/client.cjs +206 -0
  7. package/dist/backup/client.cjs.map +1 -0
  8. package/dist/backup/client.d.cts +238 -0
  9. package/dist/backup/client.d.cts.map +1 -0
  10. package/dist/backup/client.d.ts +238 -0
  11. package/dist/backup/client.d.ts.map +1 -0
  12. package/dist/backup/client.js +206 -0
  13. package/dist/backup/client.js.map +1 -0
  14. package/dist/backup/index.cjs +15 -0
  15. package/dist/backup/index.d.cts +22 -0
  16. package/dist/backup/index.d.cts.map +1 -0
  17. package/dist/backup/index.d.ts +22 -0
  18. package/dist/backup/index.d.ts.map +1 -0
  19. package/dist/backup/index.js +7 -0
  20. package/dist/backup/raw.cjs +146 -0
  21. package/dist/backup/raw.cjs.map +1 -0
  22. package/dist/backup/raw.d.cts +122 -0
  23. package/dist/backup/raw.d.cts.map +1 -0
  24. package/dist/backup/raw.d.ts +122 -0
  25. package/dist/backup/raw.d.ts.map +1 -0
  26. package/dist/backup/raw.js +146 -0
  27. package/dist/backup/raw.js.map +1 -0
  28. package/dist/bucket.cjs +2 -1
  29. package/dist/bucket.cjs.map +1 -1
  30. package/dist/bucket.js +2 -1
  31. package/dist/bucket.js.map +1 -1
  32. package/dist/copy/large.cjs +5 -3
  33. package/dist/copy/large.cjs.map +1 -1
  34. package/dist/copy/large.d.cts.map +1 -1
  35. package/dist/copy/large.d.ts.map +1 -1
  36. package/dist/copy/large.js +5 -3
  37. package/dist/copy/large.js.map +1 -1
  38. package/dist/download/checksum.cjs +6 -2
  39. package/dist/download/checksum.cjs.map +1 -1
  40. package/dist/download/checksum.js +6 -2
  41. package/dist/download/checksum.js.map +1 -1
  42. package/dist/download/parallel.cjs +52 -15
  43. package/dist/download/parallel.cjs.map +1 -1
  44. package/dist/download/parallel.d.cts +8 -1
  45. package/dist/download/parallel.d.cts.map +1 -1
  46. package/dist/download/parallel.d.ts +8 -1
  47. package/dist/download/parallel.d.ts.map +1 -1
  48. package/dist/download/parallel.js +52 -15
  49. package/dist/download/parallel.js.map +1 -1
  50. package/dist/download/single.cjs +141 -6
  51. package/dist/download/single.cjs.map +1 -1
  52. package/dist/download/single.d.cts.map +1 -1
  53. package/dist/download/single.d.ts.map +1 -1
  54. package/dist/download/single.js +141 -6
  55. package/dist/download/single.js.map +1 -1
  56. package/dist/errors/index.cjs +173 -3
  57. package/dist/errors/index.cjs.map +1 -1
  58. package/dist/errors/index.d.cts +119 -0
  59. package/dist/errors/index.d.cts.map +1 -1
  60. package/dist/errors/index.d.ts +119 -0
  61. package/dist/errors/index.d.ts.map +1 -1
  62. package/dist/errors/index.js +161 -4
  63. package/dist/errors/index.js.map +1 -1
  64. package/dist/http/retry.cjs +1 -1
  65. package/dist/http/retry.cjs.map +1 -1
  66. package/dist/http/retry.js +1 -1
  67. package/dist/http/retry.js.map +1 -1
  68. package/dist/http/transport.cjs +61 -23
  69. package/dist/http/transport.cjs.map +1 -1
  70. package/dist/http/transport.d.cts +25 -3
  71. package/dist/http/transport.d.cts.map +1 -1
  72. package/dist/http/transport.d.ts +25 -3
  73. package/dist/http/transport.d.ts.map +1 -1
  74. package/dist/http/transport.js +59 -22
  75. package/dist/http/transport.js.map +1 -1
  76. package/dist/index.cjs +25 -2
  77. package/dist/index.d.cts +6 -4
  78. package/dist/index.d.cts.map +1 -1
  79. package/dist/index.d.ts +6 -4
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +8 -6
  82. package/dist/object.cjs +1 -1
  83. package/dist/object.cjs.map +1 -1
  84. package/dist/object.d.cts +4 -2
  85. package/dist/object.d.cts.map +1 -1
  86. package/dist/object.d.ts +4 -2
  87. package/dist/object.d.ts.map +1 -1
  88. package/dist/object.js +1 -1
  89. package/dist/object.js.map +1 -1
  90. package/dist/partner/account-info.d.cts +43 -0
  91. package/dist/partner/account-info.d.cts.map +1 -0
  92. package/dist/partner/account-info.d.ts +43 -0
  93. package/dist/partner/account-info.d.ts.map +1 -0
  94. package/dist/partner/auth-clone.cjs +64 -0
  95. package/dist/partner/auth-clone.cjs.map +1 -0
  96. package/dist/partner/auth-clone.d.cts +27 -0
  97. package/dist/partner/auth-clone.d.cts.map +1 -0
  98. package/dist/partner/auth-clone.d.ts +27 -0
  99. package/dist/partner/auth-clone.d.ts.map +1 -0
  100. package/dist/partner/auth-clone.js +63 -0
  101. package/dist/partner/auth-clone.js.map +1 -0
  102. package/dist/partner/auth-core.cjs +175 -0
  103. package/dist/partner/auth-core.cjs.map +1 -0
  104. package/dist/partner/auth-core.d.cts +111 -0
  105. package/dist/partner/auth-core.d.cts.map +1 -0
  106. package/dist/partner/auth-core.d.ts +111 -0
  107. package/dist/partner/auth-core.d.ts.map +1 -0
  108. package/dist/partner/auth-core.js +175 -0
  109. package/dist/partner/auth-core.js.map +1 -0
  110. package/dist/partner/auth-shape.cjs +36 -0
  111. package/dist/partner/auth-shape.cjs.map +1 -0
  112. package/dist/partner/auth-shape.d.cts +12 -0
  113. package/dist/partner/auth-shape.d.cts.map +1 -0
  114. package/dist/partner/auth-shape.d.ts +12 -0
  115. package/dist/partner/auth-shape.d.ts.map +1 -0
  116. package/dist/partner/auth-shape.js +36 -0
  117. package/dist/partner/auth-shape.js.map +1 -0
  118. package/dist/partner/client.cjs +255 -0
  119. package/dist/partner/client.cjs.map +1 -0
  120. package/dist/partner/client.d.cts +335 -0
  121. package/dist/partner/client.d.cts.map +1 -0
  122. package/dist/partner/client.d.ts +335 -0
  123. package/dist/partner/client.d.ts.map +1 -0
  124. package/dist/partner/client.js +255 -0
  125. package/dist/partner/client.js.map +1 -0
  126. package/dist/partner/endpoint-url.cjs +108 -0
  127. package/dist/partner/endpoint-url.cjs.map +1 -0
  128. package/dist/partner/endpoint-url.d.cts +72 -0
  129. package/dist/partner/endpoint-url.d.cts.map +1 -0
  130. package/dist/partner/endpoint-url.d.ts +72 -0
  131. package/dist/partner/endpoint-url.d.ts.map +1 -0
  132. package/dist/partner/endpoint-url.js +105 -0
  133. package/dist/partner/endpoint-url.js.map +1 -0
  134. package/dist/partner/in-memory.cjs +135 -0
  135. package/dist/partner/in-memory.cjs.map +1 -0
  136. package/dist/partner/in-memory.d.cts +99 -0
  137. package/dist/partner/in-memory.d.cts.map +1 -0
  138. package/dist/partner/in-memory.d.ts +99 -0
  139. package/dist/partner/in-memory.d.ts.map +1 -0
  140. package/dist/partner/in-memory.js +135 -0
  141. package/dist/partner/in-memory.js.map +1 -0
  142. package/dist/partner/index.cjs +18 -0
  143. package/dist/partner/index.d.cts +23 -0
  144. package/dist/partner/index.d.cts.map +1 -0
  145. package/dist/partner/index.d.ts +23 -0
  146. package/dist/partner/index.d.ts.map +1 -0
  147. package/dist/partner/index.js +7 -0
  148. package/dist/partner/raw.cjs +392 -0
  149. package/dist/partner/raw.cjs.map +1 -0
  150. package/dist/partner/raw.d.cts +223 -0
  151. package/dist/partner/raw.d.cts.map +1 -0
  152. package/dist/partner/raw.d.ts +223 -0
  153. package/dist/partner/raw.d.ts.map +1 -0
  154. package/dist/partner/raw.js +390 -0
  155. package/dist/partner/raw.js.map +1 -0
  156. package/dist/partner/redaction-placeholders.cjs +10 -0
  157. package/dist/partner/redaction-placeholders.cjs.map +1 -0
  158. package/dist/partner/redaction-placeholders.d.cts +5 -0
  159. package/dist/partner/redaction-placeholders.d.cts.map +1 -0
  160. package/dist/partner/redaction-placeholders.d.ts +5 -0
  161. package/dist/partner/redaction-placeholders.d.ts.map +1 -0
  162. package/dist/partner/redaction-placeholders.js +9 -0
  163. package/dist/partner/redaction-placeholders.js.map +1 -0
  164. package/dist/partner/redaction.cjs +267 -0
  165. package/dist/partner/redaction.cjs.map +1 -0
  166. package/dist/partner/redaction.d.cts +124 -0
  167. package/dist/partner/redaction.d.cts.map +1 -0
  168. package/dist/partner/redaction.d.ts +124 -0
  169. package/dist/partner/redaction.d.ts.map +1 -0
  170. package/dist/partner/redaction.js +257 -0
  171. package/dist/partner/redaction.js.map +1 -0
  172. package/dist/raw/index.cjs +81 -19
  173. package/dist/raw/index.cjs.map +1 -1
  174. package/dist/raw/index.d.cts +6 -2
  175. package/dist/raw/index.d.cts.map +1 -1
  176. package/dist/raw/index.d.ts +6 -2
  177. package/dist/raw/index.d.ts.map +1 -1
  178. package/dist/raw/index.js +81 -19
  179. package/dist/raw/index.js.map +1 -1
  180. package/dist/raw/url.cjs +111 -0
  181. package/dist/raw/url.cjs.map +1 -0
  182. package/dist/raw/url.d.cts +41 -0
  183. package/dist/raw/url.d.cts.map +1 -0
  184. package/dist/raw/url.d.ts +41 -0
  185. package/dist/raw/url.d.ts.map +1 -0
  186. package/dist/raw/url.js +110 -0
  187. package/dist/raw/url.js.map +1 -0
  188. package/dist/s3/sigv4.cjs +15 -10
  189. package/dist/s3/sigv4.cjs.map +1 -1
  190. package/dist/s3/sigv4.js +15 -10
  191. package/dist/s3/sigv4.js.map +1 -1
  192. package/dist/simulator/index.cjs +1197 -206
  193. package/dist/simulator/index.cjs.map +1 -1
  194. package/dist/simulator/index.d.cts +109 -11
  195. package/dist/simulator/index.d.cts.map +1 -1
  196. package/dist/simulator/index.d.ts +109 -11
  197. package/dist/simulator/index.d.ts.map +1 -1
  198. package/dist/simulator/index.js +1196 -209
  199. package/dist/simulator/index.js.map +1 -1
  200. package/dist/simulator/partner.cjs +719 -0
  201. package/dist/simulator/partner.cjs.map +1 -0
  202. package/dist/simulator/partner.d.cts +183 -0
  203. package/dist/simulator/partner.d.cts.map +1 -0
  204. package/dist/simulator/partner.d.ts +183 -0
  205. package/dist/simulator/partner.d.ts.map +1 -0
  206. package/dist/simulator/partner.js +718 -0
  207. package/dist/simulator/partner.js.map +1 -0
  208. package/dist/simulator/validation.cjs +577 -0
  209. package/dist/simulator/validation.cjs.map +1 -1
  210. package/dist/simulator/validation.d.cts +117 -0
  211. package/dist/simulator/validation.d.cts.map +1 -1
  212. package/dist/simulator/validation.d.ts +117 -0
  213. package/dist/simulator/validation.d.ts.map +1 -1
  214. package/dist/simulator/validation.js +563 -1
  215. package/dist/simulator/validation.js.map +1 -1
  216. package/dist/streams/file-source.cjs +1 -1
  217. package/dist/streams/file-source.cjs.map +1 -1
  218. package/dist/streams/file-source.js +1 -1
  219. package/dist/streams/file-source.js.map +1 -1
  220. package/dist/streams/index.cjs +1 -1
  221. package/dist/streams/index.js +1 -1
  222. package/dist/streams/source.cjs +2 -1
  223. package/dist/streams/source.cjs.map +1 -1
  224. package/dist/streams/source.js +2 -1
  225. package/dist/streams/source.js.map +1 -1
  226. package/dist/sync/b2-sha1-reader.cjs +6 -2
  227. package/dist/sync/b2-sha1-reader.cjs.map +1 -1
  228. package/dist/sync/b2-sha1-reader.d.cts.map +1 -1
  229. package/dist/sync/b2-sha1-reader.d.ts.map +1 -1
  230. package/dist/sync/b2-sha1-reader.js +6 -2
  231. package/dist/sync/b2-sha1-reader.js.map +1 -1
  232. package/dist/sync/download-staging.cjs +11 -10
  233. package/dist/sync/download-staging.cjs.map +1 -1
  234. package/dist/sync/download-staging.d.cts +2 -1
  235. package/dist/sync/download-staging.d.cts.map +1 -1
  236. package/dist/sync/download-staging.d.ts +2 -1
  237. package/dist/sync/download-staging.d.ts.map +1 -1
  238. package/dist/sync/download-staging.js +11 -10
  239. package/dist/sync/download-staging.js.map +1 -1
  240. package/dist/sync/filters.cjs.map +1 -1
  241. package/dist/sync/filters.js.map +1 -1
  242. package/dist/sync/local-file-io.cjs +11 -6
  243. package/dist/sync/local-file-io.cjs.map +1 -1
  244. package/dist/sync/local-file-io.d.cts +1 -0
  245. package/dist/sync/local-file-io.d.cts.map +1 -1
  246. package/dist/sync/local-file-io.d.ts +1 -0
  247. package/dist/sync/local-file-io.d.ts.map +1 -1
  248. package/dist/sync/local-file-io.js +11 -6
  249. package/dist/sync/local-file-io.js.map +1 -1
  250. package/dist/sync/local-sha1.cjs +6 -15
  251. package/dist/sync/local-sha1.cjs.map +1 -1
  252. package/dist/sync/local-sha1.d.cts +0 -8
  253. package/dist/sync/local-sha1.d.cts.map +1 -1
  254. package/dist/sync/local-sha1.d.ts +0 -8
  255. package/dist/sync/local-sha1.d.ts.map +1 -1
  256. package/dist/sync/local-sha1.js +7 -15
  257. package/dist/sync/local-sha1.js.map +1 -1
  258. package/dist/sync/policies/compare.cjs +5 -3
  259. package/dist/sync/policies/compare.cjs.map +1 -1
  260. package/dist/sync/policies/compare.d.cts.map +1 -1
  261. package/dist/sync/policies/compare.d.ts.map +1 -1
  262. package/dist/sync/policies/compare.js +6 -4
  263. package/dist/sync/policies/compare.js.map +1 -1
  264. package/dist/sync/policies/index.cjs +4 -10
  265. package/dist/sync/policies/index.cjs.map +1 -1
  266. package/dist/sync/policies/index.js +4 -10
  267. package/dist/sync/policies/index.js.map +1 -1
  268. package/dist/sync/scanners/b2.cjs +2 -2
  269. package/dist/sync/scanners/b2.cjs.map +1 -1
  270. package/dist/sync/scanners/b2.js +2 -2
  271. package/dist/sync/scanners/b2.js.map +1 -1
  272. package/dist/sync/scanners/local.cjs.map +1 -1
  273. package/dist/sync/scanners/local.js.map +1 -1
  274. package/dist/sync/synchronizer.cjs +3 -2
  275. package/dist/sync/synchronizer.cjs.map +1 -1
  276. package/dist/sync/synchronizer.js +3 -2
  277. package/dist/sync/synchronizer.js.map +1 -1
  278. package/dist/types/auth.cjs +4 -0
  279. package/dist/types/auth.cjs.map +1 -1
  280. package/dist/types/auth.d.cts +4 -0
  281. package/dist/types/auth.d.cts.map +1 -1
  282. package/dist/types/auth.d.ts +4 -0
  283. package/dist/types/auth.d.ts.map +1 -1
  284. package/dist/types/auth.js +4 -0
  285. package/dist/types/auth.js.map +1 -1
  286. package/dist/types/backup.d.cts +80 -0
  287. package/dist/types/backup.d.cts.map +1 -0
  288. package/dist/types/backup.d.ts +80 -0
  289. package/dist/types/backup.d.ts.map +1 -0
  290. package/dist/types/bucket.cjs.map +1 -1
  291. package/dist/types/bucket.d.cts +4 -2
  292. package/dist/types/bucket.d.cts.map +1 -1
  293. package/dist/types/bucket.d.ts +4 -2
  294. package/dist/types/bucket.d.ts.map +1 -1
  295. package/dist/types/bucket.js.map +1 -1
  296. package/dist/types/download.cjs +62 -0
  297. package/dist/types/download.cjs.map +1 -0
  298. package/dist/types/download.d.cts +98 -0
  299. package/dist/types/download.d.cts.map +1 -1
  300. package/dist/types/download.d.ts +98 -0
  301. package/dist/types/download.d.ts.map +1 -1
  302. package/dist/types/download.js +61 -0
  303. package/dist/types/download.js.map +1 -0
  304. package/dist/types/encryption.cjs +58 -229
  305. package/dist/types/encryption.cjs.map +1 -1
  306. package/dist/types/encryption.d.cts +32 -0
  307. package/dist/types/encryption.d.cts.map +1 -1
  308. package/dist/types/encryption.d.ts +32 -0
  309. package/dist/types/encryption.d.ts.map +1 -1
  310. package/dist/types/encryption.js +56 -229
  311. package/dist/types/encryption.js.map +1 -1
  312. package/dist/types/errors.cjs +9 -0
  313. package/dist/types/errors.cjs.map +1 -1
  314. package/dist/types/errors.d.cts +1 -1
  315. package/dist/types/errors.d.cts.map +1 -1
  316. package/dist/types/errors.d.ts +1 -1
  317. package/dist/types/errors.d.ts.map +1 -1
  318. package/dist/types/errors.js +9 -0
  319. package/dist/types/errors.js.map +1 -1
  320. package/dist/types/file.cjs.map +1 -1
  321. package/dist/types/file.d.cts +15 -2
  322. package/dist/types/file.d.cts.map +1 -1
  323. package/dist/types/file.d.ts +15 -2
  324. package/dist/types/file.d.ts.map +1 -1
  325. package/dist/types/file.js.map +1 -1
  326. package/dist/types/ids.cjs +30 -0
  327. package/dist/types/ids.cjs.map +1 -1
  328. package/dist/types/ids.d.cts +32 -0
  329. package/dist/types/ids.d.cts.map +1 -1
  330. package/dist/types/ids.d.ts +32 -0
  331. package/dist/types/ids.d.ts.map +1 -1
  332. package/dist/types/ids.js +28 -1
  333. package/dist/types/ids.js.map +1 -1
  334. package/dist/types/index.d.cts +10 -6
  335. package/dist/types/index.d.cts.map +1 -1
  336. package/dist/types/index.d.ts +10 -6
  337. package/dist/types/index.d.ts.map +1 -1
  338. package/dist/types/lock.cjs.map +1 -1
  339. package/dist/types/lock.d.cts +14 -0
  340. package/dist/types/lock.d.cts.map +1 -1
  341. package/dist/types/lock.d.ts +14 -0
  342. package/dist/types/lock.d.ts.map +1 -1
  343. package/dist/types/lock.js.map +1 -1
  344. package/dist/types/notifications.cjs +1 -1
  345. package/dist/types/notifications.cjs.map +1 -1
  346. package/dist/types/notifications.d.cts +5 -3
  347. package/dist/types/notifications.d.cts.map +1 -1
  348. package/dist/types/notifications.d.ts +5 -3
  349. package/dist/types/notifications.d.ts.map +1 -1
  350. package/dist/types/notifications.js +1 -1
  351. package/dist/types/notifications.js.map +1 -1
  352. package/dist/types/partner.cjs +32 -0
  353. package/dist/types/partner.cjs.map +1 -0
  354. package/dist/types/partner.d.cts +394 -0
  355. package/dist/types/partner.d.cts.map +1 -0
  356. package/dist/types/partner.d.ts +394 -0
  357. package/dist/types/partner.d.ts.map +1 -0
  358. package/dist/types/partner.js +29 -0
  359. package/dist/types/partner.js.map +1 -0
  360. package/dist/types/upload.d.cts +31 -18
  361. package/dist/types/upload.d.cts.map +1 -1
  362. package/dist/types/upload.d.ts +31 -18
  363. package/dist/types/upload.d.ts.map +1 -1
  364. package/dist/upload/abort-scope.cjs +0 -45
  365. package/dist/upload/abort-scope.cjs.map +1 -1
  366. package/dist/upload/abort-scope.d.cts +0 -22
  367. package/dist/upload/abort-scope.d.cts.map +1 -1
  368. package/dist/upload/abort-scope.d.ts +0 -22
  369. package/dist/upload/abort-scope.d.ts.map +1 -1
  370. package/dist/upload/abort-scope.js +1 -44
  371. package/dist/upload/abort-scope.js.map +1 -1
  372. package/dist/upload/finish.cjs +3 -8
  373. package/dist/upload/finish.cjs.map +1 -1
  374. package/dist/upload/finish.d.cts.map +1 -1
  375. package/dist/upload/finish.d.ts.map +1 -1
  376. package/dist/upload/finish.js +1 -6
  377. package/dist/upload/finish.js.map +1 -1
  378. package/dist/upload/large.cjs +5 -1
  379. package/dist/upload/large.cjs.map +1 -1
  380. package/dist/upload/large.d.cts +16 -2
  381. package/dist/upload/large.d.cts.map +1 -1
  382. package/dist/upload/large.d.ts +16 -2
  383. package/dist/upload/large.d.ts.map +1 -1
  384. package/dist/upload/large.js +5 -1
  385. package/dist/upload/large.js.map +1 -1
  386. package/dist/upload/options.cjs.map +1 -1
  387. package/dist/upload/options.d.cts +12 -0
  388. package/dist/upload/options.d.cts.map +1 -1
  389. package/dist/upload/options.d.ts +12 -0
  390. package/dist/upload/options.d.ts.map +1 -1
  391. package/dist/upload/options.js.map +1 -1
  392. package/dist/upload/resume.cjs +2 -1
  393. package/dist/upload/resume.cjs.map +1 -1
  394. package/dist/upload/resume.d.cts +3 -1
  395. package/dist/upload/resume.d.cts.map +1 -1
  396. package/dist/upload/resume.d.ts +3 -1
  397. package/dist/upload/resume.d.ts.map +1 -1
  398. package/dist/upload/resume.js +2 -1
  399. package/dist/upload/resume.js.map +1 -1
  400. package/dist/upload/retry.cjs +8 -3
  401. package/dist/upload/retry.cjs.map +1 -1
  402. package/dist/upload/retry.js +8 -3
  403. package/dist/upload/retry.js.map +1 -1
  404. package/dist/upload/single.cjs +2 -1
  405. package/dist/upload/single.cjs.map +1 -1
  406. package/dist/upload/single.d.cts +6 -0
  407. package/dist/upload/single.d.cts.map +1 -1
  408. package/dist/upload/single.d.ts +6 -0
  409. package/dist/upload/single.d.ts.map +1 -1
  410. package/dist/upload/single.js +2 -1
  411. package/dist/upload/single.js.map +1 -1
  412. package/dist/upload/stream.cjs +6 -4
  413. package/dist/upload/stream.cjs.map +1 -1
  414. package/dist/upload/stream.d.cts +6 -0
  415. package/dist/upload/stream.d.cts.map +1 -1
  416. package/dist/upload/stream.d.ts +6 -0
  417. package/dist/upload/stream.d.ts.map +1 -1
  418. package/dist/upload/stream.js +3 -1
  419. package/dist/upload/stream.js.map +1 -1
  420. package/dist/util/abort.cjs +114 -0
  421. package/dist/util/abort.cjs.map +1 -0
  422. package/dist/util/abort.d.cts +65 -0
  423. package/dist/util/abort.d.cts.map +1 -0
  424. package/dist/util/abort.d.ts +65 -0
  425. package/dist/util/abort.d.ts.map +1 -0
  426. package/dist/util/abort.js +109 -0
  427. package/dist/util/abort.js.map +1 -0
  428. package/dist/util/defaults.cjs +3 -0
  429. package/dist/util/defaults.cjs.map +1 -1
  430. package/dist/util/defaults.d.cts +2 -0
  431. package/dist/util/defaults.d.cts.map +1 -1
  432. package/dist/util/defaults.d.ts +2 -0
  433. package/dist/util/defaults.d.ts.map +1 -1
  434. package/dist/util/defaults.js +3 -1
  435. package/dist/util/defaults.js.map +1 -1
  436. package/dist/util/md5.cjs +211 -0
  437. package/dist/util/md5.cjs.map +1 -0
  438. package/dist/util/md5.d.cts +43 -0
  439. package/dist/util/md5.d.cts.map +1 -0
  440. package/dist/util/md5.d.ts +43 -0
  441. package/dist/util/md5.d.ts.map +1 -0
  442. package/dist/util/md5.js +209 -0
  443. package/dist/util/md5.js.map +1 -0
  444. package/dist/util/normalize.cjs +5 -5
  445. package/dist/util/normalize.cjs.map +1 -1
  446. package/dist/util/normalize.d.cts +7 -7
  447. package/dist/util/normalize.d.cts.map +1 -1
  448. package/dist/util/normalize.d.ts +7 -7
  449. package/dist/util/normalize.d.ts.map +1 -1
  450. package/dist/util/normalize.js +5 -5
  451. package/dist/util/normalize.js.map +1 -1
  452. package/dist/util/paginator.cjs +7 -1
  453. package/dist/util/paginator.cjs.map +1 -1
  454. package/dist/util/paginator.d.cts +3 -1
  455. package/dist/util/paginator.d.cts.map +1 -1
  456. package/dist/util/paginator.d.ts +3 -1
  457. package/dist/util/paginator.d.ts.map +1 -1
  458. package/dist/util/paginator.js +7 -1
  459. package/dist/util/paginator.js.map +1 -1
  460. package/package.json +38 -16
@@ -0,0 +1,238 @@
1
+ import { RetryOptions } from '../http/retry.js';
2
+ import { HttpTransport } from '../http/transport.js';
3
+ import { UrlGuard } from '../http/url-guard.js';
4
+ import { PartnerAccountInfo } from '../partner/account-info.js';
5
+ import { ComputerBackup, DeleteComputerResponse, ListComputersResult } from '../types/backup.js';
6
+ import { AccountId, ComputerId } from '../types/ids.js';
7
+ import { PartnerAuthorizeResponse } from '../types/partner.js';
8
+ import { BackupRawClient } from './raw.js';
9
+ /**
10
+ * Configuration options for creating a {@link BackupClient}.
11
+ *
12
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
13
+ */
14
+ export interface BackupClientOptions {
15
+ /** The Master Application Key ID for the partner administrator account. */
16
+ readonly masterKeyId: string;
17
+ /** The Master Application Key secret. */
18
+ readonly masterKey: string;
19
+ /**
20
+ * B2 realm to authenticate against. Accepts a known realm-map key
21
+ * (`"production"` or `"staging"`) or a direct base URL. Custom HTTPS hosts
22
+ * and loopback IP literal HTTP URLs for local testing are trusted with the
23
+ * Master Application Key during Partner authorize, so never derive `realm`
24
+ * from untrusted input. Defaults to `"production"`.
25
+ */
26
+ readonly realm?: string;
27
+ /**
28
+ * Shared Partner authorization state. Defaults to
29
+ * {@link InMemoryPartnerAccountInfo}. Pass the same store to
30
+ * {@link BackupClient} and Partner clients when both surfaces should reuse
31
+ * one Partner token. Cached authorization whose endpoints fail this client's
32
+ * realm policy is ignored locally until `authorize()` replaces it; shared
33
+ * stores are not cleared during construction.
34
+ */
35
+ readonly partnerAccountInfo?: PartnerAccountInfo;
36
+ /** Custom HTTP transport. Defaults to `FetchTransport`. Wrapped by `RetryTransport`. */
37
+ readonly transport?: HttpTransport;
38
+ /** Override retry behavior (max retries, backoff, and per-attempt timeout). */
39
+ readonly retry?: Partial<RetryOptions>;
40
+ /** Custom user-agent string prepended to the SDK default. */
41
+ readonly userAgent?: string;
42
+ /**
43
+ * Additional SSRF allow-list host suffixes for the default transport.
44
+ *
45
+ * Only consulted when {@link BackupClientOptions.transport} is unset; a
46
+ * custom transport is the user's responsibility to harden.
47
+ */
48
+ readonly additionalAllowedHostSuffixes?: readonly string[];
49
+ /**
50
+ * Explicitly disable the default SSRF guard after authorize.
51
+ *
52
+ * Intended only for controlled simulator/private-proxy tests. Never enable
53
+ * it for URLs derived from untrusted input or production credentials.
54
+ */
55
+ readonly disableSsrfGuard?: boolean;
56
+ /**
57
+ * Follow same-origin GET/HEAD redirects in the default fetch transport after
58
+ * checking each target with the SSRF guard. POST redirects remain blocked.
59
+ * Defaults to true.
60
+ */
61
+ readonly followSameOriginRedirects?: boolean;
62
+ /**
63
+ * Allow direct custom authorize realms for tests or private proxies.
64
+ * Leave disabled unless the configured host is trusted with the Master
65
+ * Application Key.
66
+ */
67
+ readonly allowCustomAuthorizeRealm?: boolean;
68
+ }
69
+ /**
70
+ * Options for Partner authorization performed by {@link BackupClient}.
71
+ *
72
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
73
+ */
74
+ export interface BackupAuthorizeOptions {
75
+ /** Abort signal for cancelling the authorize request. */
76
+ readonly signal?: AbortSignal;
77
+ }
78
+ /**
79
+ * Options for listing Computer Backup records.
80
+ *
81
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
82
+ */
83
+ export interface ListComputersOptions {
84
+ /**
85
+ * Account whose active computer backups should be listed. Defaults to the
86
+ * partner administrator account ID from authorization.
87
+ */
88
+ readonly accountId?: AccountId;
89
+ /** Computer ID to start listing from for pagination. */
90
+ readonly startComputerId?: ComputerId;
91
+ /** Maximum computers to return in this page. Forwarded to `maxComputerCount`. */
92
+ readonly pageSize?: number;
93
+ /** Abort signal for cancelling the request. */
94
+ readonly signal?: AbortSignal;
95
+ }
96
+ /**
97
+ * Options for paginating Computer Backup records.
98
+ *
99
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
100
+ */
101
+ export interface PaginateComputersOptions extends Omit<ListComputersOptions, 'startComputerId'> {
102
+ /**
103
+ * Aborts the iteration between page fetches. The signal is also forwarded to
104
+ * each underlying list request.
105
+ */
106
+ readonly signal?: AbortSignal;
107
+ }
108
+ /**
109
+ * Options for deleting a Computer Backup record.
110
+ *
111
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
112
+ */
113
+ export interface DeleteComputerOptions {
114
+ /**
115
+ * Account that owns the computer backup. Defaults to the partner
116
+ * administrator account ID from authorization.
117
+ */
118
+ readonly accountId?: AccountId;
119
+ /** Computer ID of the backup to delete. */
120
+ readonly computerId: ComputerId;
121
+ /** Abort signal for cancelling the request. */
122
+ readonly signal?: AbortSignal;
123
+ }
124
+ /** Redacted JSON diagnostic shape emitted by {@link BackupClient.toJSON}. */
125
+ export interface BackupClientJson {
126
+ /** Object kind for log consumers. */
127
+ readonly type: 'BackupClient';
128
+ /** Redacted Master Application Key credential placeholder. */
129
+ readonly credentials: string;
130
+ /** Redacted Partner token placeholder, or unauthorized state. */
131
+ readonly authorization: string;
132
+ /** Whether this client currently has Partner authorization state. */
133
+ readonly authorized: boolean;
134
+ /** Current default URL guard suffixes, or null when a custom transport owns guarding. */
135
+ readonly urlGuardAllowedSuffixes: readonly string[] | null;
136
+ }
137
+ /**
138
+ * High-level Computer Backup API client for listing and deleting backup records.
139
+ *
140
+ * The client uses Partner authorization and the `backupApiUrl` returned by
141
+ * `authorizePartner`. The target account must belong to a group with
142
+ * Enterprise Controls enabled, and the caller must be a group admin. Deleting
143
+ * a backup also requires the Enterprise Controls setting that permits admins
144
+ * to delete member backups.
145
+ *
146
+ * @example
147
+ * ```ts
148
+ * const backup = new BackupClient({
149
+ * masterKeyId: process.env.B2_MASTER_KEY_ID,
150
+ * masterKey: process.env.B2_MASTER_KEY,
151
+ * })
152
+ * await backup.authorize()
153
+ * for await (const computer of backup.paginateComputers()) {
154
+ * console.log(computer.computerName)
155
+ * }
156
+ * ```
157
+ *
158
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
159
+ */
160
+ export declare class BackupClient {
161
+ /** Low-level client for direct Computer Backup API calls. */
162
+ readonly raw: BackupRawClient;
163
+ /** Partner authorization state storage (tokens, URLs, capabilities). */
164
+ readonly partnerAccountInfo: PartnerAccountInfo;
165
+ /**
166
+ * SSRF allow-list applied by the default transport. `null` when
167
+ * a custom transport was supplied; in that case the SDK does not own the
168
+ * guard.
169
+ */
170
+ readonly urlGuard: UrlGuard | null;
171
+ private readonly authCore;
172
+ /**
173
+ * Creates a new BackupClient. Call {@link authorize} before making API requests
174
+ * unless `partnerAccountInfo` already contains valid Partner authorization.
175
+ *
176
+ * @param options - Configuration including credentials, realm, and transport settings.
177
+ */
178
+ constructor(options: BackupClientOptions);
179
+ /**
180
+ * Authenticates with B2 Partner authorization and stores the authorization state.
181
+ *
182
+ * @param options - Optional abort signal.
183
+ *
184
+ * @returns The Partner authorization response containing tokens, URLs, and capabilities.
185
+ *
186
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
187
+ */
188
+ authorize(options?: BackupAuthorizeOptions): Promise<PartnerAuthorizeResponse>;
189
+ /**
190
+ * Lists active Computer Backup records for an account.
191
+ *
192
+ * @param options - Optional target account and pagination settings.
193
+ *
194
+ * @returns A normalized page of computer backup records with an optional continuation cursor.
195
+ *
196
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
197
+ */
198
+ listComputers(options?: ListComputersOptions): Promise<ListComputersResult>;
199
+ /**
200
+ * Async iterator that yields every active Computer Backup record for an account.
201
+ *
202
+ * @param options - Optional target account, page size, and abort signal.
203
+ *
204
+ * @returns An async iterable of {@link ComputerBackup} entries.
205
+ *
206
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
207
+ */
208
+ paginateComputers(options?: PaginateComputersOptions): AsyncIterableIterator<ComputerBackup>;
209
+ /**
210
+ * Deletes a Computer Backup record.
211
+ *
212
+ * This destructive mutation is not automatically retried or reauthorized in
213
+ * place; callers should reconcile backup state before issuing a new delete
214
+ * after an ambiguous failure.
215
+ *
216
+ * @param options - Target account, computer ID, and optional abort signal.
217
+ *
218
+ * @returns The deleted computer backup record array.
219
+ *
220
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
221
+ */
222
+ deleteComputer(options: DeleteComputerOptions): Promise<DeleteComputerResponse>;
223
+ private ensureBackupAuthorization;
224
+ private backupCoordinates;
225
+ /**
226
+ * Hides credentials and Partner tokens from `JSON.stringify(client)`.
227
+ *
228
+ * @returns A redacted diagnostic object.
229
+ */
230
+ toJSON(): BackupClientJson;
231
+ /**
232
+ * Hides credentials and Partner tokens from default stringification.
233
+ *
234
+ * @returns A short redacted label.
235
+ */
236
+ toString(): string;
237
+ }
238
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/backup/client.js"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAGpE,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EAEtB,mBAAmB,EACpB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAiC,MAAM,iBAAiB,CAAA;AAChG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAI1C;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,yCAAyC;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB;;;;;;;OAOG;IACH,Q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AC;IAcrF,OAAO,CAAC,yBAAyB;IAUjC,OAAO,CAAC,iBAAiB;IAiBzB;;;;OAIG;IACH,MAAM,IAAI,gBAAgB;IAW1B;;;;OAIG;IACH,QAAQ,IAAI,MAAM;CAYnB"}
@@ -0,0 +1,238 @@
1
+ import { RetryOptions } from '../http/retry.js';
2
+ import { HttpTransport } from '../http/transport.js';
3
+ import { UrlGuard } from '../http/url-guard.js';
4
+ import { PartnerAccountInfo } from '../partner/account-info.js';
5
+ import { ComputerBackup, DeleteComputerResponse, ListComputersResult } from '../types/backup.js';
6
+ import { AccountId, ComputerId } from '../types/ids.js';
7
+ import { PartnerAuthorizeResponse } from '../types/partner.js';
8
+ import { BackupRawClient } from './raw.js';
9
+ /**
10
+ * Configuration options for creating a {@link BackupClient}.
11
+ *
12
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
13
+ */
14
+ export interface BackupClientOptions {
15
+ /** The Master Application Key ID for the partner administrator account. */
16
+ readonly masterKeyId: string;
17
+ /** The Master Application Key secret. */
18
+ readonly masterKey: string;
19
+ /**
20
+ * B2 realm to authenticate against. Accepts a known realm-map key
21
+ * (`"production"` or `"staging"`) or a direct base URL. Custom HTTPS hosts
22
+ * and loopback IP literal HTTP URLs for local testing are trusted with the
23
+ * Master Application Key during Partner authorize, so never derive `realm`
24
+ * from untrusted input. Defaults to `"production"`.
25
+ */
26
+ readonly realm?: string;
27
+ /**
28
+ * Shared Partner authorization state. Defaults to
29
+ * {@link InMemoryPartnerAccountInfo}. Pass the same store to
30
+ * {@link BackupClient} and Partner clients when both surfaces should reuse
31
+ * one Partner token. Cached authorization whose endpoints fail this client's
32
+ * realm policy is ignored locally until `authorize()` replaces it; shared
33
+ * stores are not cleared during construction.
34
+ */
35
+ readonly partnerAccountInfo?: PartnerAccountInfo;
36
+ /** Custom HTTP transport. Defaults to `FetchTransport`. Wrapped by `RetryTransport`. */
37
+ readonly transport?: HttpTransport;
38
+ /** Override retry behavior (max retries, backoff, and per-attempt timeout). */
39
+ readonly retry?: Partial<RetryOptions>;
40
+ /** Custom user-agent string prepended to the SDK default. */
41
+ readonly userAgent?: string;
42
+ /**
43
+ * Additional SSRF allow-list host suffixes for the default transport.
44
+ *
45
+ * Only consulted when {@link BackupClientOptions.transport} is unset; a
46
+ * custom transport is the user's responsibility to harden.
47
+ */
48
+ readonly additionalAllowedHostSuffixes?: readonly string[];
49
+ /**
50
+ * Explicitly disable the default SSRF guard after authorize.
51
+ *
52
+ * Intended only for controlled simulator/private-proxy tests. Never enable
53
+ * it for URLs derived from untrusted input or production credentials.
54
+ */
55
+ readonly disableSsrfGuard?: boolean;
56
+ /**
57
+ * Follow same-origin GET/HEAD redirects in the default fetch transport after
58
+ * checking each target with the SSRF guard. POST redirects remain blocked.
59
+ * Defaults to true.
60
+ */
61
+ readonly followSameOriginRedirects?: boolean;
62
+ /**
63
+ * Allow direct custom authorize realms for tests or private proxies.
64
+ * Leave disabled unless the configured host is trusted with the Master
65
+ * Application Key.
66
+ */
67
+ readonly allowCustomAuthorizeRealm?: boolean;
68
+ }
69
+ /**
70
+ * Options for Partner authorization performed by {@link BackupClient}.
71
+ *
72
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
73
+ */
74
+ export interface BackupAuthorizeOptions {
75
+ /** Abort signal for cancelling the authorize request. */
76
+ readonly signal?: AbortSignal;
77
+ }
78
+ /**
79
+ * Options for listing Computer Backup records.
80
+ *
81
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
82
+ */
83
+ export interface ListComputersOptions {
84
+ /**
85
+ * Account whose active computer backups should be listed. Defaults to the
86
+ * partner administrator account ID from authorization.
87
+ */
88
+ readonly accountId?: AccountId;
89
+ /** Computer ID to start listing from for pagination. */
90
+ readonly startComputerId?: ComputerId;
91
+ /** Maximum computers to return in this page. Forwarded to `maxComputerCount`. */
92
+ readonly pageSize?: number;
93
+ /** Abort signal for cancelling the request. */
94
+ readonly signal?: AbortSignal;
95
+ }
96
+ /**
97
+ * Options for paginating Computer Backup records.
98
+ *
99
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
100
+ */
101
+ export interface PaginateComputersOptions extends Omit<ListComputersOptions, 'startComputerId'> {
102
+ /**
103
+ * Aborts the iteration between page fetches. The signal is also forwarded to
104
+ * each underlying list request.
105
+ */
106
+ readonly signal?: AbortSignal;
107
+ }
108
+ /**
109
+ * Options for deleting a Computer Backup record.
110
+ *
111
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
112
+ */
113
+ export interface DeleteComputerOptions {
114
+ /**
115
+ * Account that owns the computer backup. Defaults to the partner
116
+ * administrator account ID from authorization.
117
+ */
118
+ readonly accountId?: AccountId;
119
+ /** Computer ID of the backup to delete. */
120
+ readonly computerId: ComputerId;
121
+ /** Abort signal for cancelling the request. */
122
+ readonly signal?: AbortSignal;
123
+ }
124
+ /** Redacted JSON diagnostic shape emitted by {@link BackupClient.toJSON}. */
125
+ export interface BackupClientJson {
126
+ /** Object kind for log consumers. */
127
+ readonly type: 'BackupClient';
128
+ /** Redacted Master Application Key credential placeholder. */
129
+ readonly credentials: string;
130
+ /** Redacted Partner token placeholder, or unauthorized state. */
131
+ readonly authorization: string;
132
+ /** Whether this client currently has Partner authorization state. */
133
+ readonly authorized: boolean;
134
+ /** Current default URL guard suffixes, or null when a custom transport owns guarding. */
135
+ readonly urlGuardAllowedSuffixes: readonly string[] | null;
136
+ }
137
+ /**
138
+ * High-level Computer Backup API client for listing and deleting backup records.
139
+ *
140
+ * The client uses Partner authorization and the `backupApiUrl` returned by
141
+ * `authorizePartner`. The target account must belong to a group with
142
+ * Enterprise Controls enabled, and the caller must be a group admin. Deleting
143
+ * a backup also requires the Enterprise Controls setting that permits admins
144
+ * to delete member backups.
145
+ *
146
+ * @example
147
+ * ```ts
148
+ * const backup = new BackupClient({
149
+ * masterKeyId: process.env.B2_MASTER_KEY_ID,
150
+ * masterKey: process.env.B2_MASTER_KEY,
151
+ * })
152
+ * await backup.authorize()
153
+ * for await (const computer of backup.paginateComputers()) {
154
+ * console.log(computer.computerName)
155
+ * }
156
+ * ```
157
+ *
158
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
159
+ */
160
+ export declare class BackupClient {
161
+ /** Low-level client for direct Computer Backup API calls. */
162
+ readonly raw: BackupRawClient;
163
+ /** Partner authorization state storage (tokens, URLs, capabilities). */
164
+ readonly partnerAccountInfo: PartnerAccountInfo;
165
+ /**
166
+ * SSRF allow-list applied by the default transport. `null` when
167
+ * a custom transport was supplied; in that case the SDK does not own the
168
+ * guard.
169
+ */
170
+ readonly urlGuard: UrlGuard | null;
171
+ private readonly authCore;
172
+ /**
173
+ * Creates a new BackupClient. Call {@link authorize} before making API requests
174
+ * unless `partnerAccountInfo` already contains valid Partner authorization.
175
+ *
176
+ * @param options - Configuration including credentials, realm, and transport settings.
177
+ */
178
+ constructor(options: BackupClientOptions);
179
+ /**
180
+ * Authenticates with B2 Partner authorization and stores the authorization state.
181
+ *
182
+ * @param options - Optional abort signal.
183
+ *
184
+ * @returns The Partner authorization response containing tokens, URLs, and capabilities.
185
+ *
186
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
187
+ */
188
+ authorize(options?: BackupAuthorizeOptions): Promise<PartnerAuthorizeResponse>;
189
+ /**
190
+ * Lists active Computer Backup records for an account.
191
+ *
192
+ * @param options - Optional target account and pagination settings.
193
+ *
194
+ * @returns A normalized page of computer backup records with an optional continuation cursor.
195
+ *
196
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
197
+ */
198
+ listComputers(options?: ListComputersOptions): Promise<ListComputersResult>;
199
+ /**
200
+ * Async iterator that yields every active Computer Backup record for an account.
201
+ *
202
+ * @param options - Optional target account, page size, and abort signal.
203
+ *
204
+ * @returns An async iterable of {@link ComputerBackup} entries.
205
+ *
206
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
207
+ */
208
+ paginateComputers(options?: PaginateComputersOptions): AsyncIterableIterator<ComputerBackup>;
209
+ /**
210
+ * Deletes a Computer Backup record.
211
+ *
212
+ * This destructive mutation is not automatically retried or reauthorized in
213
+ * place; callers should reconcile backup state before issuing a new delete
214
+ * after an ambiguous failure.
215
+ *
216
+ * @param options - Target account, computer ID, and optional abort signal.
217
+ *
218
+ * @returns The deleted computer backup record array.
219
+ *
220
+ * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
221
+ */
222
+ deleteComputer(options: DeleteComputerOptions): Promise<DeleteComputerResponse>;
223
+ private ensureBackupAuthorization;
224
+ private backupCoordinates;
225
+ /**
226
+ * Hides credentials and Partner tokens from `JSON.stringify(client)`.
227
+ *
228
+ * @returns A redacted diagnostic object.
229
+ */
230
+ toJSON(): BackupClientJson;
231
+ /**
232
+ * Hides credentials and Partner tokens from default stringification.
233
+ *
234
+ * @returns A short redacted label.
235
+ */
236
+ toString(): string;
237
+ }
238
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/backup/client.js"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAGpE,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EAEtB,mBAAmB,EACpB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAiC,MAAM,iBAAiB,CAAA;AAChG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAI1C;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,EA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