@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 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/sync/actions/index.ts"],"sourcesContent":["import type { SyncEvent } from '../types.ts'\n\n/** Discriminated union of all sync action types. */\nexport type SyncActionType =\n | 'upload'\n | 'download'\n | 'copy'\n | 'hide'\n | 'delete-remote'\n | 'delete-local'\n | 'skip'\n\n/** A single executable sync action produced by the policy engine. */\nexport interface SyncAction {\n /** The kind of action. */\n readonly type: SyncActionType\n /** Relative path of the file this action targets. */\n readonly relativePath: string\n /** Size in bytes of the file, or 0 for metadata-only actions. */\n readonly size: number\n /**\n * Executes the action (or no-ops if dryRun is true) and returns a corresponding event.\n * @param dryRun - When true, skip the actual I/O but still return the event.\n */\n execute(dryRun: boolean): Promise<SyncEvent>\n}\n\n/** Uploads a local file to B2. */\nexport class UploadAction implements SyncAction {\n readonly type = 'upload' as const\n\n /**\n * Creates a new UploadAction for the given relative path.\n * @param relativePath - Path relative to the sync root.\n * @param absolutePath - Absolute local filesystem path.\n * @param size - File size in bytes.\n * @param doUpload - Callback that performs the actual upload.\n */\n constructor(\n readonly relativePath: string,\n readonly absolutePath: string,\n readonly size: number,\n private readonly doUpload: (absolutePath: string, relativePath: string) => Promise<void>,\n ) {}\n\n /**\n * Uploads the file (unless dryRun) and returns an 'upload-done' event.\n * @param dryRun - Whether to simulate the action without making changes.\n *\n * @returns An async generator yielding sync progress events.\n */\n async execute(dryRun: boolean): Promise<SyncEvent> {\n if (!dryRun) {\n await this.doUpload(this.absolutePath, this.relativePath)\n }\n return { type: 'upload-done', path: this.relativePath, size: this.size }\n }\n}\n\n/** Downloads a B2 file to the local filesystem. */\nexport class DownloadAction implements SyncAction {\n readonly type = 'download' as const\n\n /**\n * Creates a new DownloadAction for the given relative path.\n * @param relativePath - Path relative to the sync root.\n * @param size - File size in bytes.\n * @param doDownload - Callback that performs the actual download.\n */\n constructor(\n readonly relativePath: string,\n readonly size: number,\n private readonly doDownload: (relativePath: string) => Promise<void>,\n ) {}\n\n /**\n * Downloads the file (unless dryRun) and returns a 'download-done' event.\n * @param dryRun - Whether to simulate the action without making changes.\n *\n * @returns An async generator yielding sync progress events.\n */\n async execute(dryRun: boolean): Promise<SyncEvent> {\n if (!dryRun) {\n await this.doDownload(this.relativePath)\n }\n return { type: 'download-done', path: this.relativePath, size: this.size }\n }\n}\n\n/** Server-side copies a B2 file to a new key within the same or different bucket. */\nexport class CopyAction implements SyncAction {\n readonly type = 'copy' as const\n\n /**\n * Creates a new CopyAction for the given relative path.\n * @param relativePath - Path relative to the sync root.\n * @param size - File size in bytes.\n * @param doCopy - Callback that performs the server-side copy.\n */\n constructor(\n readonly relativePath: string,\n readonly size: number,\n private readonly doCopy: (relativePath: string) => Promise<void>,\n ) {}\n\n /**\n * Copies the file (unless dryRun) and returns a 'copy-done' event.\n * @param dryRun - Whether to simulate the action without making changes.\n *\n * @returns An async generator yielding sync progress events.\n */\n async execute(dryRun: boolean): Promise<SyncEvent> {\n if (!dryRun) {\n await this.doCopy(this.relativePath)\n }\n return { type: 'copy-done', path: this.relativePath, size: this.size }\n }\n}\n\n/** Hides a file in B2 by creating a hide marker (soft delete). */\nexport class HideAction implements SyncAction {\n readonly type = 'hide' as const\n readonly size = 0\n\n /**\n * Creates a new HideAction for the given relative path.\n * @param relativePath - Path relative to the sync root.\n * @param doHide - Callback that creates the hide marker.\n */\n constructor(\n readonly relativePath: string,\n private readonly doHide: (relativePath: string) => Promise<void>,\n ) {}\n\n /**\n * Hides the file (unless dryRun) and returns a 'hide' event.\n * @param dryRun - Whether to simulate the action without making changes.\n *\n * @returns An async generator yielding sync progress events.\n */\n async execute(dryRun: boolean): Promise<SyncEvent> {\n if (!dryRun) {\n await this.doHide(this.relativePath)\n }\n return { type: 'hide', path: this.relativePath, size: 0 }\n }\n}\n\n/** Permanently deletes a specific file version from B2. */\nexport class DeleteRemoteAction implements SyncAction {\n readonly type = 'delete-remote' as const\n readonly size = 0\n\n /**\n * Creates a new DeleteRemoteAction for the given relative path.\n * @param relativePath - Path relative to the sync root.\n * @param fileId - The B2 file version ID to delete.\n * @param doDelete - Callback that performs the deletion.\n */\n constructor(\n readonly relativePath: string,\n readonly fileId: string,\n private readonly doDelete: (fileId: string, fileName: string) => Promise<void>,\n ) {}\n\n /**\n * Deletes the remote file version (unless dryRun) and returns a 'delete-remote' event.\n * @param dryRun - Whether to simulate the action without making changes.\n *\n * @returns An async generator yielding sync progress events.\n */\n async execute(dryRun: boolean): Promise<SyncEvent> {\n if (!dryRun) {\n await this.doDelete(this.fileId, this.relativePath)\n }\n return { type: 'delete-remote', path: this.relativePath, size: 0 }\n }\n}\n\n/** Deletes a file from the local filesystem. */\nexport class DeleteLocalAction implements SyncAction {\n readonly type = 'delete-local' as const\n readonly size = 0\n\n /**\n * Creates a new DeleteLocalAction for the given relative path.\n * @param relativePath - Path relative to the sync root.\n * @param absolutePath - Absolute local filesystem path.\n * @param doDelete - Callback that performs the deletion.\n */\n constructor(\n readonly relativePath: string,\n readonly absolutePath: string,\n private readonly doDelete: (absolutePath: string) => Promise<void>,\n ) {}\n\n /**\n * Deletes the local file (unless dryRun) and returns a 'delete-local' event.\n * @param dryRun - Whether to simulate the action without making changes.\n *\n * @returns An async generator yielding sync progress events.\n */\n async execute(dryRun: boolean): Promise<SyncEvent> {\n if (!dryRun) {\n await this.doDelete(this.absolutePath)\n }\n return { type: 'delete-local', path: this.relativePath, size: 0 }\n }\n}\n\n/** Represents a no-op action for files that do not need syncing. */\nexport class SkipAction implements SyncAction {\n readonly type = 'skip' as const\n readonly size = 0\n\n /**\n * Creates a new SkipAction for the given relative path.\n * @param relativePath - Path relative to the sync root.\n * @param reason - Human-readable explanation for why the file was skipped.\n */\n constructor(\n readonly relativePath: string,\n readonly reason: string,\n ) {}\n\n /**\n * Returns a 'skip' event with the reason message. No I/O is performed.\n * @param _dryRun - Whether to simulate the action (unused for no-op).\n *\n * @returns An async generator yielding sync progress events.\n */\n async execute(_dryRun: boolean): Promise<SyncEvent> {\n return { type: 'skip', path: this.relativePath, size: 0, message: this.reason }\n }\n}\n"],"names":[],"mappings":";;AA4BO,MAAM,aAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAU9C,YACW,cACA,cACA,MACQ,UACjB;AAJS,SAAA,eAAA;AACA,SAAA,eAAA;AACA,SAAA,OAAA;AACQ,SAAA,WAAA;AAAA,EAChB;AAAA,EAdM,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsBhB,MAAM,QAAQ,QAAqC;AACjD,QAAI,CAAC,QAAQ;AACX,YAAM,KAAK,SAAS,KAAK,cAAc,KAAK,YAAY;AAAA,IAC1D;AACA,WAAO,EAAE,MAAM,eAAe,MAAM,KAAK,cAAc,MAAM,KAAK,KAAA;AAAA,EACpE;AACF;AAGO,MAAM,eAAqC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAShD,YACW,cACA,MACQ,YACjB;AAHS,SAAA,eAAA;AACA,SAAA,OAAA;AACQ,SAAA,aAAA;AAAA,EAChB;AAAA,EAZM,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBhB,MAAM,QAAQ,QAAqC;AACjD,QAAI,CAAC,QAAQ;AACX,YAAM,KAAK,WAAW,KAAK,YAAY;AAAA,IACzC;AACA,WAAO,EAAE,MAAM,iBAAiB,MAAM,KAAK,cAAc,MAAM,KAAK,KAAA;AAAA,EACtE;AACF;AAGO,MAAM,WAAiC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS5C,YACW,cACA,MACQ,QACjB;AAHS,SAAA,eAAA;AACA,SAAA,OAAA;AACQ,SAAA,SAAA;AAAA,EAChB;AAAA,EAZM,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBhB,MAAM,QAAQ,QAAqC;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AAI,CAAC,QAAQ;AACX,YAAM,KAAK,SAAS,KAAK,YAAY;AAAA,IACvC;AACA,WAAO,EAAE,MAAM,gBAAgB,MAAM,KAAK,cAAc,MAAM,EAAA;AAAA,EAChE;AACF;AAGO,MAAM,WAAiC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS5C,YACW,cACA,QACT;AAFS,SAAA,eAAA;AACA,SAAA,SAAA;AAAA,EACR;AAAA,EAXM,OAAO;AAAA,EACP,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBhB,MAAM,QAAQ,SAAsC;AAClD,WAAO,EAAE,MAAM,QAAQ,MAAM,KAAK,cAAc,MAAM,GAAG,SAAS,KAAK,OAAA;AAAA,EACzE;AACF;;;;;;;;"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { SyncEvent } from '../types.js';
|
|
2
|
+
/** Discriminated union of all sync action types. */
|
|
3
|
+
export type SyncActionType = 'upload' | 'download' | 'copy' | 'hide' | 'delete-remote' | 'delete-local' | 'skip';
|
|
4
|
+
/** A single executable sync action produced by the policy engine. */
|
|
5
|
+
export interface SyncAction {
|
|
6
|
+
/** The kind of action. */
|
|
7
|
+
readonly type: SyncActionType;
|
|
8
|
+
/** Relative path of the file this action targets. */
|
|
9
|
+
readonly relativePath: string;
|
|
10
|
+
/** Size in bytes of the file, or 0 for metadata-only actions. */
|
|
11
|
+
readonly size: number;
|
|
12
|
+
/**
|
|
13
|
+
* Executes the action (or no-ops if dryRun is true) and returns a corresponding event.
|
|
14
|
+
* @param dryRun - When true, skip the actual I/O but still return the event.
|
|
15
|
+
*/
|
|
16
|
+
execute(dryRun: boolean): Promise<SyncEvent>;
|
|
17
|
+
}
|
|
18
|
+
/** Uploads a local file to B2. */
|
|
19
|
+
export declare class UploadAction implements SyncAction {
|
|
20
|
+
readonly relativePath: string;
|
|
21
|
+
readonly absolutePath: string;
|
|
22
|
+
readonly size: number;
|
|
23
|
+
private readonly doUpload;
|
|
24
|
+
readonly type: "upload";
|
|
25
|
+
/**
|
|
26
|
+
* Creates a new UploadAction for the given relative path.
|
|
27
|
+
* @param relativePath - Path relative to the sync root.
|
|
28
|
+
* @param absolutePath - Absolute local filesystem path.
|
|
29
|
+
* @param size - File size in bytes.
|
|
30
|
+
* @param doUpload - Callback that performs the actual upload.
|
|
31
|
+
*/
|
|
32
|
+
constructor(relativePath: string, absolutePath: string, size: number, doUpload: (absolutePath: string, relativePath: string) => Promise<void>);
|
|
33
|
+
/**
|
|
34
|
+
* Uploads the file (unless dryRun) and returns an 'upload-done' event.
|
|
35
|
+
* @param dryRun - Whether to simulate the action without making changes.
|
|
36
|
+
*
|
|
37
|
+
* @returns An async generator yielding sync progress events.
|
|
38
|
+
*/
|
|
39
|
+
execute(dryRun: boolean): Promise<SyncEvent>;
|
|
40
|
+
}
|
|
41
|
+
/** Downloads a B2 file to the local filesystem. */
|
|
42
|
+
export declare class DownloadAction implements SyncAction {
|
|
43
|
+
readonly relativePath: string;
|
|
44
|
+
readonly size: number;
|
|
45
|
+
private readonly doDownload;
|
|
46
|
+
readonly type: "download";
|
|
47
|
+
/**
|
|
48
|
+
* Creates a new DownloadAction for the given relative path.
|
|
49
|
+
* @param relativePath - Path relative to the sync root.
|
|
50
|
+
* @param size - File size in bytes.
|
|
51
|
+
* @param doDownload - Callback that performs the actual download.
|
|
52
|
+
*/
|
|
53
|
+
constructor(relativePath: string, size: number, doDownload: (relativePath: string) => Promise<void>);
|
|
54
|
+
/**
|
|
55
|
+
* Downloads the file (unless dryRun) and returns a 'download-done' event.
|
|
56
|
+
* @param dryRun - Whether to simulate the action without making changes.
|
|
57
|
+
*
|
|
58
|
+
* @returns An async generator yielding sync progress events.
|
|
59
|
+
*/
|
|
60
|
+
execute(dryRun: boolean): Promise<SyncEvent>;
|
|
61
|
+
}
|
|
62
|
+
/** Server-side copies a B2 file to a new key within the same or different bucket. */
|
|
63
|
+
export declare class CopyAction implements SyncAction {
|
|
64
|
+
readonly relativePath: string;
|
|
65
|
+
readonly size: number;
|
|
66
|
+
private readonly doCopy;
|
|
67
|
+
readonly type: "copy";
|
|
68
|
+
/**
|
|
69
|
+
* Creates a new CopyAction for the given relative path.
|
|
70
|
+
* @param relativePath - Path relative to the sync root.
|
|
71
|
+
* @param size - File size in bytes.
|
|
72
|
+
* @param doCopy - Callback that performs the server-side copy.
|
|
73
|
+
*/
|
|
74
|
+
constructor(relativePath: string, size: number, doCopy: (relativePath: string) => Promise<void>);
|
|
75
|
+
/**
|
|
76
|
+
* Copies the file (unless dryRun) and returns a 'copy-done' event.
|
|
77
|
+
* @param dryRun - Whether to simulate the action without making changes.
|
|
78
|
+
*
|
|
79
|
+
* @returns An async generator yielding sync progress events.
|
|
80
|
+
*/
|
|
81
|
+
execute(dryRun: boolean): Promise<SyncEvent>;
|
|
82
|
+
}
|
|
83
|
+
/** Hides a file in B2 by creating a hide marker (soft delete). */
|
|
84
|
+
export declare class HideAction implements SyncAction {
|
|
85
|
+
readonly relativePath: string;
|
|
86
|
+
private readonly doHide;
|
|
87
|
+
readonly type: "hide";
|
|
88
|
+
readonly size = 0;
|
|
89
|
+
/**
|
|
90
|
+
* Creates a new HideAction for the given relative path.
|
|
91
|
+
* @param relativePath - Path relative to the sync root.
|
|
92
|
+
* @param doHide - Callback that creates the hide marker.
|
|
93
|
+
*/
|
|
94
|
+
constructor(relativePath: string, doHide: (relativePath: string) => Promise<void>);
|
|
95
|
+
/**
|
|
96
|
+
* Hides the file (unless dryRun) and returns a 'hide' event.
|
|
97
|
+
* @param dryRun - Whether to simulate the action without making changes.
|
|
98
|
+
*
|
|
99
|
+
* @returns An async generator yielding sync progress events.
|
|
100
|
+
*/
|
|
101
|
+
execute(dryRun: boolean): Promise<SyncEvent>;
|
|
102
|
+
}
|
|
103
|
+
/** Permanently deletes a specific file version from B2. */
|
|
104
|
+
export declare class DeleteRemoteAction implements SyncAction {
|
|
105
|
+
readonly relativePath: string;
|
|
106
|
+
readonly fileId: string;
|
|
107
|
+
private readonly doDelete;
|
|
108
|
+
readonly type: "delete-remote";
|
|
109
|
+
readonly size = 0;
|
|
110
|
+
/**
|
|
111
|
+
* Creates a new DeleteRemoteAction for the given relative path.
|
|
112
|
+
* @param relativePath - Path relative to the sync root.
|
|
113
|
+
* @param fileId - The B2 file version ID to delete.
|
|
114
|
+
* @param doDelete - Callback that performs the deletion.
|
|
115
|
+
*/
|
|
116
|
+
constructor(relativePath: string, fileId: string, doDelete: (fileId: string, fileName: string) => Promise<void>);
|
|
117
|
+
/**
|
|
118
|
+
* Deletes the remote file version (unless dryRun) and returns a 'delete-remote' event.
|
|
119
|
+
* @param dryRun - Whether to simulate the action without making changes.
|
|
120
|
+
*
|
|
121
|
+
* @returns An async generator yielding sync progress events.
|
|
122
|
+
*/
|
|
123
|
+
execute(dryRun: boolean): Promise<SyncEvent>;
|
|
124
|
+
}
|
|
125
|
+
/** Deletes a file from the local filesystem. */
|
|
126
|
+
export declare class DeleteLocalAction implements SyncAction {
|
|
127
|
+
readonly relativePath: string;
|
|
128
|
+
readonly absolutePath: string;
|
|
129
|
+
private readonly doDelete;
|
|
130
|
+
readonly type: "delete-local";
|
|
131
|
+
readonly size = 0;
|
|
132
|
+
/**
|
|
133
|
+
* Creates a new DeleteLocalAction for the given relative path.
|
|
134
|
+
* @param relativePath - Path relative to the sync root.
|
|
135
|
+
* @param absolutePath - Absolute local filesystem path.
|
|
136
|
+
* @param doDelete - Callback that performs the deletion.
|
|
137
|
+
*/
|
|
138
|
+
constructor(relativePath: string, absolutePath: string, doDelete: (absolutePath: string) => Promise<void>);
|
|
139
|
+
/**
|
|
140
|
+
* Deletes the local file (unless dryRun) and returns a 'delete-local' event.
|
|
141
|
+
* @param dryRun - Whether to simulate the action without making changes.
|
|
142
|
+
*
|
|
143
|
+
* @returns An async generator yielding sync progress events.
|
|
144
|
+
*/
|
|
145
|
+
execute(dryRun: boolean): Promise<SyncEvent>;
|
|
146
|
+
}
|
|
147
|
+
/** Represents a no-op action for files that do not need syncing. */
|
|
148
|
+
export declare class SkipAction implements SyncAction {
|
|
149
|
+
readonly relativePath: string;
|
|
150
|
+
readonly reason: string;
|
|
151
|
+
readonly type: "skip";
|
|
152
|
+
readonly size = 0;
|
|
153
|
+
/**
|
|
154
|
+
* Creates a new SkipAction for the given relative path.
|
|
155
|
+
* @param relativePath - Path relative to the sync root.
|
|
156
|
+
* @param reason - Human-readable explanation for why the file was skipped.
|
|
157
|
+
*/
|
|
158
|
+
constructor(relativePath: string, reason: string);
|
|
159
|
+
/**
|
|
160
|
+
* Returns a 'skip' event with the reason message. No I/O is performed.
|
|
161
|
+
* @param _dryRun - Whether to simulate the action (unused for no-op).
|
|
162
|
+
*
|
|
163
|
+
* @returns An async generator yielding sync progress events.
|
|
164
|
+
*/
|
|
165
|
+
execute(_dryRun: boolean): Promise<SyncEvent>;
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sync/actions/index.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,oDAAoD;AACpD,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,UAAU,GACV,MAAM,GACN,MAAM,GACN,eAAe,GACf,cAAc,GACd,MAAM,CAAA;AAEV,qEAAqE;AACrE,MAAM,WAAW,UAAU;IACzB,0BAA0B;IAC1B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;IAC7B,qDAAqD;IACrD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;CAC7C;AAED,kCAAkC;AAClC,qBAAa,YAAa,YAAW,UAAU;IAW3C,QAAQ,CAAC,YAAY,EA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AEjB;;;;;OAKG;gBAEQ,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;IAGpE;;;;;OAKG;IACG,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;CAMnD;AAED,oEAAoE;AACpE,qBAAa,UAAW,YAAW,UAAU;IAUzC,QAAQ,CAAC,YAAY,EAAE,MAAM;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM;IAVzB,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAS;IAC/B,QAAQ,CAAC,IAAI,KAAI;IAEjB;;;;OAIG;gBAEQ,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM;IAGzB;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;CAGpD"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { SyncEvent } from '../types.js';
|
|
2
|
+
/** Discriminated union of all sync action types. */
|
|
3
|
+
export type SyncActionType = 'upload' | 'download' | 'copy' | 'hide' | 'delete-remote' | 'delete-local' | 'skip';
|
|
4
|
+
/** A single executable sync action produced by the policy engine. */
|
|
5
|
+
export interface SyncAction {
|
|
6
|
+
/** The kind of action. */
|
|
7
|
+
readonly type: SyncActionType;
|
|
8
|
+
/** Relative path of the file this action targets. */
|
|
9
|
+
readonly relativePath: string;
|
|
10
|
+
/** Size in bytes of the file, or 0 for metadata-only actions. */
|
|
11
|
+
readonly size: number;
|
|
12
|
+
/**
|
|
13
|
+
* Executes the action (or no-ops if dryRun is true) and returns a corresponding event.
|
|
14
|
+
* @param dryRun - When true, skip the actual I/O but still return the event.
|
|
15
|
+
*/
|
|
16
|
+
execute(dryRun: boolean): Promise<SyncEvent>;
|
|
17
|
+
}
|
|
18
|
+
/** Uploads a local file to B2. */
|
|
19
|
+
export declare class UploadAction implements SyncAction {
|
|
20
|
+
readonly relativePath: string;
|
|
21
|
+
readonly absolutePath: string;
|
|
22
|
+
readonly size: number;
|
|
23
|
+
private readonly doUpload;
|
|
24
|
+
readonly type: "upload";
|
|
25
|
+
/**
|
|
26
|
+
* Creates a new UploadAction for the given relative path.
|
|
27
|
+
* @param relativePath - Path relative to the sync root.
|
|
28
|
+
* @param absolutePath - Absolute local filesystem path.
|
|
29
|
+
* @param size - File size in bytes.
|
|
30
|
+
* @param doUpload - Callback that performs the actual upload.
|
|
31
|
+
*/
|
|
32
|
+
constructor(relativePath: string, absolutePath: string, size: number, doUpload: (absolutePath: string, relativePath: string) => Promise<void>);
|
|
33
|
+
/**
|
|
34
|
+
* Uploads the file (unless dryRun) and returns an 'upload-done' event.
|
|
35
|
+
* @param dryRun - Whether to simulate the action without making changes.
|
|
36
|
+
*
|
|
37
|
+
* @returns An async generator yielding sync progress events.
|
|
38
|
+
*/
|
|
39
|
+
execute(dryRun: boolean): Promise<SyncEvent>;
|
|
40
|
+
}
|
|
41
|
+
/** Downloads a B2 file to the local filesystem. */
|
|
42
|
+
export declare class DownloadAction implements SyncAction {
|
|
43
|
+
readonly relativePath: string;
|
|
44
|
+
readonly size: number;
|
|
45
|
+
private readonly doDownload;
|
|
46
|
+
readonly type: "download";
|
|
47
|
+
/**
|
|
48
|
+
* Creates a new DownloadAction for the given relative path.
|
|
49
|
+
* @param relativePath - Path relative to the sync root.
|
|
50
|
+
* @param size - File size in bytes.
|
|
51
|
+
* @param doDownload - Callback that performs the actual download.
|
|
52
|
+
*/
|
|
53
|
+
constructor(relativePath: string, size: number, doDownload: (relativePath: string) => Promise<void>);
|
|
54
|
+
/**
|
|
55
|
+
* Downloads the file (unless dryRun) and returns a 'download-done' event.
|
|
56
|
+
* @param dryRun - Whether to simulate the action without making changes.
|
|
57
|
+
*
|
|
58
|
+
* @returns An async generator yielding sync progress events.
|
|
59
|
+
*/
|
|
60
|
+
execute(dryRun: boolean): Promise<SyncEvent>;
|
|
61
|
+
}
|
|
62
|
+
/** Server-side copies a B2 file to a new key within the same or different bucket. */
|
|
63
|
+
export declare class CopyAction implements SyncAction {
|
|
64
|
+
readonly relativePath: string;
|
|
65
|
+
readonly size: number;
|
|
66
|
+
private readonly doCopy;
|
|
67
|
+
readonly type: "copy";
|
|
68
|
+
/**
|
|
69
|
+
* Creates a new CopyAction for the given relative path.
|
|
70
|
+
* @param relativePath - Path relative to the sync root.
|
|
71
|
+
* @param size - File size in bytes.
|
|
72
|
+
* @param doCopy - Callback that performs the server-side copy.
|
|
73
|
+
*/
|
|
74
|
+
constructor(relativePath: string, size: number, doCopy: (relativePath: string) => Promise<void>);
|
|
75
|
+
/**
|
|
76
|
+
* Copies the file (unless dryRun) and returns a 'copy-done' event.
|
|
77
|
+
* @param dryRun - Whether to simulate the action without making changes.
|
|
78
|
+
*
|
|
79
|
+
* @returns An async generator yielding sync progress events.
|
|
80
|
+
*/
|
|
81
|
+
execute(dryRun: boolean): Promise<SyncEvent>;
|
|
82
|
+
}
|
|
83
|
+
/** Hides a file in B2 by creating a hide marker (soft delete). */
|
|
84
|
+
export declare class HideAction implements SyncAction {
|
|
85
|
+
readonly relativePath: string;
|
|
86
|
+
private readonly doHide;
|
|
87
|
+
readonly type: "hide";
|
|
88
|
+
readonly size = 0;
|
|
89
|
+
/**
|
|
90
|
+
* Creates a new HideAction for the given relative path.
|
|
91
|
+
* @param relativePath - Path relative to the sync root.
|
|
92
|
+
* @param doHide - Callback that creates the hide marker.
|
|
93
|
+
*/
|
|
94
|
+
constructor(relativePath: string, doHide: (relativePath: string) => Promise<void>);
|
|
95
|
+
/**
|
|
96
|
+
* Hides the file (unless dryRun) and returns a 'hide' event.
|
|
97
|
+
* @param dryRun - Whether to simulate the action without making changes.
|
|
98
|
+
*
|
|
99
|
+
* @returns An async generator yielding sync progress events.
|
|
100
|
+
*/
|
|
101
|
+
execute(dryRun: boolean): Promise<SyncEvent>;
|
|
102
|
+
}
|
|
103
|
+
/** Permanently deletes a specific file version from B2. */
|
|
104
|
+
export declare class DeleteRemoteAction implements SyncAction {
|
|
105
|
+
readonly relativePath: string;
|
|
106
|
+
readonly fileId: string;
|
|
107
|
+
private readonly doDelete;
|
|
108
|
+
readonly type: "delete-remote";
|
|
109
|
+
readonly size = 0;
|
|
110
|
+
/**
|
|
111
|
+
* Creates a new DeleteRemoteAction for the given relative path.
|
|
112
|
+
* @param relativePath - Path relative to the sync root.
|
|
113
|
+
* @param fileId - The B2 file version ID to delete.
|
|
114
|
+
* @param doDelete - Callback that performs the deletion.
|
|
115
|
+
*/
|
|
116
|
+
constructor(relativePath: string, fileId: string, doDelete: (fileId: string, fileName: string) => Promise<void>);
|
|
117
|
+
/**
|
|
118
|
+
* Deletes the remote file version (unless dryRun) and returns a 'delete-remote' event.
|
|
119
|
+
* @param dryRun - Whether to simulate the action without making changes.
|
|
120
|
+
*
|
|
121
|
+
* @returns An async generator yielding sync progress events.
|
|
122
|
+
*/
|
|
123
|
+
execute(dryRun: boolean): Promise<SyncEvent>;
|
|
124
|
+
}
|
|
125
|
+
/** Deletes a file from the local filesystem. */
|
|
126
|
+
export declare class DeleteLocalAction implements SyncAction {
|
|
127
|
+
readonly relativePath: string;
|
|
128
|
+
readonly absolutePath: string;
|
|
129
|
+
private readonly doDelete;
|
|
130
|
+
readonly type: "delete-local";
|
|
131
|
+
readonly size = 0;
|
|
132
|
+
/**
|
|
133
|
+
* Creates a new DeleteLocalAction for the given relative path.
|
|
134
|
+
* @param relativePath - Path relative to the sync root.
|
|
135
|
+
* @param absolutePath - Absolute local filesystem path.
|
|
136
|
+
* @param doDelete - Callback that performs the deletion.
|
|
137
|
+
*/
|
|
138
|
+
constructor(relativePath: string, absolutePath: string, doDelete: (absolutePath: string) => Promise<void>);
|
|
139
|
+
/**
|
|
140
|
+
* Deletes the local file (unless dryRun) and returns a 'delete-local' event.
|
|
141
|
+
* @param dryRun - Whether to simulate the action without making changes.
|
|
142
|
+
*
|
|
143
|
+
* @returns An async generator yielding sync progress events.
|
|
144
|
+
*/
|
|
145
|
+
execute(dryRun: boolean): Promise<SyncEvent>;
|
|
146
|
+
}
|
|
147
|
+
/** Represents a no-op action for files that do not need syncing. */
|
|
148
|
+
export declare class SkipAction implements SyncAction {
|
|
149
|
+
readonly relativePath: string;
|
|
150
|
+
readonly reason: string;
|
|
151
|
+
readonly type: "skip";
|
|
152
|
+
readonly size = 0;
|
|
153
|
+
/**
|
|
154
|
+
* Creates a new SkipAction for the given relative path.
|
|
155
|
+
* @param relativePath - Path relative to the sync root.
|
|
156
|
+
* @param reason - Human-readable explanation for why the file was skipped.
|
|
157
|
+
*/
|
|
158
|
+
constructor(relativePath: string, reason: string);
|
|
159
|
+
/**
|
|
160
|
+
* Returns a 'skip' event with the reason message. No I/O is performed.
|
|
161
|
+
* @param _dryRun - Whether to simulate the action (unused for no-op).
|
|
162
|
+
*
|
|
163
|
+
* @returns An async generator yielding sync progress events.
|
|
164
|
+
*/
|
|
165
|
+
execute(_dryRun: boolean): Promise<SyncEvent>;
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sync/actions/index.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,oDAAoD;AACpD,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,UAAU,GACV,MAAM,GACN,MAAM,GACN,eAAe,GACf,cAAc,GACd,MAAM,CAAA;AAEV,qEAAqE;AACrE,MAAM,WAAW,UAAU;IACzB,0BAA0B;IAC1B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;IAC7B,qDAAqD;IACrD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,O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AAO,CAAC,QAAQ,CAAC,QAAQ;IAZ3B,QAAQ,CAAC,IAAI,EAAG,cAAc,CAAS;IACvC,QAAQ,CAAC,IAAI,KAAI;IAEjB;;;;;OAKG;gBAEQ,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;IAGpE;;;;;OAKG;IACG,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;CAMnD;AAED,oEAAoE;AACpE,qBAAa,UAAW,YAAW,UAAU;IAUzC,QAAQ,CAAC,YAAY,EAAE,MAAM;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM;IAVzB,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAS;IAC/B,QAAQ,CAAC,IAAI,KAAI;IAEjB;;;;OAIG;gBAEQ,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM;IAGzB;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;CAGpD"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
class UploadAction {
|
|
2
|
+
/**
|
|
3
|
+
* Creates a new UploadAction for the given relative path.
|
|
4
|
+
* @param relativePath - Path relative to the sync root.
|
|
5
|
+
* @param absolutePath - Absolute local filesystem path.
|
|
6
|
+
* @param size - File size in bytes.
|
|
7
|
+
* @param doUpload - Callback that performs the actual upload.
|
|
8
|
+
*/
|
|
9
|
+
constructor(relativePath, absolutePath, size, doUpload) {
|
|
10
|
+
this.relativePath = relativePath;
|
|
11
|
+
this.absolutePath = absolutePath;
|
|
12
|
+
this.size = size;
|
|
13
|
+
this.doUpload = doUpload;
|
|
14
|
+
}
|
|
15
|
+
type = "upload";
|
|
16
|
+
/**
|
|
17
|
+
* Uploads the file (unless dryRun) and returns an 'upload-done' event.
|
|
18
|
+
* @param dryRun - Whether to simulate the action without making changes.
|
|
19
|
+
*
|
|
20
|
+
* @returns An async generator yielding sync progress events.
|
|
21
|
+
*/
|
|
22
|
+
async execute(dryRun) {
|
|
23
|
+
if (!dryRun) {
|
|
24
|
+
await this.doUpload(this.absolutePath, this.relativePath);
|
|
25
|
+
}
|
|
26
|
+
return { type: "upload-done", path: this.relativePath, size: this.size };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
class DownloadAction {
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new DownloadAction for the given relative path.
|
|
32
|
+
* @param relativePath - Path relative to the sync root.
|
|
33
|
+
* @param size - File size in bytes.
|
|
34
|
+
* @param doDownload - Callback that performs the actual download.
|
|
35
|
+
*/
|
|
36
|
+
constructor(relativePath, size, doDownload) {
|
|
37
|
+
this.relativePath = relativePath;
|
|
38
|
+
this.size = size;
|
|
39
|
+
this.doDownload = doDownload;
|
|
40
|
+
}
|
|
41
|
+
type = "download";
|
|
42
|
+
/**
|
|
43
|
+
* Downloads the file (unless dryRun) and returns a 'download-done' event.
|
|
44
|
+
* @param dryRun - Whether to simulate the action without making changes.
|
|
45
|
+
*
|
|
46
|
+
* @returns An async generator yielding sync progress events.
|
|
47
|
+
*/
|
|
48
|
+
async execute(dryRun) {
|
|
49
|
+
if (!dryRun) {
|
|
50
|
+
await this.doDownload(this.relativePath);
|
|
51
|
+
}
|
|
52
|
+
return { type: "download-done", path: this.relativePath, size: this.size };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
class CopyAction {
|
|
56
|
+
/**
|
|
57
|
+
* Creates a new CopyAction for the given relative path.
|
|
58
|
+
* @param relativePath - Path relative to the sync root.
|
|
59
|
+
* @param size - File size in bytes.
|
|
60
|
+
* @param doCopy - Callback that performs the server-side copy.
|
|
61
|
+
*/
|
|
62
|
+
constructor(relativePath, size, doCopy) {
|
|
63
|
+
this.relativePath = relativePath;
|
|
64
|
+
this.size = size;
|
|
65
|
+
this.doCopy = doCopy;
|
|
66
|
+
}
|
|
67
|
+
type = "copy";
|
|
68
|
+
/**
|
|
69
|
+
* Copies the file (unless dryRun) and returns a 'copy-done' event.
|
|
70
|
+
* @param dryRun - Whether to simulate the action without making changes.
|
|
71
|
+
*
|
|
72
|
+
* @returns An async generator yielding sync progress events.
|
|
73
|
+
*/
|
|
74
|
+
async execute(dryRun) {
|
|
75
|
+
if (!dryRun) {
|
|
76
|
+
await this.doCopy(this.relativePath);
|
|
77
|
+
}
|
|
78
|
+
return { type: "copy-done", path: this.relativePath, size: this.size };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
class HideAction {
|
|
82
|
+
/**
|
|
83
|
+
* Creates a new HideAction for the given relative path.
|
|
84
|
+
* @param relativePath - Path relative to the sync root.
|
|
85
|
+
* @param doHide - Callback that creates the hide marker.
|
|
86
|
+
*/
|
|
87
|
+
constructor(relativePath, doHide) {
|
|
88
|
+
this.relativePath = relativePath;
|
|
89
|
+
this.doHide = doHide;
|
|
90
|
+
}
|
|
91
|
+
type = "hide";
|
|
92
|
+
size = 0;
|
|
93
|
+
/**
|
|
94
|
+
* Hides the file (unless dryRun) and returns a 'hide' event.
|
|
95
|
+
* @param dryRun - Whether to simulate the action without making changes.
|
|
96
|
+
*
|
|
97
|
+
* @returns An async generator yielding sync progress events.
|
|
98
|
+
*/
|
|
99
|
+
async execute(dryRun) {
|
|
100
|
+
if (!dryRun) {
|
|
101
|
+
await this.doHide(this.relativePath);
|
|
102
|
+
}
|
|
103
|
+
return { type: "hide", path: this.relativePath, size: 0 };
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
class DeleteRemoteAction {
|
|
107
|
+
/**
|
|
108
|
+
* Creates a new DeleteRemoteAction for the given relative path.
|
|
109
|
+
* @param relativePath - Path relative to the sync root.
|
|
110
|
+
* @param fileId - The B2 file version ID to delete.
|
|
111
|
+
* @param doDelete - Callback that performs the deletion.
|
|
112
|
+
*/
|
|
113
|
+
constructor(relativePath, fileId, doDelete) {
|
|
114
|
+
this.relativePath = relativePath;
|
|
115
|
+
this.fileId = fileId;
|
|
116
|
+
this.doDelete = doDelete;
|
|
117
|
+
}
|
|
118
|
+
type = "delete-remote";
|
|
119
|
+
size = 0;
|
|
120
|
+
/**
|
|
121
|
+
* Deletes the remote file version (unless dryRun) and returns a 'delete-remote' event.
|
|
122
|
+
* @param dryRun - Whether to simulate the action without making changes.
|
|
123
|
+
*
|
|
124
|
+
* @returns An async generator yielding sync progress events.
|
|
125
|
+
*/
|
|
126
|
+
async execute(dryRun) {
|
|
127
|
+
if (!dryRun) {
|
|
128
|
+
await this.doDelete(this.fileId, this.relativePath);
|
|
129
|
+
}
|
|
130
|
+
return { type: "delete-remote", path: this.relativePath, size: 0 };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
class DeleteLocalAction {
|
|
134
|
+
/**
|
|
135
|
+
* Creates a new DeleteLocalAction for the given relative path.
|
|
136
|
+
* @param relativePath - Path relative to the sync root.
|
|
137
|
+
* @param absolutePath - Absolute local filesystem path.
|
|
138
|
+
* @param doDelete - Callback that performs the deletion.
|
|
139
|
+
*/
|
|
140
|
+
constructor(relativePath, absolutePath, doDelete) {
|
|
141
|
+
this.relativePath = relativePath;
|
|
142
|
+
this.absolutePath = absolutePath;
|
|
143
|
+
this.doDelete = doDelete;
|
|
144
|
+
}
|
|
145
|
+
type = "delete-local";
|
|
146
|
+
size = 0;
|
|
147
|
+
/**
|
|
148
|
+
* Deletes the local file (unless dryRun) and returns a 'delete-local' event.
|
|
149
|
+
* @param dryRun - Whether to simulate the action without making changes.
|
|
150
|
+
*
|
|
151
|
+
* @returns An async generator yielding sync progress events.
|
|
152
|
+
*/
|
|
153
|
+
async execute(dryRun) {
|
|
154
|
+
if (!dryRun) {
|
|
155
|
+
await this.doDelete(this.absolutePath);
|
|
156
|
+
}
|
|
157
|
+
return { type: "delete-local", path: this.relativePath, size: 0 };
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
class SkipAction {
|
|
161
|
+
/**
|
|
162
|
+
* Creates a new SkipAction for the given relative path.
|
|
163
|
+
* @param relativePath - Path relative to the sync root.
|
|
164
|
+
* @param reason - Human-readable explanation for why the file was skipped.
|
|
165
|
+
*/
|
|
166
|
+
constructor(relativePath, reason) {
|
|
167
|
+
this.relativePath = relativePath;
|
|
168
|
+
this.reason = reason;
|
|
169
|
+
}
|
|
170
|
+
type = "skip";
|
|
171
|
+
size = 0;
|
|
172
|
+
/**
|
|
173
|
+
* Returns a 'skip' event with the reason message. No I/O is performed.
|
|
174
|
+
* @param _dryRun - Whether to simulate the action (unused for no-op).
|
|
175
|
+
*
|
|
176
|
+
* @returns An async generator yielding sync progress events.
|
|
177
|
+
*/
|
|
178
|
+
async execute(_dryRun) {
|
|
179
|
+
return { type: "skip", path: this.relativePath, size: 0, message: this.reason };
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
export {
|
|
183
|
+
CopyAction,
|
|
184
|
+
DeleteLocalAction,
|
|
185
|
+
DeleteRemoteAction,
|
|
186
|
+
DownloadAction,
|
|
187
|
+
HideAction,
|
|
188
|
+
SkipAction,
|
|
189
|
+
UploadAction
|
|
190
|
+
};
|
|
191
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/sync/actions/index.ts"],"sourcesContent":["import type { SyncEvent } from '../types.ts'\n\n/** Discriminated union of all sync action types. */\nexport type SyncActionType =\n | 'upload'\n | 'download'\n | 'copy'\n | 'hide'\n | 'delete-remote'\n | 'delete-local'\n | 'skip'\n\n/** A single executable sync action produced by the policy engine. */\nexport interface SyncAction {\n /** The kind of action. */\n readonly type: SyncActionType\n /** Relative path of the file this action targets. */\n readonly relativePath: string\n /** Size in bytes of the file, or 0 for metadata-only actions. */\n readonly size: number\n /**\n * Executes the action (or no-ops if dryRun is true) and returns a corresponding event.\n * @param dryRun - When true, skip the actual I/O but still return the event.\n */\n execute(dryRun: boolean): Promise<SyncEvent>\n}\n\n/** Uploads a local file to B2. */\nexport class UploadAction implements SyncAction {\n readonly type = 'upload' as const\n\n /**\n * Creates a new UploadAction for the given relative path.\n * @param relativePath - Path relative to the sync root.\n * @param absolutePath - Absolute local filesystem path.\n * @param size - File size in bytes.\n * @param doUpload - Callback that performs the actual upload.\n */\n constructor(\n readonly relativePath: string,\n readonly absolutePath: string,\n readonly size: number,\n private readonly doUpload: (absolutePath: string, relativePath: string) => Promise<void>,\n ) {}\n\n /**\n * Uploads the file (unless dryRun) and returns an 'upload-done' event.\n * @param dryRun - Whether to simulate the action without making changes.\n *\n * @returns An async generator yielding sync progress events.\n */\n async execute(dryRun: boolean): Promise<SyncEvent> {\n if (!dryRun) {\n await this.doUpload(this.absolutePath, this.relativePath)\n }\n return { type: 'upload-done', path: this.relativePath, size: this.size }\n }\n}\n\n/** Downloads a B2 file to the local filesystem. */\nexport class DownloadAction implements SyncAction {\n readonly type = 'download' as const\n\n /**\n * Creates a new DownloadAction for the given relative path.\n * @param relativePath - Path relative to the sync root.\n * @param size - File size in bytes.\n * @param doDownload - Callback that performs the actual download.\n */\n constructor(\n readonly relativePath: string,\n readonly size: number,\n private readonly doDownload: (relativePath: string) => Promise<void>,\n ) {}\n\n /**\n * Downloads the file (unless dryRun) and returns a 'download-done' event.\n * @param dryRun - Whether to simulate the action without making changes.\n *\n * @returns An async generator yielding sync progress events.\n */\n async execute(dryRun: boolean): Promise<SyncEvent> {\n if (!dryRun) {\n await this.doDownload(this.relativePath)\n }\n return { type: 'download-done', path: this.relativePath, size: this.size }\n }\n}\n\n/** Server-side copies a B2 file to a new key within the same or different bucket. */\nexport class CopyAction implements SyncAction {\n readonly type = 'copy' as const\n\n /**\n * Creates a new CopyAction for the given relative path.\n * @param relativePath - Path relative to the sync root.\n * @param size - File size in bytes.\n * @param doCopy - Callback that performs the server-side copy.\n */\n constructor(\n readonly relativePath: string,\n readonly size: number,\n private readonly doCopy: (relativePath: string) => Promise<void>,\n ) {}\n\n /**\n * Copies the file (unless dryRun) and returns a 'copy-done' event.\n * @param dryRun - Whether to simulate the action without making changes.\n *\n * @returns An async generator yielding sync progress events.\n */\n async execute(dryRun: boolean): Promise<SyncEvent> {\n if (!dryRun) {\n await this.doCopy(this.relativePath)\n }\n return { type: 'copy-done', path: this.relativePath, size: this.size }\n }\n}\n\n/** Hides a file in B2 by creating a hide marker (soft delete). */\nexport class HideAction implements SyncAction {\n readonly type = 'hide' as const\n readonly size = 0\n\n /**\n * Creates a new HideAction for the given relative path.\n * @param relativePath - Path relative to the sync root.\n * @param doHide - Callback that creates the hide marker.\n */\n constructor(\n readonly relativePath: string,\n private readonly doHide: (relativePath: string) => Promise<void>,\n ) {}\n\n /**\n * Hides the file (unless dryRun) and returns a 'hide' event.\n * @param dryRun - Whether to simulate the action without making changes.\n *\n * @returns An async generator yielding sync progress events.\n */\n async execute(dryRun: boolean): Promise<SyncEvent> {\n if (!dryRun) {\n await this.doHide(this.relativePath)\n }\n return { type: 'hide', path: this.relativePath, size: 0 }\n }\n}\n\n/** Permanently deletes a specific file version from B2. */\nexport class DeleteRemoteAction implements SyncAction {\n readonly type = 'delete-remote' as const\n readonly size = 0\n\n /**\n * Creates a new DeleteRemoteAction for the given relative path.\n * @param relativePath - Path relative to the sync root.\n * @param fileId - The B2 file version ID to delete.\n * @param doDelete - Callback that performs the deletion.\n */\n constructor(\n readonly relativePath: string,\n readonly fileId: string,\n private readonly doDelete: (fileId: string, fileName: string) => Promise<void>,\n ) {}\n\n /**\n * Deletes the remote file version (unless dryRun) and returns a 'delete-remote' event.\n * @param dryRun - Whether to simulate the action without making changes.\n *\n * @returns An async generator yielding sync progress events.\n */\n async execute(dryRun: boolean): Promise<SyncEvent> {\n if (!dryRun) {\n await this.doDelete(this.fileId, this.relativePath)\n }\n return { type: 'delete-remote', path: this.relativePath, size: 0 }\n }\n}\n\n/** Deletes a file from the local filesystem. */\nexport class DeleteLocalAction implements SyncAction {\n readonly type = 'delete-local' as const\n readonly size = 0\n\n /**\n * Creates a new DeleteLocalAction for the given relative path.\n * @param relativePath - Path relative to the sync root.\n * @param absolutePath - Absolute local filesystem path.\n * @param doDelete - Callback that performs the deletion.\n */\n constructor(\n readonly relativePath: string,\n readonly absolutePath: string,\n private readonly doDelete: (absolutePath: string) => Promise<void>,\n ) {}\n\n /**\n * Deletes the local file (unless dryRun) and returns a 'delete-local' event.\n * @param dryRun - Whether to simulate the action without making changes.\n *\n * @returns An async generator yielding sync progress events.\n */\n async execute(dryRun: boolean): Promise<SyncEvent> {\n if (!dryRun) {\n await this.doDelete(this.absolutePath)\n }\n return { type: 'delete-local', path: this.relativePath, size: 0 }\n }\n}\n\n/** Represents a no-op action for files that do not need syncing. */\nexport class SkipAction implements SyncAction {\n readonly type = 'skip' as const\n readonly size = 0\n\n /**\n * Creates a new SkipAction for the given relative path.\n * @param relativePath - Path relative to the sync root.\n * @param reason - Human-readable explanation for why the file was skipped.\n */\n constructor(\n readonly relativePath: string,\n readonly reason: string,\n ) {}\n\n /**\n * Returns a 'skip' event with the reason message. No I/O is performed.\n * @param _dryRun - Whether to simulate the action (unused for no-op).\n *\n * @returns An async generator yielding sync progress events.\n */\n async execute(_dryRun: boolean): Promise<SyncEvent> {\n return { type: 'skip', path: this.relativePath, size: 0, message: this.reason }\n }\n}\n"],"names":[],"mappings":"AA4BO,MAAM,aAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAU9C,YACW,cACA,cACA,MACQ,UACjB;AAJS,SAAA,eAAA;AACA,SAAA,eAAA;AACA,SAAA,OAAA;AACQ,SAAA,WAAA;AAAA,EAChB;AAAA,EAdM,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsBhB,MAAM,QAAQ,QAAqC;AACjD,QAAI,CAAC,QAAQ;AACX,YAAM,KAAK,SAAS,KAAK,cAAc,KAAK,YAAY;AAAA,IAC1D;AACA,WAAO,EAAE,MAAM,eAAe,MAAM,KAAK,cAAc,MAAM,KAAK,KAAA;AAAA,EACpE;AACF;AAGO,MAA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,EAUpD,YACW,cACA,QACQ,UACjB;AAHS,SAAA,eAAA;AACA,SAAA,SAAA;AACQ,SAAA,WAAA;AAAA,EAChB;AAAA,EAbM,OAAO;AAAA,EACP,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBhB,MAAM,QAAQ,QAAqC;AACjD,QAAI,CAAC,QAAQ;AACX,YAAM,KAAK,SAAS,KAAK,QAAQ,KAAK,YAAY;AAAA,IACpD;AACA,WAAO,EAAE,MAAM,iBAAiB,MAAM,KAAK,cAAc,MAAM,EAAA;AAAA,EACjE;AACF;AAGO,MAAM,kBAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUnD,YACW,cACA,cACQ,UACjB;AAHS,SAAA,eAAA;AACA,SAAA,eAAA;AACQ,SAAA,WAAA;AAAA,EAChB;AAAA,EAbM,OAAO;AAAA,EACP,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBhB,MAAM,QAAQ,QAAqC;AACjD,QAAI,CAAC,QAAQ;AACX,YAAM,KAAK,SAAS,KAAK,YAAY;AAAA,IACvC;AACA,WAAO,EAAE,MAAM,gBAAgB,MAAM,KAAK,cAAc,MAAM,EAAA;AAAA,EAChE;AACF;AAGO,MAAM,WAAiC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS5C,YACW,cACA,QACT;AAFS,SAAA,eAAA;AACA,SAAA,SAAA;AAAA,EACR;AAAA,EAXM,OAAO;AAAA,EACP,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBhB,MAAM,QAAQ,SAAsC;AAClD,WAAO,EAAE,MAAM,QAAQ,MAAM,KAAK,cAAc,MAAM,GAAG,SAAS,KAAK,OAAA;AAAA,EACzE;AACF;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const local = require("./scanners/local.cjs");
|
|
4
|
+
const b2 = require("./scanners/b2.cjs");
|
|
5
|
+
const pairing = require("./pairing.cjs");
|
|
6
|
+
const index$1 = require("./policies/index.cjs");
|
|
7
|
+
const compare = require("./policies/compare.cjs");
|
|
8
|
+
const synchronizer = require("./synchronizer.cjs");
|
|
9
|
+
const index = require("./actions/index.cjs");
|
|
10
|
+
exports.LocalFolder = local.LocalFolder;
|
|
11
|
+
exports.B2Folder = b2.B2Folder;
|
|
12
|
+
exports.zipFolders = pairing.zipFolders;
|
|
13
|
+
exports.generateActions = index$1.generateActions;
|
|
14
|
+
exports.filesAreDifferent = compare.filesAreDifferent;
|
|
15
|
+
exports.synchronize = synchronizer.synchronize;
|
|
16
|
+
exports.CopyAction = index.CopyAction;
|
|
17
|
+
exports.DeleteLocalAction = index.DeleteLocalAction;
|
|
18
|
+
exports.DeleteRemoteAction = index.DeleteRemoteAction;
|
|
19
|
+
exports.DownloadAction = index.DownloadAction;
|
|
20
|
+
exports.HideAction = index.HideAction;
|
|
21
|
+
exports.SkipAction = index.SkipAction;
|
|
22
|
+
exports.UploadAction = index.UploadAction;
|
|
23
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync engine for mirroring files between local folders and B2 buckets.
|
|
3
|
+
*
|
|
4
|
+
* The pipeline is: scan folders, pair files by relative path, generate actions
|
|
5
|
+
* based on comparison and keep policies, then execute with bounded concurrency.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export { LocalFolder } from './scanners/local.js';
|
|
10
|
+
export { B2Folder } from './scanners/b2.js';
|
|
11
|
+
export { zipFolders } from './pairing.js';
|
|
12
|
+
export { generateActions } from './policies/index.js';
|
|
13
|
+
export { filesAreDifferent } from './policies/compare.js';
|
|
14
|
+
export { synchronize } from './synchronizer.js';
|
|
15
|
+
export type { SyncAction, SyncActionType, } from './actions/index.js';
|
|
16
|
+
export { UploadAction, DownloadAction, CopyAction, HideAction, DeleteRemoteAction, DeleteLocalAction, SkipAction, } from './actions/index.js';
|
|
17
|
+
export type { CompareMode, KeepMode, SyncDirection, SyncPath, LocalSyncPath, B2SyncPath, SyncEvent, SyncEventType, SyncActionEvent, SyncActionEventType, SyncSkipEvent, SyncErrorEvent, SyncOptions, SyncEncryptionProvider, SyncFolder, } from './types.js';
|
|
18
|
+
export type { ActionFactory } from './policies/index.js';
|
|
19
|
+
export type { SyncPair } from './pairing.js';
|
|
20
|
+
export type { SynchronizerConfig, SynchronizerUpConfig, SynchronizerDownConfig, LocalSyncFolder, B2SyncFolder, } from './synchronizer.js';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sync/index.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,YAAY,EACV,UAAU,EACV,cAAc,GACf,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,YAAY,EACZ,cAAc,EACd,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,GACX,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,WAAW,EACX,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,aAAa,EACb,UAAU,EACV,SAAS,EACT,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,WAAW,EACX,sBAAsB,EACtB,UAAU,GACX,MAAM,YAAY,CAAA;AACnB,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACxD,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,YAAY,EACV,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,YAAY,GACb,MAAM,mBAAmB,CAAA"}
|