@backblaze-labs/b2-sdk 0.1.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 +151 -5
- package/README.md +163 -34
- 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/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 +786 -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 +781 -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 +116 -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 +114 -69
- package/dist/copy/large.js.map +1 -1
- package/dist/download/checksum.cjs +93 -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 +91 -0
- package/dist/download/checksum.js.map +1 -0
- package/dist/download/parallel.cjs +251 -118
- package/dist/download/parallel.cjs.map +1 -1
- package/dist/download/parallel.d.cts +13 -2
- package/dist/download/parallel.d.cts.map +1 -1
- package/dist/download/parallel.d.ts +13 -2
- package/dist/download/parallel.d.ts.map +1 -1
- package/dist/download/parallel.js +249 -116
- package/dist/download/parallel.js.map +1 -1
- package/dist/download/single.cjs +323 -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 +322 -99
- package/dist/download/single.js.map +1 -1
- package/dist/errors/index.cjs +869 -243
- package/dist/errors/index.cjs.map +1 -1
- package/dist/errors/index.d.cts +404 -82
- package/dist/errors/index.d.cts.map +1 -1
- package/dist/errors/index.d.ts +404 -82
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +835 -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 +476 -140
- package/dist/http/transport.cjs.map +1 -1
- package/dist/http/transport.d.cts +46 -5
- package/dist/http/transport.d.cts.map +1 -1
- package/dist/http/transport.d.ts +46 -5
- package/dist/http/transport.d.ts.map +1 -1
- package/dist/http/transport.js +474 -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 +124 -77
- package/dist/index.d.cts +29 -21
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +29 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -72
- 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 +13 -57
- package/dist/object.d.cts.map +1 -1
- package/dist/object.d.ts +13 -57
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +249 -206
- 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/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 +740 -587
- package/dist/raw/index.cjs.map +1 -1
- package/dist/raw/index.d.cts +126 -19
- package/dist/raw/index.d.cts.map +1 -1
- package/dist/raw/index.d.ts +126 -19
- package/dist/raw/index.d.ts.map +1 -1
- package/dist/raw/index.js +736 -589
- 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/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 +154 -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 +153 -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 +3114 -1547
- package/dist/simulator/index.cjs.map +1 -1
- package/dist/simulator/index.d.cts +186 -20
- package/dist/simulator/index.d.cts.map +1 -1
- package/dist/simulator/index.d.ts +186 -20
- package/dist/simulator/index.d.ts.map +1 -1
- package/dist/simulator/index.js +3098 -1545
- 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 +772 -157
- package/dist/simulator/validation.cjs.map +1 -1
- package/dist/simulator/validation.d.cts +120 -21
- package/dist/simulator/validation.d.cts.map +1 -1
- package/dist/simulator/validation.d.ts +120 -21
- package/dist/simulator/validation.d.ts.map +1 -1
- package/dist/simulator/validation.js +755 -167
- 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 +3 -11
- 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 +317 -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 +313 -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 +152 -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 +149 -0
- package/dist/sync/b2-sha1-reader.js.map +1 -0
- package/dist/sync/download-staging.cjs +266 -0
- package/dist/sync/download-staging.cjs.map +1 -0
- package/dist/sync/download-staging.d.cts +55 -0
- package/dist/sync/download-staging.d.cts.map +1 -0
- package/dist/sync/download-staging.d.ts +55 -0
- package/dist/sync/download-staging.d.ts.map +1 -0
- package/dist/sync/download-staging.js +260 -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 +369 -0
- package/dist/sync/local-file-io.cjs.map +1 -0
- package/dist/sync/local-file-io.d.cts +76 -0
- package/dist/sync/local-file-io.d.cts.map +1 -0
- package/dist/sync/local-file-io.d.ts +76 -0
- package/dist/sync/local-file-io.d.ts.map +1 -0
- package/dist/sync/local-file-io.js +365 -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 +110 -0
- package/dist/sync/local-sha1.cjs.map +1 -0
- package/dist/sync/local-sha1.d.cts +31 -0
- package/dist/sync/local-sha1.d.cts.map +1 -0
- package/dist/sync/local-sha1.d.ts +31 -0
- package/dist/sync/local-sha1.d.ts.map +1 -0
- package/dist/sync/local-sha1.js +109 -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 +391 -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 +389 -13
- package/dist/sync/policies/compare.js.map +1 -1
- package/dist/sync/policies/index.cjs +70 -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 +70 -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 +783 -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 +780 -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 +80 -56
- package/dist/types/auth.cjs.map +1 -1
- package/dist/types/auth.d.cts +71 -9
- package/dist/types/auth.d.cts.map +1 -1
- package/dist/types/auth.d.ts +71 -9
- package/dist/types/auth.d.ts.map +1 -1
- package/dist/types/auth.js +81 -57
- 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 +74 -38
- 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 +75 -41
- 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 +194 -328
- package/dist/types/encryption.cjs.map +1 -1
- package/dist/types/encryption.d.cts +48 -0
- package/dist/types/encryption.d.cts.map +1 -1
- package/dist/types/encryption.d.ts +48 -0
- package/dist/types/encryption.d.ts.map +1 -1
- package/dist/types/encryption.js +192 -311
- package/dist/types/encryption.js.map +1 -1
- package/dist/types/errors.cjs +56 -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 +56 -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 +17 -4
- package/dist/types/file.d.cts.map +1 -1
- package/dist/types/file.d.ts +17 -4
- 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 +83 -9
- 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 +82 -16
- package/dist/types/ids.js.map +1 -1
- package/dist/types/index.d.cts +18 -13
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.ts +18 -13
- 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.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 +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.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 +45 -23
- 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 +53 -6
- package/dist/types/upload.d.cts.map +1 -1
- package/dist/types/upload.d.ts +53 -6
- package/dist/types/upload.d.ts.map +1 -1
- package/dist/upload/abort-scope.cjs +46 -0
- package/dist/upload/abort-scope.cjs.map +1 -0
- package/dist/upload/abort-scope.d.cts +26 -0
- package/dist/upload/abort-scope.d.cts.map +1 -0
- package/dist/upload/abort-scope.d.ts +26 -0
- package/dist/upload/abort-scope.d.ts.map +1 -0
- package/dist/upload/abort-scope.js +45 -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 +54 -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 +54 -0
- package/dist/upload/finish.js.map +1 -0
- package/dist/upload/large.cjs +305 -218
- package/dist/upload/large.cjs.map +1 -1
- package/dist/upload/large.d.cts +90 -9
- package/dist/upload/large.d.cts.map +1 -1
- package/dist/upload/large.d.ts +90 -9
- package/dist/upload/large.d.ts.map +1 -1
- package/dist/upload/large.js +305 -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 +116 -0
- package/dist/upload/options.d.cts.map +1 -0
- package/dist/upload/options.d.ts +116 -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 +334 -33
- package/dist/upload/resume.cjs.map +1 -1
- package/dist/upload/resume.d.cts +84 -12
- package/dist/upload/resume.d.cts.map +1 -1
- package/dist/upload/resume.d.ts +84 -12
- package/dist/upload/resume.d.ts.map +1 -1
- package/dist/upload/resume.js +331 -33
- package/dist/upload/resume.js.map +1 -1
- package/dist/upload/retry.cjs +191 -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 +187 -0
- package/dist/upload/retry.js.map +1 -0
- package/dist/upload/single.cjs +69 -44
- package/dist/upload/single.cjs.map +1 -1
- package/dist/upload/single.d.cts +8 -1
- package/dist/upload/single.d.cts.map +1 -1
- package/dist/upload/single.d.ts +8 -1
- package/dist/upload/single.d.ts.map +1 -1
- package/dist/upload/single.js +69 -44
- package/dist/upload/single.js.map +1 -1
- package/dist/upload/stream.cjs +319 -193
- package/dist/upload/stream.cjs.map +1 -1
- package/dist/upload/stream.d.cts +9 -1
- package/dist/upload/stream.d.cts.map +1 -1
- package/dist/upload/stream.d.ts +9 -1
- package/dist/upload/stream.d.ts.map +1 -1
- package/dist/upload/stream.js +318 -192
- 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/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 +28 -9
- 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 +28 -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/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 +66 -7
- 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 +67 -10
- package/dist/util/normalize.js.map +1 -1
- package/dist/util/paginator.cjs +69 -14
- 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 +70 -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 +45 -20
- 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
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
const require_url = require("../raw/url.cjs");
|
|
2
|
+
const require_endpoint_url = require("../partner/endpoint-url.cjs");
|
|
3
|
+
//#region src/backup/raw.ts
|
|
4
|
+
var BACKUP_API_V1 = {
|
|
5
|
+
prefix: "api/backup",
|
|
6
|
+
version: "v1"
|
|
7
|
+
};
|
|
8
|
+
function backupEndpointAllowedSuffixes(transport, authorizedSuffixes) {
|
|
9
|
+
return require_endpoint_url.endpointAllowedSuffixes(transport, authorizedSuffixes, {
|
|
10
|
+
missingGuard: "Computer Backup endpoint requests require BackupClient.authorize() or a locked URL guard before sending Partner tokens",
|
|
11
|
+
unlockedGuard: "Computer Backup endpoint requests require a locked URL guard before sending Partner tokens"
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Low-level client for Computer Backup API endpoint bindings.
|
|
16
|
+
*
|
|
17
|
+
* Each method maps directly to one `bz_*` HTTP call under the
|
|
18
|
+
* `/api/backup/v1/` route using the `backupApiUrl` returned by Partner
|
|
19
|
+
* authorization.
|
|
20
|
+
*
|
|
21
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
22
|
+
*/
|
|
23
|
+
var BackupRawClient = class {
|
|
24
|
+
/** @internal */
|
|
25
|
+
transport;
|
|
26
|
+
authorizedEndpointSuffixes;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a new BackupRawClient with the given transport.
|
|
29
|
+
*
|
|
30
|
+
* @param options - The constructor configuration.
|
|
31
|
+
*/
|
|
32
|
+
constructor(options) {
|
|
33
|
+
this.transport = options.transport;
|
|
34
|
+
this.authorizedEndpointSuffixes = Array.from(options.authorizedBackupEndpointSuffixes ?? []);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Replaces the validated Computer Backup endpoint host suffixes.
|
|
38
|
+
*
|
|
39
|
+
* @param suffixes - Host suffixes derived from Partner authorization.
|
|
40
|
+
*
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
setAuthorizedEndpointSuffixes(suffixes) {
|
|
44
|
+
this.authorizedEndpointSuffixes = Array.from(suffixes);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Calls `bz_list_computers`.
|
|
48
|
+
*
|
|
49
|
+
* Uses the documented GET form. The wire response is a single JSON object
|
|
50
|
+
* with a `nextComputerId` cursor and active computer backup records.
|
|
51
|
+
*
|
|
52
|
+
* @param backupApiUrl - The Computer Backup API base URL from `authorizePartner`.
|
|
53
|
+
* @param authToken - The Partner authorization token.
|
|
54
|
+
* @param request - The computer listing query parameters.
|
|
55
|
+
* @param options - Optional abort and per-request retry settings.
|
|
56
|
+
*
|
|
57
|
+
* @returns The single-object computer backup wire response.
|
|
58
|
+
*
|
|
59
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
60
|
+
*/
|
|
61
|
+
async listComputers(backupApiUrl, authToken, request, options) {
|
|
62
|
+
return this.getJson(backupApiUrl, authToken, "bz_list_computers", {
|
|
63
|
+
accountId: request.accountId,
|
|
64
|
+
...request.startComputerId !== void 0 ? { startComputerId: request.startComputerId } : {},
|
|
65
|
+
...request.maxComputerCount !== void 0 ? { maxComputerCount: request.maxComputerCount } : {}
|
|
66
|
+
}, options);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Calls `bz_delete_computer`.
|
|
70
|
+
*
|
|
71
|
+
* The documented wire response is a JSON array of deletion records. This
|
|
72
|
+
* destructive mutation is not automatically retried or reauthorized in place.
|
|
73
|
+
*
|
|
74
|
+
* @param backupApiUrl - The Computer Backup API base URL from `authorizePartner`.
|
|
75
|
+
* @param authToken - The Partner authorization token.
|
|
76
|
+
* @param request - The computer deletion request body.
|
|
77
|
+
* @param options - Optional abort and per-request retry settings.
|
|
78
|
+
*
|
|
79
|
+
* @returns The deleted computer backup record array.
|
|
80
|
+
*
|
|
81
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
82
|
+
*/
|
|
83
|
+
async deleteComputer(backupApiUrl, authToken, request, options) {
|
|
84
|
+
return this.postJson(backupApiUrl, authToken, "bz_delete_computer", {
|
|
85
|
+
accountId: request.accountId,
|
|
86
|
+
computerId: request.computerId
|
|
87
|
+
}, require_endpoint_url.nonRetryingMutationRequestOptions(options));
|
|
88
|
+
}
|
|
89
|
+
safeBackupApiUrl(backupApiUrl) {
|
|
90
|
+
return require_endpoint_url.validatePartnerEndpointUrl(backupApiUrl, "backupApiUrl", backupEndpointAllowedSuffixes(this.transport, this.authorizedEndpointSuffixes));
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Sends a JSON GET request to the specified Computer Backup API endpoint.
|
|
94
|
+
*
|
|
95
|
+
* @param backupApiUrl - The Computer Backup API base URL.
|
|
96
|
+
* @param authToken - The Partner authorization token.
|
|
97
|
+
* @param endpoint - The Computer Backup API endpoint name.
|
|
98
|
+
* @param query - The query-string parameters.
|
|
99
|
+
* @param options - Optional abort and per-request retry settings.
|
|
100
|
+
*
|
|
101
|
+
* @returns The parsed JSON response.
|
|
102
|
+
*/
|
|
103
|
+
async getJson(backupApiUrl, authToken, endpoint, query, options) {
|
|
104
|
+
return (await this.transport.send({
|
|
105
|
+
url: require_endpoint_url.withQueryString(require_url.b2Url(this.safeBackupApiUrl(backupApiUrl), {
|
|
106
|
+
...BACKUP_API_V1,
|
|
107
|
+
endpoint
|
|
108
|
+
}), query),
|
|
109
|
+
method: "GET",
|
|
110
|
+
headers: { Authorization: authToken },
|
|
111
|
+
...options?.signal !== void 0 ? { signal: options.signal } : {},
|
|
112
|
+
...options?.retry !== void 0 ? { retry: options.retry } : {}
|
|
113
|
+
})).json();
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Sends a JSON POST request to the specified Computer Backup API endpoint.
|
|
117
|
+
*
|
|
118
|
+
* @param backupApiUrl - The Computer Backup API base URL.
|
|
119
|
+
* @param authToken - The Partner authorization token.
|
|
120
|
+
* @param endpoint - The Computer Backup API endpoint name.
|
|
121
|
+
* @param body - The JSON request body.
|
|
122
|
+
* @param options - Optional abort and per-request retry settings.
|
|
123
|
+
*
|
|
124
|
+
* @returns The parsed JSON response.
|
|
125
|
+
*/
|
|
126
|
+
async postJson(backupApiUrl, authToken, endpoint, body, options) {
|
|
127
|
+
return (await this.transport.send({
|
|
128
|
+
url: require_url.b2Url(this.safeBackupApiUrl(backupApiUrl), {
|
|
129
|
+
...BACKUP_API_V1,
|
|
130
|
+
endpoint
|
|
131
|
+
}),
|
|
132
|
+
method: "POST",
|
|
133
|
+
headers: {
|
|
134
|
+
Authorization: authToken,
|
|
135
|
+
"Content-Type": "application/json"
|
|
136
|
+
},
|
|
137
|
+
body: JSON.stringify(body),
|
|
138
|
+
...options?.signal !== void 0 ? { signal: options.signal } : {},
|
|
139
|
+
...options?.retry !== void 0 ? { retry: options.retry } : {}
|
|
140
|
+
})).json();
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
//#endregion
|
|
144
|
+
exports.BackupRawClient = BackupRawClient;
|
|
145
|
+
|
|
146
|
+
//# sourceMappingURL=raw.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raw.cjs","names":[],"sources":["../../src/backup/raw.ts"],"sourcesContent":["import type { RetryOptions } from '../http/retry.ts'\nimport type { HttpTransport } from '../http/transport.ts'\nimport {\n endpointAllowedSuffixes,\n nonRetryingMutationRequestOptions,\n type QueryParams,\n validatePartnerEndpointUrl,\n withQueryString,\n} from '../partner/endpoint-url.ts'\nimport { type B2EndpointUrlOptions, b2Url } from '../raw/url.ts'\nimport type {\n DeleteComputerRequest,\n DeleteComputerResponse,\n ListComputersRequest,\n ListComputersResponse,\n} from '../types/backup.ts'\n\nconst BACKUP_API_V1: B2EndpointUrlOptions = { prefix: 'api/backup', version: 'v1' }\n\n/** Configuration for constructing a {@link BackupRawClient}. */\nexport interface BackupRawClientOptions {\n /**\n * The HTTP transport used to send requests.\n *\n * Computer Backup endpoint calls validate URLs against suffixes recorded by\n * Partner authorization. A rehydrated client that skips authorization must\n * use `authorizedBackupEndpointSuffixes` or a transport with a locked\n * `urlGuard`. Because Partner authorize responses redact\n * `authorizationToken` under `JSON.stringify`, durable caches should persist\n * `partnerAuthorizeResponseForPersistence(auth)` only to encrypted or\n * otherwise credential-grade storage, or use another secure token-preserving\n * representation.\n */\n readonly transport: HttpTransport\n /**\n * Validated Computer Backup endpoint host suffixes restored from cached\n * Partner authorization. Facades normally manage this after authorization;\n * direct raw clients can pass trusted suffixes derived from\n * `derivePartnerAllowedSuffixes()`. Do not derive this cache with\n * `JSON.stringify(authorizePartner())`, which intentionally stores a redacted\n * token placeholder instead of a usable Partner token. Rehydrating that\n * placeholder fails fast.\n */\n readonly authorizedBackupEndpointSuffixes?: readonly string[]\n}\n\n/** Optional controls for raw Computer Backup API requests. */\nexport interface BackupRawRequestOptions {\n /** Abort signal for cancelling the request. */\n readonly signal?: AbortSignal\n /** Per-request retry override. */\n readonly retry?: Partial<RetryOptions>\n}\n\nfunction backupEndpointAllowedSuffixes(\n transport: HttpTransport,\n authorizedSuffixes: readonly string[],\n): readonly string[] {\n return endpointAllowedSuffixes(transport, authorizedSuffixes, {\n missingGuard:\n 'Computer Backup endpoint requests require BackupClient.authorize() or a locked URL guard before sending Partner tokens',\n unlockedGuard:\n 'Computer Backup endpoint requests require a locked URL guard before sending Partner tokens',\n })\n}\n\n/**\n * Low-level client for Computer Backup API endpoint bindings.\n *\n * Each method maps directly to one `bz_*` HTTP call under the\n * `/api/backup/v1/` route using the `backupApiUrl` returned by Partner\n * authorization.\n *\n * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.\n */\nexport class BackupRawClient {\n /** @internal */\n private readonly transport: HttpTransport\n private authorizedEndpointSuffixes: readonly string[]\n\n /**\n * Creates a new BackupRawClient with the given transport.\n *\n * @param options - The constructor configuration.\n */\n constructor(options: BackupRawClientOptions) {\n this.transport = options.transport\n this.authorizedEndpointSuffixes = Array.from(options.authorizedBackupEndpointSuffixes ?? [])\n }\n\n /**\n * Replaces the validated Computer Backup endpoint host suffixes.\n *\n * @param suffixes - Host suffixes derived from Partner authorization.\n *\n * @internal\n */\n setAuthorizedEndpointSuffixes(suffixes: readonly string[]): void {\n this.authorizedEndpointSuffixes = Array.from(suffixes)\n }\n\n /**\n * Calls `bz_list_computers`.\n *\n * Uses the documented GET form. The wire response is a single JSON object\n * with a `nextComputerId` cursor and active computer backup records.\n *\n * @param backupApiUrl - The Computer Backup API base URL from `authorizePartner`.\n * @param authToken - The Partner authorization token.\n * @param request - The computer listing query parameters.\n * @param options - Optional abort and per-request retry settings.\n *\n * @returns The single-object computer backup wire response.\n *\n * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.\n */\n async listComputers(\n backupApiUrl: string,\n authToken: string,\n request: ListComputersRequest,\n options?: BackupRawRequestOptions,\n ): Promise<ListComputersResponse> {\n return this.getJson<ListComputersResponse>(\n backupApiUrl,\n authToken,\n 'bz_list_computers',\n {\n accountId: request.accountId,\n ...(request.startComputerId !== undefined\n ? { startComputerId: request.startComputerId }\n : {}),\n ...(request.maxComputerCount !== undefined\n ? { maxComputerCount: request.maxComputerCount }\n : {}),\n },\n options,\n )\n }\n\n /**\n * Calls `bz_delete_computer`.\n *\n * The documented wire response is a JSON array of deletion records. This\n * destructive mutation is not automatically retried or reauthorized in place.\n *\n * @param backupApiUrl - The Computer Backup API base URL from `authorizePartner`.\n * @param authToken - The Partner authorization token.\n * @param request - The computer deletion request body.\n * @param options - Optional abort and per-request retry settings.\n *\n * @returns The deleted computer backup record array.\n *\n * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.\n */\n async deleteComputer(\n backupApiUrl: string,\n authToken: string,\n request: DeleteComputerRequest,\n options?: BackupRawRequestOptions,\n ): Promise<DeleteComputerResponse> {\n return this.postJson<DeleteComputerResponse>(\n backupApiUrl,\n authToken,\n 'bz_delete_computer',\n {\n accountId: request.accountId,\n computerId: request.computerId,\n },\n nonRetryingMutationRequestOptions(options),\n )\n }\n\n private safeBackupApiUrl(backupApiUrl: string): string {\n return validatePartnerEndpointUrl(\n backupApiUrl,\n 'backupApiUrl',\n backupEndpointAllowedSuffixes(this.transport, this.authorizedEndpointSuffixes),\n )\n }\n\n /**\n * Sends a JSON GET request to the specified Computer Backup API endpoint.\n *\n * @param backupApiUrl - The Computer Backup API base URL.\n * @param authToken - The Partner authorization token.\n * @param endpoint - The Computer Backup API endpoint name.\n * @param query - The query-string parameters.\n * @param options - Optional abort and per-request retry settings.\n *\n * @returns The parsed JSON response.\n */\n private async getJson<T>(\n backupApiUrl: string,\n authToken: string,\n endpoint: string,\n query: QueryParams,\n options?: BackupRawRequestOptions,\n ): Promise<T> {\n const response = await this.transport.send({\n url: withQueryString(\n b2Url(this.safeBackupApiUrl(backupApiUrl), { ...BACKUP_API_V1, endpoint }),\n query,\n ),\n method: 'GET',\n headers: {\n Authorization: authToken,\n },\n ...(options?.signal !== undefined ? { signal: options.signal } : {}),\n ...(options?.retry !== undefined ? { retry: options.retry } : {}),\n })\n return response.json<T>()\n }\n\n /**\n * Sends a JSON POST request to the specified Computer Backup API endpoint.\n *\n * @param backupApiUrl - The Computer Backup API base URL.\n * @param authToken - The Partner authorization token.\n * @param endpoint - The Computer Backup API endpoint name.\n * @param body - The JSON request body.\n * @param options - Optional abort and per-request retry settings.\n *\n * @returns The parsed JSON response.\n */\n private async postJson<T>(\n backupApiUrl: string,\n authToken: string,\n endpoint: string,\n body: unknown,\n options?: BackupRawRequestOptions,\n ): Promise<T> {\n const response = await this.transport.send({\n url: b2Url(this.safeBackupApiUrl(backupApiUrl), { ...BACKUP_API_V1, endpoint }),\n method: 'POST',\n headers: {\n Authorization: authToken,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(body),\n ...(options?.signal !== undefined ? { signal: options.signal } : {}),\n ...(options?.retry !== undefined ? { retry: options.retry } : {}),\n })\n return response.json<T>()\n }\n}\n"],"mappings":";;;AAiBA,IAAM,gBAAsC;CAAE,QAAQ;CAAc,SAAS;AAAK;AAqClF,SAAS,8BACP,WACA,oBACmB;CACnB,OAAO,qBAAA,wBAAwB,WAAW,oBAAoB;EAC5D,cACE;EACF,eACE;CACJ,CAAC;AACH;;;;;;;;;;AAWA,IAAa,kBAAb,MAA6B;;CAE3B;CACA;;;;;;CAOA,YAAY,SAAiC;EAC3C,KAAK,YAAY,QAAQ;EACzB,KAAK,6BAA6B,MAAM,KAAK,QAAQ,oCAAoC,CAAC,CAAC;CAC7F;;;;;;;;CASA,8BAA8B,UAAmC;EAC/D,KAAK,6BAA6B,MAAM,KAAK,QAAQ;CACvD;;;;;;;;;;;;;;;;CAiBA,MAAM,cACJ,cACA,WACA,SACA,SACgC;EAChC,OAAO,KAAK,QACV,cACA,WACA,qBACA;GACE,WAAW,QAAQ;GACnB,GAAI,QAAQ,oBAAoB,KAAA,IAC5B,EAAE,iBAAiB,QAAQ,gBAAgB,IAC3C,CAAC;GACL,GAAI,QAAQ,qBAAqB,KAAA,IAC7B,EAAE,kBAAkB,QAAQ,iBAAiB,IAC7C,CAAC;EACP,GACA,OACF;CACF;;;;;;;;;;;;;;;;CAiBA,MAAM,eACJ,cACA,WACA,SACA,SACiC;EACjC,OAAO,KAAK,SACV,cACA,WACA,sBACA;GACE,WAAW,QAAQ;GACnB,YAAY,QAAQ;EACtB,GACA,qBAAA,kCAAkC,OAAO,CAC3C;CACF;CAEA,iBAAyB,cAA8B;EACrD,OAAO,qBAAA,2BACL,cACA,gBACA,8BAA8B,KAAK,WAAW,KAAK,0BAA0B,CAC/E;CACF;;;;;;;;;;;;CAaA,MAAc,QACZ,cACA,WACA,UACA,OACA,SACY;EAaZ,QAAO,MAZgB,KAAK,UAAU,KAAK;GACzC,KAAK,qBAAA,gBACH,YAAA,MAAM,KAAK,iBAAiB,YAAY,GAAG;IAAE,GAAG;IAAe;GAAS,CAAC,GACzE,KACF;GACA,QAAQ;GACR,SAAS,EACP,eAAe,UACjB;GACA,GAAI,SAAS,WAAW,KAAA,IAAY,EAAE,QAAQ,QAAQ,OAAO,IAAI,CAAC;GAClE,GAAI,SAAS,UAAU,KAAA,IAAY,EAAE,OAAO,QAAQ,MAAM,IAAI,CAAC;EACjE,CAAC,EAAA,CACe,KAAQ;CAC1B;;;;;;;;;;;;CAaA,MAAc,SACZ,cACA,WACA,UACA,MACA,SACY;EAYZ,QAAO,MAXgB,KAAK,UAAU,KAAK;GACzC,KAAK,YAAA,MAAM,KAAK,iBAAiB,YAAY,GAAG;IAAE,GAAG;IAAe;GAAS,CAAC;GAC9E,QAAQ;GACR,SAAS;IACP,eAAe;IACf,gBAAgB;GAClB;GACA,MAAM,KAAK,UAAU,IAAI;GACzB,GAAI,SAAS,WAAW,KAAA,IAAY,EAAE,QAAQ,QAAQ,OAAO,IAAI,CAAC;GAClE,GAAI,SAAS,UAAU,KAAA,IAAY,EAAE,OAAO,QAAQ,MAAM,IAAI,CAAC;EACjE,CAAC,EAAA,CACe,KAAQ;CAC1B;AACF"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { RetryOptions } from '../http/retry.js';
|
|
2
|
+
import { HttpTransport } from '../http/transport.js';
|
|
3
|
+
import { DeleteComputerRequest, DeleteComputerResponse, ListComputersRequest, ListComputersResponse } from '../types/backup.js';
|
|
4
|
+
/** Configuration for constructing a {@link BackupRawClient}. */
|
|
5
|
+
export interface BackupRawClientOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The HTTP transport used to send requests.
|
|
8
|
+
*
|
|
9
|
+
* Computer Backup endpoint calls validate URLs against suffixes recorded by
|
|
10
|
+
* Partner authorization. A rehydrated client that skips authorization must
|
|
11
|
+
* use `authorizedBackupEndpointSuffixes` or a transport with a locked
|
|
12
|
+
* `urlGuard`. Because Partner authorize responses redact
|
|
13
|
+
* `authorizationToken` under `JSON.stringify`, durable caches should persist
|
|
14
|
+
* `partnerAuthorizeResponseForPersistence(auth)` only to encrypted or
|
|
15
|
+
* otherwise credential-grade storage, or use another secure token-preserving
|
|
16
|
+
* representation.
|
|
17
|
+
*/
|
|
18
|
+
readonly transport: HttpTransport;
|
|
19
|
+
/**
|
|
20
|
+
* Validated Computer Backup endpoint host suffixes restored from cached
|
|
21
|
+
* Partner authorization. Facades normally manage this after authorization;
|
|
22
|
+
* direct raw clients can pass trusted suffixes derived from
|
|
23
|
+
* `derivePartnerAllowedSuffixes()`. Do not derive this cache with
|
|
24
|
+
* `JSON.stringify(authorizePartner())`, which intentionally stores a redacted
|
|
25
|
+
* token placeholder instead of a usable Partner token. Rehydrating that
|
|
26
|
+
* placeholder fails fast.
|
|
27
|
+
*/
|
|
28
|
+
readonly authorizedBackupEndpointSuffixes?: readonly string[];
|
|
29
|
+
}
|
|
30
|
+
/** Optional controls for raw Computer Backup API requests. */
|
|
31
|
+
export interface BackupRawRequestOptions {
|
|
32
|
+
/** Abort signal for cancelling the request. */
|
|
33
|
+
readonly signal?: AbortSignal;
|
|
34
|
+
/** Per-request retry override. */
|
|
35
|
+
readonly retry?: Partial<RetryOptions>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Low-level client for Computer Backup API endpoint bindings.
|
|
39
|
+
*
|
|
40
|
+
* Each method maps directly to one `bz_*` HTTP call under the
|
|
41
|
+
* `/api/backup/v1/` route using the `backupApiUrl` returned by Partner
|
|
42
|
+
* authorization.
|
|
43
|
+
*
|
|
44
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
45
|
+
*/
|
|
46
|
+
export declare class BackupRawClient {
|
|
47
|
+
/** @internal */
|
|
48
|
+
private readonly transport;
|
|
49
|
+
private authorizedEndpointSuffixes;
|
|
50
|
+
/**
|
|
51
|
+
* Creates a new BackupRawClient with the given transport.
|
|
52
|
+
*
|
|
53
|
+
* @param options - The constructor configuration.
|
|
54
|
+
*/
|
|
55
|
+
constructor(options: BackupRawClientOptions);
|
|
56
|
+
/**
|
|
57
|
+
* Replaces the validated Computer Backup endpoint host suffixes.
|
|
58
|
+
*
|
|
59
|
+
* @param suffixes - Host suffixes derived from Partner authorization.
|
|
60
|
+
*
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
setAuthorizedEndpointSuffixes(suffixes: readonly string[]): void;
|
|
64
|
+
/**
|
|
65
|
+
* Calls `bz_list_computers`.
|
|
66
|
+
*
|
|
67
|
+
* Uses the documented GET form. The wire response is a single JSON object
|
|
68
|
+
* with a `nextComputerId` cursor and active computer backup records.
|
|
69
|
+
*
|
|
70
|
+
* @param backupApiUrl - The Computer Backup API base URL from `authorizePartner`.
|
|
71
|
+
* @param authToken - The Partner authorization token.
|
|
72
|
+
* @param request - The computer listing query parameters.
|
|
73
|
+
* @param options - Optional abort and per-request retry settings.
|
|
74
|
+
*
|
|
75
|
+
* @returns The single-object computer backup wire response.
|
|
76
|
+
*
|
|
77
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
78
|
+
*/
|
|
79
|
+
listComputers(backupApiUrl: string, authToken: string, request: ListComputersRequest, options?: BackupRawRequestOptions): Promise<ListComputersResponse>;
|
|
80
|
+
/**
|
|
81
|
+
* Calls `bz_delete_computer`.
|
|
82
|
+
*
|
|
83
|
+
* The documented wire response is a JSON array of deletion records. This
|
|
84
|
+
* destructive mutation is not automatically retried or reauthorized in place.
|
|
85
|
+
*
|
|
86
|
+
* @param backupApiUrl - The Computer Backup API base URL from `authorizePartner`.
|
|
87
|
+
* @param authToken - The Partner authorization token.
|
|
88
|
+
* @param request - The computer deletion request body.
|
|
89
|
+
* @param options - Optional abort and per-request retry settings.
|
|
90
|
+
*
|
|
91
|
+
* @returns The deleted computer backup record array.
|
|
92
|
+
*
|
|
93
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
94
|
+
*/
|
|
95
|
+
deleteComputer(backupApiUrl: string, authToken: string, request: DeleteComputerRequest, options?: BackupRawRequestOptions): Promise<DeleteComputerResponse>;
|
|
96
|
+
private safeBackupApiUrl;
|
|
97
|
+
/**
|
|
98
|
+
* Sends a JSON GET request to the specified Computer Backup API endpoint.
|
|
99
|
+
*
|
|
100
|
+
* @param backupApiUrl - The Computer Backup API base URL.
|
|
101
|
+
* @param authToken - The Partner authorization token.
|
|
102
|
+
* @param endpoint - The Computer Backup API endpoint name.
|
|
103
|
+
* @param query - The query-string parameters.
|
|
104
|
+
* @param options - Optional abort and per-request retry settings.
|
|
105
|
+
*
|
|
106
|
+
* @returns The parsed JSON response.
|
|
107
|
+
*/
|
|
108
|
+
private getJson;
|
|
109
|
+
/**
|
|
110
|
+
* Sends a JSON POST request to the specified Computer Backup API endpoint.
|
|
111
|
+
*
|
|
112
|
+
* @param backupApiUrl - The Computer Backup API base URL.
|
|
113
|
+
* @param authToken - The Partner authorization token.
|
|
114
|
+
* @param endpoint - The Computer Backup API endpoint name.
|
|
115
|
+
* @param body - The JSON request body.
|
|
116
|
+
* @param options - Optional abort and per-request retry settings.
|
|
117
|
+
*
|
|
118
|
+
* @returns The parsed JSON response.
|
|
119
|
+
*/
|
|
120
|
+
private postJson;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=raw.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raw.d.ts","sourceRoot":"","sources":["../../src/backup/raw.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AASzD,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,oBAAoB,CAAA;AAI3B,gEAAgE;AAChE,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAA;IACjC;;;;;;;;OAQG;IACH,QAAQ,CAAC,gCAAgC,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC9D;AAED,8DAA8D;AAC9D,MAAM,WAAW,uBAAuB;IACtC,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;IAC7B,kCAAkC;IAClC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;CACvC;AAcD;;;;;;;;GAQG;AACH,qBAAa,eAAe;IAC1B,gBAAgB;IAChB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe;IACzC,OAAO,CAAC,0BAA0B,CAAmB;IAErD;;;;OAIG;gBACS,OAAO,EAAE,sBAAsB;IAK3C;;;;;;OAMG;IACH,6BAA6B,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI;IAIhE;;;;;;;;;;;;;;OAcG;IACG,aAAa,CACjB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,oBAAoB,EAC7B,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,qBAAqB,CAAC;IAkBjC;;;;;;;;;;;;;;OAcG;IACG,cAAc,CAClB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,sBAAsB,CAAC;IAalC,OAAO,CAAC,gBAAgB;IAQxB;;;;;;;;;;OAUG;YACW,OAAO;IAsBrB;;;;;;;;;;OAUG;YACW,QAAQ;CAoBvB"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { RetryOptions } from '../http/retry.js';
|
|
2
|
+
import { HttpTransport } from '../http/transport.js';
|
|
3
|
+
import { DeleteComputerRequest, DeleteComputerResponse, ListComputersRequest, ListComputersResponse } from '../types/backup.js';
|
|
4
|
+
/** Configuration for constructing a {@link BackupRawClient}. */
|
|
5
|
+
export interface BackupRawClientOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The HTTP transport used to send requests.
|
|
8
|
+
*
|
|
9
|
+
* Computer Backup endpoint calls validate URLs against suffixes recorded by
|
|
10
|
+
* Partner authorization. A rehydrated client that skips authorization must
|
|
11
|
+
* use `authorizedBackupEndpointSuffixes` or a transport with a locked
|
|
12
|
+
* `urlGuard`. Because Partner authorize responses redact
|
|
13
|
+
* `authorizationToken` under `JSON.stringify`, durable caches should persist
|
|
14
|
+
* `partnerAuthorizeResponseForPersistence(auth)` only to encrypted or
|
|
15
|
+
* otherwise credential-grade storage, or use another secure token-preserving
|
|
16
|
+
* representation.
|
|
17
|
+
*/
|
|
18
|
+
readonly transport: HttpTransport;
|
|
19
|
+
/**
|
|
20
|
+
* Validated Computer Backup endpoint host suffixes restored from cached
|
|
21
|
+
* Partner authorization. Facades normally manage this after authorization;
|
|
22
|
+
* direct raw clients can pass trusted suffixes derived from
|
|
23
|
+
* `derivePartnerAllowedSuffixes()`. Do not derive this cache with
|
|
24
|
+
* `JSON.stringify(authorizePartner())`, which intentionally stores a redacted
|
|
25
|
+
* token placeholder instead of a usable Partner token. Rehydrating that
|
|
26
|
+
* placeholder fails fast.
|
|
27
|
+
*/
|
|
28
|
+
readonly authorizedBackupEndpointSuffixes?: readonly string[];
|
|
29
|
+
}
|
|
30
|
+
/** Optional controls for raw Computer Backup API requests. */
|
|
31
|
+
export interface BackupRawRequestOptions {
|
|
32
|
+
/** Abort signal for cancelling the request. */
|
|
33
|
+
readonly signal?: AbortSignal;
|
|
34
|
+
/** Per-request retry override. */
|
|
35
|
+
readonly retry?: Partial<RetryOptions>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Low-level client for Computer Backup API endpoint bindings.
|
|
39
|
+
*
|
|
40
|
+
* Each method maps directly to one `bz_*` HTTP call under the
|
|
41
|
+
* `/api/backup/v1/` route using the `backupApiUrl` returned by Partner
|
|
42
|
+
* authorization.
|
|
43
|
+
*
|
|
44
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
45
|
+
*/
|
|
46
|
+
export declare class BackupRawClient {
|
|
47
|
+
/** @internal */
|
|
48
|
+
private readonly transport;
|
|
49
|
+
private authorizedEndpointSuffixes;
|
|
50
|
+
/**
|
|
51
|
+
* Creates a new BackupRawClient with the given transport.
|
|
52
|
+
*
|
|
53
|
+
* @param options - The constructor configuration.
|
|
54
|
+
*/
|
|
55
|
+
constructor(options: BackupRawClientOptions);
|
|
56
|
+
/**
|
|
57
|
+
* Replaces the validated Computer Backup endpoint host suffixes.
|
|
58
|
+
*
|
|
59
|
+
* @param suffixes - Host suffixes derived from Partner authorization.
|
|
60
|
+
*
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
setAuthorizedEndpointSuffixes(suffixes: readonly string[]): void;
|
|
64
|
+
/**
|
|
65
|
+
* Calls `bz_list_computers`.
|
|
66
|
+
*
|
|
67
|
+
* Uses the documented GET form. The wire response is a single JSON object
|
|
68
|
+
* with a `nextComputerId` cursor and active computer backup records.
|
|
69
|
+
*
|
|
70
|
+
* @param backupApiUrl - The Computer Backup API base URL from `authorizePartner`.
|
|
71
|
+
* @param authToken - The Partner authorization token.
|
|
72
|
+
* @param request - The computer listing query parameters.
|
|
73
|
+
* @param options - Optional abort and per-request retry settings.
|
|
74
|
+
*
|
|
75
|
+
* @returns The single-object computer backup wire response.
|
|
76
|
+
*
|
|
77
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
78
|
+
*/
|
|
79
|
+
listComputers(backupApiUrl: string, authToken: string, request: ListComputersRequest, options?: BackupRawRequestOptions): Promise<ListComputersResponse>;
|
|
80
|
+
/**
|
|
81
|
+
* Calls `bz_delete_computer`.
|
|
82
|
+
*
|
|
83
|
+
* The documented wire response is a JSON array of deletion records. This
|
|
84
|
+
* destructive mutation is not automatically retried or reauthorized in place.
|
|
85
|
+
*
|
|
86
|
+
* @param backupApiUrl - The Computer Backup API base URL from `authorizePartner`.
|
|
87
|
+
* @param authToken - The Partner authorization token.
|
|
88
|
+
* @param request - The computer deletion request body.
|
|
89
|
+
* @param options - Optional abort and per-request retry settings.
|
|
90
|
+
*
|
|
91
|
+
* @returns The deleted computer backup record array.
|
|
92
|
+
*
|
|
93
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
94
|
+
*/
|
|
95
|
+
deleteComputer(backupApiUrl: string, authToken: string, request: DeleteComputerRequest, options?: BackupRawRequestOptions): Promise<DeleteComputerResponse>;
|
|
96
|
+
private safeBackupApiUrl;
|
|
97
|
+
/**
|
|
98
|
+
* Sends a JSON GET request to the specified Computer Backup API endpoint.
|
|
99
|
+
*
|
|
100
|
+
* @param backupApiUrl - The Computer Backup API base URL.
|
|
101
|
+
* @param authToken - The Partner authorization token.
|
|
102
|
+
* @param endpoint - The Computer Backup API endpoint name.
|
|
103
|
+
* @param query - The query-string parameters.
|
|
104
|
+
* @param options - Optional abort and per-request retry settings.
|
|
105
|
+
*
|
|
106
|
+
* @returns The parsed JSON response.
|
|
107
|
+
*/
|
|
108
|
+
private getJson;
|
|
109
|
+
/**
|
|
110
|
+
* Sends a JSON POST request to the specified Computer Backup API endpoint.
|
|
111
|
+
*
|
|
112
|
+
* @param backupApiUrl - The Computer Backup API base URL.
|
|
113
|
+
* @param authToken - The Partner authorization token.
|
|
114
|
+
* @param endpoint - The Computer Backup API endpoint name.
|
|
115
|
+
* @param body - The JSON request body.
|
|
116
|
+
* @param options - Optional abort and per-request retry settings.
|
|
117
|
+
*
|
|
118
|
+
* @returns The parsed JSON response.
|
|
119
|
+
*/
|
|
120
|
+
private postJson;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=raw.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raw.d.ts","sourceRoot":"","sources":["../../src/backup/raw.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AASzD,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,oBAAoB,CAAA;AAI3B,gEAAgE;AAChE,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAA;IACjC;;;;;;;;OAQG;IACH,QAAQ,CAAC,gCAAgC,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC9D;AAED,8DAA8D;AAC9D,MAAM,WAAW,uBAAuB;IACtC,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;IAC7B,kCAAkC;IAClC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;CACvC;AAcD;;;;;;;;GAQG;AACH,qBAAa,eAAe;IAC1B,gBAAgB;IAChB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe;IACzC,OAAO,CAAC,0BAA0B,CAAmB;IAErD;;;;OAIG;gBACS,OAAO,EAAE,sBAAsB;IAK3C;;;;;;OAMG;IACH,6BAA6B,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI;IAIhE;;;;;;;;;;;;;;OAcG;IACG,aAAa,CACjB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,oBAAoB,EAC7B,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,qBAAqB,CAAC;IAkBjC;;;;;;;;;;;;;;OAcG;IACG,cAAc,CAClB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,sBAAsB,CAAC;IAalC,OAAO,CAAC,gBAAgB;IAQxB;;;;;;;;;;OAUG;YACW,OAAO;IAsBrB;;;;;;;;;;OAUG;YACW,QAAQ;CAoBvB"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { b2Url } from "../raw/url.js";
|
|
2
|
+
import { endpointAllowedSuffixes, nonRetryingMutationRequestOptions, validatePartnerEndpointUrl, withQueryString } from "../partner/endpoint-url.js";
|
|
3
|
+
//#region src/backup/raw.ts
|
|
4
|
+
var BACKUP_API_V1 = {
|
|
5
|
+
prefix: "api/backup",
|
|
6
|
+
version: "v1"
|
|
7
|
+
};
|
|
8
|
+
function backupEndpointAllowedSuffixes(transport, authorizedSuffixes) {
|
|
9
|
+
return endpointAllowedSuffixes(transport, authorizedSuffixes, {
|
|
10
|
+
missingGuard: "Computer Backup endpoint requests require BackupClient.authorize() or a locked URL guard before sending Partner tokens",
|
|
11
|
+
unlockedGuard: "Computer Backup endpoint requests require a locked URL guard before sending Partner tokens"
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Low-level client for Computer Backup API endpoint bindings.
|
|
16
|
+
*
|
|
17
|
+
* Each method maps directly to one `bz_*` HTTP call under the
|
|
18
|
+
* `/api/backup/v1/` route using the `backupApiUrl` returned by Partner
|
|
19
|
+
* authorization.
|
|
20
|
+
*
|
|
21
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
22
|
+
*/
|
|
23
|
+
var BackupRawClient = class {
|
|
24
|
+
/** @internal */
|
|
25
|
+
transport;
|
|
26
|
+
authorizedEndpointSuffixes;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a new BackupRawClient with the given transport.
|
|
29
|
+
*
|
|
30
|
+
* @param options - The constructor configuration.
|
|
31
|
+
*/
|
|
32
|
+
constructor(options) {
|
|
33
|
+
this.transport = options.transport;
|
|
34
|
+
this.authorizedEndpointSuffixes = Array.from(options.authorizedBackupEndpointSuffixes ?? []);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Replaces the validated Computer Backup endpoint host suffixes.
|
|
38
|
+
*
|
|
39
|
+
* @param suffixes - Host suffixes derived from Partner authorization.
|
|
40
|
+
*
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
setAuthorizedEndpointSuffixes(suffixes) {
|
|
44
|
+
this.authorizedEndpointSuffixes = Array.from(suffixes);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Calls `bz_list_computers`.
|
|
48
|
+
*
|
|
49
|
+
* Uses the documented GET form. The wire response is a single JSON object
|
|
50
|
+
* with a `nextComputerId` cursor and active computer backup records.
|
|
51
|
+
*
|
|
52
|
+
* @param backupApiUrl - The Computer Backup API base URL from `authorizePartner`.
|
|
53
|
+
* @param authToken - The Partner authorization token.
|
|
54
|
+
* @param request - The computer listing query parameters.
|
|
55
|
+
* @param options - Optional abort and per-request retry settings.
|
|
56
|
+
*
|
|
57
|
+
* @returns The single-object computer backup wire response.
|
|
58
|
+
*
|
|
59
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
60
|
+
*/
|
|
61
|
+
async listComputers(backupApiUrl, authToken, request, options) {
|
|
62
|
+
return this.getJson(backupApiUrl, authToken, "bz_list_computers", {
|
|
63
|
+
accountId: request.accountId,
|
|
64
|
+
...request.startComputerId !== void 0 ? { startComputerId: request.startComputerId } : {},
|
|
65
|
+
...request.maxComputerCount !== void 0 ? { maxComputerCount: request.maxComputerCount } : {}
|
|
66
|
+
}, options);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Calls `bz_delete_computer`.
|
|
70
|
+
*
|
|
71
|
+
* The documented wire response is a JSON array of deletion records. This
|
|
72
|
+
* destructive mutation is not automatically retried or reauthorized in place.
|
|
73
|
+
*
|
|
74
|
+
* @param backupApiUrl - The Computer Backup API base URL from `authorizePartner`.
|
|
75
|
+
* @param authToken - The Partner authorization token.
|
|
76
|
+
* @param request - The computer deletion request body.
|
|
77
|
+
* @param options - Optional abort and per-request retry settings.
|
|
78
|
+
*
|
|
79
|
+
* @returns The deleted computer backup record array.
|
|
80
|
+
*
|
|
81
|
+
* @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.
|
|
82
|
+
*/
|
|
83
|
+
async deleteComputer(backupApiUrl, authToken, request, options) {
|
|
84
|
+
return this.postJson(backupApiUrl, authToken, "bz_delete_computer", {
|
|
85
|
+
accountId: request.accountId,
|
|
86
|
+
computerId: request.computerId
|
|
87
|
+
}, nonRetryingMutationRequestOptions(options));
|
|
88
|
+
}
|
|
89
|
+
safeBackupApiUrl(backupApiUrl) {
|
|
90
|
+
return validatePartnerEndpointUrl(backupApiUrl, "backupApiUrl", backupEndpointAllowedSuffixes(this.transport, this.authorizedEndpointSuffixes));
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Sends a JSON GET request to the specified Computer Backup API endpoint.
|
|
94
|
+
*
|
|
95
|
+
* @param backupApiUrl - The Computer Backup API base URL.
|
|
96
|
+
* @param authToken - The Partner authorization token.
|
|
97
|
+
* @param endpoint - The Computer Backup API endpoint name.
|
|
98
|
+
* @param query - The query-string parameters.
|
|
99
|
+
* @param options - Optional abort and per-request retry settings.
|
|
100
|
+
*
|
|
101
|
+
* @returns The parsed JSON response.
|
|
102
|
+
*/
|
|
103
|
+
async getJson(backupApiUrl, authToken, endpoint, query, options) {
|
|
104
|
+
return (await this.transport.send({
|
|
105
|
+
url: withQueryString(b2Url(this.safeBackupApiUrl(backupApiUrl), {
|
|
106
|
+
...BACKUP_API_V1,
|
|
107
|
+
endpoint
|
|
108
|
+
}), query),
|
|
109
|
+
method: "GET",
|
|
110
|
+
headers: { Authorization: authToken },
|
|
111
|
+
...options?.signal !== void 0 ? { signal: options.signal } : {},
|
|
112
|
+
...options?.retry !== void 0 ? { retry: options.retry } : {}
|
|
113
|
+
})).json();
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Sends a JSON POST request to the specified Computer Backup API endpoint.
|
|
117
|
+
*
|
|
118
|
+
* @param backupApiUrl - The Computer Backup API base URL.
|
|
119
|
+
* @param authToken - The Partner authorization token.
|
|
120
|
+
* @param endpoint - The Computer Backup API endpoint name.
|
|
121
|
+
* @param body - The JSON request body.
|
|
122
|
+
* @param options - Optional abort and per-request retry settings.
|
|
123
|
+
*
|
|
124
|
+
* @returns The parsed JSON response.
|
|
125
|
+
*/
|
|
126
|
+
async postJson(backupApiUrl, authToken, endpoint, body, options) {
|
|
127
|
+
return (await this.transport.send({
|
|
128
|
+
url: b2Url(this.safeBackupApiUrl(backupApiUrl), {
|
|
129
|
+
...BACKUP_API_V1,
|
|
130
|
+
endpoint
|
|
131
|
+
}),
|
|
132
|
+
method: "POST",
|
|
133
|
+
headers: {
|
|
134
|
+
Authorization: authToken,
|
|
135
|
+
"Content-Type": "application/json"
|
|
136
|
+
},
|
|
137
|
+
body: JSON.stringify(body),
|
|
138
|
+
...options?.signal !== void 0 ? { signal: options.signal } : {},
|
|
139
|
+
...options?.retry !== void 0 ? { retry: options.retry } : {}
|
|
140
|
+
})).json();
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
//#endregion
|
|
144
|
+
export { BackupRawClient };
|
|
145
|
+
|
|
146
|
+
//# sourceMappingURL=raw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raw.js","names":[],"sources":["../../src/backup/raw.ts"],"sourcesContent":["import type { RetryOptions } from '../http/retry.ts'\nimport type { HttpTransport } from '../http/transport.ts'\nimport {\n endpointAllowedSuffixes,\n nonRetryingMutationRequestOptions,\n type QueryParams,\n validatePartnerEndpointUrl,\n withQueryString,\n} from '../partner/endpoint-url.ts'\nimport { type B2EndpointUrlOptions, b2Url } from '../raw/url.ts'\nimport type {\n DeleteComputerRequest,\n DeleteComputerResponse,\n ListComputersRequest,\n ListComputersResponse,\n} from '../types/backup.ts'\n\nconst BACKUP_API_V1: B2EndpointUrlOptions = { prefix: 'api/backup', version: 'v1' }\n\n/** Configuration for constructing a {@link BackupRawClient}. */\nexport interface BackupRawClientOptions {\n /**\n * The HTTP transport used to send requests.\n *\n * Computer Backup endpoint calls validate URLs against suffixes recorded by\n * Partner authorization. A rehydrated client that skips authorization must\n * use `authorizedBackupEndpointSuffixes` or a transport with a locked\n * `urlGuard`. Because Partner authorize responses redact\n * `authorizationToken` under `JSON.stringify`, durable caches should persist\n * `partnerAuthorizeResponseForPersistence(auth)` only to encrypted or\n * otherwise credential-grade storage, or use another secure token-preserving\n * representation.\n */\n readonly transport: HttpTransport\n /**\n * Validated Computer Backup endpoint host suffixes restored from cached\n * Partner authorization. Facades normally manage this after authorization;\n * direct raw clients can pass trusted suffixes derived from\n * `derivePartnerAllowedSuffixes()`. Do not derive this cache with\n * `JSON.stringify(authorizePartner())`, which intentionally stores a redacted\n * token placeholder instead of a usable Partner token. Rehydrating that\n * placeholder fails fast.\n */\n readonly authorizedBackupEndpointSuffixes?: readonly string[]\n}\n\n/** Optional controls for raw Computer Backup API requests. */\nexport interface BackupRawRequestOptions {\n /** Abort signal for cancelling the request. */\n readonly signal?: AbortSignal\n /** Per-request retry override. */\n readonly retry?: Partial<RetryOptions>\n}\n\nfunction backupEndpointAllowedSuffixes(\n transport: HttpTransport,\n authorizedSuffixes: readonly string[],\n): readonly string[] {\n return endpointAllowedSuffixes(transport, authorizedSuffixes, {\n missingGuard:\n 'Computer Backup endpoint requests require BackupClient.authorize() or a locked URL guard before sending Partner tokens',\n unlockedGuard:\n 'Computer Backup endpoint requests require a locked URL guard before sending Partner tokens',\n })\n}\n\n/**\n * Low-level client for Computer Backup API endpoint bindings.\n *\n * Each method maps directly to one `bz_*` HTTP call under the\n * `/api/backup/v1/` route using the `backupApiUrl` returned by Partner\n * authorization.\n *\n * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.\n */\nexport class BackupRawClient {\n /** @internal */\n private readonly transport: HttpTransport\n private authorizedEndpointSuffixes: readonly string[]\n\n /**\n * Creates a new BackupRawClient with the given transport.\n *\n * @param options - The constructor configuration.\n */\n constructor(options: BackupRawClientOptions) {\n this.transport = options.transport\n this.authorizedEndpointSuffixes = Array.from(options.authorizedBackupEndpointSuffixes ?? [])\n }\n\n /**\n * Replaces the validated Computer Backup endpoint host suffixes.\n *\n * @param suffixes - Host suffixes derived from Partner authorization.\n *\n * @internal\n */\n setAuthorizedEndpointSuffixes(suffixes: readonly string[]): void {\n this.authorizedEndpointSuffixes = Array.from(suffixes)\n }\n\n /**\n * Calls `bz_list_computers`.\n *\n * Uses the documented GET form. The wire response is a single JSON object\n * with a `nextComputerId` cursor and active computer backup records.\n *\n * @param backupApiUrl - The Computer Backup API base URL from `authorizePartner`.\n * @param authToken - The Partner authorization token.\n * @param request - The computer listing query parameters.\n * @param options - Optional abort and per-request retry settings.\n *\n * @returns The single-object computer backup wire response.\n *\n * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.\n */\n async listComputers(\n backupApiUrl: string,\n authToken: string,\n request: ListComputersRequest,\n options?: BackupRawRequestOptions,\n ): Promise<ListComputersResponse> {\n return this.getJson<ListComputersResponse>(\n backupApiUrl,\n authToken,\n 'bz_list_computers',\n {\n accountId: request.accountId,\n ...(request.startComputerId !== undefined\n ? { startComputerId: request.startComputerId }\n : {}),\n ...(request.maxComputerCount !== undefined\n ? { maxComputerCount: request.maxComputerCount }\n : {}),\n },\n options,\n )\n }\n\n /**\n * Calls `bz_delete_computer`.\n *\n * The documented wire response is a JSON array of deletion records. This\n * destructive mutation is not automatically retried or reauthorized in place.\n *\n * @param backupApiUrl - The Computer Backup API base URL from `authorizePartner`.\n * @param authToken - The Partner authorization token.\n * @param request - The computer deletion request body.\n * @param options - Optional abort and per-request retry settings.\n *\n * @returns The deleted computer backup record array.\n *\n * @experimental Computer Backup API surface; shape may change as the Backup API docs evolve.\n */\n async deleteComputer(\n backupApiUrl: string,\n authToken: string,\n request: DeleteComputerRequest,\n options?: BackupRawRequestOptions,\n ): Promise<DeleteComputerResponse> {\n return this.postJson<DeleteComputerResponse>(\n backupApiUrl,\n authToken,\n 'bz_delete_computer',\n {\n accountId: request.accountId,\n computerId: request.computerId,\n },\n nonRetryingMutationRequestOptions(options),\n )\n }\n\n private safeBackupApiUrl(backupApiUrl: string): string {\n return validatePartnerEndpointUrl(\n backupApiUrl,\n 'backupApiUrl',\n backupEndpointAllowedSuffixes(this.transport, this.authorizedEndpointSuffixes),\n )\n }\n\n /**\n * Sends a JSON GET request to the specified Computer Backup API endpoint.\n *\n * @param backupApiUrl - The Computer Backup API base URL.\n * @param authToken - The Partner authorization token.\n * @param endpoint - The Computer Backup API endpoint name.\n * @param query - The query-string parameters.\n * @param options - Optional abort and per-request retry settings.\n *\n * @returns The parsed JSON response.\n */\n private async getJson<T>(\n backupApiUrl: string,\n authToken: string,\n endpoint: string,\n query: QueryParams,\n options?: BackupRawRequestOptions,\n ): Promise<T> {\n const response = await this.transport.send({\n url: withQueryString(\n b2Url(this.safeBackupApiUrl(backupApiUrl), { ...BACKUP_API_V1, endpoint }),\n query,\n ),\n method: 'GET',\n headers: {\n Authorization: authToken,\n },\n ...(options?.signal !== undefined ? { signal: options.signal } : {}),\n ...(options?.retry !== undefined ? { retry: options.retry } : {}),\n })\n return response.json<T>()\n }\n\n /**\n * Sends a JSON POST request to the specified Computer Backup API endpoint.\n *\n * @param backupApiUrl - The Computer Backup API base URL.\n * @param authToken - The Partner authorization token.\n * @param endpoint - The Computer Backup API endpoint name.\n * @param body - The JSON request body.\n * @param options - Optional abort and per-request retry settings.\n *\n * @returns The parsed JSON response.\n */\n private async postJson<T>(\n backupApiUrl: string,\n authToken: string,\n endpoint: string,\n body: unknown,\n options?: BackupRawRequestOptions,\n ): Promise<T> {\n const response = await this.transport.send({\n url: b2Url(this.safeBackupApiUrl(backupApiUrl), { ...BACKUP_API_V1, endpoint }),\n method: 'POST',\n headers: {\n Authorization: authToken,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(body),\n ...(options?.signal !== undefined ? { signal: options.signal } : {}),\n ...(options?.retry !== undefined ? { retry: options.retry } : {}),\n })\n return response.json<T>()\n }\n}\n"],"mappings":";;;AAiBA,IAAM,gBAAsC;CAAE,QAAQ;CAAc,SAAS;AAAK;AAqClF,SAAS,8BACP,WACA,oBACmB;CACnB,OAAO,wBAAwB,WAAW,oBAAoB;EAC5D,cACE;EACF,eACE;CACJ,CAAC;AACH;;;;;;;;;;AAWA,IAAa,kBAAb,MAA6B;;CAE3B;CACA;;;;;;CAOA,YAAY,SAAiC;EAC3C,KAAK,YAAY,QAAQ;EACzB,KAAK,6BAA6B,MAAM,KAAK,QAAQ,oCAAoC,CAAC,CAAC;CAC7F;;;;;;;;CASA,8BAA8B,UAAmC;EAC/D,KAAK,6BAA6B,MAAM,KAAK,QAAQ;CACvD;;;;;;;;;;;;;;;;CAiBA,MAAM,cACJ,cACA,WACA,SACA,SACgC;EAChC,OAAO,KAAK,QACV,cACA,WACA,qBACA;GACE,WAAW,QAAQ;GACnB,GAAI,QAAQ,oBAAoB,KAAA,IAC5B,EAAE,iBAAiB,QAAQ,gBAAgB,IAC3C,CAAC;GACL,GAAI,QAAQ,qBAAqB,KAAA,IAC7B,EAAE,kBAAkB,QAAQ,iBAAiB,IAC7C,CAAC;EACP,GACA,OACF;CACF;;;;;;;;;;;;;;;;CAiBA,MAAM,eACJ,cACA,WACA,SACA,SACiC;EACjC,OAAO,KAAK,SACV,cACA,WACA,sBACA;GACE,WAAW,QAAQ;GACnB,YAAY,QAAQ;EACtB,GACA,kCAAkC,OAAO,CAC3C;CACF;CAEA,iBAAyB,cAA8B;EACrD,OAAO,2BACL,cACA,gBACA,8BAA8B,KAAK,WAAW,KAAK,0BAA0B,CAC/E;CACF;;;;;;;;;;;;CAaA,MAAc,QACZ,cACA,WACA,UACA,OACA,SACY;EAaZ,QAAO,MAZgB,KAAK,UAAU,KAAK;GACzC,KAAK,gBACH,MAAM,KAAK,iBAAiB,YAAY,GAAG;IAAE,GAAG;IAAe;GAAS,CAAC,GACzE,KACF;GACA,QAAQ;GACR,SAAS,EACP,eAAe,UACjB;GACA,GAAI,SAAS,WAAW,KAAA,IAAY,EAAE,QAAQ,QAAQ,OAAO,IAAI,CAAC;GAClE,GAAI,SAAS,UAAU,KAAA,IAAY,EAAE,OAAO,QAAQ,MAAM,IAAI,CAAC;EACjE,CAAC,EAAA,CACe,KAAQ;CAC1B;;;;;;;;;;;;CAaA,MAAc,SACZ,cACA,WACA,UACA,MACA,SACY;EAYZ,QAAO,MAXgB,KAAK,UAAU,KAAK;GACzC,KAAK,MAAM,KAAK,iBAAiB,YAAY,GAAG;IAAE,GAAG;IAAe;GAAS,CAAC;GAC9E,QAAQ;GACR,SAAS;IACP,eAAe;IACf,gBAAgB;GAClB;GACA,MAAM,KAAK,UAAU,IAAI;GACzB,GAAI,SAAS,WAAW,KAAA,IAAY,EAAE,QAAQ,QAAQ,OAAO,IAAI,CAAC;GAClE,GAAI,SAAS,UAAU,KAAA,IAAY,EAAE,OAAO,QAAQ,MAAM,IAAI,CAAC;EACjE,CAAC,EAAA,CACe,KAAQ;CAC1B;AACF"}
|