@opendatalabs/personal-server-ts-core 0.0.1-canary.052d47e → 0.0.1-canary.0620a9a
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/index.d.ts +192 -8
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1227 -153
- package/dist/api/index.js.map +1 -1
- 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/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/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 +70 -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 +320 -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.map +1 -1
- package/dist/contracts/sync.js +1 -0
- 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 +68 -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 +86 -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/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/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 +38 -0
- package/dist/legacy-projection/index.d.ts.map +1 -0
- package/dist/legacy-projection/index.js +231 -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/mcp/approval-url.d.ts +68 -0
- package/dist/mcp/approval-url.d.ts.map +1 -0
- package/dist/mcp/approval-url.js +95 -0
- package/dist/mcp/approval-url.js.map +1 -0
- package/dist/mcp/connection-api.d.ts +187 -3
- package/dist/mcp/connection-api.d.ts.map +1 -1
- package/dist/mcp/connection-api.js +600 -26
- package/dist/mcp/connection-api.js.map +1 -1
- package/dist/mcp/grantee.d.ts +1 -1
- package/dist/mcp/grantee.d.ts.map +1 -1
- package/dist/mcp/index.d.ts +4 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +4 -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 +5 -1
- package/dist/mcp/read-client.d.ts.map +1 -1
- package/dist/mcp/read-client.js +18 -4
- package/dist/mcp/read-client.js.map +1 -1
- package/dist/mcp/resources.d.ts.map +1 -1
- package/dist/mcp/resources.js +3 -0
- package/dist/mcp/resources.js.map +1 -1
- package/dist/mcp/server.d.ts +30 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +172 -17
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/session.d.ts +1 -1
- package/dist/mcp/session.d.ts.map +1 -1
- package/dist/mcp/session.js +17 -3
- package/dist/mcp/session.js.map +1 -1
- package/dist/mcp/store.d.ts +10 -1
- package/dist/mcp/store.d.ts.map +1 -1
- package/dist/mcp/store.js +72 -0
- 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 +92 -3
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +513 -28
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/types.d.ts +103 -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 +315 -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 +16 -0
- package/dist/policy/reserved-scopes.js.map +1 -0
- package/dist/ports/index.d.ts +266 -5
- 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 +109 -0
- package/dist/publication/publish.d.ts.map +1 -0
- package/dist/publication/publish.js +263 -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 +71 -0
- package/dist/schemas/server-config.d.ts.map +1 -1
- package/dist/schemas/server-config.js +151 -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 +21 -1
- 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/sdk.d.ts +2 -1
- package/dist/storage/adapters/sdk.d.ts.map +1 -1
- package/dist/storage/adapters/sdk.js +21 -3
- package/dist/storage/adapters/sdk.js.map +1 -1
- package/dist/storage/adapters/vana-audience.d.ts +24 -0
- package/dist/storage/adapters/vana-audience.d.ts.map +1 -0
- package/dist/storage/adapters/vana-audience.js +87 -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 +69 -23
- 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 +30 -3
- 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 +206 -0
- package/dist/storage/legacy-scope-view.d.ts.map +1 -0
- package/dist/storage/legacy-scope-view.js +1061 -0
- package/dist/storage/legacy-scope-view.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 +202 -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 +31 -0
- package/dist/stream-sync/artifacts.d.ts.map +1 -0
- package/dist/stream-sync/artifacts.js +106 -0
- package/dist/stream-sync/artifacts.js.map +1 -0
- package/dist/stream-sync/blobs.d.ts +11 -0
- package/dist/stream-sync/blobs.d.ts.map +1 -0
- package/dist/stream-sync/blobs.js +34 -0
- package/dist/stream-sync/blobs.js.map +1 -0
- package/dist/stream-sync/crypto.d.ts +21 -0
- package/dist/stream-sync/crypto.d.ts.map +1 -0
- package/dist/stream-sync/crypto.js +45 -0
- package/dist/stream-sync/crypto.js.map +1 -0
- package/dist/stream-sync/home.d.ts +46 -0
- package/dist/stream-sync/home.d.ts.map +1 -0
- package/dist/stream-sync/home.js +37 -0
- package/dist/stream-sync/home.js.map +1 -0
- package/dist/stream-sync/index.d.ts +14 -0
- package/dist/stream-sync/index.d.ts.map +1 -0
- package/dist/stream-sync/index.js +14 -0
- package/dist/stream-sync/index.js.map +1 -0
- package/dist/stream-sync/intake.d.ts +165 -0
- package/dist/stream-sync/intake.d.ts.map +1 -0
- package/dist/stream-sync/intake.js +467 -0
- package/dist/stream-sync/intake.js.map +1 -0
- package/dist/stream-sync/io-barrier.d.ts +39 -0
- package/dist/stream-sync/io-barrier.d.ts.map +1 -0
- package/dist/stream-sync/io-barrier.js +130 -0
- package/dist/stream-sync/io-barrier.js.map +1 -0
- package/dist/stream-sync/memory-files.d.ts +6 -0
- package/dist/stream-sync/memory-files.d.ts.map +1 -0
- package/dist/stream-sync/memory-files.js +50 -0
- package/dist/stream-sync/memory-files.js.map +1 -0
- package/dist/stream-sync/ports.d.ts +134 -0
- package/dist/stream-sync/ports.d.ts.map +1 -0
- package/dist/stream-sync/ports.js +26 -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 +212 -0
- package/dist/stream-sync/publish-plan.js.map +1 -0
- package/dist/stream-sync/registry.d.ts +19 -0
- package/dist/stream-sync/registry.d.ts.map +1 -0
- package/dist/stream-sync/registry.js +125 -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/spool.d.ts +69 -0
- package/dist/stream-sync/spool.d.ts.map +1 -0
- package/dist/stream-sync/spool.js +197 -0
- package/dist/stream-sync/spool.js.map +1 -0
- package/dist/stream-sync/writer-overlay.d.ts +19 -0
- package/dist/stream-sync/writer-overlay.d.ts.map +1 -0
- package/dist/stream-sync/writer-overlay.js +55 -0
- package/dist/stream-sync/writer-overlay.js.map +1 -0
- package/dist/stream-sync/writer.d.ts +404 -0
- package/dist/stream-sync/writer.d.ts.map +1 -0
- package/dist/stream-sync/writer.js +1994 -0
- package/dist/stream-sync/writer.js.map +1 -0
- package/dist/stream-sync-read/fold.d.ts +69 -0
- package/dist/stream-sync-read/fold.d.ts.map +1 -0
- package/dist/stream-sync-read/fold.js +83 -0
- package/dist/stream-sync-read/fold.js.map +1 -0
- package/dist/stream-sync-read/importer.d.ts +81 -0
- package/dist/stream-sync-read/importer.d.ts.map +1 -0
- package/dist/stream-sync-read/importer.js +226 -0
- package/dist/stream-sync-read/importer.js.map +1 -0
- package/dist/stream-sync-read/index.d.ts +8 -0
- package/dist/stream-sync-read/index.d.ts.map +1 -0
- package/dist/stream-sync-read/index.js +5 -0
- package/dist/stream-sync-read/index.js.map +1 -0
- package/dist/stream-sync-read/keys.d.ts +16 -0
- package/dist/stream-sync-read/keys.d.ts.map +1 -0
- package/dist/stream-sync-read/keys.js +48 -0
- package/dist/stream-sync-read/keys.js.map +1 -0
- package/dist/stream-sync-read/lines.d.ts +37 -0
- package/dist/stream-sync-read/lines.d.ts.map +1 -0
- package/dist/stream-sync-read/lines.js +98 -0
- package/dist/stream-sync-read/lines.js.map +1 -0
- package/dist/stream-sync-read/memory-files.d.ts +6 -0
- package/dist/stream-sync-read/memory-files.d.ts.map +1 -0
- package/dist/stream-sync-read/memory-files.js +34 -0
- package/dist/stream-sync-read/memory-files.js.map +1 -0
- package/dist/stream-sync-read/mirror.d.ts +80 -0
- package/dist/stream-sync-read/mirror.d.ts.map +1 -0
- package/dist/stream-sync-read/mirror.js +189 -0
- package/dist/stream-sync-read/mirror.js.map +1 -0
- package/dist/stream-sync-read/ports.d.ts +155 -0
- package/dist/stream-sync-read/ports.d.ts.map +1 -0
- package/dist/stream-sync-read/ports.js +9 -0
- package/dist/stream-sync-read/ports.js.map +1 -0
- package/dist/stream-sync-read/projection.d.ts +47 -0
- package/dist/stream-sync-read/projection.d.ts.map +1 -0
- package/dist/stream-sync-read/projection.js +338 -0
- package/dist/stream-sync-read/projection.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-fixture.d.ts +94 -0
- package/dist/stream-sync-read/service-fixture.d.ts.map +1 -0
- package/dist/stream-sync-read/service-fixture.js +227 -0
- package/dist/stream-sync-read/service-fixture.js.map +1 -0
- package/dist/stream-sync-read/service.d.ts +260 -0
- package/dist/stream-sync-read/service.d.ts.map +1 -0
- package/dist/stream-sync-read/service.js +975 -0
- package/dist/stream-sync-read/service.js.map +1 -0
- package/dist/stream-sync-read/testing.d.ts +54 -0
- package/dist/stream-sync-read/testing.d.ts.map +1 -0
- package/dist/stream-sync-read/testing.js +80 -0
- package/dist/stream-sync-read/testing.js.map +1 -0
- package/dist/stream-sync-read/view-store.d.ts +98 -0
- package/dist/stream-sync-read/view-store.d.ts.map +1 -0
- package/dist/stream-sync-read/view-store.js +278 -0
- package/dist/stream-sync-read/view-store.js.map +1 -0
- package/dist/stream-sync-read/writer-rig.d.ts +122 -0
- package/dist/stream-sync-read/writer-rig.d.ts.map +1 -0
- package/dist/stream-sync-read/writer-rig.js +301 -0
- package/dist/stream-sync-read/writer-rig.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/sync-manager.d.ts +21 -1
- package/dist/sync/engine/sync-manager.d.ts.map +1 -1
- package/dist/sync/engine/sync-manager.js +140 -11
- package/dist/sync/engine/sync-manager.js.map +1 -1
- package/dist/sync/index.d.ts +6 -2
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +7 -1
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/pdpp-import.d.ts +192 -0
- package/dist/sync/pdpp-import.d.ts.map +1 -0
- package/dist/sync/pdpp-import.js +441 -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 +10 -0
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/workers/delete.d.ts +54 -5
- package/dist/sync/workers/delete.d.ts.map +1 -1
- package/dist/sync/workers/delete.js +594 -170
- package/dist/sync/workers/delete.js.map +1 -1
- package/dist/sync/workers/download.d.ts +42 -1
- package/dist/sync/workers/download.d.ts.map +1 -1
- package/dist/sync/workers/download.js +344 -24
- 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 +27 -6
- package/dist/sync/workers/upload.d.ts.map +1 -1
- package/dist/sync/workers/upload.js +169 -274
- package/dist/sync/workers/upload.js.map +1 -1
- package/dist/test-utils/memory-storage.d.ts +1 -1
- package/dist/test-utils/memory-storage.d.ts.map +1 -1
- package/dist/test-utils/memory-storage.js +83 -17
- 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/package.json +103 -3
|
@@ -0,0 +1,975 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stream-sync read side of one Personal Server (§2.9, §2.10).
|
|
3
|
+
*
|
|
4
|
+
* - The download worker hands it every physical registry row it lists
|
|
5
|
+
* (`observe`), before its cursor moves, then lets it import (`importPending`).
|
|
6
|
+
* - A data GET asks `resolve` what to serve for a requested name: a stream
|
|
7
|
+
* view, the existing legacy path, or a refusal. The decision is the
|
|
8
|
+
* package's one `eligible` rule; nothing here re-derives it.
|
|
9
|
+
*
|
|
10
|
+
* Requested names are logical: `pdpp.<c>.<s>` or a legacy binding name. A
|
|
11
|
+
* caller may pick a connection with `connection=<ns>`; grants never name
|
|
12
|
+
* one. Physical `~` names are never accepted as a requested name.
|
|
13
|
+
*/
|
|
14
|
+
import { canonicalBytes32, classifyStreamRow, controlHashes, eligible, isHeadLive, selectConnection, streamScope, } from "@opendatalabs/personal-server-ts-stream-sync";
|
|
15
|
+
import { alternateLegacyBindingsForScope, LEGACY_SCOPE_BINDINGS, } from "../legacy-projection/index.js";
|
|
16
|
+
import { foldPlan, planHeadOf, } from "./fold.js";
|
|
17
|
+
import { StreamSyncImporter } from "./importer.js";
|
|
18
|
+
import { NO_OVERLAY, overlayWinners, viewLines, } from "./lines.js";
|
|
19
|
+
import { RegistryMirror, toControlRead, } from "./mirror.js";
|
|
20
|
+
import { planProjection, ProjectionFailedError } from "./projection.js";
|
|
21
|
+
import { isPhysicalScope, logicalStreamScopeParts } from "./routing.js";
|
|
22
|
+
import { ViewStore, } from "./view-store.js";
|
|
23
|
+
/**
|
|
24
|
+
* One row per stream the read side knows, for owner diagnostics. `records` is
|
|
25
|
+
* the imported head's record count only while that head is live (§2.4). A
|
|
26
|
+
* pending (unimported), tombstoned, superseded-generation or
|
|
27
|
+
* deleted-connection head counts `null`. Logical connection selection, a
|
|
28
|
+
* legacy-file fallback and rows from the local outbox overlay are outside
|
|
29
|
+
* this count.
|
|
30
|
+
*/
|
|
31
|
+
export function liveStreamCounts(status) {
|
|
32
|
+
return status.connections.flatMap((connection) => Object.entries(connection.streams).map(([stream, head]) => ({
|
|
33
|
+
connector: connection.connector,
|
|
34
|
+
ns: connection.ns,
|
|
35
|
+
stream,
|
|
36
|
+
records: head.live ? head.records : null,
|
|
37
|
+
})));
|
|
38
|
+
}
|
|
39
|
+
const NS = /^(?:[0-9a-f]{16})?$/;
|
|
40
|
+
const DEFAULT_ARRAY_BUDGET = 64 * 1024 * 1024;
|
|
41
|
+
const encoder = new TextEncoder();
|
|
42
|
+
function legacyConnectorKey(pdppSource) {
|
|
43
|
+
return pdppSource.slice(pdppSource.lastIndexOf("/") + 1);
|
|
44
|
+
}
|
|
45
|
+
/** The connectors and streams a logical name reads. */
|
|
46
|
+
export function readTargets(scope) {
|
|
47
|
+
if (isPhysicalScope(scope))
|
|
48
|
+
return [];
|
|
49
|
+
const targets = new Map();
|
|
50
|
+
const plain = logicalStreamScopeParts(scope);
|
|
51
|
+
if (plain) {
|
|
52
|
+
targets.set(plain.connector, {
|
|
53
|
+
connector: plain.connector,
|
|
54
|
+
streams: [plain.stream],
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const original = LEGACY_SCOPE_BINDINGS.get(scope);
|
|
58
|
+
if (original) {
|
|
59
|
+
const connector = legacyConnectorKey(original.pdppSource);
|
|
60
|
+
targets.set(connector, {
|
|
61
|
+
connector,
|
|
62
|
+
streams: original.pdppStreams,
|
|
63
|
+
binding: original,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
for (const [profileKey, binding] of alternateLegacyBindingsForScope(scope)) {
|
|
67
|
+
targets.set(profileKey, {
|
|
68
|
+
connector: profileKey,
|
|
69
|
+
streams: binding.pdppStreams,
|
|
70
|
+
binding,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return [...targets.values()];
|
|
74
|
+
}
|
|
75
|
+
/** Whether the imported view holds everything the published stream holds. */
|
|
76
|
+
function covers(base, receipt) {
|
|
77
|
+
if (base.head.generation !== receipt.generation)
|
|
78
|
+
return false;
|
|
79
|
+
if (base.version > receipt.registryVersion)
|
|
80
|
+
return true;
|
|
81
|
+
return (base.version === receipt.registryVersion &&
|
|
82
|
+
sameBytes32(base.dataHash, receipt.dataHash));
|
|
83
|
+
}
|
|
84
|
+
/** Digests compare in the one spelling the writer uses; a malformed one never matches. */
|
|
85
|
+
function sameBytes32(a, b) {
|
|
86
|
+
try {
|
|
87
|
+
return canonicalBytes32(a) === canonicalBytes32(b);
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function encodeCursor(cursor) {
|
|
94
|
+
const json = JSON.stringify(cursor);
|
|
95
|
+
let binary = "";
|
|
96
|
+
for (const byte of encoder.encode(json))
|
|
97
|
+
binary += String.fromCharCode(byte);
|
|
98
|
+
return btoa(binary)
|
|
99
|
+
.replace(/\+/g, "-")
|
|
100
|
+
.replace(/\//g, "_")
|
|
101
|
+
.replace(/=+$/, "");
|
|
102
|
+
}
|
|
103
|
+
function decodeCursor(text) {
|
|
104
|
+
try {
|
|
105
|
+
const binary = atob(text.replace(/-/g, "+").replace(/_/g, "/"));
|
|
106
|
+
const bytes = Uint8Array.from(binary, (c) => c.charCodeAt(0));
|
|
107
|
+
const parsed = JSON.parse(new TextDecoder().decode(bytes));
|
|
108
|
+
if (typeof parsed?.c !== "string" || typeof parsed.ns !== "string") {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
const streams = {};
|
|
112
|
+
if (typeof parsed.s === "object" && parsed.s !== null) {
|
|
113
|
+
for (const [name, pin] of Object.entries(parsed.s)) {
|
|
114
|
+
const { b, m, p, d, h } = (pin ?? {});
|
|
115
|
+
if (b !== null && !Number.isSafeInteger(b))
|
|
116
|
+
return null;
|
|
117
|
+
const pairs = (x) => Array.isArray(x) &&
|
|
118
|
+
x.every((y) => Array.isArray(y) &&
|
|
119
|
+
y.length === 2 &&
|
|
120
|
+
typeof y[0] === "string" &&
|
|
121
|
+
typeof y[1] === "string");
|
|
122
|
+
if (m !== undefined && !pairs(m))
|
|
123
|
+
return null;
|
|
124
|
+
if (p !== undefined && !pairs(p))
|
|
125
|
+
return null;
|
|
126
|
+
if (d !== undefined && typeof d !== "boolean")
|
|
127
|
+
return null;
|
|
128
|
+
if (h !== undefined && typeof h !== "string")
|
|
129
|
+
return null;
|
|
130
|
+
streams[name] = {
|
|
131
|
+
b: b,
|
|
132
|
+
...(m ? { m: m } : {}),
|
|
133
|
+
...(p ? { p: p } : {}),
|
|
134
|
+
...(d !== undefined ? { d } : {}),
|
|
135
|
+
...(h !== undefined ? { h } : {}),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else if (typeof parsed.v === "object" && parsed.v !== null) {
|
|
140
|
+
// A cursor from before overlay pins: registry versions only.
|
|
141
|
+
for (const [name, version] of Object.entries(parsed.v)) {
|
|
142
|
+
if (!Number.isSafeInteger(version))
|
|
143
|
+
return null;
|
|
144
|
+
streams[name] = { b: version };
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
return { c: parsed.c, ns: parsed.ns, s: streams };
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function toStream(chunks, done) {
|
|
157
|
+
const iterator = chunks[Symbol.asyncIterator]();
|
|
158
|
+
let finished = false;
|
|
159
|
+
const finish = () => {
|
|
160
|
+
if (finished)
|
|
161
|
+
return;
|
|
162
|
+
finished = true;
|
|
163
|
+
done();
|
|
164
|
+
};
|
|
165
|
+
return new ReadableStream({
|
|
166
|
+
async pull(controller) {
|
|
167
|
+
try {
|
|
168
|
+
let buffer = "";
|
|
169
|
+
while (buffer.length < 64 * 1024) {
|
|
170
|
+
const next = await iterator.next();
|
|
171
|
+
if (next.done) {
|
|
172
|
+
if (buffer)
|
|
173
|
+
controller.enqueue(encoder.encode(buffer));
|
|
174
|
+
controller.close();
|
|
175
|
+
finish();
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
buffer += next.value;
|
|
179
|
+
}
|
|
180
|
+
controller.enqueue(encoder.encode(buffer));
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
finish();
|
|
184
|
+
controller.error(error);
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
async cancel() {
|
|
188
|
+
finish();
|
|
189
|
+
await iterator.return?.(undefined);
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
/** What a read sees when no overlay source is configured. */
|
|
194
|
+
const NO_SNAPSHOT = {
|
|
195
|
+
runs: [],
|
|
196
|
+
plan: () => [],
|
|
197
|
+
lines: () => {
|
|
198
|
+
throw new Error("no overlay source");
|
|
199
|
+
},
|
|
200
|
+
release() { },
|
|
201
|
+
};
|
|
202
|
+
/** Reads start over this many times when an import lands under them. */
|
|
203
|
+
const MAX_COHERENCE_ATTEMPTS = 8;
|
|
204
|
+
const BUSY_RETRY_AFTER_SECONDS = 1;
|
|
205
|
+
export class StreamSyncReadService {
|
|
206
|
+
options;
|
|
207
|
+
mirror;
|
|
208
|
+
views;
|
|
209
|
+
importer;
|
|
210
|
+
changed;
|
|
211
|
+
spoolCounter = 0;
|
|
212
|
+
constructor(options, mirror, views, importer, changed) {
|
|
213
|
+
this.options = options;
|
|
214
|
+
this.mirror = mirror;
|
|
215
|
+
this.views = views;
|
|
216
|
+
this.importer = importer;
|
|
217
|
+
this.changed = changed;
|
|
218
|
+
}
|
|
219
|
+
static async open(options) {
|
|
220
|
+
const hashes = await controlHashes(options.keys.hashes.keccak256, options.keys.keyCheck);
|
|
221
|
+
const mirror = await RegistryMirror.open(options.files, (row) => classifyStreamRow(toControlRead(row), hashes) === "tombstoned");
|
|
222
|
+
const views = await ViewStore.open(options.files);
|
|
223
|
+
await options.files.remove("spool");
|
|
224
|
+
const importer = new StreamSyncImporter({
|
|
225
|
+
mirror,
|
|
226
|
+
views,
|
|
227
|
+
blobs: options.blobs,
|
|
228
|
+
keys: options.keys,
|
|
229
|
+
controlHashes: hashes,
|
|
230
|
+
logger: options.logger,
|
|
231
|
+
// Only durable files may let the source retire what they cover.
|
|
232
|
+
...(options.durable && options.overlay
|
|
233
|
+
? {
|
|
234
|
+
acknowledge: (coverage) => options.overlay.acknowledge(coverage),
|
|
235
|
+
}
|
|
236
|
+
: {}),
|
|
237
|
+
});
|
|
238
|
+
// Every durable current view is covered already: say so, so a restart
|
|
239
|
+
// retires what an interrupted acknowledgment left behind.
|
|
240
|
+
if (options.durable && options.overlay) {
|
|
241
|
+
for (const { key, version } of views.views()) {
|
|
242
|
+
await importer.acknowledge(key, {
|
|
243
|
+
version: version.version,
|
|
244
|
+
dataHash: version.dataHash,
|
|
245
|
+
generation: version.head.generation,
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
// Import whatever the mirror holds that a crash left unimported.
|
|
250
|
+
return new StreamSyncReadService(options, mirror, views, importer, new Set(mirror.connectors()));
|
|
251
|
+
}
|
|
252
|
+
/** True when the next listing must start from the registry's first page. */
|
|
253
|
+
wantsListingFromStart() {
|
|
254
|
+
return this.mirror.wantsListingFromStart();
|
|
255
|
+
}
|
|
256
|
+
/** Record one listed page. Call before the listing cursor moves. */
|
|
257
|
+
async observe(rows, page) {
|
|
258
|
+
for (const connector of await this.mirror.observe(rows, page)) {
|
|
259
|
+
this.changed.add(connector);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
/** Import changed connectors and retry those with a retried problem. */
|
|
263
|
+
async importPending() {
|
|
264
|
+
const connectors = new Set([
|
|
265
|
+
...this.changed,
|
|
266
|
+
...this.importer.retryConnectors(),
|
|
267
|
+
]);
|
|
268
|
+
this.changed = new Set();
|
|
269
|
+
await this.importer.run([...connectors].sort());
|
|
270
|
+
}
|
|
271
|
+
status() {
|
|
272
|
+
const connections = [];
|
|
273
|
+
for (const connector of this.mirror.connectors()) {
|
|
274
|
+
for (const view of this.connectionViews(connector)) {
|
|
275
|
+
const streams = {};
|
|
276
|
+
for (const [stream, head] of Object.entries(view.streams)) {
|
|
277
|
+
const imported = this.importer.servableView({
|
|
278
|
+
connector,
|
|
279
|
+
ns: view.ns,
|
|
280
|
+
stream,
|
|
281
|
+
});
|
|
282
|
+
streams[stream] = {
|
|
283
|
+
...head,
|
|
284
|
+
version: imported?.version ?? null,
|
|
285
|
+
records: imported?.head.recordCount ?? null,
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
connections.push({
|
|
289
|
+
connector,
|
|
290
|
+
ns: view.ns,
|
|
291
|
+
control: view.control.kind,
|
|
292
|
+
streams,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return {
|
|
297
|
+
listed: !this.mirror.needsFullListing(),
|
|
298
|
+
connections,
|
|
299
|
+
issues: this.importer.listIssues(),
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* The local runs whose rows `stream` of `(connector, ns)` shows on top of
|
|
304
|
+
* `base`, read from the writer's publish plan (`foldPlan`). A run counts
|
|
305
|
+
* only under a verified active control state of this key and its own
|
|
306
|
+
* generation (never the one active at read time), and never over a
|
|
307
|
+
* tombstoned stream row. A published stream that `base` already covers adds
|
|
308
|
+
* nothing: its rows are in the view.
|
|
309
|
+
*
|
|
310
|
+
* `pending` reads this device's own rows that no verified activation of
|
|
311
|
+
* their generation covers. `steps`, from a cursor, replays the plan of
|
|
312
|
+
* exactly those runs; the withheld and unpublished runs are still every
|
|
313
|
+
* such run now.
|
|
314
|
+
*/
|
|
315
|
+
contributions(snapshot, connector, ns, stream, control, tombstoned, base, options = {}) {
|
|
316
|
+
const { pending = false, steps } = options;
|
|
317
|
+
const head = base && planHeadOf(base.head);
|
|
318
|
+
const none = foldPlan(head, [], []);
|
|
319
|
+
if (!snapshot || tombstoned)
|
|
320
|
+
return none;
|
|
321
|
+
// Pending: this device's own rows that no verified activation of their
|
|
322
|
+
// generation covers. A verified control of another generation, a deleted
|
|
323
|
+
// connection and a foreign key hide them.
|
|
324
|
+
if (pending
|
|
325
|
+
? !(control.kind === "absent" || control.kind === "active")
|
|
326
|
+
: control.kind !== "active") {
|
|
327
|
+
return none;
|
|
328
|
+
}
|
|
329
|
+
// A receipt at or below the stream's deletion floor was published before
|
|
330
|
+
// the owner deleted the stream: the same rule servableView applies to
|
|
331
|
+
// imported views, on every overlay path (owner, pending and overlay-only).
|
|
332
|
+
const floor = this.mirror.deletionFloor(streamScope(connector, ns, stream));
|
|
333
|
+
const candidates = [];
|
|
334
|
+
for (const run of snapshot.runs) {
|
|
335
|
+
if (run.connector !== connector ||
|
|
336
|
+
run.ns !== ns ||
|
|
337
|
+
(pending
|
|
338
|
+
? control.kind === "active" &&
|
|
339
|
+
run.generation !== null &&
|
|
340
|
+
run.generation !== control.generation
|
|
341
|
+
: run.generation !== control.generation)) {
|
|
342
|
+
continue;
|
|
343
|
+
}
|
|
344
|
+
const local = run.streams.find((s) => s.name === stream);
|
|
345
|
+
if (!local)
|
|
346
|
+
continue;
|
|
347
|
+
if (local.receipt && local.receipt.registryVersion <= floor)
|
|
348
|
+
continue;
|
|
349
|
+
if (local.receipt && base && covers(base, local.receipt))
|
|
350
|
+
continue;
|
|
351
|
+
candidates.push({ run, stream: local });
|
|
352
|
+
}
|
|
353
|
+
const fold = (runs) => foldPlan(head, runs, snapshot.plan(ns, stream, head, runs.map((c) => c.run.runId)));
|
|
354
|
+
const all = fold(candidates);
|
|
355
|
+
if (!steps)
|
|
356
|
+
return all;
|
|
357
|
+
const replay = fold(candidates.filter((c) => steps.some(([runId, revision]) => runId === c.run.runId && revision === c.stream.contentRevision)));
|
|
358
|
+
return {
|
|
359
|
+
...replay,
|
|
360
|
+
withheld: all.withheld,
|
|
361
|
+
unpublished: all.unpublished,
|
|
362
|
+
awaiting: all.awaiting,
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
/** §2.10 inputs for connector c: every connection this server knows. */
|
|
366
|
+
connectionViews(connector, snapshot) {
|
|
367
|
+
const rows = this.mirror.rowsFor(connector);
|
|
368
|
+
const namespaces = new Set([
|
|
369
|
+
...rows.controls.keys(),
|
|
370
|
+
...rows.streams.keys(),
|
|
371
|
+
]);
|
|
372
|
+
const out = [];
|
|
373
|
+
for (const ns of [...namespaces].sort()) {
|
|
374
|
+
const control = this.importer.controlState(rows.controls.get(ns));
|
|
375
|
+
const streams = {};
|
|
376
|
+
let latest = null;
|
|
377
|
+
const mirrored = rows.streams.get(ns) ?? new Map();
|
|
378
|
+
const names = new Set(mirrored.keys());
|
|
379
|
+
for (const run of snapshot?.runs ?? []) {
|
|
380
|
+
if (run.ns !== ns)
|
|
381
|
+
continue;
|
|
382
|
+
for (const s of run.streams)
|
|
383
|
+
names.add(s.name);
|
|
384
|
+
}
|
|
385
|
+
for (const stream of [...names].sort()) {
|
|
386
|
+
const row = mirrored.get(stream);
|
|
387
|
+
const imported = this.importer.servableView({ connector, ns, stream });
|
|
388
|
+
const kind = row ? this.importer.streamRowKind(row) : null;
|
|
389
|
+
const live = imported !== null &&
|
|
390
|
+
kind !== null &&
|
|
391
|
+
isHeadLive(control, kind, imported.head.generation);
|
|
392
|
+
const local = this.contributions(snapshot, connector, ns, stream, control, kind === "tombstoned", live ? imported : null);
|
|
393
|
+
streams[stream] = {
|
|
394
|
+
live: live || local.merged.length > 0,
|
|
395
|
+
complete: local.complete,
|
|
396
|
+
};
|
|
397
|
+
// Q6: the registry time of the connection's newest live stream head.
|
|
398
|
+
if (live && row && row.addedAtMs !== null) {
|
|
399
|
+
latest =
|
|
400
|
+
latest === null ? row.addedAtMs : Math.max(latest, row.addedAtMs);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
out.push({ ns, control, latestHeadRegistration: latest, streams });
|
|
404
|
+
}
|
|
405
|
+
return out;
|
|
406
|
+
}
|
|
407
|
+
async resolve(input) {
|
|
408
|
+
if (input.connection !== null && !NS.test(input.connection)) {
|
|
409
|
+
return { kind: "invalid_connection" };
|
|
410
|
+
}
|
|
411
|
+
let cursor = null;
|
|
412
|
+
if (input.cursor !== null) {
|
|
413
|
+
cursor = decodeCursor(input.cursor);
|
|
414
|
+
if (!cursor)
|
|
415
|
+
return { kind: "invalid_cursor" };
|
|
416
|
+
}
|
|
417
|
+
const known = new Set(this.mirror.connectors());
|
|
418
|
+
const all = readTargets(input.scope);
|
|
419
|
+
const targets = all.filter((t) => known.has(t.connector));
|
|
420
|
+
// A connector the registry mirror has never seen can still hold the
|
|
421
|
+
// owner's local runs (a first run made offline).
|
|
422
|
+
const candidates = this.options.overlay && input.isOwnerView
|
|
423
|
+
? all.filter((t) => !known.has(t.connector))
|
|
424
|
+
: [];
|
|
425
|
+
if (targets.length === 0 && candidates.length === 0) {
|
|
426
|
+
return input.connection !== null
|
|
427
|
+
? { kind: "unavailable", reason: "connection_not_found" }
|
|
428
|
+
: { kind: "pass" };
|
|
429
|
+
}
|
|
430
|
+
// One pinned snapshot per connector, taken BEFORE any imported view is
|
|
431
|
+
// leased: whatever an import retires after this point stays readable
|
|
432
|
+
// from the pin. The chosen view keeps its snapshot until the body ends.
|
|
433
|
+
//
|
|
434
|
+
// The snapshot's plan knows the writer's commits up to the snapshot. An
|
|
435
|
+
// import that lands after it carries commits the plan does not know, so
|
|
436
|
+
// pairing that base with this plan could show a run the writer refuses.
|
|
437
|
+
// The read starts over when an import lands before the decision is made.
|
|
438
|
+
// Only the streams this read touches can invalidate it: the import
|
|
439
|
+
// revisions of the target streams are its basis. The snapshot pins the
|
|
440
|
+
// writer state of those streams (a publication in flight is part of it),
|
|
441
|
+
// so a later writer change alone cannot pair a base with another plan.
|
|
442
|
+
const touched = [...targets, ...candidates];
|
|
443
|
+
const basis = () => touched
|
|
444
|
+
.flatMap((t) => t.streams.map((s) => this.views.revision(t.connector, s)))
|
|
445
|
+
.join(",");
|
|
446
|
+
for (let attempt = 1;; attempt += 1) {
|
|
447
|
+
const before = basis();
|
|
448
|
+
const snapshots = new Map();
|
|
449
|
+
let decision;
|
|
450
|
+
try {
|
|
451
|
+
for (const target of [...targets, ...candidates]) {
|
|
452
|
+
snapshots.set(target.connector,
|
|
453
|
+
// Only the owner view reads local runs. A grant is answered from
|
|
454
|
+
// the imported heads, as if no local run existed.
|
|
455
|
+
input.isOwnerView
|
|
456
|
+
? await this.snapshot(target.connector)
|
|
457
|
+
: NO_SNAPSHOT);
|
|
458
|
+
}
|
|
459
|
+
decision = await this.decide(input, cursor, targets, candidates, snapshots);
|
|
460
|
+
}
|
|
461
|
+
finally {
|
|
462
|
+
for (const snapshot of snapshots.values())
|
|
463
|
+
snapshot.release();
|
|
464
|
+
}
|
|
465
|
+
if (basis() === before)
|
|
466
|
+
return decision;
|
|
467
|
+
if ("body" in decision)
|
|
468
|
+
await decision.body.cancel();
|
|
469
|
+
if (attempt >= MAX_COHERENCE_ATTEMPTS) {
|
|
470
|
+
return { kind: "busy", retryAfterSeconds: BUSY_RETRY_AFTER_SECONDS };
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
snapshot(connector) {
|
|
475
|
+
return this.options.overlay
|
|
476
|
+
? this.options.overlay.snapshot(connector)
|
|
477
|
+
: Promise.resolve(NO_SNAPSHOT);
|
|
478
|
+
}
|
|
479
|
+
async decide(input, cursor, targets, candidates, snapshots) {
|
|
480
|
+
const evaluated = targets.map((target) => {
|
|
481
|
+
const connections = this.connectionViews(target.connector, snapshots.get(target.connector));
|
|
482
|
+
const eligibility = this.eligibility(input, target, connections);
|
|
483
|
+
return { target, connections, eligibility };
|
|
484
|
+
});
|
|
485
|
+
// The owner never reads fewer records than a grant. When the stored body
|
|
486
|
+
// answers a grant (no published view of the imported heads), it answers
|
|
487
|
+
// the owner too, whatever the owner's own overlay would show: a complete
|
|
488
|
+
// overlay does not contain a different stored body.
|
|
489
|
+
const grantReadsFile = input.isOwnerView &&
|
|
490
|
+
input.legacyFile &&
|
|
491
|
+
input.connection === null &&
|
|
492
|
+
!targets.some((target) => this.eligibility(input, target, this.connectionViews(target.connector)).kind === "view");
|
|
493
|
+
const views = evaluated
|
|
494
|
+
.filter((e) => !grantReadsFile && e.eligibility.kind === "view")
|
|
495
|
+
.map((e) => {
|
|
496
|
+
const ns = e.eligibility.ns;
|
|
497
|
+
const selected = e.connections.find((c) => c.ns === ns);
|
|
498
|
+
return {
|
|
499
|
+
...e,
|
|
500
|
+
ns,
|
|
501
|
+
registered: selected.latestHeadRegistration ?? -Infinity,
|
|
502
|
+
};
|
|
503
|
+
})
|
|
504
|
+
.sort((a, b) => b.registered - a.registered ||
|
|
505
|
+
(a.target.connector < b.target.connector ? -1 : 1));
|
|
506
|
+
if (views.length > 0) {
|
|
507
|
+
const best = views[0];
|
|
508
|
+
// The view owns its snapshot from here: it releases it with the body.
|
|
509
|
+
const snapshot = snapshots.get(best.target.connector);
|
|
510
|
+
snapshots.delete(best.target.connector);
|
|
511
|
+
return this.serveView(input.scope, best.target, best.ns, cursor, snapshot, input.isOwnerView);
|
|
512
|
+
}
|
|
513
|
+
const deleted = evaluated.some((e) => e.eligibility.kind === "unavailable" &&
|
|
514
|
+
e.eligibility.reason === "deleted");
|
|
515
|
+
// The owner's partial view, unless a deletion hides the connector. The
|
|
516
|
+
// owner never reads fewer rows than a grant: when a grant would read the
|
|
517
|
+
// legacy body, the owner reads it too, with the notes.
|
|
518
|
+
let notes = {};
|
|
519
|
+
if (input.isOwnerView && !deleted) {
|
|
520
|
+
const scan = this.pendingScan(input, [...targets, ...candidates], snapshots);
|
|
521
|
+
if (scan.best && !grantReadsFile) {
|
|
522
|
+
const snapshot = snapshots.get(scan.best.target.connector);
|
|
523
|
+
snapshots.delete(scan.best.target.connector);
|
|
524
|
+
try {
|
|
525
|
+
return await this.serveView(input.scope, scan.best.target, scan.best.ns, cursor, snapshot, true, "pending");
|
|
526
|
+
}
|
|
527
|
+
catch (error) {
|
|
528
|
+
// The projector refuses the partial input (a legacy name whose
|
|
529
|
+
// rows are not all there yet). No partial view serves; the answer
|
|
530
|
+
// below does, with the notes. serveView released the snapshot.
|
|
531
|
+
if (!(error instanceof ProjectionFailedError))
|
|
532
|
+
throw error;
|
|
533
|
+
this.options.logger.info({ connector: scan.best.target.connector }, "stream-sync read: the partial view cannot be projected");
|
|
534
|
+
// The writer will publish these runs, but the requested name cannot
|
|
535
|
+
// show them: the owner is told, whatever answer follows.
|
|
536
|
+
scan.withheld = uniqueWithheld([
|
|
537
|
+
...scan.withheld,
|
|
538
|
+
...scan.best.shown,
|
|
539
|
+
]);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
// No view is served: the runs the writer will not publish still reach
|
|
543
|
+
// the owner, with the answer that is.
|
|
544
|
+
if (scan.withheld.length > 0) {
|
|
545
|
+
this.logWithheld(scan.connectors, scan.withheld.length);
|
|
546
|
+
notes = { withheld: scan.withheld };
|
|
547
|
+
}
|
|
548
|
+
// The legacy body answers, as before own-writes; unpublished runs are
|
|
549
|
+
// counted, never compared by time.
|
|
550
|
+
if (input.legacyFile && scan.unpublished > 0) {
|
|
551
|
+
this.options.logger.info({ connector: scan.connectors.join(","), pending: scan.unpublished }, "stream-sync read: legacy body served over pending local runs");
|
|
552
|
+
notes = { ...notes, pending: { runs: scan.unpublished } };
|
|
553
|
+
}
|
|
554
|
+
// Published is not reflected: until import covers a published run, the
|
|
555
|
+
// legacy body does not show it either.
|
|
556
|
+
if (input.legacyFile && scan.awaiting > 0) {
|
|
557
|
+
notes = { ...notes, awaitingImport: { runs: scan.awaiting } };
|
|
558
|
+
}
|
|
559
|
+
// A live imported head the stored body does not reflect, whatever the
|
|
560
|
+
// runs say: import and retirement do not end this note, reflection does.
|
|
561
|
+
if (input.legacyFile && scan.notReflected > 0) {
|
|
562
|
+
notes = { ...notes, notReflected: { streams: scan.notReflected } };
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
if (cursor)
|
|
566
|
+
return { kind: "cursor_stale" };
|
|
567
|
+
if (deleted) {
|
|
568
|
+
return { kind: "unavailable", reason: "deleted" };
|
|
569
|
+
}
|
|
570
|
+
// A named connection is served only from its own view: a legacy file
|
|
571
|
+
// records no connection.
|
|
572
|
+
if (input.connection !== null) {
|
|
573
|
+
const foreign = evaluated.some((e) => e.connections.some((c) => c.ns === input.connection && c.control.kind === "foreign"));
|
|
574
|
+
return foreign
|
|
575
|
+
? { kind: "key_mismatch" }
|
|
576
|
+
: { kind: "unavailable", reason: "connection_not_found", ...notes };
|
|
577
|
+
}
|
|
578
|
+
if (evaluated.some((e) => e.eligibility.kind === "legacy")) {
|
|
579
|
+
return { kind: "legacy", ...notes };
|
|
580
|
+
}
|
|
581
|
+
if (evaluated.some((e) => selectConnection(e.connections) === null &&
|
|
582
|
+
e.connections.some((c) => c.control.kind === "foreign"))) {
|
|
583
|
+
return { kind: "key_mismatch" };
|
|
584
|
+
}
|
|
585
|
+
return { kind: "pass", ...notes };
|
|
586
|
+
}
|
|
587
|
+
/** §2.10 for one target over `connections`. */
|
|
588
|
+
eligibility(input, target, connections) {
|
|
589
|
+
return eligible({
|
|
590
|
+
connections: [...connections],
|
|
591
|
+
target: input.connection !== null
|
|
592
|
+
? {
|
|
593
|
+
kind: "physical",
|
|
594
|
+
ns: input.connection,
|
|
595
|
+
streams: target.streams,
|
|
596
|
+
}
|
|
597
|
+
: { kind: "logical", streams: target.streams },
|
|
598
|
+
legacyFile: input.legacyFile,
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
/** The imported view of a stream while its head is live, else null. */
|
|
602
|
+
liveImported(connector, ns, stream, control, row) {
|
|
603
|
+
const imported = this.importer.servableView({ connector, ns, stream });
|
|
604
|
+
const kind = row ? this.importer.streamRowKind(row) : null;
|
|
605
|
+
return imported !== null &&
|
|
606
|
+
kind !== null &&
|
|
607
|
+
isHeadLive(control, kind, imported.head.generation)
|
|
608
|
+
? imported
|
|
609
|
+
: null;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* The target and connection the owner's partial view serves: every needed
|
|
613
|
+
* stream has a live imported head (complete or not) or local runs the
|
|
614
|
+
* writer will publish; `at` is the newest stamp among them. Also every run
|
|
615
|
+
* withheld, and the distinct runs not published yet, among all the
|
|
616
|
+
* connections looked at, whether or not any of them can be served.
|
|
617
|
+
*/
|
|
618
|
+
pendingScan(input, targets, snapshots) {
|
|
619
|
+
let best = null;
|
|
620
|
+
const withheld = [];
|
|
621
|
+
const unpublished = new Set();
|
|
622
|
+
const awaiting = new Set();
|
|
623
|
+
const notReflected = new Set();
|
|
624
|
+
const connectors = new Set();
|
|
625
|
+
for (const target of targets) {
|
|
626
|
+
const snapshot = snapshots.get(target.connector);
|
|
627
|
+
if (!snapshot)
|
|
628
|
+
continue;
|
|
629
|
+
const rows = this.mirror.rowsFor(target.connector);
|
|
630
|
+
const namespaces = new Set([
|
|
631
|
+
...rows.controls.keys(),
|
|
632
|
+
...rows.streams.keys(),
|
|
633
|
+
]);
|
|
634
|
+
for (const run of snapshot.runs)
|
|
635
|
+
if (run.ns !== null)
|
|
636
|
+
namespaces.add(run.ns);
|
|
637
|
+
for (const ns of [...namespaces].sort()) {
|
|
638
|
+
if (input.connection !== null && input.connection !== ns)
|
|
639
|
+
continue;
|
|
640
|
+
const control = this.importer.controlState(rows.controls.get(ns));
|
|
641
|
+
if (control.kind === "deleted" || control.kind === "foreign")
|
|
642
|
+
continue;
|
|
643
|
+
let at = 0;
|
|
644
|
+
const shown = [];
|
|
645
|
+
// Every stream is scanned, whether or not an earlier one can be
|
|
646
|
+
// served: a withheld or unpublished run is reported either way.
|
|
647
|
+
const covered = target.streams.map((stream) => {
|
|
648
|
+
const row = rows.streams.get(ns)?.get(stream);
|
|
649
|
+
const live = this.liveImported(target.connector, ns, stream, control, row);
|
|
650
|
+
if (live !== null) {
|
|
651
|
+
notReflected.add(JSON.stringify([target.connector, ns, stream]));
|
|
652
|
+
}
|
|
653
|
+
const local = this.contributions(snapshot, target.connector, ns, stream, control, row !== undefined &&
|
|
654
|
+
this.importer.streamRowKind(row) === "tombstoned", live, { pending: true });
|
|
655
|
+
if (local.withheld.length > 0 || local.unpublished.length > 0) {
|
|
656
|
+
connectors.add(target.connector);
|
|
657
|
+
}
|
|
658
|
+
withheld.push(...withheldRuns([{ stream, fold: local }]));
|
|
659
|
+
for (const c of local.merged) {
|
|
660
|
+
shown.push({
|
|
661
|
+
runId: c.run.runId,
|
|
662
|
+
stream,
|
|
663
|
+
reason: "projection_unavailable",
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
for (const runId of local.unpublished) {
|
|
667
|
+
unpublished.add(JSON.stringify([target.connector, ns, runId]));
|
|
668
|
+
}
|
|
669
|
+
for (const runId of local.awaiting) {
|
|
670
|
+
awaiting.add(JSON.stringify([target.connector, ns, runId]));
|
|
671
|
+
}
|
|
672
|
+
at = Math.max(at, live?.head.observedAt ?? 0, ...local.merged.map((c) => c.run.observedAt));
|
|
673
|
+
return live !== null || local.merged.length > 0;
|
|
674
|
+
});
|
|
675
|
+
if (!covered.every(Boolean))
|
|
676
|
+
continue;
|
|
677
|
+
if (!best ||
|
|
678
|
+
at > best.at ||
|
|
679
|
+
(at === best.at && target.connector < best.target.connector)) {
|
|
680
|
+
best = { target, ns, at, shown };
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
return {
|
|
685
|
+
best,
|
|
686
|
+
withheld: uniqueWithheld(withheld),
|
|
687
|
+
unpublished: unpublished.size,
|
|
688
|
+
awaiting: awaiting.size,
|
|
689
|
+
notReflected: notReflected.size,
|
|
690
|
+
connectors: [...connectors],
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
/** One log line per read: a count, never a row. */
|
|
694
|
+
logWithheld(connectors, count) {
|
|
695
|
+
this.options.logger.warn({ connector: connectors.join(","), withheld: count }, "stream-sync read: local runs withheld from the view");
|
|
696
|
+
}
|
|
697
|
+
async serveView(scope, target, ns, cursor, snapshot, isOwnerView, mode = "view") {
|
|
698
|
+
const pending = mode === "pending";
|
|
699
|
+
const leases = [];
|
|
700
|
+
// Snapshot and leases are released together, once, with the body.
|
|
701
|
+
let released = false;
|
|
702
|
+
const releaseAll = () => {
|
|
703
|
+
if (released)
|
|
704
|
+
return;
|
|
705
|
+
released = true;
|
|
706
|
+
for (const lease of leases)
|
|
707
|
+
lease.release();
|
|
708
|
+
snapshot.release();
|
|
709
|
+
};
|
|
710
|
+
try {
|
|
711
|
+
if (cursor && (cursor.c !== target.connector || cursor.ns !== ns)) {
|
|
712
|
+
releaseAll();
|
|
713
|
+
return { kind: "cursor_stale" };
|
|
714
|
+
}
|
|
715
|
+
const rows = this.mirror.rowsFor(target.connector);
|
|
716
|
+
const control = this.importer.controlState(rows.controls.get(ns));
|
|
717
|
+
const inputs = [];
|
|
718
|
+
for (const stream of target.streams) {
|
|
719
|
+
const key = { connector: target.connector, ns, stream };
|
|
720
|
+
const pin = cursor ? cursor.s[stream] : undefined;
|
|
721
|
+
if (cursor && !pin) {
|
|
722
|
+
releaseAll();
|
|
723
|
+
return { kind: "cursor_stale" };
|
|
724
|
+
}
|
|
725
|
+
const row = rows.streams.get(ns)?.get(stream);
|
|
726
|
+
const kind = row ? this.importer.streamRowKind(row) : null;
|
|
727
|
+
const current = this.importer.servableView(key);
|
|
728
|
+
const currentLive = current !== null &&
|
|
729
|
+
kind !== null &&
|
|
730
|
+
isHeadLive(control, kind, current.head.generation);
|
|
731
|
+
// A partial view leases the live head too, complete or not: the
|
|
732
|
+
// owner's rows stay readable after the run that wrote them retires.
|
|
733
|
+
let lease = null;
|
|
734
|
+
if (cursor) {
|
|
735
|
+
if (pin.b === null) {
|
|
736
|
+
// The cursor saw no imported head; one has appeared since.
|
|
737
|
+
if (currentLive) {
|
|
738
|
+
releaseAll();
|
|
739
|
+
return { kind: "cursor_stale" };
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
else {
|
|
743
|
+
lease = this.views.lease(key, pin.b);
|
|
744
|
+
if (!lease) {
|
|
745
|
+
releaseAll();
|
|
746
|
+
return { kind: "cursor_stale" };
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
else if (currentLive) {
|
|
751
|
+
lease = this.views.lease(key);
|
|
752
|
+
}
|
|
753
|
+
if (lease)
|
|
754
|
+
leases.push(lease);
|
|
755
|
+
// Replay the plan a cursor recorded: a retired or changed run makes
|
|
756
|
+
// the cursor stale, and a new run does not join. A cursor from before
|
|
757
|
+
// fold pins recorded the shown members alone.
|
|
758
|
+
const steps = cursor ? (pin.p ?? pin.m ?? []) : undefined;
|
|
759
|
+
const fold = this.contributions(snapshot, target.connector, ns, stream, control, kind === "tombstoned", lease?.version ?? null, { pending, ...(steps ? { steps } : {}) });
|
|
760
|
+
if (cursor && !replaysPin(fold, pin)) {
|
|
761
|
+
releaseAll();
|
|
762
|
+
return { kind: "cursor_stale" };
|
|
763
|
+
}
|
|
764
|
+
if (!lease && fold.merged.length === 0) {
|
|
765
|
+
// Not a view after all: nothing imported and nothing local.
|
|
766
|
+
releaseAll();
|
|
767
|
+
return { kind: "cursor_stale" };
|
|
768
|
+
}
|
|
769
|
+
inputs.push({ stream, lease, fold });
|
|
770
|
+
}
|
|
771
|
+
// A stream without an imported head has no registry entry: only the
|
|
772
|
+
// owner reads it. Everyone else gets the existing path, with its own
|
|
773
|
+
// billing, grants and access record.
|
|
774
|
+
if (pending && !isOwnerView) {
|
|
775
|
+
releaseAll();
|
|
776
|
+
return { kind: "pass" };
|
|
777
|
+
}
|
|
778
|
+
if (!isOwnerView && inputs.some((i) => !i.lease)) {
|
|
779
|
+
releaseAll();
|
|
780
|
+
return { kind: "pass" };
|
|
781
|
+
}
|
|
782
|
+
const byStream = new Map(inputs.map((i) => [i.stream, i]));
|
|
783
|
+
const overlays = new Map();
|
|
784
|
+
let observedAt = 0;
|
|
785
|
+
for (const input of inputs) {
|
|
786
|
+
const { fold } = input;
|
|
787
|
+
const overlay = fold.merged.length
|
|
788
|
+
? await overlayWinners(snapshot, this.options.keys, {
|
|
789
|
+
runs: fold.merged.map((c) => c.run),
|
|
790
|
+
stream: input.stream,
|
|
791
|
+
primaryKey: fold.shape.primaryKey,
|
|
792
|
+
})
|
|
793
|
+
: NO_OVERLAY;
|
|
794
|
+
overlays.set(input.stream, overlay);
|
|
795
|
+
observedAt = Math.max(observedAt, input.lease?.version.head.observedAt ?? 0, overlay.newestObservedAt ?? 0, ...fold.merged.map((c) => c.run.observedAt));
|
|
796
|
+
}
|
|
797
|
+
const lines = (stream) => {
|
|
798
|
+
const input = byStream.get(stream);
|
|
799
|
+
return viewLines(this.views, this.options.keys, input.lease, overlays.get(stream), input.fold.shape.primaryKey);
|
|
800
|
+
};
|
|
801
|
+
const nextCursor = encodeCursor({
|
|
802
|
+
c: target.connector,
|
|
803
|
+
ns,
|
|
804
|
+
s: Object.fromEntries(inputs.map((i) => [
|
|
805
|
+
i.stream,
|
|
806
|
+
{
|
|
807
|
+
b: i.lease ? i.lease.version.version : null,
|
|
808
|
+
m: i.fold.merged
|
|
809
|
+
.map((c) => [c.run.runId, c.stream.contentRevision])
|
|
810
|
+
.sort(),
|
|
811
|
+
p: i.fold.chain.map((c) => [c.run.runId, c.stream.contentRevision]),
|
|
812
|
+
h: shapePin(i.fold),
|
|
813
|
+
},
|
|
814
|
+
])),
|
|
815
|
+
});
|
|
816
|
+
// Runs the writer will not publish are never shown and never dropped
|
|
817
|
+
// silently: the log gets a count, the owner gets the runs.
|
|
818
|
+
const withheldAll = uniqueWithheld(withheldRuns(inputs));
|
|
819
|
+
if (withheldAll.length > 0) {
|
|
820
|
+
this.logWithheld([target.connector], withheldAll.length);
|
|
821
|
+
}
|
|
822
|
+
const withheld = isOwnerView ? withheldAll : [];
|
|
823
|
+
const complete = inputs.every((i) => i.fold.complete);
|
|
824
|
+
const open = `{"version":"1.0","scope":${JSON.stringify(scope)},"collectedAt":${JSON.stringify(new Date(observedAt).toISOString())},${pending ? `"origin":"local-pending","complete":${complete},` : ""}${withheld.length > 0 ? `"withheld":${JSON.stringify(withheld)},` : ""}"data":`;
|
|
825
|
+
let payload;
|
|
826
|
+
if (!target.binding) {
|
|
827
|
+
payload = recordsPayload(lines(target.streams[0]));
|
|
828
|
+
}
|
|
829
|
+
else {
|
|
830
|
+
const first = inputs[0];
|
|
831
|
+
const plan = await planProjection({
|
|
832
|
+
scope,
|
|
833
|
+
binding: target.binding,
|
|
834
|
+
// The head the writer leaves, not the base the runs built on.
|
|
835
|
+
profileKey: first.fold.shape?.profile.key ?? undefined,
|
|
836
|
+
lines,
|
|
837
|
+
streamBytes: (stream) => (byStream.get(stream).lease?.version.head.parts ?? []).reduce((sum, p) => sum + p.bytes, 0),
|
|
838
|
+
sha256: this.options.keys.hashes.sha256,
|
|
839
|
+
spool: this.options.files,
|
|
840
|
+
spoolId: `${Date.now().toString(36)}-${(this.spoolCounter++).toString(36)}`,
|
|
841
|
+
budgetBytes: this.options.arrayProjectionBudgetBytes ?? DEFAULT_ARRAY_BUDGET,
|
|
842
|
+
now: (this.options.now?.() ?? new Date()).toISOString(),
|
|
843
|
+
});
|
|
844
|
+
if (plan.kind === "too_large") {
|
|
845
|
+
releaseAll();
|
|
846
|
+
return plan;
|
|
847
|
+
}
|
|
848
|
+
payload = plan.payload;
|
|
849
|
+
}
|
|
850
|
+
const servedStream = target.binding?.window?.parentStream ?? target.streams[0];
|
|
851
|
+
const servedBase = byStream.get(servedStream).lease;
|
|
852
|
+
const body = toStream(envelope(open, payload), releaseAll);
|
|
853
|
+
if (pending) {
|
|
854
|
+
return {
|
|
855
|
+
kind: "local_pending",
|
|
856
|
+
connector: target.connector,
|
|
857
|
+
ns,
|
|
858
|
+
cursor: nextCursor,
|
|
859
|
+
complete,
|
|
860
|
+
...(withheld.length > 0 ? { withheld } : {}),
|
|
861
|
+
body,
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
return {
|
|
865
|
+
kind: "view",
|
|
866
|
+
connector: target.connector,
|
|
867
|
+
ns,
|
|
868
|
+
cursor: nextCursor,
|
|
869
|
+
// A view with an input that has no registered head has no registry
|
|
870
|
+
// entry to bind a paid read to.
|
|
871
|
+
served: servedBase && inputs.every((i) => i.lease)
|
|
872
|
+
? {
|
|
873
|
+
scope: streamScope(target.connector, ns, servedStream),
|
|
874
|
+
version: servedBase.version.version,
|
|
875
|
+
}
|
|
876
|
+
: null,
|
|
877
|
+
...(withheld.length > 0 ? { withheld } : {}),
|
|
878
|
+
body,
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
catch (error) {
|
|
882
|
+
releaseAll();
|
|
883
|
+
throw error;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
/** The runs the view does not show, one per run and stream. */
|
|
888
|
+
function withheldRuns(inputs) {
|
|
889
|
+
return inputs.flatMap((i) => i.fold.withheld.map((c) => ({
|
|
890
|
+
runId: c.run.runId,
|
|
891
|
+
stream: i.stream,
|
|
892
|
+
reason: c.reason,
|
|
893
|
+
})));
|
|
894
|
+
}
|
|
895
|
+
/** The projection input a cursor pins: the shown head's key, profile and completeness. */
|
|
896
|
+
function shapePin(fold) {
|
|
897
|
+
return JSON.stringify([
|
|
898
|
+
fold.shape?.primaryKey ?? null,
|
|
899
|
+
fold.shape?.profile.key ?? null,
|
|
900
|
+
fold.shape?.profile.version ?? null,
|
|
901
|
+
fold.complete,
|
|
902
|
+
]);
|
|
903
|
+
}
|
|
904
|
+
function uniqueWithheld(runs) {
|
|
905
|
+
const seen = new Set();
|
|
906
|
+
return runs
|
|
907
|
+
.filter((w) => {
|
|
908
|
+
const key = `${w.runId}\0${w.stream}`;
|
|
909
|
+
if (seen.has(key))
|
|
910
|
+
return false;
|
|
911
|
+
seen.add(key);
|
|
912
|
+
return true;
|
|
913
|
+
})
|
|
914
|
+
.sort((a, b) => a.runId === b.runId
|
|
915
|
+
? a.stream < b.stream
|
|
916
|
+
? -1
|
|
917
|
+
: a.stream > b.stream
|
|
918
|
+
? 1
|
|
919
|
+
: 0
|
|
920
|
+
: a.runId < b.runId
|
|
921
|
+
? -1
|
|
922
|
+
: 1);
|
|
923
|
+
}
|
|
924
|
+
const stepKey = (c) => `${c.run.runId}\0${c.stream.contentRevision}`;
|
|
925
|
+
const pairKey = ([runId, revision]) => `${runId}\0${revision}`;
|
|
926
|
+
/**
|
|
927
|
+
* The replayed fold is the one the cursor recorded: the same published runs
|
|
928
|
+
* in the same order, the same shown members, the same head shape. Otherwise
|
|
929
|
+
* a replay would mix rows the first response had replaced, or project them
|
|
930
|
+
* under another profile.
|
|
931
|
+
*/
|
|
932
|
+
function replaysPin(fold, pin) {
|
|
933
|
+
if (pin.d === true)
|
|
934
|
+
return false;
|
|
935
|
+
if (pin.h !== undefined && pin.h !== shapePin(fold))
|
|
936
|
+
return false;
|
|
937
|
+
const members = (pin.m ?? []).map(pairKey).sort();
|
|
938
|
+
const shown = fold.merged.map(stepKey).sort();
|
|
939
|
+
if (members.length !== shown.length ||
|
|
940
|
+
members.some((key, i) => key !== shown[i])) {
|
|
941
|
+
return false;
|
|
942
|
+
}
|
|
943
|
+
if (pin.p) {
|
|
944
|
+
const chain = fold.chain.map(stepKey);
|
|
945
|
+
if (pin.p.length !== chain.length ||
|
|
946
|
+
pin.p.some((pair, i) => pairKey(pair) !== chain[i])) {
|
|
947
|
+
return false;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
return true;
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* `{records}` of a stream with no legacy binding (`pdpp.<c>.<s>`).
|
|
954
|
+
*
|
|
955
|
+
* Record order is unspecified. The file read this replaces serves records in
|
|
956
|
+
* the order its writer chose, and no writer uses a record field: one pages
|
|
957
|
+
* the records route by import time and key, another keeps arrival order.
|
|
958
|
+
* A stream keeps no write order, so a view serves its parts in pkHash order
|
|
959
|
+
* and makes no promise about it. Readers that need an order sort by a field.
|
|
960
|
+
*/
|
|
961
|
+
async function* recordsPayload(lines) {
|
|
962
|
+
yield '{"records":[';
|
|
963
|
+
let first = true;
|
|
964
|
+
for await (const line of lines) {
|
|
965
|
+
yield (first ? "" : ",") + JSON.stringify(line.v);
|
|
966
|
+
first = false;
|
|
967
|
+
}
|
|
968
|
+
yield "]}";
|
|
969
|
+
}
|
|
970
|
+
async function* envelope(open, payload) {
|
|
971
|
+
yield open;
|
|
972
|
+
yield* payload;
|
|
973
|
+
yield "}";
|
|
974
|
+
}
|
|
975
|
+
//# sourceMappingURL=service.js.map
|