@backblaze-labs/b2-sdk 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -1
- package/README.md +20 -2
- package/dist/_virtual/_b2-sdk-version-json.cjs +1 -1
- package/dist/_virtual/_b2-sdk-version-json.js +1 -1
- package/dist/auth/file.cjs.map +1 -1
- package/dist/backup/client.cjs +206 -0
- package/dist/backup/client.cjs.map +1 -0
- package/dist/backup/client.d.cts +238 -0
- package/dist/backup/client.d.cts.map +1 -0
- package/dist/backup/client.d.ts +238 -0
- package/dist/backup/client.d.ts.map +1 -0
- package/dist/backup/client.js +206 -0
- package/dist/backup/client.js.map +1 -0
- package/dist/backup/index.cjs +15 -0
- package/dist/backup/index.d.cts +22 -0
- package/dist/backup/index.d.cts.map +1 -0
- package/dist/backup/index.d.ts +22 -0
- package/dist/backup/index.d.ts.map +1 -0
- package/dist/backup/index.js +7 -0
- package/dist/backup/raw.cjs +146 -0
- package/dist/backup/raw.cjs.map +1 -0
- package/dist/backup/raw.d.cts +122 -0
- package/dist/backup/raw.d.cts.map +1 -0
- package/dist/backup/raw.d.ts +122 -0
- package/dist/backup/raw.d.ts.map +1 -0
- package/dist/backup/raw.js +146 -0
- package/dist/backup/raw.js.map +1 -0
- package/dist/bucket.cjs +2 -1
- package/dist/bucket.cjs.map +1 -1
- package/dist/bucket.js +2 -1
- package/dist/bucket.js.map +1 -1
- package/dist/copy/large.cjs +5 -3
- package/dist/copy/large.cjs.map +1 -1
- package/dist/copy/large.d.cts.map +1 -1
- package/dist/copy/large.d.ts.map +1 -1
- package/dist/copy/large.js +5 -3
- package/dist/copy/large.js.map +1 -1
- package/dist/download/checksum.cjs +6 -2
- package/dist/download/checksum.cjs.map +1 -1
- package/dist/download/checksum.js +6 -2
- package/dist/download/checksum.js.map +1 -1
- package/dist/download/parallel.cjs +52 -15
- package/dist/download/parallel.cjs.map +1 -1
- package/dist/download/parallel.d.cts +8 -1
- package/dist/download/parallel.d.cts.map +1 -1
- package/dist/download/parallel.d.ts +8 -1
- package/dist/download/parallel.d.ts.map +1 -1
- package/dist/download/parallel.js +52 -15
- package/dist/download/parallel.js.map +1 -1
- package/dist/download/single.cjs +141 -6
- package/dist/download/single.cjs.map +1 -1
- package/dist/download/single.d.cts.map +1 -1
- package/dist/download/single.d.ts.map +1 -1
- package/dist/download/single.js +141 -6
- package/dist/download/single.js.map +1 -1
- package/dist/errors/index.cjs +173 -3
- package/dist/errors/index.cjs.map +1 -1
- package/dist/errors/index.d.cts +119 -0
- package/dist/errors/index.d.cts.map +1 -1
- package/dist/errors/index.d.ts +119 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +161 -4
- package/dist/errors/index.js.map +1 -1
- package/dist/http/retry.cjs +1 -1
- package/dist/http/retry.cjs.map +1 -1
- package/dist/http/retry.js +1 -1
- package/dist/http/retry.js.map +1 -1
- package/dist/http/transport.cjs +61 -23
- package/dist/http/transport.cjs.map +1 -1
- package/dist/http/transport.d.cts +25 -3
- package/dist/http/transport.d.cts.map +1 -1
- package/dist/http/transport.d.ts +25 -3
- package/dist/http/transport.d.ts.map +1 -1
- package/dist/http/transport.js +59 -22
- package/dist/http/transport.js.map +1 -1
- package/dist/index.cjs +25 -2
- package/dist/index.d.cts +6 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -6
- package/dist/object.cjs +1 -1
- package/dist/object.cjs.map +1 -1
- package/dist/object.d.cts +4 -2
- package/dist/object.d.cts.map +1 -1
- package/dist/object.d.ts +4 -2
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +1 -1
- package/dist/object.js.map +1 -1
- package/dist/partner/account-info.d.cts +43 -0
- package/dist/partner/account-info.d.cts.map +1 -0
- package/dist/partner/account-info.d.ts +43 -0
- package/dist/partner/account-info.d.ts.map +1 -0
- package/dist/partner/auth-clone.cjs +64 -0
- package/dist/partner/auth-clone.cjs.map +1 -0
- package/dist/partner/auth-clone.d.cts +27 -0
- package/dist/partner/auth-clone.d.cts.map +1 -0
- package/dist/partner/auth-clone.d.ts +27 -0
- package/dist/partner/auth-clone.d.ts.map +1 -0
- package/dist/partner/auth-clone.js +63 -0
- package/dist/partner/auth-clone.js.map +1 -0
- package/dist/partner/auth-core.cjs +175 -0
- package/dist/partner/auth-core.cjs.map +1 -0
- package/dist/partner/auth-core.d.cts +111 -0
- package/dist/partner/auth-core.d.cts.map +1 -0
- package/dist/partner/auth-core.d.ts +111 -0
- package/dist/partner/auth-core.d.ts.map +1 -0
- package/dist/partner/auth-core.js +175 -0
- package/dist/partner/auth-core.js.map +1 -0
- package/dist/partner/auth-shape.cjs +36 -0
- package/dist/partner/auth-shape.cjs.map +1 -0
- package/dist/partner/auth-shape.d.cts +12 -0
- package/dist/partner/auth-shape.d.cts.map +1 -0
- package/dist/partner/auth-shape.d.ts +12 -0
- package/dist/partner/auth-shape.d.ts.map +1 -0
- package/dist/partner/auth-shape.js +36 -0
- package/dist/partner/auth-shape.js.map +1 -0
- package/dist/partner/client.cjs +255 -0
- package/dist/partner/client.cjs.map +1 -0
- package/dist/partner/client.d.cts +335 -0
- package/dist/partner/client.d.cts.map +1 -0
- package/dist/partner/client.d.ts +335 -0
- package/dist/partner/client.d.ts.map +1 -0
- package/dist/partner/client.js +255 -0
- package/dist/partner/client.js.map +1 -0
- package/dist/partner/endpoint-url.cjs +108 -0
- package/dist/partner/endpoint-url.cjs.map +1 -0
- package/dist/partner/endpoint-url.d.cts +72 -0
- package/dist/partner/endpoint-url.d.cts.map +1 -0
- package/dist/partner/endpoint-url.d.ts +72 -0
- package/dist/partner/endpoint-url.d.ts.map +1 -0
- package/dist/partner/endpoint-url.js +105 -0
- package/dist/partner/endpoint-url.js.map +1 -0
- package/dist/partner/in-memory.cjs +135 -0
- package/dist/partner/in-memory.cjs.map +1 -0
- package/dist/partner/in-memory.d.cts +99 -0
- package/dist/partner/in-memory.d.cts.map +1 -0
- package/dist/partner/in-memory.d.ts +99 -0
- package/dist/partner/in-memory.d.ts.map +1 -0
- package/dist/partner/in-memory.js +135 -0
- package/dist/partner/in-memory.js.map +1 -0
- package/dist/partner/index.cjs +18 -0
- package/dist/partner/index.d.cts +23 -0
- package/dist/partner/index.d.cts.map +1 -0
- package/dist/partner/index.d.ts +23 -0
- package/dist/partner/index.d.ts.map +1 -0
- package/dist/partner/index.js +7 -0
- package/dist/partner/raw.cjs +392 -0
- package/dist/partner/raw.cjs.map +1 -0
- package/dist/partner/raw.d.cts +223 -0
- package/dist/partner/raw.d.cts.map +1 -0
- package/dist/partner/raw.d.ts +223 -0
- package/dist/partner/raw.d.ts.map +1 -0
- package/dist/partner/raw.js +390 -0
- package/dist/partner/raw.js.map +1 -0
- package/dist/partner/redaction-placeholders.cjs +10 -0
- package/dist/partner/redaction-placeholders.cjs.map +1 -0
- package/dist/partner/redaction-placeholders.d.cts +5 -0
- package/dist/partner/redaction-placeholders.d.cts.map +1 -0
- package/dist/partner/redaction-placeholders.d.ts +5 -0
- package/dist/partner/redaction-placeholders.d.ts.map +1 -0
- package/dist/partner/redaction-placeholders.js +9 -0
- package/dist/partner/redaction-placeholders.js.map +1 -0
- package/dist/partner/redaction.cjs +267 -0
- package/dist/partner/redaction.cjs.map +1 -0
- package/dist/partner/redaction.d.cts +124 -0
- package/dist/partner/redaction.d.cts.map +1 -0
- package/dist/partner/redaction.d.ts +124 -0
- package/dist/partner/redaction.d.ts.map +1 -0
- package/dist/partner/redaction.js +257 -0
- package/dist/partner/redaction.js.map +1 -0
- package/dist/raw/index.cjs +81 -19
- package/dist/raw/index.cjs.map +1 -1
- package/dist/raw/index.d.cts +6 -2
- package/dist/raw/index.d.cts.map +1 -1
- package/dist/raw/index.d.ts +6 -2
- package/dist/raw/index.d.ts.map +1 -1
- package/dist/raw/index.js +81 -19
- package/dist/raw/index.js.map +1 -1
- package/dist/raw/url.cjs +111 -0
- package/dist/raw/url.cjs.map +1 -0
- package/dist/raw/url.d.cts +41 -0
- package/dist/raw/url.d.cts.map +1 -0
- package/dist/raw/url.d.ts +41 -0
- package/dist/raw/url.d.ts.map +1 -0
- package/dist/raw/url.js +110 -0
- package/dist/raw/url.js.map +1 -0
- package/dist/s3/sigv4.cjs +15 -10
- package/dist/s3/sigv4.cjs.map +1 -1
- package/dist/s3/sigv4.js +15 -10
- package/dist/s3/sigv4.js.map +1 -1
- package/dist/simulator/index.cjs +1197 -206
- package/dist/simulator/index.cjs.map +1 -1
- package/dist/simulator/index.d.cts +109 -11
- package/dist/simulator/index.d.cts.map +1 -1
- package/dist/simulator/index.d.ts +109 -11
- package/dist/simulator/index.d.ts.map +1 -1
- package/dist/simulator/index.js +1196 -209
- package/dist/simulator/index.js.map +1 -1
- package/dist/simulator/partner.cjs +719 -0
- package/dist/simulator/partner.cjs.map +1 -0
- package/dist/simulator/partner.d.cts +183 -0
- package/dist/simulator/partner.d.cts.map +1 -0
- package/dist/simulator/partner.d.ts +183 -0
- package/dist/simulator/partner.d.ts.map +1 -0
- package/dist/simulator/partner.js +718 -0
- package/dist/simulator/partner.js.map +1 -0
- package/dist/simulator/validation.cjs +577 -0
- package/dist/simulator/validation.cjs.map +1 -1
- package/dist/simulator/validation.d.cts +117 -0
- package/dist/simulator/validation.d.cts.map +1 -1
- package/dist/simulator/validation.d.ts +117 -0
- package/dist/simulator/validation.d.ts.map +1 -1
- package/dist/simulator/validation.js +563 -1
- package/dist/simulator/validation.js.map +1 -1
- package/dist/streams/file-source.cjs +1 -1
- package/dist/streams/file-source.cjs.map +1 -1
- package/dist/streams/file-source.js +1 -1
- package/dist/streams/file-source.js.map +1 -1
- package/dist/streams/index.cjs +1 -1
- package/dist/streams/index.js +1 -1
- package/dist/streams/source.cjs +2 -1
- package/dist/streams/source.cjs.map +1 -1
- package/dist/streams/source.js +2 -1
- package/dist/streams/source.js.map +1 -1
- package/dist/sync/b2-sha1-reader.cjs +6 -2
- package/dist/sync/b2-sha1-reader.cjs.map +1 -1
- package/dist/sync/b2-sha1-reader.d.cts.map +1 -1
- package/dist/sync/b2-sha1-reader.d.ts.map +1 -1
- package/dist/sync/b2-sha1-reader.js +6 -2
- package/dist/sync/b2-sha1-reader.js.map +1 -1
- package/dist/sync/download-staging.cjs +11 -10
- package/dist/sync/download-staging.cjs.map +1 -1
- package/dist/sync/download-staging.d.cts +2 -1
- package/dist/sync/download-staging.d.cts.map +1 -1
- package/dist/sync/download-staging.d.ts +2 -1
- package/dist/sync/download-staging.d.ts.map +1 -1
- package/dist/sync/download-staging.js +11 -10
- package/dist/sync/download-staging.js.map +1 -1
- package/dist/sync/filters.cjs.map +1 -1
- package/dist/sync/filters.js.map +1 -1
- package/dist/sync/local-file-io.cjs +11 -6
- package/dist/sync/local-file-io.cjs.map +1 -1
- package/dist/sync/local-file-io.d.cts +1 -0
- package/dist/sync/local-file-io.d.cts.map +1 -1
- package/dist/sync/local-file-io.d.ts +1 -0
- package/dist/sync/local-file-io.d.ts.map +1 -1
- package/dist/sync/local-file-io.js +11 -6
- package/dist/sync/local-file-io.js.map +1 -1
- package/dist/sync/local-sha1.cjs +6 -15
- package/dist/sync/local-sha1.cjs.map +1 -1
- package/dist/sync/local-sha1.d.cts +0 -8
- package/dist/sync/local-sha1.d.cts.map +1 -1
- package/dist/sync/local-sha1.d.ts +0 -8
- package/dist/sync/local-sha1.d.ts.map +1 -1
- package/dist/sync/local-sha1.js +7 -15
- package/dist/sync/local-sha1.js.map +1 -1
- package/dist/sync/policies/compare.cjs +5 -3
- package/dist/sync/policies/compare.cjs.map +1 -1
- package/dist/sync/policies/compare.d.cts.map +1 -1
- package/dist/sync/policies/compare.d.ts.map +1 -1
- package/dist/sync/policies/compare.js +6 -4
- package/dist/sync/policies/compare.js.map +1 -1
- package/dist/sync/policies/index.cjs +4 -10
- package/dist/sync/policies/index.cjs.map +1 -1
- package/dist/sync/policies/index.js +4 -10
- package/dist/sync/policies/index.js.map +1 -1
- package/dist/sync/scanners/b2.cjs +2 -2
- package/dist/sync/scanners/b2.cjs.map +1 -1
- package/dist/sync/scanners/b2.js +2 -2
- package/dist/sync/scanners/b2.js.map +1 -1
- package/dist/sync/scanners/local.cjs.map +1 -1
- package/dist/sync/scanners/local.js.map +1 -1
- package/dist/sync/synchronizer.cjs +3 -2
- package/dist/sync/synchronizer.cjs.map +1 -1
- package/dist/sync/synchronizer.js +3 -2
- package/dist/sync/synchronizer.js.map +1 -1
- package/dist/types/auth.cjs +4 -0
- package/dist/types/auth.cjs.map +1 -1
- package/dist/types/auth.d.cts +4 -0
- package/dist/types/auth.d.cts.map +1 -1
- package/dist/types/auth.d.ts +4 -0
- package/dist/types/auth.d.ts.map +1 -1
- package/dist/types/auth.js +4 -0
- package/dist/types/auth.js.map +1 -1
- package/dist/types/backup.d.cts +80 -0
- package/dist/types/backup.d.cts.map +1 -0
- package/dist/types/backup.d.ts +80 -0
- package/dist/types/backup.d.ts.map +1 -0
- package/dist/types/bucket.cjs.map +1 -1
- package/dist/types/bucket.d.cts +4 -2
- package/dist/types/bucket.d.cts.map +1 -1
- package/dist/types/bucket.d.ts +4 -2
- package/dist/types/bucket.d.ts.map +1 -1
- package/dist/types/bucket.js.map +1 -1
- package/dist/types/download.cjs +62 -0
- package/dist/types/download.cjs.map +1 -0
- package/dist/types/download.d.cts +98 -0
- package/dist/types/download.d.cts.map +1 -1
- package/dist/types/download.d.ts +98 -0
- package/dist/types/download.d.ts.map +1 -1
- package/dist/types/download.js +61 -0
- package/dist/types/download.js.map +1 -0
- package/dist/types/encryption.cjs +58 -229
- package/dist/types/encryption.cjs.map +1 -1
- package/dist/types/encryption.d.cts +32 -0
- package/dist/types/encryption.d.cts.map +1 -1
- package/dist/types/encryption.d.ts +32 -0
- package/dist/types/encryption.d.ts.map +1 -1
- package/dist/types/encryption.js +56 -229
- package/dist/types/encryption.js.map +1 -1
- package/dist/types/errors.cjs +9 -0
- package/dist/types/errors.cjs.map +1 -1
- package/dist/types/errors.d.cts +1 -1
- package/dist/types/errors.d.cts.map +1 -1
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +9 -0
- package/dist/types/errors.js.map +1 -1
- package/dist/types/file.cjs.map +1 -1
- package/dist/types/file.d.cts +15 -2
- package/dist/types/file.d.cts.map +1 -1
- package/dist/types/file.d.ts +15 -2
- package/dist/types/file.d.ts.map +1 -1
- package/dist/types/file.js.map +1 -1
- package/dist/types/ids.cjs +30 -0
- package/dist/types/ids.cjs.map +1 -1
- package/dist/types/ids.d.cts +32 -0
- package/dist/types/ids.d.cts.map +1 -1
- package/dist/types/ids.d.ts +32 -0
- package/dist/types/ids.d.ts.map +1 -1
- package/dist/types/ids.js +28 -1
- package/dist/types/ids.js.map +1 -1
- package/dist/types/index.d.cts +10 -6
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.ts +10 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lock.cjs.map +1 -1
- package/dist/types/lock.d.cts +14 -0
- package/dist/types/lock.d.cts.map +1 -1
- package/dist/types/lock.d.ts +14 -0
- package/dist/types/lock.d.ts.map +1 -1
- package/dist/types/lock.js.map +1 -1
- package/dist/types/notifications.cjs +1 -1
- package/dist/types/notifications.cjs.map +1 -1
- package/dist/types/notifications.d.cts +5 -3
- package/dist/types/notifications.d.cts.map +1 -1
- package/dist/types/notifications.d.ts +5 -3
- package/dist/types/notifications.d.ts.map +1 -1
- package/dist/types/notifications.js +1 -1
- package/dist/types/notifications.js.map +1 -1
- package/dist/types/partner.cjs +32 -0
- package/dist/types/partner.cjs.map +1 -0
- package/dist/types/partner.d.cts +394 -0
- package/dist/types/partner.d.cts.map +1 -0
- package/dist/types/partner.d.ts +394 -0
- package/dist/types/partner.d.ts.map +1 -0
- package/dist/types/partner.js +29 -0
- package/dist/types/partner.js.map +1 -0
- package/dist/types/upload.d.cts +31 -18
- package/dist/types/upload.d.cts.map +1 -1
- package/dist/types/upload.d.ts +31 -18
- package/dist/types/upload.d.ts.map +1 -1
- package/dist/upload/abort-scope.cjs +0 -45
- package/dist/upload/abort-scope.cjs.map +1 -1
- package/dist/upload/abort-scope.d.cts +0 -22
- package/dist/upload/abort-scope.d.cts.map +1 -1
- package/dist/upload/abort-scope.d.ts +0 -22
- package/dist/upload/abort-scope.d.ts.map +1 -1
- package/dist/upload/abort-scope.js +1 -44
- package/dist/upload/abort-scope.js.map +1 -1
- package/dist/upload/finish.cjs +3 -8
- package/dist/upload/finish.cjs.map +1 -1
- package/dist/upload/finish.d.cts.map +1 -1
- package/dist/upload/finish.d.ts.map +1 -1
- package/dist/upload/finish.js +1 -6
- package/dist/upload/finish.js.map +1 -1
- package/dist/upload/large.cjs +5 -1
- package/dist/upload/large.cjs.map +1 -1
- package/dist/upload/large.d.cts +16 -2
- package/dist/upload/large.d.cts.map +1 -1
- package/dist/upload/large.d.ts +16 -2
- package/dist/upload/large.d.ts.map +1 -1
- package/dist/upload/large.js +5 -1
- package/dist/upload/large.js.map +1 -1
- package/dist/upload/options.cjs.map +1 -1
- package/dist/upload/options.d.cts +12 -0
- package/dist/upload/options.d.cts.map +1 -1
- package/dist/upload/options.d.ts +12 -0
- package/dist/upload/options.d.ts.map +1 -1
- package/dist/upload/options.js.map +1 -1
- package/dist/upload/resume.cjs +2 -1
- package/dist/upload/resume.cjs.map +1 -1
- package/dist/upload/resume.d.cts +3 -1
- package/dist/upload/resume.d.cts.map +1 -1
- package/dist/upload/resume.d.ts +3 -1
- package/dist/upload/resume.d.ts.map +1 -1
- package/dist/upload/resume.js +2 -1
- package/dist/upload/resume.js.map +1 -1
- package/dist/upload/retry.cjs +8 -3
- package/dist/upload/retry.cjs.map +1 -1
- package/dist/upload/retry.js +8 -3
- package/dist/upload/retry.js.map +1 -1
- package/dist/upload/single.cjs +2 -1
- package/dist/upload/single.cjs.map +1 -1
- package/dist/upload/single.d.cts +6 -0
- package/dist/upload/single.d.cts.map +1 -1
- package/dist/upload/single.d.ts +6 -0
- package/dist/upload/single.d.ts.map +1 -1
- package/dist/upload/single.js +2 -1
- package/dist/upload/single.js.map +1 -1
- package/dist/upload/stream.cjs +6 -4
- package/dist/upload/stream.cjs.map +1 -1
- package/dist/upload/stream.d.cts +6 -0
- package/dist/upload/stream.d.cts.map +1 -1
- package/dist/upload/stream.d.ts +6 -0
- package/dist/upload/stream.d.ts.map +1 -1
- package/dist/upload/stream.js +3 -1
- package/dist/upload/stream.js.map +1 -1
- package/dist/util/abort.cjs +114 -0
- package/dist/util/abort.cjs.map +1 -0
- package/dist/util/abort.d.cts +65 -0
- package/dist/util/abort.d.cts.map +1 -0
- package/dist/util/abort.d.ts +65 -0
- package/dist/util/abort.d.ts.map +1 -0
- package/dist/util/abort.js +109 -0
- package/dist/util/abort.js.map +1 -0
- package/dist/util/defaults.cjs +3 -0
- package/dist/util/defaults.cjs.map +1 -1
- package/dist/util/defaults.d.cts +2 -0
- package/dist/util/defaults.d.cts.map +1 -1
- package/dist/util/defaults.d.ts +2 -0
- package/dist/util/defaults.d.ts.map +1 -1
- package/dist/util/defaults.js +3 -1
- package/dist/util/defaults.js.map +1 -1
- package/dist/util/md5.cjs +211 -0
- package/dist/util/md5.cjs.map +1 -0
- package/dist/util/md5.d.cts +43 -0
- package/dist/util/md5.d.cts.map +1 -0
- package/dist/util/md5.d.ts +43 -0
- package/dist/util/md5.d.ts.map +1 -0
- package/dist/util/md5.js +209 -0
- package/dist/util/md5.js.map +1 -0
- package/dist/util/normalize.cjs +5 -5
- package/dist/util/normalize.cjs.map +1 -1
- package/dist/util/normalize.d.cts +7 -7
- package/dist/util/normalize.d.cts.map +1 -1
- package/dist/util/normalize.d.ts +7 -7
- package/dist/util/normalize.d.ts.map +1 -1
- package/dist/util/normalize.js +5 -5
- package/dist/util/normalize.js.map +1 -1
- package/dist/util/paginator.cjs +7 -1
- package/dist/util/paginator.cjs.map +1 -1
- package/dist/util/paginator.d.cts +3 -1
- package/dist/util/paginator.d.cts.map +1 -1
- package/dist/util/paginator.d.ts +3 -1
- package/dist/util/paginator.d.ts.map +1 -1
- package/dist/util/paginator.js +7 -1
- package/dist/util/paginator.js.map +1 -1
- package/package.json +38 -16
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { RetryOptions } from '../http/retry.js';
|
|
2
|
+
import { HttpTransport } from '../http/transport.js';
|
|
3
|
+
import { UrlGuard } from '../http/url-guard.js';
|
|
4
|
+
import { PartnerAccountInfo } from '../partner/account-info.js';
|
|
5
|
+
import { ComputerBackup, DeleteComputerResponse, ListComputersResult } from '../types/backup.js';
|
|
6
|
+
import { AccountId, ComputerId } from '../types/ids.js';
|
|
7
|
+
import { PartnerAuthorizeResponse } from '../types/partner.js';
|
|
8
|
+
import { BackupRawClient } from './raw.js';
|
|
9
|
+
/**
|
|
10
|
+
* Configuration options for creating a {@link BackupClient}.
|
|
11
|
+
*
|
|
12
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
13
|
+
*/
|
|
14
|
+
export interface BackupClientOptions {
|
|
15
|
+
/** The Master Application Key ID for the partner administrator account. */
|
|
16
|
+
readonly masterKeyId: string;
|
|
17
|
+
/** The Master Application Key secret. */
|
|
18
|
+
readonly masterKey: string;
|
|
19
|
+
/**
|
|
20
|
+
* B2 realm to authenticate against. Accepts a known realm-map key
|
|
21
|
+
* (`"production"` or `"staging"`) or a direct base URL. Custom HTTPS hosts
|
|
22
|
+
* and loopback IP literal HTTP URLs for local testing are trusted with the
|
|
23
|
+
* Master Application Key during Partner authorize, so never derive `realm`
|
|
24
|
+
* from untrusted input. Defaults to `"production"`.
|
|
25
|
+
*/
|
|
26
|
+
readonly realm?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Shared Partner authorization state. Defaults to
|
|
29
|
+
* {@link InMemoryPartnerAccountInfo}. Pass the same store to
|
|
30
|
+
* {@link BackupClient} and Partner clients when both surfaces should reuse
|
|
31
|
+
* one Partner token. Cached authorization whose endpoints fail this client's
|
|
32
|
+
* realm policy is ignored locally until `authorize()` replaces it; shared
|
|
33
|
+
* stores are not cleared during construction.
|
|
34
|
+
*/
|
|
35
|
+
readonly partnerAccountInfo?: PartnerAccountInfo;
|
|
36
|
+
/** Custom HTTP transport. Defaults to `FetchTransport`. Wrapped by `RetryTransport`. */
|
|
37
|
+
readonly transport?: HttpTransport;
|
|
38
|
+
/** Override retry behavior (max retries, backoff, and per-attempt timeout). */
|
|
39
|
+
readonly retry?: Partial<RetryOptions>;
|
|
40
|
+
/** Custom user-agent string prepended to the SDK default. */
|
|
41
|
+
readonly userAgent?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Additional SSRF allow-list host suffixes for the default transport.
|
|
44
|
+
*
|
|
45
|
+
* Only consulted when {@link BackupClientOptions.transport} is unset; a
|
|
46
|
+
* custom transport is the user's responsibility to harden.
|
|
47
|
+
*/
|
|
48
|
+
readonly additionalAllowedHostSuffixes?: readonly string[];
|
|
49
|
+
/**
|
|
50
|
+
* Explicitly disable the default SSRF guard after authorize.
|
|
51
|
+
*
|
|
52
|
+
* Intended only for controlled simulator/private-proxy tests. Never enable
|
|
53
|
+
* it for URLs derived from untrusted input or production credentials.
|
|
54
|
+
*/
|
|
55
|
+
readonly disableSsrfGuard?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Follow same-origin GET/HEAD redirects in the default fetch transport after
|
|
58
|
+
* checking each target with the SSRF guard. POST redirects remain blocked.
|
|
59
|
+
* Defaults to true.
|
|
60
|
+
*/
|
|
61
|
+
readonly followSameOriginRedirects?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Allow direct custom authorize realms for tests or private proxies.
|
|
64
|
+
* Leave disabled unless the configured host is trusted with the Master
|
|
65
|
+
* Application Key.
|
|
66
|
+
*/
|
|
67
|
+
readonly allowCustomAuthorizeRealm?: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Options for Partner authorization performed by {@link BackupClient}.
|
|
71
|
+
*
|
|
72
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
73
|
+
*/
|
|
74
|
+
export interface BackupAuthorizeOptions {
|
|
75
|
+
/** Abort signal for cancelling the authorize request. */
|
|
76
|
+
readonly signal?: AbortSignal;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Options for listing Computer Backup records.
|
|
80
|
+
*
|
|
81
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
82
|
+
*/
|
|
83
|
+
export interface ListComputersOptions {
|
|
84
|
+
/**
|
|
85
|
+
* Account whose active computer backups should be listed. Defaults to the
|
|
86
|
+
* partner administrator account ID from authorization.
|
|
87
|
+
*/
|
|
88
|
+
readonly accountId?: AccountId;
|
|
89
|
+
/** Computer ID to start listing from for pagination. */
|
|
90
|
+
readonly startComputerId?: ComputerId;
|
|
91
|
+
/** Maximum computers to return in this page. Forwarded to `maxComputerCount`. */
|
|
92
|
+
readonly pageSize?: number;
|
|
93
|
+
/** Abort signal for cancelling the request. */
|
|
94
|
+
readonly signal?: AbortSignal;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Options for paginating Computer Backup records.
|
|
98
|
+
*
|
|
99
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
100
|
+
*/
|
|
101
|
+
export interface PaginateComputersOptions extends Omit<ListComputersOptions, 'startComputerId'> {
|
|
102
|
+
/**
|
|
103
|
+
* Aborts the iteration between page fetches. The signal is also forwarded to
|
|
104
|
+
* each underlying list request.
|
|
105
|
+
*/
|
|
106
|
+
readonly signal?: AbortSignal;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Options for deleting a Computer Backup record.
|
|
110
|
+
*
|
|
111
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
112
|
+
*/
|
|
113
|
+
export interface DeleteComputerOptions {
|
|
114
|
+
/**
|
|
115
|
+
* Account that owns the computer backup. Defaults to the partner
|
|
116
|
+
* administrator account ID from authorization.
|
|
117
|
+
*/
|
|
118
|
+
readonly accountId?: AccountId;
|
|
119
|
+
/** Computer ID of the backup to delete. */
|
|
120
|
+
readonly computerId: ComputerId;
|
|
121
|
+
/** Abort signal for cancelling the request. */
|
|
122
|
+
readonly signal?: AbortSignal;
|
|
123
|
+
}
|
|
124
|
+
/** Redacted JSON diagnostic shape emitted by {@link BackupClient.toJSON}. */
|
|
125
|
+
export interface BackupClientJson {
|
|
126
|
+
/** Object kind for log consumers. */
|
|
127
|
+
readonly type: 'BackupClient';
|
|
128
|
+
/** Redacted Master Application Key credential placeholder. */
|
|
129
|
+
readonly credentials: string;
|
|
130
|
+
/** Redacted Partner token placeholder, or unauthorized state. */
|
|
131
|
+
readonly authorization: string;
|
|
132
|
+
/** Whether this client currently has Partner authorization state. */
|
|
133
|
+
readonly authorized: boolean;
|
|
134
|
+
/** Current default URL guard suffixes, or null when a custom transport owns guarding. */
|
|
135
|
+
readonly urlGuardAllowedSuffixes: readonly string[] | null;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* High-level Computer Backup API client for listing and deleting backup records.
|
|
139
|
+
*
|
|
140
|
+
* The client uses Partner authorization and the `backupApiUrl` returned by
|
|
141
|
+
* `authorizePartner`. The target account must belong to a group with
|
|
142
|
+
* Enterprise Controls enabled, and the caller must be a group admin. Deleting
|
|
143
|
+
* a backup also requires the Enterprise Controls setting that permits admins
|
|
144
|
+
* to delete member backups.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```ts
|
|
148
|
+
* const backup = new BackupClient({
|
|
149
|
+
* masterKeyId: process.env.B2_MASTER_KEY_ID,
|
|
150
|
+
* masterKey: process.env.B2_MASTER_KEY,
|
|
151
|
+
* })
|
|
152
|
+
* await backup.authorize()
|
|
153
|
+
* for await (const computer of backup.paginateComputers()) {
|
|
154
|
+
* console.log(computer.computerName)
|
|
155
|
+
* }
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
159
|
+
*/
|
|
160
|
+
export declare class BackupClient {
|
|
161
|
+
/** Low-level client for direct Computer Backup API calls. */
|
|
162
|
+
readonly raw: BackupRawClient;
|
|
163
|
+
/** Partner authorization state storage (tokens, URLs, capabilities). */
|
|
164
|
+
readonly partnerAccountInfo: PartnerAccountInfo;
|
|
165
|
+
/**
|
|
166
|
+
* SSRF allow-list applied by the default transport. `null` when
|
|
167
|
+
* a custom transport was supplied; in that case the SDK does not own the
|
|
168
|
+
* guard.
|
|
169
|
+
*/
|
|
170
|
+
readonly urlGuard: UrlGuard | null;
|
|
171
|
+
private readonly authCore;
|
|
172
|
+
/**
|
|
173
|
+
* Creates a new BackupClient. Call {@link authorize} before making API requests
|
|
174
|
+
* unless `partnerAccountInfo` already contains valid Partner authorization.
|
|
175
|
+
*
|
|
176
|
+
* @param options - Configuration including credentials, realm, and transport settings.
|
|
177
|
+
*/
|
|
178
|
+
constructor(options: BackupClientOptions);
|
|
179
|
+
/**
|
|
180
|
+
* Authenticates with B2 Partner authorization and stores the authorization state.
|
|
181
|
+
*
|
|
182
|
+
* @param options - Optional abort signal.
|
|
183
|
+
*
|
|
184
|
+
* @returns The Partner authorization response containing tokens, URLs, and capabilities.
|
|
185
|
+
*
|
|
186
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
187
|
+
*/
|
|
188
|
+
authorize(options?: BackupAuthorizeOptions): Promise<PartnerAuthorizeResponse>;
|
|
189
|
+
/**
|
|
190
|
+
* Lists active Computer Backup records for an account.
|
|
191
|
+
*
|
|
192
|
+
* @param options - Optional target account and pagination settings.
|
|
193
|
+
*
|
|
194
|
+
* @returns A normalized page of computer backup records with an optional continuation cursor.
|
|
195
|
+
*
|
|
196
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
197
|
+
*/
|
|
198
|
+
listComputers(options?: ListComputersOptions): Promise<ListComputersResult>;
|
|
199
|
+
/**
|
|
200
|
+
* Async iterator that yields every active Computer Backup record for an account.
|
|
201
|
+
*
|
|
202
|
+
* @param options - Optional target account, page size, and abort signal.
|
|
203
|
+
*
|
|
204
|
+
* @returns An async iterable of {@link ComputerBackup} entries.
|
|
205
|
+
*
|
|
206
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
207
|
+
*/
|
|
208
|
+
paginateComputers(options?: PaginateComputersOptions): AsyncIterableIterator<ComputerBackup>;
|
|
209
|
+
/**
|
|
210
|
+
* Deletes a Computer Backup record.
|
|
211
|
+
*
|
|
212
|
+
* This destructive mutation is not automatically retried or reauthorized in
|
|
213
|
+
* place; callers should reconcile backup state before issuing a new delete
|
|
214
|
+
* after an ambiguous failure.
|
|
215
|
+
*
|
|
216
|
+
* @param options - Target account, computer ID, and optional abort signal.
|
|
217
|
+
*
|
|
218
|
+
* @returns The deleted computer backup record array.
|
|
219
|
+
*
|
|
220
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
221
|
+
*/
|
|
222
|
+
deleteComputer(options: DeleteComputerOptions): Promise<DeleteComputerResponse>;
|
|
223
|
+
private ensureBackupAuthorization;
|
|
224
|
+
private backupCoordinates;
|
|
225
|
+
/**
|
|
226
|
+
* Hides credentials and Partner tokens from `JSON.stringify(client)`.
|
|
227
|
+
*
|
|
228
|
+
* @returns A redacted diagnostic object.
|
|
229
|
+
*/
|
|
230
|
+
toJSON(): BackupClientJson;
|
|
231
|
+
/**
|
|
232
|
+
* Hides credentials and Partner tokens from default stringification.
|
|
233
|
+
*
|
|
234
|
+
* @returns A short redacted label.
|
|
235
|
+
*/
|
|
236
|
+
toString(): string;
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/backup/client.js"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,C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AC,GAAG,EAAE,eAAe,CAAA;IAC7B,wEAAwE;IACxE,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAA;IAC/C;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAA;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;IAE1C;;;;;OAKG;gBACS,OAAO,EAAE,mBAAmB;IAYxC;;;;;;;;OAQG;IACG,SAAS,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAMpF;;;;;;;;OAQG;IACG,aAAa,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAkBjF;;;;;;;;OAQG;IACH,iBAAiB,CAAC,OAAO,CAAC,EAAE,wBAAwB,GAAG,qBAAqB,CAAC,cAAc,CAAC;IAgB5F;;;;;;;;;;;;OAYG;IACG,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAcrF,OAAO,CAAC,yBAAyB;IAUjC,OAAO,CAAC,iBAAiB;IAiBzB;;;;OAIG;IACH,MAAM,IAAI,gBAAgB;IAW1B;;;;OAIG;IACH,QAAQ,IAAI,MAAM;CAYnB"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { RetryOptions } from '../http/retry.js';
|
|
2
|
+
import { HttpTransport } from '../http/transport.js';
|
|
3
|
+
import { UrlGuard } from '../http/url-guard.js';
|
|
4
|
+
import { PartnerAccountInfo } from '../partner/account-info.js';
|
|
5
|
+
import { ComputerBackup, DeleteComputerResponse, ListComputersResult } from '../types/backup.js';
|
|
6
|
+
import { AccountId, ComputerId } from '../types/ids.js';
|
|
7
|
+
import { PartnerAuthorizeResponse } from '../types/partner.js';
|
|
8
|
+
import { BackupRawClient } from './raw.js';
|
|
9
|
+
/**
|
|
10
|
+
* Configuration options for creating a {@link BackupClient}.
|
|
11
|
+
*
|
|
12
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
13
|
+
*/
|
|
14
|
+
export interface BackupClientOptions {
|
|
15
|
+
/** The Master Application Key ID for the partner administrator account. */
|
|
16
|
+
readonly masterKeyId: string;
|
|
17
|
+
/** The Master Application Key secret. */
|
|
18
|
+
readonly masterKey: string;
|
|
19
|
+
/**
|
|
20
|
+
* B2 realm to authenticate against. Accepts a known realm-map key
|
|
21
|
+
* (`"production"` or `"staging"`) or a direct base URL. Custom HTTPS hosts
|
|
22
|
+
* and loopback IP literal HTTP URLs for local testing are trusted with the
|
|
23
|
+
* Master Application Key during Partner authorize, so never derive `realm`
|
|
24
|
+
* from untrusted input. Defaults to `"production"`.
|
|
25
|
+
*/
|
|
26
|
+
readonly realm?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Shared Partner authorization state. Defaults to
|
|
29
|
+
* {@link InMemoryPartnerAccountInfo}. Pass the same store to
|
|
30
|
+
* {@link BackupClient} and Partner clients when both surfaces should reuse
|
|
31
|
+
* one Partner token. Cached authorization whose endpoints fail this client's
|
|
32
|
+
* realm policy is ignored locally until `authorize()` replaces it; shared
|
|
33
|
+
* stores are not cleared during construction.
|
|
34
|
+
*/
|
|
35
|
+
readonly partnerAccountInfo?: PartnerAccountInfo;
|
|
36
|
+
/** Custom HTTP transport. Defaults to `FetchTransport`. Wrapped by `RetryTransport`. */
|
|
37
|
+
readonly transport?: HttpTransport;
|
|
38
|
+
/** Override retry behavior (max retries, backoff, and per-attempt timeout). */
|
|
39
|
+
readonly retry?: Partial<RetryOptions>;
|
|
40
|
+
/** Custom user-agent string prepended to the SDK default. */
|
|
41
|
+
readonly userAgent?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Additional SSRF allow-list host suffixes for the default transport.
|
|
44
|
+
*
|
|
45
|
+
* Only consulted when {@link BackupClientOptions.transport} is unset; a
|
|
46
|
+
* custom transport is the user's responsibility to harden.
|
|
47
|
+
*/
|
|
48
|
+
readonly additionalAllowedHostSuffixes?: readonly string[];
|
|
49
|
+
/**
|
|
50
|
+
* Explicitly disable the default SSRF guard after authorize.
|
|
51
|
+
*
|
|
52
|
+
* Intended only for controlled simulator/private-proxy tests. Never enable
|
|
53
|
+
* it for URLs derived from untrusted input or production credentials.
|
|
54
|
+
*/
|
|
55
|
+
readonly disableSsrfGuard?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Follow same-origin GET/HEAD redirects in the default fetch transport after
|
|
58
|
+
* checking each target with the SSRF guard. POST redirects remain blocked.
|
|
59
|
+
* Defaults to true.
|
|
60
|
+
*/
|
|
61
|
+
readonly followSameOriginRedirects?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Allow direct custom authorize realms for tests or private proxies.
|
|
64
|
+
* Leave disabled unless the configured host is trusted with the Master
|
|
65
|
+
* Application Key.
|
|
66
|
+
*/
|
|
67
|
+
readonly allowCustomAuthorizeRealm?: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Options for Partner authorization performed by {@link BackupClient}.
|
|
71
|
+
*
|
|
72
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
73
|
+
*/
|
|
74
|
+
export interface BackupAuthorizeOptions {
|
|
75
|
+
/** Abort signal for cancelling the authorize request. */
|
|
76
|
+
readonly signal?: AbortSignal;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Options for listing Computer Backup records.
|
|
80
|
+
*
|
|
81
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
82
|
+
*/
|
|
83
|
+
export interface ListComputersOptions {
|
|
84
|
+
/**
|
|
85
|
+
* Account whose active computer backups should be listed. Defaults to the
|
|
86
|
+
* partner administrator account ID from authorization.
|
|
87
|
+
*/
|
|
88
|
+
readonly accountId?: AccountId;
|
|
89
|
+
/** Computer ID to start listing from for pagination. */
|
|
90
|
+
readonly startComputerId?: ComputerId;
|
|
91
|
+
/** Maximum computers to return in this page. Forwarded to `maxComputerCount`. */
|
|
92
|
+
readonly pageSize?: number;
|
|
93
|
+
/** Abort signal for cancelling the request. */
|
|
94
|
+
readonly signal?: AbortSignal;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Options for paginating Computer Backup records.
|
|
98
|
+
*
|
|
99
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
100
|
+
*/
|
|
101
|
+
export interface PaginateComputersOptions extends Omit<ListComputersOptions, 'startComputerId'> {
|
|
102
|
+
/**
|
|
103
|
+
* Aborts the iteration between page fetches. The signal is also forwarded to
|
|
104
|
+
* each underlying list request.
|
|
105
|
+
*/
|
|
106
|
+
readonly signal?: AbortSignal;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Options for deleting a Computer Backup record.
|
|
110
|
+
*
|
|
111
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
112
|
+
*/
|
|
113
|
+
export interface DeleteComputerOptions {
|
|
114
|
+
/**
|
|
115
|
+
* Account that owns the computer backup. Defaults to the partner
|
|
116
|
+
* administrator account ID from authorization.
|
|
117
|
+
*/
|
|
118
|
+
readonly accountId?: AccountId;
|
|
119
|
+
/** Computer ID of the backup to delete. */
|
|
120
|
+
readonly computerId: ComputerId;
|
|
121
|
+
/** Abort signal for cancelling the request. */
|
|
122
|
+
readonly signal?: AbortSignal;
|
|
123
|
+
}
|
|
124
|
+
/** Redacted JSON diagnostic shape emitted by {@link BackupClient.toJSON}. */
|
|
125
|
+
export interface BackupClientJson {
|
|
126
|
+
/** Object kind for log consumers. */
|
|
127
|
+
readonly type: 'BackupClient';
|
|
128
|
+
/** Redacted Master Application Key credential placeholder. */
|
|
129
|
+
readonly credentials: string;
|
|
130
|
+
/** Redacted Partner token placeholder, or unauthorized state. */
|
|
131
|
+
readonly authorization: string;
|
|
132
|
+
/** Whether this client currently has Partner authorization state. */
|
|
133
|
+
readonly authorized: boolean;
|
|
134
|
+
/** Current default URL guard suffixes, or null when a custom transport owns guarding. */
|
|
135
|
+
readonly urlGuardAllowedSuffixes: readonly string[] | null;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* High-level Computer Backup API client for listing and deleting backup records.
|
|
139
|
+
*
|
|
140
|
+
* The client uses Partner authorization and the `backupApiUrl` returned by
|
|
141
|
+
* `authorizePartner`. The target account must belong to a group with
|
|
142
|
+
* Enterprise Controls enabled, and the caller must be a group admin. Deleting
|
|
143
|
+
* a backup also requires the Enterprise Controls setting that permits admins
|
|
144
|
+
* to delete member backups.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```ts
|
|
148
|
+
* const backup = new BackupClient({
|
|
149
|
+
* masterKeyId: process.env.B2_MASTER_KEY_ID,
|
|
150
|
+
* masterKey: process.env.B2_MASTER_KEY,
|
|
151
|
+
* })
|
|
152
|
+
* await backup.authorize()
|
|
153
|
+
* for await (const computer of backup.paginateComputers()) {
|
|
154
|
+
* console.log(computer.computerName)
|
|
155
|
+
* }
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
159
|
+
*/
|
|
160
|
+
export declare class BackupClient {
|
|
161
|
+
/** Low-level client for direct Computer Backup API calls. */
|
|
162
|
+
readonly raw: BackupRawClient;
|
|
163
|
+
/** Partner authorization state storage (tokens, URLs, capabilities). */
|
|
164
|
+
readonly partnerAccountInfo: PartnerAccountInfo;
|
|
165
|
+
/**
|
|
166
|
+
* SSRF allow-list applied by the default transport. `null` when
|
|
167
|
+
* a custom transport was supplied; in that case the SDK does not own the
|
|
168
|
+
* guard.
|
|
169
|
+
*/
|
|
170
|
+
readonly urlGuard: UrlGuard | null;
|
|
171
|
+
private readonly authCore;
|
|
172
|
+
/**
|
|
173
|
+
* Creates a new BackupClient. Call {@link authorize} before making API requests
|
|
174
|
+
* unless `partnerAccountInfo` already contains valid Partner authorization.
|
|
175
|
+
*
|
|
176
|
+
* @param options - Configuration including credentials, realm, and transport settings.
|
|
177
|
+
*/
|
|
178
|
+
constructor(options: BackupClientOptions);
|
|
179
|
+
/**
|
|
180
|
+
* Authenticates with B2 Partner authorization and stores the authorization state.
|
|
181
|
+
*
|
|
182
|
+
* @param options - Optional abort signal.
|
|
183
|
+
*
|
|
184
|
+
* @returns The Partner authorization response containing tokens, URLs, and capabilities.
|
|
185
|
+
*
|
|
186
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
187
|
+
*/
|
|
188
|
+
authorize(options?: BackupAuthorizeOptions): Promise<PartnerAuthorizeResponse>;
|
|
189
|
+
/**
|
|
190
|
+
* Lists active Computer Backup records for an account.
|
|
191
|
+
*
|
|
192
|
+
* @param options - Optional target account and pagination settings.
|
|
193
|
+
*
|
|
194
|
+
* @returns A normalized page of computer backup records with an optional continuation cursor.
|
|
195
|
+
*
|
|
196
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
197
|
+
*/
|
|
198
|
+
listComputers(options?: ListComputersOptions): Promise<ListComputersResult>;
|
|
199
|
+
/**
|
|
200
|
+
* Async iterator that yields every active Computer Backup record for an account.
|
|
201
|
+
*
|
|
202
|
+
* @param options - Optional target account, page size, and abort signal.
|
|
203
|
+
*
|
|
204
|
+
* @returns An async iterable of {@link ComputerBackup} entries.
|
|
205
|
+
*
|
|
206
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
207
|
+
*/
|
|
208
|
+
paginateComputers(options?: PaginateComputersOptions): AsyncIterableIterator<ComputerBackup>;
|
|
209
|
+
/**
|
|
210
|
+
* Deletes a Computer Backup record.
|
|
211
|
+
*
|
|
212
|
+
* This destructive mutation is not automatically retried or reauthorized in
|
|
213
|
+
* place; callers should reconcile backup state before issuing a new delete
|
|
214
|
+
* after an ambiguous failure.
|
|
215
|
+
*
|
|
216
|
+
* @param options - Target account, computer ID, and optional abort signal.
|
|
217
|
+
*
|
|
218
|
+
* @returns The deleted computer backup record array.
|
|
219
|
+
*
|
|
220
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
221
|
+
*/
|
|
222
|
+
deleteComputer(options: DeleteComputerOptions): Promise<DeleteComputerResponse>;
|
|
223
|
+
private ensureBackupAuthorization;
|
|
224
|
+
private backupCoordinates;
|
|
225
|
+
/**
|
|
226
|
+
* Hides credentials and Partner tokens from `JSON.stringify(client)`.
|
|
227
|
+
*
|
|
228
|
+
* @returns A redacted diagnostic object.
|
|
229
|
+
*/
|
|
230
|
+
toJSON(): BackupClientJson;
|
|
231
|
+
/**
|
|
232
|
+
* Hides credentials and Partner tokens from default stringification.
|
|
233
|
+
*
|
|
234
|
+
* @returns A short redacted label.
|
|
235
|
+
*/
|
|
236
|
+
toString(): string;
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/backup/client.js"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAGpE,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EAEtB,mBAAmB,EACpB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAiC,MAAM,iBAAiB,CAAA;AAChG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAI1C;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,yCAAyC;IACzC,QAAQ,CAAC,S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