@mdbase-dev/sdk 0.0.0-stage → 0.1.0-beta.149
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/LICENSE +21 -0
- package/README.md +844 -2
- package/dist/account-key.d.ts +176 -0
- package/dist/account-key.js +409 -0
- package/dist/account-key.js.map +1 -0
- package/dist/account.d.ts +11 -0
- package/dist/account.js +9 -0
- package/dist/account.js.map +1 -0
- package/dist/app-grant/client.d.ts +209 -0
- package/dist/app-grant/client.js +930 -0
- package/dist/app-grant/client.js.map +1 -0
- package/dist/app-grant/grant-store.d.ts +77 -0
- package/dist/app-grant/grant-store.js +201 -0
- package/dist/app-grant/grant-store.js.map +1 -0
- package/dist/app-grant/index.d.ts +11 -0
- package/dist/app-grant/index.js +10 -0
- package/dist/app-grant/index.js.map +1 -0
- package/dist/app-grant/native-completion.d.ts +22 -0
- package/dist/app-grant/native-completion.js +63 -0
- package/dist/app-grant/native-completion.js.map +1 -0
- package/dist/app-grant/people.d.ts +10 -0
- package/dist/app-grant/people.js +84 -0
- package/dist/app-grant/people.js.map +1 -0
- package/dist/app-grant/setup-attempt.d.ts +12 -0
- package/dist/app-grant/setup-attempt.js +62 -0
- package/dist/app-grant/setup-attempt.js.map +1 -0
- package/dist/app-grant/setup-producer.d.ts +31 -0
- package/dist/app-grant/setup-producer.js +65 -0
- package/dist/app-grant/setup-producer.js.map +1 -0
- package/dist/app-grant/setup.d.ts +11 -0
- package/dist/app-grant/setup.js +222 -0
- package/dist/app-grant/setup.js.map +1 -0
- package/dist/app-host/app-environment.d.ts +27 -0
- package/dist/app-host/app-environment.js +48 -0
- package/dist/app-host/app-environment.js.map +1 -0
- package/dist/app-host/app-origin.d.ts +7 -0
- package/dist/app-host/app-origin.js +49 -0
- package/dist/app-host/app-origin.js.map +1 -0
- package/dist/app-host/bases-pages.d.ts +29 -0
- package/dist/app-host/bases-pages.js +42 -0
- package/dist/app-host/bases-pages.js.map +1 -0
- package/dist/app-host/bases-wire.d.ts +159 -0
- package/dist/app-host/bases-wire.js +376 -0
- package/dist/app-host/bases-wire.js.map +1 -0
- package/dist/app-host/browser-direct-access.d.ts +18 -0
- package/dist/app-host/browser-direct-access.js +17 -0
- package/dist/app-host/browser-direct-access.js.map +1 -0
- package/dist/app-host/cloud-copy-bootstrap.d.ts +127 -0
- package/dist/app-host/cloud-copy-bootstrap.js +608 -0
- package/dist/app-host/cloud-copy-bootstrap.js.map +1 -0
- package/dist/app-host/cloud-copy-host.d.ts +248 -0
- package/dist/app-host/cloud-copy-host.js +1028 -0
- package/dist/app-host/cloud-copy-host.js.map +1 -0
- package/dist/app-host/cloud-copy-persistence-idb.d.ts +33 -0
- package/dist/app-host/cloud-copy-persistence-idb.js +255 -0
- package/dist/app-host/cloud-copy-persistence-idb.js.map +1 -0
- package/dist/app-host/cloud-copy-persistence.d.ts +57 -0
- package/dist/app-host/cloud-copy-persistence.js +341 -0
- package/dist/app-host/cloud-copy-persistence.js.map +1 -0
- package/dist/app-host/collection-control.d.ts +111 -0
- package/dist/app-host/collection-control.js +604 -0
- package/dist/app-host/collection-control.js.map +1 -0
- package/dist/app-host/collection-delete.d.ts +7 -0
- package/dist/app-host/collection-delete.js +54 -0
- package/dist/app-host/collection-delete.js.map +1 -0
- package/dist/app-host/collection-display-name.d.ts +2 -0
- package/dist/app-host/collection-display-name.js +22 -0
- package/dist/app-host/collection-display-name.js.map +1 -0
- package/dist/app-host/collection-join-ledger.d.ts +52 -0
- package/dist/app-host/collection-join-ledger.js +208 -0
- package/dist/app-host/collection-join-ledger.js.map +1 -0
- package/dist/app-host/collection-people.d.ts +32 -0
- package/dist/app-host/collection-people.js +119 -0
- package/dist/app-host/collection-people.js.map +1 -0
- package/dist/app-host/collection-readiness.d.ts +119 -0
- package/dist/app-host/collection-readiness.js +649 -0
- package/dist/app-host/collection-readiness.js.map +1 -0
- package/dist/app-host/collection-setup-journal.d.ts +59 -0
- package/dist/app-host/collection-setup-journal.js +813 -0
- package/dist/app-host/collection-setup-journal.js.map +1 -0
- package/dist/app-host/collection-setup-types.d.ts +155 -0
- package/dist/app-host/collection-setup-types.js +10 -0
- package/dist/app-host/collection-setup-types.js.map +1 -0
- package/dist/app-host/cp-authority.d.ts +65 -0
- package/dist/app-host/cp-authority.js +243 -0
- package/dist/app-host/cp-authority.js.map +1 -0
- package/dist/app-host/cp-people.d.ts +23 -0
- package/dist/app-host/cp-people.js +145 -0
- package/dist/app-host/cp-people.js.map +1 -0
- package/dist/app-host/cp-problem.d.ts +34 -0
- package/dist/app-host/cp-problem.js +114 -0
- package/dist/app-host/cp-problem.js.map +1 -0
- package/dist/app-host/device-key-custody.d.ts +51 -0
- package/dist/app-host/device-key-custody.js +128 -0
- package/dist/app-host/device-key-custody.js.map +1 -0
- package/dist/app-host/device-key-idb.d.ts +31 -0
- package/dist/app-host/device-key-idb.js +176 -0
- package/dist/app-host/device-key-idb.js.map +1 -0
- package/dist/app-host/device-key-provider.d.ts +33 -0
- package/dist/app-host/device-key-provider.js +181 -0
- package/dist/app-host/device-key-provider.js.map +1 -0
- package/dist/app-host/device-registration.d.ts +51 -0
- package/dist/app-host/device-registration.js +180 -0
- package/dist/app-host/device-registration.js.map +1 -0
- package/dist/app-host/foreground-wake.d.ts +43 -0
- package/dist/app-host/foreground-wake.js +113 -0
- package/dist/app-host/foreground-wake.js.map +1 -0
- package/dist/app-host/handover.d.ts +27 -0
- package/dist/app-host/handover.js +82 -0
- package/dist/app-host/handover.js.map +1 -0
- package/dist/app-host/http-log.d.ts +96 -0
- package/dist/app-host/http-log.js +609 -0
- package/dist/app-host/http-log.js.map +1 -0
- package/dist/app-host/index.d.ts +63 -0
- package/dist/app-host/index.js +33 -0
- package/dist/app-host/index.js.map +1 -0
- package/dist/app-host/initial-sync.d.ts +22 -0
- package/dist/app-host/initial-sync.js +41 -0
- package/dist/app-host/initial-sync.js.map +1 -0
- package/dist/app-host/installation-sign-in.d.ts +319 -0
- package/dist/app-host/installation-sign-in.js +1231 -0
- package/dist/app-host/installation-sign-in.js.map +1 -0
- package/dist/app-host/installation-store.d.ts +56 -0
- package/dist/app-host/installation-store.js +285 -0
- package/dist/app-host/installation-store.js.map +1 -0
- package/dist/app-host/ledger-rows.d.ts +3 -0
- package/dist/app-host/ledger-rows.js +23 -0
- package/dist/app-host/ledger-rows.js.map +1 -0
- package/dist/app-host/local-facade.d.ts +24 -0
- package/dist/app-host/local-facade.js +361 -0
- package/dist/app-host/local-facade.js.map +1 -0
- package/dist/app-host/log-pump.d.ts +124 -0
- package/dist/app-host/log-pump.js +326 -0
- package/dist/app-host/log-pump.js.map +1 -0
- package/dist/app-host/log-push.d.ts +90 -0
- package/dist/app-host/log-push.js +377 -0
- package/dist/app-host/log-push.js.map +1 -0
- package/dist/app-host/log-token-cache.d.ts +28 -0
- package/dist/app-host/log-token-cache.js +104 -0
- package/dist/app-host/log-token-cache.js.map +1 -0
- package/dist/app-host/native-sign-in.d.ts +27 -0
- package/dist/app-host/native-sign-in.js +12 -0
- package/dist/app-host/native-sign-in.js.map +1 -0
- package/dist/app-host/noise-custody.d.ts +62 -0
- package/dist/app-host/noise-custody.js +238 -0
- package/dist/app-host/noise-custody.js.map +1 -0
- package/dist/app-host/noise-idb.d.ts +33 -0
- package/dist/app-host/noise-idb.js +199 -0
- package/dist/app-host/noise-idb.js.map +1 -0
- package/dist/app-host/open-wait.d.ts +3 -0
- package/dist/app-host/open-wait.js +17 -0
- package/dist/app-host/open-wait.js.map +1 -0
- package/dist/app-host/opening-progress.d.ts +3 -0
- package/dist/app-host/opening-progress.js +5 -0
- package/dist/app-host/opening-progress.js.map +1 -0
- package/dist/app-host/owner.d.ts +103 -0
- package/dist/app-host/owner.js +262 -0
- package/dist/app-host/owner.js.map +1 -0
- package/dist/app-host/private-bootstrap.d.ts +78 -0
- package/dist/app-host/private-bootstrap.js +230 -0
- package/dist/app-host/private-bootstrap.js.map +1 -0
- package/dist/app-host/private-persistence-idb.d.ts +32 -0
- package/dist/app-host/private-persistence-idb.js +188 -0
- package/dist/app-host/private-persistence-idb.js.map +1 -0
- package/dist/app-host/private-persistence.d.ts +55 -0
- package/dist/app-host/private-persistence.js +257 -0
- package/dist/app-host/private-persistence.js.map +1 -0
- package/dist/app-host/scoped-sign-in-session.d.ts +49 -0
- package/dist/app-host/scoped-sign-in-session.js +243 -0
- package/dist/app-host/scoped-sign-in-session.js.map +1 -0
- package/dist/app-host/setup-engine.d.ts +14 -0
- package/dist/app-host/setup-engine.js +73 -0
- package/dist/app-host/setup-engine.js.map +1 -0
- package/dist/app-host/sign-out-erase.d.ts +37 -0
- package/dist/app-host/sign-out-erase.js +139 -0
- package/dist/app-host/sign-out-erase.js.map +1 -0
- package/dist/app-host/status.d.ts +62 -0
- package/dist/app-host/status.js +43 -0
- package/dist/app-host/status.js.map +1 -0
- package/dist/app-host/storage-probe.d.ts +46 -0
- package/dist/app-host/storage-probe.js +63 -0
- package/dist/app-host/storage-probe.js.map +1 -0
- package/dist/app-host/timer-port.d.ts +29 -0
- package/dist/app-host/timer-port.js +483 -0
- package/dist/app-host/timer-port.js.map +1 -0
- package/dist/app-host/wasm-runtime.d.ts +302 -0
- package/dist/app-host/wasm-runtime.js +1050 -0
- package/dist/app-host/wasm-runtime.js.map +1 -0
- package/dist/app-host/web-collection.d.ts +78 -0
- package/dist/app-host/web-collection.js +671 -0
- package/dist/app-host/web-collection.js.map +1 -0
- package/dist/app-host/web-sign-in-problem.d.ts +17 -0
- package/dist/app-host/web-sign-in-problem.js +59 -0
- package/dist/app-host/web-sign-in-problem.js.map +1 -0
- package/dist/app-host/web-sign-in-session.d.ts +367 -0
- package/dist/app-host/web-sign-in-session.js +1258 -0
- package/dist/app-host/web-sign-in-session.js.map +1 -0
- package/dist/app-storage/app-binary-index.d.ts +33 -0
- package/dist/app-storage/app-binary-index.js +274 -0
- package/dist/app-storage/app-binary-index.js.map +1 -0
- package/dist/app-storage/app-sqlite-index.d.ts +40 -0
- package/dist/app-storage/app-sqlite-index.js +102 -0
- package/dist/app-storage/app-sqlite-index.js.map +1 -0
- package/dist/app-storage/collection-sql.d.ts +39 -0
- package/dist/app-storage/collection-sql.js +93 -0
- package/dist/app-storage/collection-sql.js.map +1 -0
- package/dist/app-storage/index.d.ts +10 -0
- package/dist/app-storage/index.js +7 -0
- package/dist/app-storage/index.js.map +1 -0
- package/dist/app-storage/sqlite-index.d.ts +95 -0
- package/dist/app-storage/sqlite-index.js +280 -0
- package/dist/app-storage/sqlite-index.js.map +1 -0
- package/dist/application/asset-loader.d.ts +22 -0
- package/dist/application/asset-loader.js +130 -0
- package/dist/application/asset-loader.js.map +1 -0
- package/dist/application/asset-pins.json +24 -0
- package/dist/application/browser-capabilities.d.ts +48 -0
- package/dist/application/browser-capabilities.js +87 -0
- package/dist/application/browser-capabilities.js.map +1 -0
- package/dist/application/browser-selection.d.ts +58 -0
- package/dist/application/browser-selection.js +160 -0
- package/dist/application/browser-selection.js.map +1 -0
- package/dist/application/capabilities.d.ts +20 -0
- package/dist/application/capabilities.js +22 -0
- package/dist/application/capabilities.js.map +1 -0
- package/dist/application/collection-selection.d.ts +147 -0
- package/dist/application/collection-selection.js +351 -0
- package/dist/application/collection-selection.js.map +1 -0
- package/dist/application/configuration.d.ts +52 -0
- package/dist/application/configuration.js +568 -0
- package/dist/application/configuration.js.map +1 -0
- package/dist/application/declaration.d.ts +51 -0
- package/dist/application/declaration.js +100 -0
- package/dist/application/declaration.js.map +1 -0
- package/dist/application/entry.d.ts +343 -0
- package/dist/application/entry.js +945 -0
- package/dist/application/entry.js.map +1 -0
- package/dist/application/file-access.d.ts +55 -0
- package/dist/application/file-access.js +93 -0
- package/dist/application/file-access.js.map +1 -0
- package/dist/application/file-readiness.d.ts +16 -0
- package/dist/application/file-readiness.js +53 -0
- package/dist/application/file-readiness.js.map +1 -0
- package/dist/application/forgotten.d.ts +15 -0
- package/dist/application/forgotten.js +70 -0
- package/dist/application/forgotten.js.map +1 -0
- package/dist/application/front-door.d.ts +68 -0
- package/dist/application/front-door.js +66 -0
- package/dist/application/front-door.js.map +1 -0
- package/dist/application/local-build.d.ts +5 -0
- package/dist/application/local-build.js +22 -0
- package/dist/application/local-build.js.map +1 -0
- package/dist/application/manifest.d.ts +16 -0
- package/dist/application/manifest.js +31 -0
- package/dist/application/manifest.js.map +1 -0
- package/dist/application/native-assets.d.ts +25 -0
- package/dist/application/native-assets.js +29 -0
- package/dist/application/native-assets.js.map +1 -0
- package/dist/application/native-authorization-rpc.d.ts +23 -0
- package/dist/application/native-authorization-rpc.js +54 -0
- package/dist/application/native-authorization-rpc.js.map +1 -0
- package/dist/application/notification-readiness.d.ts +33 -0
- package/dist/application/notification-readiness.js +222 -0
- package/dist/application/notification-readiness.js.map +1 -0
- package/dist/application/packaged-assets.d.ts +5 -0
- package/dist/application/packaged-assets.js +55 -0
- package/dist/application/packaged-assets.js.map +1 -0
- package/dist/application/packaged-trust.d.ts +5 -0
- package/dist/application/packaged-trust.js +10 -0
- package/dist/application/packaged-trust.js.map +1 -0
- package/dist/application/people-readiness.d.ts +23 -0
- package/dist/application/people-readiness.js +213 -0
- package/dist/application/people-readiness.js.map +1 -0
- package/dist/application/phase.d.ts +108 -0
- package/dist/application/phase.js +113 -0
- package/dist/application/phase.js.map +1 -0
- package/dist/application/portal-reservation.d.ts +38 -0
- package/dist/application/portal-reservation.js +183 -0
- package/dist/application/portal-reservation.js.map +1 -0
- package/dist/application/private-collections.d.ts +114 -0
- package/dist/application/private-collections.js +415 -0
- package/dist/application/private-collections.js.map +1 -0
- package/dist/application/readiness.d.ts +59 -0
- package/dist/application/readiness.js +223 -0
- package/dist/application/readiness.js.map +1 -0
- package/dist/application/registration-refusal.d.ts +16 -0
- package/dist/application/registration-refusal.js +41 -0
- package/dist/application/registration-refusal.js.map +1 -0
- package/dist/application/registration.d.ts +26 -0
- package/dist/application/registration.js +372 -0
- package/dist/application/registration.js.map +1 -0
- package/dist/application/return-url.d.ts +1 -0
- package/dist/application/return-url.js +41 -0
- package/dist/application/return-url.js.map +1 -0
- package/dist/application/runtime.d.ts +107 -0
- package/dist/application/runtime.js +379 -0
- package/dist/application/runtime.js.map +1 -0
- package/dist/application/scope.d.ts +34 -0
- package/dist/application/scope.js +164 -0
- package/dist/application/scope.js.map +1 -0
- package/dist/application/session-hint.d.ts +21 -0
- package/dist/application/session-hint.js +87 -0
- package/dist/application/session-hint.js.map +1 -0
- package/dist/application/setup.d.ts +105 -0
- package/dist/application/setup.js +137 -0
- package/dist/application/setup.js.map +1 -0
- package/dist/application/sign-out.d.ts +17 -0
- package/dist/application/sign-out.js +28 -0
- package/dist/application/sign-out.js.map +1 -0
- package/dist/application/storage-scope.d.ts +8 -0
- package/dist/application/storage-scope.js +15 -0
- package/dist/application/storage-scope.js.map +1 -0
- package/dist/application/tabs.d.ts +98 -0
- package/dist/application/tabs.js +407 -0
- package/dist/application/tabs.js.map +1 -0
- package/dist/application/timer-criteria.d.ts +5 -0
- package/dist/application/timer-criteria.js +15 -0
- package/dist/application/timer-criteria.js.map +1 -0
- package/dist/application/ui-connections.d.ts +35 -0
- package/dist/application/ui-connections.js +129 -0
- package/dist/application/ui-connections.js.map +1 -0
- package/dist/application/worker-client.d.ts +59 -0
- package/dist/application/worker-client.js +381 -0
- package/dist/application/worker-client.js.map +1 -0
- package/dist/application/worker-host.d.ts +84 -0
- package/dist/application/worker-host.js +547 -0
- package/dist/application/worker-host.js.map +1 -0
- package/dist/application/worker-protocol.d.ts +40 -0
- package/dist/application/worker-protocol.js +83 -0
- package/dist/application/worker-protocol.js.map +1 -0
- package/dist/application/worker-session.d.ts +45 -0
- package/dist/application/worker-session.js +37 -0
- package/dist/application/worker-session.js.map +1 -0
- package/dist/application/worker.d.ts +1 -0
- package/dist/application/worker.js +34826 -0
- package/dist/application/worker.js.map +1 -0
- package/dist/attachment-wire.d.ts +15 -0
- package/dist/attachment-wire.js +47 -0
- package/dist/attachment-wire.js.map +1 -0
- package/dist/browser/mdbase-sdk.js +49392 -0
- package/dist/browser/mdbase-sdk.min.js +130 -0
- package/dist/browser.d.ts +4 -0
- package/dist/browser.js +5 -0
- package/dist/browser.js.map +1 -0
- package/dist/cbor.d.ts +52 -0
- package/dist/cbor.js +480 -0
- package/dist/cbor.js.map +1 -0
- package/dist/client.d.ts +656 -0
- package/dist/client.js +1962 -0
- package/dist/client.js.map +1 -0
- package/dist/codec.d.ts +82 -0
- package/dist/codec.js +388 -0
- package/dist/codec.js.map +1 -0
- package/dist/collection-availability.d.ts +34 -0
- package/dist/collection-availability.js +63 -0
- package/dist/collection-availability.js.map +1 -0
- package/dist/contract-query.d.ts +31 -0
- package/dist/contract-query.js +13 -0
- package/dist/contract-query.js.map +1 -0
- package/dist/contract-records.d.ts +51 -0
- package/dist/contract-records.js +14 -0
- package/dist/contract-records.js.map +1 -0
- package/dist/describe-error.d.ts +61 -0
- package/dist/describe-error.js +452 -0
- package/dist/describe-error.js.map +1 -0
- package/dist/errors.d.ts +65 -0
- package/dist/errors.js +94 -0
- package/dist/errors.js.map +1 -0
- package/dist/files.d.ts +147 -0
- package/dist/files.js +537 -0
- package/dist/files.js.map +1 -0
- package/dist/holds.d.ts +74 -0
- package/dist/holds.js +118 -0
- package/dist/holds.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/keys.d.ts +40 -0
- package/dist/keys.js +181 -0
- package/dist/keys.js.map +1 -0
- package/dist/live.d.ts +38 -0
- package/dist/live.js +82 -0
- package/dist/live.js.map +1 -0
- package/dist/local-build.d.ts +9 -0
- package/dist/local-build.js +33 -0
- package/dist/local-build.js.map +1 -0
- package/dist/native/provenance.json +23 -0
- package/dist/native/runtime.wasm +0 -0
- package/dist/native/sqlite3.d.ts +5 -0
- package/dist/native/sqlite3.js +17392 -0
- package/dist/native/sqlite3.js.map +1 -0
- package/dist/native/sqlite3.wasm +0 -0
- package/dist/node.d.ts +63 -0
- package/dist/node.js +255 -0
- package/dist/node.js.map +1 -0
- package/dist/notifications.d.ts +95 -0
- package/dist/notifications.js +226 -0
- package/dist/notifications.js.map +1 -0
- package/dist/offline-shell-build.d.ts +25 -0
- package/dist/offline-shell-build.js +78 -0
- package/dist/offline-shell-build.js.map +1 -0
- package/dist/offline-shell-worker.d.ts +46 -0
- package/dist/offline-shell-worker.js +115 -0
- package/dist/offline-shell-worker.js.map +1 -0
- package/dist/people.d.ts +82 -0
- package/dist/people.js +199 -0
- package/dist/people.js.map +1 -0
- package/dist/presence.d.ts +21 -0
- package/dist/presence.js +109 -0
- package/dist/presence.js.map +1 -0
- package/dist/private-account.d.ts +197 -0
- package/dist/private-account.js +510 -0
- package/dist/private-account.js.map +1 -0
- package/dist/private.d.ts +55 -0
- package/dist/private.js +69 -0
- package/dist/private.js.map +1 -0
- package/dist/read-helpers.d.ts +32 -0
- package/dist/read-helpers.js +181 -0
- package/dist/read-helpers.js.map +1 -0
- package/dist/records/session.d.ts +60 -0
- package/dist/records/session.js +534 -0
- package/dist/records/session.js.map +1 -0
- package/dist/records/types.d.ts +76 -0
- package/dist/records/types.js +2 -0
- package/dist/records/types.js.map +1 -0
- package/dist/records/witness.d.ts +19 -0
- package/dist/records/witness.js +64 -0
- package/dist/records/witness.js.map +1 -0
- package/dist/records.d.ts +23 -0
- package/dist/records.js +234 -0
- package/dist/records.js.map +1 -0
- package/dist/runtime/wasm.d.ts +69 -0
- package/dist/runtime/wasm.js +274 -0
- package/dist/runtime/wasm.js.map +1 -0
- package/dist/runtime-wire.d.ts +71 -0
- package/dist/runtime-wire.js +71 -0
- package/dist/runtime-wire.js.map +1 -0
- package/dist/saved-views.d.ts +29 -0
- package/dist/saved-views.js +171 -0
- package/dist/saved-views.js.map +1 -0
- package/dist/semver.d.ts +22 -0
- package/dist/semver.js +63 -0
- package/dist/semver.js.map +1 -0
- package/dist/session.d.ts +65 -0
- package/dist/session.js +332 -0
- package/dist/session.js.map +1 -0
- package/dist/status.d.ts +46 -0
- package/dist/status.js +59 -0
- package/dist/status.js.map +1 -0
- package/dist/strength.d.ts +12 -0
- package/dist/strength.js +194 -0
- package/dist/strength.js.map +1 -0
- package/dist/testing/application.d.ts +59 -0
- package/dist/testing/application.js +230 -0
- package/dist/testing/application.js.map +1 -0
- package/dist/testing/index.d.ts +10 -0
- package/dist/testing/index.js +6 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/memory-contracts.d.ts +40 -0
- package/dist/testing/memory-contracts.js +127 -0
- package/dist/testing/memory-contracts.js.map +1 -0
- package/dist/testing/memory-replica.d.ts +191 -0
- package/dist/testing/memory-replica.js +1465 -0
- package/dist/testing/memory-replica.js.map +1 -0
- package/dist/testing/noise-server.d.ts +11 -0
- package/dist/testing/noise-server.js +65 -0
- package/dist/testing/noise-server.js.map +1 -0
- package/dist/testing/test-app.d.ts +93 -0
- package/dist/testing/test-app.js +140 -0
- package/dist/testing/test-app.js.map +1 -0
- package/dist/thin-client.d.ts +67 -0
- package/dist/thin-client.js +42 -0
- package/dist/thin-client.js.map +1 -0
- package/dist/timers.d.ts +158 -0
- package/dist/timers.js +258 -0
- package/dist/timers.js.map +1 -0
- package/dist/transport/bases-rpc.d.ts +15 -0
- package/dist/transport/bases-rpc.js +61 -0
- package/dist/transport/bases-rpc.js.map +1 -0
- package/dist/transport/control-route.d.ts +34 -0
- package/dist/transport/control-route.js +84 -0
- package/dist/transport/control-route.js.map +1 -0
- package/dist/transport/inprocess.d.ts +13 -0
- package/dist/transport/inprocess.js +37 -0
- package/dist/transport/inprocess.js.map +1 -0
- package/dist/transport/local-link.d.ts +53 -0
- package/dist/transport/local-link.js +66 -0
- package/dist/transport/local-link.js.map +1 -0
- package/dist/transport/next-relay.d.ts +64 -0
- package/dist/transport/next-relay.js +222 -0
- package/dist/transport/next-relay.js.map +1 -0
- package/dist/transport/noise-session.d.ts +88 -0
- package/dist/transport/noise-session.js +264 -0
- package/dist/transport/noise-session.js.map +1 -0
- package/dist/transport/noise.d.ts +102 -0
- package/dist/transport/noise.js +307 -0
- package/dist/transport/noise.js.map +1 -0
- package/dist/transport/original-session.d.ts +6 -0
- package/dist/transport/original-session.js +6 -0
- package/dist/transport/original-session.js.map +1 -0
- package/dist/transport/port.d.ts +67 -0
- package/dist/transport/port.js +184 -0
- package/dist/transport/port.js.map +1 -0
- package/dist/transport/read-fence-policy.d.ts +3 -0
- package/dist/transport/read-fence-policy.js +11 -0
- package/dist/transport/read-fence-policy.js.map +1 -0
- package/dist/transport/relay-close.d.ts +31 -0
- package/dist/transport/relay-close.js +23 -0
- package/dist/transport/relay-close.js.map +1 -0
- package/dist/transport/relay-pipe.d.ts +15 -0
- package/dist/transport/relay-pipe.js +190 -0
- package/dist/transport/relay-pipe.js.map +1 -0
- package/dist/transport/relay.d.ts +36 -0
- package/dist/transport/relay.js +45 -0
- package/dist/transport/relay.js.map +1 -0
- package/dist/type-packs.d.ts +124 -0
- package/dist/type-packs.js +188 -0
- package/dist/type-packs.js.map +1 -0
- package/dist/validation.d.ts +30 -0
- package/dist/validation.js +125 -0
- package/dist/validation.js.map +1 -0
- package/dist/values.d.ts +37 -0
- package/dist/values.js +133 -0
- package/dist/values.js.map +1 -0
- package/dist/view-sources.d.ts +31 -0
- package/dist/view-sources.js +78 -0
- package/dist/view-sources.js.map +1 -0
- package/dist/wire.d.ts +856 -0
- package/dist/wire.js +914 -0
- package/dist/wire.js.map +1 -0
- package/dist/witness.d.ts +7 -0
- package/dist/witness.js +82 -0
- package/dist/witness.js.map +1 -0
- package/dist/write-ledger.d.ts +41 -0
- package/dist/write-ledger.js +184 -0
- package/dist/write-ledger.js.map +1 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/application-authorization.d.ts +32 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/application-authorization.js +207 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/application-contract.d.ts +23 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/application-contract.js +76 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/application-declaration.d.ts +120 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/application-declaration.js +1 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/authorization-errors.d.ts +34 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/authorization-errors.js +52 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/capabilities.d.ts +73 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/capabilities.js +92 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/change-events.generated.d.ts +48 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/change-events.generated.js +18 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/collection-setup.d.ts +93 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/collection-setup.js +7 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/compatibility.d.ts +37 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/compatibility.js +65 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/connect-problems.generated.d.ts +1533 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/connect-problems.generated.js +598 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/files.d.ts +288 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/files.js +426 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/index.d.ts +723 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/index.js +104 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/manifest-validators.generated.d.ts +13 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/manifest-validators.generated.js +7940 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/manifest.d.ts +72 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/manifest.js +643 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/mutation-fingerprint.d.ts +6 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/mutation-fingerprint.js +116 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/next-authorization.d.ts +30 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/next-authorization.js +90 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/operations.d.ts +15 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/operations.js +196 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/people.d.ts +33 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/people.js +26 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/records.d.ts +108 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/records.js +3 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/type-packs.d.ts +154 -0
- package/node_modules/@mdbase-dev/connect-protocol/dist/type-packs.js +30 -0
- package/node_modules/@mdbase-dev/connect-protocol/package.json +49 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/application-capability-catalog.v1.json +40 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/application-capability-catalog.v2.json +68 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/catalog.json +17 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/change-events.v1.json +48 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/connect-problem.v1.schema.json +5665 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/connect-problems.v1.catalog.json +373 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/connect-protocol.v1.schema.json +901 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/data-contract.schema.json +163 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/encrypted-relay.v1.schema.json +63 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/encrypted-relay.v2.schema.json +63 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/encrypted-relay.v3.schema.json +64 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/files.v1.schema.json +551 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/interop/v0.1/action-cancellation.schema.json +6 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/interop/v0.1/action-invocation.schema.json +6 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/interop/v0.1/action-outcome.schema.json +6 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/interop/v0.1/action-provider-declaration.schema.json +6 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/interop/v0.1/action-request.schema.json +6 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/interop/v0.1/conformance-claim.schema.json +6 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/interop/v0.1/event-source-declaration.schema.json +6 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/interop/v0.1/event.schema.json +6 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/interop/v0.1/profile.schema.json +456 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/mdbase-app.legacy-v1.schema.json +430 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/mdbase-app.schema.json +437 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/mdbase-query.v0.3.schema.json +176 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/next-trust.v1.schema.json +54 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/notification-webhook.v1.schema.json +56 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/operation-catalog.v1.json +43 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/operation-mutation-classification.v1.json +554 -0
- package/node_modules/@mdbase-dev/connect-protocol/schemas/sync.v1.schema.json +483 -0
- package/node_modules/@noble/hashes/LICENSE +21 -0
- package/node_modules/@noble/hashes/README.md +478 -0
- package/node_modules/@noble/hashes/_blake.d.ts +20 -0
- package/node_modules/@noble/hashes/_blake.js +59 -0
- package/node_modules/@noble/hashes/_md.d.ts +95 -0
- package/node_modules/@noble/hashes/_md.js +209 -0
- package/node_modules/@noble/hashes/_u64.d.ts +36 -0
- package/node_modules/@noble/hashes/_u64.js +77 -0
- package/node_modules/@noble/hashes/argon2.d.ts +148 -0
- package/node_modules/@noble/hashes/argon2.js +577 -0
- package/node_modules/@noble/hashes/blake1.d.ts +162 -0
- package/node_modules/@noble/hashes/blake1.js +630 -0
- package/node_modules/@noble/hashes/blake2.d.ts +203 -0
- package/node_modules/@noble/hashes/blake2.js +573 -0
- package/node_modules/@noble/hashes/blake3.d.ts +68 -0
- package/node_modules/@noble/hashes/blake3.js +310 -0
- package/node_modules/@noble/hashes/eskdf.d.ts +91 -0
- package/node_modules/@noble/hashes/eskdf.js +225 -0
- package/node_modules/@noble/hashes/hkdf.d.ts +70 -0
- package/node_modules/@noble/hashes/hkdf.js +152 -0
- package/node_modules/@noble/hashes/hmac.d.ts +50 -0
- package/node_modules/@noble/hashes/hmac.js +93 -0
- package/node_modules/@noble/hashes/index.d.ts +1 -0
- package/node_modules/@noble/hashes/index.js +34 -0
- package/node_modules/@noble/hashes/legacy.d.ts +107 -0
- package/node_modules/@noble/hashes/legacy.js +348 -0
- package/node_modules/@noble/hashes/package.json +91 -0
- package/node_modules/@noble/hashes/pbkdf2.d.ts +66 -0
- package/node_modules/@noble/hashes/pbkdf2.js +176 -0
- package/node_modules/@noble/hashes/scrypt.d.ts +98 -0
- package/node_modules/@noble/hashes/scrypt.js +304 -0
- package/node_modules/@noble/hashes/sha2.d.ts +176 -0
- package/node_modules/@noble/hashes/sha2.js +446 -0
- package/node_modules/@noble/hashes/sha3-addons.d.ts +533 -0
- package/node_modules/@noble/hashes/sha3-addons.js +973 -0
- package/node_modules/@noble/hashes/sha3.d.ts +208 -0
- package/node_modules/@noble/hashes/sha3.js +475 -0
- package/node_modules/@noble/hashes/src/_blake.ts +67 -0
- package/node_modules/@noble/hashes/src/_md.ts +227 -0
- package/node_modules/@noble/hashes/src/_u64.ts +111 -0
- package/node_modules/@noble/hashes/src/argon2.ts +693 -0
- package/node_modules/@noble/hashes/src/blake1.ts +677 -0
- package/node_modules/@noble/hashes/src/blake2.ts +648 -0
- package/node_modules/@noble/hashes/src/blake3.ts +344 -0
- package/node_modules/@noble/hashes/src/eskdf.ts +265 -0
- package/node_modules/@noble/hashes/src/hkdf.ts +161 -0
- package/node_modules/@noble/hashes/src/hmac.ts +130 -0
- package/node_modules/@noble/hashes/src/index.ts +33 -0
- package/node_modules/@noble/hashes/src/legacy.ts +361 -0
- package/node_modules/@noble/hashes/src/pbkdf2.ts +219 -0
- package/node_modules/@noble/hashes/src/scrypt.ts +375 -0
- package/node_modules/@noble/hashes/src/sha2.ts +486 -0
- package/node_modules/@noble/hashes/src/sha3-addons.ts +1157 -0
- package/node_modules/@noble/hashes/src/sha3.ts +525 -0
- package/node_modules/@noble/hashes/src/utils.ts +978 -0
- package/node_modules/@noble/hashes/src/webcrypto.ts +283 -0
- package/node_modules/@noble/hashes/utils.d.ts +560 -0
- package/node_modules/@noble/hashes/utils.js +687 -0
- package/node_modules/@noble/hashes/webcrypto.d.ts +121 -0
- package/node_modules/@noble/hashes/webcrypto.js +228 -0
- package/node_modules/yaml/LICENSE +13 -0
- package/node_modules/yaml/README.md +172 -0
- package/node_modules/yaml/bin.mjs +11 -0
- package/node_modules/yaml/browser/dist/compose/compose-collection.js +88 -0
- package/node_modules/yaml/browser/dist/compose/compose-doc.js +43 -0
- package/node_modules/yaml/browser/dist/compose/compose-node.js +109 -0
- package/node_modules/yaml/browser/dist/compose/compose-scalar.js +86 -0
- package/node_modules/yaml/browser/dist/compose/composer.js +219 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +115 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +198 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +49 -0
- package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +207 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +226 -0
- package/node_modules/yaml/browser/dist/compose/resolve-props.js +146 -0
- package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
- package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +26 -0
- package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
- package/node_modules/yaml/browser/dist/compose/util-map-includes.js +13 -0
- package/node_modules/yaml/browser/dist/doc/Document.js +335 -0
- package/node_modules/yaml/browser/dist/doc/anchors.js +71 -0
- package/node_modules/yaml/browser/dist/doc/applyReviver.js +55 -0
- package/node_modules/yaml/browser/dist/doc/createNode.js +88 -0
- package/node_modules/yaml/browser/dist/doc/directives.js +176 -0
- package/node_modules/yaml/browser/dist/errors.js +57 -0
- package/node_modules/yaml/browser/dist/index.js +17 -0
- package/node_modules/yaml/browser/dist/log.js +11 -0
- package/node_modules/yaml/browser/dist/nodes/Alias.js +118 -0
- package/node_modules/yaml/browser/dist/nodes/Collection.js +147 -0
- package/node_modules/yaml/browser/dist/nodes/Node.js +38 -0
- package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/Scalar.js +24 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +144 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +113 -0
- package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +63 -0
- package/node_modules/yaml/browser/dist/nodes/identity.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/toJS.js +37 -0
- package/node_modules/yaml/browser/dist/parse/cst-scalar.js +214 -0
- package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
- package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
- package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
- package/node_modules/yaml/browser/dist/parse/lexer.js +721 -0
- package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
- package/node_modules/yaml/browser/dist/parse/parser.js +975 -0
- package/node_modules/yaml/browser/dist/public-api.js +102 -0
- package/node_modules/yaml/browser/dist/schema/Schema.js +37 -0
- package/node_modules/yaml/browser/dist/schema/common/map.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/null.js +15 -0
- package/node_modules/yaml/browser/dist/schema/common/seq.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
- package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
- package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
- package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
- package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
- package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
- package/node_modules/yaml/browser/dist/schema/tags.js +96 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +58 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +67 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +74 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +78 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +39 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +93 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
- package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +146 -0
- package/node_modules/yaml/browser/dist/stringify/stringify.js +129 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +153 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +20 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +85 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +25 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +150 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyString.js +336 -0
- package/node_modules/yaml/browser/dist/util.js +11 -0
- package/node_modules/yaml/browser/dist/visit.js +233 -0
- package/node_modules/yaml/browser/index.js +5 -0
- package/node_modules/yaml/browser/package.json +3 -0
- package/node_modules/yaml/dist/cli.d.ts +8 -0
- package/node_modules/yaml/dist/cli.mjs +201 -0
- package/node_modules/yaml/dist/compose/compose-collection.d.ts +11 -0
- package/node_modules/yaml/dist/compose/compose-collection.js +90 -0
- package/node_modules/yaml/dist/compose/compose-doc.d.ts +7 -0
- package/node_modules/yaml/dist/compose/compose-doc.js +45 -0
- package/node_modules/yaml/dist/compose/compose-node.d.ts +29 -0
- package/node_modules/yaml/dist/compose/compose-node.js +112 -0
- package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
- package/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
- package/node_modules/yaml/dist/compose/composer.d.ts +63 -0
- package/node_modules/yaml/dist/compose/composer.js +224 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +11 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
- package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +228 -0
- package/node_modules/yaml/dist/compose/resolve-props.d.ts +23 -0
- package/node_modules/yaml/dist/compose/resolve-props.js +148 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
- package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
- package/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
- package/node_modules/yaml/dist/doc/Document.d.ts +141 -0
- package/node_modules/yaml/dist/doc/Document.js +337 -0
- package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
- package/node_modules/yaml/dist/doc/anchors.js +76 -0
- package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
- package/node_modules/yaml/dist/doc/applyReviver.js +57 -0
- package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
- package/node_modules/yaml/dist/doc/createNode.js +90 -0
- package/node_modules/yaml/dist/doc/directives.d.ts +49 -0
- package/node_modules/yaml/dist/doc/directives.js +178 -0
- package/node_modules/yaml/dist/errors.d.ts +21 -0
- package/node_modules/yaml/dist/errors.js +62 -0
- package/node_modules/yaml/dist/index.d.ts +25 -0
- package/node_modules/yaml/dist/index.js +50 -0
- package/node_modules/yaml/dist/log.d.ts +3 -0
- package/node_modules/yaml/dist/log.js +19 -0
- package/node_modules/yaml/dist/nodes/Alias.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/Alias.js +120 -0
- package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
- package/node_modules/yaml/dist/nodes/Collection.js +151 -0
- package/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/Node.js +40 -0
- package/node_modules/yaml/dist/nodes/Pair.d.ts +22 -0
- package/node_modules/yaml/dist/nodes/Pair.js +39 -0
- package/node_modules/yaml/dist/nodes/Scalar.d.ts +47 -0
- package/node_modules/yaml/dist/nodes/Scalar.js +27 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +60 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
- package/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
- package/node_modules/yaml/dist/nodes/identity.js +53 -0
- package/node_modules/yaml/dist/nodes/toJS.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/toJS.js +39 -0
- package/node_modules/yaml/dist/options.d.ts +350 -0
- package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
- package/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
- package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
- package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
- package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
- package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
- package/node_modules/yaml/dist/parse/cst.d.ts +109 -0
- package/node_modules/yaml/dist/parse/cst.js +112 -0
- package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
- package/node_modules/yaml/dist/parse/lexer.js +723 -0
- package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
- package/node_modules/yaml/dist/parse/line-counter.js +41 -0
- package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
- package/node_modules/yaml/dist/parse/parser.js +980 -0
- package/node_modules/yaml/dist/public-api.d.ts +44 -0
- package/node_modules/yaml/dist/public-api.js +107 -0
- package/node_modules/yaml/dist/schema/Schema.d.ts +17 -0
- package/node_modules/yaml/dist/schema/Schema.js +39 -0
- package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/map.js +19 -0
- package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
- package/node_modules/yaml/dist/schema/common/null.js +17 -0
- package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/seq.js +19 -0
- package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/string.js +16 -0
- package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/bool.js +21 -0
- package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/float.js +47 -0
- package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/int.js +42 -0
- package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/core/schema.js +25 -0
- package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
- package/node_modules/yaml/dist/schema/json/schema.js +64 -0
- package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
- package/node_modules/yaml/dist/schema/tags.d.ts +48 -0
- package/node_modules/yaml/dist/schema/tags.js +99 -0
- package/node_modules/yaml/dist/schema/types.d.ts +92 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +9 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +71 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +22 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +28 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
- package/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
- package/node_modules/yaml/dist/stringify/stringify.js +132 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.js +27 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
- package/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
- package/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
- package/node_modules/yaml/dist/test-events.d.ts +4 -0
- package/node_modules/yaml/dist/test-events.js +134 -0
- package/node_modules/yaml/dist/util.d.ts +16 -0
- package/node_modules/yaml/dist/util.js +28 -0
- package/node_modules/yaml/dist/visit.d.ts +102 -0
- package/node_modules/yaml/dist/visit.js +236 -0
- package/node_modules/yaml/package.json +97 -0
- package/node_modules/yaml/util.js +2 -0
- package/package.json +108 -4
- package/vendor/mdbase-connect-sdk-e6e66bcd172f.json +13 -0
- package/vendor/mdbase-dev-connect-protocol-0.1.0-beta.145-e6e66bcd172f.tgz +0 -0
|
@@ -0,0 +1,1028 @@
|
|
|
1
|
+
/** Production web host composition (internal until full bootstrap/read qualification).
|
|
2
|
+
* Device phase uses the actual persistent browser provider/stores and actual CP
|
|
3
|
+
* registration. No fixture/memory custody or default roots. Collection SQL opens
|
|
4
|
+
* only after ownership + protected completion; native reads gate the data facade. */
|
|
5
|
+
import { idbLogTokenCache } from "./log-token-cache.js";
|
|
6
|
+
import { waitForOpenRetry } from "./open-wait.js";
|
|
7
|
+
import { currentAppOrigin } from "./app-origin.js";
|
|
8
|
+
import { uuidToBytes } from "../codec.js";
|
|
9
|
+
import { collectionDisplayName } from "./collection-display-name.js";
|
|
10
|
+
import { MdbaseClient } from "../client.js";
|
|
11
|
+
import { MdbaseError } from "../errors.js";
|
|
12
|
+
import { inProcessConnector } from "../transport/inprocess.js";
|
|
13
|
+
import { AppCpLogAuthority } from "./cp-authority.js";
|
|
14
|
+
import { AppLogPushChannel } from "./log-push.js";
|
|
15
|
+
import { AppCpPeopleAuthority } from "./cp-people.js";
|
|
16
|
+
import { attachAppTimerReceiver } from "./timer-port.js";
|
|
17
|
+
import { appServerOutcome, isAppServerProblem } from "./cp-problem.js";
|
|
18
|
+
import { AppHttpLogError } from "./http-log.js";
|
|
19
|
+
import { initialSyncWait, keyWaitDetail } from "./initial-sync.js";
|
|
20
|
+
import { attachAppLocalFacade } from "./local-facade.js";
|
|
21
|
+
import { AppCpCloudCopyBootstrap, } from "./cloud-copy-bootstrap.js";
|
|
22
|
+
import { AppWebCloudCopyBootstrapPersistence, } from "./cloud-copy-persistence.js";
|
|
23
|
+
import { AppIndexedDbCloudCopyOutcomeStore } from "./cloud-copy-persistence-idb.js";
|
|
24
|
+
import { AppIndexedDbDeviceKeyProvider } from "./device-key-provider.js";
|
|
25
|
+
import { AppIndexedDbDeviceKeyProtectedStore } from "./device-key-idb.js";
|
|
26
|
+
import { AppWebDeviceKeyCustody } from "./device-key-custody.js";
|
|
27
|
+
import { AppIndexedDbNoiseProtectedStore } from "./noise-idb.js";
|
|
28
|
+
import { AppWebNoiseCustody } from "./noise-custody.js";
|
|
29
|
+
import { AppCpDeviceRegistration, } from "./device-registration.js";
|
|
30
|
+
import { AppWasmRuntime, AppStrictDeviceApprovalError, } from "./wasm-runtime.js";
|
|
31
|
+
export class AppCloudCopyHostError extends Error {
|
|
32
|
+
reason;
|
|
33
|
+
constructor(reason) {
|
|
34
|
+
super(`app cloud copy host: ${reason}`);
|
|
35
|
+
this.reason = reason;
|
|
36
|
+
this.name = "AppCloudCopyHostError";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** Attached tabs per replica: the leader plus followers. */
|
|
40
|
+
const MAX_FACADES = 32;
|
|
41
|
+
/** Bounded back-to-back turns in one foreground drive. */
|
|
42
|
+
const DRIVE_TURNS = 8;
|
|
43
|
+
const fail = (r) => new AppCloudCopyHostError(r);
|
|
44
|
+
const equal = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
|
|
45
|
+
/** Owns nonexported KEK and ciphertext handles for SAME original installation.
|
|
46
|
+
* Call close/terminate through openOwnedAppWorker; this object never unlocks.
|
|
47
|
+
* No raw key/KEK getter or generic store/sign/DH surface. */
|
|
48
|
+
export class AppWebCloudCopyHost {
|
|
49
|
+
source;
|
|
50
|
+
installation;
|
|
51
|
+
originalRelease;
|
|
52
|
+
origin;
|
|
53
|
+
lifetime;
|
|
54
|
+
closing = false;
|
|
55
|
+
closeResult = null;
|
|
56
|
+
provider = null;
|
|
57
|
+
keys = null;
|
|
58
|
+
noiseStore = null;
|
|
59
|
+
key = null;
|
|
60
|
+
noise = null;
|
|
61
|
+
native = null;
|
|
62
|
+
publicReceipt = null;
|
|
63
|
+
signIn = null;
|
|
64
|
+
originalCustody = null;
|
|
65
|
+
collectionAttempted = false;
|
|
66
|
+
// Original collection cancellation remains bound to protected bootstrap
|
|
67
|
+
// storage/adoption. Each public call also observes its own caller signal.
|
|
68
|
+
collectionSignal = null;
|
|
69
|
+
collectionCurrent = null;
|
|
70
|
+
outcomeStore = null;
|
|
71
|
+
outcome = null;
|
|
72
|
+
bootstrap = null;
|
|
73
|
+
bootstrapConfirmed = false;
|
|
74
|
+
collectionScope = null;
|
|
75
|
+
collectionSession = null;
|
|
76
|
+
adoptedEndpoint = null;
|
|
77
|
+
sqlAttempted = false;
|
|
78
|
+
sqlClose = null;
|
|
79
|
+
collectionSql = null;
|
|
80
|
+
logRequest = null;
|
|
81
|
+
logLoopback = false;
|
|
82
|
+
logWork = null;
|
|
83
|
+
authority = null;
|
|
84
|
+
peopleMetadata = null;
|
|
85
|
+
pump = null;
|
|
86
|
+
timerPorts = new Set();
|
|
87
|
+
readWork = null;
|
|
88
|
+
readAbort = null;
|
|
89
|
+
readClient = null;
|
|
90
|
+
readVerified = false;
|
|
91
|
+
/** One data facade per attached tab (the first, then any follower tabs). */
|
|
92
|
+
facades = new Map();
|
|
93
|
+
logWorkListener = null;
|
|
94
|
+
selected;
|
|
95
|
+
currentCallback;
|
|
96
|
+
bearerCallback;
|
|
97
|
+
ownershipCallback;
|
|
98
|
+
trust;
|
|
99
|
+
pin;
|
|
100
|
+
constructor(source, installation, originalRelease, origin, lifetime) {
|
|
101
|
+
this.source = source;
|
|
102
|
+
this.installation = installation;
|
|
103
|
+
this.originalRelease = originalRelease;
|
|
104
|
+
this.origin = origin;
|
|
105
|
+
this.lifetime = lifetime;
|
|
106
|
+
this.selected = Object.freeze({
|
|
107
|
+
accountId: source.accountId,
|
|
108
|
+
connectorId: source.connectorId,
|
|
109
|
+
deviceId: source.deviceId,
|
|
110
|
+
installationId: source.installationId,
|
|
111
|
+
kind: source.kind,
|
|
112
|
+
cpOrigin: source.cpOrigin,
|
|
113
|
+
logOrigin: source.logOrigin,
|
|
114
|
+
approvalMode: source.approvalMode,
|
|
115
|
+
});
|
|
116
|
+
this.currentCallback = source.isCurrent;
|
|
117
|
+
this.bearerCallback = source.connectorBearer;
|
|
118
|
+
this.ownershipCallback = installation.isCurrent;
|
|
119
|
+
for (const v of [
|
|
120
|
+
source.accountId,
|
|
121
|
+
source.connectorId,
|
|
122
|
+
source.deviceId,
|
|
123
|
+
source.installationId,
|
|
124
|
+
])
|
|
125
|
+
if (uuidToBytes(v).every((b) => b === 0))
|
|
126
|
+
throw fail("binding");
|
|
127
|
+
if ((source.kind !== "app-runtime" && source.kind !== "mobile") ||
|
|
128
|
+
originalRelease.schema !== "mdbn-app-trust/release/1" ||
|
|
129
|
+
originalRelease.cpOrigin !== source.cpOrigin ||
|
|
130
|
+
originalRelease.logOrigin !== source.logOrigin ||
|
|
131
|
+
!/^[0-9a-f]{64}$/.test(originalRelease.assetSha256) ||
|
|
132
|
+
!originalRelease.trustedRoots.length ||
|
|
133
|
+
originalRelease.trustedRoots.length > 64 ||
|
|
134
|
+
!originalRelease.policyPins.length ||
|
|
135
|
+
originalRelease.policyPins.length > 65536)
|
|
136
|
+
throw fail("binding");
|
|
137
|
+
this.trust = Object.freeze({
|
|
138
|
+
...originalRelease,
|
|
139
|
+
source: Object.freeze({ ...originalRelease.source }),
|
|
140
|
+
trustedRoots: Object.freeze(originalRelease.trustedRoots.map((v) => {
|
|
141
|
+
if (!(v instanceof Uint8Array) ||
|
|
142
|
+
v.length !== 32 ||
|
|
143
|
+
v.every((b) => b === 0))
|
|
144
|
+
throw fail("binding");
|
|
145
|
+
return new Uint8Array(v);
|
|
146
|
+
})),
|
|
147
|
+
policyPins: new Uint8Array(originalRelease.policyPins),
|
|
148
|
+
});
|
|
149
|
+
this.pin = Object.freeze({
|
|
150
|
+
...this.selected,
|
|
151
|
+
isCurrent: () => this.current(),
|
|
152
|
+
installationOwned: () => this.current(),
|
|
153
|
+
connectorBearer: async ({ signal }) => {
|
|
154
|
+
this.check(signal);
|
|
155
|
+
const value = await this.bearerCallback.call(this.source, Object.freeze({ signal }));
|
|
156
|
+
this.check(signal);
|
|
157
|
+
return value;
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
if (source.approvalMode === "strict")
|
|
161
|
+
throw new AppStrictDeviceApprovalError();
|
|
162
|
+
this.check(lifetime);
|
|
163
|
+
}
|
|
164
|
+
current() {
|
|
165
|
+
try {
|
|
166
|
+
const r = this.originalRelease, t = this.trust;
|
|
167
|
+
return (!this.closing &&
|
|
168
|
+
!this.lifetime.aborted &&
|
|
169
|
+
currentAppOrigin() === this.origin &&
|
|
170
|
+
this.source.isCurrent === this.currentCallback &&
|
|
171
|
+
this.source.connectorBearer === this.bearerCallback &&
|
|
172
|
+
this.installation.isCurrent === this.ownershipCallback &&
|
|
173
|
+
this.currentCallback.call(this.source) === true &&
|
|
174
|
+
this.ownershipCallback.call(this.installation) === true &&
|
|
175
|
+
this.installation.scope.account === this.selected.accountId &&
|
|
176
|
+
this.installation.scope.installation ===
|
|
177
|
+
this.selected.installationId &&
|
|
178
|
+
Object.entries(this.selected).every(([k, v]) => this.source[k] === v) &&
|
|
179
|
+
r.schema === t.schema &&
|
|
180
|
+
r.environment === t.environment &&
|
|
181
|
+
r.cpOrigin === t.cpOrigin &&
|
|
182
|
+
r.logOrigin === t.logOrigin &&
|
|
183
|
+
r.assetSha256 === t.assetSha256 &&
|
|
184
|
+
r.source.repository === t.source.repository &&
|
|
185
|
+
r.source.commit === t.source.commit &&
|
|
186
|
+
r.source.version === t.source.version &&
|
|
187
|
+
r.trustedRoots.length === t.trustedRoots.length &&
|
|
188
|
+
r.trustedRoots.every((v, i) => equal(v, t.trustedRoots[i])) &&
|
|
189
|
+
equal(r.policyPins, t.policyPins));
|
|
190
|
+
}
|
|
191
|
+
catch {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
check(signal) {
|
|
196
|
+
if (signal.aborted || !this.current())
|
|
197
|
+
throw fail("fenced");
|
|
198
|
+
}
|
|
199
|
+
operationSignal(caller) {
|
|
200
|
+
const signal = AbortSignal.any([
|
|
201
|
+
this.lifetime,
|
|
202
|
+
...(this.collectionSignal ? [this.collectionSignal] : []),
|
|
203
|
+
caller,
|
|
204
|
+
]);
|
|
205
|
+
this.check(signal);
|
|
206
|
+
return signal;
|
|
207
|
+
}
|
|
208
|
+
/** Must run INSIDE owned Worker initialization, after installation acquisition.
|
|
209
|
+
* loadRuntime is the explicit authenticated immutable-artifact intake, not a
|
|
210
|
+
* MemStore/legacy/default module selector. No collection query/SQL/facade yet. */
|
|
211
|
+
static async openOriginalDevice(options) {
|
|
212
|
+
const { session, installation, release, origin, mode, signal, loadRuntime, fetch: request, allowLoopbackHttp, allowNativeLoopbackHttp, } = options;
|
|
213
|
+
let host = null;
|
|
214
|
+
try {
|
|
215
|
+
if (!["fresh", "existing"].includes(mode))
|
|
216
|
+
throw fail("binding");
|
|
217
|
+
host = new AppWebCloudCopyHost(session, installation, release, origin, signal);
|
|
218
|
+
const { custody, restored } = await host.openOwnedDevice({ mode, signal, loadRuntime, allowLoopbackHttp, allowNativeLoopbackHttp, requireReceipt: true });
|
|
219
|
+
if (mode === "existing") {
|
|
220
|
+
host.native.acknowledgeDeviceRegistration(restored.receipt);
|
|
221
|
+
host.check(signal);
|
|
222
|
+
host.publicReceipt = host.native.registeredDeviceReceipt();
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
const receipt = await new AppCpDeviceRegistration(host.native, host.pin, custody, host.noise, { fetch: request, allowLoopbackHttp }).register(Object.freeze({ signal }));
|
|
226
|
+
host.check(signal);
|
|
227
|
+
host.publicReceipt = receipt;
|
|
228
|
+
}
|
|
229
|
+
return host;
|
|
230
|
+
}
|
|
231
|
+
catch (e) {
|
|
232
|
+
await host?.close();
|
|
233
|
+
if (e instanceof AppCloudCopyHostError ||
|
|
234
|
+
e instanceof AppStrictDeviceApprovalError)
|
|
235
|
+
throw e;
|
|
236
|
+
throw fail("unavailable");
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/** SAME protected installation flow -> SAME original native lifetime. No
|
|
240
|
+
* /devices registration, second open, seed re-loan or raw custody getter.
|
|
241
|
+
* User account confirmation and actual installation ownership precede the
|
|
242
|
+
* committed attempt; partial EXISTING state never authorizes fresh keys. */
|
|
243
|
+
static async openInstallationDevice(options) {
|
|
244
|
+
const { signIn, installation, release, origin, signal, loadRuntime, allowLoopbackHttp, allowNativeLoopbackHttp } = options;
|
|
245
|
+
let host = null;
|
|
246
|
+
try {
|
|
247
|
+
const session = signIn.confirmedHostSession(release.logOrigin, release.environment);
|
|
248
|
+
host = new AppWebCloudCopyHost(session, installation, release, origin, signal);
|
|
249
|
+
host.signIn = signIn;
|
|
250
|
+
const prepared = await signIn.prepareOriginalDevice(installation);
|
|
251
|
+
host.check(signal);
|
|
252
|
+
const { custody, restored } = await host.openOwnedDevice({ mode: prepared.mode, signal, loadRuntime, allowLoopbackHttp, allowNativeLoopbackHttp, requireReceipt: false });
|
|
253
|
+
host.originalCustody = custody;
|
|
254
|
+
if (restored?.receipt && signIn.view().state !== "paired")
|
|
255
|
+
throw fail("recovery_required");
|
|
256
|
+
// Protect original Noise immediately, even before explicit attestation.
|
|
257
|
+
await host.noise.pending(new Uint8Array(custody.envelope), { signal });
|
|
258
|
+
host.check(signal);
|
|
259
|
+
// Completed restore is entirely local: no pairing/register HTTP.
|
|
260
|
+
if (signIn.view().state === "paired")
|
|
261
|
+
await host.completeInstallationSignIn();
|
|
262
|
+
return host;
|
|
263
|
+
}
|
|
264
|
+
catch (error) {
|
|
265
|
+
await host?.close();
|
|
266
|
+
throw error;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
/** ONE fixed enrol transcript with durable original proof. Lost replies
|
|
270
|
+
* retain this native owner; only explicit SAME-flow reconciliation retries. */
|
|
271
|
+
async attestInstallation() {
|
|
272
|
+
this.check(this.lifetime);
|
|
273
|
+
if (!this.signIn || !this.native || !this.originalCustody || !this.noise)
|
|
274
|
+
throw fail("binding");
|
|
275
|
+
const view = await this.signIn.attest({ runtime: this.native, custody: this.originalCustody, persistence: this.noise, installation: this.installation });
|
|
276
|
+
this.check(this.lifetime);
|
|
277
|
+
return view;
|
|
278
|
+
}
|
|
279
|
+
/** Call only after explicit flow.exchange has protected the credential.
|
|
280
|
+
* Durable SAME Noise receipt precedes SAME native ACK and host readiness. */
|
|
281
|
+
async completeInstallationSignIn() {
|
|
282
|
+
this.check(this.lifetime);
|
|
283
|
+
if (!this.signIn || !this.native || !this.originalCustody || !this.noise)
|
|
284
|
+
throw fail("binding");
|
|
285
|
+
await this.signIn.acknowledge({ runtime: this.native, custody: this.originalCustody, persistence: this.noise, installation: this.installation });
|
|
286
|
+
this.check(this.lifetime);
|
|
287
|
+
this.publicReceipt = this.native.registeredDeviceReceipt();
|
|
288
|
+
return this.registeredReceipt();
|
|
289
|
+
}
|
|
290
|
+
/** Shared original-device intake for old controller qualification and actual
|
|
291
|
+
* installation sign-in. No mode inference or second custody implementation. */
|
|
292
|
+
async openOwnedDevice(options) {
|
|
293
|
+
const { mode, signal, loadRuntime, allowLoopbackHttp, allowNativeLoopbackHttp, requireReceipt } = options;
|
|
294
|
+
this.check(signal);
|
|
295
|
+
this.provider = await AppIndexedDbDeviceKeyProvider.open({ source: this.pin, origin: this.origin, mode, signal, allowLoopbackHttp, allowNativeLoopbackHttp });
|
|
296
|
+
this.check(signal);
|
|
297
|
+
this.key = this.provider.deviceCustodyKek({ signal });
|
|
298
|
+
this.check(signal);
|
|
299
|
+
this.keys = await AppIndexedDbDeviceKeyProtectedStore.open({ source: this.pin, origin: this.origin, mode, signal, allowLoopbackHttp, allowNativeLoopbackHttp });
|
|
300
|
+
this.check(signal);
|
|
301
|
+
this.noiseStore = await AppIndexedDbNoiseProtectedStore.open({ source: this.pin, origin: this.origin, mode, signal, allowLoopbackHttp, allowNativeLoopbackHttp });
|
|
302
|
+
this.check(signal);
|
|
303
|
+
this.noise = new AppWebNoiseCustody(this.pin, this.key, this.noiseStore);
|
|
304
|
+
const restored = await this.noise.restore({ signal });
|
|
305
|
+
this.check(signal);
|
|
306
|
+
if (mode === "existing" ? !restored || (requireReceipt && !restored.receipt) : restored !== null)
|
|
307
|
+
throw fail("recovery_required");
|
|
308
|
+
const artifact = await loadRuntime(Object.freeze({ signal }));
|
|
309
|
+
this.check(signal);
|
|
310
|
+
if (!(artifact instanceof Uint8Array) || !artifact.length)
|
|
311
|
+
throw fail("binding");
|
|
312
|
+
this.native = await AppWasmRuntime.createDevice(new Uint8Array(artifact));
|
|
313
|
+
this.check(signal);
|
|
314
|
+
const custody = await new AppWebDeviceKeyCustody(this.pin, this.key, this.keys).openNativeDevice(this.native, {
|
|
315
|
+
signal, mode, noise: mode === "fresh" ? { mode: "fresh" } : { mode: "existing", envelope: restored.envelope },
|
|
316
|
+
});
|
|
317
|
+
this.check(signal);
|
|
318
|
+
return { custody, restored };
|
|
319
|
+
}
|
|
320
|
+
/** Called INSIDE the same owned collection Worker initialization. scope is
|
|
321
|
+
* the original scope supplied by openOwnedAppWorker, collectionCurrent is
|
|
322
|
+
* its trusted first-party lifetime fence (not a grant or SQL/readiness proof).
|
|
323
|
+
* SAME nonexported KEK and bundled environment; no caller outcome adapter.
|
|
324
|
+
* No SQL is opened here and completion is NOT readable/Saved authority. */
|
|
325
|
+
async bootstrapCloudCopy(options) {
|
|
326
|
+
const { scope, collectionCurrent, purpose, outcomeMode, signal: callerSignal, reconcile, fetch: request, allowLoopbackHttp, allowNativeLoopbackHttp, } = options;
|
|
327
|
+
const signal = this.operationSignal(callerSignal);
|
|
328
|
+
const requestedName = options.displayName;
|
|
329
|
+
const displayName = requestedName === undefined ? undefined : collectionDisplayName(requestedName);
|
|
330
|
+
if (displayName !== undefined && purpose !== "create")
|
|
331
|
+
throw fail("binding");
|
|
332
|
+
this.check(signal);
|
|
333
|
+
if (this.collectionAttempted ||
|
|
334
|
+
!this.native ||
|
|
335
|
+
!this.key ||
|
|
336
|
+
!this.publicReceipt ||
|
|
337
|
+
scope.account !== this.selected.accountId ||
|
|
338
|
+
scope.installation !== this.selected.installationId ||
|
|
339
|
+
!["create", "join"].includes(purpose) ||
|
|
340
|
+
!["fresh", "existing"].includes(outcomeMode) ||
|
|
341
|
+
uuidToBytes(scope.collection).every((v) => v === 0))
|
|
342
|
+
throw fail("binding");
|
|
343
|
+
const original = Object.freeze({
|
|
344
|
+
account: scope.account,
|
|
345
|
+
installation: scope.installation,
|
|
346
|
+
collection: scope.collection,
|
|
347
|
+
});
|
|
348
|
+
const current = () => {
|
|
349
|
+
try {
|
|
350
|
+
return (this.current() &&
|
|
351
|
+
!signal.aborted &&
|
|
352
|
+
options.scope === scope &&
|
|
353
|
+
options.collectionCurrent === collectionCurrent &&
|
|
354
|
+
Object.entries(original).every(([k, v]) => scope[k] === v) &&
|
|
355
|
+
collectionCurrent.call(options) === true &&
|
|
356
|
+
this.outcomeStore?.fenced !== true);
|
|
357
|
+
}
|
|
358
|
+
catch {
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
if (!current())
|
|
363
|
+
throw fail("fenced");
|
|
364
|
+
this.collectionAttempted = true;
|
|
365
|
+
this.collectionSignal = signal;
|
|
366
|
+
this.collectionCurrent = current;
|
|
367
|
+
this.collectionScope = original;
|
|
368
|
+
const source = Object.freeze({
|
|
369
|
+
...this.pin,
|
|
370
|
+
collection: original.collection,
|
|
371
|
+
purpose,
|
|
372
|
+
assetSha256: this.trust.assetSha256,
|
|
373
|
+
...(displayName === undefined ? {} : { displayName }),
|
|
374
|
+
isCurrent: current,
|
|
375
|
+
});
|
|
376
|
+
this.collectionSession = source;
|
|
377
|
+
try {
|
|
378
|
+
this.outcomeStore = await AppIndexedDbCloudCopyOutcomeStore.open({
|
|
379
|
+
source,
|
|
380
|
+
origin: this.origin,
|
|
381
|
+
mode: outcomeMode,
|
|
382
|
+
signal,
|
|
383
|
+
allowLoopbackHttp,
|
|
384
|
+
allowNativeLoopbackHttp,
|
|
385
|
+
});
|
|
386
|
+
this.checkCollection(signal);
|
|
387
|
+
this.outcome = new AppWebCloudCopyBootstrapPersistence(source, this.publicReceipt, this.key, this.outcomeStore, { mode: outcomeMode, signal });
|
|
388
|
+
this.native.prepareCloudCopyCollection(source);
|
|
389
|
+
this.checkCollection(signal);
|
|
390
|
+
this.bootstrap = new AppCpCloudCopyBootstrap(this.native, source, this.trust, this.outcome, { fetch: request, allowLoopbackHttp, ...(displayName === undefined ? {} : { displayName }) });
|
|
391
|
+
const metadata = await this.bootstrap.bootstrap(Object.freeze({ signal, ...(reconcile ? { reconcile } : {}) }));
|
|
392
|
+
this.checkCollection(signal);
|
|
393
|
+
this.bootstrapConfirmed = true;
|
|
394
|
+
return metadata;
|
|
395
|
+
}
|
|
396
|
+
catch (error) {
|
|
397
|
+
await this.close();
|
|
398
|
+
throw error;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
checkCollection(signal) {
|
|
402
|
+
this.check(signal);
|
|
403
|
+
if (this.collectionCurrent?.() !== true)
|
|
404
|
+
throw fail("fenced");
|
|
405
|
+
}
|
|
406
|
+
/** SQL is supplied only AFTER collection ownership and an internally
|
|
407
|
+
* confirmed protected completion. Native SAME-bundle adoption, not a fresh
|
|
408
|
+
* seed loan or caller root/genesis override. Verified read still required. */
|
|
409
|
+
adoptCloudCopy(options, sql) {
|
|
410
|
+
const signal = this.operationSignal(options.signal);
|
|
411
|
+
this.checkCollection(signal);
|
|
412
|
+
if (!this.bootstrap ||
|
|
413
|
+
!this.bootstrapConfirmed ||
|
|
414
|
+
this.adoptedEndpoint !== null)
|
|
415
|
+
throw fail("fenced");
|
|
416
|
+
const endpoint = options.endpoint;
|
|
417
|
+
// Preserve the exact original protected bootstrap signal internally;
|
|
418
|
+
// never require the app to retrieve or loan the host's private lifetime.
|
|
419
|
+
this.bootstrap.adoptCollection({ ...options, signal: this.collectionSignal }, sql);
|
|
420
|
+
this.checkCollection(signal);
|
|
421
|
+
this.adoptedEndpoint = endpoint;
|
|
422
|
+
}
|
|
423
|
+
/** Trusted immutable storage intake callback: actual OPFS adapter in this
|
|
424
|
+
* Worker, exact owned scope, no MemStore/reset/missing-existing fallback.
|
|
425
|
+
* Callback cannot run until protected completion; root/genesis stay internal. */
|
|
426
|
+
async openCollectionSql(options) {
|
|
427
|
+
const { replicaId, endpoint, openSql } = options;
|
|
428
|
+
const signal = this.operationSignal(options.signal);
|
|
429
|
+
this.checkCollection(signal);
|
|
430
|
+
if (!this.bootstrapConfirmed ||
|
|
431
|
+
!this.collectionScope ||
|
|
432
|
+
this.sqlAttempted ||
|
|
433
|
+
this.adoptedEndpoint !== null)
|
|
434
|
+
throw fail("binding");
|
|
435
|
+
if (uuidToBytes(replicaId).every((v) => v === 0) ||
|
|
436
|
+
(typeof endpoint !== "bigint" && !Number.isSafeInteger(endpoint)) ||
|
|
437
|
+
BigInt(endpoint) < 0n ||
|
|
438
|
+
BigInt(endpoint) > (1n << 64n) - 1n)
|
|
439
|
+
throw fail("binding");
|
|
440
|
+
this.sqlAttempted = true;
|
|
441
|
+
try {
|
|
442
|
+
const opened = await openSql.call(options, Object.freeze({ scope: this.collectionScope, signal }));
|
|
443
|
+
// Retain cleanup even if authority changed while the handle was opening.
|
|
444
|
+
const close = opened.close;
|
|
445
|
+
this.sqlClose = async () => {
|
|
446
|
+
await close.call(opened);
|
|
447
|
+
};
|
|
448
|
+
this.collectionSql = opened.sql;
|
|
449
|
+
this.checkCollection(signal);
|
|
450
|
+
if (options.openSql !== openSql)
|
|
451
|
+
throw fail("fenced");
|
|
452
|
+
this.adoptCloudCopy({
|
|
453
|
+
signal,
|
|
454
|
+
replicaId,
|
|
455
|
+
endpoint,
|
|
456
|
+
opened: opened.opened,
|
|
457
|
+
sqliteVersion: opened.sqliteVersion,
|
|
458
|
+
cloudCopyOptIn: true,
|
|
459
|
+
}, opened.sql);
|
|
460
|
+
}
|
|
461
|
+
catch (error) {
|
|
462
|
+
await this.close();
|
|
463
|
+
throw error;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
/** Actual original-device CP credential -> native signed token -> fixed log
|
|
467
|
+
* transport. Missing/offline credentials never become trusted defaults. */
|
|
468
|
+
async startCollectionLog(options) {
|
|
469
|
+
const { fetch: request, allowLoopbackHttp } = options;
|
|
470
|
+
const signal = this.operationSignal(options.signal);
|
|
471
|
+
this.checkCollection(signal);
|
|
472
|
+
if (!this.native ||
|
|
473
|
+
!this.collectionSession ||
|
|
474
|
+
this.adoptedEndpoint === null)
|
|
475
|
+
throw fail("binding");
|
|
476
|
+
const captured = request ?? globalThis.fetch, loopback = allowLoopbackHttp === true;
|
|
477
|
+
if (this.authority &&
|
|
478
|
+
(captured !== this.logRequest || loopback !== this.logLoopback))
|
|
479
|
+
throw fail("fenced");
|
|
480
|
+
if (this.pump)
|
|
481
|
+
return;
|
|
482
|
+
if (this.logWork) {
|
|
483
|
+
await this.logWork;
|
|
484
|
+
this.checkCollection(signal);
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
if (!this.authority) {
|
|
488
|
+
this.logRequest = captured;
|
|
489
|
+
this.logLoopback = loopback;
|
|
490
|
+
this.authority = new AppCpLogAuthority(this.native, Object.freeze({
|
|
491
|
+
...this.collectionSession,
|
|
492
|
+
endpoint: this.adoptedEndpoint,
|
|
493
|
+
directOrigins: Object.freeze([]),
|
|
494
|
+
}), { fetch: captured, allowLoopbackHttp, tokenCache: idbLogTokenCache() });
|
|
495
|
+
}
|
|
496
|
+
// An offline token mint is NOT identity loss: retain the SAME authority,
|
|
497
|
+
// SQL and original keys. A later explicit foreground call may retry it.
|
|
498
|
+
const authority = this.authority;
|
|
499
|
+
const work = (async () => {
|
|
500
|
+
await authority.accessToken(Object.freeze({ signal }));
|
|
501
|
+
this.checkCollection(signal);
|
|
502
|
+
this.pump = this.native.bindLogTransport(authority.logTransport());
|
|
503
|
+
})();
|
|
504
|
+
this.logWork = work;
|
|
505
|
+
try {
|
|
506
|
+
await work;
|
|
507
|
+
}
|
|
508
|
+
finally {
|
|
509
|
+
if (this.logWork === work)
|
|
510
|
+
this.logWork = null;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
/** Read-only metadata for this adopted collection. Uses the already pinned
|
|
514
|
+
* CP transport; no session, credential, key or readiness authority escapes.
|
|
515
|
+
* Compose with MdbasePeopleClient INSIDE the trusted owned Worker and send
|
|
516
|
+
* only public projections across its caller channel. */
|
|
517
|
+
peopleAuthority() {
|
|
518
|
+
this.checkCollection(this.lifetime);
|
|
519
|
+
if (!this.collectionSession || this.adoptedEndpoint === null || !this.logRequest)
|
|
520
|
+
throw fail("binding");
|
|
521
|
+
if (!this.peopleMetadata) {
|
|
522
|
+
const endpoint = this.adoptedEndpoint, session = this.collectionSession;
|
|
523
|
+
const authority = new AppCpPeopleAuthority(Object.freeze({
|
|
524
|
+
...session,
|
|
525
|
+
endpoint,
|
|
526
|
+
directOrigins: Object.freeze([]),
|
|
527
|
+
isCurrent: () => this.collectionCurrent?.() === true && this.adoptedEndpoint === endpoint,
|
|
528
|
+
connectorBearer: async ({ signal }) => {
|
|
529
|
+
signal.throwIfAborted();
|
|
530
|
+
this.checkCollection(this.lifetime);
|
|
531
|
+
// Custody admits ONLY the original owner lifetime; the
|
|
532
|
+
// metadata request's child signal controls its HTTP work.
|
|
533
|
+
const bearer = await session.connectorBearer({ signal: this.lifetime });
|
|
534
|
+
this.checkCollection(this.lifetime);
|
|
535
|
+
signal.throwIfAborted();
|
|
536
|
+
return bearer;
|
|
537
|
+
},
|
|
538
|
+
}), { fetch: this.logRequest, allowLoopbackHttp: this.logLoopback });
|
|
539
|
+
const view = Object.freeze({
|
|
540
|
+
collection: authority.collection,
|
|
541
|
+
isCurrent: () => authority.isCurrent(),
|
|
542
|
+
request: (resource, options) => authority.request(resource, options),
|
|
543
|
+
});
|
|
544
|
+
this.peopleMetadata = { authority, view };
|
|
545
|
+
}
|
|
546
|
+
return this.peopleMetadata.view;
|
|
547
|
+
}
|
|
548
|
+
/** SAME Worker host/scope/child lifetime. Only the original chosen receipt
|
|
549
|
+
* selects a fixed native CP receiver; no session or bearer leaves Worker. */
|
|
550
|
+
openTimersPort(options) {
|
|
551
|
+
this.checkCollection(this.lifetime);
|
|
552
|
+
if (!this.readVerified || !this.logRequest || !this.collectionScope || options.signal.aborted)
|
|
553
|
+
throw fail("binding");
|
|
554
|
+
const { scope, generation, signal } = options, original = this.collectionScope;
|
|
555
|
+
if (scope.account !== original.account || scope.installation !== original.installation || scope.collection !== original.collection || uuidToBytes(generation).every(value => value === 0))
|
|
556
|
+
throw fail("binding");
|
|
557
|
+
const callback = this.source.timerConsent, consent = callback?.call(this.source);
|
|
558
|
+
if (!consent?.approved)
|
|
559
|
+
return null;
|
|
560
|
+
const grant = consent.grants.find(reference => reference.collectionId === scope.collection);
|
|
561
|
+
if (!grant)
|
|
562
|
+
return null;
|
|
563
|
+
const WorkerScope = globalThis.WorkerGlobalScope;
|
|
564
|
+
if (typeof WorkerScope !== "function" || !(globalThis instanceof WorkerScope))
|
|
565
|
+
throw fail("binding");
|
|
566
|
+
if (uuidToBytes(grant.grantId).every(value => value === 0) || !/^[0-9a-f]{64}$/.test(grant.declarationDigest))
|
|
567
|
+
throw fail("binding");
|
|
568
|
+
const snapshot = JSON.stringify(consent), channel = new MessageChannel();
|
|
569
|
+
const isCurrent = () => {
|
|
570
|
+
try {
|
|
571
|
+
return !signal.aborted && options.signal === signal && options.scope === scope && options.generation === generation && this.collectionCurrent?.() === true && this.current()
|
|
572
|
+
&& scope.account === original.account && scope.installation === original.installation && scope.collection === original.collection
|
|
573
|
+
&& this.source.timerConsent === callback && JSON.stringify(callback?.call(this.source)) === snapshot;
|
|
574
|
+
}
|
|
575
|
+
catch {
|
|
576
|
+
return false;
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
const receiver = attachAppTimerReceiver(channel.port1, { scope: original, generation, grantId: grant.grantId, cpOrigin: new URL(this.selected.cpOrigin).origin,
|
|
580
|
+
signal, isCurrent, fetch: this.logRequest, ...(this.signIn ? { journal: {
|
|
581
|
+
read: () => this.signIn.originalTimerChannel(grant.grantId),
|
|
582
|
+
write: (value) => this.signIn.retainTimerChannel(grant.grantId, value),
|
|
583
|
+
} } : {}), bearer: async () => {
|
|
584
|
+
if (!isCurrent())
|
|
585
|
+
throw fail("fenced");
|
|
586
|
+
// Custody callback accepts ONLY original host lifetime. Child
|
|
587
|
+
// cancellation fences HTTP, never borrows/unlocks the actor.
|
|
588
|
+
const value = await this.bearerCallback.call(this.source, { signal: this.lifetime });
|
|
589
|
+
if (!isCurrent())
|
|
590
|
+
throw fail("fenced");
|
|
591
|
+
return value;
|
|
592
|
+
} });
|
|
593
|
+
this.timerPorts.add(receiver);
|
|
594
|
+
return Object.freeze({ port: channel.port2, close: async () => { await receiver.close(); channel.port2.close(); this.timerPorts.delete(receiver); } });
|
|
595
|
+
}
|
|
596
|
+
/** The live log's latest specific server refusal, or null. Display only. */
|
|
597
|
+
serverProblem() {
|
|
598
|
+
return this.pump?.serverProblem ?? null;
|
|
599
|
+
}
|
|
600
|
+
/** Typed health of the path to the log from the latest failed call, or
|
|
601
|
+
* null once a reply was accepted. Display and retry pacing only. */
|
|
602
|
+
transportHealth() {
|
|
603
|
+
return this.pump?.transportHealth ?? null;
|
|
604
|
+
}
|
|
605
|
+
/** What the replica still waits for before it holds everything up to the
|
|
606
|
+
* known log head, or null once it does (native sync status). */
|
|
607
|
+
initialSync() {
|
|
608
|
+
try {
|
|
609
|
+
if (!this.native)
|
|
610
|
+
return "unavailable";
|
|
611
|
+
return initialSyncWait(this.native.observations().status);
|
|
612
|
+
}
|
|
613
|
+
catch {
|
|
614
|
+
return "unavailable";
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
/** Diagnostics while waiting for a key (native sync status), else null. */
|
|
618
|
+
keyWaitDetail() {
|
|
619
|
+
try {
|
|
620
|
+
return this.native ? keyWaitDetail(this.native.observations().status) : null;
|
|
621
|
+
}
|
|
622
|
+
catch {
|
|
623
|
+
return null;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
/** Local writes not yet confirmed by the log (native sync status). */
|
|
627
|
+
pendingWrites() {
|
|
628
|
+
try {
|
|
629
|
+
return this.native?.observations().status.pending ?? 0;
|
|
630
|
+
}
|
|
631
|
+
catch {
|
|
632
|
+
return 0;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
/** Feed one push frame to the native replica (current log session only). */
|
|
636
|
+
pushLog(frame) {
|
|
637
|
+
try {
|
|
638
|
+
return this.native?.pushLog(frame) === true;
|
|
639
|
+
}
|
|
640
|
+
catch {
|
|
641
|
+
return false;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
/** The log's push socket for this collection, or null when the runtime cannot
|
|
645
|
+
* sign its `hello` (older native asset): then the caller wakes on events only.
|
|
646
|
+
* Requires the started log. The socket never carries requests. */
|
|
647
|
+
openLogPush(events) {
|
|
648
|
+
this.checkCollection(this.lifetime);
|
|
649
|
+
const native = this.native, authority = this.authority, session = this.collectionSession, request = this.logRequest;
|
|
650
|
+
if (!native || !this.pump || !authority || !session || !request)
|
|
651
|
+
throw fail("binding");
|
|
652
|
+
if (!native.supportsLogPush || typeof WebSocket !== "function")
|
|
653
|
+
return null;
|
|
654
|
+
const loopback = this.logLoopback, origin = authority.origin;
|
|
655
|
+
const current = () => {
|
|
656
|
+
try {
|
|
657
|
+
return this.collectionCurrent?.() === true && this.current() && this.authority === authority && authority.isCurrent();
|
|
658
|
+
}
|
|
659
|
+
catch {
|
|
660
|
+
return false;
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
return new AppLogPushChannel({
|
|
664
|
+
origin, collection: authority.collection, deviceId: session.deviceId, isCurrent: current,
|
|
665
|
+
accessToken: options => authority.accessToken(options),
|
|
666
|
+
invalidateToken: token => authority.invalidateToken(token),
|
|
667
|
+
nonce: async ({ signal }) => {
|
|
668
|
+
const r = await request(`${origin}/v1/nonce`, { signal, cache: "no-store", credentials: "omit", redirect: "error", referrerPolicy: "no-referrer" });
|
|
669
|
+
const text = (await r.text()).trim();
|
|
670
|
+
if (!r.ok || !/^[0-9a-f]{64}$/.test(text))
|
|
671
|
+
throw fail("unavailable");
|
|
672
|
+
return Uint8Array.from(text.match(/../g).map(v => parseInt(v, 16)));
|
|
673
|
+
},
|
|
674
|
+
signHello: (nonce, token) => current() ? native.signLogHello(nonce, token) : null,
|
|
675
|
+
}, events, { allowLoopbackHttp: loopback });
|
|
676
|
+
}
|
|
677
|
+
/** Ordinary foreground log drive. Quiet/head/ACK/status are NOT read/Saved. */
|
|
678
|
+
async driveCollection(options) {
|
|
679
|
+
const signal = this.operationSignal(options.signal);
|
|
680
|
+
this.checkCollection(signal);
|
|
681
|
+
if (!this.native || !this.pump || this.adoptedEndpoint === null)
|
|
682
|
+
throw fail("binding");
|
|
683
|
+
// A reply can leave work that only a tick advances (an answer to a
|
|
684
|
+
// pending app call, the next upload step). Keep turning while turns
|
|
685
|
+
// send log calls, so a chain of steps never waits for the next timer.
|
|
686
|
+
for (let turn = 0; turn < DRIVE_TURNS; turn++) {
|
|
687
|
+
const sent = this.pump.callsSent;
|
|
688
|
+
this.native.tick();
|
|
689
|
+
await this.pump.pump();
|
|
690
|
+
this.checkCollection(signal);
|
|
691
|
+
if (this.pump?.callsSent === sent)
|
|
692
|
+
break;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
/** Foreground head wake. The HTTP log has no push channel and the native core
|
|
696
|
+
* queues a head only on open, failure or reconnect, so without this a running
|
|
697
|
+
* session never learns another device's entries. Runs only after a quiet pump;
|
|
698
|
+
* the native side refuses while a head fetch is already in flight. */
|
|
699
|
+
async wakeCollectionLog(options) {
|
|
700
|
+
const signal = this.operationSignal(options.signal);
|
|
701
|
+
this.checkCollection(signal);
|
|
702
|
+
if (!this.native || !this.pump || this.adoptedEndpoint === null)
|
|
703
|
+
throw fail("binding");
|
|
704
|
+
this.native.tick();
|
|
705
|
+
if (!(await this.pump.pump()).quiet)
|
|
706
|
+
return;
|
|
707
|
+
this.checkCollection(signal);
|
|
708
|
+
// Head-only fetch over the current authenticated session: no token
|
|
709
|
+
// mint, reconnect, status flicker or readiness re-assessment.
|
|
710
|
+
if (!this.native.requestLogHead())
|
|
711
|
+
return;
|
|
712
|
+
await this.pump.pump();
|
|
713
|
+
this.checkCollection(signal);
|
|
714
|
+
this.native.tick();
|
|
715
|
+
}
|
|
716
|
+
/** READ-only admission through the actual typed native Query gate. While
|
|
717
|
+
* the log pump runs, the budget bounds inactivity, so a warm replica far
|
|
718
|
+
* behind can finish its catch-up turn; without a pump it is fixed.
|
|
719
|
+
* No status-based admission, write retry, key override or private grant. */
|
|
720
|
+
waitForVerifiedRead(options) {
|
|
721
|
+
const { timeoutMs = 15000, cold = false } = options;
|
|
722
|
+
const signal = this.operationSignal(options.signal);
|
|
723
|
+
this.checkCollection(signal);
|
|
724
|
+
if (!this.native ||
|
|
725
|
+
!this.collectionScope ||
|
|
726
|
+
this.adoptedEndpoint === null ||
|
|
727
|
+
!Number.isSafeInteger(timeoutMs) ||
|
|
728
|
+
timeoutMs < 1 ||
|
|
729
|
+
timeoutMs > 15000 ||
|
|
730
|
+
typeof cold !== "boolean" ||
|
|
731
|
+
(cold && !this.pump))
|
|
732
|
+
throw fail("binding");
|
|
733
|
+
if (this.readWork)
|
|
734
|
+
return this.readWork.then(() => {
|
|
735
|
+
this.checkCollection(signal);
|
|
736
|
+
});
|
|
737
|
+
const work = this.verifyRead(signal, timeoutMs, cold, options.onProgress);
|
|
738
|
+
this.readWork = work;
|
|
739
|
+
void work
|
|
740
|
+
.finally(() => {
|
|
741
|
+
if (this.readWork === work)
|
|
742
|
+
this.readWork = null;
|
|
743
|
+
})
|
|
744
|
+
.catch(() => { });
|
|
745
|
+
return work;
|
|
746
|
+
}
|
|
747
|
+
async verifyRead(signal, timeoutMs, cold, onProgress) {
|
|
748
|
+
const ctrl = new AbortController(), abort = () => ctrl.abort();
|
|
749
|
+
this.readAbort = ctrl;
|
|
750
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
751
|
+
let timer = null;
|
|
752
|
+
let stopError = fail(cold ? "sync_stalled" : "unavailable");
|
|
753
|
+
let rejectAbort;
|
|
754
|
+
const aborted = new Promise((_resolve, reject) => {
|
|
755
|
+
rejectAbort = () => reject(stopError);
|
|
756
|
+
ctrl.signal.addEventListener("abort", rejectAbort, { once: true });
|
|
757
|
+
});
|
|
758
|
+
void aborted.catch(() => { });
|
|
759
|
+
let shown = null;
|
|
760
|
+
const report = (stage) => {
|
|
761
|
+
if (stage === shown)
|
|
762
|
+
return;
|
|
763
|
+
shown = stage;
|
|
764
|
+
try {
|
|
765
|
+
onProgress?.(stage);
|
|
766
|
+
}
|
|
767
|
+
catch { /* display observers do not own READ admission */ }
|
|
768
|
+
};
|
|
769
|
+
const observe = () => {
|
|
770
|
+
this.checkCollection(signal);
|
|
771
|
+
const refusal = cold ? this.pump.terminalProblem : null;
|
|
772
|
+
if (isAppServerProblem(refusal))
|
|
773
|
+
throw new AppHttpLogError(appServerOutcome(refusal) ?? "unavailable", refusal);
|
|
774
|
+
const observation = this.native.observations();
|
|
775
|
+
if (observation.requiresReopen || observation.keyringRebuildFailed)
|
|
776
|
+
throw fail("recovery_required");
|
|
777
|
+
const wait = initialSyncWait(observation.status);
|
|
778
|
+
report(wait === "installing" ? "loading_snapshot" : wait === "waiting_for_key" ? "waiting_for_key" : wait === "behind" ? "replaying" : wait === null ? "verifying_read" : "syncing");
|
|
779
|
+
return observation;
|
|
780
|
+
};
|
|
781
|
+
this.readVerified = false;
|
|
782
|
+
try {
|
|
783
|
+
if (this.pump) {
|
|
784
|
+
// Only native accepted prefix/READ-cursor/snapshot positions count.
|
|
785
|
+
// Requests sent, accepted heartbeats, head growth and status
|
|
786
|
+
// flicker cannot keep a stuck replica alive. Observe DURING a
|
|
787
|
+
// multi-RPC pump, not only after all its rounds have returned.
|
|
788
|
+
const progress = () => {
|
|
789
|
+
const observation = observe();
|
|
790
|
+
return [observation.status.confirmedThrough, observation.status.installing?.done ?? 0,
|
|
791
|
+
observation.status.installing?.total ?? 0, this.pump.readProgress];
|
|
792
|
+
};
|
|
793
|
+
let high = progress(), lastProgress = Date.now();
|
|
794
|
+
const bodies = new Map();
|
|
795
|
+
let deferred = null;
|
|
796
|
+
const watch = () => {
|
|
797
|
+
try {
|
|
798
|
+
const now = Date.now(), next = progress();
|
|
799
|
+
if (next.some((value, i) => value > high[i])) {
|
|
800
|
+
lastProgress = now;
|
|
801
|
+
deferred = null;
|
|
802
|
+
}
|
|
803
|
+
high = next.map((value, i) => Math.max(value, high[i]));
|
|
804
|
+
const active = this.pump.responseProgress();
|
|
805
|
+
const ids = new Set(active.map(body => body.id));
|
|
806
|
+
for (const id of bodies.keys())
|
|
807
|
+
if (!ids.has(id))
|
|
808
|
+
bodies.delete(id);
|
|
809
|
+
for (const body of active) {
|
|
810
|
+
const prior = bodies.get(body.id);
|
|
811
|
+
if (body.bytes > (prior?.bytes ?? 0))
|
|
812
|
+
bodies.set(body.id, { bytes: body.bytes, at: now });
|
|
813
|
+
}
|
|
814
|
+
let left = timeoutMs - (now - lastProgress);
|
|
815
|
+
if (left <= 0) {
|
|
816
|
+
// An HTTP body can start later than the sync clock,
|
|
817
|
+
// or use a longer bounded object-transfer deadline.
|
|
818
|
+
// Let CURRENT streaming calls finish, not successive
|
|
819
|
+
// retries/invalid replies. Only native progress can
|
|
820
|
+
// authorize another cohort. Bytes never grant READ.
|
|
821
|
+
deferred ??= new Set(bodies.keys());
|
|
822
|
+
left = Math.max(0, ...[...deferred].map(id => {
|
|
823
|
+
const body = bodies.get(id);
|
|
824
|
+
return body ? timeoutMs - (now - body.at) : 0;
|
|
825
|
+
}));
|
|
826
|
+
}
|
|
827
|
+
if (left <= 0)
|
|
828
|
+
abort();
|
|
829
|
+
else
|
|
830
|
+
timer = setTimeout(watch, Math.min(250, left));
|
|
831
|
+
}
|
|
832
|
+
catch (error) {
|
|
833
|
+
stopError = error;
|
|
834
|
+
abort();
|
|
835
|
+
}
|
|
836
|
+
};
|
|
837
|
+
timer = setTimeout(watch, Math.min(250, timeoutMs));
|
|
838
|
+
}
|
|
839
|
+
else
|
|
840
|
+
timer = setTimeout(abort, timeoutMs);
|
|
841
|
+
this.readClient = await Promise.race([
|
|
842
|
+
MdbaseClient.connect({
|
|
843
|
+
app: { name: "app-local-read-gate", version: "1" },
|
|
844
|
+
connector: inProcessConnector(this.native, {
|
|
845
|
+
collection: this.collectionScope.collection,
|
|
846
|
+
}),
|
|
847
|
+
reconnect: false,
|
|
848
|
+
signal: ctrl.signal,
|
|
849
|
+
}).then(client => {
|
|
850
|
+
// A connect that ignored cancellation still belongs to this
|
|
851
|
+
// probe, never to a later open or a data facade.
|
|
852
|
+
if (ctrl.signal.aborted) {
|
|
853
|
+
client.close();
|
|
854
|
+
throw fail("unavailable");
|
|
855
|
+
}
|
|
856
|
+
return client;
|
|
857
|
+
}),
|
|
858
|
+
aborted,
|
|
859
|
+
]);
|
|
860
|
+
this.checkCollection(signal);
|
|
861
|
+
let delay = 250;
|
|
862
|
+
while (!ctrl.signal.aborted) {
|
|
863
|
+
this.native.tick();
|
|
864
|
+
if (this.pump)
|
|
865
|
+
await Promise.race([this.pump.pump(), aborted]);
|
|
866
|
+
this.checkCollection(signal);
|
|
867
|
+
const observation = observe();
|
|
868
|
+
// Cold catch-up owns its progress clock until the complete
|
|
869
|
+
// known prefix is applied. Still require the actual native Query
|
|
870
|
+
// before any data facade; sync metadata never grants READ.
|
|
871
|
+
if (cold && initialSyncWait(observation.status) !== null) {
|
|
872
|
+
await waitForOpenRetry(delay, ctrl.signal);
|
|
873
|
+
delay = Math.min(1_000, delay * 2);
|
|
874
|
+
continue;
|
|
875
|
+
}
|
|
876
|
+
try {
|
|
877
|
+
await Promise.race([
|
|
878
|
+
this.readClient.query({ limit: 1 }, undefined, ctrl.signal),
|
|
879
|
+
aborted,
|
|
880
|
+
]);
|
|
881
|
+
this.checkCollection(signal);
|
|
882
|
+
if (ctrl.signal.aborted)
|
|
883
|
+
throw fail("unavailable");
|
|
884
|
+
this.readVerified = true;
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
887
|
+
catch (error) {
|
|
888
|
+
this.checkCollection(signal);
|
|
889
|
+
if (!(error instanceof MdbaseError) ||
|
|
890
|
+
error.code !== "unavailable" ||
|
|
891
|
+
!this.pump ||
|
|
892
|
+
ctrl.signal.aborted)
|
|
893
|
+
throw error;
|
|
894
|
+
}
|
|
895
|
+
// Only a genuine typed READ-unavailable can reach this wait.
|
|
896
|
+
// Quiet native turns do not imply the remote key/prefix can
|
|
897
|
+
// arrive synchronously. Keep ONE client and the warm deadline
|
|
898
|
+
// or cold inactivity budget; never replay bootstrap/setup/write.
|
|
899
|
+
await waitForOpenRetry(delay, ctrl.signal);
|
|
900
|
+
delay = Math.min(1_000, delay * 2);
|
|
901
|
+
}
|
|
902
|
+
throw fail("unavailable");
|
|
903
|
+
}
|
|
904
|
+
catch (error) {
|
|
905
|
+
this.checkCollection(signal);
|
|
906
|
+
if (ctrl.signal.aborted)
|
|
907
|
+
throw stopError;
|
|
908
|
+
throw error;
|
|
909
|
+
}
|
|
910
|
+
finally {
|
|
911
|
+
if (timer !== null)
|
|
912
|
+
clearTimeout(timer);
|
|
913
|
+
signal.removeEventListener("abort", abort);
|
|
914
|
+
ctrl.signal.removeEventListener("abort", rejectAbort);
|
|
915
|
+
this.readClient?.close();
|
|
916
|
+
this.readClient = null;
|
|
917
|
+
this.readAbort = null;
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
/** A data-only Worker port per attached tab, only after a genuine native typed read passed.
|
|
921
|
+
* Every subsequent frame remains gated by native trust/applied/key/read.
|
|
922
|
+
* Host controls, SQL/custody/log tokens and owner unlock are never RPCs. */
|
|
923
|
+
/** Called when an app call may have queued log work (a write or file
|
|
924
|
+
* transfer), so the collection drive runs now rather than on its timer. */
|
|
925
|
+
onLogWork(listener) {
|
|
926
|
+
this.logWorkListener = listener;
|
|
927
|
+
}
|
|
928
|
+
attachDataFacade(channel) {
|
|
929
|
+
this.checkCollection(this.lifetime);
|
|
930
|
+
if (!this.native ||
|
|
931
|
+
!this.collectionScope ||
|
|
932
|
+
!this.readVerified ||
|
|
933
|
+
this.facades.size >= MAX_FACADES ||
|
|
934
|
+
this.facades.has(channel))
|
|
935
|
+
throw fail("fenced");
|
|
936
|
+
const scope = Object.freeze({
|
|
937
|
+
...this.collectionScope,
|
|
938
|
+
isCurrent: () => {
|
|
939
|
+
try {
|
|
940
|
+
this.checkCollection(this.lifetime);
|
|
941
|
+
return true;
|
|
942
|
+
}
|
|
943
|
+
catch {
|
|
944
|
+
return false;
|
|
945
|
+
}
|
|
946
|
+
},
|
|
947
|
+
});
|
|
948
|
+
const facade = attachAppLocalFacade(this.native, channel, scope, () => this.logWorkListener?.());
|
|
949
|
+
this.facades.set(channel, facade);
|
|
950
|
+
return facade.resourceSetup;
|
|
951
|
+
}
|
|
952
|
+
/** Close one tab's data facade (that tab left); the replica stays open. */
|
|
953
|
+
detachDataFacade(channel) {
|
|
954
|
+
const facade = this.facades.get(channel);
|
|
955
|
+
if (!facade)
|
|
956
|
+
return;
|
|
957
|
+
this.facades.delete(channel);
|
|
958
|
+
facade.close();
|
|
959
|
+
}
|
|
960
|
+
/** Public tuple copy only; no key loans and no readiness claim. */
|
|
961
|
+
registeredReceipt() {
|
|
962
|
+
this.check(this.lifetime);
|
|
963
|
+
const r = this.publicReceipt;
|
|
964
|
+
if (!r)
|
|
965
|
+
throw fail("fenced");
|
|
966
|
+
return Object.freeze({
|
|
967
|
+
...r,
|
|
968
|
+
signPublicKey: new Uint8Array(r.signPublicKey),
|
|
969
|
+
kemPublicKey: new Uint8Array(r.kemPublicKey),
|
|
970
|
+
noisePublicKey: new Uint8Array(r.noisePublicKey),
|
|
971
|
+
});
|
|
972
|
+
}
|
|
973
|
+
close() {
|
|
974
|
+
this.closing = true;
|
|
975
|
+
this.readVerified = false;
|
|
976
|
+
this.readAbort?.abort();
|
|
977
|
+
if (this.closeResult)
|
|
978
|
+
return this.closeResult;
|
|
979
|
+
let fenceFailed = false;
|
|
980
|
+
for (const close of [
|
|
981
|
+
() => this.readClient?.close(),
|
|
982
|
+
() => { for (const facade of this.facades.values())
|
|
983
|
+
facade.close(); this.facades.clear(); },
|
|
984
|
+
() => this.peopleMetadata?.authority.close(),
|
|
985
|
+
() => this.bootstrap?.close(),
|
|
986
|
+
() => this.outcome?.close(),
|
|
987
|
+
]) {
|
|
988
|
+
try {
|
|
989
|
+
close();
|
|
990
|
+
}
|
|
991
|
+
catch {
|
|
992
|
+
fenceFailed = true;
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
return (this.closeResult ??= (async () => {
|
|
996
|
+
try {
|
|
997
|
+
// Drain exact timer HTTP/IPC before native/SQL/lease shutdown.
|
|
998
|
+
await Promise.all([...this.timerPorts].map(async (port) => { try {
|
|
999
|
+
await port.close();
|
|
1000
|
+
}
|
|
1001
|
+
catch {
|
|
1002
|
+
fenceFailed = true;
|
|
1003
|
+
} }));
|
|
1004
|
+
this.timerPorts.clear();
|
|
1005
|
+
const clean = await this.native?.close();
|
|
1006
|
+
if (this.collectionSql && clean !== true)
|
|
1007
|
+
this.collectionSql.fence();
|
|
1008
|
+
this.authority?.close();
|
|
1009
|
+
await this.sqlClose?.();
|
|
1010
|
+
if (fenceFailed)
|
|
1011
|
+
throw fail("unavailable");
|
|
1012
|
+
}
|
|
1013
|
+
finally {
|
|
1014
|
+
this.key = null;
|
|
1015
|
+
this.noise = null;
|
|
1016
|
+
this.originalCustody?.envelope.fill(0);
|
|
1017
|
+
this.originalCustody = null;
|
|
1018
|
+
this.signIn = null;
|
|
1019
|
+
this.publicReceipt = null;
|
|
1020
|
+
this.outcomeStore?.close();
|
|
1021
|
+
this.noiseStore?.close();
|
|
1022
|
+
this.keys?.close();
|
|
1023
|
+
this.provider?.close();
|
|
1024
|
+
}
|
|
1025
|
+
})());
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
//# sourceMappingURL=cloud-copy-host.js.map
|