@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
|
@@ -0,0 +1,736 @@
|
|
|
1
|
+
import { keccak_256 } from "@noble/hashes/sha3";
|
|
2
|
+
import { classifyControl, classifyStreamRow, controlHashes, controlScope, deriveKeyCheck, digestHead, encodeHead, HEAD_FORMAT, headBlobName, parseScope, sameControl, streamScope, verifyHead, } from "@opendatalabs/personal-server-ts-stream-sync";
|
|
3
|
+
import { manifestStreamLister } from "../stream-sync/artifacts.js";
|
|
4
|
+
import { deleteMetadataHash, deleteEndedEarlierLifetime, endedGenerationDeleteMetadataHash, } from "../stream-sync/delete-metadata.js";
|
|
5
|
+
import { RegistryRefusedError } from "../stream-sync/ports.js";
|
|
6
|
+
import { createDeleteBatcher } from "./delete-batch.js";
|
|
7
|
+
import { purgeConnection } from "./purge.js";
|
|
8
|
+
export class ConnectionStoppedError extends Error {
|
|
9
|
+
connector;
|
|
10
|
+
constructor(connector) {
|
|
11
|
+
super(`connection of ${connector} is stopped: deleted, not reconnected; an explicit connect is required`);
|
|
12
|
+
this.connector = connector;
|
|
13
|
+
this.name = "ConnectionStoppedError";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export class ConnectorNotVerifiedError extends Error {
|
|
17
|
+
connector;
|
|
18
|
+
constructor(connector) {
|
|
19
|
+
super(`no verified manifest names the streams of ${connector}; its delete cannot fence rowless streams`);
|
|
20
|
+
this.connector = connector;
|
|
21
|
+
this.name = "ConnectorNotVerifiedError";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** The batch request did not write this stream's row; the per-stream path must. */
|
|
25
|
+
class BatchFellBack extends Error {
|
|
26
|
+
}
|
|
27
|
+
export class ConnectionDeleteSuperseded extends Error {
|
|
28
|
+
connector;
|
|
29
|
+
constructor(connector) {
|
|
30
|
+
super(`delete of ${connector} was superseded before it landed`);
|
|
31
|
+
this.connector = connector;
|
|
32
|
+
this.name = "ConnectionDeleteSuperseded";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const keccak = async (bytes) => keccak_256(bytes);
|
|
36
|
+
const ATTEMPTS = 8;
|
|
37
|
+
/** `work`'s answer, or `false` once `ms` has passed (never: wait for `work`). */
|
|
38
|
+
function withinBudget(work, ms) {
|
|
39
|
+
if (ms === undefined)
|
|
40
|
+
return work;
|
|
41
|
+
return new Promise((resolve) => {
|
|
42
|
+
const timer = setTimeout(() => resolve(false), ms);
|
|
43
|
+
void work
|
|
44
|
+
.then(resolve, () => resolve(false))
|
|
45
|
+
.finally(() => clearTimeout(timer));
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export function createConnectionDeleter(deps, options) {
|
|
49
|
+
const flights = new Map();
|
|
50
|
+
/**
|
|
51
|
+
* The stream rows the plan listed, by delete id. Only a delete this process
|
|
52
|
+
* just planned has one; the landing takes it. The rows are a hint for the
|
|
53
|
+
* first cleanup attempt: every write is a compare-and-set, so a row that has
|
|
54
|
+
* moved since the listing costs one rejected write and a re-read.
|
|
55
|
+
*/
|
|
56
|
+
const listings = new Map();
|
|
57
|
+
/** Set once the registry answers that it has no usable batch route. */
|
|
58
|
+
let batchOff = false;
|
|
59
|
+
const keyInfo = async () => {
|
|
60
|
+
const keyCheck = await deriveKeyCheck((m) => deps.keys.namespaceHmac(m));
|
|
61
|
+
return { keyCheck, hashes: await controlHashes(keccak, keyCheck) };
|
|
62
|
+
};
|
|
63
|
+
const readIntent = async (connector) => {
|
|
64
|
+
const [row] = await deps.db.query("SELECT delete_id,intent FROM delete_intents WHERE connector=?", [connector]);
|
|
65
|
+
if (!row)
|
|
66
|
+
return null;
|
|
67
|
+
const intent = JSON.parse(row.intent);
|
|
68
|
+
if (!Array.isArray(intent.pins) ||
|
|
69
|
+
intent.pins.some((p) => !Number.isSafeInteger(p.version) || p.version < 1) ||
|
|
70
|
+
(intent.streams !== undefined && !Array.isArray(intent.streams)))
|
|
71
|
+
throw new Error("invalid stored delete intent");
|
|
72
|
+
for (const fence of intent.fences ?? []) {
|
|
73
|
+
const pin = intent.pins.find((p) => p.ns === fence.ns);
|
|
74
|
+
if (!pin || fence.version !== pin.version + 1)
|
|
75
|
+
throw new Error("invalid stored delete intent");
|
|
76
|
+
}
|
|
77
|
+
for (const pin of intent.pins)
|
|
78
|
+
controlScope(connector, pin.ns);
|
|
79
|
+
for (const pin of intent.streams ?? [])
|
|
80
|
+
streamScope(connector, pin.ns, pin.stream);
|
|
81
|
+
return { ...intent, id: row.delete_id };
|
|
82
|
+
};
|
|
83
|
+
const save = (connector, intent) => deps.db.batch([
|
|
84
|
+
{
|
|
85
|
+
sql: "INSERT OR REPLACE INTO delete_intents(connector,delete_id,intent) VALUES (?,?,?)",
|
|
86
|
+
params: [connector, intent.id, JSON.stringify(intent)],
|
|
87
|
+
},
|
|
88
|
+
]);
|
|
89
|
+
const clear = (connector, id) => deps.db.batch([
|
|
90
|
+
{
|
|
91
|
+
sql: "DELETE FROM delete_intents WHERE connector=? AND delete_id=?",
|
|
92
|
+
params: [connector, id],
|
|
93
|
+
},
|
|
94
|
+
]);
|
|
95
|
+
async function plan(connector) {
|
|
96
|
+
const { hashes } = await keyInfo();
|
|
97
|
+
const controls = new Map();
|
|
98
|
+
const pins = [];
|
|
99
|
+
for (const entry of await deps.registry.listControlRows()) {
|
|
100
|
+
const parsed = parseScope(entry.scope);
|
|
101
|
+
if (parsed?.kind !== "control" || parsed.connector !== connector)
|
|
102
|
+
continue;
|
|
103
|
+
const current = classifyControl(await deps.registry.read(entry.scope), hashes);
|
|
104
|
+
controls.set(parsed.ns, current);
|
|
105
|
+
if (current.kind === "active" || current.kind === "foreign")
|
|
106
|
+
pins.push({
|
|
107
|
+
ns: parsed.ns,
|
|
108
|
+
version: current.kind === "active" ? current.generation : current.version,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
const streams = [];
|
|
112
|
+
const listing = new Map();
|
|
113
|
+
for (const entry of await deps.registry.listStreamRows(connector)) {
|
|
114
|
+
const parsed = parseScope(entry.scope);
|
|
115
|
+
if (parsed?.kind === "stream" && parsed.connector === connector) {
|
|
116
|
+
listing.set(entry.scope, { ...entry.read });
|
|
117
|
+
streams.push({
|
|
118
|
+
ns: parsed.ns,
|
|
119
|
+
stream: parsed.stream,
|
|
120
|
+
control: controls.get(parsed.ns) ?? { kind: "absent" },
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const empty = pins.length === 0 && streams.length === 0;
|
|
125
|
+
if (!empty) {
|
|
126
|
+
const declared = new Set([
|
|
127
|
+
...options.declaredStreams(connector),
|
|
128
|
+
...manifestStreamLister(options.retainedManifests?.() ?? [])(connector),
|
|
129
|
+
]);
|
|
130
|
+
if (declared.size === 0 && streams.length === 0)
|
|
131
|
+
throw new ConnectorNotVerifiedError(connector);
|
|
132
|
+
for (const name of declared)
|
|
133
|
+
if (!streams.some((s) => s.ns === "" && s.stream === name))
|
|
134
|
+
streams.push({
|
|
135
|
+
ns: "",
|
|
136
|
+
stream: name,
|
|
137
|
+
control: controls.get("") ?? { kind: "absent" },
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return { intent: { id: deps.newOp(), pins, streams }, empty, listing };
|
|
141
|
+
}
|
|
142
|
+
function samePlan(a, b) {
|
|
143
|
+
return (a.pins.length === b.pins.length &&
|
|
144
|
+
a.pins.every((p) => b.pins.some((q) => q.ns === p.ns && q.version === p.version)) &&
|
|
145
|
+
a.streams?.length === b.streams?.length &&
|
|
146
|
+
(a.streams ?? []).every((p) => b.streams?.some((q) => p.ns === q.ns &&
|
|
147
|
+
p.stream === q.stream &&
|
|
148
|
+
(p.control && q.control ? sameControl(p.control, q.control) : true))));
|
|
149
|
+
}
|
|
150
|
+
async function purgeLocal(connector, intent) {
|
|
151
|
+
const connections = await deps.db.query("SELECT connection_id,ns,generation,control_version FROM connections WHERE connector=?", [connector]);
|
|
152
|
+
for (const connection of connections) {
|
|
153
|
+
const pin = intent.pins.find((p) => p.ns === connection.ns);
|
|
154
|
+
if (pin && connection.generation > pin.version)
|
|
155
|
+
continue;
|
|
156
|
+
await deps.queue.run(connection.connection_id, "purge", async () => {
|
|
157
|
+
const [current] = await deps.db.query("SELECT generation FROM connections WHERE connection_id=?", [connection.connection_id]);
|
|
158
|
+
if (pin && current && current.generation > pin.version)
|
|
159
|
+
return;
|
|
160
|
+
const nested = {
|
|
161
|
+
...deps,
|
|
162
|
+
queue: {
|
|
163
|
+
run: (id, kind, work) => id === connection.connection_id
|
|
164
|
+
? work()
|
|
165
|
+
: deps.queue.run(id, kind, work),
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
await purgeConnection(nested, connection.connection_id, {
|
|
169
|
+
controlVersion: pin ? pin.version + 1 : connection.control_version,
|
|
170
|
+
});
|
|
171
|
+
await deps.db.batch([
|
|
172
|
+
{
|
|
173
|
+
sql: "UPDATE run_streams SET decision='discarded',reason='control_deleted',replace=0 WHERE run_id IN (SELECT run_id FROM runs WHERE connection_id=?)",
|
|
174
|
+
params: [connection.connection_id],
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
sql: "UPDATE runs SET state='ended' WHERE connection_id=?",
|
|
178
|
+
params: [connection.connection_id],
|
|
179
|
+
},
|
|
180
|
+
]);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
const sign = (scope, dataHash, metadataHash, version) => deps.signer.signAddData({
|
|
185
|
+
ownerAddress: deps.ownerAddress,
|
|
186
|
+
scope,
|
|
187
|
+
dataHash,
|
|
188
|
+
metadataHash,
|
|
189
|
+
expectedVersion: BigInt(version),
|
|
190
|
+
});
|
|
191
|
+
async function signPost(scope, dataHash, metadataHash, version) {
|
|
192
|
+
const signature = await sign(scope, dataHash, metadataHash, version);
|
|
193
|
+
return deps.registry.post({
|
|
194
|
+
ownerAddress: deps.ownerAddress,
|
|
195
|
+
scope,
|
|
196
|
+
dataHash,
|
|
197
|
+
metadataHash,
|
|
198
|
+
expectedVersion: String(version),
|
|
199
|
+
signature,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Land the control tombstone of one namespace: the delete's single
|
|
204
|
+
* linearization point. Other surfaces read the control row to decide the
|
|
205
|
+
* connection exists, and the gateway checks it in the transaction of every
|
|
206
|
+
* publish, so once it is tombstoned no publish of the ended lifetime lands.
|
|
207
|
+
*
|
|
208
|
+
* The post is a CAS at `pin + 1`, sent blind and then confirmed by a read:
|
|
209
|
+
* a lost reply, a reply that never arrives, a conflict and a registry that
|
|
210
|
+
* lags all end in the same read. Any control version at or above the
|
|
211
|
+
* tombstone's proves it landed, whoever wrote it (it may already have been
|
|
212
|
+
* followed by a reconnect), so a fence never lands twice (a retry resends the
|
|
213
|
+
* same `pin + 1`, and the registry refuses it) and is never judged
|
|
214
|
+
* "superseded".
|
|
215
|
+
*/
|
|
216
|
+
async function landFence(connector, pin, hashes) {
|
|
217
|
+
const scope = controlScope(connector, pin.ns);
|
|
218
|
+
const landed = async () => {
|
|
219
|
+
const after = classifyControl(await deps.registry.read(scope), hashes);
|
|
220
|
+
return after.kind === "deleted"
|
|
221
|
+
? after.version >= pin.version + 1
|
|
222
|
+
: after.kind === "active" && after.generation > pin.version;
|
|
223
|
+
};
|
|
224
|
+
try {
|
|
225
|
+
await signPost(scope, hashes.tombstoneData, hashes.tombstoneMetadata, pin.version + 1);
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
if (!(error instanceof RegistryRefusedError && error.status === 409)) {
|
|
229
|
+
// Uncertain: the tombstone may have committed and only its reply
|
|
230
|
+
// been lost. A read decides, so a registry that now refuses every
|
|
231
|
+
// post but still answers reads does not hold the delete pending.
|
|
232
|
+
// When the read cannot prove the fence either, the failure stands.
|
|
233
|
+
if (await landed().catch(() => false))
|
|
234
|
+
return;
|
|
235
|
+
throw error;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (!(await landed()))
|
|
239
|
+
throw new Error("control fence pending without confirmed tombstone");
|
|
240
|
+
}
|
|
241
|
+
/** Wait for every promise; throw the first failure, a supersession only if nothing else failed. */
|
|
242
|
+
async function settleAll(work) {
|
|
243
|
+
const results = await Promise.allSettled(work);
|
|
244
|
+
const failures = results.flatMap((r) => r.status === "rejected" ? [r.reason] : []);
|
|
245
|
+
const real = failures.find((e) => !(e instanceof ConnectionDeleteSuperseded));
|
|
246
|
+
if (real !== undefined)
|
|
247
|
+
throw real;
|
|
248
|
+
if (failures.length > 0)
|
|
249
|
+
throw failures[0];
|
|
250
|
+
}
|
|
251
|
+
async function land(connector, fencePhaseEnded) {
|
|
252
|
+
const stored = await readIntent(connector);
|
|
253
|
+
if (!stored) {
|
|
254
|
+
fencePhaseEnded(true);
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
let intent = stored;
|
|
258
|
+
const { keyCheck, hashes } = await keyInfo();
|
|
259
|
+
const listed = listings.get(stored.id);
|
|
260
|
+
listings.delete(stored.id);
|
|
261
|
+
// One observation of a namespace's control row serves every stream of the
|
|
262
|
+
// landing that is not fenced. A rejected write drops it: the next attempt
|
|
263
|
+
// looks again.
|
|
264
|
+
const controlSeen = new Map();
|
|
265
|
+
const observeControl = (ns) => {
|
|
266
|
+
let seen = controlSeen.get(ns);
|
|
267
|
+
if (!seen) {
|
|
268
|
+
seen = deps.registry
|
|
269
|
+
.read(controlScope(connector, ns))
|
|
270
|
+
.then((read) => classifyControl(read, hashes));
|
|
271
|
+
seen.catch(() => controlSeen.delete(ns));
|
|
272
|
+
controlSeen.set(ns, seen);
|
|
273
|
+
}
|
|
274
|
+
return seen;
|
|
275
|
+
};
|
|
276
|
+
// Streams are cleaned in parallel and each saves its own pin, so saves
|
|
277
|
+
// run in the order the intent changed.
|
|
278
|
+
let saved = Promise.resolve();
|
|
279
|
+
const persist = (change) => {
|
|
280
|
+
const next = change(intent);
|
|
281
|
+
intent = next;
|
|
282
|
+
saved = saved.then(() => save(connector, next));
|
|
283
|
+
return saved;
|
|
284
|
+
};
|
|
285
|
+
const fencedAt = (ns) => {
|
|
286
|
+
const fence = intent.fences?.find((f) => f.ns === ns);
|
|
287
|
+
return fence && intent.pins.find((p) => p.ns === ns)?.version;
|
|
288
|
+
};
|
|
289
|
+
/**
|
|
290
|
+
* One stream's tombstone. Under a fence the stream is cleaned against the
|
|
291
|
+
* lifetime the fence ended (`ended`), not against the control row, which
|
|
292
|
+
* has since been tombstoned and may have been reconnected: the row is
|
|
293
|
+
* tombstoned only when it holds data of that lifetime or an earlier one,
|
|
294
|
+
* and a row of a later lifetime is left as it is. Without a fence the
|
|
295
|
+
* control row must still be the one the plan saw.
|
|
296
|
+
*/
|
|
297
|
+
async function cleanStream(connector, target, hashes, keyCheck,
|
|
298
|
+
/**
|
|
299
|
+
* The first tombstone goes through the landing's batch request, with the
|
|
300
|
+
* fence of `ended` in the same commit or an earlier one (see
|
|
301
|
+
* delete-batch.ts). It then needs no lifetime proof of its own: the
|
|
302
|
+
* request's condition holds the control row at that fence.
|
|
303
|
+
*/
|
|
304
|
+
batched) {
|
|
305
|
+
const scope = streamScope(connector, target.ns, target.stream);
|
|
306
|
+
// The listed row serves the first attempt of this stream only: a retry,
|
|
307
|
+
// or the per-stream path after a batch, reads the registry.
|
|
308
|
+
let hint = listed?.get(scope);
|
|
309
|
+
listed?.delete(scope);
|
|
310
|
+
let finished = false;
|
|
311
|
+
let signedPin = target.pin;
|
|
312
|
+
// A rejected CAS spends one of ATTEMPTS, and so does a landed CAS that
|
|
313
|
+
// the next read no longer shows. A landed CAS the next read confirms
|
|
314
|
+
// is free: confirming it must not consume the attempt that won.
|
|
315
|
+
let spent = 0;
|
|
316
|
+
let landed = false;
|
|
317
|
+
for (;;) {
|
|
318
|
+
const row = hint ?? (await deps.registry.read(scope));
|
|
319
|
+
hint = undefined;
|
|
320
|
+
const ended = batched ? batched.ended : fencedAt(target.ns);
|
|
321
|
+
// Fenced: the lifetime this delete ended, as the control row said
|
|
322
|
+
// before the fence. Otherwise the control row now.
|
|
323
|
+
const now = ended !== undefined
|
|
324
|
+
? { kind: "active", generation: ended }
|
|
325
|
+
: await observeControl(target.ns);
|
|
326
|
+
if (ended === undefined) {
|
|
327
|
+
const pin = intent.pins.find((p) => p.ns === target.ns);
|
|
328
|
+
const holds = target.control
|
|
329
|
+
? sameControl(now, target.control)
|
|
330
|
+
: pin
|
|
331
|
+
? (now.kind === "active"
|
|
332
|
+
? now.generation
|
|
333
|
+
: now.kind === "foreign"
|
|
334
|
+
? now.version
|
|
335
|
+
: -1) === pin.version
|
|
336
|
+
: now.kind === "absent";
|
|
337
|
+
if (!holds)
|
|
338
|
+
throw new ConnectionDeleteSuperseded(connector);
|
|
339
|
+
}
|
|
340
|
+
// A completed delete already fences this lifetime. Keep its row,
|
|
341
|
+
// including its version and hashes, even on a device with no local state.
|
|
342
|
+
if (now.kind === "deleted" &&
|
|
343
|
+
row.found &&
|
|
344
|
+
deleteEndedEarlierLifetime(scope, row, now.version)) {
|
|
345
|
+
finished = true;
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
if (now.kind === "foreign")
|
|
349
|
+
throw new Error("stream delete pending without ended generation proof");
|
|
350
|
+
// A deleted control at v fences every active generation <= v.
|
|
351
|
+
// Use v as a conservative boundary when the old marker has lost
|
|
352
|
+
// its proof: reconnect must create active(v+1). This does not
|
|
353
|
+
// infer a lost active generation or weaken the reader's rule.
|
|
354
|
+
// With no control, the first lifetime is generation 1, matching
|
|
355
|
+
// the empty delete head, so the legacy v1 marker remains usable.
|
|
356
|
+
const endedGeneration = now.kind === "active"
|
|
357
|
+
? now.generation
|
|
358
|
+
: now.kind === "deleted"
|
|
359
|
+
? now.version
|
|
360
|
+
: undefined;
|
|
361
|
+
// With a known lifetime, only its v2 metadata proves the boundary.
|
|
362
|
+
// A tombstoned row or a head fence cannot substitute for that proof.
|
|
363
|
+
const marked = (version, hash) => (now.kind === "absent" &&
|
|
364
|
+
hash.toLowerCase() === deleteMetadataHash(scope, version)) ||
|
|
365
|
+
(endedGeneration !== undefined &&
|
|
366
|
+
hash.toLowerCase() ===
|
|
367
|
+
endedGenerationDeleteMetadataHash(scope, version, endedGeneration));
|
|
368
|
+
let lastDelete = row.found &&
|
|
369
|
+
((now.kind === "absent" &&
|
|
370
|
+
classifyStreamRow(row, hashes) === "tombstoned") ||
|
|
371
|
+
marked(row.version, row.metadataHash))
|
|
372
|
+
? row.version
|
|
373
|
+
: 0;
|
|
374
|
+
if (now.kind === "absent" &&
|
|
375
|
+
row.found &&
|
|
376
|
+
lastDelete === 0 &&
|
|
377
|
+
signedPin !== undefined) {
|
|
378
|
+
try {
|
|
379
|
+
const cipher = await deps.blobs.get(`${scope}/${headBlobName(row.dataHash)}`);
|
|
380
|
+
if (cipher) {
|
|
381
|
+
const verified = await verifyHead(keccak, await deps.keys.decrypt(scope, cipher), {
|
|
382
|
+
dataHash: row.dataHash,
|
|
383
|
+
connector,
|
|
384
|
+
ns: target.ns,
|
|
385
|
+
stream: target.stream,
|
|
386
|
+
keyCheck,
|
|
387
|
+
});
|
|
388
|
+
if (verified.kind === "ok")
|
|
389
|
+
lastDelete = verified.head.lastDeleteVersion ?? 0;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
catch {
|
|
393
|
+
// Deleting requires the control pin and CAS, never a readable old head.
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
if (signedPin === undefined ? lastDelete > 0 : lastDelete >= signedPin) {
|
|
397
|
+
finished = true;
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
if (landed)
|
|
401
|
+
spent++;
|
|
402
|
+
if (spent >= ATTEMPTS)
|
|
403
|
+
break;
|
|
404
|
+
const version = row.found ? row.version + 1 : 1;
|
|
405
|
+
const observedAt = deps.now();
|
|
406
|
+
const head = encodeHead({
|
|
407
|
+
format: HEAD_FORMAT,
|
|
408
|
+
connector,
|
|
409
|
+
ns: target.ns,
|
|
410
|
+
stream: target.stream,
|
|
411
|
+
generation: 1,
|
|
412
|
+
keyCheck,
|
|
413
|
+
lastDeleteVersion: version,
|
|
414
|
+
complete: false,
|
|
415
|
+
observedAt,
|
|
416
|
+
replacedAt: observedAt,
|
|
417
|
+
parts: [],
|
|
418
|
+
primaryKey: ["id"],
|
|
419
|
+
profile: { key: null, version: "0.0.0" },
|
|
420
|
+
recordCount: 0,
|
|
421
|
+
});
|
|
422
|
+
const digest = await digestHead(keccak, head);
|
|
423
|
+
// Under a fence, the row must hold nothing newer than the ended
|
|
424
|
+
// lifetime before it is tombstoned. The check runs beside the head
|
|
425
|
+
// upload (a head blob is content-addressed and harmless if unused).
|
|
426
|
+
const oldDataOnly = ended !== undefined &&
|
|
427
|
+
!batched &&
|
|
428
|
+
row.found &&
|
|
429
|
+
classifyStreamRow(row, hashes) !== "tombstoned"
|
|
430
|
+
? holdsEndedLifetimeOnly(connector, target, row, ended, hashes, keyCheck)
|
|
431
|
+
: Promise.resolve(true);
|
|
432
|
+
const [olderOnly] = await Promise.all([
|
|
433
|
+
oldDataOnly,
|
|
434
|
+
deps.keys
|
|
435
|
+
.encrypt(scope, head)
|
|
436
|
+
.then((cipher) => deps.blobs.put(`${scope}/${digest.blobName}`, cipher)),
|
|
437
|
+
]);
|
|
438
|
+
if (!olderOnly) {
|
|
439
|
+
// A later lifetime owns this row. It is not this delete's to remove.
|
|
440
|
+
finished = true;
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
await persist((current) => ({
|
|
444
|
+
...current,
|
|
445
|
+
streams: current.streams.map((p) => p.ns === target.ns && p.stream === target.stream
|
|
446
|
+
? { ...p, pin: version }
|
|
447
|
+
: p),
|
|
448
|
+
}));
|
|
449
|
+
let conflict = false;
|
|
450
|
+
const metadataHash = endedGeneration === undefined
|
|
451
|
+
? deleteMetadataHash(scope, version)
|
|
452
|
+
: endedGenerationDeleteMetadataHash(scope, version, endedGeneration);
|
|
453
|
+
if (batched) {
|
|
454
|
+
// One shot: a lost compare-and-set, a failed condition or a missing
|
|
455
|
+
// batch route all end it, and the per-stream path takes over.
|
|
456
|
+
const turn = await batched.batcher.submit({
|
|
457
|
+
scope,
|
|
458
|
+
dataHash: digest.dataHash,
|
|
459
|
+
metadataHash,
|
|
460
|
+
expectedVersion: String(version),
|
|
461
|
+
signature: await sign(scope, digest.dataHash, metadataHash, version),
|
|
462
|
+
...(row.found && {
|
|
463
|
+
expectedHeadDataHash: row.dataHash,
|
|
464
|
+
}),
|
|
465
|
+
}, { ns: target.ns, fence: false });
|
|
466
|
+
if (turn === "fallback")
|
|
467
|
+
throw new BatchFellBack();
|
|
468
|
+
finished = true;
|
|
469
|
+
break;
|
|
470
|
+
}
|
|
471
|
+
try {
|
|
472
|
+
conflict =
|
|
473
|
+
(await signPost(scope, digest.dataHash, metadataHash, version))
|
|
474
|
+
.kind === "conflict";
|
|
475
|
+
}
|
|
476
|
+
catch (error) {
|
|
477
|
+
if (!(error instanceof RegistryRefusedError && error.status === 409))
|
|
478
|
+
throw error;
|
|
479
|
+
conflict = true;
|
|
480
|
+
}
|
|
481
|
+
if (conflict) {
|
|
482
|
+
controlSeen.delete(target.ns);
|
|
483
|
+
await new Promise((resolve) => setTimeout(resolve, Math.min(10 * 2 ** spent, 1000)));
|
|
484
|
+
spent++;
|
|
485
|
+
}
|
|
486
|
+
landed = !conflict;
|
|
487
|
+
// The next authoritative read proves whether this pin landed.
|
|
488
|
+
signedPin = version;
|
|
489
|
+
}
|
|
490
|
+
if (!finished)
|
|
491
|
+
throw new Error("stream delete pending after version conflicts");
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Whether a live stream row holds data of the ended lifetime (`ended`) or
|
|
495
|
+
* an earlier one only. `row` was read before this runs.
|
|
496
|
+
*
|
|
497
|
+
* While the control row still reads exactly the fence (deleted at
|
|
498
|
+
* `ended + 1`), no later lifetime exists, and none can have published
|
|
499
|
+
* before this read: a publish needs an active control row of its own
|
|
500
|
+
* generation. Otherwise the control row has moved (a reconnect), and the
|
|
501
|
+
* head's own generation says which lifetime wrote the row. A head that
|
|
502
|
+
* cannot be read then leaves the question open, and the delete stays
|
|
503
|
+
* pending rather than guess.
|
|
504
|
+
*/
|
|
505
|
+
async function holdsEndedLifetimeOnly(connector, target, row, ended, hashes, keyCheck) {
|
|
506
|
+
const control = classifyControl(await deps.registry.read(controlScope(connector, target.ns)), hashes);
|
|
507
|
+
if (control.kind === "deleted" && control.version === ended + 1)
|
|
508
|
+
return true;
|
|
509
|
+
const scope = streamScope(connector, target.ns, target.stream);
|
|
510
|
+
const cipher = await deps.blobs.get(`${scope}/${headBlobName(row.dataHash)}`);
|
|
511
|
+
if (cipher) {
|
|
512
|
+
const verified = await verifyHead(keccak, await deps.keys.decrypt(scope, cipher), {
|
|
513
|
+
dataHash: row.dataHash,
|
|
514
|
+
connector,
|
|
515
|
+
ns: target.ns,
|
|
516
|
+
stream: target.stream,
|
|
517
|
+
keyCheck,
|
|
518
|
+
});
|
|
519
|
+
if (verified.kind === "ok")
|
|
520
|
+
return verified.head.generation <= ended;
|
|
521
|
+
}
|
|
522
|
+
throw new Error("stream delete pending: the lifetime of the stream's head is unproven");
|
|
523
|
+
}
|
|
524
|
+
try {
|
|
525
|
+
// Phase 1, the fence. A control row of another key is not tombstoned
|
|
526
|
+
// here: its streams cannot be proven and stay pending as before.
|
|
527
|
+
const foreign = new Set((intent.streams ?? [])
|
|
528
|
+
.filter((s) => s.control?.kind === "foreign")
|
|
529
|
+
.map((s) => s.ns));
|
|
530
|
+
const settledByBatch = new Set();
|
|
531
|
+
const unfencedPins = intent.pins.filter((p) => fencedAt(p.ns) === undefined && !foreign.has(p.ns));
|
|
532
|
+
if (unfencedPins.length > 0 &&
|
|
533
|
+
!batchOff &&
|
|
534
|
+
deps.registry.postBatch !== undefined) {
|
|
535
|
+
// The first landing: each unfenced namespace's fence and its streams'
|
|
536
|
+
// tombstones in one batch request. Whatever it does not write is left
|
|
537
|
+
// for the per-stream path below, which re-reads before it writes.
|
|
538
|
+
const pins = new Map(unfencedPins.map((p) => [p.ns, p.version]));
|
|
539
|
+
const streams = (intent.streams ?? []).filter((s) => !intent.streamsLanded && pins.has(s.ns));
|
|
540
|
+
const batcher = createDeleteBatcher({
|
|
541
|
+
registry: deps.registry,
|
|
542
|
+
ownerAddress: deps.ownerAddress,
|
|
543
|
+
controlScopeOf: (ns) => controlScope(connector, ns),
|
|
544
|
+
pins,
|
|
545
|
+
hashes,
|
|
546
|
+
participants: unfencedPins.length + streams.length,
|
|
547
|
+
onUnusable: () => {
|
|
548
|
+
batchOff = true;
|
|
549
|
+
},
|
|
550
|
+
});
|
|
551
|
+
/** Each participant sends one row or leaves, whatever else happens. */
|
|
552
|
+
const participate = async (work) => {
|
|
553
|
+
let sent = false;
|
|
554
|
+
try {
|
|
555
|
+
await work({
|
|
556
|
+
submit: (row, part) => {
|
|
557
|
+
sent = true;
|
|
558
|
+
return batcher.submit(row, part);
|
|
559
|
+
},
|
|
560
|
+
leave: () => {
|
|
561
|
+
sent = true;
|
|
562
|
+
batcher.leave();
|
|
563
|
+
},
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
catch (error) {
|
|
567
|
+
if (!(error instanceof BatchFellBack))
|
|
568
|
+
throw error;
|
|
569
|
+
}
|
|
570
|
+
finally {
|
|
571
|
+
if (!sent)
|
|
572
|
+
batcher.leave();
|
|
573
|
+
}
|
|
574
|
+
};
|
|
575
|
+
const fences = Promise.all(unfencedPins.map((pin) => participate(async (own) => {
|
|
576
|
+
const scope = controlScope(connector, pin.ns);
|
|
577
|
+
const turn = await own.submit({
|
|
578
|
+
scope,
|
|
579
|
+
dataHash: hashes.tombstoneData,
|
|
580
|
+
metadataHash: hashes.tombstoneMetadata,
|
|
581
|
+
expectedVersion: String(pin.version + 1),
|
|
582
|
+
signature: await sign(scope, hashes.tombstoneData, hashes.tombstoneMetadata, pin.version + 1),
|
|
583
|
+
}, { ns: pin.ns, fence: true });
|
|
584
|
+
if (turn === "fallback")
|
|
585
|
+
return;
|
|
586
|
+
await persist((current) => ({
|
|
587
|
+
...current,
|
|
588
|
+
fences: [
|
|
589
|
+
...(current.fences ?? []),
|
|
590
|
+
{ ns: pin.ns, version: pin.version + 1 },
|
|
591
|
+
],
|
|
592
|
+
}));
|
|
593
|
+
})));
|
|
594
|
+
// The request waits for the fences, not for the rest.
|
|
595
|
+
void fences.then(() => {
|
|
596
|
+
if (intent.pins.every((p) => fencedAt(p.ns) !== undefined))
|
|
597
|
+
fencePhaseEnded(true);
|
|
598
|
+
}, () => undefined);
|
|
599
|
+
await settleAll([
|
|
600
|
+
fences,
|
|
601
|
+
...streams.map((target) => participate(async (own) => {
|
|
602
|
+
await cleanStream(connector, target, hashes, keyCheck, {
|
|
603
|
+
batcher: own,
|
|
604
|
+
ended: pins.get(target.ns),
|
|
605
|
+
});
|
|
606
|
+
settledByBatch.add(`${target.ns}\0${target.stream}`);
|
|
607
|
+
})),
|
|
608
|
+
]);
|
|
609
|
+
}
|
|
610
|
+
await settleAll(intent.pins
|
|
611
|
+
.filter((p) => fencedAt(p.ns) === undefined && !foreign.has(p.ns))
|
|
612
|
+
.map(async (pin) => {
|
|
613
|
+
await landFence(connector, pin, hashes);
|
|
614
|
+
await persist((current) => ({
|
|
615
|
+
...current,
|
|
616
|
+
fences: [
|
|
617
|
+
...(current.fences ?? []),
|
|
618
|
+
{ ns: pin.ns, version: pin.version + 1 },
|
|
619
|
+
],
|
|
620
|
+
}));
|
|
621
|
+
}));
|
|
622
|
+
const unfenced = () => intent.pins.filter((p) => fencedAt(p.ns) === undefined);
|
|
623
|
+
fencePhaseEnded(unfenced().length === 0);
|
|
624
|
+
// Phase 2, cleanup. Each stream is its own scope with its own CAS, so
|
|
625
|
+
// streams do not wait for one another.
|
|
626
|
+
if (!intent.streamsLanded) {
|
|
627
|
+
await settleAll((intent.streams ?? [])
|
|
628
|
+
.filter((t) => !settledByBatch.has(`${t.ns}\0${t.stream}`))
|
|
629
|
+
.map((target) => cleanStream(connector, target, hashes, keyCheck)));
|
|
630
|
+
await persist((current) => ({ ...current, streamsLanded: true }));
|
|
631
|
+
}
|
|
632
|
+
// Control rows that no fence covered (another key's): the old order.
|
|
633
|
+
for (const pin of unfenced()) {
|
|
634
|
+
const scope = controlScope(connector, pin.ns);
|
|
635
|
+
try {
|
|
636
|
+
await signPost(scope, hashes.tombstoneData, hashes.tombstoneMetadata, pin.version + 1);
|
|
637
|
+
}
|
|
638
|
+
catch (error) {
|
|
639
|
+
if (!(error instanceof RegistryRefusedError && error.status === 409))
|
|
640
|
+
throw error;
|
|
641
|
+
}
|
|
642
|
+
const after = classifyControl(await deps.registry.read(scope), hashes);
|
|
643
|
+
if (after.kind !== "deleted") {
|
|
644
|
+
if (after.kind === "absent" ||
|
|
645
|
+
(after.kind === "active" && after.generation <= pin.version))
|
|
646
|
+
throw new Error("control delete pending without confirmed tombstone");
|
|
647
|
+
throw new ConnectionDeleteSuperseded(connector);
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
await saved;
|
|
651
|
+
await purgeLocal(connector, intent);
|
|
652
|
+
await options.eraseLegacy?.(connector);
|
|
653
|
+
await clear(connector, intent.id);
|
|
654
|
+
}
|
|
655
|
+
catch (error) {
|
|
656
|
+
await saved.catch(() => undefined);
|
|
657
|
+
if (error instanceof ConnectionDeleteSuperseded)
|
|
658
|
+
await clear(connector, intent.id);
|
|
659
|
+
throw error;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
function schedule(connector) {
|
|
663
|
+
const held = flights.get(connector);
|
|
664
|
+
if (held)
|
|
665
|
+
return held;
|
|
666
|
+
let fencePhaseEnded;
|
|
667
|
+
const fenced = new Promise((resolve) => (fencePhaseEnded = resolve));
|
|
668
|
+
const done = deps.queue
|
|
669
|
+
.run(`delete:${connector}`, "purge", () => land(connector, fencePhaseEnded))
|
|
670
|
+
.finally(() => {
|
|
671
|
+
fencePhaseEnded(false); // a landing that failed before its fence says "not fenced"
|
|
672
|
+
if (flights.get(connector) === landing)
|
|
673
|
+
flights.delete(connector);
|
|
674
|
+
});
|
|
675
|
+
const landing = { fenced, done };
|
|
676
|
+
flights.set(connector, landing);
|
|
677
|
+
return landing;
|
|
678
|
+
}
|
|
679
|
+
return {
|
|
680
|
+
async requestConnectionDelete(connector) {
|
|
681
|
+
controlScope(connector, "");
|
|
682
|
+
const intent = await deps.queue.run(`delete:${connector}`, "purge", async () => {
|
|
683
|
+
const open = await readIntent(connector);
|
|
684
|
+
let planned;
|
|
685
|
+
try {
|
|
686
|
+
planned = await plan(connector);
|
|
687
|
+
}
|
|
688
|
+
catch (error) {
|
|
689
|
+
if (open && error instanceof ConnectorNotVerifiedError)
|
|
690
|
+
return open;
|
|
691
|
+
throw error;
|
|
692
|
+
}
|
|
693
|
+
if (open && (planned.empty || samePlan(open, planned.intent)))
|
|
694
|
+
return open;
|
|
695
|
+
if (planned.empty) {
|
|
696
|
+
await purgeLocal(connector, planned.intent);
|
|
697
|
+
await options.eraseLegacy?.(connector);
|
|
698
|
+
return null;
|
|
699
|
+
}
|
|
700
|
+
await save(connector, planned.intent);
|
|
701
|
+
listings.set(planned.intent.id, planned.listing);
|
|
702
|
+
await purgeLocal(connector, planned.intent);
|
|
703
|
+
return planned.intent;
|
|
704
|
+
});
|
|
705
|
+
if (!intent)
|
|
706
|
+
return { deleteId: deps.newOp(), fenced: true };
|
|
707
|
+
const landing = schedule(connector);
|
|
708
|
+
landing.done.catch((error) => deps.logger.warn({ connector, reason: error instanceof Error ? error.name : "Error" }, "connection delete pending"));
|
|
709
|
+
// The request waits for the fence only: one registry write and its
|
|
710
|
+
// confirming read. Cleanup keeps running after the answer. A registry
|
|
711
|
+
// that is slower than the budget answers "not fenced yet"; the landing
|
|
712
|
+
// is not cancelled and the resume loop re-checks it.
|
|
713
|
+
return {
|
|
714
|
+
deleteId: intent.id,
|
|
715
|
+
fenced: await withinBudget(landing.fenced, options.fenceWaitMs),
|
|
716
|
+
};
|
|
717
|
+
},
|
|
718
|
+
async resumeDeletes() {
|
|
719
|
+
const rows = await deps.db.query("SELECT connector FROM delete_intents ORDER BY connector");
|
|
720
|
+
const pending = [];
|
|
721
|
+
for (const { connector } of rows) {
|
|
722
|
+
try {
|
|
723
|
+
await schedule(connector).done;
|
|
724
|
+
}
|
|
725
|
+
catch (error) {
|
|
726
|
+
pending.push({
|
|
727
|
+
connector,
|
|
728
|
+
why: error instanceof Error ? error.name : "Error",
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
return pending;
|
|
733
|
+
},
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
//# sourceMappingURL=delete.js.map
|