@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,1044 @@
|
|
|
1
|
+
import { compareLegacyCoverage, } from "./legacy-scope-coverage.js";
|
|
2
|
+
import { LEGACY_SCOPE_ENTITY_KEYS } from "./legacy-scope-entity-keys.js";
|
|
3
|
+
import { OURA_BROWSER_HISTORY_POLICY } from "../oura/history-policy.js";
|
|
4
|
+
import { ANTHROPIC_LIVE_BINDINGS, GITHUB_BROWSER_BINDINGS, LEGACY_SCOPE_BINDINGS, legacyBindingsForProfile, META_040_BINDINGS, OURA_BROWSER_BINDINGS, STRAVA_BROWSER_BINDINGS, } from "../legacy-projection/index.js";
|
|
5
|
+
import { legacyConnectorKey, readCanonicalLegacyScope, CANONICAL_LEGACY_VIEW_CONTRACT, } from "./canonical-legacy-projection.js";
|
|
6
|
+
/**
|
|
7
|
+
* Decides, per legacy scope, whether the latest body comes from the
|
|
8
|
+
* canonical rows or from the existing legacy file, and reads it.
|
|
9
|
+
*
|
|
10
|
+
* Only a bound scope can move. Its binding names the connector key it was
|
|
11
|
+
* reviewed for (`oura`, `oura-browser`, `github-browser`, `meta`, ...), and
|
|
12
|
+
* that key is the method id a connection is registered with: the operator's
|
|
13
|
+
* trusted method configuration names methods the same way. The store source
|
|
14
|
+
* id is never derived from the key; it is the connection's registered
|
|
15
|
+
* source, and that (source, method) pair must be configured on this boot.
|
|
16
|
+
*
|
|
17
|
+
* A bound scope is canonical-owned for write/refusal safety when a connection
|
|
18
|
+
* of one of its methods has held a row of, or a completion receipt for, one
|
|
19
|
+
* of the scope's streams, or was reset or deleted (both erase the rows that
|
|
20
|
+
* would show this). With a stored legacy head, the first eligible GET checks
|
|
21
|
+
* the projected body against the latest legacy body and records the verdict.
|
|
22
|
+
* A newer legacy version is checked again; a mismatch explicitly returns
|
|
23
|
+
* that file. A regression against an already covered version refuses.
|
|
24
|
+
* Every other scope, unbound ones included, keeps the file.
|
|
25
|
+
*
|
|
26
|
+
* The connection comes only from the registry: the single live connection
|
|
27
|
+
* of the scope's methods that has held any data. A request cannot name one.
|
|
28
|
+
*/
|
|
29
|
+
/** Every declaration profile the pure module serves a scope from. */
|
|
30
|
+
const BINDING_PROFILES = [
|
|
31
|
+
LEGACY_SCOPE_BINDINGS,
|
|
32
|
+
ANTHROPIC_LIVE_BINDINGS,
|
|
33
|
+
GITHUB_BROWSER_BINDINGS,
|
|
34
|
+
META_040_BINDINGS,
|
|
35
|
+
OURA_BROWSER_BINDINGS,
|
|
36
|
+
STRAVA_BROWSER_BINDINGS,
|
|
37
|
+
];
|
|
38
|
+
// Invalidate persisted witnesses created before completion-horizon fencing.
|
|
39
|
+
const COVERAGE_RULE_VERSION = 11;
|
|
40
|
+
const OURA_RUN_STREAMS = ["sleep", "readiness", "activity"];
|
|
41
|
+
/** Live Claude omits some account metadata. Preserve known fields from the
|
|
42
|
+
* same organization's saved head; never borrow entities or another identity. */
|
|
43
|
+
async function retainClaudeProfile(read, legacy) {
|
|
44
|
+
const current = read.envelope.data;
|
|
45
|
+
const previous = legacy.data;
|
|
46
|
+
if (current.source !== "live-session" ||
|
|
47
|
+
typeof current.organizationId !== "string" ||
|
|
48
|
+
current.organizationId !== previous.organizationId)
|
|
49
|
+
return;
|
|
50
|
+
const isObject = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
51
|
+
if (!isObject(current.profile) || !isObject(previous.profile))
|
|
52
|
+
return;
|
|
53
|
+
const profile = { ...current.profile };
|
|
54
|
+
let retained = false;
|
|
55
|
+
for (const field of ["name", "plan"]) {
|
|
56
|
+
if (profile[field] === null &&
|
|
57
|
+
typeof previous.profile[field] === "string") {
|
|
58
|
+
profile[field] = previous.profile[field];
|
|
59
|
+
retained = true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (retained) {
|
|
63
|
+
read.envelope = { ...read.envelope, data: { ...current, profile } };
|
|
64
|
+
// The stored metadata contributes to the response even when live rows do not change.
|
|
65
|
+
const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(`${read.revision}:profile:${JSON.stringify(profile)}`));
|
|
66
|
+
read.revision = Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function scopeDeclarationCursor(scope) {
|
|
70
|
+
return JSON.stringify(BINDING_PROFILES.flatMap((profile) => [...profile.values()])
|
|
71
|
+
.filter((binding) => binding.scope === scope)
|
|
72
|
+
.map((binding) => ({
|
|
73
|
+
pdppSource: binding.pdppSource,
|
|
74
|
+
pdppStreams: binding.pdppStreams,
|
|
75
|
+
primaryKey: binding.primaryKey,
|
|
76
|
+
fieldsRead: binding.fieldsRead,
|
|
77
|
+
provenance: binding.provenance,
|
|
78
|
+
})));
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The deletion history of a body, decided with the body. Callers never
|
|
82
|
+
* recompute it from later ownership state.
|
|
83
|
+
*/
|
|
84
|
+
export function deletionHistoryOf(body) {
|
|
85
|
+
return body.kind === "file" ? body.deletion : "canonical";
|
|
86
|
+
}
|
|
87
|
+
export function createLegacyScopeView(input) {
|
|
88
|
+
const { authority, records } = input;
|
|
89
|
+
const coveredProjection = new Map();
|
|
90
|
+
/**
|
|
91
|
+
* The scope's methods, minus each opt-in method (`input.optInMethods`)
|
|
92
|
+
* while the legacy file is still the owner's latest body: an eligible
|
|
93
|
+
* legacy head and no takeover recorded for that method. Such a method never
|
|
94
|
+
* served this scope, so its deleted, reset or replaced connections are not
|
|
95
|
+
* ownership evidence: the file was the served body all along. A takeover
|
|
96
|
+
* another method earned (the PAT `oura` connection, say), or one that does
|
|
97
|
+
* not name its method, leaves it excluded. Once it has earned one, it
|
|
98
|
+
* serves, and deletion refuses, as for any other method.
|
|
99
|
+
*/
|
|
100
|
+
function withoutOptedOutMethods(scope) {
|
|
101
|
+
const methods = scopeMethods(scope);
|
|
102
|
+
const head = authority.eligibleLegacyHead(scope);
|
|
103
|
+
if (head === null)
|
|
104
|
+
return methods;
|
|
105
|
+
const gated = new Set([...optedOutMethods(scope)].filter((method) => !earnedTakeover(scope, method)));
|
|
106
|
+
if (gated.size === 0)
|
|
107
|
+
return methods;
|
|
108
|
+
reportKeptLegacyFile(scope, head, gated);
|
|
109
|
+
return new Map([...methods].filter(([method]) => !gated.has(method)));
|
|
110
|
+
}
|
|
111
|
+
function optedOutMethods(scope) {
|
|
112
|
+
const optIn = input.optInMethods;
|
|
113
|
+
if (!optIn || optIn.size === 0)
|
|
114
|
+
return [];
|
|
115
|
+
return [...scopeMethods(scope).keys()].filter((method) => optIn.has(method));
|
|
116
|
+
}
|
|
117
|
+
function earnedTakeover(scope, method) {
|
|
118
|
+
return authority.hasMethodTakeover(scope, method);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Deletion safety asks the ungated question: do connection rows exist that
|
|
122
|
+
* a legacy-only deletion would let appear? Where the gate keeps the file
|
|
123
|
+
* over an opted-out method, only live rows of that method count: a deleted,
|
|
124
|
+
* reset or replaced connection erased its rows, and a connection that never
|
|
125
|
+
* held data has none.
|
|
126
|
+
*/
|
|
127
|
+
function ownsScope(scope) {
|
|
128
|
+
if (decide(scope, false).kind === "file")
|
|
129
|
+
return false;
|
|
130
|
+
if (decide(scope).kind !== "file")
|
|
131
|
+
return true;
|
|
132
|
+
return authority
|
|
133
|
+
.listMethodConnections([...optedOutMethods(scope)])
|
|
134
|
+
.some((connection) => connection.deletedAt === null &&
|
|
135
|
+
authority.hasHeldData(connection.instance, null));
|
|
136
|
+
}
|
|
137
|
+
/** Decided with the body: connection rows serve the scope, or they do not. */
|
|
138
|
+
function deletionFor(decision) {
|
|
139
|
+
return decision.kind === "file" ? "file" : "canonical";
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* One line per (scope, legacy head, number of connections holding rows), so
|
|
143
|
+
* an operator can see a stalled collector keeping a fresh projection gated.
|
|
144
|
+
*/
|
|
145
|
+
const reportedKept = new Set();
|
|
146
|
+
function reportKeptLegacyFile(scope, head, optedOut) {
|
|
147
|
+
if (!input.logger)
|
|
148
|
+
return;
|
|
149
|
+
const held = authority
|
|
150
|
+
.listMethodConnections([...optedOut])
|
|
151
|
+
.filter((connection) => connection.deletedAt === null &&
|
|
152
|
+
authority.hasHeldData(connection.instance, null)).length;
|
|
153
|
+
if (held === 0)
|
|
154
|
+
return;
|
|
155
|
+
const key = `${scope}:${head.id}:${held}`;
|
|
156
|
+
if (reportedKept.has(key))
|
|
157
|
+
return;
|
|
158
|
+
reportedKept.add(key);
|
|
159
|
+
input.logger.info({
|
|
160
|
+
scope,
|
|
161
|
+
legacyHeadCollectedAt: head.collectedAt,
|
|
162
|
+
heldConnections: held,
|
|
163
|
+
}, "Legacy file kept as the latest body; a method that opts out of takeover holds synced rows");
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* `legacyFirst` (the default) lets the legacy file stay authoritative over
|
|
167
|
+
* methods whose binding opts out of takeover. Deletion safety asks the
|
|
168
|
+
* ungated question: do any connection rows exist for this scope?
|
|
169
|
+
*/
|
|
170
|
+
function decide(scope, legacyFirst = true) {
|
|
171
|
+
const streamsByMethod = legacyFirst
|
|
172
|
+
? withoutOptedOutMethods(scope)
|
|
173
|
+
: scopeMethods(scope);
|
|
174
|
+
if (streamsByMethod.size === 0) {
|
|
175
|
+
return authority.hasTakeover(scope)
|
|
176
|
+
? refused({
|
|
177
|
+
status: "unavailable",
|
|
178
|
+
reason: "connection_unavailable",
|
|
179
|
+
detail: "method_not_configured",
|
|
180
|
+
})
|
|
181
|
+
: { kind: "file" };
|
|
182
|
+
}
|
|
183
|
+
const connections = authority.listMethodConnections([
|
|
184
|
+
...streamsByMethod.keys(),
|
|
185
|
+
]);
|
|
186
|
+
const owned = authority.hasTakeover(scope) ||
|
|
187
|
+
connections.some((connection) => connection.deletedAt !== null ||
|
|
188
|
+
connection.generation > 1 ||
|
|
189
|
+
authority.hasHeldData(connection.instance, streamsByMethod.get(connection.method ?? "") ?? []));
|
|
190
|
+
if (!owned)
|
|
191
|
+
return { kind: "file" };
|
|
192
|
+
// A connection that never held anything (boot registers one per source)
|
|
193
|
+
// is not a candidate; any other live one is, whatever stream it holds,
|
|
194
|
+
// so two accounts never split one namespace between them.
|
|
195
|
+
const candidates = connections.filter((connection) => connection.deletedAt === null &&
|
|
196
|
+
authority.hasHeldData(connection.instance, null));
|
|
197
|
+
const [only] = candidates;
|
|
198
|
+
if (!only) {
|
|
199
|
+
return refused({
|
|
200
|
+
status: "unavailable",
|
|
201
|
+
reason: "no_connection",
|
|
202
|
+
candidates: 0,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
if (candidates.length > 1) {
|
|
206
|
+
return refused({
|
|
207
|
+
status: "unavailable",
|
|
208
|
+
reason: "ambiguous_connection",
|
|
209
|
+
candidates: candidates.length,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
const { instance, sourceId, method } = only;
|
|
213
|
+
if (!records ||
|
|
214
|
+
sourceId === null ||
|
|
215
|
+
method === null ||
|
|
216
|
+
!input.configuredMethods(sourceId).includes(method)) {
|
|
217
|
+
return refused({
|
|
218
|
+
status: "unavailable",
|
|
219
|
+
reason: "connection_unavailable",
|
|
220
|
+
detail: "method_not_configured",
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
kind: "canonical",
|
|
225
|
+
records,
|
|
226
|
+
selection: { instance, sourceId, method },
|
|
227
|
+
generation: only.generation,
|
|
228
|
+
streams: streamsByMethod.get(method) ?? [],
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
function canServeLegacyBeforeTakeover(scope) {
|
|
232
|
+
const methods = [...scopeMethods(scope).keys()];
|
|
233
|
+
const connections = authority.listMethodConnections(methods);
|
|
234
|
+
if (!connections.length ||
|
|
235
|
+
connections.some((connection) => connection.deletedAt !== null)) {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
const current = decide(scope);
|
|
239
|
+
if (current.kind === "refused" &&
|
|
240
|
+
!(current.refusal.status === "unavailable" &&
|
|
241
|
+
current.refusal.reason === "no_connection")) {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
return (authority.eligibleLegacyHead(scope) !== null &&
|
|
245
|
+
!authority.hasTakeover(scope, current.kind === "canonical" ? current.selection.instance : undefined, current.kind === "canonical" ? current.generation : undefined));
|
|
246
|
+
}
|
|
247
|
+
function listingFor(scope) {
|
|
248
|
+
return authority.readSnapshot(() => {
|
|
249
|
+
const decision = decide(scope);
|
|
250
|
+
const listed = chooseListing(scope, decision);
|
|
251
|
+
return listed.kind === "file"
|
|
252
|
+
? { kind: "file", deletion: deletionFor(decision) }
|
|
253
|
+
: listed;
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
function chooseListing(scope, decision) {
|
|
257
|
+
if (authority.isReset(scope))
|
|
258
|
+
return { kind: "file" };
|
|
259
|
+
const legacyHead = authority.eligibleLegacyHead(scope);
|
|
260
|
+
const hasTakeover = authority.hasTakeover(scope, decision.kind === "canonical" ? decision.selection.instance : undefined, decision.kind === "canonical" ? decision.generation : undefined);
|
|
261
|
+
if (decision.kind === "refused" &&
|
|
262
|
+
decision.refusal.status === "unavailable" &&
|
|
263
|
+
decision.refusal.reason === "no_connection" &&
|
|
264
|
+
canServeLegacyBeforeTakeover(scope)) {
|
|
265
|
+
return { kind: "file" };
|
|
266
|
+
}
|
|
267
|
+
if (decision.kind !== "canonical")
|
|
268
|
+
return { kind: decision.kind };
|
|
269
|
+
if (ouraHasRetainedEntityLoss(decision) &&
|
|
270
|
+
!ouraCompletedReplacement(decision))
|
|
271
|
+
return { kind: hasTakeover || legacyHead === null ? "refused" : "file" };
|
|
272
|
+
const hasLegacyHead = legacyHead !== null;
|
|
273
|
+
if (hasLegacyHead && !hasTakeover && !initialOuraRunComplete(decision)) {
|
|
274
|
+
return { kind: "file" };
|
|
275
|
+
}
|
|
276
|
+
const completedReplacement = legacyHead !== null &&
|
|
277
|
+
authority.hasCompletedReplacement?.(scope, legacyHead, decision.selection.instance, decision.generation, decision.selection.method, coverageCursor(scope, decision, authority.writeClock(), authority.arrivalRevision(), receiptCursor(decision, input.declarations))) === true;
|
|
278
|
+
if (hasLegacyHead && input.readLegacyHead && !completedReplacement) {
|
|
279
|
+
const verdict = authority
|
|
280
|
+
.verdictFor(scope)
|
|
281
|
+
.find((row) => row.instance === decision.selection.instance &&
|
|
282
|
+
row.generation === decision.generation &&
|
|
283
|
+
row.legacyVersionId === legacyHead.id);
|
|
284
|
+
const coveredHead = authority.hasCoveredHead(scope, legacyHead);
|
|
285
|
+
if (verdict?.verdict !== "covered") {
|
|
286
|
+
return { kind: coveredHead ? "refused" : "file" };
|
|
287
|
+
}
|
|
288
|
+
if (verdict.canonicalCursor !==
|
|
289
|
+
coverageCursor(scope, decision, authority.writeClock(), authority.arrivalRevision(), receiptCursor(decision, input.declarations))) {
|
|
290
|
+
return { kind: "refused" };
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
else if (hasLegacyHead && !hasTakeover)
|
|
294
|
+
return { kind: "file" };
|
|
295
|
+
if (!input.readLegacyHead &&
|
|
296
|
+
hasLegacyHead &&
|
|
297
|
+
hasTakeover &&
|
|
298
|
+
missingCompletionReceipts(decision).length > 0) {
|
|
299
|
+
return { kind: "refused" };
|
|
300
|
+
}
|
|
301
|
+
const collectedAt = listedCollectedAt(decision.records, decision.selection.instance, decision.streams);
|
|
302
|
+
return collectedAt === null
|
|
303
|
+
? { kind: "refused" }
|
|
304
|
+
: { kind: "canonical", collectedAt };
|
|
305
|
+
}
|
|
306
|
+
function ouraHasRetainedEntityLoss(decision) {
|
|
307
|
+
return (decision.selection.method === "oura-browser" &&
|
|
308
|
+
OURA_BROWSER_HISTORY_POLICY.preserveRetainedEntities &&
|
|
309
|
+
authority.hasRetainedTombstones(decision.selection.instance, decision.streams));
|
|
310
|
+
}
|
|
311
|
+
// Omitted IDs are intentional only when every Oura stream has current,
|
|
312
|
+
// coherent completion evidence. A tombstone alone proves no replacement.
|
|
313
|
+
function ouraCompletedReplacement(decision) {
|
|
314
|
+
if (!initialOuraRunComplete(decision))
|
|
315
|
+
return false;
|
|
316
|
+
const receipts = decision.records.listStreamCompletions(decision.selection.instance);
|
|
317
|
+
return OURA_RUN_STREAMS.every((stream) => {
|
|
318
|
+
const head = authority.eligibleLegacyHead(`oura.${stream}`);
|
|
319
|
+
if (!head)
|
|
320
|
+
return true;
|
|
321
|
+
const receipt = receipts.find((entry) => entry.stream === stream);
|
|
322
|
+
const collected = Date.parse(receipt?.sourceCollectedAt ?? "");
|
|
323
|
+
const previous = Date.parse(head.collectedAt);
|
|
324
|
+
return (Number.isFinite(collected) &&
|
|
325
|
+
Number.isFinite(previous) &&
|
|
326
|
+
collected > previous);
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
function coverageCursor(scope, decision, writeClock, arrivalRevision, receipts) {
|
|
330
|
+
return [
|
|
331
|
+
writeClock,
|
|
332
|
+
arrivalRevision,
|
|
333
|
+
receipts,
|
|
334
|
+
decision.generation,
|
|
335
|
+
CANONICAL_LEGACY_VIEW_CONTRACT,
|
|
336
|
+
scopeDeclarationCursor(scope),
|
|
337
|
+
COVERAGE_RULE_VERSION,
|
|
338
|
+
input.coverageThresholds?.maxPayloadRatio ?? 1.5,
|
|
339
|
+
input.coverageThresholds?.maxExtraBytes ?? 256 * 1024,
|
|
340
|
+
].join(":");
|
|
341
|
+
}
|
|
342
|
+
/** One snapshot: the decision and the evidence the read is judged by. */
|
|
343
|
+
function readDecision(scope) {
|
|
344
|
+
return authority.readSnapshot(() => {
|
|
345
|
+
const decision = decide(scope);
|
|
346
|
+
return {
|
|
347
|
+
reset: authority.isReset(scope),
|
|
348
|
+
decision,
|
|
349
|
+
retainedEntityLoss: decision.kind === "canonical" && ouraHasRetainedEntityLoss(decision),
|
|
350
|
+
legacyHead: authority.eligibleLegacyHead(scope),
|
|
351
|
+
hasTakeover: authority.hasTakeover(scope, decision.kind === "canonical"
|
|
352
|
+
? decision.selection.instance
|
|
353
|
+
: undefined, decision.kind === "canonical" ? decision.generation : undefined),
|
|
354
|
+
canServeLegacy: canServeLegacyBeforeTakeover(scope),
|
|
355
|
+
hasCompletion: decision.kind === "canonical" &&
|
|
356
|
+
missingCompletionReceipts(decision).length === 0,
|
|
357
|
+
initialOuraRunComplete: decision.kind !== "canonical" || initialOuraRunComplete(decision),
|
|
358
|
+
writeClock: authority.writeClock(),
|
|
359
|
+
arrivalRevision: authority.arrivalRevision(),
|
|
360
|
+
receiptCursor: decision.kind === "canonical"
|
|
361
|
+
? receiptCursor(decision, input.declarations)
|
|
362
|
+
: "",
|
|
363
|
+
};
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
/** The body `decision` serves; the caller attaches its deletion history. */
|
|
367
|
+
async function chooseBody(scope, initial) {
|
|
368
|
+
if (initial.reset)
|
|
369
|
+
return { kind: "file" };
|
|
370
|
+
const { decision, legacyHead, hasTakeover, canServeLegacy } = initial;
|
|
371
|
+
if (decision.kind === "refused" &&
|
|
372
|
+
decision.refusal.status === "unavailable" &&
|
|
373
|
+
decision.refusal.reason === "no_connection" &&
|
|
374
|
+
canServeLegacy) {
|
|
375
|
+
return { kind: "file" };
|
|
376
|
+
}
|
|
377
|
+
if (decision.kind !== "canonical")
|
|
378
|
+
return decision;
|
|
379
|
+
if (initial.retainedEntityLoss && !ouraCompletedReplacement(decision)) {
|
|
380
|
+
return hasTakeover || legacyHead === null
|
|
381
|
+
? {
|
|
382
|
+
kind: "refused",
|
|
383
|
+
refusal: {
|
|
384
|
+
status: "incomplete",
|
|
385
|
+
reason: "canonical_view_incomplete",
|
|
386
|
+
diagnostics: [],
|
|
387
|
+
},
|
|
388
|
+
}
|
|
389
|
+
: { kind: "file" };
|
|
390
|
+
}
|
|
391
|
+
if (legacyHead !== null &&
|
|
392
|
+
!hasTakeover &&
|
|
393
|
+
!initial.initialOuraRunComplete) {
|
|
394
|
+
return { kind: "file" };
|
|
395
|
+
}
|
|
396
|
+
const replacementEligible = initial.hasCompletion &&
|
|
397
|
+
typeof authority.hasCompletedReplacement === "function";
|
|
398
|
+
const canonicalCursor = legacyHead
|
|
399
|
+
? coverageCursor(scope, decision, initial.writeClock, initial.arrivalRevision, initial.receiptCursor)
|
|
400
|
+
: "";
|
|
401
|
+
const projectionKey = legacyHead
|
|
402
|
+
? JSON.stringify([
|
|
403
|
+
decision.selection.instance,
|
|
404
|
+
decision.generation,
|
|
405
|
+
legacyHead.id,
|
|
406
|
+
canonicalCursor,
|
|
407
|
+
])
|
|
408
|
+
: "";
|
|
409
|
+
const projectionOwner = scope;
|
|
410
|
+
const cachedCoverage = legacyHead !== null && input.readLegacyHead
|
|
411
|
+
? authority.cachedVerdict(scope, decision.selection.instance, decision.generation, legacyHead.id, canonicalCursor)
|
|
412
|
+
: null;
|
|
413
|
+
const cachedProjection = coveredProjection.get(projectionOwner);
|
|
414
|
+
if (cachedCoverage?.covered && cachedProjection?.key === projectionKey) {
|
|
415
|
+
const confirmed = authority.confirmRead(scope, legacyHead, () => sameSelection(decide(scope), decision) &&
|
|
416
|
+
receiptCursor(decision, input.declarations) === initial.receiptCursor, decision.selection.method, {
|
|
417
|
+
instance: decision.selection.instance,
|
|
418
|
+
generation: decision.generation,
|
|
419
|
+
writeClock: initial.writeClock,
|
|
420
|
+
arrivalRevision: initial.arrivalRevision,
|
|
421
|
+
canonicalCursor,
|
|
422
|
+
coverage: cachedCoverage,
|
|
423
|
+
cached: true,
|
|
424
|
+
});
|
|
425
|
+
if (!confirmed) {
|
|
426
|
+
if (authority.isReset(scope))
|
|
427
|
+
return { kind: "file" };
|
|
428
|
+
return {
|
|
429
|
+
kind: "refused",
|
|
430
|
+
refusal: {
|
|
431
|
+
status: "unavailable",
|
|
432
|
+
reason: "store_inconsistent_read",
|
|
433
|
+
detail: "legacy head or canonical cursor changed during parity evaluation",
|
|
434
|
+
},
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
return {
|
|
438
|
+
kind: "canonical",
|
|
439
|
+
envelope: cachedProjection.envelope,
|
|
440
|
+
revision: cachedProjection.revision,
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
if (cachedCoverage && !cachedCoverage.covered && legacyHead) {
|
|
444
|
+
let legacy;
|
|
445
|
+
try {
|
|
446
|
+
legacy = await input.readLegacyHead(legacyHead);
|
|
447
|
+
}
|
|
448
|
+
catch {
|
|
449
|
+
return hasTakeover
|
|
450
|
+
? {
|
|
451
|
+
kind: "refused",
|
|
452
|
+
refusal: {
|
|
453
|
+
status: "unavailable",
|
|
454
|
+
reason: "store_inconsistent_read",
|
|
455
|
+
detail: "indexed legacy head could not be read",
|
|
456
|
+
},
|
|
457
|
+
}
|
|
458
|
+
: { kind: "file" };
|
|
459
|
+
}
|
|
460
|
+
if (legacy.scope !== scope) {
|
|
461
|
+
return {
|
|
462
|
+
kind: "refused",
|
|
463
|
+
refusal: {
|
|
464
|
+
status: "unavailable",
|
|
465
|
+
reason: "store_inconsistent_read",
|
|
466
|
+
detail: "indexed legacy head has another scope",
|
|
467
|
+
},
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
const alreadyCovered = authority.hasCoveredHead(scope, legacyHead);
|
|
471
|
+
const confirmed = authority.confirmRead(scope, legacyHead, () => sameSelection(decide(scope), decision) &&
|
|
472
|
+
receiptCursor(decision, input.declarations) === initial.receiptCursor, decision.selection.method, {
|
|
473
|
+
instance: decision.selection.instance,
|
|
474
|
+
generation: decision.generation,
|
|
475
|
+
writeClock: initial.writeClock,
|
|
476
|
+
arrivalRevision: initial.arrivalRevision,
|
|
477
|
+
canonicalCursor,
|
|
478
|
+
coverage: cachedCoverage,
|
|
479
|
+
cached: true,
|
|
480
|
+
});
|
|
481
|
+
if (!confirmed) {
|
|
482
|
+
if (authority.isReset(scope))
|
|
483
|
+
return { kind: "file" };
|
|
484
|
+
return {
|
|
485
|
+
kind: "refused",
|
|
486
|
+
refusal: {
|
|
487
|
+
status: "unavailable",
|
|
488
|
+
reason: "store_inconsistent_read",
|
|
489
|
+
detail: "legacy head or canonical cursor changed during parity evaluation",
|
|
490
|
+
},
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
return alreadyCovered
|
|
494
|
+
? {
|
|
495
|
+
kind: "refused",
|
|
496
|
+
refusal: {
|
|
497
|
+
status: "incomplete",
|
|
498
|
+
reason: "canonical_view_incomplete",
|
|
499
|
+
diagnostics: [],
|
|
500
|
+
},
|
|
501
|
+
}
|
|
502
|
+
: { kind: "file" };
|
|
503
|
+
}
|
|
504
|
+
const read = await readCanonicalLegacyScope({
|
|
505
|
+
store: decision.records,
|
|
506
|
+
declarations: input.declarations,
|
|
507
|
+
scope,
|
|
508
|
+
selection: decision.selection,
|
|
509
|
+
profileBy: "method",
|
|
510
|
+
// Completion proves initial Oura admission. Once a takeover is earned,
|
|
511
|
+
// partial refreshes still face coverage checks without requiring receipts.
|
|
512
|
+
requireCompletionReceipts: legacyHead !== null &&
|
|
513
|
+
(replacementEligible ||
|
|
514
|
+
!input.readLegacyHead ||
|
|
515
|
+
(decision.selection.method === "oura-browser" && !hasTakeover)),
|
|
516
|
+
allowUnprovenEmptyStreams: legacyHead !== null && !!input.readLegacyHead,
|
|
517
|
+
includeStreamTimes: legacyHead !== null,
|
|
518
|
+
requireClaudeRawBlobs: legacyHead !== null && !!input.readLegacyHead,
|
|
519
|
+
// The rows must come from a state in which this is still the one
|
|
520
|
+
// connection: a second account appearing between the decision and
|
|
521
|
+
// the rows refuses instead of serving a body chosen while ambiguous.
|
|
522
|
+
confirmSelection: () => sameSelection(decide(scope), decision),
|
|
523
|
+
});
|
|
524
|
+
if (!read.ok) {
|
|
525
|
+
if (legacyHead !== null &&
|
|
526
|
+
input.readLegacyHead &&
|
|
527
|
+
isProjectionDataFailure(read.reason)) {
|
|
528
|
+
let legacy;
|
|
529
|
+
try {
|
|
530
|
+
legacy = await input.readLegacyHead(legacyHead);
|
|
531
|
+
}
|
|
532
|
+
catch {
|
|
533
|
+
const { ok: _ok, ...refusal } = read;
|
|
534
|
+
return { kind: "refused", refusal };
|
|
535
|
+
}
|
|
536
|
+
if (legacy.scope !== scope) {
|
|
537
|
+
return {
|
|
538
|
+
kind: "refused",
|
|
539
|
+
refusal: {
|
|
540
|
+
status: "unavailable",
|
|
541
|
+
reason: "store_inconsistent_read",
|
|
542
|
+
detail: "indexed legacy head has another scope",
|
|
543
|
+
},
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
const coveredHead = authority.hasCoveredHead(scope, legacyHead);
|
|
547
|
+
const coverage = projectionUnavailableCoverage(legacy.data, read.reason === "missing_raw_blob" ? read.recordCount : 0);
|
|
548
|
+
const confirmed = authority.confirmRead(scope, legacyHead, () => sameSelection(decide(scope), decision) &&
|
|
549
|
+
receiptCursor(decision, input.declarations) ===
|
|
550
|
+
initial.receiptCursor, decision.selection.method, {
|
|
551
|
+
instance: decision.selection.instance,
|
|
552
|
+
generation: decision.generation,
|
|
553
|
+
writeClock: initial.writeClock,
|
|
554
|
+
arrivalRevision: initial.arrivalRevision,
|
|
555
|
+
canonicalCursor: `${initial.writeClock}:${initial.arrivalRevision}:${initial.receiptCursor}:unavailable:${read.reason}:${COVERAGE_RULE_VERSION}`,
|
|
556
|
+
coverage,
|
|
557
|
+
cached: false,
|
|
558
|
+
});
|
|
559
|
+
if (!confirmed) {
|
|
560
|
+
if (authority.isReset(scope))
|
|
561
|
+
return { kind: "file" };
|
|
562
|
+
return {
|
|
563
|
+
kind: "refused",
|
|
564
|
+
refusal: {
|
|
565
|
+
status: "unavailable",
|
|
566
|
+
reason: "store_inconsistent_read",
|
|
567
|
+
detail: "legacy head or canonical cursor changed during parity evaluation",
|
|
568
|
+
},
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
if (coveredHead) {
|
|
572
|
+
const { ok: _ok, ...refusal } = read;
|
|
573
|
+
return { kind: "refused", refusal };
|
|
574
|
+
}
|
|
575
|
+
return { kind: "file" };
|
|
576
|
+
}
|
|
577
|
+
if (legacyHead !== null &&
|
|
578
|
+
!hasTakeover &&
|
|
579
|
+
(read.reason === "projection_rejected" ||
|
|
580
|
+
read.reason === "all_rows_rejected" ||
|
|
581
|
+
read.reason === "no_synced_data" ||
|
|
582
|
+
read.reason === "stream_completion_unknown" ||
|
|
583
|
+
read.reason === "blob_read_budget_exceeded" ||
|
|
584
|
+
read.reason === "blob_backed_record_invalid" ||
|
|
585
|
+
read.reason === "missing_raw_blob" ||
|
|
586
|
+
read.reason === "blob_backed_records_unsupported")) {
|
|
587
|
+
const stillLegacyOwned = authority.readSnapshot(() => canServeLegacyBeforeTakeover(scope));
|
|
588
|
+
if (stillLegacyOwned)
|
|
589
|
+
return { kind: "file" };
|
|
590
|
+
}
|
|
591
|
+
const { ok: _ok, ...refusal } = read;
|
|
592
|
+
return { kind: "refused", refusal };
|
|
593
|
+
}
|
|
594
|
+
// Receipt presence cannot make a lossy/partial projection complete.
|
|
595
|
+
if (initial.retainedEntityLoss && !read.complete) {
|
|
596
|
+
if (legacyHead !== null && !hasTakeover) {
|
|
597
|
+
const stillLegacyOwned = authority.readSnapshot(() => canServeLegacyBeforeTakeover(scope));
|
|
598
|
+
if (stillLegacyOwned)
|
|
599
|
+
return { kind: "file" };
|
|
600
|
+
}
|
|
601
|
+
return {
|
|
602
|
+
kind: "refused",
|
|
603
|
+
refusal: {
|
|
604
|
+
status: "incomplete",
|
|
605
|
+
reason: "canonical_view_incomplete",
|
|
606
|
+
diagnostics: incompleteness(read),
|
|
607
|
+
},
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
// Whole-dataset replacement needs a fresh completion for every input.
|
|
611
|
+
// Equal/older horizons retain the existing parity path, not deletion authority.
|
|
612
|
+
if (legacyHead !== null &&
|
|
613
|
+
replacementEligible &&
|
|
614
|
+
read.complete &&
|
|
615
|
+
allStreamsProvenAfter(read, decision.streams, legacyHead.collectedAt)) {
|
|
616
|
+
const confirmed = authority.confirmRead(scope, legacyHead, () => sameSelection(decide(scope), decision) &&
|
|
617
|
+
receiptCursor(decision, input.declarations) === initial.receiptCursor, decision.selection.method, {
|
|
618
|
+
instance: decision.selection.instance,
|
|
619
|
+
generation: decision.generation,
|
|
620
|
+
writeClock: initial.writeClock,
|
|
621
|
+
arrivalRevision: initial.arrivalRevision,
|
|
622
|
+
canonicalCursor,
|
|
623
|
+
completion: true,
|
|
624
|
+
});
|
|
625
|
+
if (!confirmed) {
|
|
626
|
+
if (authority.isReset(scope))
|
|
627
|
+
return { kind: "file" };
|
|
628
|
+
const canKeepFile = authority.readSnapshot(() => canServeLegacyBeforeTakeover(scope) &&
|
|
629
|
+
!authority.hasTakeover(scope, decision.selection.instance, decision.generation));
|
|
630
|
+
if (canKeepFile)
|
|
631
|
+
return { kind: "file" };
|
|
632
|
+
return {
|
|
633
|
+
kind: "refused",
|
|
634
|
+
refusal: {
|
|
635
|
+
status: "unavailable",
|
|
636
|
+
reason: "store_inconsistent_read",
|
|
637
|
+
detail: "legacy head or canonical snapshot changed during replacement",
|
|
638
|
+
},
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
return {
|
|
642
|
+
kind: "canonical",
|
|
643
|
+
envelope: read.envelope,
|
|
644
|
+
revision: read.revision,
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
// Without the old body, only a newer complete import can prove replacement.
|
|
648
|
+
// Do not fall through to confirmation that records an unscoped takeover.
|
|
649
|
+
if (legacyHead !== null && !input.readLegacyHead) {
|
|
650
|
+
const stillLegacyOwned = authority.readSnapshot(() => canServeLegacyBeforeTakeover(scope));
|
|
651
|
+
if (stillLegacyOwned)
|
|
652
|
+
return { kind: "file" };
|
|
653
|
+
return {
|
|
654
|
+
kind: "refused",
|
|
655
|
+
refusal: {
|
|
656
|
+
status: "incomplete",
|
|
657
|
+
reason: "canonical_view_incomplete",
|
|
658
|
+
diagnostics: incompleteness(read),
|
|
659
|
+
},
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
if (legacyHead !== null && input.readLegacyHead) {
|
|
663
|
+
// Coverage compares against the old file, so it cannot see rows the
|
|
664
|
+
// source reports short of detail. Such a history cannot take over; once
|
|
665
|
+
// this file is covered, it keeps serving (no hard break).
|
|
666
|
+
if (read.diagnostics.partialRows.length > 0 &&
|
|
667
|
+
!authority.hasCoveredHead(scope, legacyHead)) {
|
|
668
|
+
return { kind: "file" };
|
|
669
|
+
}
|
|
670
|
+
let coverage = cachedCoverage;
|
|
671
|
+
const cached = coverage !== null;
|
|
672
|
+
if (!coverage || decision.selection.method === "anthropic-live") {
|
|
673
|
+
let legacy;
|
|
674
|
+
try {
|
|
675
|
+
legacy = await input.readLegacyHead(legacyHead);
|
|
676
|
+
}
|
|
677
|
+
catch {
|
|
678
|
+
return hasTakeover
|
|
679
|
+
? {
|
|
680
|
+
kind: "refused",
|
|
681
|
+
refusal: {
|
|
682
|
+
status: "unavailable",
|
|
683
|
+
reason: "store_inconsistent_read",
|
|
684
|
+
detail: "indexed legacy head could not be read",
|
|
685
|
+
},
|
|
686
|
+
}
|
|
687
|
+
: { kind: "file" };
|
|
688
|
+
}
|
|
689
|
+
if (legacy.scope !== scope) {
|
|
690
|
+
return {
|
|
691
|
+
kind: "refused",
|
|
692
|
+
refusal: {
|
|
693
|
+
status: "unavailable",
|
|
694
|
+
reason: "store_inconsistent_read",
|
|
695
|
+
detail: "indexed legacy head has another scope",
|
|
696
|
+
},
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
if (scope === "claude.conversations" &&
|
|
700
|
+
decision.selection.method === "anthropic-live") {
|
|
701
|
+
await retainClaudeProfile(read, legacy);
|
|
702
|
+
}
|
|
703
|
+
coverage = compareLegacyCoverage(legacy.data, read.envelope.data, {
|
|
704
|
+
scope,
|
|
705
|
+
entityKeys: LEGACY_SCOPE_ENTITY_KEYS[scope],
|
|
706
|
+
projectionOmissions: read.projectionOmissions,
|
|
707
|
+
canonicalNewer: allStreamsNewerThan(read, decision.streams, legacyHead.collectedAt),
|
|
708
|
+
// A partial row is present, only short of detail, so it does not
|
|
709
|
+
// weaken the receipts' proof that a missing entity was deleted. A
|
|
710
|
+
// dropped row would look deleted, so omissions still block it.
|
|
711
|
+
allowProvenDeletion: (decision.selection.method === "oura-browser"
|
|
712
|
+
? OURA_BROWSER_HISTORY_POLICY.allowProvenDeletion
|
|
713
|
+
: true) &&
|
|
714
|
+
read.diagnostics.omissions.length === 0 &&
|
|
715
|
+
(read.diagnostics.unproven?.length ?? 0) === 0 &&
|
|
716
|
+
allStreamsProvenAfter(read, decision.streams, legacyHead.collectedAt),
|
|
717
|
+
...input.coverageThresholds,
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
const alreadyCovered = authority.hasCoveredHead(scope, legacyHead);
|
|
721
|
+
const confirmed = authority.confirmRead(scope, legacyHead, () => sameSelection(decide(scope), decision) &&
|
|
722
|
+
receiptCursor(decision, input.declarations) === initial.receiptCursor, decision.selection.method, {
|
|
723
|
+
instance: decision.selection.instance,
|
|
724
|
+
generation: decision.generation,
|
|
725
|
+
writeClock: initial.writeClock,
|
|
726
|
+
arrivalRevision: initial.arrivalRevision,
|
|
727
|
+
canonicalCursor,
|
|
728
|
+
coverage,
|
|
729
|
+
cached,
|
|
730
|
+
});
|
|
731
|
+
if (!confirmed) {
|
|
732
|
+
if (authority.isReset(scope))
|
|
733
|
+
return { kind: "file" };
|
|
734
|
+
return {
|
|
735
|
+
kind: "refused",
|
|
736
|
+
refusal: {
|
|
737
|
+
status: "unavailable",
|
|
738
|
+
reason: "store_inconsistent_read",
|
|
739
|
+
detail: "legacy head or canonical cursor changed during parity evaluation",
|
|
740
|
+
},
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
if (!coverage.covered) {
|
|
744
|
+
// A newer file is an explicit, recorded rollback. A canonical
|
|
745
|
+
// regression against the same file must still refuse after takeover.
|
|
746
|
+
return alreadyCovered
|
|
747
|
+
? {
|
|
748
|
+
kind: "refused",
|
|
749
|
+
refusal: {
|
|
750
|
+
status: "incomplete",
|
|
751
|
+
reason: "canonical_view_incomplete",
|
|
752
|
+
diagnostics: [],
|
|
753
|
+
},
|
|
754
|
+
}
|
|
755
|
+
: { kind: "file" };
|
|
756
|
+
}
|
|
757
|
+
coveredProjection.set(projectionOwner, {
|
|
758
|
+
key: projectionKey,
|
|
759
|
+
envelope: read.envelope,
|
|
760
|
+
revision: read.revision,
|
|
761
|
+
});
|
|
762
|
+
return {
|
|
763
|
+
kind: "canonical",
|
|
764
|
+
envelope: read.envelope,
|
|
765
|
+
revision: read.revision,
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
if (!read.complete) {
|
|
769
|
+
if (legacyHead !== null && !hasTakeover) {
|
|
770
|
+
const stillLegacyOwned = authority.readSnapshot(() => canServeLegacyBeforeTakeover(scope));
|
|
771
|
+
if (stillLegacyOwned)
|
|
772
|
+
return { kind: "file" };
|
|
773
|
+
}
|
|
774
|
+
return {
|
|
775
|
+
kind: "refused",
|
|
776
|
+
refusal: {
|
|
777
|
+
status: "incomplete",
|
|
778
|
+
reason: "canonical_view_incomplete",
|
|
779
|
+
diagnostics: incompleteness(read),
|
|
780
|
+
},
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
const confirmed = authority.confirmRead(scope, legacyHead, () => sameSelection(decide(scope), decision), decision.selection.method);
|
|
784
|
+
if (!confirmed) {
|
|
785
|
+
const current = authority.readSnapshot(() => ({
|
|
786
|
+
canServeLegacy: canServeLegacyBeforeTakeover(scope),
|
|
787
|
+
hasTakeover: authority.hasTakeover(scope, decision.selection.instance, decision.generation),
|
|
788
|
+
}));
|
|
789
|
+
if (current.canServeLegacy && !current.hasTakeover)
|
|
790
|
+
return { kind: "file" };
|
|
791
|
+
return {
|
|
792
|
+
kind: "refused",
|
|
793
|
+
refusal: {
|
|
794
|
+
status: "unavailable",
|
|
795
|
+
reason: "store_inconsistent_read",
|
|
796
|
+
detail: "legacy head or connection selection changed during canonical projection",
|
|
797
|
+
},
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
return {
|
|
801
|
+
kind: "canonical",
|
|
802
|
+
envelope: read.envelope,
|
|
803
|
+
revision: read.revision,
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
return {
|
|
807
|
+
async readLatest(scope) {
|
|
808
|
+
const initial = readDecision(scope);
|
|
809
|
+
const body = await chooseBody(scope, initial);
|
|
810
|
+
return body.kind === "file"
|
|
811
|
+
? { kind: "file", deletion: deletionFor(initial.decision) }
|
|
812
|
+
: body;
|
|
813
|
+
},
|
|
814
|
+
listingFor,
|
|
815
|
+
listCanonicalScopes(scopePrefix) {
|
|
816
|
+
const listed = [];
|
|
817
|
+
for (const scope of boundScopes()) {
|
|
818
|
+
if (scopePrefix !== undefined && !scope.startsWith(scopePrefix)) {
|
|
819
|
+
continue;
|
|
820
|
+
}
|
|
821
|
+
const listing = listingFor(scope);
|
|
822
|
+
if (listing.kind === "canonical") {
|
|
823
|
+
listed.push({ scope, collectedAt: listing.collectedAt });
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
return listed;
|
|
827
|
+
},
|
|
828
|
+
ownsScope(scope) {
|
|
829
|
+
return authority.readSnapshot(() => ownsScope(scope));
|
|
830
|
+
},
|
|
831
|
+
verdictFor: (scope) => authority.verdictFor(scope),
|
|
832
|
+
resetTakeover: (scope) => authority.resetTakeover(scope),
|
|
833
|
+
isReset: (scope) => authority.isReset(scope),
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
/** Initial Oura admission is one completed three-stream run, never a mix of windows. */
|
|
837
|
+
function initialOuraRunComplete(decision) {
|
|
838
|
+
if (decision.selection.method !== "oura-browser")
|
|
839
|
+
return true;
|
|
840
|
+
const binding = decision.records.getInstanceBinding(decision.selection.instance);
|
|
841
|
+
const listings = decision.records.listStreams([decision.selection.instance]);
|
|
842
|
+
const receipts = decision.records.listStreamCompletions(decision.selection.instance);
|
|
843
|
+
let horizon;
|
|
844
|
+
return OURA_RUN_STREAMS.every((stream) => {
|
|
845
|
+
const count = listings.find((entry) => entry.stream === stream)?.recordCount ?? 0;
|
|
846
|
+
const receipt = receipts.find((entry) => entry.stream === stream &&
|
|
847
|
+
entry.method === binding.method &&
|
|
848
|
+
entry.generation === binding.generation &&
|
|
849
|
+
entry.liveCount === count);
|
|
850
|
+
const time = Date.parse(receipt?.sourceCollectedAt ?? "");
|
|
851
|
+
if (!Number.isFinite(time))
|
|
852
|
+
return false;
|
|
853
|
+
horizon ??= time;
|
|
854
|
+
return time === horizon;
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
function missingCompletionReceipts(decision) {
|
|
858
|
+
const binding = decision.records.getInstanceBinding(decision.selection.instance);
|
|
859
|
+
const listings = decision.records.listStreams([decision.selection.instance]);
|
|
860
|
+
const receipts = decision.records.listStreamCompletions(decision.selection.instance);
|
|
861
|
+
return decision.streams.filter((stream) => {
|
|
862
|
+
const liveCount = listings.find((entry) => entry.stream === stream)?.recordCount ?? 0;
|
|
863
|
+
return !receipts.some((receipt) => receipt.stream === stream &&
|
|
864
|
+
receipt.method === binding.method &&
|
|
865
|
+
receipt.generation === binding.generation &&
|
|
866
|
+
receipt.liveCount === liveCount);
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
function isProjectionDataFailure(reason) {
|
|
870
|
+
return [
|
|
871
|
+
"projection_rejected",
|
|
872
|
+
"all_rows_rejected",
|
|
873
|
+
"no_synced_data",
|
|
874
|
+
"stream_completion_unknown",
|
|
875
|
+
"invalid_collected_at",
|
|
876
|
+
"blob_read_budget_exceeded",
|
|
877
|
+
"blob_backed_record_invalid",
|
|
878
|
+
"missing_raw_blob",
|
|
879
|
+
"blob_backed_records_unsupported",
|
|
880
|
+
].includes(reason);
|
|
881
|
+
}
|
|
882
|
+
function receiptCursor(decision, declarations) {
|
|
883
|
+
const receipts = decision.records
|
|
884
|
+
.listStreamCompletions(decision.selection.instance)
|
|
885
|
+
.filter((receipt) => (decision.selection.method === "oura-browser"
|
|
886
|
+
? OURA_RUN_STREAMS
|
|
887
|
+
: decision.streams).includes(receipt.stream))
|
|
888
|
+
.map((receipt) => [
|
|
889
|
+
receipt.stream,
|
|
890
|
+
receipt.method,
|
|
891
|
+
receipt.generation,
|
|
892
|
+
receipt.sourceCollectedAt,
|
|
893
|
+
receipt.writeSeq,
|
|
894
|
+
receipt.liveCount,
|
|
895
|
+
])
|
|
896
|
+
.sort((a, b) => String(a[0]).localeCompare(String(b[0])));
|
|
897
|
+
// A declaration-only change must invalidate covered-body and verdict caches,
|
|
898
|
+
// including while an asynchronous blob digest or legacy file read is pending.
|
|
899
|
+
if (!declarations)
|
|
900
|
+
return JSON.stringify(receipts);
|
|
901
|
+
return JSON.stringify({
|
|
902
|
+
receipts,
|
|
903
|
+
schemas: decision.streams.map((stream) => [
|
|
904
|
+
stream,
|
|
905
|
+
declarations.forInstance(decision.selection.instance, stream)?.schema ??
|
|
906
|
+
null,
|
|
907
|
+
]),
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
function projectionUnavailableCoverage(legacyPayload, missingRawBlobCount = 0) {
|
|
911
|
+
const legacyBytes = new TextEncoder().encode(JSON.stringify(legacyPayload)).length;
|
|
912
|
+
return {
|
|
913
|
+
comparisonCase: "same_time",
|
|
914
|
+
covered: false,
|
|
915
|
+
reason: missingRawBlobCount > 0 ? "missing_raw_blob" : "projection_unavailable",
|
|
916
|
+
reasonCounts: {
|
|
917
|
+
no_stable_key: 0,
|
|
918
|
+
missing_entity: 0,
|
|
919
|
+
missing_field: 0,
|
|
920
|
+
field_mismatch: 0,
|
|
921
|
+
type_mismatch: 0,
|
|
922
|
+
timestamp_format: 0,
|
|
923
|
+
identity_mismatch: 0,
|
|
924
|
+
creation_mismatch: 0,
|
|
925
|
+
array_order: 0,
|
|
926
|
+
payload_growth: 0,
|
|
927
|
+
missing_raw_blob: missingRawBlobCount,
|
|
928
|
+
projection_unavailable: missingRawBlobCount > 0 ? 0 : 1,
|
|
929
|
+
},
|
|
930
|
+
appliedExceptions: [],
|
|
931
|
+
missingEntityCount: 0,
|
|
932
|
+
mismatchedFieldPaths: [],
|
|
933
|
+
legacyBytes,
|
|
934
|
+
canonicalBytes: 0,
|
|
935
|
+
byteDelta: -legacyBytes,
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
/** A newer scope snapshot requires a newer collection horizon for each input stream. */
|
|
939
|
+
function allStreamsNewerThan(read, streams, legacyCollectedAt) {
|
|
940
|
+
const legacyTime = Date.parse(legacyCollectedAt);
|
|
941
|
+
if (!Number.isFinite(legacyTime))
|
|
942
|
+
return false;
|
|
943
|
+
return streams.every((stream) => {
|
|
944
|
+
const time = Date.parse(read.streamCollectionTimes?.[stream] ?? "");
|
|
945
|
+
return Number.isFinite(time) && time > legacyTime;
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
/** Only current P7 receipts from every input stream prove a later deletion. */
|
|
949
|
+
function allStreamsProvenAfter(read, streams, legacyCollectedAt) {
|
|
950
|
+
const legacyTime = Date.parse(legacyCollectedAt);
|
|
951
|
+
if (!Number.isFinite(legacyTime))
|
|
952
|
+
return false;
|
|
953
|
+
return streams.every((stream) => {
|
|
954
|
+
const time = Date.parse(read.streamCompletionTimes?.[stream] ?? "");
|
|
955
|
+
return Number.isFinite(time) && time > legacyTime;
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
function refused(refusal) {
|
|
959
|
+
return { kind: "refused", refusal };
|
|
960
|
+
}
|
|
961
|
+
function sameSelection(again, decision) {
|
|
962
|
+
return (again.kind === "canonical" &&
|
|
963
|
+
again.selection.instance === decision.selection.instance &&
|
|
964
|
+
again.selection.sourceId === decision.selection.sourceId &&
|
|
965
|
+
again.selection.method === decision.selection.method &&
|
|
966
|
+
again.generation === decision.generation);
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* The methods that may serve a scope, each with the streams its binding
|
|
970
|
+
* reads. A method id is a binding's connector key; its binding is the one
|
|
971
|
+
* the reader will use for that method.
|
|
972
|
+
*/
|
|
973
|
+
function scopeMethods(scope) {
|
|
974
|
+
const methods = new Map();
|
|
975
|
+
for (const profile of BINDING_PROFILES) {
|
|
976
|
+
const bound = profile.get(scope);
|
|
977
|
+
if (!bound)
|
|
978
|
+
continue;
|
|
979
|
+
const method = legacyConnectorKey(bound.pdppSource);
|
|
980
|
+
const binding = legacyBindingsForProfile(method).get(scope);
|
|
981
|
+
if (binding)
|
|
982
|
+
methods.set(method, binding.pdppStreams);
|
|
983
|
+
}
|
|
984
|
+
return methods;
|
|
985
|
+
}
|
|
986
|
+
function boundScopes() {
|
|
987
|
+
const scopes = new Set();
|
|
988
|
+
for (const profile of BINDING_PROFILES) {
|
|
989
|
+
for (const scope of profile.keys())
|
|
990
|
+
scopes.add(scope);
|
|
991
|
+
}
|
|
992
|
+
return [...scopes].sort();
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* The `collectedAt` a read would return, from listing counts and receipts:
|
|
996
|
+
* a stream's valid receipt time, else its newest row time. Null when a bound
|
|
997
|
+
* stream is empty without a valid receipt, which a read refuses.
|
|
998
|
+
*/
|
|
999
|
+
function listedCollectedAt(store, instance, streams) {
|
|
1000
|
+
const binding = store.getInstanceBinding(instance);
|
|
1001
|
+
const listing = store.listStreams([instance]);
|
|
1002
|
+
const receipts = store.listStreamCompletions(instance);
|
|
1003
|
+
let newest = Number.NEGATIVE_INFINITY;
|
|
1004
|
+
for (const stream of streams) {
|
|
1005
|
+
const entry = listing.find((candidate) => candidate.stream === stream);
|
|
1006
|
+
const count = entry?.recordCount ?? 0;
|
|
1007
|
+
const receipt = receipts.find((candidate) => candidate.stream === stream &&
|
|
1008
|
+
candidate.method === binding.method &&
|
|
1009
|
+
candidate.generation === binding.generation &&
|
|
1010
|
+
candidate.liveCount === count);
|
|
1011
|
+
const stamp = receipt?.sourceCollectedAt ?? entry?.lastUpdated ?? null;
|
|
1012
|
+
if (count === 0 && !receipt)
|
|
1013
|
+
return null;
|
|
1014
|
+
if (stamp === null)
|
|
1015
|
+
return null;
|
|
1016
|
+
const ms = Date.parse(stamp);
|
|
1017
|
+
if (Number.isNaN(ms))
|
|
1018
|
+
return null;
|
|
1019
|
+
newest = Math.max(newest, ms);
|
|
1020
|
+
}
|
|
1021
|
+
return Number.isFinite(newest) ? new Date(newest).toISOString() : null;
|
|
1022
|
+
}
|
|
1023
|
+
function incompleteness(read) {
|
|
1024
|
+
const { omissions, partialRows, unproven } = read.diagnostics;
|
|
1025
|
+
return [
|
|
1026
|
+
...omissions.map((entry) => ({
|
|
1027
|
+
stream: entry.stream,
|
|
1028
|
+
kind: "omitted",
|
|
1029
|
+
detail: `${entry.count} rows: ${entry.reasons.join("; ")}`,
|
|
1030
|
+
})),
|
|
1031
|
+
...partialRows.map((entry) => ({
|
|
1032
|
+
stream: entry.stream,
|
|
1033
|
+
kind: "partial",
|
|
1034
|
+
detail: `${entry.count} rows: ${entry.reasons.join("; ")}`,
|
|
1035
|
+
})),
|
|
1036
|
+
// Optional on the canonical-legacy-view/4 contract: omitted when empty.
|
|
1037
|
+
...(unproven ?? []).map((entry) => ({
|
|
1038
|
+
stream: entry.stream,
|
|
1039
|
+
kind: "unproven",
|
|
1040
|
+
detail: `${entry.aspect}: ${entry.reason}`,
|
|
1041
|
+
})),
|
|
1042
|
+
];
|
|
1043
|
+
}
|
|
1044
|
+
//# sourceMappingURL=legacy-scope-view.js.map
|