@backblaze-labs/b2-sdk 0.1.0 → 0.2.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.
- package/CHANGELOG.md +110 -5
- package/README.md +144 -33
- package/dist/_virtual/_b2-sdk-version-json.cjs +4 -0
- package/dist/_virtual/_b2-sdk-version-json.js +4 -0
- package/dist/auth/account-info.d.cts +32 -0
- package/dist/auth/account-info.d.cts.map +1 -1
- package/dist/auth/account-info.d.ts +32 -0
- package/dist/auth/account-info.d.ts.map +1 -1
- package/dist/auth/file.cjs +408 -207
- package/dist/auth/file.cjs.map +1 -1
- package/dist/auth/file.d.cts +77 -3
- package/dist/auth/file.d.cts.map +1 -1
- package/dist/auth/file.d.ts +77 -3
- package/dist/auth/file.d.ts.map +1 -1
- package/dist/auth/file.js +407 -207
- package/dist/auth/file.js.map +1 -1
- package/dist/auth/in-memory.cjs +212 -183
- package/dist/auth/in-memory.cjs.map +1 -1
- package/dist/auth/in-memory.d.cts +8 -0
- package/dist/auth/in-memory.d.cts.map +1 -1
- package/dist/auth/in-memory.d.ts +8 -0
- package/dist/auth/in-memory.d.ts.map +1 -1
- package/dist/auth/in-memory.js +211 -182
- package/dist/auth/in-memory.js.map +1 -1
- package/dist/auth/index.cjs +7 -9
- package/dist/auth/index.d.cts +3 -2
- package/dist/auth/index.d.cts.map +1 -1
- package/dist/auth/index.d.ts +3 -2
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +2 -8
- package/dist/auth/realms.cjs +80 -7
- package/dist/auth/realms.cjs.map +1 -1
- package/dist/auth/realms.d.cts +27 -4
- package/dist/auth/realms.d.cts.map +1 -1
- package/dist/auth/realms.d.ts +27 -4
- package/dist/auth/realms.d.ts.map +1 -1
- package/dist/auth/realms.js +80 -9
- package/dist/auth/realms.js.map +1 -1
- package/dist/auth/upload-url-pool.cjs +55 -51
- package/dist/auth/upload-url-pool.cjs.map +1 -1
- package/dist/auth/upload-url-pool.js +55 -51
- package/dist/auth/upload-url-pool.js.map +1 -1
- package/dist/bucket.cjs +785 -787
- package/dist/bucket.cjs.map +1 -1
- package/dist/bucket.d.cts +35 -47
- package/dist/bucket.d.cts.map +1 -1
- package/dist/bucket.d.ts +35 -47
- package/dist/bucket.d.ts.map +1 -1
- package/dist/bucket.js +780 -782
- package/dist/bucket.js.map +1 -1
- package/dist/client.cjs +246 -228
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +25 -17
- package/dist/client.d.cts.map +1 -1
- package/dist/client.d.ts +25 -17
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +243 -225
- package/dist/client.js.map +1 -1
- package/dist/copy/large.cjs +114 -71
- package/dist/copy/large.cjs.map +1 -1
- package/dist/copy/large.d.cts +6 -0
- package/dist/copy/large.d.cts.map +1 -1
- package/dist/copy/large.d.ts +6 -0
- package/dist/copy/large.d.ts.map +1 -1
- package/dist/copy/large.js +112 -69
- package/dist/copy/large.js.map +1 -1
- package/dist/download/checksum.cjs +89 -0
- package/dist/download/checksum.cjs.map +1 -0
- package/dist/download/checksum.d.cts +40 -0
- package/dist/download/checksum.d.cts.map +1 -0
- package/dist/download/checksum.d.ts +40 -0
- package/dist/download/checksum.d.ts.map +1 -0
- package/dist/download/checksum.js +87 -0
- package/dist/download/checksum.js.map +1 -0
- package/dist/download/parallel.cjs +214 -118
- package/dist/download/parallel.cjs.map +1 -1
- package/dist/download/parallel.d.cts +5 -1
- package/dist/download/parallel.d.cts.map +1 -1
- package/dist/download/parallel.d.ts +5 -1
- package/dist/download/parallel.d.ts.map +1 -1
- package/dist/download/parallel.js +212 -116
- package/dist/download/parallel.js.map +1 -1
- package/dist/download/single.cjs +188 -97
- package/dist/download/single.cjs.map +1 -1
- package/dist/download/single.d.cts +6 -1
- package/dist/download/single.d.cts.map +1 -1
- package/dist/download/single.d.ts +6 -1
- package/dist/download/single.d.ts.map +1 -1
- package/dist/download/single.js +186 -98
- package/dist/download/single.js.map +1 -1
- package/dist/errors/index.cjs +699 -243
- package/dist/errors/index.cjs.map +1 -1
- package/dist/errors/index.d.cts +285 -82
- package/dist/errors/index.d.cts.map +1 -1
- package/dist/errors/index.d.ts +285 -82
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +678 -261
- package/dist/errors/index.js.map +1 -1
- package/dist/http/retry.cjs +45 -28
- package/dist/http/retry.cjs.map +1 -1
- package/dist/http/retry.d.cts +15 -2
- package/dist/http/retry.d.cts.map +1 -1
- package/dist/http/retry.d.ts +15 -2
- package/dist/http/retry.d.ts.map +1 -1
- package/dist/http/retry.js +46 -31
- package/dist/http/retry.js.map +1 -1
- package/dist/http/transport.cjs +438 -140
- package/dist/http/transport.cjs.map +1 -1
- package/dist/http/transport.d.cts +21 -2
- package/dist/http/transport.d.cts.map +1 -1
- package/dist/http/transport.d.ts +21 -2
- package/dist/http/transport.d.ts.map +1 -1
- package/dist/http/transport.js +437 -140
- package/dist/http/transport.js.map +1 -1
- package/dist/http/url-guard.cjs +154 -89
- package/dist/http/url-guard.cjs.map +1 -1
- package/dist/http/url-guard.d.cts +25 -3
- package/dist/http/url-guard.d.cts.map +1 -1
- package/dist/http/url-guard.d.ts +25 -3
- package/dist/http/url-guard.d.ts.map +1 -1
- package/dist/http/url-guard.js +152 -90
- package/dist/http/url-guard.js.map +1 -1
- package/dist/http/user-agent.cjs +84 -44
- package/dist/http/user-agent.cjs.map +1 -1
- package/dist/http/user-agent.js +84 -46
- package/dist/http/user-agent.js.map +1 -1
- package/dist/index.cjs +101 -77
- package/dist/index.d.cts +27 -21
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +27 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -71
- package/dist/internal/b2-naming.cjs +66 -0
- package/dist/internal/b2-naming.cjs.map +1 -0
- package/dist/internal/b2-naming.d.cts +43 -0
- package/dist/internal/b2-naming.d.cts.map +1 -0
- package/dist/internal/b2-naming.d.ts +43 -0
- package/dist/internal/b2-naming.d.ts.map +1 -0
- package/dist/internal/b2-naming.js +60 -0
- package/dist/internal/b2-naming.js.map +1 -0
- package/dist/internal/upload-retry-options.cjs +21 -0
- package/dist/internal/upload-retry-options.cjs.map +1 -0
- package/dist/internal/upload-retry-options.d.cts +12 -0
- package/dist/internal/upload-retry-options.d.cts.map +1 -0
- package/dist/internal/upload-retry-options.d.ts +12 -0
- package/dist/internal/upload-retry-options.d.ts.map +1 -0
- package/dist/internal/upload-retry-options.js +21 -0
- package/dist/internal/upload-retry-options.js.map +1 -0
- package/dist/internal/url-redaction.cjs +31 -0
- package/dist/internal/url-redaction.cjs.map +1 -0
- package/dist/internal/url-redaction.d.cts +17 -0
- package/dist/internal/url-redaction.d.cts.map +1 -0
- package/dist/internal/url-redaction.d.ts +17 -0
- package/dist/internal/url-redaction.d.ts.map +1 -0
- package/dist/internal/url-redaction.js +31 -0
- package/dist/internal/url-redaction.js.map +1 -0
- package/dist/notifications/index.cjs +4 -6
- package/dist/notifications/index.d.cts +1 -1
- package/dist/notifications/index.d.cts.map +1 -1
- package/dist/notifications/index.d.ts +1 -1
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/index.js +1 -6
- package/dist/notifications/webhook.cjs +195 -85
- package/dist/notifications/webhook.cjs.map +1 -1
- package/dist/notifications/webhook.d.cts.map +1 -1
- package/dist/notifications/webhook.d.ts.map +1 -1
- package/dist/notifications/webhook.js +195 -87
- package/dist/notifications/webhook.js.map +1 -1
- package/dist/object.cjs +253 -210
- package/dist/object.cjs.map +1 -1
- package/dist/object.d.cts +9 -55
- package/dist/object.d.cts.map +1 -1
- package/dist/object.d.ts +9 -55
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +249 -206
- package/dist/object.js.map +1 -1
- package/dist/raw/encoding.cjs +74 -35
- package/dist/raw/encoding.cjs.map +1 -1
- package/dist/raw/encoding.js +74 -38
- package/dist/raw/encoding.js.map +1 -1
- package/dist/raw/index.cjs +678 -587
- package/dist/raw/index.cjs.map +1 -1
- package/dist/raw/index.d.cts +121 -18
- package/dist/raw/index.d.cts.map +1 -1
- package/dist/raw/index.d.ts +121 -18
- package/dist/raw/index.d.ts.map +1 -1
- package/dist/raw/index.js +674 -589
- package/dist/raw/index.js.map +1 -1
- package/dist/s3/index.cjs +355 -18
- package/dist/s3/index.cjs.map +1 -1
- package/dist/s3/index.d.cts +233 -5
- package/dist/s3/index.d.cts.map +1 -1
- package/dist/s3/index.d.ts +233 -5
- package/dist/s3/index.d.ts.map +1 -1
- package/dist/s3/index.js +351 -22
- package/dist/s3/index.js.map +1 -1
- package/dist/s3/sigv4.cjs +149 -0
- package/dist/s3/sigv4.cjs.map +1 -0
- package/dist/s3/sigv4.d.cts +43 -0
- package/dist/s3/sigv4.d.cts.map +1 -0
- package/dist/s3/sigv4.d.ts +43 -0
- package/dist/s3/sigv4.d.ts.map +1 -0
- package/dist/s3/sigv4.js +148 -0
- package/dist/s3/sigv4.js.map +1 -0
- package/dist/s3/validation.cjs +69 -0
- package/dist/s3/validation.cjs.map +1 -0
- package/dist/s3/validation.d.cts +43 -0
- package/dist/s3/validation.d.cts.map +1 -0
- package/dist/s3/validation.d.ts +43 -0
- package/dist/s3/validation.d.ts.map +1 -0
- package/dist/s3/validation.js +66 -0
- package/dist/s3/validation.js.map +1 -0
- package/dist/simulator/capabilities.cjs +63 -48
- package/dist/simulator/capabilities.cjs.map +1 -1
- package/dist/simulator/capabilities.js +63 -49
- package/dist/simulator/capabilities.js.map +1 -1
- package/dist/simulator/index.cjs +2124 -1548
- package/dist/simulator/index.cjs.map +1 -1
- package/dist/simulator/index.d.cts +79 -11
- package/dist/simulator/index.d.cts.map +1 -1
- package/dist/simulator/index.d.ts +79 -11
- package/dist/simulator/index.d.ts.map +1 -1
- package/dist/simulator/index.js +2112 -1546
- package/dist/simulator/index.js.map +1 -1
- package/dist/simulator/validation.cjs +191 -153
- package/dist/simulator/validation.cjs.map +1 -1
- package/dist/simulator/validation.d.cts +3 -21
- package/dist/simulator/validation.d.cts.map +1 -1
- package/dist/simulator/validation.d.ts +3 -21
- package/dist/simulator/validation.d.ts.map +1 -1
- package/dist/simulator/validation.js +188 -162
- package/dist/simulator/validation.js.map +1 -1
- package/dist/streams/collect.cjs +74 -24
- package/dist/streams/collect.cjs.map +1 -1
- package/dist/streams/collect.d.cts +14 -1
- package/dist/streams/collect.d.cts.map +1 -1
- package/dist/streams/collect.d.ts +14 -1
- package/dist/streams/collect.d.ts.map +1 -1
- package/dist/streams/collect.js +74 -25
- package/dist/streams/collect.js.map +1 -1
- package/dist/streams/file-source.cjs +287 -0
- package/dist/streams/file-source.cjs.map +1 -0
- package/dist/streams/file-source.d.cts +96 -0
- package/dist/streams/file-source.d.cts.map +1 -0
- package/dist/streams/file-source.d.ts +96 -0
- package/dist/streams/file-source.d.ts.map +1 -0
- package/dist/streams/file-source.js +286 -0
- package/dist/streams/file-source.js.map +1 -0
- package/dist/streams/hash.cjs +207 -115
- package/dist/streams/hash.cjs.map +1 -1
- package/dist/streams/hash.d.cts +5 -4
- package/dist/streams/hash.d.cts.map +1 -1
- package/dist/streams/hash.d.ts +5 -4
- package/dist/streams/hash.d.ts.map +1 -1
- package/dist/streams/hash.js +208 -95
- package/dist/streams/hash.js.map +1 -1
- package/dist/streams/index.cjs +12 -12
- package/dist/streams/index.d.cts +3 -3
- package/dist/streams/index.d.cts.map +1 -1
- package/dist/streams/index.d.ts +3 -3
- package/dist/streams/index.d.ts.map +1 -1
- package/dist/streams/index.js +2 -10
- package/dist/streams/progress.cjs +60 -46
- package/dist/streams/progress.cjs.map +1 -1
- package/dist/streams/progress.js +60 -46
- package/dist/streams/progress.js.map +1 -1
- package/dist/streams/source.cjs +316 -146
- package/dist/streams/source.cjs.map +1 -1
- package/dist/streams/source.d.cts +56 -18
- package/dist/streams/source.d.cts.map +1 -1
- package/dist/streams/source.d.ts +56 -18
- package/dist/streams/source.d.ts.map +1 -1
- package/dist/streams/source.js +312 -149
- package/dist/streams/source.js.map +1 -1
- package/dist/sync/actions/index.cjs +236 -184
- package/dist/sync/actions/index.cjs.map +1 -1
- package/dist/sync/actions/index.d.cts +29 -21
- package/dist/sync/actions/index.d.cts.map +1 -1
- package/dist/sync/actions/index.d.ts +29 -21
- package/dist/sync/actions/index.d.ts.map +1 -1
- package/dist/sync/actions/index.js +236 -190
- package/dist/sync/actions/index.js.map +1 -1
- package/dist/sync/b2-sha1-reader.cjs +148 -0
- package/dist/sync/b2-sha1-reader.cjs.map +1 -0
- package/dist/sync/b2-sha1-reader.d.cts +58 -0
- package/dist/sync/b2-sha1-reader.d.cts.map +1 -0
- package/dist/sync/b2-sha1-reader.d.ts +58 -0
- package/dist/sync/b2-sha1-reader.d.ts.map +1 -0
- package/dist/sync/b2-sha1-reader.js +145 -0
- package/dist/sync/b2-sha1-reader.js.map +1 -0
- package/dist/sync/download-staging.cjs +265 -0
- package/dist/sync/download-staging.cjs.map +1 -0
- package/dist/sync/download-staging.d.cts +54 -0
- package/dist/sync/download-staging.d.cts.map +1 -0
- package/dist/sync/download-staging.d.ts +54 -0
- package/dist/sync/download-staging.d.ts.map +1 -0
- package/dist/sync/download-staging.js +259 -0
- package/dist/sync/download-staging.js.map +1 -0
- package/dist/sync/filesystem-errors.cjs +32 -0
- package/dist/sync/filesystem-errors.cjs.map +1 -0
- package/dist/sync/filesystem-errors.d.cts +8 -0
- package/dist/sync/filesystem-errors.d.cts.map +1 -0
- package/dist/sync/filesystem-errors.d.ts +8 -0
- package/dist/sync/filesystem-errors.d.ts.map +1 -0
- package/dist/sync/filesystem-errors.js +32 -0
- package/dist/sync/filesystem-errors.js.map +1 -0
- package/dist/sync/filters.cjs +217 -0
- package/dist/sync/filters.cjs.map +1 -0
- package/dist/sync/filters.d.cts +51 -0
- package/dist/sync/filters.d.cts.map +1 -0
- package/dist/sync/filters.d.ts +51 -0
- package/dist/sync/filters.d.ts.map +1 -0
- package/dist/sync/filters.js +213 -0
- package/dist/sync/filters.js.map +1 -0
- package/dist/sync/index.cjs +39 -22
- package/dist/sync/index.d.cts +14 -9
- package/dist/sync/index.d.cts.map +1 -1
- package/dist/sync/index.d.ts +14 -9
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +9 -20
- package/dist/sync/local-file-identity.cjs +61 -0
- package/dist/sync/local-file-identity.cjs.map +1 -0
- package/dist/sync/local-file-identity.d.cts +37 -0
- package/dist/sync/local-file-identity.d.cts.map +1 -0
- package/dist/sync/local-file-identity.d.ts +37 -0
- package/dist/sync/local-file-identity.d.ts.map +1 -0
- package/dist/sync/local-file-identity.js +60 -0
- package/dist/sync/local-file-identity.js.map +1 -0
- package/dist/sync/local-file-io.cjs +364 -0
- package/dist/sync/local-file-io.cjs.map +1 -0
- package/dist/sync/local-file-io.d.cts +75 -0
- package/dist/sync/local-file-io.d.cts.map +1 -0
- package/dist/sync/local-file-io.d.ts +75 -0
- package/dist/sync/local-file-io.d.ts.map +1 -0
- package/dist/sync/local-file-io.js +360 -0
- package/dist/sync/local-file-io.js.map +1 -0
- package/dist/sync/local-filesystem-root.cjs +27 -0
- package/dist/sync/local-filesystem-root.cjs.map +1 -0
- package/dist/sync/local-filesystem-root.d.cts +18 -0
- package/dist/sync/local-filesystem-root.d.cts.map +1 -0
- package/dist/sync/local-filesystem-root.d.ts +18 -0
- package/dist/sync/local-filesystem-root.d.ts.map +1 -0
- package/dist/sync/local-filesystem-root.js +26 -0
- package/dist/sync/local-filesystem-root.js.map +1 -0
- package/dist/sync/local-sha1.cjs +119 -0
- package/dist/sync/local-sha1.cjs.map +1 -0
- package/dist/sync/local-sha1.d.cts +39 -0
- package/dist/sync/local-sha1.d.cts.map +1 -0
- package/dist/sync/local-sha1.d.ts +39 -0
- package/dist/sync/local-sha1.d.ts.map +1 -0
- package/dist/sync/local-sha1.js +117 -0
- package/dist/sync/local-sha1.js.map +1 -0
- package/dist/sync/pairing.cjs +118 -29
- package/dist/sync/pairing.cjs.map +1 -1
- package/dist/sync/pairing.d.cts +7 -2
- package/dist/sync/pairing.d.cts.map +1 -1
- package/dist/sync/pairing.d.ts +7 -2
- package/dist/sync/pairing.d.ts.map +1 -1
- package/dist/sync/pairing.js +120 -31
- package/dist/sync/pairing.js.map +1 -1
- package/dist/sync/path-order.cjs +30 -0
- package/dist/sync/path-order.cjs.map +1 -0
- package/dist/sync/path-order.d.cts +28 -0
- package/dist/sync/path-order.d.cts.map +1 -0
- package/dist/sync/path-order.d.ts +28 -0
- package/dist/sync/path-order.d.ts.map +1 -0
- package/dist/sync/path-order.js +29 -0
- package/dist/sync/path-order.js.map +1 -0
- package/dist/sync/path-safety.cjs +111 -0
- package/dist/sync/path-safety.cjs.map +1 -0
- package/dist/sync/path-safety.d.cts +78 -0
- package/dist/sync/path-safety.d.cts.map +1 -0
- package/dist/sync/path-safety.d.ts +78 -0
- package/dist/sync/path-safety.d.ts.map +1 -0
- package/dist/sync/path-safety.js +105 -0
- package/dist/sync/path-safety.js.map +1 -0
- package/dist/sync/paths.d.cts +19 -0
- package/dist/sync/paths.d.cts.map +1 -0
- package/dist/sync/paths.d.ts +19 -0
- package/dist/sync/paths.d.ts.map +1 -0
- package/dist/sync/policies/compare.cjs +389 -11
- package/dist/sync/policies/compare.cjs.map +1 -1
- package/dist/sync/policies/compare.d.cts +100 -2
- package/dist/sync/policies/compare.d.cts.map +1 -1
- package/dist/sync/policies/compare.d.ts +100 -2
- package/dist/sync/policies/compare.d.ts.map +1 -1
- package/dist/sync/policies/compare.js +387 -13
- package/dist/sync/policies/compare.js.map +1 -1
- package/dist/sync/policies/index.cjs +76 -65
- package/dist/sync/policies/index.cjs.map +1 -1
- package/dist/sync/policies/index.d.cts +35 -6
- package/dist/sync/policies/index.d.cts.map +1 -1
- package/dist/sync/policies/index.d.ts +35 -6
- package/dist/sync/policies/index.d.ts.map +1 -1
- package/dist/sync/policies/index.js +76 -65
- package/dist/sync/policies/index.js.map +1 -1
- package/dist/sync/prefix.cjs +96 -0
- package/dist/sync/prefix.cjs.map +1 -0
- package/dist/sync/prefix.d.cts +55 -0
- package/dist/sync/prefix.d.cts.map +1 -0
- package/dist/sync/prefix.d.ts +55 -0
- package/dist/sync/prefix.d.ts.map +1 -0
- package/dist/sync/prefix.js +92 -0
- package/dist/sync/prefix.js.map +1 -0
- package/dist/sync/regexp-safety.cjs +192 -0
- package/dist/sync/regexp-safety.cjs.map +1 -0
- package/dist/sync/regexp-safety.d.cts +29 -0
- package/dist/sync/regexp-safety.d.cts.map +1 -0
- package/dist/sync/regexp-safety.d.ts +29 -0
- package/dist/sync/regexp-safety.d.ts.map +1 -0
- package/dist/sync/regexp-safety.js +190 -0
- package/dist/sync/regexp-safety.js.map +1 -0
- package/dist/sync/scan-events.cjs +33 -0
- package/dist/sync/scan-events.cjs.map +1 -0
- package/dist/sync/scan-events.d.cts +17 -0
- package/dist/sync/scan-events.d.cts.map +1 -0
- package/dist/sync/scan-events.d.ts +17 -0
- package/dist/sync/scan-events.d.ts.map +1 -0
- package/dist/sync/scan-events.js +32 -0
- package/dist/sync/scan-events.js.map +1 -0
- package/dist/sync/scan-limit.cjs +33 -0
- package/dist/sync/scan-limit.cjs.map +1 -0
- package/dist/sync/scan-limit.d.cts +21 -0
- package/dist/sync/scan-limit.d.cts.map +1 -0
- package/dist/sync/scan-limit.d.ts +21 -0
- package/dist/sync/scan-limit.d.ts.map +1 -0
- package/dist/sync/scan-limit.js +31 -0
- package/dist/sync/scan-limit.js.map +1 -0
- package/dist/sync/scanners/b2.cjs +239 -55
- package/dist/sync/scanners/b2.cjs.map +1 -1
- package/dist/sync/scanners/b2.d.cts +26 -7
- package/dist/sync/scanners/b2.d.cts.map +1 -1
- package/dist/sync/scanners/b2.d.ts +26 -7
- package/dist/sync/scanners/b2.d.ts.map +1 -1
- package/dist/sync/scanners/b2.js +239 -55
- package/dist/sync/scanners/b2.js.map +1 -1
- package/dist/sync/scanners/local.cjs +215 -56
- package/dist/sync/scanners/local.cjs.map +1 -1
- package/dist/sync/scanners/local.d.cts +22 -7
- package/dist/sync/scanners/local.d.cts.map +1 -1
- package/dist/sync/scanners/local.d.ts +22 -7
- package/dist/sync/scanners/local.d.ts.map +1 -1
- package/dist/sync/scanners/local.js +216 -57
- package/dist/sync/scanners/local.js.map +1 -1
- package/dist/sync/sha1-metadata.cjs +94 -0
- package/dist/sync/sha1-metadata.cjs.map +1 -0
- package/dist/sync/sha1-metadata.d.cts +82 -0
- package/dist/sync/sha1-metadata.d.cts.map +1 -0
- package/dist/sync/sha1-metadata.d.ts +82 -0
- package/dist/sync/sha1-metadata.d.ts.map +1 -0
- package/dist/sync/sha1-metadata.js +89 -0
- package/dist/sync/sha1-metadata.js.map +1 -0
- package/dist/sync/sha1-options.cjs +23 -0
- package/dist/sync/sha1-options.cjs.map +1 -0
- package/dist/sync/sha1-options.d.cts +14 -0
- package/dist/sync/sha1-options.d.cts.map +1 -0
- package/dist/sync/sha1-options.d.ts +14 -0
- package/dist/sync/sha1-options.d.ts.map +1 -0
- package/dist/sync/sha1-options.js +21 -0
- package/dist/sync/sha1-options.js.map +1 -0
- package/dist/sync/synchronizer.cjs +782 -197
- package/dist/sync/synchronizer.cjs.map +1 -1
- package/dist/sync/synchronizer.d.cts +47 -1
- package/dist/sync/synchronizer.d.cts.map +1 -1
- package/dist/sync/synchronizer.d.ts +47 -1
- package/dist/sync/synchronizer.d.ts.map +1 -1
- package/dist/sync/synchronizer.js +779 -173
- package/dist/sync/synchronizer.js.map +1 -1
- package/dist/sync/types.d.cts +208 -16
- package/dist/sync/types.d.cts.map +1 -1
- package/dist/sync/types.d.ts +208 -16
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/types/auth.cjs +76 -56
- package/dist/types/auth.cjs.map +1 -1
- package/dist/types/auth.d.cts +67 -9
- package/dist/types/auth.d.cts.map +1 -1
- package/dist/types/auth.d.ts +67 -9
- package/dist/types/auth.d.ts.map +1 -1
- package/dist/types/auth.js +77 -57
- package/dist/types/auth.js.map +1 -1
- package/dist/types/bucket.cjs +74 -38
- package/dist/types/bucket.cjs.map +1 -1
- package/dist/types/bucket.js +75 -41
- package/dist/types/bucket.js.map +1 -1
- package/dist/types/encryption.cjs +364 -327
- package/dist/types/encryption.cjs.map +1 -1
- package/dist/types/encryption.d.cts +16 -0
- package/dist/types/encryption.d.cts.map +1 -1
- package/dist/types/encryption.d.ts +16 -0
- package/dist/types/encryption.d.ts.map +1 -1
- package/dist/types/encryption.js +364 -310
- package/dist/types/encryption.js.map +1 -1
- package/dist/types/errors.cjs +47 -0
- package/dist/types/errors.cjs.map +1 -0
- package/dist/types/errors.d.cts +13 -4
- package/dist/types/errors.d.cts.map +1 -1
- package/dist/types/errors.d.ts +13 -4
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +47 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/file.cjs +36 -19
- package/dist/types/file.cjs.map +1 -1
- package/dist/types/file.d.cts +2 -2
- package/dist/types/file.d.cts.map +1 -1
- package/dist/types/file.d.ts +2 -2
- package/dist/types/file.d.ts.map +1 -1
- package/dist/types/file.js +37 -21
- package/dist/types/file.js.map +1 -1
- package/dist/types/ids.cjs +53 -9
- package/dist/types/ids.cjs.map +1 -1
- package/dist/types/ids.js +54 -15
- package/dist/types/ids.js.map +1 -1
- package/dist/types/index.d.cts +12 -11
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.ts +12 -11
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/key.d.cts +44 -8
- package/dist/types/key.d.cts.map +1 -1
- package/dist/types/key.d.ts +44 -8
- package/dist/types/key.d.ts.map +1 -1
- package/dist/types/lock.cjs +33 -13
- package/dist/types/lock.cjs.map +1 -1
- package/dist/types/lock.js +34 -15
- package/dist/types/lock.js.map +1 -1
- package/dist/types/notifications.cjs +44 -22
- package/dist/types/notifications.cjs.map +1 -1
- package/dist/types/notifications.js +45 -23
- package/dist/types/notifications.js.map +1 -1
- package/dist/types/upload.d.cts +39 -5
- package/dist/types/upload.d.cts.map +1 -1
- package/dist/types/upload.d.ts +39 -5
- package/dist/types/upload.d.ts.map +1 -1
- package/dist/upload/abort-scope.cjs +91 -0
- package/dist/upload/abort-scope.cjs.map +1 -0
- package/dist/upload/abort-scope.d.cts +48 -0
- package/dist/upload/abort-scope.d.cts.map +1 -0
- package/dist/upload/abort-scope.d.ts +48 -0
- package/dist/upload/abort-scope.d.ts.map +1 -0
- package/dist/upload/abort-scope.js +88 -0
- package/dist/upload/abort-scope.js.map +1 -0
- package/dist/upload/cancel.cjs +183 -8
- package/dist/upload/cancel.cjs.map +1 -1
- package/dist/upload/cancel.d.cts +110 -2
- package/dist/upload/cancel.d.cts.map +1 -1
- package/dist/upload/cancel.d.ts +110 -2
- package/dist/upload/cancel.d.ts.map +1 -1
- package/dist/upload/cancel.js +178 -9
- package/dist/upload/cancel.js.map +1 -1
- package/dist/upload/concurrency.cjs +79 -52
- package/dist/upload/concurrency.cjs.map +1 -1
- package/dist/upload/concurrency.js +79 -53
- package/dist/upload/concurrency.js.map +1 -1
- package/dist/upload/finish.cjs +59 -0
- package/dist/upload/finish.cjs.map +1 -0
- package/dist/upload/finish.d.cts +26 -0
- package/dist/upload/finish.d.cts.map +1 -0
- package/dist/upload/finish.d.ts +26 -0
- package/dist/upload/finish.d.ts.map +1 -0
- package/dist/upload/finish.js +59 -0
- package/dist/upload/finish.js.map +1 -0
- package/dist/upload/large.cjs +301 -218
- package/dist/upload/large.cjs.map +1 -1
- package/dist/upload/large.d.cts +76 -9
- package/dist/upload/large.d.cts.map +1 -1
- package/dist/upload/large.d.ts +76 -9
- package/dist/upload/large.d.ts.map +1 -1
- package/dist/upload/large.js +301 -218
- package/dist/upload/large.js.map +1 -1
- package/dist/upload/options.cjs +28 -0
- package/dist/upload/options.cjs.map +1 -0
- package/dist/upload/options.d.cts +104 -0
- package/dist/upload/options.d.cts.map +1 -0
- package/dist/upload/options.d.ts +104 -0
- package/dist/upload/options.d.ts.map +1 -0
- package/dist/upload/options.js +27 -0
- package/dist/upload/options.js.map +1 -0
- package/dist/upload/resume.cjs +333 -33
- package/dist/upload/resume.cjs.map +1 -1
- package/dist/upload/resume.d.cts +82 -12
- package/dist/upload/resume.d.cts.map +1 -1
- package/dist/upload/resume.d.ts +82 -12
- package/dist/upload/resume.d.ts.map +1 -1
- package/dist/upload/resume.js +330 -33
- package/dist/upload/resume.js.map +1 -1
- package/dist/upload/retry.cjs +186 -0
- package/dist/upload/retry.cjs.map +1 -0
- package/dist/upload/retry.d.cts +127 -0
- package/dist/upload/retry.d.cts.map +1 -0
- package/dist/upload/retry.d.ts +127 -0
- package/dist/upload/retry.d.ts.map +1 -0
- package/dist/upload/retry.js +182 -0
- package/dist/upload/retry.js.map +1 -0
- package/dist/upload/single.cjs +68 -44
- package/dist/upload/single.cjs.map +1 -1
- package/dist/upload/single.d.cts +2 -1
- package/dist/upload/single.d.cts.map +1 -1
- package/dist/upload/single.d.ts +2 -1
- package/dist/upload/single.d.ts.map +1 -1
- package/dist/upload/single.js +68 -44
- package/dist/upload/single.js.map +1 -1
- package/dist/upload/stream.cjs +317 -193
- package/dist/upload/stream.cjs.map +1 -1
- package/dist/upload/stream.d.cts +3 -1
- package/dist/upload/stream.d.cts.map +1 -1
- package/dist/upload/stream.d.ts +3 -1
- package/dist/upload/stream.d.ts.map +1 -1
- package/dist/upload/stream.js +316 -192
- package/dist/upload/stream.js.map +1 -1
- package/dist/util/best-effort.cjs +42 -8
- package/dist/util/best-effort.cjs.map +1 -1
- package/dist/util/best-effort.d.cts +2 -1
- package/dist/util/best-effort.d.cts.map +1 -1
- package/dist/util/best-effort.d.ts +2 -1
- package/dist/util/best-effort.d.ts.map +1 -1
- package/dist/util/best-effort.js +43 -9
- package/dist/util/best-effort.js.map +1 -1
- package/dist/util/bytes.cjs +23 -0
- package/dist/util/bytes.cjs.map +1 -0
- package/dist/util/bytes.d.cts +15 -0
- package/dist/util/bytes.d.cts.map +1 -0
- package/dist/util/bytes.d.ts +15 -0
- package/dist/util/bytes.d.ts.map +1 -0
- package/dist/util/bytes.js +23 -0
- package/dist/util/bytes.js.map +1 -0
- package/dist/util/crypto.cjs +68 -0
- package/dist/util/crypto.cjs.map +1 -0
- package/dist/util/crypto.d.cts +26 -0
- package/dist/util/crypto.d.cts.map +1 -0
- package/dist/util/crypto.d.ts +26 -0
- package/dist/util/crypto.d.ts.map +1 -0
- package/dist/util/crypto.js +66 -0
- package/dist/util/crypto.js.map +1 -0
- package/dist/util/defaults.cjs +25 -9
- package/dist/util/defaults.cjs.map +1 -1
- package/dist/util/defaults.js +26 -11
- package/dist/util/defaults.js.map +1 -1
- package/dist/util/error-reason.cjs +41 -0
- package/dist/util/error-reason.cjs.map +1 -0
- package/dist/util/error-reason.d.cts +9 -0
- package/dist/util/error-reason.d.cts.map +1 -0
- package/dist/util/error-reason.d.ts +9 -0
- package/dist/util/error-reason.d.ts.map +1 -0
- package/dist/util/error-reason.js +41 -0
- package/dist/util/error-reason.js.map +1 -0
- package/dist/util/http.cjs +23 -0
- package/dist/util/http.cjs.map +1 -0
- package/dist/util/http.d.cts +13 -0
- package/dist/util/http.d.cts.map +1 -0
- package/dist/util/http.d.ts +13 -0
- package/dist/util/http.d.ts.map +1 -0
- package/dist/util/http.js +23 -0
- package/dist/util/http.js.map +1 -0
- package/dist/util/normalize.cjs +66 -7
- package/dist/util/normalize.cjs.map +1 -1
- package/dist/util/normalize.js +67 -10
- package/dist/util/normalize.js.map +1 -1
- package/dist/util/paginator.cjs +63 -14
- package/dist/util/paginator.cjs.map +1 -1
- package/dist/util/paginator.js +64 -16
- package/dist/util/paginator.js.map +1 -1
- package/dist/util/plan-ranges.cjs +47 -22
- package/dist/util/plan-ranges.cjs.map +1 -1
- package/dist/util/plan-ranges.js +48 -24
- package/dist/util/plan-ranges.js.map +1 -1
- package/dist/util/sha1.cjs +27 -0
- package/dist/util/sha1.cjs.map +1 -0
- package/dist/util/sha1.d.cts +17 -0
- package/dist/util/sha1.d.cts.map +1 -0
- package/dist/util/sha1.d.ts +17 -0
- package/dist/util/sha1.d.ts.map +1 -0
- package/dist/util/sha1.js +26 -0
- package/dist/util/sha1.js.map +1 -0
- package/dist/util/text-codec.cjs +29 -5
- package/dist/util/text-codec.cjs.map +1 -1
- package/dist/util/text-codec.js +30 -7
- package/dist/util/text-codec.js.map +1 -1
- package/dist/util/to-error.cjs +18 -4
- package/dist/util/to-error.cjs.map +1 -1
- package/dist/util/to-error.js +19 -5
- package/dist/util/to-error.js.map +1 -1
- package/dist/version.cjs +17 -5
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.cts +3 -3
- package/dist/version.d.ts +3 -3
- package/dist/version.js +19 -6
- package/dist/version.js.map +1 -1
- package/package.json +19 -16
- package/dist/auth/index.cjs.map +0 -1
- package/dist/auth/index.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/notifications/index.cjs.map +0 -1
- package/dist/notifications/index.js.map +0 -1
- package/dist/package.json.cjs +0 -9
- package/dist/package.json.cjs.map +0 -1
- package/dist/package.json.js +0 -9
- package/dist/package.json.js.map +0 -1
- package/dist/streams/index.cjs.map +0 -1
- package/dist/streams/index.js.map +0 -1
- package/dist/sync/index.cjs.map +0 -1
- package/dist/sync/index.js.map +0 -1
package/dist/bucket.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bucket.cjs","sources":["../src/bucket.ts"],"sourcesContent":["import type { B2Client } from './client.ts'\nimport { copyLargeFile } from './copy/large.ts'\nimport {\n type DownloadResult,\n type HeadResult,\n downloadByName,\n headByName,\n} from './download/single.ts'\nimport { B2Object, type DownloadCallOptions, type HeadCallOptions } from './object.ts'\nimport type { ProgressListener } from './streams/progress.ts'\nimport type { ContentSource } from './streams/source.ts'\nimport type {\n BucketInfo,\n BucketRetentionPolicy,\n BucketType,\n CorsRule,\n LifecycleRule,\n} from './types/bucket.ts'\nimport type { DownloadAuthorizationResponse } from './types/download.ts'\nimport type { EncryptionSetting } from './types/encryption.ts'\nimport type {\n FileVersion,\n ListFileNamesResponse,\n ListFileVersionsResponse,\n MetadataDirective,\n} from './types/file.ts'\nimport type { ApplicationKeyId, BucketId, FileId, LargeFileId } from './types/ids.ts'\nimport { accountId } from './types/ids.ts'\nimport type { FileRetentionValue, LegalHoldValue } from './types/lock.ts'\nimport type {\n EventNotificationRule,\n GetBucketNotificationRulesResponse,\n} from './types/notifications.ts'\nimport type { ReplicationConfiguration, ReplicationRule } from './types/replication.ts'\nimport type { CancelLargeFileResponse, PartInfo, UnfinishedLargeFile } from './types/upload.ts'\nimport { Semaphore } from './upload/concurrency.ts'\nimport { uploadLargeFile } from './upload/large.ts'\nimport { uploadSmallFile } from './upload/single.ts'\nimport { DEFAULT_BULK_CONCURRENCY, DEFAULT_PAGE_SIZE } from './util/defaults.ts'\nimport { type PaginatorOptions, paginateItems } from './util/paginator.ts'\nimport { toError } from './util/to-error.ts'\n\n/** A target for bulk deletion: a file name and its specific version ID. */\nexport interface DeleteTarget {\n /** File name (path) of the version to delete. */\n readonly fileName: string\n /** Unique identifier of the file version. */\n readonly fileId: FileId\n}\n\n/** Per-target error encountered during bulk deletion. */\nexport interface DeleteError {\n /** The target that failed. */\n readonly target: DeleteTarget\n /** The error thrown by the underlying `deleteFileVersion` call. */\n readonly error: Error\n}\n\n/** Aggregate result of a {@link Bucket.deleteMany} run. */\nexport interface DeleteManyResult {\n /** Number of file versions successfully deleted. */\n readonly deleted: number\n /** Per-target failures. Empty on full success. */\n readonly errors: readonly DeleteError[]\n}\n\n/** Emitted by {@link Bucket.deleteAll} once a file version has been successfully deleted. */\nexport interface DeleteAllDeleteEvent {\n /** Discriminant identifying a successful delete. */\n readonly type: 'delete'\n /** File name of the deleted version. */\n readonly fileName: string\n /** Unique identifier of the deleted version. */\n readonly fileId: FileId\n}\n\n/** Emitted by {@link Bucket.deleteAll} when a single delete call fails (other versions keep streaming). */\nexport interface DeleteAllErrorEvent {\n /** Discriminant identifying a per-version delete failure. */\n readonly type: 'error'\n /** File name of the version that failed to delete. */\n readonly fileName: string\n /** Unique identifier of the version that failed to delete. */\n readonly fileId: FileId\n /** Human-readable failure reason taken from the underlying error. */\n readonly message: string\n}\n\n/** Emitted by {@link Bucket.deleteAll} in `dryRun` mode for every version that would have been deleted. */\nexport interface DeleteAllSkipEvent {\n /** Discriminant identifying a dry-run skip. */\n readonly type: 'skip'\n /** File name of the version that would have been deleted. */\n readonly fileName: string\n /** Unique identifier of the version that would have been deleted. */\n readonly fileId: FileId\n}\n\n/** Event yielded by {@link Bucket.deleteAll} as it streams through file versions. */\nexport type DeleteAllEvent = DeleteAllDeleteEvent | DeleteAllErrorEvent | DeleteAllSkipEvent\n\n/**\n * Handle to a B2 bucket providing upload, download, listing, and management operations.\n *\n * Obtained via {@link B2Client.createBucket}, {@link B2Client.listBuckets}, or {@link B2Client.getBucket}.\n *\n * @example\n * ```ts\n * const bucket = await client.getBucket('my-bucket')\n * await bucket.upload({ fileName: 'hello.txt', source: new BufferSource(data) })\n * ```\n */\nexport class Bucket {\n /** Unique identifier for this bucket. */\n readonly id: BucketId\n /** Human-readable bucket name. */\n readonly name: string\n /** Full bucket metadata as returned by the B2 API. */\n readonly info: BucketInfo\n private readonly client: B2Client\n\n /**\n * @param client - The parent B2Client instance.\n * @param info - The bucket metadata from the API.\n *\n * @internal\n */\n constructor(client: B2Client, info: BucketInfo) {\n this.client = client\n this.info = info\n this.id = info.bucketId\n this.name = info.bucketName\n }\n\n /**\n * Returns a {@link B2Object} handle for a specific file name in this bucket.\n * @param fileName - The file path within the bucket.\n *\n * @returns A B2Object handle bound to this bucket and file name.\n */\n file(fileName: string): B2Object {\n return new B2Object(this.client, this, fileName)\n }\n\n /**\n * Uploads a file to this bucket. Automatically uses multipart upload for files\n * larger than the recommended part size.\n * @param options - Upload configuration including file name, source data, and optional settings.\n *\n * @returns Metadata for the uploaded file version.\n */\n async upload(options: {\n /** Destination file name (path) in the bucket. */\n fileName: string\n /** Data source to upload. Use {@link BufferSource}, {@link BlobSource}, or {@link StreamSource}. */\n source: ContentSource\n /** MIME type. Defaults to `\"b2/x-auto\"` (auto-detected by B2). */\n contentType?: string\n /** Custom key-value metadata stored with the file. */\n fileInfo?: Record<string, string>\n /** Server-side encryption settings. */\n serverSideEncryption?: EncryptionSetting\n /** File retention policy (requires file lock on the bucket). */\n fileRetention?: FileRetentionValue\n /** Legal hold status for the file. */\n legalHold?: LegalHoldValue\n /** Last-modified timestamp in milliseconds since epoch. */\n lastModifiedMillis?: number\n /** Part size override for multipart uploads, in bytes. */\n partSize?: number\n /** Number of concurrent part uploads for large files. */\n concurrency?: number\n /** Callback invoked with upload progress events. */\n onProgress?: ProgressListener\n /** Abort signal for cancelling the upload. */\n signal?: AbortSignal\n /**\n * Resume an unfinished multipart upload for this file name when one\n * exists. Only consulted on the large-file path (source size\n * greater than `recommendedPartSize`). On the small-file path this\n * option is silently ignored. Sliceable sources only — `StreamSource`\n * rejects resume because it can't replay parts.\n */\n resume?: boolean\n /**\n * Resume into a specific large-file ID. Overrides the `resume`\n * discovery path. The local `partSize` must match the server-side\n * plan.\n */\n resumeFileId?: LargeFileId\n }): Promise<FileVersion> {\n const recommendedPartSize = this.client.accountInfo.getRecommendedPartSize()\n const isLarge = options.source.size > recommendedPartSize\n\n if (isLarge) {\n return uploadLargeFile(this.client.raw, this.client.accountInfo, {\n bucketId: this.id,\n ...options,\n })\n }\n\n // Strip resume / resumeFileId from the small-file path: the\n // signature there doesn't accept them, and they're meaningless for\n // single-request uploads.\n const { resume: _resume, resumeFileId: _resumeFileId, ...smallOptions } = options\n return uploadSmallFile(this.client.raw, this.client.accountInfo, {\n bucketId: this.id,\n ...smallOptions,\n })\n }\n\n /**\n * Downloads a file from this bucket by name. Pass `method: 'HEAD'` in\n * `options` to fetch only the response headers (file metadata) without\n * streaming the body.\n * @param fileName - The file name (path) to download.\n * @param options - Optional method, range, SSE-C decryption, response-header overrides, and abort signal.\n *\n * @returns The download result containing response headers and a readable body stream.\n */\n async download(fileName: string, options?: DownloadCallOptions): Promise<DownloadResult> {\n return downloadByName(this.client.raw, this.client.accountInfo, {\n bucketName: this.name,\n fileName,\n ...options,\n })\n }\n\n /**\n * Fetches the response headers (file metadata) for a file via HTTP\n * HEAD. Returns a body-less result so callers never have to drain\n * the (logically empty) HEAD body themselves.\n *\n * Use this for metadata-only checks like \"does this file exist\", \"what\n * is its current SHA-1\", \"what is its Content-Length\". For full file\n * retrieval use {@link Bucket.download}.\n *\n * @param fileName - The file name (path) to inspect.\n * @param options - Optional range, SSE-C decryption, response-header\n * overrides, and abort signal. Same shape as {@link Bucket.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 * @example\n * ```ts\n * const { headers } = await bucket.head('photos/2026/sunset.jpg')\n * console.log(headers.contentLength, headers.contentSha1)\n * ```\n */\n async head(fileName: string, options?: HeadCallOptions): Promise<HeadResult> {\n return headByName(this.client.raw, this.client.accountInfo, {\n bucketName: this.name,\n fileName,\n ...options,\n })\n }\n\n /**\n * Lists file names in this bucket (most recent versions only).\n * @param options - Optional filtering and pagination settings.\n *\n * @returns A page of file versions with an optional continuation token.\n */\n async listFileNames(options?: {\n /** Start listing after this file name (for pagination). */\n startFileName?: string\n /**\n * Maximum number of files to return per request (1-10000).\n * Forwarded to the raw API's `maxFileCount` parameter.\n */\n pageSize?: number\n /** Only list files with names starting with this prefix. */\n prefix?: string\n /** Delimiter for virtual directory grouping (typically `\"/\"`). */\n delimiter?: string\n }): Promise<ListFileNamesResponse> {\n return this.client.raw.listFileNames(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n {\n bucketId: this.id,\n ...(options?.startFileName !== undefined ? { startFileName: options.startFileName } : {}),\n ...(options?.pageSize !== undefined ? { maxFileCount: options.pageSize } : {}),\n ...(options?.prefix !== undefined ? { prefix: options.prefix } : {}),\n ...(options?.delimiter !== undefined ? { delimiter: options.delimiter } : {}),\n },\n )\n }\n\n /**\n * Lists all file versions in this bucket, including hidden files.\n * @param options - Optional filtering and pagination settings.\n *\n * @returns A page of file versions with an optional continuation token.\n */\n async listFileVersions(options?: {\n /** Start listing after this file name (for pagination). */\n startFileName?: string\n /** Start listing after this file ID (for pagination within a file name). */\n startFileId?: FileId\n /**\n * Maximum number of file versions to return per request (1-10000).\n * Forwarded to the raw API's `maxFileCount` parameter.\n */\n pageSize?: number\n /** Only list files with names starting with this prefix. */\n prefix?: string\n /** Delimiter for virtual directory grouping. */\n delimiter?: string\n }): Promise<ListFileVersionsResponse> {\n return this.client.raw.listFileVersions(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n {\n bucketId: this.id,\n ...(options?.startFileName !== undefined ? { startFileName: options.startFileName } : {}),\n ...(options?.startFileId !== undefined ? { startFileId: options.startFileId } : {}),\n ...(options?.pageSize !== undefined ? { maxFileCount: options.pageSize } : {}),\n ...(options?.prefix !== undefined ? { prefix: options.prefix } : {}),\n ...(options?.delimiter !== undefined ? { delimiter: options.delimiter } : {}),\n },\n )\n }\n\n /**\n * Async iterator that yields the latest visible version of every file in\n * the bucket, automatically handling pagination via `listFileNames`.\n *\n * Hidden files (those whose latest version is a hide marker) are NOT\n * yielded by this iterator. Use {@link paginateFileVersions} when you\n * need full version history.\n *\n * @param options - Filter + pagination + abort options. `pageSize` is\n * forwarded to `b2_list_file_names`'s `maxFileCount` (default 1000,\n * B2-capped at 10000).\n *\n * @returns An async iterable of {@link FileVersion} entries.\n *\n * @example\n * ```ts\n * for await (const file of bucket.paginateFileNames({ prefix: 'photos/' })) {\n * console.log(file.fileName, file.contentLength)\n * }\n * ```\n */\n paginateFileNames(\n options?: {\n /** Only yield files whose names start with this prefix. */\n prefix?: string\n /** Delimiter for virtual directory grouping (typically `'/'`). */\n delimiter?: string\n } & PaginatorOptions,\n ): AsyncIterableIterator<FileVersion> {\n return paginateItems(\n async (cursor: string | undefined) => {\n const resp = await this.listFileNames({\n pageSize: options?.pageSize ?? DEFAULT_PAGE_SIZE,\n ...(cursor !== undefined ? { startFileName: cursor } : {}),\n ...(options?.prefix !== undefined ? { prefix: options.prefix } : {}),\n ...(options?.delimiter !== undefined ? { delimiter: options.delimiter } : {}),\n })\n return { page: resp, nextCursor: resp.nextFileName ?? undefined }\n },\n // Real B2 surfaces hide markers as rows in `b2_list_file_names`. This\n // iterator's documented contract is \"latest VISIBLE version\", so we\n // drop hide-action rows here. Callers who need full history should\n // use `paginateFileVersions`.\n (page) => page.files.filter((f) => f.action !== 'hide'),\n options?.signal,\n )\n }\n\n /**\n * Async iterator that yields every version of every file in the bucket,\n * including hidden files and historical versions, automatically handling\n * pagination via `listFileVersions`.\n *\n * The two-cursor `(nextFileName, nextFileId)` continuation that the raw\n * endpoint exposes is threaded internally; callers iterate flat.\n *\n * @param options - Filter + pagination + abort options.\n *\n * @returns An async iterable of {@link FileVersion} entries.\n */\n paginateFileVersions(\n options?: {\n /** Only yield versions whose names start with this prefix. */\n prefix?: string\n /** Delimiter for virtual directory grouping. */\n delimiter?: string\n } & PaginatorOptions,\n ): AsyncIterableIterator<FileVersion> {\n type Cursor = { fileName: string; fileId: FileId | undefined }\n return paginateItems(\n async (cursor: Cursor | undefined) => {\n const resp = await this.listFileVersions({\n pageSize: options?.pageSize ?? DEFAULT_PAGE_SIZE,\n ...(cursor !== undefined ? { startFileName: cursor.fileName } : {}),\n ...(cursor?.fileId !== undefined ? { startFileId: cursor.fileId } : {}),\n ...(options?.prefix !== undefined ? { prefix: options.prefix } : {}),\n ...(options?.delimiter !== undefined ? { delimiter: options.delimiter } : {}),\n })\n const nextCursor: Cursor | undefined =\n resp.nextFileName !== null\n ? { fileName: resp.nextFileName, fileId: resp.nextFileId ?? undefined }\n : undefined\n return { page: resp, nextCursor }\n },\n (page) => page.files,\n options?.signal,\n )\n }\n\n /**\n * Async iterator that yields every unfinished large file in the bucket,\n * automatically handling pagination via `listUnfinishedLargeFiles`.\n *\n * Useful for janitorial scripts that want to inspect or cancel abandoned\n * multipart uploads (typically followed by {@link cancelLargeFile} on\n * the underlying raw client).\n *\n * @param options - Filter + pagination + abort options. `pageSize` is\n * B2-capped at 100 for this endpoint.\n *\n * @returns An async iterable of unfinished-large-file metadata entries.\n */\n paginateUnfinishedLargeFiles(\n options?: {\n /** Only yield large files whose names start with this prefix. */\n namePrefix?: string\n } & PaginatorOptions,\n ): AsyncIterableIterator<UnfinishedLargeFile> {\n return paginateItems(\n async (cursor: LargeFileId | undefined) => {\n const resp = await this.listUnfinishedLargeFiles({\n pageSize: options?.pageSize ?? 100,\n ...(cursor !== undefined ? { startFileId: cursor } : {}),\n ...(options?.namePrefix !== undefined ? { namePrefix: options.namePrefix } : {}),\n })\n return { page: resp, nextCursor: resp.nextFileId ?? undefined }\n },\n (page) => page.files,\n options?.signal,\n )\n }\n\n /**\n * Async iterator that yields every uploaded part for a specific large\n * file, automatically handling pagination via `listParts`.\n *\n * @param largeFileId - The unfinished large file to enumerate parts of.\n * @param options - Pagination + abort options. `pageSize` is B2-capped\n * at 1000 for this endpoint; the default is 1000.\n *\n * @returns An async iterable of {@link PartInfo} entries.\n */\n paginateParts(\n largeFileId: LargeFileId,\n options?: PaginatorOptions,\n ): AsyncIterableIterator<PartInfo> {\n return paginateItems(\n async (cursor: number | undefined) => {\n const resp = await this.client.raw.listParts(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n {\n fileId: largeFileId,\n maxPartCount: options?.pageSize ?? DEFAULT_PAGE_SIZE,\n ...(cursor !== undefined ? { startPartNumber: cursor } : {}),\n },\n )\n return { page: resp, nextCursor: resp.nextPartNumber ?? undefined }\n },\n (page) => page.parts,\n options?.signal,\n )\n }\n\n /**\n * Looks up the latest visible version of a file by name.\n * Uses `listFileNames` under the hood; returns `null` when the file does not\n * exist or its latest version is a hide marker.\n * @param fileName - The exact file path to look up.\n *\n * @returns The latest {@link FileVersion}, or `null` if not found.\n */\n async getFileInfoByName(fileName: string): Promise<FileVersion | null> {\n // `listFileNames` returns the most recent version per file name,\n // which may be a hide marker (real B2: `action: 'hide'`,\n // `contentLength: 0`). This helper's contract is \"latest LIVE\n // version\", so we treat a hide-action match as \"not found\".\n const resp = await this.listFileNames({ prefix: fileName, pageSize: 1 })\n const match = resp.files.find((f) => f.fileName === fileName)\n if (!match || match.action === 'hide') return null\n return match\n }\n\n /**\n * Removes the latest hide marker for a file, restoring visibility of the\n * previous upload. Returns the deleted hide marker, or `null` if there was\n * no hide marker to remove (file is already visible or does not exist).\n * @param fileName - The file path to unhide.\n *\n * @returns The deleted hide marker version, or `null` if nothing was hidden.\n */\n async unhideFile(fileName: string): Promise<FileVersion | null> {\n // The latest version of a hidden file appears in listFileVersions but not\n // in listFileNames. Walk versions until we find the hide marker on top.\n const resp = await this.listFileVersions({ prefix: fileName, pageSize: 100 })\n const versions = resp.files.filter((f) => f.fileName === fileName)\n if (versions.length === 0) return null\n // listFileVersions sorts by name asc then upload timestamp desc, so the\n // first entry is the latest version.\n const latest = versions[0]\n if (!latest || latest.action !== 'hide') return null\n await this.deleteFileVersion(fileName, latest.fileId)\n return latest\n }\n\n /**\n * Hides a file by creating a hide marker. The file remains in version history but is no longer visible in `listFileNames`.\n * @param fileName - The file path to hide.\n *\n * @returns Metadata for the newly created hide marker.\n */\n async hideFile(fileName: string): Promise<FileVersion> {\n return this.client.raw.hideFile(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n { bucketId: this.id, fileName },\n )\n }\n\n /**\n * Permanently deletes a specific file version. Both file name and file ID are required.\n *\n * If the file is under Object Lock retention, B2 will reject the\n * delete: compliance-mode files cannot be deleted until the retention\n * expires; governance-mode files require `bypassGovernance: true`\n * AND a calling key with the `bypassGovernance` capability. Files on\n * legal hold cannot be deleted by anyone until the hold is removed.\n *\n * @param fileName - The file path of the version to delete.\n * @param fileId - The unique identifier of the file version to delete.\n * @param options - Optional flag for bypassing governance retention.\n */\n async deleteFileVersion(\n fileName: string,\n fileId: FileId,\n options?: { bypassGovernance?: boolean },\n ): Promise<void> {\n await this.client.raw.deleteFileVersion(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n {\n fileName,\n fileId,\n ...(options?.bypassGovernance !== undefined\n ? { bypassGovernance: options.bypassGovernance }\n : {}),\n },\n )\n }\n\n /**\n * Cancels an in-progress large file upload so the partial parts are not\n * retained or billed. The most common reason to call this is to clean up\n * abandoned multipart uploads surfaced by {@link listUnfinishedLargeFiles}.\n * @param fileId - The unique identifier of the unfinished large file to cancel.\n *\n * @returns Metadata about the cancelled large file.\n */\n async cancelLargeFile(fileId: LargeFileId): Promise<CancelLargeFileResponse> {\n return this.client.raw.cancelLargeFile(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n { fileId },\n )\n }\n\n /**\n * Lists large files in this bucket that were started but never finished or\n * cancelled. Wraps `b2_list_unfinished_large_files`.\n * @param options - Optional pagination filters.\n *\n * @returns The page of unfinished large files plus a continuation token.\n */\n async listUnfinishedLargeFiles(options?: {\n /** Restrict results to files whose name starts with this prefix. */\n namePrefix?: string\n /** Start listing after this file ID (for pagination). */\n startFileId?: LargeFileId\n /**\n * Maximum number of files to return per request (1-100). Forwarded\n * to the raw API's `maxFileCount` parameter.\n */\n pageSize?: number\n }) {\n return this.client.raw.listUnfinishedLargeFiles(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n {\n bucketId: this.id,\n ...(options?.namePrefix !== undefined ? { namePrefix: options.namePrefix } : {}),\n ...(options?.startFileId !== undefined ? { startFileId: options.startFileId } : {}),\n ...(options?.pageSize !== undefined ? { maxFileCount: options.pageSize } : {}),\n },\n )\n }\n\n /**\n * Deletes many file versions with bounded concurrency. Errors from individual\n * deletes are collected and returned rather than thrown, so partial success\n * does not abort the run.\n *\n * When `options.signal` is supplied and aborted, in-flight deletes\n * complete (they're already on the wire), but no new deletes start\n * after the abort fires. Subsequent targets are short-circuited to an\n * error entry so the result tally reflects what actually happened.\n * @param targets - File versions to delete.\n * @param options - Optional concurrency override and abort signal.\n * Concurrency defaults to the SDK-wide bulk-metadata setting\n * (currently 10, higher than transfer concurrency because each\n * task is a single tiny API round-trip).\n *\n * @returns A summary of successes and per-target errors.\n */\n async deleteMany(\n targets: readonly DeleteTarget[],\n options?: { concurrency?: number; signal?: AbortSignal },\n ): Promise<DeleteManyResult> {\n const concurrency = options?.concurrency ?? DEFAULT_BULK_CONCURRENCY\n const sem = new Semaphore(concurrency)\n const signal = options?.signal\n let deleted = 0\n const errors: DeleteError[] = []\n\n await Promise.all(\n targets.map(async (target) => {\n await sem.acquire()\n try {\n // Honour abort BETWEEN acquisitions: in-flight deletes\n // complete (they're already on the wire), but new tasks don't\n // start once the signal fires. Without this gate, aborting a\n // 1000-item deleteMany would still let the next `concurrency`\n // tasks dispatch before the caller's await returned.\n if (signal?.aborted) {\n errors.push({\n target,\n error: toError(signal.reason ?? 'aborted'),\n })\n return\n }\n await this.deleteFileVersion(target.fileName, target.fileId)\n deleted++\n } catch (err) {\n errors.push({\n target,\n error: toError(err),\n })\n } finally {\n sem.release()\n }\n }),\n )\n\n return { deleted, errors }\n }\n\n /**\n * Async generator that streams every file version in the bucket (optionally\n * filtered by prefix) and deletes each one. Yields a {@link DeleteAllEvent}\n * per file version. With `dryRun: true`, no deletes are performed but `skip`\n * events are still emitted.\n * @param options - Optional prefix filter, page size, and dry-run flag.\n *\n * @returns An async generator of per-file events.\n */\n async *deleteAll(options?: {\n /** Only delete file versions whose names start with this prefix. */\n prefix?: string\n /** Number of file versions fetched per API page (default 1000). */\n pageSize?: number\n /** If true, yield `skip` events without actually deleting anything. */\n dryRun?: boolean\n }): AsyncGenerator<DeleteAllEvent> {\n const dryRun = options?.dryRun ?? false\n const pageSize = options?.pageSize ?? DEFAULT_PAGE_SIZE\n\n let startFileName: string | undefined\n let startFileId: FileId | undefined\n while (true) {\n const page = await this.listFileVersions({\n pageSize,\n ...(options?.prefix !== undefined ? { prefix: options.prefix } : {}),\n ...(startFileName !== undefined ? { startFileName } : {}),\n ...(startFileId !== undefined ? { startFileId } : {}),\n })\n\n for (const version of page.files) {\n if (dryRun) {\n yield { type: 'skip', fileName: version.fileName, fileId: version.fileId }\n continue\n }\n try {\n await this.deleteFileVersion(version.fileName, version.fileId)\n yield { type: 'delete', fileName: version.fileName, fileId: version.fileId }\n } catch (err) {\n yield {\n type: 'error',\n fileName: version.fileName,\n fileId: version.fileId,\n message: toError(err).message,\n }\n }\n }\n\n if (!page.nextFileName) break\n startFileName = page.nextFileName\n startFileId = page.nextFileId ?? undefined\n }\n }\n\n /**\n * Creates a server-side copy of a file within or across buckets.\n * @param options - Copy configuration including source file ID and destination name.\n *\n * @returns Metadata for the newly created file version.\n */\n async copyFile(options: {\n /** File ID of the source file to copy. */\n sourceFileId: FileId\n /** Destination file name in the target bucket. */\n fileName: string\n /** Target bucket ID. Defaults to this bucket if omitted. */\n destinationBucketId?: BucketId\n /** Whether to copy or replace file metadata. */\n metadataDirective?: MetadataDirective\n /** Override content type (only with `REPLACE` metadata directive). */\n contentType?: string\n /** Override file info (only with `REPLACE` metadata directive). */\n fileInfo?: Record<string, string>\n /** Server-side encryption for the destination file. */\n serverSideEncryption?: EncryptionSetting\n }): Promise<FileVersion> {\n return this.client.raw.copyFile(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n options,\n )\n }\n\n /**\n * Copies a file via the server-side multipart protocol. Each part is copied\n * by reference through `b2_copy_part`; data never traverses the client. Falls\n * back to a single `copyFile` call when the source fits within a single part.\n * @param options - Copy parameters including source file ID, destination name, part size, and concurrency.\n *\n * @returns Metadata for the newly created destination file version.\n */\n async copyLargeFile(options: {\n /** File ID of the source file to copy. */\n sourceFileId: FileId\n /** Destination file name in the target bucket. */\n fileName: string\n /** Target bucket ID. Defaults to this bucket if omitted. */\n destinationBucketId?: BucketId\n /** Override content type for the destination. */\n contentType?: string\n /** Custom file info for the destination. */\n fileInfo?: Record<string, string>\n /** Server-side encryption for the destination file. */\n destinationServerSideEncryption?: EncryptionSetting\n /** SSE-C settings for the source if it was uploaded with SSE-C. */\n sourceServerSideEncryption?: EncryptionSetting\n /** Part size in bytes. Defaults to the account's recommended part size. */\n partSize?: number\n /**\n * Maximum number of parts copied in parallel. Defaults to the\n * SDK-wide transfer concurrency.\n */\n concurrency?: number\n /**\n * Optional abort signal. Aborting cancels any remaining parts and\n * triggers a best-effort `cancelLargeFile` on the unfinished upload.\n */\n signal?: AbortSignal\n }): Promise<FileVersion> {\n return copyLargeFile(this.client.raw, this.client.accountInfo, {\n sourceFileId: options.sourceFileId,\n fileName: options.fileName,\n ...(options.destinationBucketId !== undefined\n ? { destinationBucketId: options.destinationBucketId }\n : { destinationBucketId: this.id }),\n ...(options.contentType !== undefined ? { contentType: options.contentType } : {}),\n ...(options.fileInfo !== undefined ? { fileInfo: options.fileInfo } : {}),\n ...(options.destinationServerSideEncryption !== undefined\n ? { destinationServerSideEncryption: options.destinationServerSideEncryption }\n : {}),\n ...(options.sourceServerSideEncryption !== undefined\n ? { sourceServerSideEncryption: options.sourceServerSideEncryption }\n : {}),\n ...(options.partSize !== undefined ? { partSize: options.partSize } : {}),\n ...(options.concurrency !== undefined ? { concurrency: options.concurrency } : {}),\n ...(options.signal !== undefined ? { signal: options.signal } : {}),\n })\n }\n\n /**\n * Updates bucket settings such as type, CORS, lifecycle rules, and encryption.\n * @param options - Fields to update. Omitted fields are left unchanged.\n *\n * @returns Updated bucket metadata.\n */\n async update(options: {\n /** Change the bucket access level. */\n bucketType?: BucketType\n /** Replace custom bucket metadata. */\n bucketInfo?: Record<string, string>\n /** Replace CORS rules. */\n corsRules?: CorsRule[]\n /** Change default server-side encryption. */\n defaultServerSideEncryption?: EncryptionSetting\n /** Change default file retention policy. */\n defaultRetention?: BucketRetentionPolicy\n /** Replace lifecycle rules. */\n lifecycleRules?: LifecycleRule[]\n /** Update replication configuration. */\n replicationConfiguration?: ReplicationConfiguration\n /** Optimistic locking: only update if the bucket revision matches. */\n ifRevisionIs?: number\n }): Promise<BucketInfo> {\n return this.client.raw.updateBucket(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n {\n accountId: accountId(this.client.accountInfo.getAccountId()),\n bucketId: this.id,\n ...options,\n },\n )\n }\n\n /**\n * Permanently deletes this bucket. The bucket must be empty (no file versions).\n *\n * @returns The deleted bucket metadata.\n */\n async delete(): Promise<BucketInfo> {\n return this.client.deleteBucket(this.id)\n }\n\n /**\n * Gets a download authorization token scoped to a file name prefix in this bucket.\n * @param fileNamePrefix - Only authorize downloads of files starting with this prefix.\n * @param validDurationInSeconds - How long the authorization is valid (1-604800 seconds).\n *\n * @returns The download authorization response containing a time-limited token.\n */\n async getDownloadAuthorization(\n fileNamePrefix: string,\n validDurationInSeconds: number,\n ): Promise<DownloadAuthorizationResponse> {\n return this.client.raw.getDownloadAuthorization(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n { bucketId: this.id, fileNamePrefix, validDurationInSeconds },\n )\n }\n\n /**\n * Gets the event notification rules configured for this bucket.\n *\n * @returns The current notification rules for this bucket.\n */\n async getNotificationRules(): Promise<GetBucketNotificationRulesResponse> {\n return this.client.raw.getBucketNotificationRules(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n { bucketId: this.id },\n )\n }\n\n /**\n * Replaces the event notification rules for this bucket.\n * @param rules - The new set of notification rules to apply.\n *\n * @returns The updated notification rules for this bucket.\n */\n async setNotificationRules(\n rules: EventNotificationRule[],\n ): Promise<GetBucketNotificationRulesResponse> {\n return this.client.raw.setBucketNotificationRules(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n { bucketId: this.id, eventNotificationRules: rules },\n )\n }\n\n /**\n * Updates the file retention policy for a specific file version. Requires file lock on the bucket.\n * @param fileName - The file path of the version to update.\n * @param fileId - The unique identifier of the file version.\n * @param retention - The new retention policy to apply.\n * @param options - Optional flags. Set `bypassGovernance: true` to shorten governance-mode retention.\n *\n * @returns The updated file retention metadata.\n */\n async updateFileRetention(\n fileName: string,\n fileId: FileId,\n retention: FileRetentionValue,\n options?: { bypassGovernance?: boolean },\n ) {\n return this.client.raw.updateFileRetention(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n {\n fileName,\n fileId,\n fileRetention: retention,\n ...(options?.bypassGovernance !== undefined\n ? { bypassGovernance: options.bypassGovernance }\n : {}),\n },\n )\n }\n\n /**\n * Updates the legal hold status for a specific file version. Requires file lock on the bucket.\n * @param fileName - The file path of the version to update.\n * @param fileId - The unique identifier of the file version.\n * @param legalHold - The new legal hold status to apply.\n *\n * @returns The updated legal hold metadata.\n */\n async updateFileLegalHold(fileName: string, fileId: FileId, legalHold: LegalHoldValue) {\n return this.client.raw.updateFileLegalHold(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n { fileName, fileId, legalHold },\n )\n }\n\n /**\n * Refetches this bucket's metadata from B2 so callers operating on\n * replication / lifecycle / retention configuration always start from the\n * server-of-record state.\n *\n * Bucket configuration is monotonically revisioned by B2: B2 increments\n * `revision` on every accepted update. The local {@link info} snapshot\n * captured at construction time goes stale as soon as anyone else (or any\n * prior `update()` call) mutates the bucket, so the ergonomic\n * add/remove helpers below always refresh before composing the next\n * `setX()` call. The result is that each helper is safe to call without\n * the caller having to thread BucketInfo through their code.\n *\n * @returns Fresh {@link BucketInfo} for this bucket.\n *\n * @throws If the bucket no longer exists.\n */\n private async refresh(): Promise<BucketInfo> {\n const fresh = await this.client.listBuckets({ bucketId: this.id })\n const found = fresh[0]\n if (!found) throw new Error(`Bucket ${this.id} not found`)\n return found.info\n }\n\n /**\n * Returns the current cross-region replication configuration, refetched\n * from B2.\n *\n * Use this when you need to read replication state without composing a\n * write. For add/remove flows the helper methods below handle the\n * refresh-then-set sequence for you.\n *\n * @returns The current {@link ReplicationConfiguration}.\n */\n async getReplication(): Promise<ReplicationConfiguration> {\n const fresh = await this.refresh()\n return fresh.replicationConfiguration\n }\n\n /**\n * Replaces this bucket's complete replication configuration.\n * @param replication - The new configuration. Pass an empty source/destination\n * pair (`{ asReplicationSource: null, asReplicationDestination: null }`)\n * to clear replication entirely.\n *\n * @returns The updated bucket metadata.\n */\n async setReplication(replication: ReplicationConfiguration): Promise<BucketInfo> {\n return this.update({ replicationConfiguration: replication })\n }\n\n /**\n * Adds (or replaces by `replicationRuleName`) a single replication rule\n * on this bucket while leaving any other rules, the source key, and the\n * destination key mapping untouched.\n *\n * When this is the very first source-side rule, `sourceApplicationKeyId`\n * must be supplied to seed `asReplicationSource.sourceApplicationKeyId`;\n * for subsequent calls the existing source key is reused unless the\n * caller explicitly overrides it.\n *\n * @param rule - The replication rule to add or replace.\n * @param options - Optional source application key ID override (or seed\n * when no source side exists yet).\n *\n * @returns The updated bucket metadata.\n *\n * @throws If no source-side replication exists yet and the caller did\n * not supply `sourceApplicationKeyId`.\n */\n async addReplicationRule(\n rule: ReplicationRule,\n options?: { sourceApplicationKeyId?: ApplicationKeyId },\n ): Promise<BucketInfo> {\n const current = (await this.refresh()).replicationConfiguration\n const existingSource = current.asReplicationSource\n const sourceKey = options?.sourceApplicationKeyId ?? existingSource?.sourceApplicationKeyId\n if (!sourceKey) {\n throw new Error(\n 'addReplicationRule: no existing source-side replication; pass options.sourceApplicationKeyId',\n )\n }\n const existingRules = existingSource?.replicationRules ?? []\n const without = existingRules.filter((r) => r.replicationRuleName !== rule.replicationRuleName)\n return this.setReplication({\n asReplicationSource: {\n sourceApplicationKeyId: sourceKey,\n replicationRules: [...without, rule],\n },\n asReplicationDestination: current.asReplicationDestination,\n })\n }\n\n /**\n * Removes a single replication rule by name. No-ops cleanly when the rule\n * is not present (returns the unchanged-but-revision-bumped bucket info).\n *\n * @param replicationRuleName - Name of the rule to remove.\n *\n * @returns The updated bucket metadata.\n */\n async removeReplicationRule(replicationRuleName: string): Promise<BucketInfo> {\n const current = (await this.refresh()).replicationConfiguration\n const existingSource = current.asReplicationSource\n if (!existingSource) {\n return this.setReplication(current)\n }\n const filtered = existingSource.replicationRules.filter(\n (r) => r.replicationRuleName !== replicationRuleName,\n )\n return this.setReplication({\n asReplicationSource: {\n sourceApplicationKeyId: existingSource.sourceApplicationKeyId,\n replicationRules: filtered,\n },\n asReplicationDestination: current.asReplicationDestination,\n })\n }\n\n /**\n * Returns the current lifecycle rules for this bucket, refetched from B2.\n *\n * @returns The current array of {@link LifecycleRule}s.\n */\n async getLifecycleRules(): Promise<readonly LifecycleRule[]> {\n const fresh = await this.refresh()\n return fresh.lifecycleRules\n }\n\n /**\n * Replaces this bucket's lifecycle rules in their entirety.\n * @param rules - The new rule set. Pass `[]` to remove all lifecycle\n * automation.\n *\n * @returns The updated bucket metadata.\n */\n async setLifecycleRules(rules: readonly LifecycleRule[]): Promise<BucketInfo> {\n return this.update({ lifecycleRules: [...rules] })\n }\n\n /**\n * Adds (or replaces, matched by `fileNamePrefix`) a single lifecycle rule\n * while leaving any other rules untouched.\n *\n * Matching on prefix mirrors B2's own data model: each unique prefix can\n * have at most one rule, and a `b2_update_bucket` call that contains two\n * rules with the same prefix is rejected. The helper enforces this for\n * the caller.\n *\n * @param rule - The lifecycle rule to add or replace.\n *\n * @returns The updated bucket metadata.\n */\n async addLifecycleRule(rule: LifecycleRule): Promise<BucketInfo> {\n const current = await this.getLifecycleRules()\n const without = current.filter((r) => r.fileNamePrefix !== rule.fileNamePrefix)\n return this.setLifecycleRules([...without, rule])\n }\n\n /**\n * Removes a single lifecycle rule by prefix. No-ops cleanly when the rule\n * is not present.\n *\n * @param fileNamePrefix - The prefix of the rule to remove.\n *\n * @returns The updated bucket metadata.\n */\n async removeLifecycleRule(fileNamePrefix: string): Promise<BucketInfo> {\n const current = await this.getLifecycleRules()\n return this.setLifecycleRules(current.filter((r) => r.fileNamePrefix !== fileNamePrefix))\n }\n\n /**\n * Returns the current default Object Lock retention policy for new\n * uploads to this bucket, refetched from B2.\n *\n * @returns The default {@link BucketRetentionPolicy} (which may be\n * `{ mode: 'none', period: null }` when Object Lock is enabled on the\n * bucket but no default is set).\n */\n async getDefaultRetention(): Promise<BucketRetentionPolicy> {\n const fresh = await this.refresh()\n return fresh.defaultRetention\n }\n\n /**\n * Sets (or clears, by passing `{ mode: 'none', period: null }`) the\n * default Object Lock retention policy applied to new uploads.\n *\n * Object Lock must already be enabled on the bucket. Buckets created\n * without `fileLockEnabled: true` cannot accept a default retention\n * policy and B2 will reject this call.\n *\n * @param policy - The new default retention policy.\n *\n * @returns The updated bucket metadata.\n */\n async setDefaultRetention(policy: BucketRetentionPolicy): Promise<BucketInfo> {\n return this.update({ defaultRetention: policy })\n }\n}\n"],"names":["B2Object","uploadLargeFile","uploadSmallFile","downloadByName","headByName","paginateItems","DEFAULT_PAGE_SIZE","concurrency","DEFAULT_BULK_CONCURRENCY","Semaphore","toError","copyLargeFile","accountId"],"mappings":";;;;;;;;;;;;AAgHO,MAAM,OAAO;AAAA;AAAA,EAET;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EACQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQjB,YAAY,QAAkB,MAAkB;AAC9C,SAAK,SAAS;AACd,SAAK,OAAO;AACZ,SAAK,KAAK,KAAK;AACf,SAAK,OAAO,KAAK;AAAA,EACnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,KAAK,UAA4B;AAC/B,WAAO,IAAIA,OAAAA,SAAS,KAAK,QAAQ,MAAM,QAAQ;AAAA,EACjD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,OAAO,SAuCY;AACvB,UAAM,sBAAsB,KAAK,OAAO,YAAY,uBAAA;AACpD,UAAM,UAAU,QAAQ,OAAO,OAAO;AAEtC,QAAI,SAAS;AACX,aAAOC,MAAAA,gBAAgB,KAAK,OAAO,KAAK,KAAK,OAAO,aAAa;AAAA,QAC/D,UAAU,KAAK;AAAA,QACf,GAAG;AAAA,MAAA,CACJ;AAAA,IACH;AAKA,UAAM,EAAE,QAAQ,SAAS,cAAc,eAAe,GAAG,iBAAiB;AAC1E,WA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M,QAAQ,MAAM,KAAK,QAAA;AACzB,WAAO,MAAM;AAAA,EACf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,MAAM,oBAAoB,QAAoD;AAC5E,WAAO,KAAK,OAAO,EAAE,kBAAkB,QAAQ;AAAA,EACjD;AACF;;"}
|
|
1
|
+
{"version":3,"file":"bucket.cjs","names":[],"sources":["../src/bucket.ts"],"sourcesContent":["import type { B2Client } from './client.ts'\nimport { copyLargeFile } from './copy/large.ts'\nimport {\n type DownloadResult,\n downloadByName,\n type HeadResult,\n headByName,\n} from './download/single.ts'\nimport type { RetryOptions } from './http/retry.ts'\nimport { mergeUploadRetryOptions } from './internal/upload-retry-options.ts'\nimport { B2Object, type DownloadCallOptions, type HeadCallOptions } from './object.ts'\nimport type {\n BucketInfo,\n BucketRetentionPolicy,\n BucketType,\n CorsRule,\n LifecycleRule,\n} from './types/bucket.ts'\nimport type { DownloadAuthorizationResponse } from './types/download.ts'\nimport type { EncryptionSetting } from './types/encryption.ts'\nimport type {\n FileVersion,\n ListFileNamesResponse,\n ListFileVersionsResponse,\n MetadataDirective,\n} from './types/file.ts'\nimport type { ApplicationKeyId, BucketId, FileId, LargeFileId } from './types/ids.ts'\nimport { accountId } from './types/ids.ts'\nimport type { FileRetentionValue, LegalHoldValue } from './types/lock.ts'\nimport type {\n EventNotificationRule,\n GetBucketNotificationRulesResponse,\n} from './types/notifications.ts'\nimport type { ReplicationConfiguration, ReplicationRule } from './types/replication.ts'\nimport type { CancelLargeFileResponse, PartInfo, UnfinishedLargeFile } from './types/upload.ts'\nimport type { CleanupFailureListener } from './upload/cancel.ts'\nimport { Semaphore } from './upload/concurrency.ts'\nimport { uploadLargeFile } from './upload/large.ts'\nimport {\n type BucketUploadOptions,\n rejectSmallResumeFileId,\n stripResumeOnlyOptions,\n} from './upload/options.ts'\nimport { uploadSmallFile } from './upload/single.ts'\nimport { DEFAULT_BULK_CONCURRENCY, DEFAULT_PAGE_SIZE } from './util/defaults.ts'\nimport { type PaginatorOptions, paginateItems } from './util/paginator.ts'\nimport { toError } from './util/to-error.ts'\n\n/** A target for bulk deletion: a file name and its specific version ID. */\nexport interface DeleteTarget {\n /** File name (path) of the version to delete. */\n readonly fileName: string\n /** Unique identifier of the file version. */\n readonly fileId: FileId\n}\n\n/** Per-target error encountered during bulk deletion. */\nexport interface DeleteError {\n /** The target that failed. */\n readonly target: DeleteTarget\n /** The error thrown by the underlying `deleteFileVersion` call. */\n readonly error: Error\n}\n\n/** Aggregate result of a {@link Bucket.deleteMany} run. */\nexport interface DeleteManyResult {\n /** Number of file versions successfully deleted. */\n readonly deleted: number\n /** Per-target failures. Empty on full success. */\n readonly errors: readonly DeleteError[]\n}\n\n/** Emitted by {@link Bucket.deleteAll} once a file version has been successfully deleted. */\nexport interface DeleteAllDeleteEvent {\n /** Discriminant identifying a successful delete. */\n readonly type: 'delete'\n /** File name of the deleted version. */\n readonly fileName: string\n /** Unique identifier of the deleted version. */\n readonly fileId: FileId\n}\n\n/** Emitted by {@link Bucket.deleteAll} when a single delete call fails (other versions keep streaming). */\nexport interface DeleteAllErrorEvent {\n /** Discriminant identifying a per-version delete failure. */\n readonly type: 'error'\n /** File name of the version that failed to delete. */\n readonly fileName: string\n /** Unique identifier of the version that failed to delete. */\n readonly fileId: FileId\n /** Human-readable failure reason taken from the underlying error. */\n readonly message: string\n}\n\n/** Emitted by {@link Bucket.deleteAll} in `dryRun` mode for every version that would have been deleted. */\nexport interface DeleteAllSkipEvent {\n /** Discriminant identifying a dry-run skip. */\n readonly type: 'skip'\n /** File name of the version that would have been deleted. */\n readonly fileName: string\n /** Unique identifier of the version that would have been deleted. */\n readonly fileId: FileId\n}\n\n/** Event yielded by {@link Bucket.deleteAll} as it streams through file versions. */\nexport type DeleteAllEvent = DeleteAllDeleteEvent | DeleteAllErrorEvent | DeleteAllSkipEvent\n\ninterface BucketDefaultRetentionSnapshot {\n readonly retention?: BucketRetentionPolicy\n readonly unreadable: boolean\n}\n\nfunction bucketDefaultRetentionSnapshot(info: BucketInfo): 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: BucketUploadOptions): 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/**\n * Handle to a B2 bucket providing upload, download, listing, and management operations.\n *\n * Obtained via {@link B2Client.createBucket}, {@link B2Client.listBuckets}, or {@link B2Client.getBucket}.\n *\n * @example\n * ```ts\n * const bucket = await client.getBucket('my-bucket')\n * await bucket.upload({ fileName: 'hello.txt', source: new BufferSource(data) })\n * ```\n */\nexport class Bucket {\n /** Unique identifier for this bucket. */\n readonly id: BucketId\n /** Human-readable bucket name. */\n readonly name: string\n /** Full bucket metadata as returned by the B2 API. */\n readonly info: BucketInfo\n private readonly client: B2Client\n private readonly uploadRetryOptions: RetryOptions\n\n /**\n * @param client - The parent B2Client instance.\n * @param info - The bucket metadata from the API.\n * @param uploadRetryOptions - Resolved client upload retry defaults.\n *\n * @internal\n */\n constructor(client: B2Client, info: BucketInfo, uploadRetryOptions: RetryOptions) {\n this.client = client\n this.info = info\n this.id = info.bucketId\n this.name = info.bucketName\n this.uploadRetryOptions = uploadRetryOptions\n }\n\n /**\n * Returns a {@link B2Object} handle for a specific file name in this bucket.\n * @param fileName - The file path within the bucket.\n *\n * @returns A B2Object handle bound to this bucket and file name.\n */\n file(fileName: string): B2Object {\n return new B2Object(this.client, this, fileName, this.uploadRetryOptions)\n }\n\n /**\n * Uploads a file to this bucket. Automatically uses multipart upload for files\n * larger than the recommended part size.\n * @param options - Upload configuration including file name, source data, and optional settings.\n *\n * @returns Metadata for the uploaded file version.\n */\n async upload(options: BucketUploadOptions): 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) ? await this.refresh() : this.info\n const bucketDefaultRetention = bucketDefaultRetentionSnapshot(bucketInfo)\n return uploadLargeFile(this.client.raw, this.client.accountInfo, {\n ...options,\n bucketId: this.id,\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, 'Bucket.upload')\n const smallOptions = stripResumeOnlyOptions(options)\n return uploadSmallFile(this.client.raw, this.client.accountInfo, {\n ...smallOptions,\n bucketId: this.id,\n retry: uploadRetryOptions,\n })\n }\n\n /**\n * Downloads a file from this bucket by name. Pass `method: 'HEAD'` in\n * `options` to fetch only the response headers (file metadata) without\n * streaming the body.\n * @param fileName - The file name (path) to download.\n * @param options - Optional method, range, SSE-C decryption, response-header overrides, and abort signal.\n *\n * @returns The download result containing response headers and a readable body stream.\n */\n async download(fileName: string, options?: DownloadCallOptions): Promise<DownloadResult> {\n return downloadByName(this.client.raw, this.client.accountInfo, {\n bucketName: this.name,\n fileName,\n ...options,\n })\n }\n\n /**\n * Fetches the response headers (file metadata) for a file via HTTP\n * HEAD. Returns a body-less result so callers never have to drain\n * the (logically empty) HEAD body themselves.\n *\n * Use this for metadata-only checks like \"does this file exist\", \"what\n * is its current SHA-1\", \"what is its Content-Length\". For full file\n * retrieval use {@link Bucket.download}.\n *\n * @param fileName - The file name (path) to inspect.\n * @param options - Optional range, SSE-C decryption, response-header\n * overrides, and abort signal. Same shape as {@link Bucket.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 * @example\n * ```ts\n * const { headers } = await bucket.head('photos/2026/sunset.jpg')\n * console.log(headers.contentLength, headers.contentSha1)\n * ```\n */\n async head(fileName: string, options?: HeadCallOptions): Promise<HeadResult> {\n return headByName(this.client.raw, this.client.accountInfo, {\n bucketName: this.name,\n fileName,\n ...options,\n })\n }\n\n /**\n * Lists file names in this bucket (most recent versions only).\n * @param options - Optional filtering and pagination settings.\n *\n * @returns A page of file versions with an optional continuation token.\n */\n async listFileNames(options?: {\n /** Start listing after this file name (for pagination). */\n startFileName?: string\n /**\n * Maximum number of files to return per request (1-10000).\n * Forwarded to the raw API's `maxFileCount` parameter.\n */\n pageSize?: number\n /** Only list files with names starting with this prefix. */\n prefix?: string\n /** Delimiter for virtual directory grouping (typically `\"/\"`). */\n delimiter?: string\n /** Optional abort signal for the listing request. */\n signal?: AbortSignal\n }): Promise<ListFileNamesResponse> {\n return this.client.raw.listFileNames(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n {\n bucketId: this.id,\n ...(options?.startFileName !== undefined ? { startFileName: options.startFileName } : {}),\n ...(options?.pageSize !== undefined ? { maxFileCount: options.pageSize } : {}),\n ...(options?.prefix !== undefined ? { prefix: options.prefix } : {}),\n ...(options?.delimiter !== undefined ? { delimiter: options.delimiter } : {}),\n },\n {\n ...(options?.signal !== undefined ? { signal: options.signal } : {}),\n },\n )\n }\n\n /**\n * Lists all file versions in this bucket, including hidden files.\n * @param options - Optional filtering and pagination settings.\n *\n * @returns A page of file versions with an optional continuation token.\n */\n async listFileVersions(options?: {\n /** Start listing after this file name (for pagination). */\n startFileName?: string\n /** Start listing after this file ID (for pagination within a file name). */\n startFileId?: FileId\n /**\n * Maximum number of file versions to return per request (1-10000).\n * Forwarded to the raw API's `maxFileCount` parameter.\n */\n pageSize?: number\n /** Only list files with names starting with this prefix. */\n prefix?: string\n /** Delimiter for virtual directory grouping. */\n delimiter?: string\n /** Optional abort signal for the listing request. */\n signal?: AbortSignal\n }): Promise<ListFileVersionsResponse> {\n return this.client.raw.listFileVersions(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n {\n bucketId: this.id,\n ...(options?.startFileName !== undefined ? { startFileName: options.startFileName } : {}),\n ...(options?.startFileId !== undefined ? { startFileId: options.startFileId } : {}),\n ...(options?.pageSize !== undefined ? { maxFileCount: options.pageSize } : {}),\n ...(options?.prefix !== undefined ? { prefix: options.prefix } : {}),\n ...(options?.delimiter !== undefined ? { delimiter: options.delimiter } : {}),\n },\n {\n ...(options?.signal !== undefined ? { signal: options.signal } : {}),\n },\n )\n }\n\n /**\n * Async iterator that yields the latest visible version of every file in\n * the bucket, automatically handling pagination via `listFileNames`.\n *\n * Hidden files (those whose latest version is a hide marker) are NOT\n * yielded by this iterator. Use {@link paginateFileVersions} when you\n * need full version history.\n *\n * @param options - Filter + pagination + abort options. `pageSize` is\n * forwarded to `b2_list_file_names`'s `maxFileCount` (default 1000,\n * B2-capped at 10000).\n *\n * @returns An async iterable of {@link FileVersion} entries.\n *\n * @example\n * ```ts\n * for await (const file of bucket.paginateFileNames({ prefix: 'photos/' })) {\n * console.log(file.fileName, file.contentLength)\n * }\n * ```\n */\n paginateFileNames(\n options?: {\n /** Only yield files whose names start with this prefix. */\n prefix?: string\n /** Delimiter for virtual directory grouping (typically `'/'`). */\n delimiter?: string\n } & PaginatorOptions,\n ): AsyncIterableIterator<FileVersion> {\n return paginateItems(\n async (cursor: string | undefined) => {\n const resp = await this.listFileNames({\n pageSize: options?.pageSize ?? DEFAULT_PAGE_SIZE,\n ...(cursor !== undefined ? { startFileName: cursor } : {}),\n ...(options?.prefix !== undefined ? { prefix: options.prefix } : {}),\n ...(options?.delimiter !== undefined ? { delimiter: options.delimiter } : {}),\n ...(options?.signal !== undefined ? { signal: options.signal } : {}),\n })\n return { page: resp, nextCursor: resp.nextFileName ?? undefined }\n },\n // Real B2 surfaces hide markers as rows in `b2_list_file_names`. This\n // iterator's documented contract is \"latest VISIBLE version\", so we\n // drop hide-action rows here. Callers who need full history should\n // use `paginateFileVersions`.\n (page) => page.files.filter((f) => f.action !== 'hide'),\n options?.signal,\n )\n }\n\n /**\n * Async iterator that yields every version of every file in the bucket,\n * including hidden files and historical versions, automatically handling\n * pagination via `listFileVersions`.\n *\n * The two-cursor `(nextFileName, nextFileId)` continuation that the raw\n * endpoint exposes is threaded internally; callers iterate flat.\n *\n * @param options - Filter + pagination + abort options.\n *\n * @returns An async iterable of {@link FileVersion} entries.\n */\n paginateFileVersions(\n options?: {\n /** Only yield versions whose names start with this prefix. */\n prefix?: string\n /** Delimiter for virtual directory grouping. */\n delimiter?: string\n } & PaginatorOptions,\n ): AsyncIterableIterator<FileVersion> {\n type Cursor = { fileName: string; fileId: FileId | undefined }\n return paginateItems(\n async (cursor: Cursor | undefined) => {\n const resp = await this.listFileVersions({\n pageSize: options?.pageSize ?? DEFAULT_PAGE_SIZE,\n ...(cursor !== undefined ? { startFileName: cursor.fileName } : {}),\n ...(cursor?.fileId !== undefined ? { startFileId: cursor.fileId } : {}),\n ...(options?.prefix !== undefined ? { prefix: options.prefix } : {}),\n ...(options?.delimiter !== undefined ? { delimiter: options.delimiter } : {}),\n ...(options?.signal !== undefined ? { signal: options.signal } : {}),\n })\n const nextCursor: Cursor | undefined =\n resp.nextFileName !== null\n ? { fileName: resp.nextFileName, fileId: resp.nextFileId ?? undefined }\n : undefined\n return { page: resp, nextCursor }\n },\n (page) => page.files,\n options?.signal,\n )\n }\n\n /**\n * Async iterator that yields every unfinished large file in the bucket,\n * automatically handling pagination via `listUnfinishedLargeFiles`.\n *\n * Useful for janitorial scripts that want to inspect or cancel abandoned\n * multipart uploads (typically followed by {@link cancelLargeFile} on\n * the underlying raw client).\n *\n * @param options - Filter + pagination + abort options. `pageSize` is\n * B2-capped at 100 for this endpoint.\n *\n * @returns An async iterable of unfinished-large-file metadata entries.\n */\n paginateUnfinishedLargeFiles(\n options?: {\n /** Only yield large files whose names start with this prefix. */\n namePrefix?: string\n } & PaginatorOptions,\n ): AsyncIterableIterator<UnfinishedLargeFile> {\n return paginateItems(\n async (cursor: LargeFileId | undefined) => {\n const resp = await this.listUnfinishedLargeFiles({\n pageSize: options?.pageSize ?? 100,\n ...(cursor !== undefined ? { startFileId: cursor } : {}),\n ...(options?.namePrefix !== undefined ? { namePrefix: options.namePrefix } : {}),\n ...(options?.signal !== undefined ? { signal: options.signal } : {}),\n })\n return { page: resp, nextCursor: resp.nextFileId ?? undefined }\n },\n (page) => page.files,\n options?.signal,\n )\n }\n\n /**\n * Async iterator that yields every uploaded part for a specific large\n * file, automatically handling pagination via `listParts`.\n *\n * @param largeFileId - The unfinished large file to enumerate parts of.\n * @param options - Pagination + abort options. `pageSize` is B2-capped\n * at 1000 for this endpoint; the default is 1000.\n *\n * @returns An async iterable of {@link PartInfo} entries.\n */\n paginateParts(\n largeFileId: LargeFileId,\n options?: PaginatorOptions,\n ): AsyncIterableIterator<PartInfo> {\n return paginateItems(\n async (cursor: number | undefined) => {\n const resp = await this.client.raw.listParts(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n {\n fileId: largeFileId,\n maxPartCount: options?.pageSize ?? DEFAULT_PAGE_SIZE,\n ...(cursor !== undefined ? { startPartNumber: cursor } : {}),\n },\n options?.signal !== undefined ? { signal: options.signal } : undefined,\n )\n return { page: resp, nextCursor: resp.nextPartNumber ?? undefined }\n },\n (page) => page.parts,\n options?.signal,\n )\n }\n\n /**\n * Looks up the latest visible version of a file by name.\n * Uses `listFileNames` under the hood; returns `null` when the file does not\n * exist or its latest version is a hide marker.\n * @param fileName - The exact file path to look up.\n *\n * @returns The latest {@link FileVersion}, or `null` if not found.\n */\n async getFileInfoByName(fileName: string): Promise<FileVersion | null> {\n // `listFileNames` returns the most recent version per file name,\n // which may be a hide marker (real B2: `action: 'hide'`,\n // `contentLength: 0`). This helper's contract is \"latest LIVE\n // version\", so we treat a hide-action match as \"not found\".\n const resp = await this.listFileNames({ prefix: fileName, pageSize: 1 })\n const match = resp.files.find((f) => f.fileName === fileName)\n if (!match || match.action === 'hide') return null\n return match\n }\n\n /**\n * Removes the latest hide marker for a file, restoring visibility of the\n * previous upload. Returns the deleted hide marker, or `null` if there was\n * no hide marker to remove (file is already visible or does not exist).\n * @param fileName - The file path to unhide.\n *\n * @returns The deleted hide marker version, or `null` if nothing was hidden.\n */\n async unhideFile(fileName: string): Promise<FileVersion | null> {\n // The latest version of a hidden file appears in listFileVersions but not\n // in listFileNames. Walk versions until we find the hide marker on top.\n const resp = await this.listFileVersions({ prefix: fileName, pageSize: 100 })\n const versions = resp.files.filter((f) => f.fileName === fileName)\n if (versions.length === 0) return null\n // listFileVersions sorts by name asc then upload timestamp desc, so the\n // first entry is the latest version.\n const latest = versions[0]\n if (latest?.action !== 'hide') return null\n await this.deleteFileVersion(fileName, latest.fileId)\n return latest\n }\n\n /**\n * Hides a file by creating a hide marker. The file remains in version history but is no longer visible in `listFileNames`.\n * @param fileName - The file path to hide.\n * @param options - Optional request controls such as an abort signal.\n *\n * @returns Metadata for the newly created hide marker.\n */\n async hideFile(fileName: string, options?: { signal?: AbortSignal }): Promise<FileVersion> {\n return this.client.raw.hideFile(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n { bucketId: this.id, fileName },\n options,\n )\n }\n\n /**\n * Permanently deletes a specific file version. Both file name and file ID are required.\n *\n * If the file is under Object Lock retention, B2 will reject the\n * delete: compliance-mode files cannot be deleted until the retention\n * expires; governance-mode files require `bypassGovernance: true`\n * AND a calling key with the `bypassGovernance` capability. Files on\n * legal hold cannot be deleted by anyone until the hold is removed.\n *\n * @param fileName - The file path of the version to delete.\n * @param fileId - The unique identifier of the file version to delete.\n * @param options - Optional governance and abort controls.\n */\n async deleteFileVersion(\n fileName: string,\n fileId: FileId,\n options?: { bypassGovernance?: boolean; signal?: AbortSignal },\n ): Promise<void> {\n await this.client.raw.deleteFileVersion(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n {\n fileName,\n fileId,\n ...(options?.bypassGovernance !== undefined\n ? { bypassGovernance: options.bypassGovernance }\n : {}),\n },\n options?.signal !== undefined ? { signal: options.signal } : undefined,\n )\n }\n\n /**\n * Cancels an in-progress large file upload so the partial parts are not\n * retained or billed. The most common reason to call this is to clean up\n * abandoned multipart uploads surfaced by {@link listUnfinishedLargeFiles}.\n * @param fileId - The unique identifier of the unfinished large file to cancel.\n *\n * @returns Metadata about the cancelled large file.\n */\n async cancelLargeFile(fileId: LargeFileId): Promise<CancelLargeFileResponse> {\n return this.client.raw.cancelLargeFile(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n { fileId },\n )\n }\n\n /**\n * Lists large files in this bucket that were started but never finished or\n * cancelled. Wraps `b2_list_unfinished_large_files`.\n * @param options - Optional pagination filters.\n *\n * @returns The page of unfinished large files plus a continuation token.\n */\n async listUnfinishedLargeFiles(options?: {\n /** Restrict results to files whose name starts with this prefix. */\n namePrefix?: string\n /** Start listing at this file ID, inclusive (for pagination). */\n startFileId?: LargeFileId\n /**\n * Maximum number of files to return per request (1-100). Forwarded\n * to the raw API's `maxFileCount` parameter.\n */\n pageSize?: number\n /** Abort signal for cancelling the list request. */\n signal?: AbortSignal\n }) {\n return this.client.raw.listUnfinishedLargeFiles(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n {\n bucketId: this.id,\n ...(options?.namePrefix !== undefined ? { namePrefix: options.namePrefix } : {}),\n ...(options?.startFileId !== undefined ? { startFileId: options.startFileId } : {}),\n ...(options?.pageSize !== undefined ? { maxFileCount: options.pageSize } : {}),\n },\n options?.signal !== undefined ? { signal: options.signal } : undefined,\n )\n }\n\n /**\n * Deletes many file versions with bounded concurrency. Errors from individual\n * deletes are collected and returned rather than thrown, so partial success\n * does not abort the run.\n *\n * When `options.signal` is supplied and aborted, in-flight deletes\n * complete (they're already on the wire), but no new deletes start\n * after the abort fires. Subsequent targets are short-circuited to an\n * error entry so the result tally reflects what actually happened.\n * @param targets - File versions to delete.\n * @param options - Optional concurrency override and abort signal.\n * Concurrency defaults to the SDK-wide bulk-metadata setting\n * (currently 10, higher than transfer concurrency because each\n * task is a single tiny API round-trip).\n *\n * @returns A summary of successes and per-target errors.\n */\n async deleteMany(\n targets: readonly DeleteTarget[],\n options?: { concurrency?: number; signal?: AbortSignal },\n ): Promise<DeleteManyResult> {\n const concurrency = options?.concurrency ?? DEFAULT_BULK_CONCURRENCY\n const sem = new Semaphore(concurrency)\n const signal = options?.signal\n let deleted = 0\n const errors: DeleteError[] = []\n\n await Promise.all(\n targets.map(async (target) => {\n await sem.acquire()\n try {\n // Honour abort BETWEEN acquisitions: in-flight deletes\n // complete (they're already on the wire), but new tasks don't\n // start once the signal fires. Without this gate, aborting a\n // 1000-item deleteMany would still let the next `concurrency`\n // tasks dispatch before the caller's await returned.\n if (signal?.aborted) {\n errors.push({\n target,\n error: toError(signal.reason ?? 'aborted'),\n })\n return\n }\n await this.deleteFileVersion(target.fileName, target.fileId)\n deleted++\n } catch (err) {\n errors.push({\n target,\n error: toError(err),\n })\n } finally {\n sem.release()\n }\n }),\n )\n\n return { deleted, errors }\n }\n\n /**\n * Async generator that streams every file version in the bucket (optionally\n * filtered by prefix) and deletes each one. Yields a {@link DeleteAllEvent}\n * per file version. With `dryRun: true`, no deletes are performed but `skip`\n * events are still emitted.\n * @param options - Optional prefix filter, page size, and dry-run flag.\n *\n * @returns An async generator of per-file events.\n */\n async *deleteAll(options?: {\n /** Only delete file versions whose names start with this prefix. */\n prefix?: string\n /** Number of file versions fetched per API page (default 1000). */\n pageSize?: number\n /** If true, yield `skip` events without actually deleting anything. */\n dryRun?: boolean\n }): AsyncGenerator<DeleteAllEvent> {\n const dryRun = options?.dryRun ?? false\n const pageSize = options?.pageSize ?? DEFAULT_PAGE_SIZE\n\n let startFileName: string | undefined\n let startFileId: FileId | undefined\n while (true) {\n const page = await this.listFileVersions({\n pageSize,\n ...(options?.prefix !== undefined ? { prefix: options.prefix } : {}),\n ...(startFileName !== undefined ? { startFileName } : {}),\n ...(startFileId !== undefined ? { startFileId } : {}),\n })\n\n for (const version of page.files) {\n if (dryRun) {\n yield { type: 'skip', fileName: version.fileName, fileId: version.fileId }\n continue\n }\n try {\n await this.deleteFileVersion(version.fileName, version.fileId)\n yield { type: 'delete', fileName: version.fileName, fileId: version.fileId }\n } catch (err) {\n yield {\n type: 'error',\n fileName: version.fileName,\n fileId: version.fileId,\n message: toError(err).message,\n }\n }\n }\n\n if (!page.nextFileName) break\n startFileName = page.nextFileName\n startFileId = page.nextFileId ?? undefined\n }\n }\n\n /**\n * Creates a server-side copy of a file within or across buckets.\n * @param options - Copy configuration including source file ID and destination name.\n *\n * @returns Metadata for the newly created file version.\n */\n async copyFile(options: {\n /** File ID of the source file to copy. */\n sourceFileId: FileId\n /** Destination file name in the target bucket. */\n fileName: string\n /** Target bucket ID. Defaults to this bucket if omitted. */\n destinationBucketId?: BucketId\n /** Whether to copy or replace file metadata. */\n metadataDirective?: MetadataDirective\n /** Override content type (only with `REPLACE` metadata directive). */\n contentType?: string\n /** Override file info (only with `REPLACE` metadata directive). */\n fileInfo?: Record<string, string>\n /**\n * @deprecated Renamed to `destinationServerSideEncryption` for consistency with\n * multipart copy. Still honored as a fallback when the new field is absent.\n */\n serverSideEncryption?: EncryptionSetting\n /** Server-side encryption for the destination file. Preferred over `serverSideEncryption`. */\n destinationServerSideEncryption?: EncryptionSetting\n /** SSE-C settings for the source if it was uploaded with SSE-C. */\n sourceServerSideEncryption?: EncryptionSetting\n /** Optional abort signal for cancelling the copy request. */\n signal?: AbortSignal\n }): Promise<FileVersion> {\n const { serverSideEncryption, destinationServerSideEncryption, signal, ...copyOptions } =\n options\n const destinationEncryption = destinationServerSideEncryption ?? serverSideEncryption\n return this.client.raw.copyFile(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n {\n ...copyOptions,\n ...(destinationEncryption !== undefined\n ? { destinationServerSideEncryption: destinationEncryption }\n : {}),\n },\n signal !== undefined ? { signal } : undefined,\n )\n }\n\n /**\n * Copies a file via the server-side multipart protocol. Each part is copied\n * by reference through `b2_copy_part`; data never traverses the client. Falls\n * back to a single `copyFile` call when the source fits within a single part.\n * @param options - Copy parameters including source file ID, destination name, part size, and concurrency.\n *\n * @returns Metadata for the newly created destination file version.\n */\n async copyLargeFile(options: {\n /** File ID of the source file to copy. */\n sourceFileId: FileId\n /** Destination file name in the target bucket. */\n fileName: string\n /** Target bucket ID. Defaults to this bucket if omitted. */\n destinationBucketId?: BucketId\n /** Override content type for the destination. */\n contentType?: string\n /** Custom file info for the destination. */\n fileInfo?: Record<string, string>\n /** Server-side encryption for the destination file. */\n destinationServerSideEncryption?: EncryptionSetting\n /** SSE-C settings for the source if it was uploaded with SSE-C. */\n sourceServerSideEncryption?: EncryptionSetting\n /**\n * Callback invoked if best-effort cancellation fails, or if cancellation is\n * skipped because `b2_finish_large_file` may already have committed.\n */\n onCleanupFailure?: CleanupFailureListener\n /** Part size in bytes. Defaults to the account's recommended part size. */\n partSize?: number\n /**\n * Maximum number of parts copied in parallel. Defaults to the\n * SDK-wide transfer concurrency.\n */\n concurrency?: number\n /**\n * Optional abort signal. Aborting cancels any remaining parts and\n * triggers a best-effort `cancelLargeFile` on the unfinished upload.\n */\n signal?: AbortSignal\n }): Promise<FileVersion> {\n return copyLargeFile(this.client.raw, this.client.accountInfo, {\n sourceFileId: options.sourceFileId,\n fileName: options.fileName,\n ...(options.destinationBucketId !== undefined\n ? { destinationBucketId: options.destinationBucketId }\n : { destinationBucketId: this.id }),\n ...(options.contentType !== undefined ? { contentType: options.contentType } : {}),\n ...(options.fileInfo !== undefined ? { fileInfo: options.fileInfo } : {}),\n ...(options.destinationServerSideEncryption !== undefined\n ? { destinationServerSideEncryption: options.destinationServerSideEncryption }\n : {}),\n ...(options.sourceServerSideEncryption !== undefined\n ? { sourceServerSideEncryption: options.sourceServerSideEncryption }\n : {}),\n ...(options.partSize !== undefined ? { partSize: options.partSize } : {}),\n ...(options.concurrency !== undefined ? { concurrency: options.concurrency } : {}),\n ...(options.onCleanupFailure !== undefined\n ? { onCleanupFailure: options.onCleanupFailure }\n : {}),\n ...(options.signal !== undefined ? { signal: options.signal } : {}),\n })\n }\n\n /**\n * Updates bucket settings such as type, CORS, lifecycle rules, and encryption.\n * @param options - Fields to update. Omitted fields are left unchanged.\n *\n * @returns Updated bucket metadata.\n */\n async update(options: {\n /** Change the bucket access level. */\n bucketType?: BucketType\n /** Replace custom bucket metadata. */\n bucketInfo?: Record<string, string>\n /** Replace CORS rules. */\n corsRules?: CorsRule[]\n /** Change default server-side encryption. */\n defaultServerSideEncryption?: EncryptionSetting\n /** Change default file retention policy. */\n defaultRetention?: BucketRetentionPolicy\n /** Replace lifecycle rules. */\n lifecycleRules?: LifecycleRule[]\n /** Update replication configuration. */\n replicationConfiguration?: ReplicationConfiguration\n /** Optimistic locking: only update if the bucket revision matches. */\n ifRevisionIs?: number\n }): Promise<BucketInfo> {\n return this.client.raw.updateBucket(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n {\n accountId: accountId(this.client.accountInfo.getAccountId()),\n bucketId: this.id,\n ...options,\n },\n )\n }\n\n /**\n * Permanently deletes this bucket. The bucket must be empty (no file versions).\n *\n * @returns The deleted bucket metadata.\n */\n async delete(): Promise<BucketInfo> {\n return this.client.deleteBucket(this.id)\n }\n\n /**\n * Gets a download authorization token scoped to a file name prefix in this bucket.\n * @param fileNamePrefix - Only authorize downloads of files starting with this prefix.\n * @param validDurationInSeconds - How long the authorization is valid (1-604800 seconds).\n *\n * @returns The download authorization response containing a time-limited token.\n */\n async getDownloadAuthorization(\n fileNamePrefix: string,\n validDurationInSeconds: number,\n ): Promise<DownloadAuthorizationResponse> {\n return this.client.raw.getDownloadAuthorization(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n { bucketId: this.id, fileNamePrefix, validDurationInSeconds },\n )\n }\n\n /**\n * Gets the event notification rules configured for this bucket.\n *\n * @returns The current notification rules for this bucket.\n */\n async getNotificationRules(): Promise<GetBucketNotificationRulesResponse> {\n return this.client.raw.getBucketNotificationRules(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n { bucketId: this.id },\n )\n }\n\n /**\n * Replaces the event notification rules for this bucket.\n * @param rules - The new set of notification rules to apply.\n *\n * @returns The updated notification rules for this bucket.\n */\n async setNotificationRules(\n rules: EventNotificationRule[],\n ): Promise<GetBucketNotificationRulesResponse> {\n return this.client.raw.setBucketNotificationRules(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n { bucketId: this.id, eventNotificationRules: rules },\n )\n }\n\n /**\n * Updates the file retention policy for a specific file version. Requires file lock on the bucket.\n * @param fileName - The file path of the version to update.\n * @param fileId - The unique identifier of the file version.\n * @param retention - The new retention policy to apply.\n * @param options - Optional flags. Set `bypassGovernance: true` to shorten governance-mode retention.\n *\n * @returns The updated file retention metadata.\n */\n async updateFileRetention(\n fileName: string,\n fileId: FileId,\n retention: FileRetentionValue,\n options?: { bypassGovernance?: boolean },\n ) {\n return this.client.raw.updateFileRetention(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n {\n fileName,\n fileId,\n fileRetention: retention,\n ...(options?.bypassGovernance !== undefined\n ? { bypassGovernance: options.bypassGovernance }\n : {}),\n },\n )\n }\n\n /**\n * Updates the legal hold status for a specific file version. Requires file lock on the bucket.\n * @param fileName - The file path of the version to update.\n * @param fileId - The unique identifier of the file version.\n * @param legalHold - The new legal hold status to apply.\n *\n * @returns The updated legal hold metadata.\n */\n async updateFileLegalHold(fileName: string, fileId: FileId, legalHold: LegalHoldValue) {\n return this.client.raw.updateFileLegalHold(\n this.client.accountInfo.getApiUrl(),\n this.client.accountInfo.getAuthToken(),\n { fileName, fileId, legalHold },\n )\n }\n\n /**\n * Refetches this bucket's metadata from B2 so callers operating on\n * replication / lifecycle / retention configuration always start from the\n * server-of-record state.\n *\n * Bucket configuration is monotonically revisioned by B2: B2 increments\n * `revision` on every accepted update. The local {@link info} snapshot\n * captured at construction time goes stale as soon as anyone else (or any\n * prior `update()` call) mutates the bucket, so the ergonomic\n * add/remove helpers below always refresh before composing the next\n * `setX()` call. The result is that each helper is safe to call without\n * the caller having to thread BucketInfo through their code.\n *\n * @returns Fresh {@link BucketInfo} for this bucket.\n *\n * @throws If the bucket no longer exists.\n */\n private async refresh(): Promise<BucketInfo> {\n const fresh = await this.client.listBuckets({ bucketId: this.id })\n const found = fresh[0]\n if (!found) throw new Error(`Bucket ${this.id} not found`)\n return found.info\n }\n\n /**\n * Returns the current cross-region replication configuration, refetched\n * from B2.\n *\n * Use this when you need to read replication state without composing a\n * write. For add/remove flows the helper methods below handle the\n * refresh-then-set sequence for you.\n *\n * @returns The current {@link ReplicationConfiguration}.\n */\n async getReplication(): Promise<ReplicationConfiguration> {\n const fresh = await this.refresh()\n return fresh.replicationConfiguration\n }\n\n /**\n * Replaces this bucket's complete replication configuration.\n * @param replication - The new configuration. Pass an empty source/destination\n * pair (`{ asReplicationSource: null, asReplicationDestination: null }`)\n * to clear replication entirely.\n *\n * @returns The updated bucket metadata.\n */\n async setReplication(replication: ReplicationConfiguration): Promise<BucketInfo> {\n return this.update({ replicationConfiguration: replication })\n }\n\n /**\n * Adds (or replaces by `replicationRuleName`) a single replication rule\n * on this bucket while leaving any other rules, the source key, and the\n * destination key mapping untouched.\n *\n * When this is the very first source-side rule, `sourceApplicationKeyId`\n * must be supplied to seed `asReplicationSource.sourceApplicationKeyId`;\n * for subsequent calls the existing source key is reused unless the\n * caller explicitly overrides it.\n *\n * @param rule - The replication rule to add or replace.\n * @param options - Optional source application key ID override (or seed\n * when no source side exists yet).\n *\n * @returns The updated bucket metadata.\n *\n * @throws If no source-side replication exists yet and the caller did\n * not supply `sourceApplicationKeyId`.\n */\n async addReplicationRule(\n rule: ReplicationRule,\n options?: { sourceApplicationKeyId?: ApplicationKeyId },\n ): Promise<BucketInfo> {\n const current = (await this.refresh()).replicationConfiguration\n const existingSource = current.asReplicationSource\n const sourceKey = options?.sourceApplicationKeyId ?? existingSource?.sourceApplicationKeyId\n if (!sourceKey) {\n throw new Error(\n 'addReplicationRule: no existing source-side replication; pass options.sourceApplicationKeyId',\n )\n }\n const existingRules = existingSource?.replicationRules ?? []\n const without = existingRules.filter((r) => r.replicationRuleName !== rule.replicationRuleName)\n return this.setReplication({\n asReplicationSource: {\n sourceApplicationKeyId: sourceKey,\n replicationRules: [...without, rule],\n },\n asReplicationDestination: current.asReplicationDestination,\n })\n }\n\n /**\n * Removes a single replication rule by name. No-ops cleanly when the rule\n * is not present (returns the unchanged-but-revision-bumped bucket info).\n *\n * @param replicationRuleName - Name of the rule to remove.\n *\n * @returns The updated bucket metadata.\n */\n async removeReplicationRule(replicationRuleName: string): Promise<BucketInfo> {\n const current = (await this.refresh()).replicationConfiguration\n const existingSource = current.asReplicationSource\n if (!existingSource) {\n return this.setReplication(current)\n }\n const filtered = existingSource.replicationRules.filter(\n (r) => r.replicationRuleName !== replicationRuleName,\n )\n return this.setReplication({\n asReplicationSource: {\n sourceApplicationKeyId: existingSource.sourceApplicationKeyId,\n replicationRules: filtered,\n },\n asReplicationDestination: current.asReplicationDestination,\n })\n }\n\n /**\n * Returns the current lifecycle rules for this bucket, refetched from B2.\n *\n * @returns The current array of {@link LifecycleRule}s.\n */\n async getLifecycleRules(): Promise<readonly LifecycleRule[]> {\n const fresh = await this.refresh()\n return fresh.lifecycleRules\n }\n\n /**\n * Replaces this bucket's lifecycle rules in their entirety.\n * @param rules - The new rule set. Pass `[]` to remove all lifecycle\n * automation.\n *\n * @returns The updated bucket metadata.\n */\n async setLifecycleRules(rules: readonly LifecycleRule[]): Promise<BucketInfo> {\n return this.update({ lifecycleRules: [...rules] })\n }\n\n /**\n * Adds (or replaces, matched by `fileNamePrefix`) a single lifecycle rule\n * while leaving any other rules untouched.\n *\n * Matching on prefix mirrors B2's own data model: each unique prefix can\n * have at most one rule, and a `b2_update_bucket` call that contains two\n * rules with the same prefix is rejected. The helper enforces this for\n * the caller.\n *\n * @param rule - The lifecycle rule to add or replace.\n *\n * @returns The updated bucket metadata.\n */\n async addLifecycleRule(rule: LifecycleRule): Promise<BucketInfo> {\n const current = await this.getLifecycleRules()\n const without = current.filter((r) => r.fileNamePrefix !== rule.fileNamePrefix)\n return this.setLifecycleRules([...without, rule])\n }\n\n /**\n * Removes a single lifecycle rule by prefix. No-ops cleanly when the rule\n * is not present.\n *\n * @param fileNamePrefix - The prefix of the rule to remove.\n *\n * @returns The updated bucket metadata.\n */\n async removeLifecycleRule(fileNamePrefix: string): Promise<BucketInfo> {\n const current = await this.getLifecycleRules()\n return this.setLifecycleRules(current.filter((r) => r.fileNamePrefix !== fileNamePrefix))\n }\n\n /**\n * Returns the current default Object Lock retention policy for new\n * uploads to this bucket, refetched from B2.\n *\n * @returns The default {@link BucketRetentionPolicy} (which may be\n * `{ mode: 'none', period: null }` when Object Lock is enabled on the\n * bucket but no default is set).\n */\n async getDefaultRetention(): Promise<BucketRetentionPolicy> {\n const fresh = await this.refresh()\n return fresh.defaultRetention\n }\n\n /**\n * Sets (or clears, by passing `{ mode: 'none', period: null }`) the\n * default Object Lock retention policy applied to new uploads.\n *\n * Object Lock must already be enabled on the bucket. Buckets created\n * without `fileLockEnabled: true` cannot accept a default retention\n * policy and B2 will reject this call.\n *\n * @param policy - The new default retention policy.\n *\n * @returns The updated bucket metadata.\n */\n async setDefaultRetention(policy: BucketRetentionPolicy): Promise<BucketInfo> {\n return this.update({ defaultRetention: policy })\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAgHA,SAAS,+BAA+B,MAAkD;CACxF,MAAM,WAAW,KAAK;CACtB,IAAI,CAAC,SAAS,0BAA0B,OAAO,EAAE,YAAY,KAAK;CAClE,IAAI,SAAS,UAAU,MAAM,OAAO,EAAE,YAAY,MA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EAC7C,OAAO,KAAK,kBAAkB,QAAQ,QAAQ,MAAM,EAAE,mBAAmB,cAAc,CAAC;CAC1F;;;;;;;;;CAUA,MAAM,sBAAsD;EAE1D,QAAO,MADa,KAAK,QAAQ,EAAA,CACpB;CACf;;;;;;;;;;;;;CAcA,MAAM,oBAAoB,QAAoD;EAC5E,OAAO,KAAK,OAAO,EAAE,kBAAkB,OAAO,CAAC;CACjD;AACF"}
|
package/dist/bucket.d.cts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { B2Client } from './client.js';
|
|
2
2
|
import { DownloadResult, HeadResult } from './download/single.js';
|
|
3
|
+
import { RetryOptions } from './http/retry.js';
|
|
3
4
|
import { B2Object, DownloadCallOptions, HeadCallOptions } from './object.js';
|
|
4
|
-
import { ProgressListener } from './streams/progress.js';
|
|
5
|
-
import { ContentSource } from './streams/source.js';
|
|
6
5
|
import { BucketInfo, BucketRetentionPolicy, BucketType, CorsRule, LifecycleRule } from './types/bucket.js';
|
|
7
6
|
import { DownloadAuthorizationResponse } from './types/download.js';
|
|
8
7
|
import { EncryptionSetting } from './types/encryption.js';
|
|
@@ -12,6 +11,8 @@ import { FileRetentionValue, LegalHoldValue } from './types/lock.js';
|
|
|
12
11
|
import { EventNotificationRule, GetBucketNotificationRulesResponse } from './types/notifications.js';
|
|
13
12
|
import { ReplicationConfiguration, ReplicationRule } from './types/replication.js';
|
|
14
13
|
import { CancelLargeFileResponse, PartInfo, UnfinishedLargeFile } from './types/upload.js';
|
|
14
|
+
import { CleanupFailureListener } from './upload/cancel.js';
|
|
15
|
+
import { BucketUploadOptions } from './upload/options.js';
|
|
15
16
|
import { PaginatorOptions } from './util/paginator.js';
|
|
16
17
|
/** A target for bulk deletion: a file name and its specific version ID. */
|
|
17
18
|
export interface DeleteTarget {
|
|
@@ -84,13 +85,15 @@ export declare class Bucket {
|
|
|
84
85
|
/** Full bucket metadata as returned by the B2 API. */
|
|
85
86
|
readonly info: BucketInfo;
|
|
86
87
|
private readonly client;
|
|
88
|
+
private readonly uploadRetryOptions;
|
|
87
89
|
/**
|
|
88
90
|
* @param client - The parent B2Client instance.
|
|
89
91
|
* @param info - The bucket metadata from the API.
|
|
92
|
+
* @param uploadRetryOptions - Resolved client upload retry defaults.
|
|
90
93
|
*
|
|
91
94
|
* @internal
|
|
92
95
|
*/
|
|
93
|
-
constructor(client: B2Client, info: BucketInfo);
|
|
96
|
+
constructor(client: B2Client, info: BucketInfo, uploadRetryOptions: RetryOptions);
|
|
94
97
|
/**
|
|
95
98
|
* Returns a {@link B2Object} handle for a specific file name in this bucket.
|
|
96
99
|
* @param fileName - The file path within the bucket.
|
|
@@ -105,46 +108,7 @@ export declare class Bucket {
|
|
|
105
108
|
*
|
|
106
109
|
* @returns Metadata for the uploaded file version.
|
|
107
110
|
*/
|
|
108
|
-
upload(options:
|
|
109
|
-
/** Destination file name (path) in the bucket. */
|
|
110
|
-
fileName: string;
|
|
111
|
-
/** Data source to upload. Use {@link BufferSource}, {@link BlobSource}, or {@link StreamSource}. */
|
|
112
|
-
source: ContentSource;
|
|
113
|
-
/** MIME type. Defaults to `"b2/x-auto"` (auto-detected by B2). */
|
|
114
|
-
contentType?: string;
|
|
115
|
-
/** Custom key-value metadata stored with the file. */
|
|
116
|
-
fileInfo?: Record<string, string>;
|
|
117
|
-
/** Server-side encryption settings. */
|
|
118
|
-
serverSideEncryption?: EncryptionSetting;
|
|
119
|
-
/** File retention policy (requires file lock on the bucket). */
|
|
120
|
-
fileRetention?: FileRetentionValue;
|
|
121
|
-
/** Legal hold status for the file. */
|
|
122
|
-
legalHold?: LegalHoldValue;
|
|
123
|
-
/** Last-modified timestamp in milliseconds since epoch. */
|
|
124
|
-
lastModifiedMillis?: number;
|
|
125
|
-
/** Part size override for multipart uploads, in bytes. */
|
|
126
|
-
partSize?: number;
|
|
127
|
-
/** Number of concurrent part uploads for large files. */
|
|
128
|
-
concurrency?: number;
|
|
129
|
-
/** Callback invoked with upload progress events. */
|
|
130
|
-
onProgress?: ProgressListener;
|
|
131
|
-
/** Abort signal for cancelling the upload. */
|
|
132
|
-
signal?: AbortSignal;
|
|
133
|
-
/**
|
|
134
|
-
* Resume an unfinished multipart upload for this file name when one
|
|
135
|
-
* exists. Only consulted on the large-file path (source size
|
|
136
|
-
* greater than `recommendedPartSize`). On the small-file path this
|
|
137
|
-
* option is silently ignored. Sliceable sources only — `StreamSource`
|
|
138
|
-
* rejects resume because it can't replay parts.
|
|
139
|
-
*/
|
|
140
|
-
resume?: boolean;
|
|
141
|
-
/**
|
|
142
|
-
* Resume into a specific large-file ID. Overrides the `resume`
|
|
143
|
-
* discovery path. The local `partSize` must match the server-side
|
|
144
|
-
* plan.
|
|
145
|
-
*/
|
|
146
|
-
resumeFileId?: LargeFileId;
|
|
147
|
-
}): Promise<FileVersion>;
|
|
111
|
+
upload(options: BucketUploadOptions): Promise<FileVersion>;
|
|
148
112
|
/**
|
|
149
113
|
* Downloads a file from this bucket by name. Pass `method: 'HEAD'` in
|
|
150
114
|
* `options` to fetch only the response headers (file metadata) without
|
|
@@ -196,6 +160,8 @@ export declare class Bucket {
|
|
|
196
160
|
prefix?: string;
|
|
197
161
|
/** Delimiter for virtual directory grouping (typically `"/"`). */
|
|
198
162
|
delimiter?: string;
|
|
163
|
+
/** Optional abort signal for the listing request. */
|
|
164
|
+
signal?: AbortSignal;
|
|
199
165
|
}): Promise<ListFileNamesResponse>;
|
|
200
166
|
/**
|
|
201
167
|
* Lists all file versions in this bucket, including hidden files.
|
|
@@ -217,6 +183,8 @@ export declare class Bucket {
|
|
|
217
183
|
prefix?: string;
|
|
218
184
|
/** Delimiter for virtual directory grouping. */
|
|
219
185
|
delimiter?: string;
|
|
186
|
+
/** Optional abort signal for the listing request. */
|
|
187
|
+
signal?: AbortSignal;
|
|
220
188
|
}): Promise<ListFileVersionsResponse>;
|
|
221
189
|
/**
|
|
222
190
|
* Async iterator that yields the latest visible version of every file in
|
|
@@ -312,10 +280,13 @@ export declare class Bucket {
|
|
|
312
280
|
/**
|
|
313
281
|
* Hides a file by creating a hide marker. The file remains in version history but is no longer visible in `listFileNames`.
|
|
314
282
|
* @param fileName - The file path to hide.
|
|
283
|
+
* @param options - Optional request controls such as an abort signal.
|
|
315
284
|
*
|
|
316
285
|
* @returns Metadata for the newly created hide marker.
|
|
317
286
|
*/
|
|
318
|
-
hideFile(fileName: string
|
|
287
|
+
hideFile(fileName: string, options?: {
|
|
288
|
+
signal?: AbortSignal;
|
|
289
|
+
}): Promise<FileVersion>;
|
|
319
290
|
/**
|
|
320
291
|
* Permanently deletes a specific file version. Both file name and file ID are required.
|
|
321
292
|
*
|
|
@@ -327,10 +298,11 @@ export declare class Bucket {
|
|
|
327
298
|
*
|
|
328
299
|
* @param fileName - The file path of the version to delete.
|
|
329
300
|
* @param fileId - The unique identifier of the file version to delete.
|
|
330
|
-
* @param options - Optional
|
|
301
|
+
* @param options - Optional governance and abort controls.
|
|
331
302
|
*/
|
|
332
303
|
deleteFileVersion(fileName: string, fileId: FileId, options?: {
|
|
333
304
|
bypassGovernance?: boolean;
|
|
305
|
+
signal?: AbortSignal;
|
|
334
306
|
}): Promise<void>;
|
|
335
307
|
/**
|
|
336
308
|
* Cancels an in-progress large file upload so the partial parts are not
|
|
@@ -351,13 +323,15 @@ export declare class Bucket {
|
|
|
351
323
|
listUnfinishedLargeFiles(options?: {
|
|
352
324
|
/** Restrict results to files whose name starts with this prefix. */
|
|
353
325
|
namePrefix?: string;
|
|
354
|
-
/** Start listing
|
|
326
|
+
/** Start listing at this file ID, inclusive (for pagination). */
|
|
355
327
|
startFileId?: LargeFileId;
|
|
356
328
|
/**
|
|
357
329
|
* Maximum number of files to return per request (1-100). Forwarded
|
|
358
330
|
* to the raw API's `maxFileCount` parameter.
|
|
359
331
|
*/
|
|
360
332
|
pageSize?: number;
|
|
333
|
+
/** Abort signal for cancelling the list request. */
|
|
334
|
+
signal?: AbortSignal;
|
|
361
335
|
}): Promise<import('./index.js').ListUnfinishedLargeFilesResponse>;
|
|
362
336
|
/**
|
|
363
337
|
* Deletes many file versions with bounded concurrency. Errors from individual
|
|
@@ -416,8 +390,17 @@ export declare class Bucket {
|
|
|
416
390
|
contentType?: string;
|
|
417
391
|
/** Override file info (only with `REPLACE` metadata directive). */
|
|
418
392
|
fileInfo?: Record<string, string>;
|
|
419
|
-
/**
|
|
393
|
+
/**
|
|
394
|
+
* @deprecated Renamed to `destinationServerSideEncryption` for consistency with
|
|
395
|
+
* multipart copy. Still honored as a fallback when the new field is absent.
|
|
396
|
+
*/
|
|
420
397
|
serverSideEncryption?: EncryptionSetting;
|
|
398
|
+
/** Server-side encryption for the destination file. Preferred over `serverSideEncryption`. */
|
|
399
|
+
destinationServerSideEncryption?: EncryptionSetting;
|
|
400
|
+
/** SSE-C settings for the source if it was uploaded with SSE-C. */
|
|
401
|
+
sourceServerSideEncryption?: EncryptionSetting;
|
|
402
|
+
/** Optional abort signal for cancelling the copy request. */
|
|
403
|
+
signal?: AbortSignal;
|
|
421
404
|
}): Promise<FileVersion>;
|
|
422
405
|
/**
|
|
423
406
|
* Copies a file via the server-side multipart protocol. Each part is copied
|
|
@@ -442,6 +425,11 @@ export declare class Bucket {
|
|
|
442
425
|
destinationServerSideEncryption?: EncryptionSetting;
|
|
443
426
|
/** SSE-C settings for the source if it was uploaded with SSE-C. */
|
|
444
427
|
sourceServerSideEncryption?: EncryptionSetting;
|
|
428
|
+
/**
|
|
429
|
+
* Callback invoked if best-effort cancellation fails, or if cancellation is
|
|
430
|
+
* skipped because `b2_finish_large_file` may already have committed.
|
|
431
|
+
*/
|
|
432
|
+
onCleanupFailure?: CleanupFailureListener;
|
|
445
433
|
/** Part size in bytes. Defaults to the account's recommended part size. */
|
|
446
434
|
partSize?: number;
|
|
447
435
|
/**
|
package/dist/bucket.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bucket.d.ts","sourceRoot":"","sources":["../src/bucket.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EA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