@opendatalabs/personal-server-ts-core 0.0.1-canary.052d47e → 0.0.1-canary.05cdd81
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/dist/additions/budget.d.ts +34 -0
- package/dist/additions/budget.d.ts.map +1 -0
- package/dist/additions/budget.js +144 -0
- package/dist/additions/budget.js.map +1 -0
- package/dist/additions/durable.d.ts +94 -0
- package/dist/additions/durable.d.ts.map +1 -0
- package/dist/additions/durable.js +823 -0
- package/dist/additions/durable.js.map +1 -0
- package/dist/additions/first-added.d.ts +204 -0
- package/dist/additions/first-added.d.ts.map +1 -0
- package/dist/additions/first-added.js +598 -0
- package/dist/additions/first-added.js.map +1 -0
- package/dist/additions/index.d.ts +9 -0
- package/dist/additions/index.d.ts.map +1 -0
- package/dist/additions/index.js +9 -0
- package/dist/additions/index.js.map +1 -0
- package/dist/additions/ledger-store.d.ts +69 -0
- package/dist/additions/ledger-store.d.ts.map +1 -0
- package/dist/additions/ledger-store.js +407 -0
- package/dist/additions/ledger-store.js.map +1 -0
- package/dist/additions/record-rules.d.ts +54 -0
- package/dist/additions/record-rules.d.ts.map +1 -0
- package/dist/additions/record-rules.js +198 -0
- package/dist/additions/record-rules.js.map +1 -0
- package/dist/additions/scope-lock.d.ts +14 -0
- package/dist/additions/scope-lock.d.ts.map +1 -0
- package/dist/additions/scope-lock.js +32 -0
- package/dist/additions/scope-lock.js.map +1 -0
- package/dist/additions/summary.d.ts +143 -0
- package/dist/additions/summary.d.ts.map +1 -0
- package/dist/additions/summary.js +279 -0
- package/dist/additions/summary.js.map +1 -0
- package/dist/additions/version-inventory.d.ts +86 -0
- package/dist/additions/version-inventory.d.ts.map +1 -0
- package/dist/additions/version-inventory.js +244 -0
- package/dist/additions/version-inventory.js.map +1 -0
- package/dist/api/account-storage-mode.d.ts +77 -0
- package/dist/api/account-storage-mode.d.ts.map +1 -0
- package/dist/api/account-storage-mode.js +72 -0
- package/dist/api/account-storage-mode.js.map +1 -0
- package/dist/api/index.d.ts +320 -10
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1758 -181
- package/dist/api/index.js.map +1 -1
- package/dist/api/legacy-write-gate.d.ts +51 -0
- package/dist/api/legacy-write-gate.d.ts.map +1 -0
- package/dist/api/legacy-write-gate.js +88 -0
- package/dist/api/legacy-write-gate.js.map +1 -0
- package/dist/api/oura-collection-requirements.d.ts +16 -0
- package/dist/api/oura-collection-requirements.d.ts.map +1 -0
- package/dist/api/oura-collection-requirements.js +70 -0
- package/dist/api/oura-collection-requirements.js.map +1 -0
- package/dist/api/owner-connector-delete.d.ts +79 -0
- package/dist/api/owner-connector-delete.d.ts.map +1 -0
- package/dist/api/owner-connector-delete.js +109 -0
- package/dist/api/owner-connector-delete.js.map +1 -0
- package/dist/api/raw-envelope.d.ts +3 -0
- package/dist/api/raw-envelope.d.ts.map +1 -0
- package/dist/api/raw-envelope.js +215 -0
- package/dist/api/raw-envelope.js.map +1 -0
- package/dist/api/scope-upload-batches.d.ts +18 -0
- package/dist/api/scope-upload-batches.d.ts.map +1 -0
- package/dist/api/scope-upload-batches.js +71 -0
- package/dist/api/scope-upload-batches.js.map +1 -0
- package/dist/api/scope-uploads.d.ts +112 -0
- package/dist/api/scope-uploads.d.ts.map +1 -0
- package/dist/api/scope-uploads.js +369 -0
- package/dist/api/scope-uploads.js.map +1 -0
- package/dist/api/switched-delete-refusal.d.ts +16 -0
- package/dist/api/switched-delete-refusal.d.ts.map +1 -0
- package/dist/api/switched-delete-refusal.js +30 -0
- package/dist/api/switched-delete-refusal.js.map +1 -0
- package/dist/auth/index.d.ts +3 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +3 -1
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/proof-id.d.ts +8 -0
- package/dist/auth/proof-id.d.ts.map +1 -0
- package/dist/auth/proof-id.js +29 -0
- package/dist/auth/proof-id.js.map +1 -0
- package/dist/auth/request.d.ts +24 -0
- package/dist/auth/request.d.ts.map +1 -1
- package/dist/auth/request.js +99 -4
- package/dist/auth/request.js.map +1 -1
- package/dist/client.d.ts +78 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -0
- package/dist/client.js.map +1 -1
- package/dist/contracts/auth-device.d.ts +10 -0
- package/dist/contracts/auth-device.d.ts.map +1 -1
- package/dist/contracts/auth-device.js +2 -0
- package/dist/contracts/auth-device.js.map +1 -1
- package/dist/contracts/data.d.ts +102 -8
- package/dist/contracts/data.d.ts.map +1 -1
- package/dist/contracts/data.js +326 -47
- package/dist/contracts/data.js.map +1 -1
- package/dist/contracts/grants.d.ts.map +1 -1
- package/dist/contracts/grants.js +7 -0
- package/dist/contracts/grants.js.map +1 -1
- package/dist/contracts/index.d.ts +4 -2
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +3 -1
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/oura-collection-requirements.d.ts +17 -0
- package/dist/contracts/oura-collection-requirements.d.ts.map +1 -0
- package/dist/contracts/oura-collection-requirements.js +49 -0
- package/dist/contracts/oura-collection-requirements.js.map +1 -0
- package/dist/contracts/sync.d.ts +9 -1
- package/dist/contracts/sync.d.ts.map +1 -1
- package/dist/contracts/sync.js +7 -2
- package/dist/contracts/sync.js.map +1 -1
- package/dist/derivatives/answer-shape.d.ts +83 -0
- package/dist/derivatives/answer-shape.d.ts.map +1 -0
- package/dist/derivatives/answer-shape.js +320 -0
- package/dist/derivatives/answer-shape.js.map +1 -0
- package/dist/derivatives/api.d.ts +1 -1
- package/dist/derivatives/api.d.ts.map +1 -1
- package/dist/derivatives/api.js +8 -0
- package/dist/derivatives/api.js.map +1 -1
- package/dist/derivatives/compute.d.ts +9 -3
- package/dist/derivatives/compute.d.ts.map +1 -1
- package/dist/derivatives/compute.js +87 -6
- package/dist/derivatives/compute.js.map +1 -1
- package/dist/derivatives/index.d.ts +2 -1
- package/dist/derivatives/index.d.ts.map +1 -1
- package/dist/derivatives/index.js +2 -1
- package/dist/derivatives/index.js.map +1 -1
- package/dist/derivatives/prompt.d.ts +35 -0
- package/dist/derivatives/prompt.d.ts.map +1 -1
- package/dist/derivatives/prompt.js +96 -8
- package/dist/derivatives/prompt.js.map +1 -1
- package/dist/derivatives/registration.d.ts +6 -9
- package/dist/derivatives/registration.d.ts.map +1 -1
- package/dist/derivatives/registration.js +14 -6
- package/dist/derivatives/registration.js.map +1 -1
- package/dist/derivatives/scheduler.d.ts +39 -9
- package/dist/derivatives/scheduler.d.ts.map +1 -1
- package/dist/derivatives/scheduler.js +99 -8
- package/dist/derivatives/scheduler.js.map +1 -1
- package/dist/derivatives/store.d.ts.map +1 -1
- package/dist/derivatives/store.js +2 -0
- package/dist/derivatives/store.js.map +1 -1
- package/dist/derivatives/types.d.ts +13 -3
- package/dist/derivatives/types.d.ts.map +1 -1
- package/dist/derivatives/types.js +2 -0
- package/dist/derivatives/types.js.map +1 -1
- package/dist/errors/pdpp-catalog.d.ts +36 -0
- package/dist/errors/pdpp-catalog.d.ts.map +1 -0
- package/dist/errors/pdpp-catalog.js +92 -0
- package/dist/errors/pdpp-catalog.js.map +1 -0
- package/dist/grants/index.d.ts +2 -0
- package/dist/grants/index.d.ts.map +1 -1
- package/dist/grants/index.js +4 -0
- package/dist/grants/index.js.map +1 -1
- package/dist/grants/pdpp-binding-store.d.ts +89 -0
- package/dist/grants/pdpp-binding-store.d.ts.map +1 -0
- package/dist/grants/pdpp-binding-store.js +112 -0
- package/dist/grants/pdpp-binding-store.js.map +1 -0
- package/dist/grants/pdpp-binding.d.ts +169 -0
- package/dist/grants/pdpp-binding.d.ts.map +1 -0
- package/dist/grants/pdpp-binding.js +236 -0
- package/dist/grants/pdpp-binding.js.map +1 -0
- package/dist/keys/index.d.ts +1 -0
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +1 -0
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/owner-master-key.d.ts +37 -0
- package/dist/keys/owner-master-key.d.ts.map +1 -0
- package/dist/keys/owner-master-key.js +45 -0
- package/dist/keys/owner-master-key.js.map +1 -0
- package/dist/legacy-projection/bindings.d.ts +31 -0
- package/dist/legacy-projection/bindings.d.ts.map +1 -0
- package/dist/legacy-projection/bindings.js +4512 -0
- package/dist/legacy-projection/bindings.js.map +1 -0
- package/dist/legacy-projection/claude-source-record.d.ts +22 -0
- package/dist/legacy-projection/claude-source-record.d.ts.map +1 -0
- package/dist/legacy-projection/claude-source-record.js +360 -0
- package/dist/legacy-projection/claude-source-record.js.map +1 -0
- package/dist/legacy-projection/declared-text.d.ts +41 -0
- package/dist/legacy-projection/declared-text.d.ts.map +1 -0
- package/dist/legacy-projection/declared-text.js +199 -0
- package/dist/legacy-projection/declared-text.js.map +1 -0
- package/dist/legacy-projection/erase-connector.d.ts +18 -0
- package/dist/legacy-projection/erase-connector.d.ts.map +1 -0
- package/dist/legacy-projection/erase-connector.js +29 -0
- package/dist/legacy-projection/erase-connector.js.map +1 -0
- package/dist/legacy-projection/github-browser-bindings.d.ts +3 -0
- package/dist/legacy-projection/github-browser-bindings.d.ts.map +1 -0
- package/dist/legacy-projection/github-browser-bindings.js +212 -0
- package/dist/legacy-projection/github-browser-bindings.js.map +1 -0
- package/dist/legacy-projection/github-legacy-fields.d.ts +6 -0
- package/dist/legacy-projection/github-legacy-fields.d.ts.map +1 -0
- package/dist/legacy-projection/github-legacy-fields.js +202 -0
- package/dist/legacy-projection/github-legacy-fields.js.map +1 -0
- package/dist/legacy-projection/index.d.ts +48 -0
- package/dist/legacy-projection/index.d.ts.map +1 -0
- package/dist/legacy-projection/index.js +255 -0
- package/dist/legacy-projection/index.js.map +1 -0
- package/dist/legacy-projection/meta-040-bindings.d.ts +3 -0
- package/dist/legacy-projection/meta-040-bindings.d.ts.map +1 -0
- package/dist/legacy-projection/meta-040-bindings.js +112 -0
- package/dist/legacy-projection/meta-040-bindings.js.map +1 -0
- package/dist/legacy-projection/oura-browser-bindings.d.ts +5 -0
- package/dist/legacy-projection/oura-browser-bindings.d.ts.map +1 -0
- package/dist/legacy-projection/oura-browser-bindings.js +141 -0
- package/dist/legacy-projection/oura-browser-bindings.js.map +1 -0
- package/dist/legacy-projection/provenance.d.ts +57 -0
- package/dist/legacy-projection/provenance.d.ts.map +1 -0
- package/dist/legacy-projection/provenance.js +2 -0
- package/dist/legacy-projection/provenance.js.map +1 -0
- package/dist/legacy-projection/strava-browser-bindings.d.ts +3 -0
- package/dist/legacy-projection/strava-browser-bindings.d.ts.map +1 -0
- package/dist/legacy-projection/strava-browser-bindings.js +32 -0
- package/dist/legacy-projection/strava-browser-bindings.js.map +1 -0
- package/dist/legacy-projection/test-debris.d.ts +2 -0
- package/dist/legacy-projection/test-debris.d.ts.map +1 -0
- package/dist/legacy-projection/test-debris.js +49 -0
- package/dist/legacy-projection/test-debris.js.map +1 -0
- package/dist/legacy-projection/types.d.ts +235 -0
- package/dist/legacy-projection/types.d.ts.map +1 -0
- package/dist/legacy-projection/types.js +2 -0
- package/dist/legacy-projection/types.js.map +1 -0
- package/dist/lineage/gateway.d.ts +3 -1
- package/dist/lineage/gateway.d.ts.map +1 -1
- package/dist/lineage/gateway.js +2 -1
- package/dist/lineage/gateway.js.map +1 -1
- package/dist/localdb/apply.d.ts +13 -0
- package/dist/localdb/apply.d.ts.map +1 -0
- package/dist/localdb/apply.js +565 -0
- package/dist/localdb/apply.js.map +1 -0
- package/dist/localdb/batch-commit.d.ts +67 -0
- package/dist/localdb/batch-commit.d.ts.map +1 -0
- package/dist/localdb/batch-commit.js +121 -0
- package/dist/localdb/batch-commit.js.map +1 -0
- package/dist/localdb/blobs.d.ts +71 -0
- package/dist/localdb/blobs.d.ts.map +1 -0
- package/dist/localdb/blobs.js +306 -0
- package/dist/localdb/blobs.js.map +1 -0
- package/dist/localdb/bootstrap.d.ts +20 -0
- package/dist/localdb/bootstrap.d.ts.map +1 -0
- package/dist/localdb/bootstrap.js +157 -0
- package/dist/localdb/bootstrap.js.map +1 -0
- package/dist/localdb/connection-link.d.ts +12 -0
- package/dist/localdb/connection-link.d.ts.map +1 -0
- package/dist/localdb/connection-link.js +72 -0
- package/dist/localdb/connection-link.js.map +1 -0
- package/dist/localdb/cycle.d.ts +32 -0
- package/dist/localdb/cycle.d.ts.map +1 -0
- package/dist/localdb/cycle.js +46 -0
- package/dist/localdb/cycle.js.map +1 -0
- package/dist/localdb/delete-batch.d.ts +51 -0
- package/dist/localdb/delete-batch.d.ts.map +1 -0
- package/dist/localdb/delete-batch.js +132 -0
- package/dist/localdb/delete-batch.js.map +1 -0
- package/dist/localdb/delete.d.ts +81 -0
- package/dist/localdb/delete.d.ts.map +1 -0
- package/dist/localdb/delete.js +736 -0
- package/dist/localdb/delete.js.map +1 -0
- package/dist/localdb/deps.d.ts +54 -0
- package/dist/localdb/deps.d.ts.map +1 -0
- package/dist/localdb/deps.js +10 -0
- package/dist/localdb/deps.js.map +1 -0
- package/dist/localdb/driver.d.ts +67 -0
- package/dist/localdb/driver.d.ts.map +1 -0
- package/dist/localdb/driver.js +3 -0
- package/dist/localdb/driver.js.map +1 -0
- package/dist/localdb/encode.d.ts +217 -0
- package/dist/localdb/encode.d.ts.map +1 -0
- package/dist/localdb/encode.js +502 -0
- package/dist/localdb/encode.js.map +1 -0
- package/dist/localdb/fence.d.ts +31 -0
- package/dist/localdb/fence.d.ts.map +1 -0
- package/dist/localdb/fence.js +69 -0
- package/dist/localdb/fence.js.map +1 -0
- package/dist/localdb/history.d.ts +74 -0
- package/dist/localdb/history.d.ts.map +1 -0
- package/dist/localdb/history.js +266 -0
- package/dist/localdb/history.js.map +1 -0
- package/dist/localdb/import-fingerprint.d.ts +8 -0
- package/dist/localdb/import-fingerprint.d.ts.map +1 -0
- package/dist/localdb/import-fingerprint.js +35 -0
- package/dist/localdb/import-fingerprint.js.map +1 -0
- package/dist/localdb/import-ledger.d.ts +27 -0
- package/dist/localdb/import-ledger.d.ts.map +1 -0
- package/dist/localdb/import-ledger.js +197 -0
- package/dist/localdb/import-ledger.js.map +1 -0
- package/dist/localdb/import-readback.d.ts +8 -0
- package/dist/localdb/import-readback.d.ts.map +1 -0
- package/dist/localdb/import-readback.js +69 -0
- package/dist/localdb/import-readback.js.map +1 -0
- package/dist/localdb/import-snapshot.d.ts +21 -0
- package/dist/localdb/import-snapshot.d.ts.map +1 -0
- package/dist/localdb/import-snapshot.js +94 -0
- package/dist/localdb/import-snapshot.js.map +1 -0
- package/dist/localdb/index.d.ts +39 -0
- package/dist/localdb/index.d.ts.map +1 -0
- package/dist/localdb/index.js +36 -0
- package/dist/localdb/index.js.map +1 -0
- package/dist/localdb/legacy-import-types.d.ts +110 -0
- package/dist/localdb/legacy-import-types.d.ts.map +1 -0
- package/dist/localdb/legacy-import-types.js +2 -0
- package/dist/localdb/legacy-import-types.js.map +1 -0
- package/dist/localdb/legacy-import.d.ts +36 -0
- package/dist/localdb/legacy-import.d.ts.map +1 -0
- package/dist/localdb/legacy-import.js +288 -0
- package/dist/localdb/legacy-import.js.map +1 -0
- package/dist/localdb/legacy-retire.d.ts +26 -0
- package/dist/localdb/legacy-retire.d.ts.map +1 -0
- package/dist/localdb/legacy-retire.js +93 -0
- package/dist/localdb/legacy-retire.js.map +1 -0
- package/dist/localdb/lifetime-boundary.d.ts +49 -0
- package/dist/localdb/lifetime-boundary.d.ts.map +1 -0
- package/dist/localdb/lifetime-boundary.js +74 -0
- package/dist/localdb/lifetime-boundary.js.map +1 -0
- package/dist/localdb/listing.d.ts +51 -0
- package/dist/localdb/listing.d.ts.map +1 -0
- package/dist/localdb/listing.js +231 -0
- package/dist/localdb/listing.js.map +1 -0
- package/dist/localdb/merge.d.ts +95 -0
- package/dist/localdb/merge.d.ts.map +1 -0
- package/dist/localdb/merge.js +282 -0
- package/dist/localdb/merge.js.map +1 -0
- package/dist/localdb/migrate.d.ts +10 -0
- package/dist/localdb/migrate.d.ts.map +1 -0
- package/dist/localdb/migrate.js +27 -0
- package/dist/localdb/migrate.js.map +1 -0
- package/dist/localdb/name.d.ts +3 -0
- package/dist/localdb/name.d.ts.map +1 -0
- package/dist/localdb/name.js +8 -0
- package/dist/localdb/name.js.map +1 -0
- package/dist/localdb/older-versions.d.ts +49 -0
- package/dist/localdb/older-versions.d.ts.map +1 -0
- package/dist/localdb/older-versions.js +172 -0
- package/dist/localdb/older-versions.js.map +1 -0
- package/dist/localdb/open.d.ts +19 -0
- package/dist/localdb/open.d.ts.map +1 -0
- package/dist/localdb/open.js +46 -0
- package/dist/localdb/open.js.map +1 -0
- package/dist/localdb/part-layout.d.ts +74 -0
- package/dist/localdb/part-layout.d.ts.map +1 -0
- package/dist/localdb/part-layout.js +203 -0
- package/dist/localdb/part-layout.js.map +1 -0
- package/dist/localdb/publish-meter.d.ts +45 -0
- package/dist/localdb/publish-meter.d.ts.map +1 -0
- package/dist/localdb/publish-meter.js +62 -0
- package/dist/localdb/publish-meter.js.map +1 -0
- package/dist/localdb/publish.d.ts +47 -0
- package/dist/localdb/publish.d.ts.map +1 -0
- package/dist/localdb/publish.js +2100 -0
- package/dist/localdb/publish.js.map +1 -0
- package/dist/localdb/purge.d.ts +23 -0
- package/dist/localdb/purge.d.ts.map +1 -0
- package/dist/localdb/purge.js +75 -0
- package/dist/localdb/purge.js.map +1 -0
- package/dist/localdb/query.d.ts +69 -0
- package/dist/localdb/query.d.ts.map +1 -0
- package/dist/localdb/query.js +306 -0
- package/dist/localdb/query.js.map +1 -0
- package/dist/localdb/queue.d.ts +10 -0
- package/dist/localdb/queue.d.ts.map +1 -0
- package/dist/localdb/queue.js +31 -0
- package/dist/localdb/queue.js.map +1 -0
- package/dist/localdb/read-selection.d.ts +103 -0
- package/dist/localdb/read-selection.d.ts.map +1 -0
- package/dist/localdb/read-selection.js +141 -0
- package/dist/localdb/read-selection.js.map +1 -0
- package/dist/localdb/registry-view.d.ts +65 -0
- package/dist/localdb/registry-view.d.ts.map +1 -0
- package/dist/localdb/registry-view.js +73 -0
- package/dist/localdb/registry-view.js.map +1 -0
- package/dist/localdb/replace.d.ts +33 -0
- package/dist/localdb/replace.d.ts.map +1 -0
- package/dist/localdb/replace.js +22 -0
- package/dist/localdb/replace.js.map +1 -0
- package/dist/localdb/requirements.d.ts +35 -0
- package/dist/localdb/requirements.d.ts.map +1 -0
- package/dist/localdb/requirements.js +66 -0
- package/dist/localdb/requirements.js.map +1 -0
- package/dist/localdb/resolve.d.ts +43 -0
- package/dist/localdb/resolve.d.ts.map +1 -0
- package/dist/localdb/resolve.js +265 -0
- package/dist/localdb/resolve.js.map +1 -0
- package/dist/localdb/run-end.d.ts +19 -0
- package/dist/localdb/run-end.d.ts.map +1 -0
- package/dist/localdb/run-end.js +283 -0
- package/dist/localdb/run-end.js.map +1 -0
- package/dist/localdb/run-intake.d.ts +16 -0
- package/dist/localdb/run-intake.d.ts.map +1 -0
- package/dist/localdb/run-intake.js +441 -0
- package/dist/localdb/run-intake.js.map +1 -0
- package/dist/localdb/run-receipts.d.ts +19 -0
- package/dist/localdb/run-receipts.d.ts.map +1 -0
- package/dist/localdb/run-receipts.js +151 -0
- package/dist/localdb/run-receipts.js.map +1 -0
- package/dist/localdb/schema.d.ts +7 -0
- package/dist/localdb/schema.d.ts.map +1 -0
- package/dist/localdb/schema.js +312 -0
- package/dist/localdb/schema.js.map +1 -0
- package/dist/localdb/seed.d.ts +39 -0
- package/dist/localdb/seed.d.ts.map +1 -0
- package/dist/localdb/seed.js +188 -0
- package/dist/localdb/seed.js.map +1 -0
- package/dist/localdb/slot.d.ts +9 -0
- package/dist/localdb/slot.d.ts.map +1 -0
- package/dist/localdb/slot.js +15 -0
- package/dist/localdb/slot.js.map +1 -0
- package/dist/localdb/sync.d.ts +53 -0
- package/dist/localdb/sync.d.ts.map +1 -0
- package/dist/localdb/sync.js +211 -0
- package/dist/localdb/sync.js.map +1 -0
- package/dist/localdb/transfer-memory.d.ts +17 -0
- package/dist/localdb/transfer-memory.d.ts.map +1 -0
- package/dist/localdb/transfer-memory.js +17 -0
- package/dist/localdb/transfer-memory.js.map +1 -0
- package/dist/localdb/unwrite.d.ts +22 -0
- package/dist/localdb/unwrite.d.ts.map +1 -0
- package/dist/localdb/unwrite.js +46 -0
- package/dist/localdb/unwrite.js.map +1 -0
- package/dist/localdb/upload-wave.d.ts +34 -0
- package/dist/localdb/upload-wave.d.ts.map +1 -0
- package/dist/localdb/upload-wave.js +30 -0
- package/dist/localdb/upload-wave.js.map +1 -0
- package/dist/localdb/verified-heads.d.ts +13 -0
- package/dist/localdb/verified-heads.d.ts.map +1 -0
- package/dist/localdb/verified-heads.js +56 -0
- package/dist/localdb/verified-heads.js.map +1 -0
- package/dist/localdb/view-changes.d.ts +58 -0
- package/dist/localdb/view-changes.d.ts.map +1 -0
- package/dist/localdb/view-changes.js +174 -0
- package/dist/localdb/view-changes.js.map +1 -0
- package/dist/mcp/approval-url.d.ts +100 -0
- package/dist/mcp/approval-url.d.ts.map +1 -0
- package/dist/mcp/approval-url.js +171 -0
- package/dist/mcp/approval-url.js.map +1 -0
- package/dist/mcp/connection-api.d.ts +239 -3
- package/dist/mcp/connection-api.d.ts.map +1 -1
- package/dist/mcp/connection-api.js +792 -27
- package/dist/mcp/connection-api.js.map +1 -1
- package/dist/mcp/grant-registration.d.ts +15 -0
- package/dist/mcp/grant-registration.d.ts.map +1 -0
- package/dist/mcp/grant-registration.js +44 -0
- package/dist/mcp/grant-registration.js.map +1 -0
- package/dist/mcp/grantee.d.ts +1 -1
- package/dist/mcp/grantee.d.ts.map +1 -1
- package/dist/mcp/index.d.ts +5 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +5 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/oauth-redirect.d.ts +14 -0
- package/dist/mcp/oauth-redirect.d.ts.map +1 -0
- package/dist/mcp/oauth-redirect.js +51 -0
- package/dist/mcp/oauth-redirect.js.map +1 -0
- package/dist/mcp/read-client.d.ts +27 -3
- package/dist/mcp/read-client.d.ts.map +1 -1
- package/dist/mcp/read-client.js +325 -19
- package/dist/mcp/read-client.js.map +1 -1
- package/dist/mcp/resources.d.ts +3 -1
- package/dist/mcp/resources.d.ts.map +1 -1
- package/dist/mcp/resources.js +14 -2
- package/dist/mcp/resources.js.map +1 -1
- package/dist/mcp/server.d.ts +47 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +219 -17
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/session.d.ts +3 -1
- package/dist/mcp/session.d.ts.map +1 -1
- package/dist/mcp/session.js +58 -11
- package/dist/mcp/session.js.map +1 -1
- package/dist/mcp/store.d.ts +23 -1
- package/dist/mcp/store.d.ts.map +1 -1
- package/dist/mcp/store.js +102 -1
- package/dist/mcp/store.js.map +1 -1
- package/dist/mcp/token-expiry.d.ts +48 -0
- package/dist/mcp/token-expiry.d.ts.map +1 -0
- package/dist/mcp/token-expiry.js +69 -0
- package/dist/mcp/token-expiry.js.map +1 -0
- package/dist/mcp/tools.d.ts +154 -3
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +660 -39
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/types.d.ts +105 -4
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/mcp/types.js +13 -1
- package/dist/mcp/types.js.map +1 -1
- package/dist/mcp/write-client.d.ts +81 -0
- package/dist/mcp/write-client.d.ts.map +1 -0
- package/dist/mcp/write-client.js +140 -0
- package/dist/mcp/write-client.js.map +1 -0
- package/dist/oura/history-policy.d.ts +12 -0
- package/dist/oura/history-policy.d.ts.map +1 -0
- package/dist/oura/history-policy.js +54 -0
- package/dist/oura/history-policy.js.map +1 -0
- package/dist/oura/index.d.ts +51 -0
- package/dist/oura/index.d.ts.map +1 -0
- package/dist/oura/index.js +330 -0
- package/dist/oura/index.js.map +1 -0
- package/dist/payment/own-app.d.ts +8 -0
- package/dist/payment/own-app.d.ts.map +1 -0
- package/dist/payment/own-app.js +47 -0
- package/dist/payment/own-app.js.map +1 -0
- package/dist/pdpp/approval.d.ts +271 -0
- package/dist/pdpp/approval.d.ts.map +1 -0
- package/dist/pdpp/approval.js +486 -0
- package/dist/pdpp/approval.js.map +1 -0
- package/dist/pdpp/client-identity.d.ts +88 -0
- package/dist/pdpp/client-identity.d.ts.map +1 -0
- package/dist/pdpp/client-identity.js +196 -0
- package/dist/pdpp/client-identity.js.map +1 -0
- package/dist/pdpp/client-metadata.d.ts +95 -0
- package/dist/pdpp/client-metadata.d.ts.map +1 -0
- package/dist/pdpp/client-metadata.js +96 -0
- package/dist/pdpp/client-metadata.js.map +1 -0
- package/dist/pdpp/commitments.d.ts +75 -0
- package/dist/pdpp/commitments.d.ts.map +1 -0
- package/dist/pdpp/commitments.js +113 -0
- package/dist/pdpp/commitments.js.map +1 -0
- package/dist/pdpp/declaration-limits.d.ts +7 -0
- package/dist/pdpp/declaration-limits.d.ts.map +1 -0
- package/dist/pdpp/declaration-limits.js +7 -0
- package/dist/pdpp/declaration-limits.js.map +1 -0
- package/dist/pdpp/declaration.d.ts +119 -0
- package/dist/pdpp/declaration.d.ts.map +1 -0
- package/dist/pdpp/declaration.js +837 -0
- package/dist/pdpp/declaration.js.map +1 -0
- package/dist/pdpp/index.d.ts +38 -0
- package/dist/pdpp/index.d.ts.map +1 -0
- package/dist/pdpp/index.js +24 -0
- package/dist/pdpp/index.js.map +1 -0
- package/dist/pdpp/issuance.d.ts +126 -0
- package/dist/pdpp/issuance.d.ts.map +1 -0
- package/dist/pdpp/issuance.js +184 -0
- package/dist/pdpp/issuance.js.map +1 -0
- package/dist/pdpp/pkce.d.ts +53 -0
- package/dist/pdpp/pkce.d.ts.map +1 -0
- package/dist/pdpp/pkce.js +109 -0
- package/dist/pdpp/pkce.js.map +1 -0
- package/dist/pdpp/redirect.d.ts +60 -0
- package/dist/pdpp/redirect.d.ts.map +1 -0
- package/dist/pdpp/redirect.js +125 -0
- package/dist/pdpp/redirect.js.map +1 -0
- package/dist/pdpp/resolve.d.ts +120 -0
- package/dist/pdpp/resolve.d.ts.map +1 -0
- package/dist/pdpp/resolve.js +491 -0
- package/dist/pdpp/resolve.js.map +1 -0
- package/dist/pdpp/review.d.ts +280 -0
- package/dist/pdpp/review.d.ts.map +1 -0
- package/dist/pdpp/review.js +205 -0
- package/dist/pdpp/review.js.map +1 -0
- package/dist/pdpp/selection.d.ts +79 -0
- package/dist/pdpp/selection.d.ts.map +1 -0
- package/dist/pdpp/selection.js +493 -0
- package/dist/pdpp/selection.js.map +1 -0
- package/dist/pdpp/store.d.ts +228 -0
- package/dist/pdpp/store.d.ts.map +1 -0
- package/dist/pdpp/store.js +542 -0
- package/dist/pdpp/store.js.map +1 -0
- package/dist/pdpp/time.d.ts +39 -0
- package/dist/pdpp/time.d.ts.map +1 -0
- package/dist/pdpp/time.js +173 -0
- package/dist/pdpp/time.js.map +1 -0
- package/dist/pdpp/tokens.d.ts +181 -0
- package/dist/pdpp/tokens.d.ts.map +1 -0
- package/dist/pdpp/tokens.js +421 -0
- package/dist/pdpp/tokens.js.map +1 -0
- package/dist/pdpp/types.d.ts +457 -0
- package/dist/pdpp/types.d.ts.map +1 -0
- package/dist/pdpp/types.js +68 -0
- package/dist/pdpp/types.js.map +1 -0
- package/dist/pdpp-version.d.ts +28 -0
- package/dist/pdpp-version.d.ts.map +1 -0
- package/dist/pdpp-version.js +28 -0
- package/dist/pdpp-version.js.map +1 -0
- package/dist/policy/data-read.d.ts +52 -1
- package/dist/policy/data-read.d.ts.map +1 -1
- package/dist/policy/data-read.js +157 -3
- package/dist/policy/data-read.js.map +1 -1
- package/dist/policy/data-write.d.ts.map +1 -1
- package/dist/policy/data-write.js +18 -1
- package/dist/policy/data-write.js.map +1 -1
- package/dist/policy/index.d.ts +2 -1
- package/dist/policy/index.d.ts.map +1 -1
- package/dist/policy/index.js +2 -1
- package/dist/policy/index.js.map +1 -1
- package/dist/policy/reserved-scopes.d.ts +10 -0
- package/dist/policy/reserved-scopes.d.ts.map +1 -0
- package/dist/policy/reserved-scopes.js +19 -0
- package/dist/policy/reserved-scopes.js.map +1 -0
- package/dist/ports/index.d.ts +323 -10
- package/dist/ports/index.d.ts.map +1 -1
- package/dist/ports/index.js.map +1 -1
- package/dist/ports/pdpp-auth.d.ts +119 -0
- package/dist/ports/pdpp-auth.d.ts.map +1 -0
- package/dist/ports/pdpp-auth.js +46 -0
- package/dist/ports/pdpp-auth.js.map +1 -0
- package/dist/ports/pdpp-auth.test-utils.d.ts +9 -0
- package/dist/ports/pdpp-auth.test-utils.d.ts.map +1 -0
- package/dist/ports/pdpp-auth.test-utils.js +18 -0
- package/dist/ports/pdpp-auth.test-utils.js.map +1 -0
- package/dist/publication/publish.d.ts +137 -0
- package/dist/publication/publish.d.ts.map +1 -0
- package/dist/publication/publish.js +278 -0
- package/dist/publication/publish.js.map +1 -0
- package/dist/replication/completion.d.ts +20 -0
- package/dist/replication/completion.d.ts.map +1 -0
- package/dist/replication/completion.js +73 -0
- package/dist/replication/completion.js.map +1 -0
- package/dist/replication/coordinator-state.d.ts +29 -0
- package/dist/replication/coordinator-state.d.ts.map +1 -0
- package/dist/replication/coordinator-state.js +88 -0
- package/dist/replication/coordinator-state.js.map +1 -0
- package/dist/replication/coordinator-state.test-utils.d.ts +32 -0
- package/dist/replication/coordinator-state.test-utils.d.ts.map +1 -0
- package/dist/replication/coordinator-state.test-utils.js +113 -0
- package/dist/replication/coordinator-state.test-utils.js.map +1 -0
- package/dist/replication/coordinator.d.ts +264 -0
- package/dist/replication/coordinator.d.ts.map +1 -0
- package/dist/replication/coordinator.js +499 -0
- package/dist/replication/coordinator.js.map +1 -0
- package/dist/replication/copies.d.ts +126 -0
- package/dist/replication/copies.d.ts.map +1 -0
- package/dist/replication/copies.js +437 -0
- package/dist/replication/copies.js.map +1 -0
- package/dist/replication/copy-promotion.d.ts +132 -0
- package/dist/replication/copy-promotion.d.ts.map +1 -0
- package/dist/replication/copy-promotion.js +126 -0
- package/dist/replication/copy-promotion.js.map +1 -0
- package/dist/replication/door.d.ts +33 -0
- package/dist/replication/door.d.ts.map +1 -0
- package/dist/replication/door.js +10 -0
- package/dist/replication/door.js.map +1 -0
- package/dist/replication/dpv2.d.ts +141 -0
- package/dist/replication/dpv2.d.ts.map +1 -0
- package/dist/replication/dpv2.js +320 -0
- package/dist/replication/dpv2.js.map +1 -0
- package/dist/replication/effects.d.ts +68 -0
- package/dist/replication/effects.d.ts.map +1 -0
- package/dist/replication/effects.js +89 -0
- package/dist/replication/effects.js.map +1 -0
- package/dist/replication/engine.d.ts +378 -0
- package/dist/replication/engine.d.ts.map +1 -0
- package/dist/replication/engine.js +3197 -0
- package/dist/replication/engine.js.map +1 -0
- package/dist/replication/envelope.d.ts +481 -0
- package/dist/replication/envelope.d.ts.map +1 -0
- package/dist/replication/envelope.js +192 -0
- package/dist/replication/envelope.js.map +1 -0
- package/dist/replication/evidence.d.ts +118 -0
- package/dist/replication/evidence.d.ts.map +1 -0
- package/dist/replication/evidence.js +198 -0
- package/dist/replication/evidence.js.map +1 -0
- package/dist/replication/finality.d.ts +16 -0
- package/dist/replication/finality.d.ts.map +1 -0
- package/dist/replication/finality.js +11 -0
- package/dist/replication/finality.js.map +1 -0
- package/dist/replication/fixtures.d.ts +16 -0
- package/dist/replication/fixtures.d.ts.map +1 -0
- package/dist/replication/fixtures.js +47 -0
- package/dist/replication/fixtures.js.map +1 -0
- package/dist/replication/host-config.d.ts +52 -0
- package/dist/replication/host-config.d.ts.map +1 -0
- package/dist/replication/host-config.js +111 -0
- package/dist/replication/host-config.js.map +1 -0
- package/dist/replication/host-driver.d.ts +95 -0
- package/dist/replication/host-driver.d.ts.map +1 -0
- package/dist/replication/host-driver.js +202 -0
- package/dist/replication/host-driver.js.map +1 -0
- package/dist/replication/host-ports.d.ts +48 -0
- package/dist/replication/host-ports.d.ts.map +1 -0
- package/dist/replication/host-ports.js +69 -0
- package/dist/replication/host-ports.js.map +1 -0
- package/dist/replication/identity.d.ts +13 -0
- package/dist/replication/identity.d.ts.map +1 -0
- package/dist/replication/identity.js +22 -0
- package/dist/replication/identity.js.map +1 -0
- package/dist/replication/limits.d.ts +124 -0
- package/dist/replication/limits.d.ts.map +1 -0
- package/dist/replication/limits.js +182 -0
- package/dist/replication/limits.js.map +1 -0
- package/dist/replication/merge-plan.d.ts +92 -0
- package/dist/replication/merge-plan.d.ts.map +1 -0
- package/dist/replication/merge-plan.js +229 -0
- package/dist/replication/merge-plan.js.map +1 -0
- package/dist/replication/namespace.d.ts +4 -0
- package/dist/replication/namespace.d.ts.map +1 -0
- package/dist/replication/namespace.js +7 -0
- package/dist/replication/namespace.js.map +1 -0
- package/dist/replication/outcome.d.ts +178 -0
- package/dist/replication/outcome.d.ts.map +1 -0
- package/dist/replication/outcome.js +83 -0
- package/dist/replication/outcome.js.map +1 -0
- package/dist/replication/payload.d.ts +39 -0
- package/dist/replication/payload.d.ts.map +1 -0
- package/dist/replication/payload.js +137 -0
- package/dist/replication/payload.js.map +1 -0
- package/dist/replication/preparation.d.ts +42 -0
- package/dist/replication/preparation.d.ts.map +1 -0
- package/dist/replication/preparation.js +118 -0
- package/dist/replication/preparation.js.map +1 -0
- package/dist/replication/rebaseline.d.ts +33 -0
- package/dist/replication/rebaseline.d.ts.map +1 -0
- package/dist/replication/rebaseline.js +40 -0
- package/dist/replication/rebaseline.js.map +1 -0
- package/dist/replication/rebinding.d.ts +43 -0
- package/dist/replication/rebinding.d.ts.map +1 -0
- package/dist/replication/rebinding.js +52 -0
- package/dist/replication/rebinding.js.map +1 -0
- package/dist/replication/receive.d.ts +57 -0
- package/dist/replication/receive.d.ts.map +1 -0
- package/dist/replication/receive.js +114 -0
- package/dist/replication/receive.js.map +1 -0
- package/dist/replication/record-reducer.d.ts +16 -0
- package/dist/replication/record-reducer.d.ts.map +1 -0
- package/dist/replication/record-reducer.js +52 -0
- package/dist/replication/record-reducer.js.map +1 -0
- package/dist/replication/revision.d.ts +24 -0
- package/dist/replication/revision.d.ts.map +1 -0
- package/dist/replication/revision.js +35 -0
- package/dist/replication/revision.js.map +1 -0
- package/dist/replication/roster.d.ts +53 -0
- package/dist/replication/roster.d.ts.map +1 -0
- package/dist/replication/roster.js +115 -0
- package/dist/replication/roster.js.map +1 -0
- package/dist/replication/schedule.d.ts +73 -0
- package/dist/replication/schedule.d.ts.map +1 -0
- package/dist/replication/schedule.js +182 -0
- package/dist/replication/schedule.js.map +1 -0
- package/dist/replication/stream.d.ts +73 -0
- package/dist/replication/stream.d.ts.map +1 -0
- package/dist/replication/stream.js +542 -0
- package/dist/replication/stream.js.map +1 -0
- package/dist/replication/transport.d.ts +236 -0
- package/dist/replication/transport.d.ts.map +1 -0
- package/dist/replication/transport.js +440 -0
- package/dist/replication/transport.js.map +1 -0
- package/dist/replication/visibility-engine.d.ts +337 -0
- package/dist/replication/visibility-engine.d.ts.map +1 -0
- package/dist/replication/visibility-engine.js +602 -0
- package/dist/replication/visibility-engine.js.map +1 -0
- package/dist/replication/visibility-policy.d.ts +26 -0
- package/dist/replication/visibility-policy.d.ts.map +1 -0
- package/dist/replication/visibility-policy.js +33 -0
- package/dist/replication/visibility-policy.js.map +1 -0
- package/dist/replication/writer-identity-store.d.ts +100 -0
- package/dist/replication/writer-identity-store.d.ts.map +1 -0
- package/dist/replication/writer-identity-store.js +218 -0
- package/dist/replication/writer-identity-store.js.map +1 -0
- package/dist/replication/writer-identity.d.ts +252 -0
- package/dist/replication/writer-identity.d.ts.map +1 -0
- package/dist/replication/writer-identity.js +281 -0
- package/dist/replication/writer-identity.js.map +1 -0
- package/dist/replication/writer-identity.test-utils.d.ts +24 -0
- package/dist/replication/writer-identity.test-utils.d.ts.map +1 -0
- package/dist/replication/writer-identity.test-utils.js +86 -0
- package/dist/replication/writer-identity.test-utils.js.map +1 -0
- package/dist/schemas/server-config.d.ts +81 -0
- package/dist/schemas/server-config.d.ts.map +1 -1
- package/dist/schemas/server-config.js +179 -0
- package/dist/schemas/server-config.js.map +1 -1
- package/dist/signing/request-signer.d.ts +2 -0
- package/dist/signing/request-signer.d.ts.map +1 -1
- package/dist/signing/request-signer.js +1 -0
- package/dist/signing/request-signer.js.map +1 -1
- package/dist/storage/adapters/index.d.ts +3 -1
- package/dist/storage/adapters/index.d.ts.map +1 -1
- package/dist/storage/adapters/index.js +2 -0
- package/dist/storage/adapters/index.js.map +1 -1
- package/dist/storage/adapters/interface.d.ts +33 -3
- package/dist/storage/adapters/interface.d.ts.map +1 -1
- package/dist/storage/adapters/interface.js +13 -1
- package/dist/storage/adapters/interface.js.map +1 -1
- package/dist/storage/adapters/rate-limit-policy.d.ts +66 -0
- package/dist/storage/adapters/rate-limit-policy.d.ts.map +1 -0
- package/dist/storage/adapters/rate-limit-policy.js +103 -0
- package/dist/storage/adapters/rate-limit-policy.js.map +1 -0
- package/dist/storage/adapters/sdk.d.ts +9 -1
- package/dist/storage/adapters/sdk.d.ts.map +1 -1
- package/dist/storage/adapters/sdk.js +32 -8
- package/dist/storage/adapters/sdk.js.map +1 -1
- package/dist/storage/adapters/throttle.d.ts +30 -0
- package/dist/storage/adapters/throttle.d.ts.map +1 -0
- package/dist/storage/adapters/throttle.js +94 -0
- package/dist/storage/adapters/throttle.js.map +1 -0
- package/dist/storage/adapters/vana-audience.d.ts +27 -0
- package/dist/storage/adapters/vana-audience.d.ts.map +1 -0
- package/dist/storage/adapters/vana-audience.js +99 -0
- package/dist/storage/adapters/vana-audience.js.map +1 -0
- package/dist/storage/adapters/vana.d.ts +5 -3
- package/dist/storage/adapters/vana.d.ts.map +1 -1
- package/dist/storage/adapters/vana.js +128 -18
- package/dist/storage/adapters/vana.js.map +1 -1
- package/dist/storage/blocks/cursor.d.ts +5 -1
- package/dist/storage/blocks/cursor.d.ts.map +1 -1
- package/dist/storage/blocks/cursor.js +13 -1
- package/dist/storage/blocks/cursor.js.map +1 -1
- package/dist/storage/blocks/page.d.ts +18 -0
- package/dist/storage/blocks/page.d.ts.map +1 -0
- package/dist/storage/blocks/page.js +113 -0
- package/dist/storage/blocks/page.js.map +1 -0
- package/dist/storage/canonical-legacy-projection.d.ts +262 -0
- package/dist/storage/canonical-legacy-projection.d.ts.map +1 -0
- package/dist/storage/canonical-legacy-projection.js +759 -0
- package/dist/storage/canonical-legacy-projection.js.map +1 -0
- package/dist/storage/hierarchy/paths.d.ts.map +1 -1
- package/dist/storage/hierarchy/paths.js +9 -2
- package/dist/storage/hierarchy/paths.js.map +1 -1
- package/dist/storage/index/manager.d.ts +46 -5
- package/dist/storage/index/manager.d.ts.map +1 -1
- package/dist/storage/index/schema.d.ts +1 -1
- package/dist/storage/index/schema.js +1 -1
- package/dist/storage/index/types.d.ts +7 -1
- package/dist/storage/index/types.d.ts.map +1 -1
- package/dist/storage/legacy-projection.d.ts +88 -0
- package/dist/storage/legacy-projection.d.ts.map +1 -0
- package/dist/storage/legacy-projection.js +755 -0
- package/dist/storage/legacy-projection.js.map +1 -0
- package/dist/storage/legacy-scope-coverage-exceptions.d.ts +13 -0
- package/dist/storage/legacy-scope-coverage-exceptions.d.ts.map +1 -0
- package/dist/storage/legacy-scope-coverage-exceptions.js +14 -0
- package/dist/storage/legacy-scope-coverage-exceptions.js.map +1 -0
- package/dist/storage/legacy-scope-coverage.d.ts +53 -0
- package/dist/storage/legacy-scope-coverage.d.ts.map +1 -0
- package/dist/storage/legacy-scope-coverage.js +416 -0
- package/dist/storage/legacy-scope-coverage.js.map +1 -0
- package/dist/storage/legacy-scope-entity-keys.d.ts +17 -0
- package/dist/storage/legacy-scope-entity-keys.d.ts.map +1 -0
- package/dist/storage/legacy-scope-entity-keys.js +109 -0
- package/dist/storage/legacy-scope-entity-keys.js.map +1 -0
- package/dist/storage/legacy-scope-view.d.ts +201 -0
- package/dist/storage/legacy-scope-view.d.ts.map +1 -0
- package/dist/storage/legacy-scope-view.js +1044 -0
- package/dist/storage/legacy-scope-view.js.map +1 -0
- package/dist/storage/legacy-write-seal.d.ts +73 -0
- package/dist/storage/legacy-write-seal.d.ts.map +1 -0
- package/dist/storage/legacy-write-seal.js +71 -0
- package/dist/storage/legacy-write-seal.js.map +1 -0
- package/dist/storage/pdpp-records/completion.d.ts +91 -0
- package/dist/storage/pdpp-records/completion.d.ts.map +1 -0
- package/dist/storage/pdpp-records/completion.js +170 -0
- package/dist/storage/pdpp-records/completion.js.map +1 -0
- package/dist/storage/pdpp-records/cursor.d.ts +86 -0
- package/dist/storage/pdpp-records/cursor.d.ts.map +1 -0
- package/dist/storage/pdpp-records/cursor.js +56 -0
- package/dist/storage/pdpp-records/cursor.js.map +1 -0
- package/dist/storage/pdpp-records/declaration-witness.d.ts +58 -0
- package/dist/storage/pdpp-records/declaration-witness.d.ts.map +1 -0
- package/dist/storage/pdpp-records/declaration-witness.js +230 -0
- package/dist/storage/pdpp-records/declaration-witness.js.map +1 -0
- package/dist/storage/pdpp-records/enforcement.d.ts +39 -0
- package/dist/storage/pdpp-records/enforcement.d.ts.map +1 -0
- package/dist/storage/pdpp-records/enforcement.js +143 -0
- package/dist/storage/pdpp-records/enforcement.js.map +1 -0
- package/dist/storage/pdpp-records/index.d.ts +7 -0
- package/dist/storage/pdpp-records/index.d.ts.map +1 -0
- package/dist/storage/pdpp-records/index.js +6 -0
- package/dist/storage/pdpp-records/index.js.map +1 -0
- package/dist/storage/pdpp-records/ingest-plan.d.ts +39 -0
- package/dist/storage/pdpp-records/ingest-plan.d.ts.map +1 -0
- package/dist/storage/pdpp-records/ingest-plan.js +103 -0
- package/dist/storage/pdpp-records/ingest-plan.js.map +1 -0
- package/dist/storage/pdpp-records/interface.d.ts +111 -0
- package/dist/storage/pdpp-records/interface.d.ts.map +1 -0
- package/dist/storage/pdpp-records/interface.js +2 -0
- package/dist/storage/pdpp-records/interface.js.map +1 -0
- package/dist/storage/pdpp-records/list-page.d.ts +35 -0
- package/dist/storage/pdpp-records/list-page.d.ts.map +1 -0
- package/dist/storage/pdpp-records/list-page.js +106 -0
- package/dist/storage/pdpp-records/list-page.js.map +1 -0
- package/dist/storage/pdpp-records/memory-store.d.ts +9 -0
- package/dist/storage/pdpp-records/memory-store.d.ts.map +1 -0
- package/dist/storage/pdpp-records/memory-store.js +462 -0
- package/dist/storage/pdpp-records/memory-store.js.map +1 -0
- package/dist/storage/pdpp-records/portable.d.ts +12 -0
- package/dist/storage/pdpp-records/portable.d.ts.map +1 -0
- package/dist/storage/pdpp-records/portable.js +11 -0
- package/dist/storage/pdpp-records/portable.js.map +1 -0
- package/dist/storage/pdpp-records/read-port.d.ts +44 -0
- package/dist/storage/pdpp-records/read-port.d.ts.map +1 -0
- package/dist/storage/pdpp-records/read-port.js +22 -0
- package/dist/storage/pdpp-records/read-port.js.map +1 -0
- package/dist/storage/pdpp-records/record-key.d.ts +52 -0
- package/dist/storage/pdpp-records/record-key.d.ts.map +1 -0
- package/dist/storage/pdpp-records/record-key.js +97 -0
- package/dist/storage/pdpp-records/record-key.js.map +1 -0
- package/dist/storage/pdpp-records/replication-journal.d.ts +20 -0
- package/dist/storage/pdpp-records/replication-journal.d.ts.map +1 -0
- package/dist/storage/pdpp-records/replication-journal.js +2 -0
- package/dist/storage/pdpp-records/replication-journal.js.map +1 -0
- package/dist/storage/pdpp-records/schema.d.ts +41 -0
- package/dist/storage/pdpp-records/schema.d.ts.map +1 -0
- package/dist/storage/pdpp-records/schema.js +153 -0
- package/dist/storage/pdpp-records/schema.js.map +1 -0
- package/dist/storage/pdpp-records/stream-declaration.d.ts +86 -0
- package/dist/storage/pdpp-records/stream-declaration.d.ts.map +1 -0
- package/dist/storage/pdpp-records/stream-declaration.js +48 -0
- package/dist/storage/pdpp-records/stream-declaration.js.map +1 -0
- package/dist/storage/pdpp-records/sync-selection.d.ts +4 -0
- package/dist/storage/pdpp-records/sync-selection.d.ts.map +1 -0
- package/dist/storage/pdpp-records/sync-selection.js +37 -0
- package/dist/storage/pdpp-records/sync-selection.js.map +1 -0
- package/dist/storage/pdpp-records/types.d.ts +204 -0
- package/dist/storage/pdpp-records/types.d.ts.map +1 -0
- package/dist/storage/pdpp-records/types.js +38 -0
- package/dist/storage/pdpp-records/types.js.map +1 -0
- package/dist/stream-sync/artifacts.d.ts +38 -0
- package/dist/stream-sync/artifacts.d.ts.map +1 -0
- package/dist/stream-sync/artifacts.js +141 -0
- package/dist/stream-sync/artifacts.js.map +1 -0
- package/dist/stream-sync/blobs.d.ts +18 -0
- package/dist/stream-sync/blobs.d.ts.map +1 -0
- package/dist/stream-sync/blobs.js +83 -0
- package/dist/stream-sync/blobs.js.map +1 -0
- package/dist/stream-sync/crypto-port.d.ts +20 -0
- package/dist/stream-sync/crypto-port.d.ts.map +1 -0
- package/dist/stream-sync/crypto-port.js +19 -0
- package/dist/stream-sync/crypto-port.js.map +1 -0
- package/dist/stream-sync/crypto.d.ts +27 -0
- package/dist/stream-sync/crypto.d.ts.map +1 -0
- package/dist/stream-sync/crypto.js +67 -0
- package/dist/stream-sync/crypto.js.map +1 -0
- package/dist/stream-sync/delete-metadata.d.ts +23 -0
- package/dist/stream-sync/delete-metadata.d.ts.map +1 -0
- package/dist/stream-sync/delete-metadata.js +40 -0
- package/dist/stream-sync/delete-metadata.js.map +1 -0
- package/dist/stream-sync/index.d.ts +13 -0
- package/dist/stream-sync/index.d.ts.map +1 -0
- package/dist/stream-sync/index.js +13 -0
- package/dist/stream-sync/index.js.map +1 -0
- package/dist/stream-sync/intake.d.ts +185 -0
- package/dist/stream-sync/intake.d.ts.map +1 -0
- package/dist/stream-sync/intake.js +36 -0
- package/dist/stream-sync/intake.js.map +1 -0
- package/dist/stream-sync/memory-registry.d.ts +58 -0
- package/dist/stream-sync/memory-registry.d.ts.map +1 -0
- package/dist/stream-sync/memory-registry.js +119 -0
- package/dist/stream-sync/memory-registry.js.map +1 -0
- package/dist/stream-sync/ports.d.ts +363 -0
- package/dist/stream-sync/ports.d.ts.map +1 -0
- package/dist/stream-sync/ports.js +68 -0
- package/dist/stream-sync/ports.js.map +1 -0
- package/dist/stream-sync/publish-plan.d.ts +157 -0
- package/dist/stream-sync/publish-plan.d.ts.map +1 -0
- package/dist/stream-sync/publish-plan.js +217 -0
- package/dist/stream-sync/publish-plan.js.map +1 -0
- package/dist/stream-sync/registry.d.ts +24 -0
- package/dist/stream-sync/registry.d.ts.map +1 -0
- package/dist/stream-sync/registry.js +389 -0
- package/dist/stream-sync/registry.js.map +1 -0
- package/dist/stream-sync/scope-routing.d.ts +17 -0
- package/dist/stream-sync/scope-routing.d.ts.map +1 -0
- package/dist/stream-sync/scope-routing.js +24 -0
- package/dist/stream-sync/scope-routing.js.map +1 -0
- package/dist/stream-sync/seed-staging.d.ts +85 -0
- package/dist/stream-sync/seed-staging.d.ts.map +1 -0
- package/dist/stream-sync/seed-staging.js +325 -0
- package/dist/stream-sync/seed-staging.js.map +1 -0
- package/dist/stream-sync/send-gate.d.ts +149 -0
- package/dist/stream-sync/send-gate.d.ts.map +1 -0
- package/dist/stream-sync/send-gate.js +382 -0
- package/dist/stream-sync/send-gate.js.map +1 -0
- package/dist/stream-sync/storage-retry.d.ts +210 -0
- package/dist/stream-sync/storage-retry.d.ts.map +1 -0
- package/dist/stream-sync/storage-retry.js +314 -0
- package/dist/stream-sync/storage-retry.js.map +1 -0
- package/dist/stream-sync/stream-aead.d.ts +33 -0
- package/dist/stream-sync/stream-aead.d.ts.map +1 -0
- package/dist/stream-sync/stream-aead.js +183 -0
- package/dist/stream-sync/stream-aead.js.map +1 -0
- package/dist/stream-sync-read/index.d.ts +4 -0
- package/dist/stream-sync-read/index.d.ts.map +1 -0
- package/dist/stream-sync-read/index.js +3 -0
- package/dist/stream-sync-read/index.js.map +1 -0
- package/dist/stream-sync-read/routing.d.ts +27 -0
- package/dist/stream-sync-read/routing.d.ts.map +1 -0
- package/dist/stream-sync-read/routing.js +49 -0
- package/dist/stream-sync-read/routing.js.map +1 -0
- package/dist/stream-sync-read/service.d.ts +196 -0
- package/dist/stream-sync-read/service.d.ts.map +1 -0
- package/dist/stream-sync-read/service.js +17 -0
- package/dist/stream-sync-read/service.js.map +1 -0
- package/dist/sync/account-mode/authority.d.ts +56 -0
- package/dist/sync/account-mode/authority.d.ts.map +1 -0
- package/dist/sync/account-mode/authority.js +145 -0
- package/dist/sync/account-mode/authority.js.map +1 -0
- package/dist/sync/account-mode/evidence-wire.d.ts +23 -0
- package/dist/sync/account-mode/evidence-wire.d.ts.map +1 -0
- package/dist/sync/account-mode/evidence-wire.js +37 -0
- package/dist/sync/account-mode/evidence-wire.js.map +1 -0
- package/dist/sync/account-mode/import-waker.d.ts +36 -0
- package/dist/sync/account-mode/import-waker.d.ts.map +1 -0
- package/dist/sync/account-mode/import-waker.js +55 -0
- package/dist/sync/account-mode/import-waker.js.map +1 -0
- package/dist/sync/account-mode/index.d.ts +10 -0
- package/dist/sync/account-mode/index.d.ts.map +1 -0
- package/dist/sync/account-mode/index.js +10 -0
- package/dist/sync/account-mode/index.js.map +1 -0
- package/dist/sync/account-mode/port.d.ts +11 -0
- package/dist/sync/account-mode/port.d.ts.map +1 -0
- package/dist/sync/account-mode/port.js +21 -0
- package/dist/sync/account-mode/port.js.map +1 -0
- package/dist/sync/account-mode/record.d.ts +52 -0
- package/dist/sync/account-mode/record.d.ts.map +1 -0
- package/dist/sync/account-mode/record.js +60 -0
- package/dist/sync/account-mode/record.js.map +1 -0
- package/dist/sync/account-mode/rw-lock.d.ts +14 -0
- package/dist/sync/account-mode/rw-lock.d.ts.map +1 -0
- package/dist/sync/account-mode/rw-lock.js +59 -0
- package/dist/sync/account-mode/rw-lock.js.map +1 -0
- package/dist/sync/cancellable-gateway.d.ts +25 -0
- package/dist/sync/cancellable-gateway.d.ts.map +1 -0
- package/dist/sync/cancellable-gateway.js +64 -0
- package/dist/sync/cancellable-gateway.js.map +1 -0
- package/dist/sync/data-point-feed.d.ts +3 -0
- package/dist/sync/data-point-feed.d.ts.map +1 -1
- package/dist/sync/data-point-feed.js +20 -1
- package/dist/sync/data-point-feed.js.map +1 -1
- package/dist/sync/delete-data-port.d.ts +19 -0
- package/dist/sync/delete-data-port.d.ts.map +1 -1
- package/dist/sync/delete-data-port.js +42 -9
- package/dist/sync/delete-data-port.js.map +1 -1
- package/dist/sync/engine/change-probe.d.ts +42 -0
- package/dist/sync/engine/change-probe.d.ts.map +1 -0
- package/dist/sync/engine/change-probe.js +79 -0
- package/dist/sync/engine/change-probe.js.map +1 -0
- package/dist/sync/engine/change-push.d.ts +53 -0
- package/dist/sync/engine/change-push.d.ts.map +1 -0
- package/dist/sync/engine/change-push.js +153 -0
- package/dist/sync/engine/change-push.js.map +1 -0
- package/dist/sync/engine/sync-manager.d.ts +181 -2
- package/dist/sync/engine/sync-manager.d.ts.map +1 -1
- package/dist/sync/engine/sync-manager.js +642 -19
- package/dist/sync/engine/sync-manager.js.map +1 -1
- package/dist/sync/index.d.ts +11 -3
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +11 -1
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/pdpp-import.d.ts +202 -0
- package/dist/sync/pdpp-import.d.ts.map +1 -0
- package/dist/sync/pdpp-import.js +466 -0
- package/dist/sync/pdpp-import.js.map +1 -0
- package/dist/sync/pending-blob-deletions.d.ts +18 -2
- package/dist/sync/pending-blob-deletions.d.ts.map +1 -1
- package/dist/sync/pending-blob-deletions.js +97 -23
- package/dist/sync/pending-blob-deletions.js.map +1 -1
- package/dist/sync/scope-deletions.d.ts +12 -0
- package/dist/sync/scope-deletions.d.ts.map +1 -1
- package/dist/sync/scope-deletions.js +99 -25
- package/dist/sync/scope-deletions.js.map +1 -1
- package/dist/sync/tombstone-finality.d.ts +36 -0
- package/dist/sync/tombstone-finality.d.ts.map +1 -0
- package/dist/sync/tombstone-finality.js +142 -0
- package/dist/sync/tombstone-finality.js.map +1 -0
- package/dist/sync/tombstone-resubmits.d.ts +61 -0
- package/dist/sync/tombstone-resubmits.d.ts.map +1 -0
- package/dist/sync/tombstone-resubmits.js +85 -0
- package/dist/sync/tombstone-resubmits.js.map +1 -0
- package/dist/sync/types.d.ts +26 -0
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/upload-attempts.d.ts +218 -0
- package/dist/sync/upload-attempts.d.ts.map +1 -0
- package/dist/sync/upload-attempts.js +500 -0
- package/dist/sync/upload-attempts.js.map +1 -0
- package/dist/sync/upload-state.d.ts +163 -0
- package/dist/sync/upload-state.d.ts.map +1 -0
- package/dist/sync/upload-state.js +239 -0
- package/dist/sync/upload-state.js.map +1 -0
- package/dist/sync/workers/delete.d.ts +63 -6
- package/dist/sync/workers/delete.d.ts.map +1 -1
- package/dist/sync/workers/delete.js +621 -168
- package/dist/sync/workers/delete.js.map +1 -1
- package/dist/sync/workers/download.d.ts +27 -1
- package/dist/sync/workers/download.d.ts.map +1 -1
- package/dist/sync/workers/download.js +368 -27
- package/dist/sync/workers/download.js.map +1 -1
- package/dist/sync/workers/lost-data-points.d.ts +38 -0
- package/dist/sync/workers/lost-data-points.d.ts.map +1 -0
- package/dist/sync/workers/lost-data-points.js +72 -0
- package/dist/sync/workers/lost-data-points.js.map +1 -0
- package/dist/sync/workers/upload.d.ts +97 -8
- package/dist/sync/workers/upload.d.ts.map +1 -1
- package/dist/sync/workers/upload.js +498 -277
- package/dist/sync/workers/upload.js.map +1 -1
- package/dist/test-support/memory-oracle.calibration.d.ts +16 -0
- package/dist/test-support/memory-oracle.calibration.d.ts.map +1 -0
- package/dist/test-support/memory-oracle.calibration.js +43 -0
- package/dist/test-support/memory-oracle.calibration.js.map +1 -0
- package/dist/test-support/memory-oracle.d.ts +82 -0
- package/dist/test-support/memory-oracle.d.ts.map +1 -0
- package/dist/test-support/memory-oracle.js +104 -0
- package/dist/test-support/memory-oracle.js.map +1 -0
- package/dist/test-utils/account-mode.d.ts +36 -0
- package/dist/test-utils/account-mode.d.ts.map +1 -0
- package/dist/test-utils/account-mode.js +77 -0
- package/dist/test-utils/account-mode.js.map +1 -0
- package/dist/test-utils/index.d.ts +2 -0
- package/dist/test-utils/index.d.ts.map +1 -1
- package/dist/test-utils/index.js +2 -0
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/legacy-write-seal.d.ts +16 -0
- package/dist/test-utils/legacy-write-seal.d.ts.map +1 -0
- package/dist/test-utils/legacy-write-seal.js +20 -0
- package/dist/test-utils/legacy-write-seal.js.map +1 -0
- package/dist/test-utils/live-grants.d.ts +24 -0
- package/dist/test-utils/live-grants.d.ts.map +1 -0
- package/dist/test-utils/live-grants.js +6 -0
- package/dist/test-utils/live-grants.js.map +1 -0
- package/dist/test-utils/memory-storage.d.ts +18 -2
- package/dist/test-utils/memory-storage.d.ts.map +1 -1
- package/dist/test-utils/memory-storage.js +156 -42
- package/dist/test-utils/memory-storage.js.map +1 -1
- package/dist/write/attribution.d.ts.map +1 -1
- package/dist/write/attribution.js +8 -4
- package/dist/write/attribution.js.map +1 -1
- package/dist/write/route.d.ts.map +1 -1
- package/dist/write/route.js +9 -10
- package/dist/write/route.js.map +1 -1
- package/dist/write/session.d.ts.map +1 -1
- package/dist/write/session.js +13 -0
- package/dist/write/session.js.map +1 -1
- package/dist-test/localdb/conformance.d.ts +13 -0
- package/dist-test/localdb/conformance.d.ts.map +1 -0
- package/dist-test/localdb/conformance.js +292 -0
- package/dist-test/localdb/conformance.js.map +1 -0
- package/dist-test/tsconfig.tsbuildinfo +1 -0
- package/package.json +131 -5
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { uploadAll } from "../workers/upload.js";
|
|
2
|
-
import {
|
|
2
|
+
import { createUploadStateTracker } from "../upload-state.js";
|
|
3
|
+
import { createMemoryUploadAttemptStore, createUploadAttemptLedger, } from "../upload-attempts.js";
|
|
4
|
+
import { requeueLostDataPoints } from "../workers/lost-data-points.js";
|
|
5
|
+
import { downloadAll, downloadScopes } from "../workers/download.js";
|
|
3
6
|
import { deleteScope, retryPendingBlobDeletions, } from "../workers/delete.js";
|
|
4
7
|
import { createDownloadRetryMemory } from "../retry-memory.js";
|
|
8
|
+
import { createTombstoneResubmitTracker } from "../tombstone-resubmits.js";
|
|
9
|
+
import { changePushBackoffMs } from "./change-push.js";
|
|
5
10
|
const MAX_ERRORS = 10;
|
|
6
11
|
export function createSyncManager(uploadDeps, downloadDeps, options) {
|
|
7
12
|
const pollInterval = options?.pollInterval ?? 60_000;
|
|
8
13
|
const uploadBatchSize = options?.uploadBatchSize ?? 50;
|
|
9
14
|
const notifyDebounceMs = options?.notifyDebounceMs ?? 500;
|
|
10
15
|
const transferMode = options?.transferMode ?? "upload-download";
|
|
16
|
+
const startupHydrateScopes = [...new Set(options?.hydrateScopes ?? [])];
|
|
11
17
|
let intervalId = null;
|
|
12
18
|
let notifyTimerId = null;
|
|
13
19
|
let isRunning = false;
|
|
@@ -16,22 +22,99 @@ export function createSyncManager(uploadDeps, downloadDeps, options) {
|
|
|
16
22
|
let blocked = null;
|
|
17
23
|
let errors = [];
|
|
18
24
|
let cycleInFlight = null;
|
|
25
|
+
// The dirty follow-up flag: a request arrived that the running cycle may not
|
|
26
|
+
// have seen. It is owed one more cycle and is dropped only by running one (or
|
|
27
|
+
// by a stop). A pass clears it on entry, so it never re-arms itself.
|
|
19
28
|
let rerunRequested = false;
|
|
29
|
+
// Failed cycles in a row, and the pending retry of the follow-up they owe.
|
|
30
|
+
// `retryTimer` set means cooling down: a pushed change only marks the flag.
|
|
31
|
+
let cycleFailures = 0;
|
|
32
|
+
let retryTimer = null;
|
|
33
|
+
// Pulls: one probe-and-cycle in flight; `pullRequested` is its dirty flag.
|
|
34
|
+
let pullInFlight = null;
|
|
35
|
+
let pullInFlightRun = 0;
|
|
36
|
+
let pullSeq = 0;
|
|
37
|
+
let pullRequested = false;
|
|
38
|
+
// True when a person-driven signal (focus, online) joined the pull in flight.
|
|
39
|
+
let pullSignalled = false;
|
|
40
|
+
// One value per start() and per stop(). A pull remembers the value it began
|
|
41
|
+
// under and does nothing once it differs: a probe answering after stop(), or
|
|
42
|
+
// from before a stop and start, can start no cycle and set no baseline.
|
|
43
|
+
let lifecycle = 0;
|
|
44
|
+
// Ends with the lifecycle value it belongs to: a pause or a stop aborts every
|
|
45
|
+
// request and timer the run before it still holds (the probe's read).
|
|
46
|
+
let lifecycleEnd = new AbortController();
|
|
47
|
+
const nextLifecycle = (why) => {
|
|
48
|
+
lifecycle += 1;
|
|
49
|
+
lifecycleEnd.abort(new Error(`sync manager ${why}`));
|
|
50
|
+
lifecycleEnd = new AbortController();
|
|
51
|
+
};
|
|
52
|
+
// Failed probes in a row, and the earliest time the timed probe tries again.
|
|
53
|
+
let probeFailures = 0;
|
|
54
|
+
let nextTimedProbeAt = 0;
|
|
55
|
+
// The change push (`ChangeProbe.push`): whether it can be trusted now, when
|
|
56
|
+
// the registry was last probed (a tick within the healthy period of one is
|
|
57
|
+
// skipped), and how to end the subscription of this run.
|
|
58
|
+
let pushHealthy = false;
|
|
59
|
+
let lastProbeAt = 0;
|
|
60
|
+
let stopPush = null;
|
|
61
|
+
// The host paused the manager (no one is looking): no request, no timer.
|
|
62
|
+
// `owedWhilePaused` remembers a local ingest that arrived meanwhile.
|
|
63
|
+
let paused = false;
|
|
64
|
+
let owedWhilePaused = false;
|
|
65
|
+
// The registry marker as of the last cycle a pull ran and finished cleanly.
|
|
66
|
+
// Only `pullIfChanged` moves it, and only to a marker read BEFORE its cycle
|
|
67
|
+
// started, so every change up to it was in the registry when that cycle read.
|
|
68
|
+
// A cycle that does not read its own marker first (a pushed change) leaves it
|
|
69
|
+
// alone: the next probe then runs one conservative follow-up.
|
|
70
|
+
let pulledMarker;
|
|
71
|
+
let errorSeq = 0;
|
|
72
|
+
// Status subscribers (`subscribeStatus`). `statusSeen` is the serialized
|
|
73
|
+
// value last delivered or taken as the baseline; null while no one listens.
|
|
74
|
+
const statusListeners = new Set();
|
|
75
|
+
let statusSeen = null;
|
|
76
|
+
let statusDelivering = false;
|
|
77
|
+
let probeIntervalId = null;
|
|
20
78
|
let needsFullReconcile = true;
|
|
79
|
+
// Once per boot, then only the scopes whose lookup failed, a few times.
|
|
80
|
+
let lostDataPointRetryScopes = null;
|
|
81
|
+
let lostDataPointAttempts = 0;
|
|
82
|
+
const MAX_LOST_DATA_POINT_ATTEMPTS = 5;
|
|
83
|
+
let needsStartupHydration = startupHydrateScopes.length > 0;
|
|
84
|
+
const hydratedScopes = new Set();
|
|
21
85
|
// One retry memory per manager (= per boot session): a blob that 404s is
|
|
22
86
|
// attempted once per session, not once per cycle; transient storage errors
|
|
23
87
|
// back off exponentially instead of re-firing on every cycle.
|
|
24
88
|
const downloadRetryMemory = createDownloadRetryMemory();
|
|
89
|
+
// Re-submissions of deletes whose tombstone failed (bounded per boot).
|
|
90
|
+
const tombstoneResubmits = createTombstoneResubmitTracker();
|
|
91
|
+
// Entries too large to upload and failing uploads that back off (per boot).
|
|
92
|
+
const uploadState = uploadDeps.uploadState ?? createUploadStateTracker();
|
|
25
93
|
const dataPointFeed = downloadDeps.dataPointFeed ?? uploadDeps.dataPointFeed;
|
|
26
94
|
const scopeDeletions = uploadDeps.scopeDeletions ?? downloadDeps.scopeDeletions;
|
|
95
|
+
const namelessAttempts = !uploadDeps.uploadAttempts && !options?.uploadAttemptStore;
|
|
27
96
|
// The upload worker queues guarded cleanup for ciphertext it had to
|
|
28
97
|
// abandon mid-race; it shares the manager's marker store.
|
|
98
|
+
const uploadAttempts = uploadDeps.uploadAttempts ??
|
|
99
|
+
createUploadAttemptLedger(options?.uploadAttemptStore ?? createMemoryUploadAttemptStore(), uploadDeps.serverOwner, {
|
|
100
|
+
onDegraded: (message) => pushError({
|
|
101
|
+
fileId: null,
|
|
102
|
+
scope: null,
|
|
103
|
+
message,
|
|
104
|
+
timestamp: new Date().toISOString(),
|
|
105
|
+
}),
|
|
106
|
+
});
|
|
29
107
|
const workerUploadDeps = {
|
|
30
108
|
...uploadDeps,
|
|
109
|
+
uploadState,
|
|
110
|
+
uploadAttempts,
|
|
31
111
|
pendingBlobDeletions: uploadDeps.pendingBlobDeletions ?? options?.pendingBlobDeletions,
|
|
32
112
|
};
|
|
33
113
|
const workerDownloadDeps = {
|
|
34
114
|
...downloadDeps,
|
|
115
|
+
// A mode-aware manager handles On through its cycle above. Its legacy
|
|
116
|
+
// worker is reached only for Off and must not invoke the database hook.
|
|
117
|
+
localSync: options?.accountStorageMode ? undefined : downloadDeps.localSync,
|
|
35
118
|
pendingBlobDeletions: downloadDeps.pendingBlobDeletions ?? options?.pendingBlobDeletions,
|
|
36
119
|
};
|
|
37
120
|
// Sync cycles and durable deletes mutate the same local index and the same
|
|
@@ -45,14 +128,36 @@ export function createSyncManager(uploadDeps, downloadDeps, options) {
|
|
|
45
128
|
mutationQueue = run.catch(() => undefined);
|
|
46
129
|
return run;
|
|
47
130
|
}
|
|
131
|
+
async function hydrateScopesExclusive(scopes) {
|
|
132
|
+
// Resolve scopes individually so an earlier success remains observable if
|
|
133
|
+
// a later scope fails.
|
|
134
|
+
for (const scope of new Set(scopes)) {
|
|
135
|
+
await downloadScopes(workerDownloadDeps, [scope], {
|
|
136
|
+
retryMemory: downloadRetryMemory,
|
|
137
|
+
});
|
|
138
|
+
// "Hydrated" means the remote scope was resolved, including an absent
|
|
139
|
+
// data point or tombstone; it does not guarantee local bytes exist.
|
|
140
|
+
hydratedScopes.add(scope);
|
|
141
|
+
downloadDeps.logger.info({ scope }, "Hydrated requested scope");
|
|
142
|
+
statusMayHaveChanged();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
48
145
|
async function runCycle() {
|
|
49
146
|
// Prevent concurrent cycles
|
|
50
147
|
if (cycleInFlight) {
|
|
51
148
|
rerunRequested = true;
|
|
52
149
|
return cycleInFlight;
|
|
53
150
|
}
|
|
54
|
-
|
|
151
|
+
// One cycle's passes: repeats while a request arrived during a pass.
|
|
152
|
+
const passes = async () => {
|
|
153
|
+
let first = true;
|
|
55
154
|
do {
|
|
155
|
+
// Reaching another pass means the previous one succeeded: the failure
|
|
156
|
+
// streak ends at that boundary, not when the whole cycle returns, or a
|
|
157
|
+
// failure in a pass that follows a success would back off as a repeat.
|
|
158
|
+
if (!first)
|
|
159
|
+
cycleFailures = 0;
|
|
160
|
+
first = false;
|
|
56
161
|
rerunRequested = false;
|
|
57
162
|
const canRun = await (options?.canSync?.() ?? { ok: true });
|
|
58
163
|
if (!canRun.ok) {
|
|
@@ -61,10 +166,57 @@ export function createSyncManager(uploadDeps, downloadDeps, options) {
|
|
|
61
166
|
continue;
|
|
62
167
|
}
|
|
63
168
|
blocked = null;
|
|
169
|
+
statusMayHaveChanged();
|
|
170
|
+
// canSync can yield while Account changes. Sample only after it returns.
|
|
171
|
+
if (options?.accountStorageMode) {
|
|
172
|
+
const mode = options.accountStorageMode.read();
|
|
173
|
+
if (mode !== "unswitched") {
|
|
174
|
+
if (mode === "switched" && options.localSync) {
|
|
175
|
+
await options.localSync.cycle();
|
|
176
|
+
lastSync = new Date().toISOString();
|
|
177
|
+
statusMayHaveChanged();
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
blocked = {
|
|
181
|
+
reason: mode === "unknown"
|
|
182
|
+
? "account_mode_unknown"
|
|
183
|
+
: "stream_sync_unavailable",
|
|
184
|
+
message: "Waiting for the account or its stream database",
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (needsStartupHydration) {
|
|
191
|
+
try {
|
|
192
|
+
await hydrateScopesExclusive(startupHydrateScopes);
|
|
193
|
+
needsStartupHydration = false;
|
|
194
|
+
}
|
|
195
|
+
catch (err) {
|
|
196
|
+
downloadDeps.logger.warn({ error: err.message }, "Scope hydration failed; continuing with full sync");
|
|
197
|
+
}
|
|
198
|
+
}
|
|
64
199
|
// Finish blob deletions whose tombstone landed but whose storage
|
|
65
200
|
// DELETE did not. Cheap when nothing is pending; never blocks sync.
|
|
66
201
|
if (transferMode === "upload-download") {
|
|
202
|
+
if (lostDataPointAttempts < MAX_LOST_DATA_POINT_ATTEMPTS &&
|
|
203
|
+
// null: no full pass has completed yet (first cycle, or it threw).
|
|
204
|
+
(lostDataPointRetryScopes === null ||
|
|
205
|
+
lostDataPointRetryScopes.length > 0)) {
|
|
206
|
+
// A registration the gateway accepted and later dropped (failed
|
|
207
|
+
// settle) still reads as synced locally. Full pass once per boot;
|
|
208
|
+
// later cycles retry only scopes whose lookup failed.
|
|
209
|
+
lostDataPointAttempts += 1;
|
|
210
|
+
try {
|
|
211
|
+
const { failed } = await requeueLostDataPoints(uploadDeps, lostDataPointRetryScopes ?? undefined);
|
|
212
|
+
lostDataPointRetryScopes = failed;
|
|
213
|
+
}
|
|
214
|
+
catch (err) {
|
|
215
|
+
uploadDeps.logger.warn({ error: err.message }, "Lost data point check failed; continuing with sync");
|
|
216
|
+
}
|
|
217
|
+
}
|
|
67
218
|
await runUploadCycle();
|
|
219
|
+
statusMayHaveChanged(); // uploads moved, the pending count with them
|
|
68
220
|
}
|
|
69
221
|
try {
|
|
70
222
|
// Download new remote files
|
|
@@ -94,24 +246,116 @@ export function createSyncManager(uploadDeps, downloadDeps, options) {
|
|
|
94
246
|
// Non-critical: status will show stale value
|
|
95
247
|
}
|
|
96
248
|
lastSync = new Date().toISOString();
|
|
97
|
-
|
|
98
|
-
|
|
249
|
+
statusMayHaveChanged(); // the cursor and lastSync, at the pass boundary
|
|
250
|
+
} while (rerunRequested && isRunning && !paused);
|
|
251
|
+
};
|
|
252
|
+
// A failed cycle ends its exclusive operation at once: callers get its
|
|
253
|
+
// error and queued mutations run. A follow-up it still owes (the dirty
|
|
254
|
+
// flag) waits out a cooldown first: see `scheduleRetry`.
|
|
255
|
+
cycleInFlight = exclusive(passes);
|
|
256
|
+
statusMayHaveChanged(); // syncing: true
|
|
99
257
|
try {
|
|
100
258
|
await cycleInFlight;
|
|
259
|
+
cycleFailures = 0;
|
|
260
|
+
}
|
|
261
|
+
catch (error) {
|
|
262
|
+
cycleFailed();
|
|
263
|
+
throw error;
|
|
101
264
|
}
|
|
102
265
|
finally {
|
|
103
266
|
cycleInFlight = null;
|
|
267
|
+
statusMayHaveChanged(); // syncing: false, and whatever the cycle moved
|
|
104
268
|
}
|
|
105
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* A cycle failed. If a request arrived while it ran, one follow-up is owed:
|
|
272
|
+
* run it after a cooldown from the push's back-off schedule (1 s doubling to
|
|
273
|
+
* 30 s over consecutive failures), never at once. Pushes cannot shorten or
|
|
274
|
+
* restart the cooldown: while it runs they only mark the dirty flag, and the
|
|
275
|
+
* one timer runs the follow-up. Without a request nothing retries; the timed
|
|
276
|
+
* cycle is the fallback.
|
|
277
|
+
*/
|
|
278
|
+
function cycleFailed() {
|
|
279
|
+
const failures = cycleFailures;
|
|
280
|
+
cycleFailures += 1;
|
|
281
|
+
if (!rerunRequested || !isRunning || paused || retryTimer !== null)
|
|
282
|
+
return;
|
|
283
|
+
retryTimer = setTimeout(() => {
|
|
284
|
+
retryTimer = null;
|
|
285
|
+
if (!isRunning || paused || !rerunRequested)
|
|
286
|
+
return;
|
|
287
|
+
runCycle().catch(() => {
|
|
288
|
+
// Errors already captured in ring buffer
|
|
289
|
+
});
|
|
290
|
+
}, changePushBackoffMs(failures));
|
|
291
|
+
}
|
|
292
|
+
function clearRetryTimer() {
|
|
293
|
+
if (retryTimer !== null)
|
|
294
|
+
clearTimeout(retryTimer);
|
|
295
|
+
retryTimer = null;
|
|
296
|
+
}
|
|
297
|
+
function deleteScopeDeps() {
|
|
298
|
+
return {
|
|
299
|
+
storage: uploadDeps.storage,
|
|
300
|
+
serverOwner: uploadDeps.serverOwner,
|
|
301
|
+
deleteData: options?.deleteData,
|
|
302
|
+
pendingBlobDeletions: options?.pendingBlobDeletions,
|
|
303
|
+
tombstoneFinality: options?.tombstoneFinality,
|
|
304
|
+
scopeDeletions,
|
|
305
|
+
dataPointFeed,
|
|
306
|
+
logger: uploadDeps.logger,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Durable additions delete their ledger scope through `manager.deleteScope`,
|
|
311
|
+
* which queues behind the running mutation. Inside a cycle that must not be
|
|
312
|
+
* awaited, so it is started and left to run after the cycle.
|
|
313
|
+
*/
|
|
314
|
+
function deleteAdditionsAfter(scope) {
|
|
315
|
+
const additions = uploadDeps.additions;
|
|
316
|
+
if (!additions)
|
|
317
|
+
return;
|
|
318
|
+
// Start only once the running cycle has left the mutation queue: the
|
|
319
|
+
// PS-Lite additions session holds its Web Lock across the ledger delete,
|
|
320
|
+
// and this cycle's uploads need that lock too.
|
|
321
|
+
void mutationQueue
|
|
322
|
+
.then(() => additions.deleteScope(scope))
|
|
323
|
+
.catch((err) => {
|
|
324
|
+
uploadDeps.logger.warn({ scope, error: err.message }, "Could not delete the additions ledger of a re-deleted scope");
|
|
325
|
+
});
|
|
326
|
+
}
|
|
106
327
|
async function runUploadCycle() {
|
|
107
328
|
try {
|
|
108
329
|
await retryPendingBlobDeletions({
|
|
109
330
|
deleteData: options?.deleteData,
|
|
110
331
|
pendingBlobDeletions: options?.pendingBlobDeletions,
|
|
332
|
+
tombstoneFinality: options?.tombstoneFinality,
|
|
111
333
|
dataPointFeed,
|
|
112
334
|
serverOwner: uploadDeps.serverOwner,
|
|
113
335
|
storage: uploadDeps.storage,
|
|
114
336
|
logger: uploadDeps.logger,
|
|
337
|
+
...(options?.tombstoneFinality && options.deleteData
|
|
338
|
+
? {
|
|
339
|
+
tombstoneResubmits,
|
|
340
|
+
// Already inside the mutation queue: call the worker directly.
|
|
341
|
+
async resubmitDeletion(scope, resubmit) {
|
|
342
|
+
const result = await deleteScope(deleteScopeDeps(), scope, resubmit);
|
|
343
|
+
if (result.durable)
|
|
344
|
+
deleteAdditionsAfter(scope);
|
|
345
|
+
return result;
|
|
346
|
+
},
|
|
347
|
+
onDeletionAbandoned(state) {
|
|
348
|
+
pushError({
|
|
349
|
+
fileId: null,
|
|
350
|
+
scope: state.scope,
|
|
351
|
+
message: state.reason === "head-changed"
|
|
352
|
+
? `Deletion of ${state.scope} did not complete: the gateway tombstone failed and the data is live again. Delete it again to retry.`
|
|
353
|
+
: `Deletion of ${state.scope} did not complete: the gateway tombstone failed ${state.attempts + 1} times and the data is live again. Delete it again to retry.`,
|
|
354
|
+
timestamp: new Date().toISOString(),
|
|
355
|
+
});
|
|
356
|
+
},
|
|
357
|
+
}
|
|
358
|
+
: {}),
|
|
115
359
|
});
|
|
116
360
|
}
|
|
117
361
|
catch (err) {
|
|
@@ -121,12 +365,13 @@ export function createSyncManager(uploadDeps, downloadDeps, options) {
|
|
|
121
365
|
const uploadResults = await uploadAll(workerUploadDeps, {
|
|
122
366
|
batchSize: uploadBatchSize,
|
|
123
367
|
onError(entry, error) {
|
|
368
|
+
// One notification for the whole upload cycle, from the caller.
|
|
124
369
|
pushError({
|
|
125
370
|
fileId: entry.fileId,
|
|
126
371
|
scope: entry.scope,
|
|
127
372
|
message: `Upload failed for ${entry.path}: ${error.message}`,
|
|
128
373
|
timestamp: new Date().toISOString(),
|
|
129
|
-
});
|
|
374
|
+
}, false);
|
|
130
375
|
},
|
|
131
376
|
});
|
|
132
377
|
uploadDeps.logger.debug({ uploaded: uploadResults.length }, "Upload cycle complete");
|
|
@@ -141,9 +386,114 @@ export function createSyncManager(uploadDeps, downloadDeps, options) {
|
|
|
141
386
|
pushError(syncError);
|
|
142
387
|
uploadDeps.logger.error({ error: err.message }, "Upload cycle failed");
|
|
143
388
|
}
|
|
389
|
+
if (options?.streamSync?.write) {
|
|
390
|
+
try {
|
|
391
|
+
await options.streamSync.publisher.cycle();
|
|
392
|
+
}
|
|
393
|
+
catch (err) {
|
|
394
|
+
pushError({
|
|
395
|
+
fileId: null,
|
|
396
|
+
scope: null,
|
|
397
|
+
message: `Stream sync publish failed: ${err.message}`,
|
|
398
|
+
timestamp: new Date().toISOString(),
|
|
399
|
+
});
|
|
400
|
+
uploadDeps.logger.warn({ error: err.message }, "Stream sync publish failed");
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* After a failed probe the timed probe waits probe period x 2^failures, capped
|
|
406
|
+
* at the poll interval, so an offline device probes about once a minute and
|
|
407
|
+
* the timer's own cycle stays the fallback. Both numbers are the host's.
|
|
408
|
+
*/
|
|
409
|
+
function noteProbeFailure(probe) {
|
|
410
|
+
probeFailures += 1;
|
|
411
|
+
const wait = Math.min(probe.intervalMs * 2 ** probeFailures, Math.max(pollInterval, probe.intervalMs));
|
|
412
|
+
nextTimedProbeAt = Date.now() + wait;
|
|
413
|
+
}
|
|
414
|
+
async function pullIfChanged(probe, run, fromSignal, ended) {
|
|
415
|
+
let marker;
|
|
416
|
+
lastProbeAt = Date.now();
|
|
417
|
+
try {
|
|
418
|
+
marker = await probe.read(ended);
|
|
419
|
+
}
|
|
420
|
+
catch (err) {
|
|
421
|
+
if (run === lifecycle)
|
|
422
|
+
noteProbeFailure(probe);
|
|
423
|
+
uploadDeps.logger.debug({ error: err.message }, "Registry change probe failed; the timer cycle is the fallback");
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
// stop() does not wait for a probe; an answer from an earlier run is void.
|
|
427
|
+
if (run !== lifecycle || !isRunning)
|
|
428
|
+
return;
|
|
429
|
+
probeFailures = 0;
|
|
430
|
+
nextTimedProbeAt = 0;
|
|
431
|
+
if (marker === undefined && !fromSignal)
|
|
432
|
+
return; // cannot tell: the timer decides
|
|
433
|
+
if (marker !== undefined && marker === pulledMarker)
|
|
434
|
+
return;
|
|
435
|
+
const errorsBefore = errorSeq;
|
|
436
|
+
// A cycle already running may have read the registry before the change:
|
|
437
|
+
// `runCycle` makes a joiner wait for a follow-up that starts after this call.
|
|
438
|
+
await runCycle();
|
|
439
|
+
if (run === lifecycle &&
|
|
440
|
+
marker !== undefined &&
|
|
441
|
+
blocked === null &&
|
|
442
|
+
errorSeq === errorsBefore) {
|
|
443
|
+
pulledMarker = marker;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
function pull(fromSignal) {
|
|
447
|
+
if (!isRunning || paused)
|
|
448
|
+
return Promise.resolve();
|
|
449
|
+
// No probe: a pull is a cycle request, and `runCycle` coalesces those.
|
|
450
|
+
const probe = options?.changeProbe;
|
|
451
|
+
if (!probe)
|
|
452
|
+
return runCycle();
|
|
453
|
+
const run = lifecycle;
|
|
454
|
+
const ended = lifecycleEnd.signal;
|
|
455
|
+
if (pullInFlight && pullInFlightRun === run) {
|
|
456
|
+
pullRequested = true;
|
|
457
|
+
pullSignalled ||= fromSignal;
|
|
458
|
+
return pullInFlight;
|
|
459
|
+
}
|
|
460
|
+
pullSignalled = fromSignal;
|
|
461
|
+
const seq = ++pullSeq;
|
|
462
|
+
const current = (async () => {
|
|
463
|
+
try {
|
|
464
|
+
do {
|
|
465
|
+
pullRequested = false;
|
|
466
|
+
const signalled = pullSignalled;
|
|
467
|
+
pullSignalled = false;
|
|
468
|
+
await pullIfChanged(probe, run, signalled, ended);
|
|
469
|
+
// A tick that joined a read that then failed waits out the back-off;
|
|
470
|
+
// only a signal (focus, online) is read again at once.
|
|
471
|
+
} while (pullRequested &&
|
|
472
|
+
isRunning &&
|
|
473
|
+
run === lifecycle &&
|
|
474
|
+
(pullSignalled || Date.now() >= nextTimedProbeAt));
|
|
475
|
+
}
|
|
476
|
+
finally {
|
|
477
|
+
// Only the newest pull clears the slot; an older run's may end later.
|
|
478
|
+
if (pullSeq === seq)
|
|
479
|
+
pullInFlight = null;
|
|
480
|
+
}
|
|
481
|
+
})();
|
|
482
|
+
pullInFlight = current;
|
|
483
|
+
pullInFlightRun = run;
|
|
484
|
+
return current;
|
|
485
|
+
}
|
|
486
|
+
function requestPull() {
|
|
487
|
+
return pull(true);
|
|
144
488
|
}
|
|
145
489
|
function scheduleNotifiedCycle() {
|
|
146
|
-
if (!isRunning
|
|
490
|
+
if (!isRunning)
|
|
491
|
+
return;
|
|
492
|
+
if (paused) {
|
|
493
|
+
owedWhilePaused = true;
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
if (notifyTimerId !== null)
|
|
147
497
|
return;
|
|
148
498
|
notifyTimerId = setTimeout(() => {
|
|
149
499
|
notifyTimerId = null;
|
|
@@ -154,11 +504,79 @@ export function createSyncManager(uploadDeps, downloadDeps, options) {
|
|
|
154
504
|
});
|
|
155
505
|
}, notifyDebounceMs);
|
|
156
506
|
}
|
|
157
|
-
|
|
507
|
+
/**
|
|
508
|
+
* Record an error for the status. `notify: false` leaves the notification to
|
|
509
|
+
* the caller, which owes one at the end of its batch: the upload worker
|
|
510
|
+
* reports one error per failed file, and a status read per file would cost
|
|
511
|
+
* a count each.
|
|
512
|
+
*/
|
|
513
|
+
function pushError(error, notify = true) {
|
|
514
|
+
errorSeq += 1;
|
|
158
515
|
errors.push(error);
|
|
159
516
|
if (errors.length > MAX_ERRORS) {
|
|
160
517
|
errors = errors.slice(-MAX_ERRORS);
|
|
161
518
|
}
|
|
519
|
+
if (notify)
|
|
520
|
+
statusMayHaveChanged();
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Log a failure of delivery. Anything can be thrown (`null`, a string), and
|
|
524
|
+
* the logger can throw too; neither may leave delivery, or a caller such as
|
|
525
|
+
* `start` would stop before its first cycle.
|
|
526
|
+
*/
|
|
527
|
+
function reportQuietly(message, thrown) {
|
|
528
|
+
try {
|
|
529
|
+
uploadDeps.logger.warn({ error: thrown instanceof Error ? thrown.message : String(thrown) }, message);
|
|
530
|
+
}
|
|
531
|
+
catch {
|
|
532
|
+
// A failing logger has no one left to tell.
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Called at every point where a field of `getStatus()` can change. Reads the
|
|
537
|
+
* status only when someone listens, and tells them only if it differs from
|
|
538
|
+
* what they last had. Not reentrant: a change a listener causes is picked up
|
|
539
|
+
* by the loop below after the listeners return.
|
|
540
|
+
*/
|
|
541
|
+
function statusMayHaveChanged() {
|
|
542
|
+
if (statusListeners.size === 0) {
|
|
543
|
+
statusSeen = null; // unknown from here: the next subscriber re-baselines
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
if (statusDelivering)
|
|
547
|
+
return;
|
|
548
|
+
statusDelivering = true;
|
|
549
|
+
try {
|
|
550
|
+
for (;;) {
|
|
551
|
+
let status;
|
|
552
|
+
let seen;
|
|
553
|
+
try {
|
|
554
|
+
status = manager.getStatus();
|
|
555
|
+
seen = JSON.stringify(status);
|
|
556
|
+
}
|
|
557
|
+
catch (error) {
|
|
558
|
+
reportQuietly("sync status could not be read for subscribers", error);
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
if (seen === statusSeen)
|
|
562
|
+
return;
|
|
563
|
+
const first = statusSeen === null;
|
|
564
|
+
statusSeen = seen;
|
|
565
|
+
if (first)
|
|
566
|
+
return; // the baseline, not a change
|
|
567
|
+
for (const listener of [...statusListeners]) {
|
|
568
|
+
try {
|
|
569
|
+
listener(status);
|
|
570
|
+
}
|
|
571
|
+
catch (error) {
|
|
572
|
+
reportQuietly("a sync status listener threw", error);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
finally {
|
|
578
|
+
statusDelivering = false;
|
|
579
|
+
}
|
|
162
580
|
}
|
|
163
581
|
function startInterval() {
|
|
164
582
|
if (intervalId !== null)
|
|
@@ -175,6 +593,66 @@ export function createSyncManager(uploadDeps, downloadDeps, options) {
|
|
|
175
593
|
intervalId = null;
|
|
176
594
|
}
|
|
177
595
|
}
|
|
596
|
+
function startProbeInterval() {
|
|
597
|
+
const probe = options?.changeProbe;
|
|
598
|
+
if (!probe || probeIntervalId !== null)
|
|
599
|
+
return;
|
|
600
|
+
probeIntervalId = setInterval(() => {
|
|
601
|
+
if (Date.now() < nextTimedProbeAt)
|
|
602
|
+
return; // backing off after failures
|
|
603
|
+
// A healthy push pokes on a change; the timer cycle still runs every
|
|
604
|
+
// poll interval, so this probe only has to back it up now and then.
|
|
605
|
+
if (pushHealthy &&
|
|
606
|
+
probe.push &&
|
|
607
|
+
Date.now() - lastProbeAt < probe.push.healthyProbeMs) {
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
pull(false).catch(() => {
|
|
611
|
+
// Errors already captured in ring buffer
|
|
612
|
+
});
|
|
613
|
+
}, probe.intervalMs);
|
|
614
|
+
}
|
|
615
|
+
function startChangePush() {
|
|
616
|
+
const push = options?.changeProbe?.push;
|
|
617
|
+
if (!push || stopPush !== null)
|
|
618
|
+
return;
|
|
619
|
+
const run = lifecycle;
|
|
620
|
+
stopPush = push.subscribe({
|
|
621
|
+
onChange() {
|
|
622
|
+
if (run !== lifecycle || !isRunning)
|
|
623
|
+
return;
|
|
624
|
+
// A verified change cycles at once. It does not wait for the optional
|
|
625
|
+
// probe or join a timed probe read in flight, so a probe that never
|
|
626
|
+
// answers cannot hold it up; `runCycle` still runs one cycle at a time.
|
|
627
|
+
// It reads no marker and publishes none: see `pulledMarker`.
|
|
628
|
+
if (retryTimer !== null) {
|
|
629
|
+
// Cooling down after a failed cycle: the request is owed, and the
|
|
630
|
+
// retry timer runs it. A push neither skips nor restarts the wait.
|
|
631
|
+
rerunRequested = true;
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
runCycle().catch(() => {
|
|
635
|
+
// Errors already captured in ring buffer
|
|
636
|
+
});
|
|
637
|
+
},
|
|
638
|
+
onHealth(healthy) {
|
|
639
|
+
if (run !== lifecycle)
|
|
640
|
+
return;
|
|
641
|
+
pushHealthy = healthy;
|
|
642
|
+
},
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
function stopChangePush() {
|
|
646
|
+
stopPush?.();
|
|
647
|
+
stopPush = null;
|
|
648
|
+
pushHealthy = false;
|
|
649
|
+
}
|
|
650
|
+
function clearProbeInterval() {
|
|
651
|
+
if (probeIntervalId !== null) {
|
|
652
|
+
clearInterval(probeIntervalId);
|
|
653
|
+
probeIntervalId = null;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
178
656
|
function clearNotifyTimer() {
|
|
179
657
|
if (notifyTimerId !== null) {
|
|
180
658
|
clearTimeout(notifyTimerId);
|
|
@@ -189,32 +667,112 @@ export function createSyncManager(uploadDeps, downloadDeps, options) {
|
|
|
189
667
|
if (isRunning)
|
|
190
668
|
return; // Idempotent
|
|
191
669
|
isRunning = true;
|
|
670
|
+
paused = false;
|
|
671
|
+
owedWhilePaused = false;
|
|
672
|
+
nextLifecycle("started");
|
|
673
|
+
pulledMarker = undefined;
|
|
674
|
+
cycleFailures = 0;
|
|
675
|
+
probeFailures = 0;
|
|
676
|
+
nextTimedProbeAt = 0;
|
|
677
|
+
lastProbeAt = Date.now();
|
|
678
|
+
statusMayHaveChanged(); // running: true
|
|
192
679
|
// Crash recovery: run one cycle immediately on start
|
|
193
680
|
runCycle().catch(() => {
|
|
194
681
|
// Errors already captured in ring buffer
|
|
195
682
|
});
|
|
196
683
|
startInterval();
|
|
684
|
+
startProbeInterval();
|
|
685
|
+
startChangePush();
|
|
197
686
|
},
|
|
198
687
|
async stop() {
|
|
688
|
+
// Opens the stop's repair window before anything awaits, so a stop that
|
|
689
|
+
// nothing awaits still holds its repair duty.
|
|
690
|
+
const closing = uploadAttempts
|
|
691
|
+
.close(namelessAttempts ? Infinity : undefined)
|
|
692
|
+
.catch((err) => err);
|
|
199
693
|
clearIntervalTimer();
|
|
694
|
+
clearProbeInterval();
|
|
695
|
+
stopChangePush();
|
|
200
696
|
clearNotifyTimer();
|
|
697
|
+
clearRetryTimer();
|
|
698
|
+
rerunRequested = false;
|
|
201
699
|
isRunning = false;
|
|
700
|
+
paused = false;
|
|
701
|
+
owedWhilePaused = false;
|
|
702
|
+
// Cancel pulls: a probe that answers later finds a new lifecycle value.
|
|
703
|
+
nextLifecycle("stopped");
|
|
704
|
+
statusMayHaveChanged(); // running: false
|
|
202
705
|
// Wait for any in-flight cycle to complete
|
|
203
706
|
if (cycleInFlight) {
|
|
204
707
|
await cycleInFlight;
|
|
205
708
|
}
|
|
709
|
+
// Hand the upload markers to the next manager over this store, once no
|
|
710
|
+
// attempt is still running (a running one keeps its entry excluded).
|
|
711
|
+
// Without a stable store namespace a rebuilt manager gets a fresh,
|
|
712
|
+
// unrelated lock, so only a fully drained stop keeps two managers over
|
|
713
|
+
// the same persistence from overlapping.
|
|
714
|
+
const err = await closing;
|
|
715
|
+
if (err !== undefined) {
|
|
716
|
+
// The ledger keeps the store and retries the repair itself; say so.
|
|
717
|
+
pushError({
|
|
718
|
+
fileId: null,
|
|
719
|
+
scope: null,
|
|
720
|
+
message: `Upload crash protection could not be saved on stop: ${err.message}`,
|
|
721
|
+
timestamp: new Date().toISOString(),
|
|
722
|
+
});
|
|
723
|
+
uploadDeps.logger.error({ error: err.message }, "Upload attempt store could not be repaired on stop");
|
|
724
|
+
}
|
|
206
725
|
},
|
|
207
726
|
async trigger() {
|
|
208
727
|
// Clear existing timers, run immediately, restart interval
|
|
209
728
|
clearIntervalTimer();
|
|
210
729
|
clearNotifyTimer();
|
|
211
730
|
await runCycle();
|
|
212
|
-
if (isRunning) {
|
|
731
|
+
if (isRunning && !paused) {
|
|
213
732
|
startInterval();
|
|
214
733
|
}
|
|
215
734
|
},
|
|
735
|
+
pause() {
|
|
736
|
+
if (!isRunning || paused)
|
|
737
|
+
return;
|
|
738
|
+
paused = true;
|
|
739
|
+
// Stale answers (a probe, a poke) of the run before the hide are void.
|
|
740
|
+
nextLifecycle("paused");
|
|
741
|
+
// A debounced ingest still waiting for its timer is owed, not dropped.
|
|
742
|
+
if (notifyTimerId !== null)
|
|
743
|
+
owedWhilePaused = true;
|
|
744
|
+
clearIntervalTimer();
|
|
745
|
+
clearProbeInterval();
|
|
746
|
+
clearNotifyTimer();
|
|
747
|
+
clearRetryTimer();
|
|
748
|
+
stopChangePush(); // aborts the held request and the push's own timers
|
|
749
|
+
cycleFailures = 0;
|
|
750
|
+
probeFailures = 0;
|
|
751
|
+
nextTimedProbeAt = 0;
|
|
752
|
+
},
|
|
753
|
+
resume() {
|
|
754
|
+
if (!isRunning || !paused)
|
|
755
|
+
return;
|
|
756
|
+
paused = false;
|
|
757
|
+
startInterval();
|
|
758
|
+
startProbeInterval();
|
|
759
|
+
startChangePush();
|
|
760
|
+
// A follow-up the last cycle owed, or an ingest, waited for this.
|
|
761
|
+
const owed = owedWhilePaused || rerunRequested;
|
|
762
|
+
owedWhilePaused = false;
|
|
763
|
+
if (owed) {
|
|
764
|
+
runCycle().catch(() => {
|
|
765
|
+
// Errors already captured in ring buffer
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
},
|
|
769
|
+
requestPull,
|
|
216
770
|
getStatus() {
|
|
217
|
-
const pendingFiles =
|
|
771
|
+
const pendingFiles = options?.accountStorageMode &&
|
|
772
|
+
options.accountStorageMode.read() !== "unswitched"
|
|
773
|
+
? 0
|
|
774
|
+
: (uploadDeps.storage.countUnsynced?.() ??
|
|
775
|
+
uploadDeps.storage.findUnsynced().length);
|
|
218
776
|
return {
|
|
219
777
|
enabled: true,
|
|
220
778
|
running: isRunning,
|
|
@@ -223,23 +781,88 @@ export function createSyncManager(uploadDeps, downloadDeps, options) {
|
|
|
223
781
|
lastSync,
|
|
224
782
|
lastProcessedTimestamp,
|
|
225
783
|
pendingFiles,
|
|
784
|
+
hydratedScopes: [...hydratedScopes],
|
|
226
785
|
errors: [...errors],
|
|
786
|
+
changeProbeMs: options?.changeProbe?.intervalMs ?? 0,
|
|
787
|
+
deletions: tombstoneResubmits.snapshot(),
|
|
788
|
+
uploads: uploadState.snapshot(),
|
|
789
|
+
};
|
|
790
|
+
},
|
|
791
|
+
subscribeStatus(listener) {
|
|
792
|
+
statusListeners.add(listener);
|
|
793
|
+
// The first subscriber's value is the baseline, not an event.
|
|
794
|
+
if (statusListeners.size === 1)
|
|
795
|
+
statusMayHaveChanged();
|
|
796
|
+
return () => {
|
|
797
|
+
statusListeners.delete(listener);
|
|
798
|
+
if (statusListeners.size === 0)
|
|
799
|
+
statusSeen = null;
|
|
227
800
|
};
|
|
228
801
|
},
|
|
802
|
+
hydrateScopes(scopes) {
|
|
803
|
+
return exclusive(async () => {
|
|
804
|
+
const canRun = await (options?.canSync?.() ?? { ok: true });
|
|
805
|
+
if (!canRun.ok) {
|
|
806
|
+
blocked = { reason: canRun.reason, message: canRun.message };
|
|
807
|
+
downloadDeps.logger.warn(blocked, "Scope hydration blocked");
|
|
808
|
+
statusMayHaveChanged();
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
blocked = null;
|
|
812
|
+
statusMayHaveChanged();
|
|
813
|
+
if (options?.accountStorageMode) {
|
|
814
|
+
const mode = options.accountStorageMode.read();
|
|
815
|
+
if (mode !== "unswitched") {
|
|
816
|
+
if (mode === "switched" && options.localSync)
|
|
817
|
+
await options.localSync.cycle();
|
|
818
|
+
else {
|
|
819
|
+
blocked = {
|
|
820
|
+
reason: "account_mode_unknown",
|
|
821
|
+
message: "Waiting for the account or its stream database",
|
|
822
|
+
};
|
|
823
|
+
statusMayHaveChanged();
|
|
824
|
+
}
|
|
825
|
+
return;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
await hydrateScopesExclusive(scopes);
|
|
829
|
+
});
|
|
830
|
+
},
|
|
229
831
|
notifyNewData() {
|
|
230
832
|
uploadDeps.logger.debug("New data notification received");
|
|
833
|
+
statusMayHaveChanged(); // the new data is pending until a cycle takes it
|
|
231
834
|
scheduleNotifiedCycle();
|
|
232
835
|
},
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
836
|
+
async retryQuarantinedUploads(scope) {
|
|
837
|
+
if (!(await uploadAttempts.recover()))
|
|
838
|
+
return;
|
|
839
|
+
try {
|
|
840
|
+
for (const path of await uploadAttempts.release(scope))
|
|
841
|
+
uploadState.clear(path);
|
|
842
|
+
}
|
|
843
|
+
finally {
|
|
844
|
+
// The tracker's snapshot is part of the status, and a release that
|
|
845
|
+
// fails part way has still cleared the paths before it.
|
|
846
|
+
statusMayHaveChanged();
|
|
847
|
+
}
|
|
848
|
+
},
|
|
849
|
+
async deleteScope(scope, within) {
|
|
850
|
+
const result = await exclusive(async () => {
|
|
851
|
+
// A delete the user asks for starts a fresh set of re-submissions.
|
|
852
|
+
tombstoneResubmits.reset(scope);
|
|
853
|
+
const outcome = within
|
|
854
|
+
? await within((hold) => deleteScope(deleteScopeDeps(), scope, { hold }))
|
|
855
|
+
: await deleteScope(deleteScopeDeps(), scope);
|
|
856
|
+
// Upload state follows the rows. A failed delete removed nothing, so
|
|
857
|
+
// its entries keep their budget and status; entries the delete did
|
|
858
|
+
// remove are forgotten by comparing with what is still unsynced.
|
|
859
|
+
uploadState.reconcile(uploadDeps.storage.findUnsynced());
|
|
860
|
+
statusMayHaveChanged();
|
|
861
|
+
return outcome;
|
|
862
|
+
});
|
|
863
|
+
if (result.durable && uploadDeps.additions)
|
|
864
|
+
await uploadDeps.additions.deleteScope(scope);
|
|
865
|
+
return result;
|
|
243
866
|
},
|
|
244
867
|
};
|
|
245
868
|
return manager;
|