@backblaze-labs/b2-sdk 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -1
- package/README.md +20 -2
- package/dist/_virtual/_b2-sdk-version-json.cjs +1 -1
- package/dist/_virtual/_b2-sdk-version-json.js +1 -1
- package/dist/auth/file.cjs.map +1 -1
- package/dist/backup/client.cjs +206 -0
- package/dist/backup/client.cjs.map +1 -0
- package/dist/backup/client.d.cts +238 -0
- package/dist/backup/client.d.cts.map +1 -0
- package/dist/backup/client.d.ts +238 -0
- package/dist/backup/client.d.ts.map +1 -0
- package/dist/backup/client.js +206 -0
- package/dist/backup/client.js.map +1 -0
- package/dist/backup/index.cjs +15 -0
- package/dist/backup/index.d.cts +22 -0
- package/dist/backup/index.d.cts.map +1 -0
- package/dist/backup/index.d.ts +22 -0
- package/dist/backup/index.d.ts.map +1 -0
- package/dist/backup/index.js +7 -0
- package/dist/backup/raw.cjs +146 -0
- package/dist/backup/raw.cjs.map +1 -0
- package/dist/backup/raw.d.cts +122 -0
- package/dist/backup/raw.d.cts.map +1 -0
- package/dist/backup/raw.d.ts +122 -0
- package/dist/backup/raw.d.ts.map +1 -0
- package/dist/backup/raw.js +146 -0
- package/dist/backup/raw.js.map +1 -0
- package/dist/bucket.cjs +2 -1
- package/dist/bucket.cjs.map +1 -1
- package/dist/bucket.js +2 -1
- package/dist/bucket.js.map +1 -1
- package/dist/copy/large.cjs +5 -3
- package/dist/copy/large.cjs.map +1 -1
- package/dist/copy/large.d.cts.map +1 -1
- package/dist/copy/large.d.ts.map +1 -1
- package/dist/copy/large.js +5 -3
- package/dist/copy/large.js.map +1 -1
- package/dist/download/checksum.cjs +6 -2
- package/dist/download/checksum.cjs.map +1 -1
- package/dist/download/checksum.js +6 -2
- package/dist/download/checksum.js.map +1 -1
- package/dist/download/parallel.cjs +52 -15
- package/dist/download/parallel.cjs.map +1 -1
- package/dist/download/parallel.d.cts +8 -1
- package/dist/download/parallel.d.cts.map +1 -1
- package/dist/download/parallel.d.ts +8 -1
- package/dist/download/parallel.d.ts.map +1 -1
- package/dist/download/parallel.js +52 -15
- package/dist/download/parallel.js.map +1 -1
- package/dist/download/single.cjs +141 -6
- package/dist/download/single.cjs.map +1 -1
- package/dist/download/single.d.cts.map +1 -1
- package/dist/download/single.d.ts.map +1 -1
- package/dist/download/single.js +141 -6
- package/dist/download/single.js.map +1 -1
- package/dist/errors/index.cjs +173 -3
- package/dist/errors/index.cjs.map +1 -1
- package/dist/errors/index.d.cts +119 -0
- package/dist/errors/index.d.cts.map +1 -1
- package/dist/errors/index.d.ts +119 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +161 -4
- package/dist/errors/index.js.map +1 -1
- package/dist/http/retry.cjs +1 -1
- package/dist/http/retry.cjs.map +1 -1
- package/dist/http/retry.js +1 -1
- package/dist/http/retry.js.map +1 -1
- package/dist/http/transport.cjs +61 -23
- package/dist/http/transport.cjs.map +1 -1
- package/dist/http/transport.d.cts +25 -3
- package/dist/http/transport.d.cts.map +1 -1
- package/dist/http/transport.d.ts +25 -3
- package/dist/http/transport.d.ts.map +1 -1
- package/dist/http/transport.js +59 -22
- package/dist/http/transport.js.map +1 -1
- package/dist/index.cjs +25 -2
- package/dist/index.d.cts +6 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -6
- package/dist/object.cjs +1 -1
- package/dist/object.cjs.map +1 -1
- package/dist/object.d.cts +4 -2
- package/dist/object.d.cts.map +1 -1
- package/dist/object.d.ts +4 -2
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +1 -1
- package/dist/object.js.map +1 -1
- package/dist/partner/account-info.d.cts +43 -0
- package/dist/partner/account-info.d.cts.map +1 -0
- package/dist/partner/account-info.d.ts +43 -0
- package/dist/partner/account-info.d.ts.map +1 -0
- package/dist/partner/auth-clone.cjs +64 -0
- package/dist/partner/auth-clone.cjs.map +1 -0
- package/dist/partner/auth-clone.d.cts +27 -0
- package/dist/partner/auth-clone.d.cts.map +1 -0
- package/dist/partner/auth-clone.d.ts +27 -0
- package/dist/partner/auth-clone.d.ts.map +1 -0
- package/dist/partner/auth-clone.js +63 -0
- package/dist/partner/auth-clone.js.map +1 -0
- package/dist/partner/auth-core.cjs +175 -0
- package/dist/partner/auth-core.cjs.map +1 -0
- package/dist/partner/auth-core.d.cts +111 -0
- package/dist/partner/auth-core.d.cts.map +1 -0
- package/dist/partner/auth-core.d.ts +111 -0
- package/dist/partner/auth-core.d.ts.map +1 -0
- package/dist/partner/auth-core.js +175 -0
- package/dist/partner/auth-core.js.map +1 -0
- package/dist/partner/auth-shape.cjs +36 -0
- package/dist/partner/auth-shape.cjs.map +1 -0
- package/dist/partner/auth-shape.d.cts +12 -0
- package/dist/partner/auth-shape.d.cts.map +1 -0
- package/dist/partner/auth-shape.d.ts +12 -0
- package/dist/partner/auth-shape.d.ts.map +1 -0
- package/dist/partner/auth-shape.js +36 -0
- package/dist/partner/auth-shape.js.map +1 -0
- package/dist/partner/client.cjs +255 -0
- package/dist/partner/client.cjs.map +1 -0
- package/dist/partner/client.d.cts +335 -0
- package/dist/partner/client.d.cts.map +1 -0
- package/dist/partner/client.d.ts +335 -0
- package/dist/partner/client.d.ts.map +1 -0
- package/dist/partner/client.js +255 -0
- package/dist/partner/client.js.map +1 -0
- package/dist/partner/endpoint-url.cjs +108 -0
- package/dist/partner/endpoint-url.cjs.map +1 -0
- package/dist/partner/endpoint-url.d.cts +72 -0
- package/dist/partner/endpoint-url.d.cts.map +1 -0
- package/dist/partner/endpoint-url.d.ts +72 -0
- package/dist/partner/endpoint-url.d.ts.map +1 -0
- package/dist/partner/endpoint-url.js +105 -0
- package/dist/partner/endpoint-url.js.map +1 -0
- package/dist/partner/in-memory.cjs +135 -0
- package/dist/partner/in-memory.cjs.map +1 -0
- package/dist/partner/in-memory.d.cts +99 -0
- package/dist/partner/in-memory.d.cts.map +1 -0
- package/dist/partner/in-memory.d.ts +99 -0
- package/dist/partner/in-memory.d.ts.map +1 -0
- package/dist/partner/in-memory.js +135 -0
- package/dist/partner/in-memory.js.map +1 -0
- package/dist/partner/index.cjs +18 -0
- package/dist/partner/index.d.cts +23 -0
- package/dist/partner/index.d.cts.map +1 -0
- package/dist/partner/index.d.ts +23 -0
- package/dist/partner/index.d.ts.map +1 -0
- package/dist/partner/index.js +7 -0
- package/dist/partner/raw.cjs +392 -0
- package/dist/partner/raw.cjs.map +1 -0
- package/dist/partner/raw.d.cts +223 -0
- package/dist/partner/raw.d.cts.map +1 -0
- package/dist/partner/raw.d.ts +223 -0
- package/dist/partner/raw.d.ts.map +1 -0
- package/dist/partner/raw.js +390 -0
- package/dist/partner/raw.js.map +1 -0
- package/dist/partner/redaction-placeholders.cjs +10 -0
- package/dist/partner/redaction-placeholders.cjs.map +1 -0
- package/dist/partner/redaction-placeholders.d.cts +5 -0
- package/dist/partner/redaction-placeholders.d.cts.map +1 -0
- package/dist/partner/redaction-placeholders.d.ts +5 -0
- package/dist/partner/redaction-placeholders.d.ts.map +1 -0
- package/dist/partner/redaction-placeholders.js +9 -0
- package/dist/partner/redaction-placeholders.js.map +1 -0
- package/dist/partner/redaction.cjs +267 -0
- package/dist/partner/redaction.cjs.map +1 -0
- package/dist/partner/redaction.d.cts +124 -0
- package/dist/partner/redaction.d.cts.map +1 -0
- package/dist/partner/redaction.d.ts +124 -0
- package/dist/partner/redaction.d.ts.map +1 -0
- package/dist/partner/redaction.js +257 -0
- package/dist/partner/redaction.js.map +1 -0
- package/dist/raw/index.cjs +81 -19
- package/dist/raw/index.cjs.map +1 -1
- package/dist/raw/index.d.cts +6 -2
- package/dist/raw/index.d.cts.map +1 -1
- package/dist/raw/index.d.ts +6 -2
- package/dist/raw/index.d.ts.map +1 -1
- package/dist/raw/index.js +81 -19
- package/dist/raw/index.js.map +1 -1
- package/dist/raw/url.cjs +111 -0
- package/dist/raw/url.cjs.map +1 -0
- package/dist/raw/url.d.cts +41 -0
- package/dist/raw/url.d.cts.map +1 -0
- package/dist/raw/url.d.ts +41 -0
- package/dist/raw/url.d.ts.map +1 -0
- package/dist/raw/url.js +110 -0
- package/dist/raw/url.js.map +1 -0
- package/dist/s3/sigv4.cjs +15 -10
- package/dist/s3/sigv4.cjs.map +1 -1
- package/dist/s3/sigv4.js +15 -10
- package/dist/s3/sigv4.js.map +1 -1
- package/dist/simulator/index.cjs +1197 -206
- package/dist/simulator/index.cjs.map +1 -1
- package/dist/simulator/index.d.cts +109 -11
- package/dist/simulator/index.d.cts.map +1 -1
- package/dist/simulator/index.d.ts +109 -11
- package/dist/simulator/index.d.ts.map +1 -1
- package/dist/simulator/index.js +1196 -209
- package/dist/simulator/index.js.map +1 -1
- package/dist/simulator/partner.cjs +719 -0
- package/dist/simulator/partner.cjs.map +1 -0
- package/dist/simulator/partner.d.cts +183 -0
- package/dist/simulator/partner.d.cts.map +1 -0
- package/dist/simulator/partner.d.ts +183 -0
- package/dist/simulator/partner.d.ts.map +1 -0
- package/dist/simulator/partner.js +718 -0
- package/dist/simulator/partner.js.map +1 -0
- package/dist/simulator/validation.cjs +577 -0
- package/dist/simulator/validation.cjs.map +1 -1
- package/dist/simulator/validation.d.cts +117 -0
- package/dist/simulator/validation.d.cts.map +1 -1
- package/dist/simulator/validation.d.ts +117 -0
- package/dist/simulator/validation.d.ts.map +1 -1
- package/dist/simulator/validation.js +563 -1
- package/dist/simulator/validation.js.map +1 -1
- package/dist/streams/file-source.cjs +1 -1
- package/dist/streams/file-source.cjs.map +1 -1
- package/dist/streams/file-source.js +1 -1
- package/dist/streams/file-source.js.map +1 -1
- package/dist/streams/index.cjs +1 -1
- package/dist/streams/index.js +1 -1
- package/dist/streams/source.cjs +2 -1
- package/dist/streams/source.cjs.map +1 -1
- package/dist/streams/source.js +2 -1
- package/dist/streams/source.js.map +1 -1
- package/dist/sync/b2-sha1-reader.cjs +6 -2
- package/dist/sync/b2-sha1-reader.cjs.map +1 -1
- package/dist/sync/b2-sha1-reader.d.cts.map +1 -1
- package/dist/sync/b2-sha1-reader.d.ts.map +1 -1
- package/dist/sync/b2-sha1-reader.js +6 -2
- package/dist/sync/b2-sha1-reader.js.map +1 -1
- package/dist/sync/download-staging.cjs +11 -10
- package/dist/sync/download-staging.cjs.map +1 -1
- package/dist/sync/download-staging.d.cts +2 -1
- package/dist/sync/download-staging.d.cts.map +1 -1
- package/dist/sync/download-staging.d.ts +2 -1
- package/dist/sync/download-staging.d.ts.map +1 -1
- package/dist/sync/download-staging.js +11 -10
- package/dist/sync/download-staging.js.map +1 -1
- package/dist/sync/filters.cjs.map +1 -1
- package/dist/sync/filters.js.map +1 -1
- package/dist/sync/local-file-io.cjs +11 -6
- package/dist/sync/local-file-io.cjs.map +1 -1
- package/dist/sync/local-file-io.d.cts +1 -0
- package/dist/sync/local-file-io.d.cts.map +1 -1
- package/dist/sync/local-file-io.d.ts +1 -0
- package/dist/sync/local-file-io.d.ts.map +1 -1
- package/dist/sync/local-file-io.js +11 -6
- package/dist/sync/local-file-io.js.map +1 -1
- package/dist/sync/local-sha1.cjs +6 -15
- package/dist/sync/local-sha1.cjs.map +1 -1
- package/dist/sync/local-sha1.d.cts +0 -8
- package/dist/sync/local-sha1.d.cts.map +1 -1
- package/dist/sync/local-sha1.d.ts +0 -8
- package/dist/sync/local-sha1.d.ts.map +1 -1
- package/dist/sync/local-sha1.js +7 -15
- package/dist/sync/local-sha1.js.map +1 -1
- package/dist/sync/policies/compare.cjs +5 -3
- package/dist/sync/policies/compare.cjs.map +1 -1
- package/dist/sync/policies/compare.d.cts.map +1 -1
- package/dist/sync/policies/compare.d.ts.map +1 -1
- package/dist/sync/policies/compare.js +6 -4
- package/dist/sync/policies/compare.js.map +1 -1
- package/dist/sync/policies/index.cjs +4 -10
- package/dist/sync/policies/index.cjs.map +1 -1
- package/dist/sync/policies/index.js +4 -10
- package/dist/sync/policies/index.js.map +1 -1
- package/dist/sync/scanners/b2.cjs +2 -2
- package/dist/sync/scanners/b2.cjs.map +1 -1
- package/dist/sync/scanners/b2.js +2 -2
- package/dist/sync/scanners/b2.js.map +1 -1
- package/dist/sync/scanners/local.cjs.map +1 -1
- package/dist/sync/scanners/local.js.map +1 -1
- package/dist/sync/synchronizer.cjs +3 -2
- package/dist/sync/synchronizer.cjs.map +1 -1
- package/dist/sync/synchronizer.js +3 -2
- package/dist/sync/synchronizer.js.map +1 -1
- package/dist/types/auth.cjs +4 -0
- package/dist/types/auth.cjs.map +1 -1
- package/dist/types/auth.d.cts +4 -0
- package/dist/types/auth.d.cts.map +1 -1
- package/dist/types/auth.d.ts +4 -0
- package/dist/types/auth.d.ts.map +1 -1
- package/dist/types/auth.js +4 -0
- package/dist/types/auth.js.map +1 -1
- package/dist/types/backup.d.cts +80 -0
- package/dist/types/backup.d.cts.map +1 -0
- package/dist/types/backup.d.ts +80 -0
- package/dist/types/backup.d.ts.map +1 -0
- package/dist/types/bucket.cjs.map +1 -1
- package/dist/types/bucket.d.cts +4 -2
- package/dist/types/bucket.d.cts.map +1 -1
- package/dist/types/bucket.d.ts +4 -2
- package/dist/types/bucket.d.ts.map +1 -1
- package/dist/types/bucket.js.map +1 -1
- package/dist/types/download.cjs +62 -0
- package/dist/types/download.cjs.map +1 -0
- package/dist/types/download.d.cts +98 -0
- package/dist/types/download.d.cts.map +1 -1
- package/dist/types/download.d.ts +98 -0
- package/dist/types/download.d.ts.map +1 -1
- package/dist/types/download.js +61 -0
- package/dist/types/download.js.map +1 -0
- package/dist/types/encryption.cjs +58 -229
- package/dist/types/encryption.cjs.map +1 -1
- package/dist/types/encryption.d.cts +32 -0
- package/dist/types/encryption.d.cts.map +1 -1
- package/dist/types/encryption.d.ts +32 -0
- package/dist/types/encryption.d.ts.map +1 -1
- package/dist/types/encryption.js +56 -229
- package/dist/types/encryption.js.map +1 -1
- package/dist/types/errors.cjs +9 -0
- package/dist/types/errors.cjs.map +1 -1
- package/dist/types/errors.d.cts +1 -1
- package/dist/types/errors.d.cts.map +1 -1
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +9 -0
- package/dist/types/errors.js.map +1 -1
- package/dist/types/file.cjs.map +1 -1
- package/dist/types/file.d.cts +15 -2
- package/dist/types/file.d.cts.map +1 -1
- package/dist/types/file.d.ts +15 -2
- package/dist/types/file.d.ts.map +1 -1
- package/dist/types/file.js.map +1 -1
- package/dist/types/ids.cjs +30 -0
- package/dist/types/ids.cjs.map +1 -1
- package/dist/types/ids.d.cts +32 -0
- package/dist/types/ids.d.cts.map +1 -1
- package/dist/types/ids.d.ts +32 -0
- package/dist/types/ids.d.ts.map +1 -1
- package/dist/types/ids.js +28 -1
- package/dist/types/ids.js.map +1 -1
- package/dist/types/index.d.cts +10 -6
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.ts +10 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lock.cjs.map +1 -1
- package/dist/types/lock.d.cts +14 -0
- package/dist/types/lock.d.cts.map +1 -1
- package/dist/types/lock.d.ts +14 -0
- package/dist/types/lock.d.ts.map +1 -1
- package/dist/types/lock.js.map +1 -1
- package/dist/types/notifications.cjs +1 -1
- package/dist/types/notifications.cjs.map +1 -1
- package/dist/types/notifications.d.cts +5 -3
- package/dist/types/notifications.d.cts.map +1 -1
- package/dist/types/notifications.d.ts +5 -3
- package/dist/types/notifications.d.ts.map +1 -1
- package/dist/types/notifications.js +1 -1
- package/dist/types/notifications.js.map +1 -1
- package/dist/types/partner.cjs +32 -0
- package/dist/types/partner.cjs.map +1 -0
- package/dist/types/partner.d.cts +394 -0
- package/dist/types/partner.d.cts.map +1 -0
- package/dist/types/partner.d.ts +394 -0
- package/dist/types/partner.d.ts.map +1 -0
- package/dist/types/partner.js +29 -0
- package/dist/types/partner.js.map +1 -0
- package/dist/types/upload.d.cts +31 -18
- package/dist/types/upload.d.cts.map +1 -1
- package/dist/types/upload.d.ts +31 -18
- package/dist/types/upload.d.ts.map +1 -1
- package/dist/upload/abort-scope.cjs +0 -45
- package/dist/upload/abort-scope.cjs.map +1 -1
- package/dist/upload/abort-scope.d.cts +0 -22
- package/dist/upload/abort-scope.d.cts.map +1 -1
- package/dist/upload/abort-scope.d.ts +0 -22
- package/dist/upload/abort-scope.d.ts.map +1 -1
- package/dist/upload/abort-scope.js +1 -44
- package/dist/upload/abort-scope.js.map +1 -1
- package/dist/upload/finish.cjs +3 -8
- package/dist/upload/finish.cjs.map +1 -1
- package/dist/upload/finish.d.cts.map +1 -1
- package/dist/upload/finish.d.ts.map +1 -1
- package/dist/upload/finish.js +1 -6
- package/dist/upload/finish.js.map +1 -1
- package/dist/upload/large.cjs +5 -1
- package/dist/upload/large.cjs.map +1 -1
- package/dist/upload/large.d.cts +16 -2
- package/dist/upload/large.d.cts.map +1 -1
- package/dist/upload/large.d.ts +16 -2
- package/dist/upload/large.d.ts.map +1 -1
- package/dist/upload/large.js +5 -1
- package/dist/upload/large.js.map +1 -1
- package/dist/upload/options.cjs.map +1 -1
- package/dist/upload/options.d.cts +12 -0
- package/dist/upload/options.d.cts.map +1 -1
- package/dist/upload/options.d.ts +12 -0
- package/dist/upload/options.d.ts.map +1 -1
- package/dist/upload/options.js.map +1 -1
- package/dist/upload/resume.cjs +2 -1
- package/dist/upload/resume.cjs.map +1 -1
- package/dist/upload/resume.d.cts +3 -1
- package/dist/upload/resume.d.cts.map +1 -1
- package/dist/upload/resume.d.ts +3 -1
- package/dist/upload/resume.d.ts.map +1 -1
- package/dist/upload/resume.js +2 -1
- package/dist/upload/resume.js.map +1 -1
- package/dist/upload/retry.cjs +8 -3
- package/dist/upload/retry.cjs.map +1 -1
- package/dist/upload/retry.js +8 -3
- package/dist/upload/retry.js.map +1 -1
- package/dist/upload/single.cjs +2 -1
- package/dist/upload/single.cjs.map +1 -1
- package/dist/upload/single.d.cts +6 -0
- package/dist/upload/single.d.cts.map +1 -1
- package/dist/upload/single.d.ts +6 -0
- package/dist/upload/single.d.ts.map +1 -1
- package/dist/upload/single.js +2 -1
- package/dist/upload/single.js.map +1 -1
- package/dist/upload/stream.cjs +6 -4
- package/dist/upload/stream.cjs.map +1 -1
- package/dist/upload/stream.d.cts +6 -0
- package/dist/upload/stream.d.cts.map +1 -1
- package/dist/upload/stream.d.ts +6 -0
- package/dist/upload/stream.d.ts.map +1 -1
- package/dist/upload/stream.js +3 -1
- package/dist/upload/stream.js.map +1 -1
- package/dist/util/abort.cjs +114 -0
- package/dist/util/abort.cjs.map +1 -0
- package/dist/util/abort.d.cts +65 -0
- package/dist/util/abort.d.cts.map +1 -0
- package/dist/util/abort.d.ts +65 -0
- package/dist/util/abort.d.ts.map +1 -0
- package/dist/util/abort.js +109 -0
- package/dist/util/abort.js.map +1 -0
- package/dist/util/defaults.cjs +3 -0
- package/dist/util/defaults.cjs.map +1 -1
- package/dist/util/defaults.d.cts +2 -0
- package/dist/util/defaults.d.cts.map +1 -1
- package/dist/util/defaults.d.ts +2 -0
- package/dist/util/defaults.d.ts.map +1 -1
- package/dist/util/defaults.js +3 -1
- package/dist/util/defaults.js.map +1 -1
- package/dist/util/md5.cjs +211 -0
- package/dist/util/md5.cjs.map +1 -0
- package/dist/util/md5.d.cts +43 -0
- package/dist/util/md5.d.cts.map +1 -0
- package/dist/util/md5.d.ts +43 -0
- package/dist/util/md5.d.ts.map +1 -0
- package/dist/util/md5.js +209 -0
- package/dist/util/md5.js.map +1 -0
- package/dist/util/normalize.cjs +5 -5
- package/dist/util/normalize.cjs.map +1 -1
- package/dist/util/normalize.d.cts +7 -7
- package/dist/util/normalize.d.cts.map +1 -1
- package/dist/util/normalize.d.ts +7 -7
- package/dist/util/normalize.d.ts.map +1 -1
- package/dist/util/normalize.js +5 -5
- package/dist/util/normalize.js.map +1 -1
- package/dist/util/paginator.cjs +7 -1
- package/dist/util/paginator.cjs.map +1 -1
- package/dist/util/paginator.d.cts +3 -1
- package/dist/util/paginator.d.cts.map +1 -1
- package/dist/util/paginator.d.ts +3 -1
- package/dist/util/paginator.d.ts.map +1 -1
- package/dist/util/paginator.js +7 -1
- package/dist/util/paginator.js.map +1 -1
- package/package.json +38 -16
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
//#region src/util/abort.ts
|
|
2
|
+
/**
|
|
3
|
+
* Abort-signal and cancellation-error helpers shared across SDK operations.
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Resolves the abort reason for a signal, defaulting to a standard `AbortError`.
|
|
9
|
+
*
|
|
10
|
+
* @param signal - The aborted signal whose reason should be resolved.
|
|
11
|
+
*
|
|
12
|
+
* @returns The signal's `reason`, or a fresh `AbortError` DOMException when unset.
|
|
13
|
+
*/
|
|
14
|
+
function abortReason(signal) {
|
|
15
|
+
return signal.reason ?? new DOMException("Aborted", "AbortError");
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Returns whether an error represents an abort.
|
|
19
|
+
*
|
|
20
|
+
* @param err - Unknown thrown value.
|
|
21
|
+
*
|
|
22
|
+
* @returns True for `Error` or `DOMException` instances named `AbortError`.
|
|
23
|
+
*/
|
|
24
|
+
function isAbortError(err) {
|
|
25
|
+
return isNamedError(err, "AbortError");
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Returns whether an error should be treated as the given signal's abort.
|
|
29
|
+
*
|
|
30
|
+
* @param signal - Controlling signal for the operation.
|
|
31
|
+
* @param err - Unknown thrown value.
|
|
32
|
+
*
|
|
33
|
+
* @returns True when the signal is aborted and `err` is either the signal's
|
|
34
|
+
* reason or a trusted `AbortError` instance.
|
|
35
|
+
*/
|
|
36
|
+
function isSignalAbortError(signal, err) {
|
|
37
|
+
if (signal?.aborted !== true) return false;
|
|
38
|
+
if (signal.reason !== void 0 && Object.is(err, signal.reason)) return true;
|
|
39
|
+
return isAbortError(err);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Returns whether an error represents a timeout.
|
|
43
|
+
*
|
|
44
|
+
* @param err - Unknown thrown value.
|
|
45
|
+
*
|
|
46
|
+
* @returns True for `Error` or `DOMException` instances named `TimeoutError`.
|
|
47
|
+
*/
|
|
48
|
+
function isTimeoutError(err) {
|
|
49
|
+
return isNamedError(err, "TimeoutError");
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Throws the abort reason if the signal is already aborted; otherwise returns.
|
|
53
|
+
*
|
|
54
|
+
* @param signal - The signal to check, or undefined to skip the check.
|
|
55
|
+
*
|
|
56
|
+
* @throws The signal's abort reason when the signal is already aborted.
|
|
57
|
+
*/
|
|
58
|
+
function throwIfSignalAborted(signal) {
|
|
59
|
+
if (signal?.aborted === true) throw abortReason(signal);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Races a promise against an abort signal. Rejects with the signal's abort
|
|
63
|
+
* reason if the signal fires first, detaching the listener and suppressing the
|
|
64
|
+
* losing promise's rejection so it never surfaces as an unhandled rejection.
|
|
65
|
+
*
|
|
66
|
+
* The underlying work must still receive the same signal so transports can
|
|
67
|
+
* cancel their network activity. This helper only makes callers stop waiting
|
|
68
|
+
* promptly even when a test double or custom transport ignores the signal.
|
|
69
|
+
*
|
|
70
|
+
* @param promise - The work to await.
|
|
71
|
+
* @param signal - Abort signal, or undefined to await the promise directly.
|
|
72
|
+
*
|
|
73
|
+
* @returns The resolved value of `promise` when it settles before the signal aborts.
|
|
74
|
+
*
|
|
75
|
+
* @throws The abort reason if the signal aborts first, or the promise's rejection.
|
|
76
|
+
*/
|
|
77
|
+
async function raceWithAbort(promise, signal) {
|
|
78
|
+
if (signal === void 0) return promise;
|
|
79
|
+
if (signal.aborted) {
|
|
80
|
+
promise.catch(() => {});
|
|
81
|
+
throw abortReason(signal);
|
|
82
|
+
}
|
|
83
|
+
let removeAbortListener;
|
|
84
|
+
const aborted = new Promise((_, reject) => {
|
|
85
|
+
const onAbort = () => {
|
|
86
|
+
promise.catch(() => {});
|
|
87
|
+
reject(abortReason(signal));
|
|
88
|
+
};
|
|
89
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
90
|
+
removeAbortListener = () => signal.removeEventListener("abort", onAbort);
|
|
91
|
+
if (signal.aborted) onAbort();
|
|
92
|
+
});
|
|
93
|
+
try {
|
|
94
|
+
return await Promise.race([promise, aborted]);
|
|
95
|
+
} finally {
|
|
96
|
+
removeAbortListener?.();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function isNamedError(err, name) {
|
|
100
|
+
try {
|
|
101
|
+
return (err instanceof DOMException || err instanceof Error) && err.name === name;
|
|
102
|
+
} catch {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
//#endregion
|
|
107
|
+
exports.abortReason = abortReason;
|
|
108
|
+
exports.isAbortError = isAbortError;
|
|
109
|
+
exports.isSignalAbortError = isSignalAbortError;
|
|
110
|
+
exports.isTimeoutError = isTimeoutError;
|
|
111
|
+
exports.raceWithAbort = raceWithAbort;
|
|
112
|
+
exports.throwIfSignalAborted = throwIfSignalAborted;
|
|
113
|
+
|
|
114
|
+
//# sourceMappingURL=abort.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort.cjs","names":[],"sources":["../../src/util/abort.ts"],"sourcesContent":["/**\n * Abort-signal and cancellation-error helpers shared across SDK operations.\n *\n * @packageDocumentation\n */\n\n/**\n * Resolves the abort reason for a signal, defaulting to a standard `AbortError`.\n *\n * @param signal - The aborted signal whose reason should be resolved.\n *\n * @returns The signal's `reason`, or a fresh `AbortError` DOMException when unset.\n */\nexport function abortReason(signal: AbortSignal): unknown {\n return signal.reason ?? new DOMException('Aborted', 'AbortError')\n}\n\n/**\n * Returns whether an error represents an abort.\n *\n * @param err - Unknown thrown value.\n *\n * @returns True for `Error` or `DOMException` instances named `AbortError`.\n */\nexport function isAbortError(err: unknown): boolean {\n return isNamedError(err, 'AbortError')\n}\n\n/**\n * Returns whether an error should be treated as the given signal's abort.\n *\n * @param signal - Controlling signal for the operation.\n * @param err - Unknown thrown value.\n *\n * @returns True when the signal is aborted and `err` is either the signal's\n * reason or a trusted `AbortError` instance.\n */\nexport function isSignalAbortError(signal: AbortSignal | undefined, err: unknown): boolean {\n if (signal?.aborted !== true) return false\n if (signal.reason !== undefined && Object.is(err, signal.reason)) return true\n return isAbortError(err)\n}\n\n/**\n * Returns whether an error represents a timeout.\n *\n * @param err - Unknown thrown value.\n *\n * @returns True for `Error` or `DOMException` instances named `TimeoutError`.\n */\nexport function isTimeoutError(err: unknown): boolean {\n return isNamedError(err, 'TimeoutError')\n}\n\n/**\n * Throws the abort reason if the signal is already aborted; otherwise returns.\n *\n * @param signal - The signal to check, or undefined to skip the check.\n *\n * @throws The signal's abort reason when the signal is already aborted.\n */\nexport function throwIfSignalAborted(signal: AbortSignal | undefined): void {\n if (signal?.aborted === true) {\n throw abortReason(signal)\n }\n}\n\n/**\n * Races a promise against an abort signal. Rejects with the signal's abort\n * reason if the signal fires first, detaching the listener and suppressing the\n * losing promise's rejection so it never surfaces as an unhandled rejection.\n *\n * The underlying work must still receive the same signal so transports can\n * cancel their network activity. This helper only makes callers stop waiting\n * promptly even when a test double or custom transport ignores the signal.\n *\n * @param promise - The work to await.\n * @param signal - Abort signal, or undefined to await the promise directly.\n *\n * @returns The resolved value of `promise` when it settles before the signal aborts.\n *\n * @throws The abort reason if the signal aborts first, or the promise's rejection.\n */\nexport async function raceWithAbort<T>(\n promise: Promise<T>,\n signal: AbortSignal | undefined,\n): Promise<T> {\n if (signal === undefined) return promise\n if (signal.aborted) {\n void promise.catch(() => {})\n throw abortReason(signal)\n }\n\n let removeAbortListener: (() => void) | undefined\n const aborted = new Promise<never>((_, reject) => {\n const onAbort = (): void => {\n void promise.catch(() => {})\n reject(abortReason(signal))\n }\n signal.addEventListener('abort', onAbort, { once: true })\n removeAbortListener = () => signal.removeEventListener('abort', onAbort)\n if (signal.aborted) onAbort()\n })\n\n try {\n return await Promise.race([promise, aborted])\n } finally {\n removeAbortListener?.()\n }\n}\n\nfunction isNamedError(err: unknown, name: string): boolean {\n try {\n return (\n (err instanceof DOMException || err instanceof Error) &&\n (err as { readonly name: string }).name === name\n )\n } catch {\n return false\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,SAAgB,YAAY,QAA8B;CACxD,OAAO,OAAO,UAAU,IAAI,aAAa,WAAW,YAAY;AAClE;;;;;;;;AASA,SAAgB,aAAa,KAAuB;CAClD,OAAO,aAAa,KAAK,YAAY;AACvC;;;;;;;;;;AAWA,SAAgB,mBAAmB,QAAiC,KAAuB;CACzF,IAAI,QAAQ,YAAY,MAAM,OAAO;CACrC,IAAI,OAAO,WAAW,KAAA,KAAa,OAAO,GAAG,KAAK,OAAO,MAAM,GAAG,OAAO;CACzE,OAAO,aAAa,GAAG;AACzB;;;;;;;;AASA,SAAgB,eAAe,KAAuB;CACpD,OAAO,aAAa,KAAK,cAAc;AACzC;;;;;;;;AASA,SAAgB,qBAAqB,QAAuC;CAC1E,IAAI,QAAQ,YAAY,MACtB,MAAM,YAAY,MAAM;AAE5B;;;;;;;;;;;;;;;;;AAkBA,eAAsB,cACpB,SACA,QACY;CACZ,IAAI,WAAW,KAAA,GAAW,OAAO;CACjC,IAAI,OAAO,SAAS;EAClB,QAAa,YAAY,CAAC,CAAC;EAC3B,MAAM,YAAY,MAAM;CAC1B;CAEA,IAAI;CACJ,MAAM,UAAU,IAAI,SAAgB,GAAG,WAAW;EAChD,MAAM,gBAAsB;GAC1B,QAAa,YAAY,CAAC,CAAC;GAC3B,OAAO,YAAY,MAAM,CAAC;EAC5B;EACA,OAAO,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;EACxD,4BAA4B,OAAO,oBAAoB,SAAS,OAAO;EACvE,IAAI,OAAO,SAAS,QAAQ;CAC9B,CAAC;CAED,IAAI;EACF,OAAO,MAAM,QAAQ,KAAK,CAAC,SAAS,OAAO,CAAC;CAC9C,UAAU;EACR,sBAAsB;CACxB;AACF;AAEA,SAAS,aAAa,KAAc,MAAuB;CACzD,IAAI;EACF,QACG,eAAe,gBAAgB,eAAe,UAC9C,IAAkC,SAAS;CAEhD,QAAQ;EACN,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abort-signal and cancellation-error helpers shared across SDK operations.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Resolves the abort reason for a signal, defaulting to a standard `AbortError`.
|
|
8
|
+
*
|
|
9
|
+
* @param signal - The aborted signal whose reason should be resolved.
|
|
10
|
+
*
|
|
11
|
+
* @returns The signal's `reason`, or a fresh `AbortError` DOMException when unset.
|
|
12
|
+
*/
|
|
13
|
+
export declare function abortReason(signal: AbortSignal): unknown;
|
|
14
|
+
/**
|
|
15
|
+
* Returns whether an error represents an abort.
|
|
16
|
+
*
|
|
17
|
+
* @param err - Unknown thrown value.
|
|
18
|
+
*
|
|
19
|
+
* @returns True for `Error` or `DOMException` instances named `AbortError`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isAbortError(err: unknown): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Returns whether an error should be treated as the given signal's abort.
|
|
24
|
+
*
|
|
25
|
+
* @param signal - Controlling signal for the operation.
|
|
26
|
+
* @param err - Unknown thrown value.
|
|
27
|
+
*
|
|
28
|
+
* @returns True when the signal is aborted and `err` is either the signal's
|
|
29
|
+
* reason or a trusted `AbortError` instance.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isSignalAbortError(signal: AbortSignal | undefined, err: unknown): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Returns whether an error represents a timeout.
|
|
34
|
+
*
|
|
35
|
+
* @param err - Unknown thrown value.
|
|
36
|
+
*
|
|
37
|
+
* @returns True for `Error` or `DOMException` instances named `TimeoutError`.
|
|
38
|
+
*/
|
|
39
|
+
export declare function isTimeoutError(err: unknown): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Throws the abort reason if the signal is already aborted; otherwise returns.
|
|
42
|
+
*
|
|
43
|
+
* @param signal - The signal to check, or undefined to skip the check.
|
|
44
|
+
*
|
|
45
|
+
* @throws The signal's abort reason when the signal is already aborted.
|
|
46
|
+
*/
|
|
47
|
+
export declare function throwIfSignalAborted(signal: AbortSignal | undefined): void;
|
|
48
|
+
/**
|
|
49
|
+
* Races a promise against an abort signal. Rejects with the signal's abort
|
|
50
|
+
* reason if the signal fires first, detaching the listener and suppressing the
|
|
51
|
+
* losing promise's rejection so it never surfaces as an unhandled rejection.
|
|
52
|
+
*
|
|
53
|
+
* The underlying work must still receive the same signal so transports can
|
|
54
|
+
* cancel their network activity. This helper only makes callers stop waiting
|
|
55
|
+
* promptly even when a test double or custom transport ignores the signal.
|
|
56
|
+
*
|
|
57
|
+
* @param promise - The work to await.
|
|
58
|
+
* @param signal - Abort signal, or undefined to await the promise directly.
|
|
59
|
+
*
|
|
60
|
+
* @returns The resolved value of `promise` when it settles before the signal aborts.
|
|
61
|
+
*
|
|
62
|
+
* @throws The abort reason if the signal aborts first, or the promise's rejection.
|
|
63
|
+
*/
|
|
64
|
+
export declare function raceWithAbort<T>(promise: Promise<T>, signal: AbortSignal | undefined): Promise<T>;
|
|
65
|
+
//# sourceMappingURL=abort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort.d.ts","sourceRoot":"","sources":["../../src/util/abort.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAExD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAElD;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAIzF;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAEpD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAI1E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,aAAa,CAAC,CAAC,EACnC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,MAAM,EAAE,WAAW,GAAG,SAAS,GAC9B,OAAO,CAAC,CAAC,CAAC,CAuBZ"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abort-signal and cancellation-error helpers shared across SDK operations.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Resolves the abort reason for a signal, defaulting to a standard `AbortError`.
|
|
8
|
+
*
|
|
9
|
+
* @param signal - The aborted signal whose reason should be resolved.
|
|
10
|
+
*
|
|
11
|
+
* @returns The signal's `reason`, or a fresh `AbortError` DOMException when unset.
|
|
12
|
+
*/
|
|
13
|
+
export declare function abortReason(signal: AbortSignal): unknown;
|
|
14
|
+
/**
|
|
15
|
+
* Returns whether an error represents an abort.
|
|
16
|
+
*
|
|
17
|
+
* @param err - Unknown thrown value.
|
|
18
|
+
*
|
|
19
|
+
* @returns True for `Error` or `DOMException` instances named `AbortError`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isAbortError(err: unknown): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Returns whether an error should be treated as the given signal's abort.
|
|
24
|
+
*
|
|
25
|
+
* @param signal - Controlling signal for the operation.
|
|
26
|
+
* @param err - Unknown thrown value.
|
|
27
|
+
*
|
|
28
|
+
* @returns True when the signal is aborted and `err` is either the signal's
|
|
29
|
+
* reason or a trusted `AbortError` instance.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isSignalAbortError(signal: AbortSignal | undefined, err: unknown): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Returns whether an error represents a timeout.
|
|
34
|
+
*
|
|
35
|
+
* @param err - Unknown thrown value.
|
|
36
|
+
*
|
|
37
|
+
* @returns True for `Error` or `DOMException` instances named `TimeoutError`.
|
|
38
|
+
*/
|
|
39
|
+
export declare function isTimeoutError(err: unknown): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Throws the abort reason if the signal is already aborted; otherwise returns.
|
|
42
|
+
*
|
|
43
|
+
* @param signal - The signal to check, or undefined to skip the check.
|
|
44
|
+
*
|
|
45
|
+
* @throws The signal's abort reason when the signal is already aborted.
|
|
46
|
+
*/
|
|
47
|
+
export declare function throwIfSignalAborted(signal: AbortSignal | undefined): void;
|
|
48
|
+
/**
|
|
49
|
+
* Races a promise against an abort signal. Rejects with the signal's abort
|
|
50
|
+
* reason if the signal fires first, detaching the listener and suppressing the
|
|
51
|
+
* losing promise's rejection so it never surfaces as an unhandled rejection.
|
|
52
|
+
*
|
|
53
|
+
* The underlying work must still receive the same signal so transports can
|
|
54
|
+
* cancel their network activity. This helper only makes callers stop waiting
|
|
55
|
+
* promptly even when a test double or custom transport ignores the signal.
|
|
56
|
+
*
|
|
57
|
+
* @param promise - The work to await.
|
|
58
|
+
* @param signal - Abort signal, or undefined to await the promise directly.
|
|
59
|
+
*
|
|
60
|
+
* @returns The resolved value of `promise` when it settles before the signal aborts.
|
|
61
|
+
*
|
|
62
|
+
* @throws The abort reason if the signal aborts first, or the promise's rejection.
|
|
63
|
+
*/
|
|
64
|
+
export declare function raceWithAbort<T>(promise: Promise<T>, signal: AbortSignal | undefined): Promise<T>;
|
|
65
|
+
//# sourceMappingURL=abort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort.d.ts","sourceRoot":"","sources":["../../src/util/abort.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAExD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAElD;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAIzF;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAEpD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAI1E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,aAAa,CAAC,CAAC,EACnC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,MAAM,EAAE,WAAW,GAAG,SAAS,GAC9B,OAAO,CAAC,CAAC,CAAC,CAuBZ"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
//#region src/util/abort.ts
|
|
2
|
+
/**
|
|
3
|
+
* Abort-signal and cancellation-error helpers shared across SDK operations.
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Resolves the abort reason for a signal, defaulting to a standard `AbortError`.
|
|
9
|
+
*
|
|
10
|
+
* @param signal - The aborted signal whose reason should be resolved.
|
|
11
|
+
*
|
|
12
|
+
* @returns The signal's `reason`, or a fresh `AbortError` DOMException when unset.
|
|
13
|
+
*/
|
|
14
|
+
function abortReason(signal) {
|
|
15
|
+
return signal.reason ?? new DOMException("Aborted", "AbortError");
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Returns whether an error represents an abort.
|
|
19
|
+
*
|
|
20
|
+
* @param err - Unknown thrown value.
|
|
21
|
+
*
|
|
22
|
+
* @returns True for `Error` or `DOMException` instances named `AbortError`.
|
|
23
|
+
*/
|
|
24
|
+
function isAbortError(err) {
|
|
25
|
+
return isNamedError(err, "AbortError");
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Returns whether an error should be treated as the given signal's abort.
|
|
29
|
+
*
|
|
30
|
+
* @param signal - Controlling signal for the operation.
|
|
31
|
+
* @param err - Unknown thrown value.
|
|
32
|
+
*
|
|
33
|
+
* @returns True when the signal is aborted and `err` is either the signal's
|
|
34
|
+
* reason or a trusted `AbortError` instance.
|
|
35
|
+
*/
|
|
36
|
+
function isSignalAbortError(signal, err) {
|
|
37
|
+
if (signal?.aborted !== true) return false;
|
|
38
|
+
if (signal.reason !== void 0 && Object.is(err, signal.reason)) return true;
|
|
39
|
+
return isAbortError(err);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Returns whether an error represents a timeout.
|
|
43
|
+
*
|
|
44
|
+
* @param err - Unknown thrown value.
|
|
45
|
+
*
|
|
46
|
+
* @returns True for `Error` or `DOMException` instances named `TimeoutError`.
|
|
47
|
+
*/
|
|
48
|
+
function isTimeoutError(err) {
|
|
49
|
+
return isNamedError(err, "TimeoutError");
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Throws the abort reason if the signal is already aborted; otherwise returns.
|
|
53
|
+
*
|
|
54
|
+
* @param signal - The signal to check, or undefined to skip the check.
|
|
55
|
+
*
|
|
56
|
+
* @throws The signal's abort reason when the signal is already aborted.
|
|
57
|
+
*/
|
|
58
|
+
function throwIfSignalAborted(signal) {
|
|
59
|
+
if (signal?.aborted === true) throw abortReason(signal);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Races a promise against an abort signal. Rejects with the signal's abort
|
|
63
|
+
* reason if the signal fires first, detaching the listener and suppressing the
|
|
64
|
+
* losing promise's rejection so it never surfaces as an unhandled rejection.
|
|
65
|
+
*
|
|
66
|
+
* The underlying work must still receive the same signal so transports can
|
|
67
|
+
* cancel their network activity. This helper only makes callers stop waiting
|
|
68
|
+
* promptly even when a test double or custom transport ignores the signal.
|
|
69
|
+
*
|
|
70
|
+
* @param promise - The work to await.
|
|
71
|
+
* @param signal - Abort signal, or undefined to await the promise directly.
|
|
72
|
+
*
|
|
73
|
+
* @returns The resolved value of `promise` when it settles before the signal aborts.
|
|
74
|
+
*
|
|
75
|
+
* @throws The abort reason if the signal aborts first, or the promise's rejection.
|
|
76
|
+
*/
|
|
77
|
+
async function raceWithAbort(promise, signal) {
|
|
78
|
+
if (signal === void 0) return promise;
|
|
79
|
+
if (signal.aborted) {
|
|
80
|
+
promise.catch(() => {});
|
|
81
|
+
throw abortReason(signal);
|
|
82
|
+
}
|
|
83
|
+
let removeAbortListener;
|
|
84
|
+
const aborted = new Promise((_, reject) => {
|
|
85
|
+
const onAbort = () => {
|
|
86
|
+
promise.catch(() => {});
|
|
87
|
+
reject(abortReason(signal));
|
|
88
|
+
};
|
|
89
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
90
|
+
removeAbortListener = () => signal.removeEventListener("abort", onAbort);
|
|
91
|
+
if (signal.aborted) onAbort();
|
|
92
|
+
});
|
|
93
|
+
try {
|
|
94
|
+
return await Promise.race([promise, aborted]);
|
|
95
|
+
} finally {
|
|
96
|
+
removeAbortListener?.();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function isNamedError(err, name) {
|
|
100
|
+
try {
|
|
101
|
+
return (err instanceof DOMException || err instanceof Error) && err.name === name;
|
|
102
|
+
} catch {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
//#endregion
|
|
107
|
+
export { abortReason, isAbortError, isSignalAbortError, isTimeoutError, raceWithAbort, throwIfSignalAborted };
|
|
108
|
+
|
|
109
|
+
//# sourceMappingURL=abort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort.js","names":[],"sources":["../../src/util/abort.ts"],"sourcesContent":["/**\n * Abort-signal and cancellation-error helpers shared across SDK operations.\n *\n * @packageDocumentation\n */\n\n/**\n * Resolves the abort reason for a signal, defaulting to a standard `AbortError`.\n *\n * @param signal - The aborted signal whose reason should be resolved.\n *\n * @returns The signal's `reason`, or a fresh `AbortError` DOMException when unset.\n */\nexport function abortReason(signal: AbortSignal): unknown {\n return signal.reason ?? new DOMException('Aborted', 'AbortError')\n}\n\n/**\n * Returns whether an error represents an abort.\n *\n * @param err - Unknown thrown value.\n *\n * @returns True for `Error` or `DOMException` instances named `AbortError`.\n */\nexport function isAbortError(err: unknown): boolean {\n return isNamedError(err, 'AbortError')\n}\n\n/**\n * Returns whether an error should be treated as the given signal's abort.\n *\n * @param signal - Controlling signal for the operation.\n * @param err - Unknown thrown value.\n *\n * @returns True when the signal is aborted and `err` is either the signal's\n * reason or a trusted `AbortError` instance.\n */\nexport function isSignalAbortError(signal: AbortSignal | undefined, err: unknown): boolean {\n if (signal?.aborted !== true) return false\n if (signal.reason !== undefined && Object.is(err, signal.reason)) return true\n return isAbortError(err)\n}\n\n/**\n * Returns whether an error represents a timeout.\n *\n * @param err - Unknown thrown value.\n *\n * @returns True for `Error` or `DOMException` instances named `TimeoutError`.\n */\nexport function isTimeoutError(err: unknown): boolean {\n return isNamedError(err, 'TimeoutError')\n}\n\n/**\n * Throws the abort reason if the signal is already aborted; otherwise returns.\n *\n * @param signal - The signal to check, or undefined to skip the check.\n *\n * @throws The signal's abort reason when the signal is already aborted.\n */\nexport function throwIfSignalAborted(signal: AbortSignal | undefined): void {\n if (signal?.aborted === true) {\n throw abortReason(signal)\n }\n}\n\n/**\n * Races a promise against an abort signal. Rejects with the signal's abort\n * reason if the signal fires first, detaching the listener and suppressing the\n * losing promise's rejection so it never surfaces as an unhandled rejection.\n *\n * The underlying work must still receive the same signal so transports can\n * cancel their network activity. This helper only makes callers stop waiting\n * promptly even when a test double or custom transport ignores the signal.\n *\n * @param promise - The work to await.\n * @param signal - Abort signal, or undefined to await the promise directly.\n *\n * @returns The resolved value of `promise` when it settles before the signal aborts.\n *\n * @throws The abort reason if the signal aborts first, or the promise's rejection.\n */\nexport async function raceWithAbort<T>(\n promise: Promise<T>,\n signal: AbortSignal | undefined,\n): Promise<T> {\n if (signal === undefined) return promise\n if (signal.aborted) {\n void promise.catch(() => {})\n throw abortReason(signal)\n }\n\n let removeAbortListener: (() => void) | undefined\n const aborted = new Promise<never>((_, reject) => {\n const onAbort = (): void => {\n void promise.catch(() => {})\n reject(abortReason(signal))\n }\n signal.addEventListener('abort', onAbort, { once: true })\n removeAbortListener = () => signal.removeEventListener('abort', onAbort)\n if (signal.aborted) onAbort()\n })\n\n try {\n return await Promise.race([promise, aborted])\n } finally {\n removeAbortListener?.()\n }\n}\n\nfunction isNamedError(err: unknown, name: string): boolean {\n try {\n return (\n (err instanceof DOMException || err instanceof Error) &&\n (err as { readonly name: string }).name === name\n )\n } catch {\n return false\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,SAAgB,YAAY,QAA8B;CACxD,OAAO,OAAO,UAAU,IAAI,aAAa,WAAW,YAAY;AAClE;;;;;;;;AASA,SAAgB,aAAa,KAAuB;CAClD,OAAO,aAAa,KAAK,YAAY;AACvC;;;;;;;;;;AAWA,SAAgB,mBAAmB,QAAiC,KAAuB;CACzF,IAAI,QAAQ,YAAY,MAAM,OAAO;CACrC,IAAI,OAAO,WAAW,KAAA,KAAa,OAAO,GAAG,KAAK,OAAO,MAAM,GAAG,OAAO;CACzE,OAAO,aAAa,GAAG;AACzB;;;;;;;;AASA,SAAgB,eAAe,KAAuB;CACpD,OAAO,aAAa,KAAK,cAAc;AACzC;;;;;;;;AASA,SAAgB,qBAAqB,QAAuC;CAC1E,IAAI,QAAQ,YAAY,MACtB,MAAM,YAAY,MAAM;AAE5B;;;;;;;;;;;;;;;;;AAkBA,eAAsB,cACpB,SACA,QACY;CACZ,IAAI,WAAW,KAAA,GAAW,OAAO;CACjC,IAAI,OAAO,SAAS;EAClB,QAAa,YAAY,CAAC,CAAC;EAC3B,MAAM,YAAY,MAAM;CAC1B;CAEA,IAAI;CACJ,MAAM,UAAU,IAAI,SAAgB,GAAG,WAAW;EAChD,MAAM,gBAAsB;GAC1B,QAAa,YAAY,CAAC,CAAC;GAC3B,OAAO,YAAY,MAAM,CAAC;EAC5B;EACA,OAAO,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;EACxD,4BAA4B,OAAO,oBAAoB,SAAS,OAAO;EACvE,IAAI,OAAO,SAAS,QAAQ;CAC9B,CAAC;CAED,IAAI;EACF,OAAO,MAAM,QAAQ,KAAK,CAAC,SAAS,OAAO,CAAC;CAC9C,UAAU;EACR,sBAAsB;CACxB;AACF;AAEA,SAAS,aAAa,KAAc,MAAuB;CACzD,IAAI;EACF,QACG,eAAe,gBAAgB,eAAe,UAC9C,IAAkC,SAAS;CAEhD,QAAQ;EACN,OAAO;CACT;AACF"}
|
package/dist/util/defaults.cjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
//#region src/util/defaults.ts
|
|
2
|
+
/** Default byte size for each ranged request in a parallel download. */
|
|
3
|
+
var DEFAULT_DOWNLOAD_RANGE_SIZE = 10485760;
|
|
2
4
|
/**
|
|
3
5
|
* Default `maxFileCount` for list-style endpoints
|
|
4
6
|
* (`b2_list_file_names`, `b2_list_file_versions`, `b2_list_parts`). B2
|
|
@@ -22,6 +24,7 @@ var DEFAULT_PAGE_SIZE = 1e3;
|
|
|
22
24
|
var DEFAULT_CONTENT_TYPE = "b2/x-auto";
|
|
23
25
|
//#endregion
|
|
24
26
|
exports.DEFAULT_CONTENT_TYPE = DEFAULT_CONTENT_TYPE;
|
|
27
|
+
exports.DEFAULT_DOWNLOAD_RANGE_SIZE = DEFAULT_DOWNLOAD_RANGE_SIZE;
|
|
25
28
|
exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
|
|
26
29
|
|
|
27
30
|
//# sourceMappingURL=defaults.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.cjs","names":[],"sources":["../../src/util/defaults.ts"],"sourcesContent":["/**\n * Shared SDK-wide default values.\n *\n * Centralising defaults here makes the trade-offs visible and prevents the\n * drift that creeps in when each module hard-codes its own magic number.\n *\n * @packageDocumentation\n */\n\n/**\n * Default parallel-task count for **data-transfer** operations: uploads\n * (multipart parts), downloads (byte ranges), server-side copies (parts),\n * and sync (file-by-file). Each in-flight task occupies one transport\n * slot and at least one part-worth of memory, so we keep this\n * conservative.\n *\n * Empirically `4` saturates a typical home / office uplink without\n * starving the event loop or risking B2's per-account upload-URL\n * rate-limit. Callers that have measured their environment can override\n * via the `concurrency` option on every transfer method.\n */\nexport const DEFAULT_TRANSFER_CONCURRENCY = 4\n\n/**\n * Default parallel-task count for **bulk metadata** operations:\n * `Bucket.deleteMany` (per-version delete calls), and the action loop in\n * `synchronize` when it dispatches mixed actions in batches.\n *\n * Higher than the transfer default because each task is a tiny API\n * round-trip (no payload), so concurrency is bound by API latency rather\n * than bandwidth or local memory. `10` keeps a delete-of-thousands\n * snappy without overwhelming a single account's request budget.\n */\nexport const DEFAULT_BULK_CONCURRENCY = 10\n\n/**\n * Default `maxFileCount` for list-style endpoints\n * (`b2_list_file_names`, `b2_list_file_versions`, `b2_list_parts`). B2\n * caps `maxFileCount` at `10000` for these endpoints; the SDK requests\n * `1000` per page so a single network blip doesn't lose 10× the work and\n * so callers see results sooner.\n *\n * `b2_list_unfinished_large_files` is capped at `100` server-side and is\n * not affected by this constant.\n */\nexport const DEFAULT_PAGE_SIZE = 1000\n\n/**\n * Default MIME type for uploads when the caller omits `contentType`.\n * B2 documents `b2/x-auto` as the magic value that asks the service to\n * sniff the file's content and pick a sensible `Content-Type` itself.\n * Centralising the literal here keeps the upload, copy, and create-write\n * paths in sync.\n *\n * @see https://www.backblaze.com/apidocs/b2-upload-file\n */\nexport const DEFAULT_CONTENT_TYPE = 'b2/x-auto'\n"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"defaults.cjs","names":[],"sources":["../../src/util/defaults.ts"],"sourcesContent":["/**\n * Shared SDK-wide default values.\n *\n * Centralising defaults here makes the trade-offs visible and prevents the\n * drift that creeps in when each module hard-codes its own magic number.\n *\n * @packageDocumentation\n */\n\n/**\n * Default parallel-task count for **data-transfer** operations: uploads\n * (multipart parts), downloads (byte ranges), server-side copies (parts),\n * and sync (file-by-file). Each in-flight task occupies one transport\n * slot and at least one part-worth of memory, so we keep this\n * conservative.\n *\n * Empirically `4` saturates a typical home / office uplink without\n * starving the event loop or risking B2's per-account upload-URL\n * rate-limit. Callers that have measured their environment can override\n * via the `concurrency` option on every transfer method.\n */\nexport const DEFAULT_TRANSFER_CONCURRENCY = 4\n\n/** Default byte size for each ranged request in a parallel download. */\nexport const DEFAULT_DOWNLOAD_RANGE_SIZE = 10 * 1024 * 1024\n\n/**\n * Default parallel-task count for **bulk metadata** operations:\n * `Bucket.deleteMany` (per-version delete calls), and the action loop in\n * `synchronize` when it dispatches mixed actions in batches.\n *\n * Higher than the transfer default because each task is a tiny API\n * round-trip (no payload), so concurrency is bound by API latency rather\n * than bandwidth or local memory. `10` keeps a delete-of-thousands\n * snappy without overwhelming a single account's request budget.\n */\nexport const DEFAULT_BULK_CONCURRENCY = 10\n\n/**\n * Default `maxFileCount` for list-style endpoints\n * (`b2_list_file_names`, `b2_list_file_versions`, `b2_list_parts`). B2\n * caps `maxFileCount` at `10000` for these endpoints; the SDK requests\n * `1000` per page so a single network blip doesn't lose 10× the work and\n * so callers see results sooner.\n *\n * `b2_list_unfinished_large_files` is capped at `100` server-side and is\n * not affected by this constant.\n */\nexport const DEFAULT_PAGE_SIZE = 1000\n\n/**\n * Default MIME type for uploads when the caller omits `contentType`.\n * B2 documents `b2/x-auto` as the magic value that asks the service to\n * sniff the file's content and pick a sensible `Content-Type` itself.\n * Centralising the literal here keeps the upload, copy, and create-write\n * paths in sync.\n *\n * @see https://www.backblaze.com/apidocs/b2-upload-file\n */\nexport const DEFAULT_CONTENT_TYPE = 'b2/x-auto'\n"],"mappings":";;AAwBA,IAAa,8BAA8B;;;;;;;;;;;AAwB3C,IAAa,oBAAoB;;;;;;;;;;AAWjC,IAAa,uBAAuB"}
|
package/dist/util/defaults.d.cts
CHANGED
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
* via the `concurrency` option on every transfer method.
|
|
20
20
|
*/
|
|
21
21
|
export declare const DEFAULT_TRANSFER_CONCURRENCY = 4;
|
|
22
|
+
/** Default byte size for each ranged request in a parallel download. */
|
|
23
|
+
export declare const DEFAULT_DOWNLOAD_RANGE_SIZE: number;
|
|
22
24
|
/**
|
|
23
25
|
* Default parallel-task count for **bulk metadata** operations:
|
|
24
26
|
* `Bucket.deleteMany` (per-version delete calls), and the action loop in
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/util/defaults.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,4BAA4B,IAAI,CAAA;AAE7C;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAE1C;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,OAAO,CAAA;AAErC;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,cAAc,CAAA"}
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/util/defaults.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,4BAA4B,IAAI,CAAA;AAE7C,wEAAwE;AACxE,eAAO,MAAM,2BAA2B,QAAmB,CAAA;AAE3D;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAE1C;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,OAAO,CAAA;AAErC;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,cAAc,CAAA"}
|
package/dist/util/defaults.d.ts
CHANGED
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
* via the `concurrency` option on every transfer method.
|
|
20
20
|
*/
|
|
21
21
|
export declare const DEFAULT_TRANSFER_CONCURRENCY = 4;
|
|
22
|
+
/** Default byte size for each ranged request in a parallel download. */
|
|
23
|
+
export declare const DEFAULT_DOWNLOAD_RANGE_SIZE: number;
|
|
22
24
|
/**
|
|
23
25
|
* Default parallel-task count for **bulk metadata** operations:
|
|
24
26
|
* `Bucket.deleteMany` (per-version delete calls), and the action loop in
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/util/defaults.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,4BAA4B,IAAI,CAAA;AAE7C;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAE1C;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,OAAO,CAAA;AAErC;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,cAAc,CAAA"}
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/util/defaults.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,4BAA4B,IAAI,CAAA;AAE7C,wEAAwE;AACxE,eAAO,MAAM,2BAA2B,QAAmB,CAAA;AAE3D;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAE1C;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,OAAO,CAAA;AAErC;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,cAAc,CAAA"}
|
package/dist/util/defaults.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
//#region src/util/defaults.ts
|
|
2
|
+
/** Default byte size for each ranged request in a parallel download. */
|
|
3
|
+
var DEFAULT_DOWNLOAD_RANGE_SIZE = 10485760;
|
|
2
4
|
/**
|
|
3
5
|
* Default `maxFileCount` for list-style endpoints
|
|
4
6
|
* (`b2_list_file_names`, `b2_list_file_versions`, `b2_list_parts`). B2
|
|
@@ -21,6 +23,6 @@ var DEFAULT_PAGE_SIZE = 1e3;
|
|
|
21
23
|
*/
|
|
22
24
|
var DEFAULT_CONTENT_TYPE = "b2/x-auto";
|
|
23
25
|
//#endregion
|
|
24
|
-
export { DEFAULT_CONTENT_TYPE, DEFAULT_PAGE_SIZE };
|
|
26
|
+
export { DEFAULT_CONTENT_TYPE, DEFAULT_DOWNLOAD_RANGE_SIZE, DEFAULT_PAGE_SIZE };
|
|
25
27
|
|
|
26
28
|
//# sourceMappingURL=defaults.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","names":[],"sources":["../../src/util/defaults.ts"],"sourcesContent":["/**\n * Shared SDK-wide default values.\n *\n * Centralising defaults here makes the trade-offs visible and prevents the\n * drift that creeps in when each module hard-codes its own magic number.\n *\n * @packageDocumentation\n */\n\n/**\n * Default parallel-task count for **data-transfer** operations: uploads\n * (multipart parts), downloads (byte ranges), server-side copies (parts),\n * and sync (file-by-file). Each in-flight task occupies one transport\n * slot and at least one part-worth of memory, so we keep this\n * conservative.\n *\n * Empirically `4` saturates a typical home / office uplink without\n * starving the event loop or risking B2's per-account upload-URL\n * rate-limit. Callers that have measured their environment can override\n * via the `concurrency` option on every transfer method.\n */\nexport const DEFAULT_TRANSFER_CONCURRENCY = 4\n\n/**\n * Default parallel-task count for **bulk metadata** operations:\n * `Bucket.deleteMany` (per-version delete calls), and the action loop in\n * `synchronize` when it dispatches mixed actions in batches.\n *\n * Higher than the transfer default because each task is a tiny API\n * round-trip (no payload), so concurrency is bound by API latency rather\n * than bandwidth or local memory. `10` keeps a delete-of-thousands\n * snappy without overwhelming a single account's request budget.\n */\nexport const DEFAULT_BULK_CONCURRENCY = 10\n\n/**\n * Default `maxFileCount` for list-style endpoints\n * (`b2_list_file_names`, `b2_list_file_versions`, `b2_list_parts`). B2\n * caps `maxFileCount` at `10000` for these endpoints; the SDK requests\n * `1000` per page so a single network blip doesn't lose 10× the work and\n * so callers see results sooner.\n *\n * `b2_list_unfinished_large_files` is capped at `100` server-side and is\n * not affected by this constant.\n */\nexport const DEFAULT_PAGE_SIZE = 1000\n\n/**\n * Default MIME type for uploads when the caller omits `contentType`.\n * B2 documents `b2/x-auto` as the magic value that asks the service to\n * sniff the file's content and pick a sensible `Content-Type` itself.\n * Centralising the literal here keeps the upload, copy, and create-write\n * paths in sync.\n *\n * @see https://www.backblaze.com/apidocs/b2-upload-file\n */\nexport const DEFAULT_CONTENT_TYPE = 'b2/x-auto'\n"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"defaults.js","names":[],"sources":["../../src/util/defaults.ts"],"sourcesContent":["/**\n * Shared SDK-wide default values.\n *\n * Centralising defaults here makes the trade-offs visible and prevents the\n * drift that creeps in when each module hard-codes its own magic number.\n *\n * @packageDocumentation\n */\n\n/**\n * Default parallel-task count for **data-transfer** operations: uploads\n * (multipart parts), downloads (byte ranges), server-side copies (parts),\n * and sync (file-by-file). Each in-flight task occupies one transport\n * slot and at least one part-worth of memory, so we keep this\n * conservative.\n *\n * Empirically `4` saturates a typical home / office uplink without\n * starving the event loop or risking B2's per-account upload-URL\n * rate-limit. Callers that have measured their environment can override\n * via the `concurrency` option on every transfer method.\n */\nexport const DEFAULT_TRANSFER_CONCURRENCY = 4\n\n/** Default byte size for each ranged request in a parallel download. */\nexport const DEFAULT_DOWNLOAD_RANGE_SIZE = 10 * 1024 * 1024\n\n/**\n * Default parallel-task count for **bulk metadata** operations:\n * `Bucket.deleteMany` (per-version delete calls), and the action loop in\n * `synchronize` when it dispatches mixed actions in batches.\n *\n * Higher than the transfer default because each task is a tiny API\n * round-trip (no payload), so concurrency is bound by API latency rather\n * than bandwidth or local memory. `10` keeps a delete-of-thousands\n * snappy without overwhelming a single account's request budget.\n */\nexport const DEFAULT_BULK_CONCURRENCY = 10\n\n/**\n * Default `maxFileCount` for list-style endpoints\n * (`b2_list_file_names`, `b2_list_file_versions`, `b2_list_parts`). B2\n * caps `maxFileCount` at `10000` for these endpoints; the SDK requests\n * `1000` per page so a single network blip doesn't lose 10× the work and\n * so callers see results sooner.\n *\n * `b2_list_unfinished_large_files` is capped at `100` server-side and is\n * not affected by this constant.\n */\nexport const DEFAULT_PAGE_SIZE = 1000\n\n/**\n * Default MIME type for uploads when the caller omits `contentType`.\n * B2 documents `b2/x-auto` as the magic value that asks the service to\n * sniff the file's content and pick a sensible `Content-Type` itself.\n * Centralising the literal here keeps the upload, copy, and create-write\n * paths in sync.\n *\n * @see https://www.backblaze.com/apidocs/b2-upload-file\n */\nexport const DEFAULT_CONTENT_TYPE = 'b2/x-auto'\n"],"mappings":";;AAwBA,IAAa,8BAA8B;;;;;;;;;;;AAwB3C,IAAa,oBAAoB;;;;;;;;;;AAWjC,IAAa,uBAAuB"}
|