@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,823 @@
|
|
|
1
|
+
import { AdditionsBudget, AdditionsBudgetExceeded as BudgetExceeded, } from "./budget.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { keccak256, stringToHex } from "viem";
|
|
4
|
+
import { createDataFileEnvelope, DataFileEnvelopeSchema, decryptWithPassword, deriveScopeKey, } from "@opendatalabs/vana-sdk/browser";
|
|
5
|
+
import { publishVersion, NeedsFencedPublicationError, } from "../publication/publish.js";
|
|
6
|
+
import { computeDataPointId } from "../sync/data-point-id.js";
|
|
7
|
+
import { foldVersion, extractRecordKeys, readScopeFirstSeenLedger, } from "./first-added.js";
|
|
8
|
+
import { summarizeAdditions, ADDITIONS_SUMMARY_MAX_BYTES, } from "./summary.js";
|
|
9
|
+
import { fingerprintVersionInventory, } from "./version-inventory.js";
|
|
10
|
+
import { isSystemScope } from "../policy/reserved-scopes.js";
|
|
11
|
+
export const ADDITIONS_SUMMARY_SCOPE = "vana.system.additions";
|
|
12
|
+
const decimal = z.string().regex(/^(0|[1-9]\d*)$/);
|
|
13
|
+
const slotSchema = z.object({
|
|
14
|
+
expectedVersion: decimal,
|
|
15
|
+
dataHash: z.string(),
|
|
16
|
+
metadataHash: z.string(),
|
|
17
|
+
status: z.string(),
|
|
18
|
+
addedAt: z.string(),
|
|
19
|
+
isTombstone: z.boolean(),
|
|
20
|
+
});
|
|
21
|
+
const documentSchema = z.object({
|
|
22
|
+
version: z.literal(1),
|
|
23
|
+
owner: z.string(),
|
|
24
|
+
network: z.string(),
|
|
25
|
+
scope: z.string(),
|
|
26
|
+
through: decimal,
|
|
27
|
+
currentTotal: z.number().int().nonnegative(),
|
|
28
|
+
slots: z.array(slotSchema),
|
|
29
|
+
ledger: z.unknown(),
|
|
30
|
+
});
|
|
31
|
+
/** The separate hash namespace cannot collide with a literal source suffix. */
|
|
32
|
+
export function additionsLedgerScope(scope) {
|
|
33
|
+
const literal = `${ADDITIONS_SUMMARY_SCOPE}.${scope}`;
|
|
34
|
+
return new TextEncoder().encode(literal).byteLength <= 256
|
|
35
|
+
? literal
|
|
36
|
+
: `vana.system.additions-hash.${keccak256(stringToHex(scope)).slice(2)}`;
|
|
37
|
+
}
|
|
38
|
+
/** Fixed operator codes only: never retain payloads or raw exception text. */
|
|
39
|
+
export class AdditionsRecoveryError extends Error {
|
|
40
|
+
code;
|
|
41
|
+
constructor(code, message = code) {
|
|
42
|
+
super(message);
|
|
43
|
+
this.code = code;
|
|
44
|
+
this.name = "AdditionsRecoveryError";
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
class InaccessibleLedger extends Error {
|
|
48
|
+
}
|
|
49
|
+
class CheckpointSearchExceeded extends BudgetExceeded {
|
|
50
|
+
}
|
|
51
|
+
const CHECKPOINT_READ_LIMIT = 256;
|
|
52
|
+
const INVENTORY_CONCURRENCY = 16;
|
|
53
|
+
class BoundedWorkUnavailable extends Error {
|
|
54
|
+
}
|
|
55
|
+
class ReadBudget extends AdditionsBudget {
|
|
56
|
+
limited;
|
|
57
|
+
checkpoints;
|
|
58
|
+
constructor(options, parent) {
|
|
59
|
+
super(options.byteBudget, options.timeBudgetMs, options.signal, parent);
|
|
60
|
+
this.checkpoints = parent?.checkpoints ?? { reads: 0, rejected: new Map() };
|
|
61
|
+
this.limited =
|
|
62
|
+
options.byteBudget !== undefined || options.timeBudgetMs !== undefined;
|
|
63
|
+
}
|
|
64
|
+
/** A failed source unit cannot spend the bytes held for its durable prefix. */
|
|
65
|
+
excluding(reserved) {
|
|
66
|
+
return new ReadBudget({
|
|
67
|
+
byteBudget: Math.max(0, this.remaining - reserved),
|
|
68
|
+
timeBudgetMs: Number.isFinite(this.remainingMilliseconds)
|
|
69
|
+
? Math.max(0, Math.floor(this.remainingMilliseconds - 2000))
|
|
70
|
+
: undefined,
|
|
71
|
+
signal: this.signal,
|
|
72
|
+
}, this);
|
|
73
|
+
}
|
|
74
|
+
check(bytes = 0) {
|
|
75
|
+
this.charge(bytes);
|
|
76
|
+
}
|
|
77
|
+
get readOptions() {
|
|
78
|
+
return { signal: this.signal, ...(this.limited ? { budget: this } : {}) };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function hex(bytes) {
|
|
82
|
+
return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
83
|
+
}
|
|
84
|
+
function sameCommitment(a, b) {
|
|
85
|
+
return (a.expectedVersion === b.expectedVersion &&
|
|
86
|
+
a.dataHash.toLowerCase() === b.dataHash.toLowerCase() &&
|
|
87
|
+
a.metadataHash.toLowerCase() === b.metadataHash.toLowerCase() &&
|
|
88
|
+
a.isTombstone === b.isTombstone);
|
|
89
|
+
}
|
|
90
|
+
function sameSlot(a, b) {
|
|
91
|
+
return sameCommitment(a, b) && a.status === b.status;
|
|
92
|
+
}
|
|
93
|
+
function sameInventory(a, b) {
|
|
94
|
+
return (JSON.stringify(a.head) === JSON.stringify(b.head) &&
|
|
95
|
+
a.versions.length === b.versions.length &&
|
|
96
|
+
a.versions.every((slot, i) => sameSlot(slot, b.versions[i])));
|
|
97
|
+
}
|
|
98
|
+
function settled(slot) {
|
|
99
|
+
return slot.status === "confirmed" || slot.status === "finalized";
|
|
100
|
+
}
|
|
101
|
+
function eligible(slot) {
|
|
102
|
+
return (!slot.isTombstone &&
|
|
103
|
+
["confirmed", "finalized", "pending", "submitting"].includes(slot.status));
|
|
104
|
+
}
|
|
105
|
+
function sourceWindow(snapshot) {
|
|
106
|
+
const end = BigInt(snapshot.head?.expectedVersion ?? "0");
|
|
107
|
+
const rows = snapshot.versions.filter((slot) => BigInt(slot.expectedVersion) <= end);
|
|
108
|
+
const after = BigInt(rows.filter((slot) => slot.isTombstone && settled(slot)).at(-1)
|
|
109
|
+
?.expectedVersion ?? "0");
|
|
110
|
+
return {
|
|
111
|
+
end,
|
|
112
|
+
after,
|
|
113
|
+
relevant: rows.filter((slot) => BigInt(slot.expectedVersion) > after),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/** Reuse only a commitment still visible after the current registry deletion boundary. */
|
|
117
|
+
export function findCheckpointRegistration(snapshot, version, commitment) {
|
|
118
|
+
if (!snapshot.head || snapshot.head.deletedAt !== null)
|
|
119
|
+
return undefined;
|
|
120
|
+
const { end, after } = sourceWindow(snapshot);
|
|
121
|
+
if (BigInt(version) > end || BigInt(version) <= after)
|
|
122
|
+
return undefined;
|
|
123
|
+
return snapshot.versions.find((row) => row.expectedVersion === version &&
|
|
124
|
+
eligible(row) &&
|
|
125
|
+
row.dataHash.toLowerCase() === commitment.dataHash.toLowerCase() &&
|
|
126
|
+
row.metadataHash.toLowerCase() === commitment.metadataHash.toLowerCase());
|
|
127
|
+
}
|
|
128
|
+
function sourceData(data) {
|
|
129
|
+
if (data === null || typeof data !== "object" || Array.isArray(data))
|
|
130
|
+
return null;
|
|
131
|
+
return Object.fromEntries(Object.entries(data));
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Revalidates commitments, rather than trusting a numeric watermark or a local
|
|
135
|
+
* mutex. Persisted lost/lower-prefix writes are repaired from the next inventory.
|
|
136
|
+
*/
|
|
137
|
+
export function createDurableAdditions(options) {
|
|
138
|
+
const owner = options.ownerAddress.toLowerCase();
|
|
139
|
+
const { inventory, storageAdapter } = options;
|
|
140
|
+
async function readEnvelope(scope, slot, budget) {
|
|
141
|
+
budget.check();
|
|
142
|
+
if (budget.limited &&
|
|
143
|
+
(!storageAdapter.downloadBounded || !options.boundedWork))
|
|
144
|
+
throw new BoundedWorkUnavailable("Abortable bounded crypto/storage capability unavailable");
|
|
145
|
+
const url = storageAdapter.urlForKey(`${scope}/${slot.expectedVersion}`);
|
|
146
|
+
const encrypted = budget.limited && storageAdapter.downloadBounded
|
|
147
|
+
? await storageAdapter.downloadBounded(url, budget)
|
|
148
|
+
: await storageAdapter.download(url);
|
|
149
|
+
if (!budget.limited)
|
|
150
|
+
budget.check(encrypted.byteLength);
|
|
151
|
+
const password = hex(deriveScopeKey(options.masterKey, scope));
|
|
152
|
+
let plaintext;
|
|
153
|
+
try {
|
|
154
|
+
plaintext =
|
|
155
|
+
budget.limited && options.boundedWork
|
|
156
|
+
? await options.boundedWork.decrypt(encrypted, password, budget)
|
|
157
|
+
: await decryptWithPassword(encrypted, password);
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
if (error instanceof AdditionsRecoveryError ||
|
|
161
|
+
error instanceof BudgetExceeded ||
|
|
162
|
+
budget.signal?.aborted)
|
|
163
|
+
throw error;
|
|
164
|
+
throw new AdditionsRecoveryError("decrypt_failed");
|
|
165
|
+
}
|
|
166
|
+
budget.check(plaintext.byteLength);
|
|
167
|
+
if (keccak256(plaintext).toLowerCase() !== slot.dataHash.toLowerCase())
|
|
168
|
+
throw new AdditionsRecoveryError("data_hash_mismatch", "Additions content commitment mismatch");
|
|
169
|
+
budget.check(plaintext.byteLength * 3);
|
|
170
|
+
let envelope;
|
|
171
|
+
try {
|
|
172
|
+
envelope = DataFileEnvelopeSchema.parse(JSON.parse(new TextDecoder().decode(plaintext)));
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
throw new AdditionsRecoveryError("invalid_envelope");
|
|
176
|
+
}
|
|
177
|
+
const metadataHash = keccak256(stringToHex(JSON.stringify({
|
|
178
|
+
scope,
|
|
179
|
+
collectedAt: envelope.collectedAt,
|
|
180
|
+
sizeBytes: encrypted.byteLength,
|
|
181
|
+
})));
|
|
182
|
+
if (envelope.scope !== scope ||
|
|
183
|
+
!Number.isFinite(Date.parse(envelope.collectedAt)) ||
|
|
184
|
+
metadataHash.toLowerCase() !== slot.metadataHash.toLowerCase())
|
|
185
|
+
throw new AdditionsRecoveryError("metadata_hash_mismatch", "Additions metadata commitment mismatch");
|
|
186
|
+
budget.check();
|
|
187
|
+
return envelope;
|
|
188
|
+
}
|
|
189
|
+
async function current(scope, budget) {
|
|
190
|
+
budget.check();
|
|
191
|
+
const snapshot = await inventory.list(scope, budget.readOptions);
|
|
192
|
+
budget.check();
|
|
193
|
+
const head = snapshot.head;
|
|
194
|
+
if (!head || head.deletedAt !== null)
|
|
195
|
+
return null;
|
|
196
|
+
const slot = findCheckpointRegistration(snapshot, head.expectedVersion, head);
|
|
197
|
+
if (!slot)
|
|
198
|
+
throw new Error("Additions head missing from inventory");
|
|
199
|
+
return { snapshot, envelope: await readEnvelope(scope, slot, budget) };
|
|
200
|
+
}
|
|
201
|
+
async function readDocument(scope, budget, source, search, prefetched) {
|
|
202
|
+
const { relevant, after } = sourceWindow(source);
|
|
203
|
+
const systemScope = additionsLedgerScope(scope);
|
|
204
|
+
const snapshot = prefetched ?? (await inventory.list(systemScope, budget.readOptions));
|
|
205
|
+
if (!snapshot.head || snapshot.head.deletedAt !== null)
|
|
206
|
+
return null;
|
|
207
|
+
// Same visibility as source recovery: only settled tombstones at or below the head delete history.
|
|
208
|
+
const boundary = snapshot.versions
|
|
209
|
+
.filter((row) => row.isTombstone &&
|
|
210
|
+
settled(row) &&
|
|
211
|
+
BigInt(row.expectedVersion) <=
|
|
212
|
+
BigInt(snapshot.head.expectedVersion))
|
|
213
|
+
.at(-1)?.expectedVersion ?? "0";
|
|
214
|
+
let inaccessible = false;
|
|
215
|
+
const sourceFingerprint = fingerprintVersionInventory(source);
|
|
216
|
+
for (let index = snapshot.versions.length - 1; index >= 0; index--) {
|
|
217
|
+
budget.check();
|
|
218
|
+
const slot = snapshot.versions[index];
|
|
219
|
+
if (BigInt(slot.expectedVersion) <= BigInt(boundary) ||
|
|
220
|
+
BigInt(slot.expectedVersion) > BigInt(snapshot.head.expectedVersion) ||
|
|
221
|
+
(search && BigInt(slot.expectedVersion) >= BigInt(search.before)) ||
|
|
222
|
+
!eligible(slot))
|
|
223
|
+
continue;
|
|
224
|
+
const identity = JSON.stringify([
|
|
225
|
+
systemScope,
|
|
226
|
+
slot.expectedVersion,
|
|
227
|
+
slot.dataHash.toLowerCase(),
|
|
228
|
+
slot.metadataHash.toLowerCase(),
|
|
229
|
+
sourceFingerprint,
|
|
230
|
+
]);
|
|
231
|
+
const rejected = budget.checkpoints.rejected.get(identity);
|
|
232
|
+
if (rejected !== undefined) {
|
|
233
|
+
inaccessible ||= rejected === "inaccessible";
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
if (budget.checkpoints.reads >= CHECKPOINT_READ_LIMIT) {
|
|
237
|
+
try {
|
|
238
|
+
options.onRecoveryDiagnostic?.({
|
|
239
|
+
scope,
|
|
240
|
+
version: slot.expectedVersion,
|
|
241
|
+
code: "checkpoint_search_exhausted",
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
/* Observation cannot alter recovery. */
|
|
246
|
+
}
|
|
247
|
+
throw new CheckpointSearchExceeded("Retained checkpoint search exhausted");
|
|
248
|
+
}
|
|
249
|
+
budget.check(identity.length * 2 + 64);
|
|
250
|
+
budget.checkpoints.reads++;
|
|
251
|
+
let envelope;
|
|
252
|
+
try {
|
|
253
|
+
envelope = await readEnvelope(systemScope, slot, budget);
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
if (error instanceof BudgetExceeded || budget.signal?.aborted)
|
|
257
|
+
throw error;
|
|
258
|
+
inaccessible = true;
|
|
259
|
+
budget.checkpoints.rejected.set(identity, "inaccessible");
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
const parsed = documentSchema.safeParse(envelope.data);
|
|
263
|
+
if (!parsed.success ||
|
|
264
|
+
parsed.data.owner !== owner ||
|
|
265
|
+
parsed.data.network !== options.network ||
|
|
266
|
+
parsed.data.scope !== scope) {
|
|
267
|
+
budget.checkpoints.rejected.set(identity, "invalid");
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
const ledger = parsed.data.ledger === null
|
|
271
|
+
? null
|
|
272
|
+
: readScopeFirstSeenLedger(parsed.data.ledger);
|
|
273
|
+
if (parsed.data.ledger !== null && (!ledger || ledger.scope !== scope)) {
|
|
274
|
+
budget.checkpoints.rejected.set(identity, "invalid");
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
const candidate = { ...parsed.data, ledger };
|
|
278
|
+
if (candidate.slots.length > relevant.length ||
|
|
279
|
+
!candidate.slots.every((row, i) => eligible(relevant[i]) && sameCommitment(row, relevant[i])) ||
|
|
280
|
+
candidate.through !==
|
|
281
|
+
(candidate.slots.at(-1)?.expectedVersion ?? String(after))) {
|
|
282
|
+
budget.checkpoints.rejected.set(identity, "invalid");
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
if (search && candidate.slots.length <= search.longerThan)
|
|
286
|
+
continue;
|
|
287
|
+
return {
|
|
288
|
+
document: candidate,
|
|
289
|
+
publicationVersion: slot.expectedVersion,
|
|
290
|
+
repairHead: slot.expectedVersion !== snapshot.head.expectedVersion,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
if (inaccessible)
|
|
294
|
+
throw new InaccessibleLedger("No readable committed additions ledger version");
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
async function publish(scope, data, budget) {
|
|
298
|
+
budget.check();
|
|
299
|
+
if (budget.limited) {
|
|
300
|
+
if (!options.boundedWork)
|
|
301
|
+
throw new BoundedWorkUnavailable("Bounded checkpoint publication unavailable");
|
|
302
|
+
const proof = await options.boundedWork.publish(scope, data, budget);
|
|
303
|
+
budget.check();
|
|
304
|
+
const check = await inventory.list(scope, budget.readOptions);
|
|
305
|
+
const slot = findCheckpointRegistration(check, proof.expectedVersion, proof);
|
|
306
|
+
if (!slot)
|
|
307
|
+
throw new Error("Bounded checkpoint registration was replaced");
|
|
308
|
+
const envelope = await readEnvelope(scope, slot, budget);
|
|
309
|
+
if (JSON.stringify(envelope.data) !== JSON.stringify(data))
|
|
310
|
+
throw new Error("Bounded checkpoint content was replaced");
|
|
311
|
+
budget.check();
|
|
312
|
+
await options.boundedWork.confirmed?.(scope, budget);
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
const snapshot = await inventory.list(scope, budget.readOptions);
|
|
316
|
+
const toHead = (state) => state.head
|
|
317
|
+
? {
|
|
318
|
+
...state.head,
|
|
319
|
+
id: computeDataPointId(owner, scope),
|
|
320
|
+
}
|
|
321
|
+
: null;
|
|
322
|
+
const proof = await publishVersion({
|
|
323
|
+
ownerAddress: owner,
|
|
324
|
+
envelope: createDataFileEnvelope(scope, new Date().toISOString(), data),
|
|
325
|
+
preferredVersion: BigInt(snapshot.versions.at(-1)?.expectedVersion ?? "0") + 1n,
|
|
326
|
+
masterKey: options.masterKey,
|
|
327
|
+
storageAdapter,
|
|
328
|
+
signer: options.signer,
|
|
329
|
+
gateway: options.gateway,
|
|
330
|
+
fencedPublication: options.fencedPublication,
|
|
331
|
+
head: toHead(snapshot),
|
|
332
|
+
readHead: async () => toHead(await inventory.list(scope, budget.readOptions)),
|
|
333
|
+
// Rebuilding an explicitly deleted system document is a deliberate re-add.
|
|
334
|
+
acknowledgedDeletionVersion: snapshot.head?.deletedAt
|
|
335
|
+
? BigInt(snapshot.head.expectedVersion)
|
|
336
|
+
: undefined,
|
|
337
|
+
}).catch((error) => {
|
|
338
|
+
if (error instanceof NeedsFencedPublicationError)
|
|
339
|
+
options.onPublicationBlocked?.(error);
|
|
340
|
+
throw error;
|
|
341
|
+
});
|
|
342
|
+
const check = await inventory.list(scope, budget.readOptions);
|
|
343
|
+
const registered = findCheckpointRegistration(check, String(proof.version), proof);
|
|
344
|
+
if (!registered)
|
|
345
|
+
throw new Error("Concurrent additions publication replaced the registration");
|
|
346
|
+
await readEnvelope(scope, registered, budget);
|
|
347
|
+
}
|
|
348
|
+
async function recover(scope, budget, uploaded, initial, deferVerification) {
|
|
349
|
+
budget.check();
|
|
350
|
+
const snapshot = initial?.source ?? (await inventory.list(scope, budget.readOptions));
|
|
351
|
+
budget.check();
|
|
352
|
+
const head = snapshot.head;
|
|
353
|
+
if (!head || head.deletedAt !== null) {
|
|
354
|
+
const tombstone = head
|
|
355
|
+
? snapshot.versions.find((slot) => slot.expectedVersion === head.expectedVersion &&
|
|
356
|
+
slot.dataHash === head.dataHash &&
|
|
357
|
+
slot.metadataHash === head.metadataHash &&
|
|
358
|
+
slot.isTombstone &&
|
|
359
|
+
settled(slot))
|
|
360
|
+
: null;
|
|
361
|
+
const check = deferVerification
|
|
362
|
+
? snapshot
|
|
363
|
+
: await inventory.list(scope, budget.readOptions);
|
|
364
|
+
deferVerification?.(snapshot);
|
|
365
|
+
return {
|
|
366
|
+
ledger: null,
|
|
367
|
+
inventory: fingerprintVersionInventory(snapshot),
|
|
368
|
+
currentTotal: 0,
|
|
369
|
+
through: head?.expectedVersion ?? "0",
|
|
370
|
+
coverage: !sameInventory(snapshot, check)
|
|
371
|
+
? "behind"
|
|
372
|
+
: head
|
|
373
|
+
? settled(head) && tombstone
|
|
374
|
+
? "complete"
|
|
375
|
+
: "partial"
|
|
376
|
+
: snapshot.versions.length
|
|
377
|
+
? "partial"
|
|
378
|
+
: "complete",
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
const { end, after, relevant } = sourceWindow(snapshot);
|
|
382
|
+
let checkpoint = null;
|
|
383
|
+
let inaccessibleExisting = false;
|
|
384
|
+
try {
|
|
385
|
+
if (initial?.checkpoint?.status === "rejected")
|
|
386
|
+
throw initial.checkpoint.reason;
|
|
387
|
+
checkpoint = await readDocument(scope, budget, snapshot, undefined, initial?.checkpoint?.status === "fulfilled"
|
|
388
|
+
? initial.checkpoint.value
|
|
389
|
+
: undefined);
|
|
390
|
+
}
|
|
391
|
+
catch (error) {
|
|
392
|
+
if (error instanceof BudgetExceeded || budget.signal?.aborted)
|
|
393
|
+
throw error;
|
|
394
|
+
inaccessibleExisting = true;
|
|
395
|
+
}
|
|
396
|
+
let existing = checkpoint?.document ?? null;
|
|
397
|
+
const prefixValid = existing !== null;
|
|
398
|
+
let ledger = prefixValid ? existing.ledger : null;
|
|
399
|
+
const folded = prefixValid ? relevant.slice(0, existing.slots.length) : [];
|
|
400
|
+
let currentTotal = prefixValid ? existing.currentTotal : 0;
|
|
401
|
+
let through = folded.at(-1)?.expectedVersion ?? String(after);
|
|
402
|
+
let expected = after + 1n;
|
|
403
|
+
const headSlot = relevant.find((slot) => slot.expectedVersion === head.expectedVersion &&
|
|
404
|
+
slot.dataHash === head.dataHash &&
|
|
405
|
+
slot.metadataHash === head.metadataHash);
|
|
406
|
+
let coverage = headSlot && settled(head) ? "complete" : "partial";
|
|
407
|
+
for (const slot of relevant) {
|
|
408
|
+
if (BigInt(slot.expectedVersion) !== expected || !settled(slot))
|
|
409
|
+
coverage = "partial";
|
|
410
|
+
expected = BigInt(slot.expectedVersion) + 1n;
|
|
411
|
+
}
|
|
412
|
+
const sourceCoverage = coverage;
|
|
413
|
+
const checkpointBytes = (candidate, count) => 128 * 1024 +
|
|
414
|
+
128 *
|
|
415
|
+
new TextEncoder().encode(JSON.stringify({
|
|
416
|
+
ledger: candidate,
|
|
417
|
+
slots: relevant.slice(0, count),
|
|
418
|
+
owner,
|
|
419
|
+
network: options.network,
|
|
420
|
+
scope,
|
|
421
|
+
through,
|
|
422
|
+
currentTotal,
|
|
423
|
+
})).byteLength;
|
|
424
|
+
while (folded.length < relevant.length) {
|
|
425
|
+
const slot = relevant[folded.length];
|
|
426
|
+
let unitBudget = budget;
|
|
427
|
+
try {
|
|
428
|
+
// Keep publication capacity in the same owner-wide allowance. Exhaustion
|
|
429
|
+
// of the child leaves the already-folded prefix publishable.
|
|
430
|
+
unitBudget = budget.limited
|
|
431
|
+
? budget.excluding(checkpointBytes(ledger, folded.length))
|
|
432
|
+
: budget;
|
|
433
|
+
unitBudget.check();
|
|
434
|
+
if (BigInt(slot.expectedVersion) !== BigInt(through) + 1n)
|
|
435
|
+
coverage = "partial";
|
|
436
|
+
// Mutable slots are provisional; failed/unknown slots cannot advance the prefix.
|
|
437
|
+
if (!eligible(slot)) {
|
|
438
|
+
coverage = "partial";
|
|
439
|
+
break;
|
|
440
|
+
}
|
|
441
|
+
let version;
|
|
442
|
+
const proof = uploaded?.proof;
|
|
443
|
+
const inMemory = proof
|
|
444
|
+
? DataFileEnvelopeSchema.safeParse(proof.envelope)
|
|
445
|
+
: null;
|
|
446
|
+
const bytes = proof
|
|
447
|
+
? new TextEncoder().encode(JSON.stringify(proof.envelope))
|
|
448
|
+
: null;
|
|
449
|
+
const metadata = inMemory?.success && proof
|
|
450
|
+
? keccak256(stringToHex(JSON.stringify({
|
|
451
|
+
scope,
|
|
452
|
+
collectedAt: inMemory.data.collectedAt,
|
|
453
|
+
sizeBytes: proof.encryptedSize,
|
|
454
|
+
})))
|
|
455
|
+
: null;
|
|
456
|
+
if (inMemory?.success &&
|
|
457
|
+
bytes &&
|
|
458
|
+
inMemory.data.scope === scope &&
|
|
459
|
+
keccak256(bytes) === slot.dataHash &&
|
|
460
|
+
metadata === slot.metadataHash) {
|
|
461
|
+
const data = sourceData(inMemory.data.data);
|
|
462
|
+
if (!data)
|
|
463
|
+
throw new AdditionsRecoveryError("unsupported_source_data");
|
|
464
|
+
version = { scope, collectedAt: inMemory.data.collectedAt, data };
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
const envelope = await readEnvelope(scope, slot, unitBudget);
|
|
468
|
+
const data = sourceData(envelope.data);
|
|
469
|
+
if (!data)
|
|
470
|
+
throw new AdditionsRecoveryError("unsupported_source_data");
|
|
471
|
+
version = { scope, collectedAt: envelope.collectedAt, data };
|
|
472
|
+
}
|
|
473
|
+
const hadBaseline = ledger !== null && ledger.baseline !== null;
|
|
474
|
+
const candidate = await foldVersion(ledger, version);
|
|
475
|
+
unitBudget.check();
|
|
476
|
+
if (budget.limited &&
|
|
477
|
+
checkpointBytes(candidate, folded.length + 1) > budget.remaining)
|
|
478
|
+
throw new BudgetExceeded("Checkpoint cannot fit remaining recovery allowance");
|
|
479
|
+
ledger = candidate;
|
|
480
|
+
currentTotal =
|
|
481
|
+
(await extractRecordKeys(scope, version.data))?.total ?? 1;
|
|
482
|
+
// Reimport baseline and incomplete starts have unknown arrivals.
|
|
483
|
+
if (ledger && (after > 0n || relevant[0]?.expectedVersion !== "1")) {
|
|
484
|
+
ledger.partial = true;
|
|
485
|
+
if (!hadBaseline && ledger.baseline !== null)
|
|
486
|
+
ledger.unknownArrivalKeys = Object.keys(ledger.records);
|
|
487
|
+
}
|
|
488
|
+
folded.push(slot);
|
|
489
|
+
through = slot.expectedVersion;
|
|
490
|
+
}
|
|
491
|
+
catch (error) {
|
|
492
|
+
// Normal advancement needs one checkpoint, not the complete publication
|
|
493
|
+
// history. Search older evidence only when replay cannot advance, keeping
|
|
494
|
+
// the bytes reserved for publishing our best verified source prefix.
|
|
495
|
+
if (checkpoint && !budget.signal?.aborted) {
|
|
496
|
+
const searchBudget = budget.limited
|
|
497
|
+
? budget.excluding(checkpointBytes(ledger, folded.length))
|
|
498
|
+
: budget;
|
|
499
|
+
try {
|
|
500
|
+
const fallback = await readDocument(scope, searchBudget, snapshot, {
|
|
501
|
+
before: checkpoint.publicationVersion,
|
|
502
|
+
longerThan: folded.length,
|
|
503
|
+
});
|
|
504
|
+
if (fallback) {
|
|
505
|
+
checkpoint = fallback;
|
|
506
|
+
existing = fallback.document;
|
|
507
|
+
ledger = existing.ledger;
|
|
508
|
+
currentTotal = existing.currentTotal;
|
|
509
|
+
through = existing.through;
|
|
510
|
+
folded.splice(0, folded.length, ...relevant.slice(0, existing.slots.length));
|
|
511
|
+
coverage = sourceCoverage;
|
|
512
|
+
continue;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
catch (failure) {
|
|
516
|
+
// Keep the verified prefix and its publication reserve, but expose
|
|
517
|
+
// a bounded search that could not finish as retryable coverage.
|
|
518
|
+
if (failure instanceof BudgetExceeded)
|
|
519
|
+
error = failure;
|
|
520
|
+
else if (searchBudget.signal?.aborted)
|
|
521
|
+
error = new BudgetExceeded("Checkpoint fallback allowance exhausted");
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
try {
|
|
525
|
+
options.onRecoveryDiagnostic?.({
|
|
526
|
+
scope,
|
|
527
|
+
version: slot.expectedVersion,
|
|
528
|
+
code: error instanceof BudgetExceeded ||
|
|
529
|
+
(unitBudget.signal?.aborted &&
|
|
530
|
+
unitBudget.signal.reason instanceof DOMException &&
|
|
531
|
+
unitBudget.signal.reason.name === "TimeoutError")
|
|
532
|
+
? "budget_exceeded"
|
|
533
|
+
: budget.signal?.aborted
|
|
534
|
+
? "cancelled"
|
|
535
|
+
: error instanceof AdditionsRecoveryError
|
|
536
|
+
? error.code
|
|
537
|
+
: "replay_failed",
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
catch {
|
|
541
|
+
/* Observation cannot alter recovery. */
|
|
542
|
+
}
|
|
543
|
+
coverage =
|
|
544
|
+
error instanceof BudgetExceeded ||
|
|
545
|
+
budget.signal?.aborted ||
|
|
546
|
+
unitBudget.signal?.aborted
|
|
547
|
+
? "behind"
|
|
548
|
+
: "partial";
|
|
549
|
+
break;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
if (BigInt(through) !== end && coverage === "complete")
|
|
553
|
+
coverage = "partial";
|
|
554
|
+
if (ledger?.incomplete || ledger?.skipped)
|
|
555
|
+
coverage = "partial";
|
|
556
|
+
const document = {
|
|
557
|
+
version: 1,
|
|
558
|
+
owner,
|
|
559
|
+
network: options.network,
|
|
560
|
+
scope,
|
|
561
|
+
through,
|
|
562
|
+
currentTotal,
|
|
563
|
+
slots: folded,
|
|
564
|
+
ledger,
|
|
565
|
+
};
|
|
566
|
+
// A matching retained document needs no publication. Delay only its final
|
|
567
|
+
// observation so summaries can authenticate those independent inventories
|
|
568
|
+
// together after all content reads. Never defer a changed prefix: it must
|
|
569
|
+
// spend its reserved publication capacity before the next source unit.
|
|
570
|
+
if (deferVerification &&
|
|
571
|
+
!checkpoint?.repairHead &&
|
|
572
|
+
JSON.stringify(document) === JSON.stringify(existing)) {
|
|
573
|
+
deferVerification(snapshot);
|
|
574
|
+
return {
|
|
575
|
+
ledger,
|
|
576
|
+
through,
|
|
577
|
+
currentTotal,
|
|
578
|
+
coverage,
|
|
579
|
+
inventory: fingerprintVersionInventory(snapshot),
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
// The pages above are separate snapshots. Never certify against an old view.
|
|
583
|
+
if (!budget.signal?.aborted) {
|
|
584
|
+
const check = await inventory.list(scope, budget.readOptions);
|
|
585
|
+
if (!sameInventory(snapshot, check))
|
|
586
|
+
return {
|
|
587
|
+
ledger: null,
|
|
588
|
+
inventory: fingerprintVersionInventory(snapshot),
|
|
589
|
+
through: "0",
|
|
590
|
+
currentTotal: 0,
|
|
591
|
+
coverage: "behind",
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
// Never replace durable permanent evidence with a failed invalidation replay.
|
|
595
|
+
if (((!existing && !inaccessibleExisting) ||
|
|
596
|
+
prefixValid ||
|
|
597
|
+
coverage === "complete") &&
|
|
598
|
+
(checkpoint?.repairHead ||
|
|
599
|
+
JSON.stringify(document) !== JSON.stringify(existing))) {
|
|
600
|
+
// A write failure affects durability, never hides the verified in-memory result.
|
|
601
|
+
try {
|
|
602
|
+
await publish(additionsLedgerScope(scope), { ...document }, budget);
|
|
603
|
+
}
|
|
604
|
+
catch {
|
|
605
|
+
coverage = coverage === "complete" ? "behind" : coverage;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
return {
|
|
609
|
+
ledger,
|
|
610
|
+
through,
|
|
611
|
+
currentTotal,
|
|
612
|
+
coverage,
|
|
613
|
+
inventory: fingerprintVersionInventory(snapshot),
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
return {
|
|
617
|
+
async summarize(input) {
|
|
618
|
+
const budget = new ReadBudget(options);
|
|
619
|
+
if (budget.limited &&
|
|
620
|
+
(!options.boundedWork || !storageAdapter.downloadBounded))
|
|
621
|
+
return summarizeAdditions({
|
|
622
|
+
...input,
|
|
623
|
+
ledgers: [],
|
|
624
|
+
coverage: "unavailable",
|
|
625
|
+
});
|
|
626
|
+
const ledgers = [];
|
|
627
|
+
const through = {};
|
|
628
|
+
const provenance = {};
|
|
629
|
+
let coverage = "complete";
|
|
630
|
+
let scopes = [];
|
|
631
|
+
try {
|
|
632
|
+
scopes = (await inventory.listScopes(budget.readOptions))
|
|
633
|
+
.filter((scope) => !isSystemScope(scope))
|
|
634
|
+
.sort();
|
|
635
|
+
// Overlap owner signing and small registry reads, not source replay or
|
|
636
|
+
// checkpoint writes. Snapshots live only in this invocation and recovery
|
|
637
|
+
// still observes each source again after reading its committed evidence.
|
|
638
|
+
const snapshots = new Map();
|
|
639
|
+
for (let offset = 0; offset < scopes.length; offset += INVENTORY_CONCURRENCY) {
|
|
640
|
+
const batch = await Promise.allSettled(scopes
|
|
641
|
+
.slice(offset, offset + INVENTORY_CONCURRENCY)
|
|
642
|
+
.map(async (scope) => {
|
|
643
|
+
const source = await inventory.list(scope, budget.readOptions);
|
|
644
|
+
const checkpoint = source.head && source.head.deletedAt === null
|
|
645
|
+
? await inventory
|
|
646
|
+
.list(additionsLedgerScope(scope), budget.readOptions)
|
|
647
|
+
.then((value) => ({
|
|
648
|
+
status: "fulfilled",
|
|
649
|
+
value,
|
|
650
|
+
}), (reason) => ({
|
|
651
|
+
status: "rejected",
|
|
652
|
+
reason,
|
|
653
|
+
}))
|
|
654
|
+
: undefined;
|
|
655
|
+
return { scope, source, checkpoint };
|
|
656
|
+
}));
|
|
657
|
+
// Settle every admitted request before propagating cancellation/failure.
|
|
658
|
+
for (const item of batch) {
|
|
659
|
+
if (item.status === "rejected")
|
|
660
|
+
throw item.reason;
|
|
661
|
+
snapshots.set(item.value.scope, item.value);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
const deferred = new Map();
|
|
665
|
+
for (const scope of scopes) {
|
|
666
|
+
const result = await recover(scope, budget, undefined, snapshots.get(scope), (snapshot) => deferred.set(scope, snapshot));
|
|
667
|
+
if (result.ledger)
|
|
668
|
+
ledgers.push({
|
|
669
|
+
...result.ledger,
|
|
670
|
+
latest: { ...result.ledger.latest, total: result.currentTotal },
|
|
671
|
+
});
|
|
672
|
+
through[scope] = result.through;
|
|
673
|
+
provenance[scope] = result.inventory;
|
|
674
|
+
if (result.coverage === "behind" ||
|
|
675
|
+
(result.coverage === "partial" && coverage === "complete"))
|
|
676
|
+
coverage = result.coverage;
|
|
677
|
+
}
|
|
678
|
+
const pending = [...deferred];
|
|
679
|
+
for (let offset = 0; offset < pending.length; offset += INVENTORY_CONCURRENCY) {
|
|
680
|
+
const batch = await Promise.allSettled(pending
|
|
681
|
+
.slice(offset, offset + INVENTORY_CONCURRENCY)
|
|
682
|
+
.map(async ([scope, snapshot]) => {
|
|
683
|
+
const check = await inventory.list(scope, budget.readOptions);
|
|
684
|
+
if (!sameInventory(snapshot, check))
|
|
685
|
+
coverage = "behind";
|
|
686
|
+
}));
|
|
687
|
+
for (const item of batch)
|
|
688
|
+
if (item.status === "rejected")
|
|
689
|
+
throw item.reason;
|
|
690
|
+
}
|
|
691
|
+
const check = (await inventory.listScopes(budget.readOptions))
|
|
692
|
+
.filter((scope) => !isSystemScope(scope))
|
|
693
|
+
.sort();
|
|
694
|
+
if (JSON.stringify(scopes) !== JSON.stringify(check))
|
|
695
|
+
coverage = "behind";
|
|
696
|
+
}
|
|
697
|
+
catch (error) {
|
|
698
|
+
coverage =
|
|
699
|
+
error instanceof BudgetExceeded || budget.signal?.aborted
|
|
700
|
+
? "behind"
|
|
701
|
+
: "unavailable";
|
|
702
|
+
}
|
|
703
|
+
const result = await summarizeAdditions({
|
|
704
|
+
...input,
|
|
705
|
+
ledgers,
|
|
706
|
+
coverage,
|
|
707
|
+
through,
|
|
708
|
+
inventory: provenance,
|
|
709
|
+
});
|
|
710
|
+
// Publish one portable UTC summary on reads, never on every source upload.
|
|
711
|
+
if (coverage === "complete" || coverage === "partial") {
|
|
712
|
+
try {
|
|
713
|
+
const portable = await summarizeAdditions({
|
|
714
|
+
...input,
|
|
715
|
+
timezone: "UTC",
|
|
716
|
+
ledgers,
|
|
717
|
+
coverage,
|
|
718
|
+
through,
|
|
719
|
+
inventory: provenance,
|
|
720
|
+
});
|
|
721
|
+
const serialized = JSON.stringify(portable);
|
|
722
|
+
if (new TextEncoder().encode(serialized).byteLength >
|
|
723
|
+
ADDITIONS_SUMMARY_MAX_BYTES)
|
|
724
|
+
throw new Error("Portable additions summary exceeds browser size limit");
|
|
725
|
+
budget.check(serialized.length * 2);
|
|
726
|
+
let previous = null;
|
|
727
|
+
try {
|
|
728
|
+
previous = await current(ADDITIONS_SUMMARY_SCOPE, budget);
|
|
729
|
+
}
|
|
730
|
+
catch (error) {
|
|
731
|
+
if (error instanceof BudgetExceeded || budget.signal?.aborted)
|
|
732
|
+
throw error;
|
|
733
|
+
}
|
|
734
|
+
if (JSON.stringify(previous?.envelope.data) !== JSON.stringify(portable)) {
|
|
735
|
+
budget.check();
|
|
736
|
+
await new Promise((resolve) => setTimeout(resolve, Math.floor(crypto.getRandomValues(new Uint8Array(1))[0] / 8)));
|
|
737
|
+
await publish(ADDITIONS_SUMMARY_SCOPE, { ...portable }, budget);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
catch (error) {
|
|
741
|
+
if (error instanceof NeedsFencedPublicationError &&
|
|
742
|
+
error.scope === ADDITIONS_SUMMARY_SCOPE) {
|
|
743
|
+
// The current source/checkpoint observations still prove this read.
|
|
744
|
+
// Do not cross the deletion fence merely to persist a derived cache.
|
|
745
|
+
try {
|
|
746
|
+
options.onRecoveryDiagnostic?.({
|
|
747
|
+
scope: ADDITIONS_SUMMARY_SCOPE,
|
|
748
|
+
version: "0",
|
|
749
|
+
code: "publication_blocked",
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
catch {
|
|
753
|
+
/* Observation cannot alter recovery. */
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
else
|
|
757
|
+
result.coverage = "behind";
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
try {
|
|
761
|
+
budget.check();
|
|
762
|
+
}
|
|
763
|
+
catch {
|
|
764
|
+
result.coverage = "behind";
|
|
765
|
+
}
|
|
766
|
+
return result;
|
|
767
|
+
},
|
|
768
|
+
async recordUpload(version, proof) {
|
|
769
|
+
if (isSystemScope(version.scope))
|
|
770
|
+
return;
|
|
771
|
+
// Optional optimization only. Correctness always comes from read recovery.
|
|
772
|
+
try {
|
|
773
|
+
const budget = new ReadBudget(options);
|
|
774
|
+
// Bounded recovery reads committed bytes through the bounded transport;
|
|
775
|
+
// never parse or serialize an unbounded caller-owned upload hint.
|
|
776
|
+
if (budget.limited)
|
|
777
|
+
proof = undefined;
|
|
778
|
+
if (budget.limited &&
|
|
779
|
+
(!options.boundedWork || !storageAdapter.downloadBounded))
|
|
780
|
+
return;
|
|
781
|
+
const snapshot = await inventory.list(version.scope, budget.readOptions);
|
|
782
|
+
const head = snapshot.head;
|
|
783
|
+
if (!head || head.deletedAt !== null)
|
|
784
|
+
return;
|
|
785
|
+
if (proof &&
|
|
786
|
+
keccak256(new TextEncoder().encode(JSON.stringify(proof.envelope))) !== head.dataHash)
|
|
787
|
+
return;
|
|
788
|
+
const previous = (await readDocument(version.scope, budget, snapshot))
|
|
789
|
+
?.document;
|
|
790
|
+
const { after } = sourceWindow(snapshot);
|
|
791
|
+
const startsFresh = BigInt(head.expectedVersion) === after + 1n;
|
|
792
|
+
if (!startsFresh &&
|
|
793
|
+
(!previous ||
|
|
794
|
+
BigInt(previous.through) + 1n !== BigInt(head.expectedVersion)))
|
|
795
|
+
return;
|
|
796
|
+
const uploaded = !budget.limited && "collectedAt" in version && "data" in version
|
|
797
|
+
? { version, proof }
|
|
798
|
+
: undefined;
|
|
799
|
+
await recover(version.scope, budget, uploaded);
|
|
800
|
+
}
|
|
801
|
+
catch {
|
|
802
|
+
/* Next reader retries. */
|
|
803
|
+
}
|
|
804
|
+
},
|
|
805
|
+
async deleteScope(scope, deletion) {
|
|
806
|
+
deletion?.signal?.throwIfAborted();
|
|
807
|
+
options.signal?.throwIfAborted();
|
|
808
|
+
if (isSystemScope(scope))
|
|
809
|
+
return;
|
|
810
|
+
// Lite owns a separate bounded registry/journal deleter. This core host
|
|
811
|
+
// only has ordinary cleanup and must not silently use it for durableOnly.
|
|
812
|
+
if (deletion?.durableOnly)
|
|
813
|
+
throw new Error("Bounded additions deletion is unavailable");
|
|
814
|
+
if (!options.deleteSystemScope)
|
|
815
|
+
throw new Error("Durable additions deletion is unavailable");
|
|
816
|
+
await options.deleteSystemScope(additionsLedgerScope(scope));
|
|
817
|
+
// Invalidate the portable summary immediately. The next reader rebuilds
|
|
818
|
+
// from authoritative source tombstones and cannot show deleted counts.
|
|
819
|
+
await options.deleteSystemScope(ADDITIONS_SUMMARY_SCOPE);
|
|
820
|
+
},
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
//# sourceMappingURL=durable.js.map
|