@backblaze-labs/b2-sdk 0.1.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 +121 -0
- package/LICENSE +21 -0
- package/README.md +664 -0
- package/dist/auth/account-info.d.cts +51 -0
- package/dist/auth/account-info.d.cts.map +1 -0
- package/dist/auth/account-info.d.ts +51 -0
- package/dist/auth/account-info.d.ts.map +1 -0
- package/dist/auth/file.cjs +210 -0
- package/dist/auth/file.cjs.map +1 -0
- package/dist/auth/file.d.cts +157 -0
- package/dist/auth/file.d.cts.map +1 -0
- package/dist/auth/file.d.ts +157 -0
- package/dist/auth/file.d.ts.map +1 -0
- package/dist/auth/file.js +210 -0
- package/dist/auth/file.js.map +1 -0
- package/dist/auth/in-memory.cjs +184 -0
- package/dist/auth/in-memory.cjs.map +1 -0
- package/dist/auth/in-memory.d.cts +147 -0
- package/dist/auth/in-memory.d.cts.map +1 -0
- package/dist/auth/in-memory.d.ts +147 -0
- package/dist/auth/in-memory.d.ts.map +1 -0
- package/dist/auth/in-memory.js +184 -0
- package/dist/auth/in-memory.js.map +1 -0
- package/dist/auth/index.cjs +10 -0
- package/dist/auth/index.cjs.map +1 -0
- package/dist/auth/index.d.cts +6 -0
- package/dist/auth/index.d.cts.map +1 -0
- package/dist/auth/index.d.ts +6 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +10 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/realms.cjs +12 -0
- package/dist/auth/realms.cjs.map +1 -0
- package/dist/auth/realms.d.cts +12 -0
- package/dist/auth/realms.d.cts.map +1 -0
- package/dist/auth/realms.d.ts +12 -0
- package/dist/auth/realms.d.ts.map +1 -0
- package/dist/auth/realms.js +12 -0
- package/dist/auth/realms.js.map +1 -0
- package/dist/auth/upload-url-pool.cjs +52 -0
- package/dist/auth/upload-url-pool.cjs.map +1 -0
- package/dist/auth/upload-url-pool.d.cts +35 -0
- package/dist/auth/upload-url-pool.d.cts.map +1 -0
- package/dist/auth/upload-url-pool.d.ts +35 -0
- package/dist/auth/upload-url-pool.d.ts.map +1 -0
- package/dist/auth/upload-url-pool.js +52 -0
- package/dist/auth/upload-url-pool.js.map +1 -0
- package/dist/bucket.cjs +789 -0
- package/dist/bucket.cjs.map +1 -0
- package/dist/bucket.d.cts +659 -0
- package/dist/bucket.d.cts.map +1 -0
- package/dist/bucket.d.ts +659 -0
- package/dist/bucket.d.ts.map +1 -0
- package/dist/bucket.js +789 -0
- package/dist/bucket.js.map +1 -0
- package/dist/client.cjs +230 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +222 -0
- package/dist/client.d.cts.map +1 -0
- package/dist/client.d.ts +222 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +230 -0
- package/dist/client.js.map +1 -0
- package/dist/copy/large.cjs +74 -0
- package/dist/copy/large.cjs.map +1 -0
- package/dist/copy/large.d.cts +53 -0
- package/dist/copy/large.d.cts.map +1 -0
- package/dist/copy/large.d.ts +53 -0
- package/dist/copy/large.d.ts.map +1 -0
- package/dist/copy/large.js +74 -0
- package/dist/copy/large.js.map +1 -0
- package/dist/download/parallel.cjs +122 -0
- package/dist/download/parallel.cjs.map +1 -0
- package/dist/download/parallel.d.cts +42 -0
- package/dist/download/parallel.d.cts.map +1 -0
- package/dist/download/parallel.d.ts +42 -0
- package/dist/download/parallel.d.ts.map +1 -0
- package/dist/download/parallel.js +122 -0
- package/dist/download/parallel.js.map +1 -0
- package/dist/download/single.cjs +117 -0
- package/dist/download/single.cjs.map +1 -0
- package/dist/download/single.d.cts +152 -0
- package/dist/download/single.d.cts.map +1 -0
- package/dist/download/single.d.ts +152 -0
- package/dist/download/single.d.ts.map +1 -0
- package/dist/download/single.js +117 -0
- package/dist/download/single.js.map +1 -0
- package/dist/errors/index.cjs +268 -0
- package/dist/errors/index.cjs.map +1 -0
- package/dist/errors/index.d.cts +264 -0
- package/dist/errors/index.d.cts.map +1 -0
- package/dist/errors/index.d.ts +264 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +268 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/http/retry.cjs +36 -0
- package/dist/http/retry.cjs.map +1 -0
- package/dist/http/retry.d.cts +34 -0
- package/dist/http/retry.d.cts.map +1 -0
- package/dist/http/retry.d.ts +34 -0
- package/dist/http/retry.d.ts.map +1 -0
- package/dist/http/retry.js +36 -0
- package/dist/http/retry.js.map +1 -0
- package/dist/http/transport.cjs +143 -0
- package/dist/http/transport.cjs.map +1 -0
- package/dist/http/transport.d.cts +122 -0
- package/dist/http/transport.d.cts.map +1 -0
- package/dist/http/transport.d.ts +122 -0
- package/dist/http/transport.d.ts.map +1 -0
- package/dist/http/transport.js +143 -0
- package/dist/http/transport.js.map +1 -0
- package/dist/http/url-guard.cjs +97 -0
- package/dist/http/url-guard.cjs.map +1 -0
- package/dist/http/url-guard.d.cts +88 -0
- package/dist/http/url-guard.d.cts.map +1 -0
- package/dist/http/url-guard.d.ts +88 -0
- package/dist/http/url-guard.d.ts.map +1 -0
- package/dist/http/url-guard.js +97 -0
- package/dist/http/url-guard.js.map +1 -0
- package/dist/http/user-agent.cjs +51 -0
- package/dist/http/user-agent.cjs.map +1 -0
- package/dist/http/user-agent.d.cts +28 -0
- package/dist/http/user-agent.d.cts.map +1 -0
- package/dist/http/user-agent.d.ts +28 -0
- package/dist/http/user-agent.d.ts.map +1 -0
- package/dist/http/user-agent.js +51 -0
- package/dist/http/user-agent.js.map +1 -0
- package/dist/index.cjs +78 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +39 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +78 -0
- package/dist/index.js.map +1 -0
- package/dist/notifications/index.cjs +7 -0
- package/dist/notifications/index.cjs.map +1 -0
- package/dist/notifications/index.d.cts +3 -0
- package/dist/notifications/index.d.cts.map +1 -0
- package/dist/notifications/index.d.ts +3 -0
- package/dist/notifications/index.d.ts.map +1 -0
- package/dist/notifications/index.js +7 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/notifications/webhook.cjs +106 -0
- package/dist/notifications/webhook.cjs.map +1 -0
- package/dist/notifications/webhook.d.cts +146 -0
- package/dist/notifications/webhook.d.cts.map +1 -0
- package/dist/notifications/webhook.d.ts +146 -0
- package/dist/notifications/webhook.d.ts.map +1 -0
- package/dist/notifications/webhook.js +106 -0
- package/dist/notifications/webhook.js.map +1 -0
- package/dist/object.cjs +212 -0
- package/dist/object.cjs.map +1 -0
- package/dist/object.d.cts +263 -0
- package/dist/object.d.cts.map +1 -0
- package/dist/object.d.ts +263 -0
- package/dist/object.d.ts.map +1 -0
- package/dist/object.js +212 -0
- package/dist/object.js.map +1 -0
- package/dist/package.json.cjs +9 -0
- package/dist/package.json.cjs.map +1 -0
- package/dist/package.json.js +9 -0
- package/dist/package.json.js.map +1 -0
- package/dist/raw/encoding.cjs +47 -0
- package/dist/raw/encoding.cjs.map +1 -0
- package/dist/raw/encoding.d.cts +46 -0
- package/dist/raw/encoding.d.cts.map +1 -0
- package/dist/raw/encoding.d.ts +46 -0
- package/dist/raw/encoding.d.ts.map +1 -0
- package/dist/raw/encoding.js +47 -0
- package/dist/raw/encoding.js.map +1 -0
- package/dist/raw/index.cjs +600 -0
- package/dist/raw/index.cjs.map +1 -0
- package/dist/raw/index.d.cts +381 -0
- package/dist/raw/index.d.cts.map +1 -0
- package/dist/raw/index.d.ts +381 -0
- package/dist/raw/index.d.ts.map +1 -0
- package/dist/raw/index.js +601 -0
- package/dist/raw/index.js.map +1 -0
- package/dist/s3/index.cjs +23 -0
- package/dist/s3/index.cjs.map +1 -0
- package/dist/s3/index.d.cts +74 -0
- package/dist/s3/index.d.cts.map +1 -0
- package/dist/s3/index.d.ts +74 -0
- package/dist/s3/index.d.ts.map +1 -0
- package/dist/s3/index.js +23 -0
- package/dist/s3/index.js.map +1 -0
- package/dist/simulator/capabilities.cjs +53 -0
- package/dist/simulator/capabilities.cjs.map +1 -0
- package/dist/simulator/capabilities.d.cts +15 -0
- package/dist/simulator/capabilities.d.cts.map +1 -0
- package/dist/simulator/capabilities.d.ts +15 -0
- package/dist/simulator/capabilities.d.ts.map +1 -0
- package/dist/simulator/capabilities.js +53 -0
- package/dist/simulator/capabilities.js.map +1 -0
- package/dist/simulator/index.cjs +1559 -0
- package/dist/simulator/index.cjs.map +1 -0
- package/dist/simulator/index.d.cts +495 -0
- package/dist/simulator/index.d.cts.map +1 -0
- package/dist/simulator/index.d.ts +495 -0
- package/dist/simulator/index.d.ts.map +1 -0
- package/dist/simulator/index.js +1560 -0
- package/dist/simulator/index.js.map +1 -0
- package/dist/simulator/validation.cjs +174 -0
- package/dist/simulator/validation.cjs.map +1 -0
- package/dist/simulator/validation.d.cts +104 -0
- package/dist/simulator/validation.d.cts.map +1 -0
- package/dist/simulator/validation.d.ts +104 -0
- package/dist/simulator/validation.d.ts.map +1 -0
- package/dist/simulator/validation.js +174 -0
- package/dist/simulator/validation.js.map +1 -0
- package/dist/streams/collect.cjs +26 -0
- package/dist/streams/collect.cjs.map +1 -0
- package/dist/streams/collect.d.cts +18 -0
- package/dist/streams/collect.d.cts.map +1 -0
- package/dist/streams/collect.d.ts +18 -0
- package/dist/streams/collect.d.ts.map +1 -0
- package/dist/streams/collect.js +26 -0
- package/dist/streams/collect.js.map +1 -0
- package/dist/streams/hash.cjs +123 -0
- package/dist/streams/hash.cjs.map +1 -0
- package/dist/streams/hash.d.cts +42 -0
- package/dist/streams/hash.d.cts.map +1 -0
- package/dist/streams/hash.d.ts +42 -0
- package/dist/streams/hash.d.ts.map +1 -0
- package/dist/streams/hash.js +101 -0
- package/dist/streams/hash.js.map +1 -0
- package/dist/streams/index.cjs +13 -0
- package/dist/streams/index.cjs.map +1 -0
- package/dist/streams/index.d.cts +7 -0
- package/dist/streams/index.d.cts.map +1 -0
- package/dist/streams/index.d.ts +7 -0
- package/dist/streams/index.d.ts.map +1 -0
- package/dist/streams/index.js +13 -0
- package/dist/streams/index.js.map +1 -0
- package/dist/streams/progress.cjs +47 -0
- package/dist/streams/progress.cjs.map +1 -0
- package/dist/streams/progress.d.cts +53 -0
- package/dist/streams/progress.d.cts.map +1 -0
- package/dist/streams/progress.d.ts +53 -0
- package/dist/streams/progress.d.ts.map +1 -0
- package/dist/streams/progress.js +47 -0
- package/dist/streams/progress.js.map +1 -0
- package/dist/streams/source.cjs +155 -0
- package/dist/streams/source.cjs.map +1 -0
- package/dist/streams/source.d.cts +140 -0
- package/dist/streams/source.d.cts.map +1 -0
- package/dist/streams/source.d.ts +140 -0
- package/dist/streams/source.d.ts.map +1 -0
- package/dist/streams/source.js +155 -0
- package/dist/streams/source.js.map +1 -0
- package/dist/sync/actions/index.cjs +191 -0
- package/dist/sync/actions/index.cjs.map +1 -0
- package/dist/sync/actions/index.d.cts +167 -0
- package/dist/sync/actions/index.d.cts.map +1 -0
- package/dist/sync/actions/index.d.ts +167 -0
- package/dist/sync/actions/index.d.ts.map +1 -0
- package/dist/sync/actions/index.js +191 -0
- package/dist/sync/actions/index.js.map +1 -0
- package/dist/sync/index.cjs +23 -0
- package/dist/sync/index.cjs.map +1 -0
- package/dist/sync/index.d.cts +21 -0
- package/dist/sync/index.d.cts.map +1 -0
- package/dist/sync/index.d.ts +21 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +23 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/pairing.cjs +31 -0
- package/dist/sync/pairing.cjs.map +1 -0
- package/dist/sync/pairing.d.cts +13 -0
- package/dist/sync/pairing.d.cts.map +1 -0
- package/dist/sync/pairing.d.ts +13 -0
- package/dist/sync/pairing.d.ts.map +1 -0
- package/dist/sync/pairing.js +31 -0
- package/dist/sync/pairing.js.map +1 -0
- package/dist/sync/policies/compare.cjs +14 -0
- package/dist/sync/policies/compare.cjs.map +1 -0
- package/dist/sync/policies/compare.d.cts +13 -0
- package/dist/sync/policies/compare.d.cts.map +1 -0
- package/dist/sync/policies/compare.d.ts +13 -0
- package/dist/sync/policies/compare.d.ts.map +1 -0
- package/dist/sync/policies/compare.js +14 -0
- package/dist/sync/policies/compare.js.map +1 -0
- package/dist/sync/policies/index.cjs +74 -0
- package/dist/sync/policies/index.cjs.map +1 -0
- package/dist/sync/policies/index.d.cts +42 -0
- package/dist/sync/policies/index.d.cts.map +1 -0
- package/dist/sync/policies/index.d.ts +42 -0
- package/dist/sync/policies/index.d.ts.map +1 -0
- package/dist/sync/policies/index.js +74 -0
- package/dist/sync/policies/index.js.map +1 -0
- package/dist/sync/scanners/b2.cjs +57 -0
- package/dist/sync/scanners/b2.cjs.map +1 -0
- package/dist/sync/scanners/b2.d.cts +20 -0
- package/dist/sync/scanners/b2.d.cts.map +1 -0
- package/dist/sync/scanners/b2.d.ts +20 -0
- package/dist/sync/scanners/b2.d.ts.map +1 -0
- package/dist/sync/scanners/b2.js +57 -0
- package/dist/sync/scanners/b2.js.map +1 -0
- package/dist/sync/scanners/local.cjs +58 -0
- package/dist/sync/scanners/local.cjs.map +1 -0
- package/dist/sync/scanners/local.d.cts +24 -0
- package/dist/sync/scanners/local.d.cts.map +1 -0
- package/dist/sync/scanners/local.d.ts +24 -0
- package/dist/sync/scanners/local.d.ts.map +1 -0
- package/dist/sync/scanners/local.js +58 -0
- package/dist/sync/scanners/local.js.map +1 -0
- package/dist/sync/synchronizer.cjs +203 -0
- package/dist/sync/synchronizer.cjs.map +1 -0
- package/dist/sync/synchronizer.d.cts +52 -0
- package/dist/sync/synchronizer.d.cts.map +1 -0
- package/dist/sync/synchronizer.d.ts +52 -0
- package/dist/sync/synchronizer.d.ts.map +1 -0
- package/dist/sync/synchronizer.js +181 -0
- package/dist/sync/synchronizer.js.map +1 -0
- package/dist/sync/types.d.cts +121 -0
- package/dist/sync/types.d.cts.map +1 -0
- package/dist/sync/types.d.ts +121 -0
- package/dist/sync/types.d.ts.map +1 -0
- package/dist/types/auth.cjs +58 -0
- package/dist/types/auth.cjs.map +1 -0
- package/dist/types/auth.d.cts +150 -0
- package/dist/types/auth.d.cts.map +1 -0
- package/dist/types/auth.d.ts +150 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/auth.js +58 -0
- package/dist/types/auth.js.map +1 -0
- package/dist/types/bucket.cjs +44 -0
- package/dist/types/bucket.cjs.map +1 -0
- package/dist/types/bucket.d.cts +245 -0
- package/dist/types/bucket.d.cts.map +1 -0
- package/dist/types/bucket.d.ts +245 -0
- package/dist/types/bucket.d.ts.map +1 -0
- package/dist/types/bucket.js +44 -0
- package/dist/types/bucket.js.map +1 -0
- package/dist/types/download.d.cts +110 -0
- package/dist/types/download.d.cts.map +1 -0
- package/dist/types/download.d.ts +110 -0
- package/dist/types/download.d.ts.map +1 -0
- package/dist/types/encryption.cjs +343 -0
- package/dist/types/encryption.cjs.map +1 -0
- package/dist/types/encryption.d.cts +132 -0
- package/dist/types/encryption.d.cts.map +1 -0
- package/dist/types/encryption.d.ts +132 -0
- package/dist/types/encryption.d.ts.map +1 -0
- package/dist/types/encryption.js +321 -0
- package/dist/types/encryption.js.map +1 -0
- package/dist/types/errors.d.cts +16 -0
- package/dist/types/errors.d.cts.map +1 -0
- package/dist/types/errors.d.ts +16 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/file.cjs +23 -0
- package/dist/types/file.cjs.map +1 -0
- package/dist/types/file.d.cts +220 -0
- package/dist/types/file.d.cts.map +1 -0
- package/dist/types/file.d.ts +220 -0
- package/dist/types/file.d.ts.map +1 -0
- package/dist/types/file.js +23 -0
- package/dist/types/file.js.map +1 -0
- package/dist/types/ids.cjs +27 -0
- package/dist/types/ids.cjs.map +1 -0
- package/dist/types/ids.d.cts +84 -0
- package/dist/types/ids.d.cts.map +1 -0
- package/dist/types/ids.d.ts +84 -0
- package/dist/types/ids.d.ts.map +1 -0
- package/dist/types/ids.js +27 -0
- package/dist/types/ids.js.map +1 -0
- package/dist/types/index.d.cts +25 -0
- package/dist/types/index.d.cts.map +1 -0
- package/dist/types/index.d.ts +25 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/key.d.cts +84 -0
- package/dist/types/key.d.cts.map +1 -0
- package/dist/types/key.d.ts +84 -0
- package/dist/types/key.d.ts.map +1 -0
- package/dist/types/lock.cjs +17 -0
- package/dist/types/lock.cjs.map +1 -0
- package/dist/types/lock.d.cts +92 -0
- package/dist/types/lock.d.cts.map +1 -0
- package/dist/types/lock.d.ts +92 -0
- package/dist/types/lock.d.ts.map +1 -0
- package/dist/types/lock.js +17 -0
- package/dist/types/lock.js.map +1 -0
- package/dist/types/notifications.cjs +24 -0
- package/dist/types/notifications.cjs.map +1 -0
- package/dist/types/notifications.d.cts +97 -0
- package/dist/types/notifications.d.cts.map +1 -0
- package/dist/types/notifications.d.ts +97 -0
- package/dist/types/notifications.d.ts.map +1 -0
- package/dist/types/notifications.js +24 -0
- package/dist/types/notifications.js.map +1 -0
- package/dist/types/replication.d.cts +42 -0
- package/dist/types/replication.d.cts.map +1 -0
- package/dist/types/replication.d.ts +42 -0
- package/dist/types/replication.d.ts.map +1 -0
- package/dist/types/upload.d.cts +219 -0
- package/dist/types/upload.d.cts.map +1 -0
- package/dist/types/upload.d.ts +219 -0
- package/dist/types/upload.d.ts.map +1 -0
- package/dist/upload/cancel.cjs +10 -0
- package/dist/upload/cancel.cjs.map +1 -0
- package/dist/upload/cancel.d.cts +23 -0
- package/dist/upload/cancel.d.cts.map +1 -0
- package/dist/upload/cancel.d.ts +23 -0
- package/dist/upload/cancel.d.ts.map +1 -0
- package/dist/upload/cancel.js +10 -0
- package/dist/upload/cancel.js.map +1 -0
- package/dist/upload/concurrency.cjs +54 -0
- package/dist/upload/concurrency.cjs.map +1 -0
- package/dist/upload/concurrency.d.cts +46 -0
- package/dist/upload/concurrency.d.cts.map +1 -0
- package/dist/upload/concurrency.d.ts +46 -0
- package/dist/upload/concurrency.d.ts.map +1 -0
- package/dist/upload/concurrency.js +54 -0
- package/dist/upload/concurrency.js.map +1 -0
- package/dist/upload/large.cjs +222 -0
- package/dist/upload/large.cjs.map +1 -0
- package/dist/upload/large.d.cts +71 -0
- package/dist/upload/large.d.cts.map +1 -0
- package/dist/upload/large.d.ts +71 -0
- package/dist/upload/large.d.ts.map +1 -0
- package/dist/upload/large.js +222 -0
- package/dist/upload/large.js.map +1 -0
- package/dist/upload/resume.cjs +34 -0
- package/dist/upload/resume.cjs.map +1 -0
- package/dist/upload/resume.d.cts +33 -0
- package/dist/upload/resume.d.cts.map +1 -0
- package/dist/upload/resume.d.ts +33 -0
- package/dist/upload/resume.d.ts.map +1 -0
- package/dist/upload/resume.js +34 -0
- package/dist/upload/resume.js.map +1 -0
- package/dist/upload/single.cjs +47 -0
- package/dist/upload/single.cjs.map +1 -0
- package/dist/upload/single.d.cts +51 -0
- package/dist/upload/single.d.cts.map +1 -0
- package/dist/upload/single.d.ts +51 -0
- package/dist/upload/single.d.ts.map +1 -0
- package/dist/upload/single.js +47 -0
- package/dist/upload/single.js.map +1 -0
- package/dist/upload/stream.cjs +198 -0
- package/dist/upload/stream.cjs.map +1 -0
- package/dist/upload/stream.d.cts +61 -0
- package/dist/upload/stream.d.cts.map +1 -0
- package/dist/upload/stream.d.ts +61 -0
- package/dist/upload/stream.d.ts.map +1 -0
- package/dist/upload/stream.js +198 -0
- package/dist/upload/stream.js.map +1 -0
- package/dist/util/best-effort.cjs +10 -0
- package/dist/util/best-effort.cjs.map +1 -0
- package/dist/util/best-effort.d.cts +31 -0
- package/dist/util/best-effort.d.cts.map +1 -0
- package/dist/util/best-effort.d.ts +31 -0
- package/dist/util/best-effort.d.ts.map +1 -0
- package/dist/util/best-effort.js +10 -0
- package/dist/util/best-effort.js.map +1 -0
- package/dist/util/defaults.cjs +11 -0
- package/dist/util/defaults.cjs.map +1 -0
- package/dist/util/defaults.d.cts +54 -0
- package/dist/util/defaults.d.cts.map +1 -0
- package/dist/util/defaults.d.ts +54 -0
- package/dist/util/defaults.d.ts.map +1 -0
- package/dist/util/defaults.js +11 -0
- package/dist/util/defaults.js.map +1 -0
- package/dist/util/normalize.cjs +16 -0
- package/dist/util/normalize.cjs.map +1 -0
- package/dist/util/normalize.d.cts +62 -0
- package/dist/util/normalize.d.cts.map +1 -0
- package/dist/util/normalize.d.ts +62 -0
- package/dist/util/normalize.d.ts.map +1 -0
- package/dist/util/normalize.js +16 -0
- package/dist/util/normalize.js.map +1 -0
- package/dist/util/paginator.cjs +20 -0
- package/dist/util/paginator.cjs.map +1 -0
- package/dist/util/paginator.d.cts +120 -0
- package/dist/util/paginator.d.cts.map +1 -0
- package/dist/util/paginator.d.ts +120 -0
- package/dist/util/paginator.d.ts.map +1 -0
- package/dist/util/paginator.js +20 -0
- package/dist/util/paginator.js.map +1 -0
- package/dist/util/plan-ranges.cjs +28 -0
- package/dist/util/plan-ranges.cjs.map +1 -0
- package/dist/util/plan-ranges.d.cts +56 -0
- package/dist/util/plan-ranges.d.cts.map +1 -0
- package/dist/util/plan-ranges.d.ts +56 -0
- package/dist/util/plan-ranges.d.ts.map +1 -0
- package/dist/util/plan-ranges.js +28 -0
- package/dist/util/plan-ranges.js.map +1 -0
- package/dist/util/text-codec.cjs +7 -0
- package/dist/util/text-codec.cjs.map +1 -0
- package/dist/util/text-codec.d.cts +26 -0
- package/dist/util/text-codec.d.cts.map +1 -0
- package/dist/util/text-codec.d.ts +26 -0
- package/dist/util/text-codec.d.ts.map +1 -0
- package/dist/util/text-codec.js +7 -0
- package/dist/util/text-codec.js.map +1 -0
- package/dist/util/to-error.cjs +7 -0
- package/dist/util/to-error.cjs.map +1 -0
- package/dist/util/to-error.d.cts +15 -0
- package/dist/util/to-error.d.cts.map +1 -0
- package/dist/util/to-error.d.ts +15 -0
- package/dist/util/to-error.d.ts.map +1 -0
- package/dist/util/to-error.js +7 -0
- package/dist/util/to-error.js.map +1 -0
- package/dist/version.cjs +6 -0
- package/dist/version.cjs.map +1 -0
- package/dist/version.d.cts +14 -0
- package/dist/version.d.cts.map +1 -0
- package/dist/version.d.ts +14 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/package.json +198 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { AuthorizeAccountResponse } from '../types/auth.js';
|
|
2
|
+
import { BucketId } from '../types/ids.js';
|
|
3
|
+
import { AccountInfo, UploadUrlEntry } from './account-info.js';
|
|
4
|
+
/**
|
|
5
|
+
* In-memory implementation of {@link AccountInfo}.
|
|
6
|
+
* Stores the authorization response and upload URL pools in plain object fields.
|
|
7
|
+
* Suitable for short-lived processes or tests; state is lost when the process exits.
|
|
8
|
+
*/
|
|
9
|
+
export declare class InMemoryAccountInfo implements AccountInfo {
|
|
10
|
+
/** Cached authorization response, or null before authorize() is called. */
|
|
11
|
+
private auth;
|
|
12
|
+
/** Pool of reusable small-file upload URLs, keyed by bucket ID. */
|
|
13
|
+
private readonly uploadUrls;
|
|
14
|
+
/** Pool of reusable large-file part upload URLs, keyed by file ID. */
|
|
15
|
+
private readonly partUploadUrls;
|
|
16
|
+
/**
|
|
17
|
+
* Store a fresh authorization response, replacing any previous state.
|
|
18
|
+
*
|
|
19
|
+
* @param auth - The authorize account response to store.
|
|
20
|
+
*/
|
|
21
|
+
setAuth(auth: AuthorizeAccountResponse): void;
|
|
22
|
+
/**
|
|
23
|
+
* Return the current authorization response, or null if not authorized.
|
|
24
|
+
*
|
|
25
|
+
* @returns The cached authorization response, or null if not yet authorized.
|
|
26
|
+
*/
|
|
27
|
+
getAuth(): AuthorizeAccountResponse | null;
|
|
28
|
+
/** Discard all cached authorization state and upload URLs. */
|
|
29
|
+
clear(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Base URL for B2 API calls.
|
|
32
|
+
*
|
|
33
|
+
* @returns The base URL for B2 API calls.
|
|
34
|
+
*
|
|
35
|
+
* @throws Error if not yet authorized.
|
|
36
|
+
*/
|
|
37
|
+
getApiUrl(): string;
|
|
38
|
+
/**
|
|
39
|
+
* Base URL for file downloads.
|
|
40
|
+
*
|
|
41
|
+
* @returns The base URL for file downloads.
|
|
42
|
+
*
|
|
43
|
+
* @throws Error if not yet authorized.
|
|
44
|
+
*/
|
|
45
|
+
getDownloadUrl(): string;
|
|
46
|
+
/**
|
|
47
|
+
* Current authorization token.
|
|
48
|
+
*
|
|
49
|
+
* @returns The current authorization token.
|
|
50
|
+
*
|
|
51
|
+
* @throws Error if not yet authorized.
|
|
52
|
+
*/
|
|
53
|
+
getAuthToken(): string;
|
|
54
|
+
/**
|
|
55
|
+
* The authorized account ID.
|
|
56
|
+
*
|
|
57
|
+
* @returns The authorized account identifier.
|
|
58
|
+
*
|
|
59
|
+
* @throws Error if not yet authorized.
|
|
60
|
+
*/
|
|
61
|
+
getAccountId(): string;
|
|
62
|
+
/**
|
|
63
|
+
* Server-recommended part size for large file uploads, in bytes.
|
|
64
|
+
*
|
|
65
|
+
* @returns The server-recommended part size in bytes.
|
|
66
|
+
*
|
|
67
|
+
* @throws Error if not yet authorized.
|
|
68
|
+
*/
|
|
69
|
+
getRecommendedPartSize(): number;
|
|
70
|
+
/**
|
|
71
|
+
* Smallest allowed part size for large file uploads, in bytes.
|
|
72
|
+
*
|
|
73
|
+
* @returns The smallest allowed part size in bytes.
|
|
74
|
+
*
|
|
75
|
+
* @throws Error if not yet authorized.
|
|
76
|
+
*/
|
|
77
|
+
getAbsoluteMinimumPartSize(): number;
|
|
78
|
+
/**
|
|
79
|
+
* Base URL for the S3-compatible API.
|
|
80
|
+
*
|
|
81
|
+
* @returns The base URL for the S3-compatible API.
|
|
82
|
+
*
|
|
83
|
+
* @throws Error if not yet authorized.
|
|
84
|
+
*/
|
|
85
|
+
getS3ApiUrl(): string;
|
|
86
|
+
/**
|
|
87
|
+
* Bucket ID the key is restricted to, or null if unrestricted.
|
|
88
|
+
*
|
|
89
|
+
* @returns The restricted bucket identifier, or null if the key is unrestricted.
|
|
90
|
+
*
|
|
91
|
+
* @throws Error if not yet authorized.
|
|
92
|
+
*/
|
|
93
|
+
getAllowedBucketId(): BucketId | null;
|
|
94
|
+
/**
|
|
95
|
+
* Take an upload URL from the pool for the given bucket, or null if none available.
|
|
96
|
+
*
|
|
97
|
+
* @param bucketId - The bucket to check out an upload URL for.
|
|
98
|
+
*
|
|
99
|
+
* @returns A reusable upload URL entry, or null if none are available.
|
|
100
|
+
*/
|
|
101
|
+
checkoutUploadUrl(bucketId: BucketId): UploadUrlEntry | null;
|
|
102
|
+
/**
|
|
103
|
+
* Return a still-valid upload URL to the pool for reuse.
|
|
104
|
+
*
|
|
105
|
+
* @param bucketId - The bucket the upload URL belongs to.
|
|
106
|
+
* @param entry - The upload URL entry to return to the pool.
|
|
107
|
+
*/
|
|
108
|
+
returnUploadUrl(bucketId: BucketId, entry: UploadUrlEntry): void;
|
|
109
|
+
/**
|
|
110
|
+
* Remove an upload URL from the pool after an upload error.
|
|
111
|
+
*
|
|
112
|
+
* @param bucketId - The bucket the failed upload URL belongs to.
|
|
113
|
+
* @param entry - The upload URL entry to remove from the pool.
|
|
114
|
+
*/
|
|
115
|
+
evictUploadUrl(bucketId: BucketId, entry: UploadUrlEntry): void;
|
|
116
|
+
/**
|
|
117
|
+
* Take a large-file part upload URL from the pool, or null if none available.
|
|
118
|
+
*
|
|
119
|
+
* @param fileId - The large file to check out a part upload URL for.
|
|
120
|
+
*
|
|
121
|
+
* @returns A reusable part upload URL entry, or null if none are available.
|
|
122
|
+
*/
|
|
123
|
+
checkoutPartUploadUrl(fileId: string): UploadUrlEntry | null;
|
|
124
|
+
/**
|
|
125
|
+
* Return a still-valid part upload URL to the pool for reuse.
|
|
126
|
+
*
|
|
127
|
+
* @param fileId - The large file the part upload URL belongs to.
|
|
128
|
+
* @param entry - The part upload URL entry to return to the pool.
|
|
129
|
+
*/
|
|
130
|
+
returnPartUploadUrl(fileId: string, entry: UploadUrlEntry): void;
|
|
131
|
+
/**
|
|
132
|
+
* Remove a part upload URL from the pool after an error.
|
|
133
|
+
*
|
|
134
|
+
* @param fileId - The large file the failed part upload URL belongs to.
|
|
135
|
+
* @param entry - The part upload URL entry to remove from the pool.
|
|
136
|
+
*/
|
|
137
|
+
evictPartUploadUrl(fileId: string, entry: UploadUrlEntry): void;
|
|
138
|
+
/**
|
|
139
|
+
* Retrieve the cached auth response or throw if not yet authorized.
|
|
140
|
+
*
|
|
141
|
+
* @returns The cached authorization response.
|
|
142
|
+
*
|
|
143
|
+
* @throws Error if authorize() has not been called.
|
|
144
|
+
*/
|
|
145
|
+
private requireAuth;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=in-memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-memory.d.ts","sourceRoot":"","sources":["../../src/auth/in-memory.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAGpE;;;;GAIG;AACH,qBAAa,mBAAoB,YAAW,WAAW;IACrD,2EAA2E;IAC3E,OAAO,CAAC,IAAI,CAAwC;IACpD,mEAAmE;IACnE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IACjD,sEAAsE;IACtE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAsB;IAErD;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,wBAAwB,GAAG,IAAI;IAM7C;;;;OAIG;IACH,OAAO,IAAI,wBAAwB,GAAG,IAAI;IAI1C,8DAA8D;IAC9D,KAAK,IAAI,IAAI;IAMb;;;;;;OAMG;IACH,SAAS,IAAI,MAAM;IAInB;;;;;;OAMG;IACH,cAAc,IAAI,MAAM;IAIxB;;;;;;OAMG;IACH,YAAY,IAAI,MAAM;IAItB;;;;;;OAMG;IACH,YAAY,IAAI,MAAM;IAItB;;;;;;OAMG;IACH,sBAAsB,IAAI,MAAM;IAIhC;;;;;;OAMG;IACH,0BAA0B,IAAI,MAAM;IAIpC;;;;;;OAMG;IACH,WAAW,IAAI,MAAM;IAIrB;;;;;;OAMG;IACH,kBAAkB,IAAI,QAAQ,GAAG,IAAI;IAIrC;;;;;;OAMG;IACH,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,cAAc,GAAG,IAAI;IAI5D;;;;;OAKG;IACH,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI;IAIhE;;;;;OAKG;IACH,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI;IAI/D;;;;;;OAMG;IACH,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAI5D;;;;;OAKG;IACH,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI;IAIhE;;;;;OAKG;IACH,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI;IAI/D;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;CAIpB"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { UploadUrlPool } from "./upload-url-pool.js";
|
|
2
|
+
class InMemoryAccountInfo {
|
|
3
|
+
/** Cached authorization response, or null before authorize() is called. */
|
|
4
|
+
auth = null;
|
|
5
|
+
/** Pool of reusable small-file upload URLs, keyed by bucket ID. */
|
|
6
|
+
uploadUrls = new UploadUrlPool();
|
|
7
|
+
/** Pool of reusable large-file part upload URLs, keyed by file ID. */
|
|
8
|
+
partUploadUrls = new UploadUrlPool();
|
|
9
|
+
/**
|
|
10
|
+
* Store a fresh authorization response, replacing any previous state.
|
|
11
|
+
*
|
|
12
|
+
* @param auth - The authorize account response to store.
|
|
13
|
+
*/
|
|
14
|
+
setAuth(auth) {
|
|
15
|
+
this.auth = auth;
|
|
16
|
+
this.uploadUrls.clear();
|
|
17
|
+
this.partUploadUrls.clear();
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Return the current authorization response, or null if not authorized.
|
|
21
|
+
*
|
|
22
|
+
* @returns The cached authorization response, or null if not yet authorized.
|
|
23
|
+
*/
|
|
24
|
+
getAuth() {
|
|
25
|
+
return this.auth;
|
|
26
|
+
}
|
|
27
|
+
/** Discard all cached authorization state and upload URLs. */
|
|
28
|
+
clear() {
|
|
29
|
+
this.auth = null;
|
|
30
|
+
this.uploadUrls.clear();
|
|
31
|
+
this.partUploadUrls.clear();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Base URL for B2 API calls.
|
|
35
|
+
*
|
|
36
|
+
* @returns The base URL for B2 API calls.
|
|
37
|
+
*
|
|
38
|
+
* @throws Error if not yet authorized.
|
|
39
|
+
*/
|
|
40
|
+
getApiUrl() {
|
|
41
|
+
return this.requireAuth().apiInfo.storageApi.apiUrl;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Base URL for file downloads.
|
|
45
|
+
*
|
|
46
|
+
* @returns The base URL for file downloads.
|
|
47
|
+
*
|
|
48
|
+
* @throws Error if not yet authorized.
|
|
49
|
+
*/
|
|
50
|
+
getDownloadUrl() {
|
|
51
|
+
return this.requireAuth().apiInfo.storageApi.downloadUrl;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Current authorization token.
|
|
55
|
+
*
|
|
56
|
+
* @returns The current authorization token.
|
|
57
|
+
*
|
|
58
|
+
* @throws Error if not yet authorized.
|
|
59
|
+
*/
|
|
60
|
+
getAuthToken() {
|
|
61
|
+
return this.requireAuth().authorizationToken;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The authorized account ID.
|
|
65
|
+
*
|
|
66
|
+
* @returns The authorized account identifier.
|
|
67
|
+
*
|
|
68
|
+
* @throws Error if not yet authorized.
|
|
69
|
+
*/
|
|
70
|
+
getAccountId() {
|
|
71
|
+
return this.requireAuth().accountId;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Server-recommended part size for large file uploads, in bytes.
|
|
75
|
+
*
|
|
76
|
+
* @returns The server-recommended part size in bytes.
|
|
77
|
+
*
|
|
78
|
+
* @throws Error if not yet authorized.
|
|
79
|
+
*/
|
|
80
|
+
getRecommendedPartSize() {
|
|
81
|
+
return this.requireAuth().apiInfo.storageApi.recommendedPartSize;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Smallest allowed part size for large file uploads, in bytes.
|
|
85
|
+
*
|
|
86
|
+
* @returns The smallest allowed part size in bytes.
|
|
87
|
+
*
|
|
88
|
+
* @throws Error if not yet authorized.
|
|
89
|
+
*/
|
|
90
|
+
getAbsoluteMinimumPartSize() {
|
|
91
|
+
return this.requireAuth().apiInfo.storageApi.absoluteMinimumPartSize;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Base URL for the S3-compatible API.
|
|
95
|
+
*
|
|
96
|
+
* @returns The base URL for the S3-compatible API.
|
|
97
|
+
*
|
|
98
|
+
* @throws Error if not yet authorized.
|
|
99
|
+
*/
|
|
100
|
+
getS3ApiUrl() {
|
|
101
|
+
return this.requireAuth().apiInfo.storageApi.s3ApiUrl;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Bucket ID the key is restricted to, or null if unrestricted.
|
|
105
|
+
*
|
|
106
|
+
* @returns The restricted bucket identifier, or null if the key is unrestricted.
|
|
107
|
+
*
|
|
108
|
+
* @throws Error if not yet authorized.
|
|
109
|
+
*/
|
|
110
|
+
getAllowedBucketId() {
|
|
111
|
+
return this.requireAuth().apiInfo.storageApi.allowed.bucketId ?? null;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Take an upload URL from the pool for the given bucket, or null if none available.
|
|
115
|
+
*
|
|
116
|
+
* @param bucketId - The bucket to check out an upload URL for.
|
|
117
|
+
*
|
|
118
|
+
* @returns A reusable upload URL entry, or null if none are available.
|
|
119
|
+
*/
|
|
120
|
+
checkoutUploadUrl(bucketId) {
|
|
121
|
+
return this.uploadUrls.checkout(bucketId);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Return a still-valid upload URL to the pool for reuse.
|
|
125
|
+
*
|
|
126
|
+
* @param bucketId - The bucket the upload URL belongs to.
|
|
127
|
+
* @param entry - The upload URL entry to return to the pool.
|
|
128
|
+
*/
|
|
129
|
+
returnUploadUrl(bucketId, entry) {
|
|
130
|
+
this.uploadUrls.checkin(bucketId, entry);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Remove an upload URL from the pool after an upload error.
|
|
134
|
+
*
|
|
135
|
+
* @param bucketId - The bucket the failed upload URL belongs to.
|
|
136
|
+
* @param entry - The upload URL entry to remove from the pool.
|
|
137
|
+
*/
|
|
138
|
+
evictUploadUrl(bucketId, entry) {
|
|
139
|
+
this.uploadUrls.evict(bucketId, entry);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Take a large-file part upload URL from the pool, or null if none available.
|
|
143
|
+
*
|
|
144
|
+
* @param fileId - The large file to check out a part upload URL for.
|
|
145
|
+
*
|
|
146
|
+
* @returns A reusable part upload URL entry, or null if none are available.
|
|
147
|
+
*/
|
|
148
|
+
checkoutPartUploadUrl(fileId) {
|
|
149
|
+
return this.partUploadUrls.checkout(fileId);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Return a still-valid part upload URL to the pool for reuse.
|
|
153
|
+
*
|
|
154
|
+
* @param fileId - The large file the part upload URL belongs to.
|
|
155
|
+
* @param entry - The part upload URL entry to return to the pool.
|
|
156
|
+
*/
|
|
157
|
+
returnPartUploadUrl(fileId, entry) {
|
|
158
|
+
this.partUploadUrls.checkin(fileId, entry);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Remove a part upload URL from the pool after an error.
|
|
162
|
+
*
|
|
163
|
+
* @param fileId - The large file the failed part upload URL belongs to.
|
|
164
|
+
* @param entry - The part upload URL entry to remove from the pool.
|
|
165
|
+
*/
|
|
166
|
+
evictPartUploadUrl(fileId, entry) {
|
|
167
|
+
this.partUploadUrls.evict(fileId, entry);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Retrieve the cached auth response or throw if not yet authorized.
|
|
171
|
+
*
|
|
172
|
+
* @returns The cached authorization response.
|
|
173
|
+
*
|
|
174
|
+
* @throws Error if authorize() has not been called.
|
|
175
|
+
*/
|
|
176
|
+
requireAuth() {
|
|
177
|
+
if (!this.auth) throw new Error("Not authorized. Call authorize() first.");
|
|
178
|
+
return this.auth;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
export {
|
|
182
|
+
InMemoryAccountInfo
|
|
183
|
+
};
|
|
184
|
+
//# sourceMappingURL=in-memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-memory.js","sources":["../../src/auth/in-memory.ts"],"sourcesContent":["import type { AuthorizeAccountResponse } from '../types/auth.ts'\nimport type { BucketId } from '../types/ids.ts'\nimport type { AccountInfo, UploadUrlEntry } from './account-info.ts'\nimport { UploadUrlPool } from './upload-url-pool.ts'\n\n/**\n * In-memory implementation of {@link AccountInfo}.\n * Stores the authorization response and upload URL pools in plain object fields.\n * Suitable for short-lived processes or tests; state is lost when the process exits.\n */\nexport class InMemoryAccountInfo implements AccountInfo {\n /** Cached authorization response, or null before authorize() is called. */\n private auth: AuthorizeAccountResponse | null = null\n /** Pool of reusable small-file upload URLs, keyed by bucket ID. */\n private readonly uploadUrls = new UploadUrlPool()\n /** Pool of reusable large-file part upload URLs, keyed by file ID. */\n private readonly partUploadUrls = new UploadUrlPool()\n\n /**\n * Store a fresh authorization response, replacing any previous state.\n *\n * @param auth - The authorize account response to store.\n */\n setAuth(auth: AuthorizeAccountResponse): void {\n this.auth = auth\n this.uploadUrls.clear()\n this.partUploadUrls.clear()\n }\n\n /**\n * Return the current authorization response, or null if not authorized.\n *\n * @returns The cached authorization response, or null if not yet authorized.\n */\n getAuth(): AuthorizeAccountResponse | null {\n return this.auth\n }\n\n /** Discard all cached authorization state and upload URLs. */\n clear(): void {\n this.auth = null\n this.uploadUrls.clear()\n this.partUploadUrls.clear()\n }\n\n /**\n * Base URL for B2 API calls.\n *\n * @returns The base URL for B2 API calls.\n *\n * @throws Error if not yet authorized.\n */\n getApiUrl(): string {\n return this.requireAuth().apiInfo.storageApi.apiUrl\n }\n\n /**\n * Base URL for file downloads.\n *\n * @returns The base URL for file downloads.\n *\n * @throws Error if not yet authorized.\n */\n getDownloadUrl(): string {\n return this.requireAuth().apiInfo.storageApi.downloadUrl\n }\n\n /**\n * Current authorization token.\n *\n * @returns The current authorization token.\n *\n * @throws Error if not yet authorized.\n */\n getAuthToken(): string {\n return this.requireAuth().authorizationToken as string\n }\n\n /**\n * The authorized account ID.\n *\n * @returns The authorized account identifier.\n *\n * @throws Error if not yet authorized.\n */\n getAccountId(): string {\n return this.requireAuth().accountId as string\n }\n\n /**\n * Server-recommended part size for large file uploads, in bytes.\n *\n * @returns The server-recommended part size in bytes.\n *\n * @throws Error if not yet authorized.\n */\n getRecommendedPartSize(): number {\n return this.requireAuth().apiInfo.storageApi.recommendedPartSize\n }\n\n /**\n * Smallest allowed part size for large file uploads, in bytes.\n *\n * @returns The smallest allowed part size in bytes.\n *\n * @throws Error if not yet authorized.\n */\n getAbsoluteMinimumPartSize(): number {\n return this.requireAuth().apiInfo.storageApi.absoluteMinimumPartSize\n }\n\n /**\n * Base URL for the S3-compatible API.\n *\n * @returns The base URL for the S3-compatible API.\n *\n * @throws Error if not yet authorized.\n */\n getS3ApiUrl(): string {\n return this.requireAuth().apiInfo.storageApi.s3ApiUrl\n }\n\n /**\n * Bucket ID the key is restricted to, or null if unrestricted.\n *\n * @returns The restricted bucket identifier, or null if the key is unrestricted.\n *\n * @throws Error if not yet authorized.\n */\n getAllowedBucketId(): BucketId | null {\n return this.requireAuth().apiInfo.storageApi.allowed.bucketId ?? null\n }\n\n /**\n * Take an upload URL from the pool for the given bucket, or null if none available.\n *\n * @param bucketId - The bucket to check out an upload URL for.\n *\n * @returns A reusable upload URL entry, or null if none are available.\n */\n checkoutUploadUrl(bucketId: BucketId): UploadUrlEntry | null {\n return this.uploadUrls.checkout(bucketId as string)\n }\n\n /**\n * Return a still-valid upload URL to the pool for reuse.\n *\n * @param bucketId - The bucket the upload URL belongs to.\n * @param entry - The upload URL entry to return to the pool.\n */\n returnUploadUrl(bucketId: BucketId, entry: UploadUrlEntry): void {\n this.uploadUrls.checkin(bucketId as string, entry)\n }\n\n /**\n * Remove an upload URL from the pool after an upload error.\n *\n * @param bucketId - The bucket the failed upload URL belongs to.\n * @param entry - The upload URL entry to remove from the pool.\n */\n evictUploadUrl(bucketId: BucketId, entry: UploadUrlEntry): void {\n this.uploadUrls.evict(bucketId as string, entry)\n }\n\n /**\n * Take a large-file part upload URL from the pool, or null if none available.\n *\n * @param fileId - The large file to check out a part upload URL for.\n *\n * @returns A reusable part upload URL entry, or null if none are available.\n */\n checkoutPartUploadUrl(fileId: string): UploadUrlEntry | null {\n return this.partUploadUrls.checkout(fileId)\n }\n\n /**\n * Return a still-valid part upload URL to the pool for reuse.\n *\n * @param fileId - The large file the part upload URL belongs to.\n * @param entry - The part upload URL entry to return to the pool.\n */\n returnPartUploadUrl(fileId: string, entry: UploadUrlEntry): void {\n this.partUploadUrls.checkin(fileId, entry)\n }\n\n /**\n * Remove a part upload URL from the pool after an error.\n *\n * @param fileId - The large file the failed part upload URL belongs to.\n * @param entry - The part upload URL entry to remove from the pool.\n */\n evictPartUploadUrl(fileId: string, entry: UploadUrlEntry): void {\n this.partUploadUrls.evict(fileId, entry)\n }\n\n /**\n * Retrieve the cached auth response or throw if not yet authorized.\n *\n * @returns The cached authorization response.\n *\n * @throws Error if authorize() has not been called.\n */\n private requireAuth(): AuthorizeAccountResponse {\n if (!this.auth) throw new Error('Not authorized. Call authorize() first.')\n return this.auth\n }\n}\n"],"names":[],"mappings":";AAUO,MAAM,oBAA2C;AAAA;AAAA,EAE9C,OAAwC;AAAA;AAAA,EAE/B,aAAa,IAAI,cAAA;AAAA;AAAA,EAEjB,iBAAiB,IAAI,cAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOtC,QAAQ,MAAsC;AAC5C,SAAK,OAAO;AACZ,SAAK,WAAW,MAAA;AAChB,SAAK,eAAe,MAAA;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,UAA2C;AACzC,WAAO,KAAK;AAAA,EACd;AAAA;AAAA,EAGA,QAAc;AACZ,SAAK,OAAO;AACZ,SAAK,WAAW,MAAA;AAChB,SAAK,eAAe,MAAA;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,YAAoB;AAClB,WAAO,KAAK,YAAA,EAAc,QAAQ,WAAW;AAAA,EAC/C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,iBAAyB;AACvB,WAAO,KAAK,YAAA,EAAc,QAAQ,WAAW;AAAA,EAC/C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,eAAuB;AACrB,WAAO,KAAK,cAAc;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,eAAuB;AACrB,WAAO,KAAK,cAAc;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,yBAAiC;AAC/B,WAAO,KAAK,YAAA,EAAc,QAAQ,WAAW;AAAA,EAC/C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,6BAAqC;AACnC,WAAO,KAAK,YAAA,EAAc,QAAQ,WAAW;AAAA,EAC/C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,cAAsB;AACpB,WAAO,KAAK,YAAA,EAAc,QAAQ,WAAW;AAAA,EAC/C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,qBAAsC;AACpC,WAAO,KAAK,cAAc,QAAQ,WAAW,QAAQ,YAAY;AAAA,EACnE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,kBAAkB,UAA2C;AAC3D,WAAO,KAAK,WAAW,SAAS,QAAkB;AAAA,EACpD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,gBAAgB,UAAoB,OAA6B;AAC/D,SAAK,WAAW,QAAQ,UAAoB,KAAK;AAAA,EACnD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,eAAe,UAAoB,OAA6B;AAC9D,SAAK,WAAW,MAAM,UAAoB,KAAK;AAAA,EACjD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,sBAAsB,QAAuC;AAC3D,WAAO,KAAK,eAAe,SAAS,MAAM;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,oBAAoB,QAAgB,OAA6B;AAC/D,SAAK,eAAe,QAAQ,QAAQ,KAAK;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,mBAAmB,QAAgB,OAA6B;AAC9D,SAAK,eAAe,MAAM,QAAQ,KAAK;AAAA,EACzC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASQ,cAAwC;AAC9C,QAAI,CAAC,KAAK,KAAM,OAAM,IAAI,MAAM,yCAAyC;AACzE,WAAO,KAAK;AAAA,EACd;AACF;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const inMemory = require("./in-memory.cjs");
|
|
4
|
+
const uploadUrlPool = require("./upload-url-pool.cjs");
|
|
5
|
+
const realms = require("./realms.cjs");
|
|
6
|
+
exports.InMemoryAccountInfo = inMemory.InMemoryAccountInfo;
|
|
7
|
+
exports.UploadUrlPool = uploadUrlPool.UploadUrlPool;
|
|
8
|
+
exports.REALM_URLS = realms.REALM_URLS;
|
|
9
|
+
exports.getRealmUrl = realms.getRealmUrl;
|
|
10
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** @packageDocumentation */
|
|
2
|
+
export type { AccountInfo, UploadUrlEntry } from './account-info.js';
|
|
3
|
+
export { InMemoryAccountInfo } from './in-memory.js';
|
|
4
|
+
export { UploadUrlPool } from './upload-url-pool.js';
|
|
5
|
+
export { getRealmUrl, REALM_URLS } from './realms.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.js"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** @packageDocumentation */
|
|
2
|
+
export type { AccountInfo, UploadUrlEntry } from './account-info.js';
|
|
3
|
+
export { InMemoryAccountInfo } from './in-memory.js';
|
|
4
|
+
export { UploadUrlPool } from './upload-url-pool.js';
|
|
5
|
+
export { getRealmUrl, REALM_URLS } from './realms.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.js"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { InMemoryAccountInfo } from "./in-memory.js";
|
|
2
|
+
import { UploadUrlPool } from "./upload-url-pool.js";
|
|
3
|
+
import { REALM_URLS, getRealmUrl } from "./realms.js";
|
|
4
|
+
export {
|
|
5
|
+
InMemoryAccountInfo,
|
|
6
|
+
REALM_URLS,
|
|
7
|
+
UploadUrlPool,
|
|
8
|
+
getRealmUrl
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const REALM_URLS = {
|
|
4
|
+
production: "https://api.backblazeb2.com",
|
|
5
|
+
staging: "https://api.backblazeb2.com"
|
|
6
|
+
};
|
|
7
|
+
function getRealmUrl(realm) {
|
|
8
|
+
return REALM_URLS[realm] ?? realm;
|
|
9
|
+
}
|
|
10
|
+
exports.REALM_URLS = REALM_URLS;
|
|
11
|
+
exports.getRealmUrl = getRealmUrl;
|
|
12
|
+
//# sourceMappingURL=realms.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realms.cjs","sources":["../../src/auth/realms.ts"],"sourcesContent":["/** Map of known realm names to their base API URLs. */\nexport const REALM_URLS: Record<string, string> = {\n production: 'https://api.backblazeb2.com',\n staging: 'https://api.backblazeb2.com',\n}\n\n/**\n * Resolve a realm name to its base API URL.\n * If the realm is not a known name, it is returned as-is (assumed to be a URL).\n *\n * @param realm - The realm name or direct URL to resolve.\n *\n * @returns The base API URL for the given realm.\n */\nexport function getRealmUrl(realm: string): string {\n return REALM_URLS[realm] ?? realm\n}\n"],"names":[],"mappings":";;AACO,MAAM,aAAqC;AAAA,EAChD,YAAY;AAAA,EACZ,SAAS;AACX;AAUO,SAAS,YAAY,OAAuB;AACjD,SAAO,WAAW,KAAK,KAAK;AAC9B;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Map of known realm names to their base API URLs. */
|
|
2
|
+
export declare const REALM_URLS: Record<string, string>;
|
|
3
|
+
/**
|
|
4
|
+
* Resolve a realm name to its base API URL.
|
|
5
|
+
* If the realm is not a known name, it is returned as-is (assumed to be a URL).
|
|
6
|
+
*
|
|
7
|
+
* @param realm - The realm name or direct URL to resolve.
|
|
8
|
+
*
|
|
9
|
+
* @returns The base API URL for the given realm.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getRealmUrl(realm: string): string;
|
|
12
|
+
//# sourceMappingURL=realms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realms.d.ts","sourceRoot":"","sources":["../../src/auth/realms.js"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAG7C,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Map of known realm names to their base API URLs. */
|
|
2
|
+
export declare const REALM_URLS: Record<string, string>;
|
|
3
|
+
/**
|
|
4
|
+
* Resolve a realm name to its base API URL.
|
|
5
|
+
* If the realm is not a known name, it is returned as-is (assumed to be a URL).
|
|
6
|
+
*
|
|
7
|
+
* @param realm - The realm name or direct URL to resolve.
|
|
8
|
+
*
|
|
9
|
+
* @returns The base API URL for the given realm.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getRealmUrl(realm: string): string;
|
|
12
|
+
//# sourceMappingURL=realms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realms.d.ts","sourceRoot":"","sources":["../../src/auth/realms.js"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAG7C,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const REALM_URLS = {
|
|
2
|
+
production: "https://api.backblazeb2.com",
|
|
3
|
+
staging: "https://api.backblazeb2.com"
|
|
4
|
+
};
|
|
5
|
+
function getRealmUrl(realm) {
|
|
6
|
+
return REALM_URLS[realm] ?? realm;
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
REALM_URLS,
|
|
10
|
+
getRealmUrl
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=realms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realms.js","sources":["../../src/auth/realms.ts"],"sourcesContent":["/** Map of known realm names to their base API URLs. */\nexport const REALM_URLS: Record<string, string> = {\n production: 'https://api.backblazeb2.com',\n staging: 'https://api.backblazeb2.com',\n}\n\n/**\n * Resolve a realm name to its base API URL.\n * If the realm is not a known name, it is returned as-is (assumed to be a URL).\n *\n * @param realm - The realm name or direct URL to resolve.\n *\n * @returns The base API URL for the given realm.\n */\nexport function getRealmUrl(realm: string): string {\n return REALM_URLS[realm] ?? realm\n}\n"],"names":[],"mappings":"AACO,MAAM,aAAqC;AAAA,EAChD,YAAY;AAAA,EACZ,SAAS;AACX;AAUO,SAAS,YAAY,OAAuB;AACjD,SAAO,WAAW,KAAK,KAAK;AAC9B;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
class UploadUrlPool {
|
|
4
|
+
/** Map from key (bucket ID or file ID) to a stack of available entries. */
|
|
5
|
+
pools = /* @__PURE__ */ new Map();
|
|
6
|
+
/**
|
|
7
|
+
* Take an upload URL from the pool, or return null if none are available.
|
|
8
|
+
*
|
|
9
|
+
* @param key - The bucket ID or file ID to look up.
|
|
10
|
+
*
|
|
11
|
+
* @returns An upload URL entry, or null if the pool is empty for the given key.
|
|
12
|
+
*/
|
|
13
|
+
checkout(key) {
|
|
14
|
+
const pool = this.pools.get(key);
|
|
15
|
+
if (!pool || pool.length === 0) return null;
|
|
16
|
+
return pool.pop() ?? null;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Return a still-valid upload URL to the pool for future reuse.
|
|
20
|
+
*
|
|
21
|
+
* @param key - The bucket ID or file ID the entry belongs to.
|
|
22
|
+
* @param entry - The upload URL entry to return to the pool.
|
|
23
|
+
*/
|
|
24
|
+
checkin(key, entry) {
|
|
25
|
+
let pool = this.pools.get(key);
|
|
26
|
+
if (!pool) {
|
|
27
|
+
pool = [];
|
|
28
|
+
this.pools.set(key, pool);
|
|
29
|
+
}
|
|
30
|
+
pool.push(entry);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Remove a specific upload URL from the pool (e.g. after an upload error).
|
|
34
|
+
*
|
|
35
|
+
* @param key - The bucket ID or file ID the entry belongs to.
|
|
36
|
+
* @param entry - The failed upload URL entry to remove.
|
|
37
|
+
*/
|
|
38
|
+
evict(key, entry) {
|
|
39
|
+
const pool = this.pools.get(key);
|
|
40
|
+
if (!pool) return;
|
|
41
|
+
const idx = pool.findIndex((e) => e.uploadUrl === entry.uploadUrl);
|
|
42
|
+
if (idx !== -1) {
|
|
43
|
+
pool.splice(idx, 1);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** Remove all entries from every key in the pool. */
|
|
47
|
+
clear() {
|
|
48
|
+
this.pools.clear();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.UploadUrlPool = UploadUrlPool;
|
|
52
|
+
//# sourceMappingURL=upload-url-pool.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-url-pool.cjs","sources":["../../src/auth/upload-url-pool.ts"],"sourcesContent":["import type { UploadUrlEntry } from './account-info.ts'\n\n/**\n * Manages a pool of reusable upload URLs keyed by bucket ID or file ID.\n * URLs are checked out before an upload, checked back in on success, and\n * evicted on error so they are not reused.\n */\nexport class UploadUrlPool {\n /** Map from key (bucket ID or file ID) to a stack of available entries. */\n private readonly pools = new Map<string, UploadUrlEntry[]>()\n\n /**\n * Take an upload URL from the pool, or return null if none are available.\n *\n * @param key - The bucket ID or file ID to look up.\n *\n * @returns An upload URL entry, or null if the pool is empty for the given key.\n */\n checkout(key: string): UploadUrlEntry | null {\n const pool = this.pools.get(key)\n if (!pool || pool.length === 0) return null\n return pool.pop() ?? null\n }\n\n /**\n * Return a still-valid upload URL to the pool for future reuse.\n *\n * @param key - The bucket ID or file ID the entry belongs to.\n * @param entry - The upload URL entry to return to the pool.\n */\n checkin(key: string, entry: UploadUrlEntry): void {\n let pool = this.pools.get(key)\n if (!pool) {\n pool = []\n this.pools.set(key, pool)\n }\n pool.push(entry)\n }\n\n /**\n * Remove a specific upload URL from the pool (e.g. after an upload error).\n *\n * @param key - The bucket ID or file ID the entry belongs to.\n * @param entry - The failed upload URL entry to remove.\n */\n evict(key: string, entry: UploadUrlEntry): void {\n const pool = this.pools.get(key)\n if (!pool) return\n const idx = pool.findIndex((e) => e.uploadUrl === entry.uploadUrl)\n if (idx !== -1) {\n pool.splice(idx, 1)\n }\n }\n\n /** Remove all entries from every key in the pool. */\n clear(): void {\n this.pools.clear()\n }\n}\n"],"names":[],"mappings":";;AAOO,MAAM,cAAc;AAAA;AAAA,EAER,4BAAY,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS7B,SAAS,KAAoC;AAC3C,UAAM,OAAO,KAAK,MAAM,IAAI,GAAG;AAC/B,QAAI,CAAC,QAAQ,KAAK,WAAW,EAAG,QAAO;AACvC,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,QAAQ,KAAa,OAA6B;AAChD,QAAI,OAAO,KAAK,MAAM,IAAI,GAAG;AAC7B,QAAI,CAAC,MAAM;AACT,aAAO,CAAA;AACP,WAAK,MAAM,IAAI,KAAK,IAAI;AAAA,IAC1B;AACA,SAAK,KAAK,KAAK;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,KAAa,OAA6B;AAC9C,UAAM,OAAO,KAAK,MAAM,IAAI,GAAG;AAC/B,QAAI,CAAC,KAAM;AACX,UAAM,MAAM,KAAK,UAAU,CAAC,MAAM,EAAE,cAAc,MAAM,SAAS;AACjE,QAAI,QAAQ,IAAI;AACd,WAAK,OAAO,KAAK,CAAC;AAAA,IACpB;AAAA,EACF;AAAA;AAAA,EAGA,QAAc;AACZ,SAAK,MAAM,MAAA;AAAA,EACb;AACF;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { UploadUrlEntry } from './account-info.js';
|
|
2
|
+
/**
|
|
3
|
+
* Manages a pool of reusable upload URLs keyed by bucket ID or file ID.
|
|
4
|
+
* URLs are checked out before an upload, checked back in on success, and
|
|
5
|
+
* evicted on error so they are not reused.
|
|
6
|
+
*/
|
|
7
|
+
export declare class UploadUrlPool {
|
|
8
|
+
/** Map from key (bucket ID or file ID) to a stack of available entries. */
|
|
9
|
+
private readonly pools;
|
|
10
|
+
/**
|
|
11
|
+
* Take an upload URL from the pool, or return null if none are available.
|
|
12
|
+
*
|
|
13
|
+
* @param key - The bucket ID or file ID to look up.
|
|
14
|
+
*
|
|
15
|
+
* @returns An upload URL entry, or null if the pool is empty for the given key.
|
|
16
|
+
*/
|
|
17
|
+
checkout(key: string): UploadUrlEntry | null;
|
|
18
|
+
/**
|
|
19
|
+
* Return a still-valid upload URL to the pool for future reuse.
|
|
20
|
+
*
|
|
21
|
+
* @param key - The bucket ID or file ID the entry belongs to.
|
|
22
|
+
* @param entry - The upload URL entry to return to the pool.
|
|
23
|
+
*/
|
|
24
|
+
checkin(key: string, entry: UploadUrlEntry): void;
|
|
25
|
+
/**
|
|
26
|
+
* Remove a specific upload URL from the pool (e.g. after an upload error).
|
|
27
|
+
*
|
|
28
|
+
* @param key - The bucket ID or file ID the entry belongs to.
|
|
29
|
+
* @param entry - The failed upload URL entry to remove.
|
|
30
|
+
*/
|
|
31
|
+
evict(key: string, entry: UploadUrlEntry): void;
|
|
32
|
+
/** Remove all entries from every key in the pool. */
|
|
33
|
+
clear(): void;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=upload-url-pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-url-pool.d.ts","sourceRoot":"","sources":["../../src/auth/upload-url-pool.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEvD;;;;GAIG;AACH,qBAAa,aAAa;IACxB,2EAA2E;IAC3E,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsC;IAE5D;;;;;;OAMG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAM5C;;;;;OAKG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI;IASjD;;;;;OAKG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI;IAS/C,qDAAqD;IACrD,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { UploadUrlEntry } from './account-info.js';
|
|
2
|
+
/**
|
|
3
|
+
* Manages a pool of reusable upload URLs keyed by bucket ID or file ID.
|
|
4
|
+
* URLs are checked out before an upload, checked back in on success, and
|
|
5
|
+
* evicted on error so they are not reused.
|
|
6
|
+
*/
|
|
7
|
+
export declare class UploadUrlPool {
|
|
8
|
+
/** Map from key (bucket ID or file ID) to a stack of available entries. */
|
|
9
|
+
private readonly pools;
|
|
10
|
+
/**
|
|
11
|
+
* Take an upload URL from the pool, or return null if none are available.
|
|
12
|
+
*
|
|
13
|
+
* @param key - The bucket ID or file ID to look up.
|
|
14
|
+
*
|
|
15
|
+
* @returns An upload URL entry, or null if the pool is empty for the given key.
|
|
16
|
+
*/
|
|
17
|
+
checkout(key: string): UploadUrlEntry | null;
|
|
18
|
+
/**
|
|
19
|
+
* Return a still-valid upload URL to the pool for future reuse.
|
|
20
|
+
*
|
|
21
|
+
* @param key - The bucket ID or file ID the entry belongs to.
|
|
22
|
+
* @param entry - The upload URL entry to return to the pool.
|
|
23
|
+
*/
|
|
24
|
+
checkin(key: string, entry: UploadUrlEntry): void;
|
|
25
|
+
/**
|
|
26
|
+
* Remove a specific upload URL from the pool (e.g. after an upload error).
|
|
27
|
+
*
|
|
28
|
+
* @param key - The bucket ID or file ID the entry belongs to.
|
|
29
|
+
* @param entry - The failed upload URL entry to remove.
|
|
30
|
+
*/
|
|
31
|
+
evict(key: string, entry: UploadUrlEntry): void;
|
|
32
|
+
/** Remove all entries from every key in the pool. */
|
|
33
|
+
clear(): void;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=upload-url-pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-url-pool.d.ts","sourceRoot":"","sources":["../../src/auth/upload-url-pool.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEvD;;;;GAIG;AACH,qBAAa,aAAa;IACxB,2EAA2E;IAC3E,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsC;IAE5D;;;;;;OAMG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAM5C;;;;;OAKG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI;IASjD;;;;;OAKG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI;IAS/C,qDAAqD;IACrD,KAAK,IAAI,IAAI;CAGd"}
|