@dxos/echo-db 2.33.5-dev.ea3876ba → 2.33.5-dev.fee8f5fe
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/api/index.d.ts +0 -5
- package/dist/src/api/index.d.ts.map +1 -1
- package/dist/src/api/index.js +5 -6
- package/dist/src/api/index.js.map +1 -1
- package/dist/src/api/schema.test.js +1 -1
- package/dist/src/api/schema.test.js.map +1 -1
- package/dist/src/echo.d.ts +1 -0
- package/dist/src/echo.d.ts.map +1 -1
- package/dist/src/echo.js +10 -21
- package/dist/src/echo.js.map +1 -1
- package/dist/src/echo.test.js +12 -4
- package/dist/src/echo.test.js.map +1 -1
- package/dist/src/halo/contact-manager.d.ts +2 -1
- package/dist/src/halo/contact-manager.d.ts.map +1 -1
- package/dist/src/halo/contact-manager.js +1 -1
- package/dist/src/halo/contact-manager.js.map +1 -1
- package/dist/src/halo/halo-factory.d.ts +4 -4
- package/dist/src/halo/halo-factory.d.ts.map +1 -1
- package/dist/src/halo/halo-factory.js +8 -13
- package/dist/src/halo/halo-factory.js.map +1 -1
- package/dist/src/halo/halo-party.d.ts +5 -4
- package/dist/src/halo/halo-party.d.ts.map +1 -1
- package/dist/src/halo/halo-party.js +16 -10
- package/dist/src/halo/halo-party.js.map +1 -1
- package/dist/src/halo/halo.d.ts +2 -2
- package/dist/src/halo/halo.d.ts.map +1 -1
- package/dist/src/halo/halo.test.js +4 -3
- package/dist/src/halo/halo.test.js.map +1 -1
- package/dist/src/halo/identity.js +2 -2
- package/dist/src/halo/identity.js.map +1 -1
- package/dist/src/halo/index.js +5 -1
- package/dist/src/halo/index.js.map +1 -1
- package/dist/src/halo/party-opener.d.ts +1 -1
- package/dist/src/halo/party-opener.d.ts.map +1 -1
- package/dist/src/halo/party-opener.js +5 -3
- package/dist/src/halo/party-opener.js.map +1 -1
- package/dist/src/halo/preferences.d.ts +1 -1
- package/dist/src/halo/preferences.d.ts.map +1 -1
- package/dist/src/halo/preferences.js +8 -11
- package/dist/src/halo/preferences.js.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +7 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/invitations/greeting-initiator.d.ts +4 -5
- package/dist/src/invitations/greeting-initiator.d.ts.map +1 -1
- package/dist/src/invitations/greeting-initiator.js +4 -4
- package/dist/src/invitations/greeting-initiator.js.map +1 -1
- package/dist/src/invitations/greeting-protocol-provider.d.ts.map +1 -1
- package/dist/src/invitations/greeting-protocol-provider.js +5 -9
- package/dist/src/invitations/greeting-protocol-provider.js.map +1 -1
- package/dist/src/invitations/greeting-responder.d.ts +6 -4
- package/dist/src/invitations/greeting-responder.d.ts.map +1 -1
- package/dist/src/invitations/greeting-responder.js +11 -14
- package/dist/src/invitations/greeting-responder.js.map +1 -1
- package/dist/src/invitations/halo-recovery-initiator.d.ts +1 -1
- package/dist/src/invitations/halo-recovery-initiator.d.ts.map +1 -1
- package/dist/src/invitations/halo-recovery-initiator.js +2 -2
- package/dist/src/invitations/halo-recovery-initiator.js.map +1 -1
- package/dist/src/invitations/index.js +5 -1
- package/dist/src/invitations/index.js.map +1 -1
- package/dist/src/invitations/invitation-descriptor.js +6 -2
- package/dist/src/invitations/invitation-descriptor.js.map +1 -1
- package/dist/src/invitations/invitation-factory.d.ts +5 -2
- package/dist/src/invitations/invitation-factory.d.ts.map +1 -1
- package/dist/src/invitations/invitation-factory.js +4 -3
- package/dist/src/invitations/invitation-factory.js.map +1 -1
- package/dist/src/invitations/offline-invitation-claimer.d.ts.map +1 -1
- package/dist/src/invitations/offline-invitation-claimer.js +7 -9
- package/dist/src/invitations/offline-invitation-claimer.js.map +1 -1
- package/dist/src/{database → packlets/database}/data-mirror.d.ts +0 -0
- package/dist/src/packlets/database/data-mirror.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/data-mirror.js +0 -0
- package/dist/src/packlets/database/data-mirror.js.map +1 -0
- package/dist/src/{database → packlets/database}/data-mirror.test.d.ts +0 -0
- package/dist/src/packlets/database/data-mirror.test.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/data-mirror.test.js +2 -2
- package/dist/src/packlets/database/data-mirror.test.js.map +1 -0
- package/dist/src/{database → packlets/database}/data-service-host.d.ts +0 -0
- package/dist/src/packlets/database/data-service-host.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/data-service-host.js +4 -3
- package/dist/src/packlets/database/data-service-host.js.map +1 -0
- package/dist/src/{database → packlets/database}/data-service-router.d.ts +0 -0
- package/dist/src/packlets/database/data-service-router.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/data-service-router.js +0 -0
- package/dist/src/packlets/database/data-service-router.js.map +1 -0
- package/dist/src/{database → packlets/database}/database-backend.d.ts +4 -5
- package/dist/src/packlets/database/database-backend.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/database-backend.js +5 -6
- package/dist/src/packlets/database/database-backend.js.map +1 -0
- package/dist/src/{api → packlets/database}/database.d.ts +2 -1
- package/dist/src/packlets/database/database.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/database.js +2 -2
- package/dist/src/packlets/database/database.js.map +1 -0
- package/dist/src/{api → packlets/database}/database.test.d.ts +0 -0
- package/dist/src/packlets/database/database.test.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/database.test.js +3 -3
- package/dist/src/packlets/database/database.test.js.map +1 -0
- package/dist/src/{api → packlets/database}/entity.d.ts +1 -1
- package/dist/src/packlets/database/entity.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/entity.js +0 -0
- package/dist/src/packlets/database/entity.js.map +1 -0
- package/dist/src/{database → packlets/database}/index.d.ts +5 -0
- package/dist/src/packlets/database/index.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/index.js +10 -1
- package/dist/src/packlets/database/index.js.map +1 -0
- package/dist/src/{database → packlets/database}/item-demuxer.d.ts +5 -4
- package/dist/src/packlets/database/item-demuxer.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/item-demuxer.js +5 -8
- package/dist/src/packlets/database/item-demuxer.js.map +1 -0
- package/dist/src/{database → packlets/database}/item-demuxer.test.d.ts +0 -0
- package/dist/src/packlets/database/item-demuxer.test.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/item-demuxer.test.js +15 -11
- package/dist/src/packlets/database/item-demuxer.test.js.map +1 -0
- package/dist/src/{database → packlets/database}/item-manager.d.ts +3 -1
- package/dist/src/packlets/database/item-manager.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/item-manager.js +13 -12
- package/dist/src/packlets/database/item-manager.js.map +1 -0
- package/dist/src/{database → packlets/database}/item-manager.test.d.ts +0 -0
- package/dist/src/packlets/database/item-manager.test.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/item-manager.test.js +0 -0
- package/dist/src/packlets/database/item-manager.test.js.map +1 -0
- package/dist/src/{api → packlets/database}/item.d.ts +1 -1
- package/dist/src/packlets/database/item.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/item.js +0 -0
- package/dist/src/packlets/database/item.js.map +1 -0
- package/dist/src/{api → packlets/database}/link.d.ts +1 -1
- package/dist/src/packlets/database/link.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/link.js +0 -0
- package/dist/src/packlets/database/link.js.map +1 -0
- package/dist/src/{api → packlets/database}/selection/index.d.ts +0 -0
- package/dist/src/packlets/database/selection/index.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/selection/index.js +5 -1
- package/dist/src/packlets/database/selection/index.js.map +1 -0
- package/dist/src/{api → packlets/database}/selection/queries.d.ts +0 -0
- package/dist/src/packlets/database/selection/queries.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/selection/queries.js +13 -17
- package/dist/src/packlets/database/selection/queries.js.map +1 -0
- package/dist/src/{api → packlets/database}/selection/result.d.ts +0 -0
- package/dist/src/packlets/database/selection/result.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/selection/result.js +0 -0
- package/dist/src/packlets/database/selection/result.js.map +1 -0
- package/dist/src/{api → packlets/database}/selection/selection.d.ts +0 -0
- package/dist/src/packlets/database/selection/selection.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/selection/selection.js +1 -3
- package/dist/src/packlets/database/selection/selection.js.map +1 -0
- package/dist/src/{api → packlets/database}/selection/selection.test.d.ts +0 -0
- package/dist/src/packlets/database/selection/selection.test.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/selection/selection.test.js +4 -12
- package/dist/src/packlets/database/selection/selection.test.js.map +1 -0
- package/dist/src/{api → packlets/database}/selection/util.d.ts +0 -0
- package/dist/src/packlets/database/selection/util.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/selection/util.js +0 -0
- package/dist/src/packlets/database/selection/util.js.map +1 -0
- package/dist/src/{database → packlets/database}/testing.d.ts +1 -1
- package/dist/src/packlets/database/testing.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/testing.js +5 -6
- package/dist/src/packlets/database/testing.js.map +1 -0
- package/dist/src/{database → packlets/database}/timeframe-clock.d.ts +1 -0
- package/dist/src/packlets/database/timeframe-clock.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/timeframe-clock.js +3 -0
- package/dist/src/packlets/database/timeframe-clock.js.map +1 -0
- package/dist/src/{errors.d.ts → packlets/errors/index.d.ts} +1 -1
- package/dist/src/packlets/errors/index.d.ts.map +1 -0
- package/dist/src/{errors.js → packlets/errors/index.js} +1 -1
- package/dist/src/packlets/errors/index.js.map +1 -0
- package/dist/src/parties/data-party.d.ts +14 -10
- package/dist/src/parties/data-party.d.ts.map +1 -1
- package/dist/src/parties/data-party.js +39 -15
- package/dist/src/parties/data-party.js.map +1 -1
- package/dist/src/parties/data-party.test.js +42 -22
- package/dist/src/parties/data-party.test.js.map +1 -1
- package/dist/src/parties/index.js +5 -1
- package/dist/src/parties/index.js.map +1 -1
- package/dist/src/parties/party-factory.d.ts +5 -10
- package/dist/src/parties/party-factory.d.ts.map +1 -1
- package/dist/src/parties/party-factory.js +30 -54
- package/dist/src/parties/party-factory.js.map +1 -1
- package/dist/src/parties/party-manager.d.ts +3 -4
- package/dist/src/parties/party-manager.d.ts.map +1 -1
- package/dist/src/parties/party-manager.js +9 -7
- package/dist/src/parties/party-manager.js.map +1 -1
- package/dist/src/parties/party-manager.test.js +16 -15
- package/dist/src/parties/party-manager.test.js.map +1 -1
- package/dist/src/pipeline/{pipeline.d.ts → feed-muxer.d.ts} +10 -15
- package/dist/src/pipeline/feed-muxer.d.ts.map +1 -0
- package/dist/src/pipeline/{pipeline.js → feed-muxer.js} +34 -44
- package/dist/src/pipeline/feed-muxer.js.map +1 -0
- package/dist/src/pipeline/feed-muxer.test.d.ts +2 -0
- package/dist/src/pipeline/feed-muxer.test.d.ts.map +1 -0
- package/dist/src/pipeline/{pipeline.test.js → feed-muxer.test.js} +20 -18
- package/dist/src/pipeline/feed-muxer.test.js.map +1 -0
- package/dist/src/pipeline/index.d.ts +2 -2
- package/dist/src/pipeline/index.d.ts.map +1 -1
- package/dist/src/pipeline/index.js +7 -3
- package/dist/src/pipeline/index.js.map +1 -1
- package/dist/src/pipeline/message-selector.d.ts +3 -3
- package/dist/src/pipeline/message-selector.d.ts.map +1 -1
- package/dist/src/pipeline/message-selector.js +30 -29
- package/dist/src/pipeline/message-selector.js.map +1 -1
- package/dist/src/pipeline/metadata-store.d.ts +5 -4
- package/dist/src/pipeline/metadata-store.d.ts.map +1 -1
- package/dist/src/pipeline/metadata-store.js +11 -5
- package/dist/src/pipeline/metadata-store.js.map +1 -1
- package/dist/src/pipeline/metadata-store.test.js +8 -4
- package/dist/src/pipeline/metadata-store.test.js.map +1 -1
- package/dist/src/pipeline/party-feed-provider.d.ts +2 -3
- package/dist/src/pipeline/party-feed-provider.d.ts.map +1 -1
- package/dist/src/pipeline/party-feed-provider.js +2 -17
- package/dist/src/pipeline/party-feed-provider.js.map +1 -1
- package/dist/src/pipeline/{party-core.d.ts → party-pipeline.d.ts} +26 -11
- package/dist/src/pipeline/party-pipeline.d.ts.map +1 -0
- package/dist/src/pipeline/{party-core.js → party-pipeline.js} +32 -31
- package/dist/src/pipeline/party-pipeline.js.map +1 -0
- package/dist/src/pipeline/party-pipeline.test.d.ts +2 -0
- package/dist/src/pipeline/party-pipeline.test.d.ts.map +1 -0
- package/dist/src/pipeline/{party-core.test.js → party-pipeline.test.js} +64 -46
- package/dist/src/pipeline/party-pipeline.test.js.map +1 -0
- package/dist/src/pipeline/party-processor.d.ts +21 -9
- package/dist/src/pipeline/party-processor.d.ts.map +1 -1
- package/dist/src/pipeline/party-processor.js +0 -8
- package/dist/src/pipeline/party-processor.js.map +1 -1
- package/dist/src/protocol/auth-plugin.d.ts +1 -1
- package/dist/src/protocol/auth-plugin.d.ts.map +1 -1
- package/dist/src/protocol/auth-plugin.js +1 -3
- package/dist/src/protocol/auth-plugin.js.map +1 -1
- package/dist/src/protocol/authenticator.d.ts +4 -4
- package/dist/src/protocol/authenticator.d.ts.map +1 -1
- package/dist/src/protocol/authenticator.js +12 -16
- package/dist/src/protocol/authenticator.js.map +1 -1
- package/dist/src/protocol/authenticator.test.js +1 -4
- package/dist/src/protocol/authenticator.test.js.map +1 -1
- package/dist/src/protocol/halo-recovery-plugin.d.ts +1 -1
- package/dist/src/protocol/halo-recovery-plugin.d.ts.map +1 -1
- package/dist/src/protocol/halo-recovery-plugin.js +1 -3
- package/dist/src/protocol/halo-recovery-plugin.js.map +1 -1
- package/dist/src/protocol/identity-credentials.d.ts +2 -2
- package/dist/src/protocol/identity-credentials.d.ts.map +1 -1
- package/dist/src/protocol/identity-credentials.js +4 -4
- package/dist/src/protocol/identity-credentials.js.map +1 -1
- package/dist/src/protocol/index.js +5 -1
- package/dist/src/protocol/index.js.map +1 -1
- package/dist/src/protocol/offline-invitation-plugin.d.ts +1 -1
- package/dist/src/protocol/offline-invitation-plugin.d.ts.map +1 -1
- package/dist/src/protocol/offline-invitation-plugin.js +1 -3
- package/dist/src/protocol/offline-invitation-plugin.js.map +1 -1
- package/dist/src/protocol/party-protocol-factory.d.ts +1 -14
- package/dist/src/protocol/party-protocol-factory.d.ts.map +1 -1
- package/dist/src/protocol/party-protocol-factory.js +2 -55
- package/dist/src/protocol/party-protocol-factory.js.map +1 -1
- package/dist/src/protocol/replicator-plugin.d.ts +7 -0
- package/dist/src/protocol/replicator-plugin.d.ts.map +1 -0
- package/dist/src/protocol/replicator-plugin.js +36 -0
- package/dist/src/protocol/replicator-plugin.js.map +1 -0
- package/dist/src/snapshots/index.js +5 -1
- package/dist/src/snapshots/index.js.map +1 -1
- package/dist/src/snapshots/snapshot-generator.d.ts +3 -3
- package/dist/src/snapshots/snapshot-generator.d.ts.map +1 -1
- package/dist/src/snapshots/snapshot-generator.js +13 -15
- package/dist/src/snapshots/snapshot-generator.js.map +1 -1
- package/dist/src/snapshots/snapshot-store.d.ts +3 -3
- package/dist/src/snapshots/snapshot-store.d.ts.map +1 -1
- package/dist/src/snapshots/snapshot-store.js +5 -5
- package/dist/src/snapshots/snapshot-store.js.map +1 -1
- package/dist/src/snapshots/snapshot-store.test.js +1 -1
- package/dist/src/snapshots/snapshot-store.test.js.map +1 -1
- package/dist/src/snapshots/snapshot.test.js +1 -1
- package/dist/src/snapshots/snapshot.test.js.map +1 -1
- package/dist/src/testing/benchmark.test.d.ts +2 -0
- package/dist/src/testing/benchmark.test.d.ts.map +1 -0
- package/dist/src/testing/benchmark.test.js +25 -0
- package/dist/src/testing/benchmark.test.js.map +1 -0
- package/dist/src/testing/index.js +5 -1
- package/dist/src/testing/index.js.map +1 -1
- package/dist/src/testing/testing-factories.d.ts +1 -1
- package/dist/src/testing/testing-factories.d.ts.map +1 -1
- package/dist/src/testing/testing-factories.js +2 -2
- package/dist/src/testing/testing-factories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +19 -19
- package/src/api/index.ts +0 -5
- package/src/api/schema.test.ts +1 -2
- package/src/echo.test.ts +16 -5
- package/src/echo.ts +11 -20
- package/src/halo/contact-manager.ts +3 -2
- package/src/halo/halo-factory.ts +11 -23
- package/src/halo/halo-party.ts +22 -14
- package/src/halo/halo.test.ts +4 -3
- package/src/halo/halo.ts +2 -2
- package/src/halo/identity.ts +2 -2
- package/src/halo/party-opener.ts +5 -3
- package/src/halo/preferences.ts +10 -12
- package/src/index.ts +3 -2
- package/src/invitations/greeting-initiator.ts +10 -9
- package/src/invitations/greeting-protocol-provider.ts +5 -9
- package/src/invitations/greeting-responder.ts +15 -17
- package/src/invitations/halo-recovery-initiator.ts +4 -4
- package/src/invitations/invitation-descriptor.ts +1 -1
- package/src/invitations/invitation-factory.ts +8 -5
- package/src/invitations/offline-invitation-claimer.ts +8 -10
- package/src/{database → packlets/database}/data-mirror.test.ts +3 -3
- package/src/{database → packlets/database}/data-mirror.ts +1 -1
- package/src/{database → packlets/database}/data-service-host.ts +2 -1
- package/src/{database → packlets/database}/data-service-router.ts +0 -0
- package/src/{database → packlets/database}/database-backend.ts +7 -6
- package/src/{api → packlets/database}/database.test.ts +2 -1
- package/src/{api → packlets/database}/database.ts +3 -1
- package/src/{api → packlets/database}/entity.ts +1 -1
- package/src/{database → packlets/database}/index.ts +5 -0
- package/src/{database → packlets/database}/item-demuxer.test.ts +21 -19
- package/src/{database → packlets/database}/item-demuxer.ts +10 -9
- package/src/{database → packlets/database}/item-manager.test.ts +0 -0
- package/src/{database → packlets/database}/item-manager.ts +5 -3
- package/src/{api → packlets/database}/item.ts +2 -2
- package/src/{api → packlets/database}/link.ts +1 -1
- package/src/{api → packlets/database}/selection/index.ts +0 -0
- package/src/{api → packlets/database}/selection/queries.ts +14 -18
- package/src/{api → packlets/database}/selection/result.ts +0 -0
- package/src/{api → packlets/database}/selection/selection.test.ts +4 -12
- package/src/{api → packlets/database}/selection/selection.ts +1 -7
- package/src/{api → packlets/database}/selection/util.ts +0 -0
- package/src/{database → packlets/database}/testing.ts +4 -7
- package/src/{database → packlets/database}/timeframe-clock.ts +4 -0
- package/src/{errors.ts → packlets/errors/index.ts} +0 -0
- package/src/parties/data-party.test.ts +58 -25
- package/src/parties/data-party.ts +48 -20
- package/src/parties/party-factory.ts +40 -84
- package/src/parties/party-manager.test.ts +24 -15
- package/src/parties/party-manager.ts +10 -6
- package/src/pipeline/{pipeline.test.ts → feed-muxer.test.ts} +23 -19
- package/src/pipeline/{pipeline.ts → feed-muxer.ts} +39 -55
- package/src/pipeline/index.ts +2 -2
- package/src/pipeline/message-selector.ts +32 -35
- package/src/pipeline/metadata-store.test.ts +8 -4
- package/src/pipeline/metadata-store.ts +12 -6
- package/src/pipeline/party-feed-provider.ts +3 -16
- package/src/pipeline/{party-core.test.ts → party-pipeline.test.ts} +67 -48
- package/src/pipeline/{party-core.ts → party-pipeline.ts} +59 -31
- package/src/pipeline/party-processor.ts +23 -15
- package/src/protocol/auth-plugin.ts +1 -3
- package/src/protocol/authenticator.test.ts +1 -4
- package/src/protocol/authenticator.ts +33 -33
- package/src/protocol/halo-recovery-plugin.ts +4 -6
- package/src/protocol/identity-credentials.ts +4 -4
- package/src/protocol/offline-invitation-plugin.ts +4 -6
- package/src/protocol/party-protocol-factory.ts +3 -56
- package/src/protocol/replicator-plugin.ts +37 -0
- package/src/snapshots/snapshot-generator.ts +14 -18
- package/src/snapshots/snapshot-store.test.ts +1 -1
- package/src/snapshots/snapshot-store.ts +5 -6
- package/src/snapshots/snapshot.test.ts +1 -1
- package/src/testing/benchmark.test.ts +30 -0
- package/src/testing/testing-factories.ts +3 -3
- package/dist/src/api/database.d.ts.map +0 -1
- package/dist/src/api/database.js.map +0 -1
- package/dist/src/api/database.test.d.ts.map +0 -1
- package/dist/src/api/database.test.js.map +0 -1
- package/dist/src/api/entity.d.ts.map +0 -1
- package/dist/src/api/entity.js.map +0 -1
- package/dist/src/api/item.d.ts.map +0 -1
- package/dist/src/api/item.js.map +0 -1
- package/dist/src/api/link.d.ts.map +0 -1
- package/dist/src/api/link.js.map +0 -1
- package/dist/src/api/selection/index.d.ts.map +0 -1
- package/dist/src/api/selection/index.js.map +0 -1
- package/dist/src/api/selection/queries.d.ts.map +0 -1
- package/dist/src/api/selection/queries.js.map +0 -1
- package/dist/src/api/selection/result.d.ts.map +0 -1
- package/dist/src/api/selection/result.js.map +0 -1
- package/dist/src/api/selection/selection.d.ts.map +0 -1
- package/dist/src/api/selection/selection.js.map +0 -1
- package/dist/src/api/selection/selection.test.d.ts.map +0 -1
- package/dist/src/api/selection/selection.test.js.map +0 -1
- package/dist/src/api/selection/util.d.ts.map +0 -1
- package/dist/src/api/selection/util.js.map +0 -1
- package/dist/src/database/data-mirror.d.ts.map +0 -1
- package/dist/src/database/data-mirror.js.map +0 -1
- package/dist/src/database/data-mirror.test.d.ts.map +0 -1
- package/dist/src/database/data-mirror.test.js.map +0 -1
- package/dist/src/database/data-service-host.d.ts.map +0 -1
- package/dist/src/database/data-service-host.js.map +0 -1
- package/dist/src/database/data-service-router.d.ts.map +0 -1
- package/dist/src/database/data-service-router.js.map +0 -1
- package/dist/src/database/database-backend.d.ts.map +0 -1
- package/dist/src/database/database-backend.js.map +0 -1
- package/dist/src/database/index.d.ts.map +0 -1
- package/dist/src/database/index.js.map +0 -1
- package/dist/src/database/item-demuxer.d.ts.map +0 -1
- package/dist/src/database/item-demuxer.js.map +0 -1
- package/dist/src/database/item-demuxer.test.d.ts.map +0 -1
- package/dist/src/database/item-demuxer.test.js.map +0 -1
- package/dist/src/database/item-manager.d.ts.map +0 -1
- package/dist/src/database/item-manager.js.map +0 -1
- package/dist/src/database/item-manager.test.d.ts.map +0 -1
- package/dist/src/database/item-manager.test.js.map +0 -1
- package/dist/src/database/testing.d.ts.map +0 -1
- package/dist/src/database/testing.js.map +0 -1
- package/dist/src/database/timeframe-clock.d.ts.map +0 -1
- package/dist/src/database/timeframe-clock.js.map +0 -1
- package/dist/src/errors.d.ts.map +0 -1
- package/dist/src/errors.js.map +0 -1
- package/dist/src/pipeline/party-core.d.ts.map +0 -1
- package/dist/src/pipeline/party-core.js.map +0 -1
- package/dist/src/pipeline/party-core.test.d.ts +0 -2
- package/dist/src/pipeline/party-core.test.d.ts.map +0 -1
- package/dist/src/pipeline/party-core.test.js.map +0 -1
- package/dist/src/pipeline/pipeline.d.ts.map +0 -1
- package/dist/src/pipeline/pipeline.js.map +0 -1
- package/dist/src/pipeline/pipeline.test.d.ts +0 -2
- package/dist/src/pipeline/pipeline.test.d.ts.map +0 -1
- package/dist/src/pipeline/pipeline.test.js.map +0 -1
package/src/api/schema.test.ts
CHANGED
|
@@ -9,8 +9,7 @@ import { ModelFactory } from '@dxos/model-factory';
|
|
|
9
9
|
import { ObjectModel } from '@dxos/object-model';
|
|
10
10
|
import { afterTest } from '@dxos/testutils';
|
|
11
11
|
|
|
12
|
-
import { createInMemoryDatabase } from '../database';
|
|
13
|
-
import { Database } from './database';
|
|
12
|
+
import { createInMemoryDatabase, Database } from '../packlets/database';
|
|
14
13
|
import { Schema, TYPE_SCHEMA } from './schema';
|
|
15
14
|
|
|
16
15
|
const SCHEMA = 'example:type/schema/organization';
|
package/src/echo.test.ts
CHANGED
|
@@ -13,10 +13,10 @@ import { generateSeedPhrase, keyPairFromSeedPhrase } from '@dxos/crypto';
|
|
|
13
13
|
import { ObjectModel } from '@dxos/object-model';
|
|
14
14
|
import { afterTest } from '@dxos/testutils';
|
|
15
15
|
|
|
16
|
-
import { Item } from './api';
|
|
17
16
|
import { ECHO } from './echo';
|
|
18
17
|
import { Contact } from './halo';
|
|
19
18
|
import { defaultInvitationAuthenticator } from './invitations';
|
|
19
|
+
import { Item } from './packlets/database';
|
|
20
20
|
import { inviteTestPeer } from './testing';
|
|
21
21
|
|
|
22
22
|
const log = debug('dxos:echo:test');
|
|
@@ -707,10 +707,6 @@ describe('ECHO', () => {
|
|
|
707
707
|
expect(partyA.isOpen).toBe(true);
|
|
708
708
|
expect(partyA.isActive).toBe(true);
|
|
709
709
|
|
|
710
|
-
await partyA.database
|
|
711
|
-
.select({ type: 'example:item/test' })
|
|
712
|
-
.exec()
|
|
713
|
-
.update.waitFor(result => result.entities.length > 0);
|
|
714
710
|
expect(partyA.database.select({ type: 'example:item/test' }).exec().entities.length).toEqual(1);
|
|
715
711
|
}).timeout(10_000);
|
|
716
712
|
|
|
@@ -834,6 +830,21 @@ describe('ECHO', () => {
|
|
|
834
830
|
expect(members[1].displayName).toBe('B');
|
|
835
831
|
});
|
|
836
832
|
|
|
833
|
+
test('optimistic mutations on ObjectModel', async () => {
|
|
834
|
+
const echo = await setup({ createProfile: true, displayName: 'A' });
|
|
835
|
+
const party = await echo.createParty();
|
|
836
|
+
const item = await party.database.createItem({ model: ObjectModel });
|
|
837
|
+
|
|
838
|
+
const committed = item.model
|
|
839
|
+
.builder()
|
|
840
|
+
.set('key', 'value')
|
|
841
|
+
.commit();
|
|
842
|
+
expect(item.model.get('key')).toEqual('value');
|
|
843
|
+
|
|
844
|
+
await committed;
|
|
845
|
+
expect(item.model.get('key')).toEqual('value');
|
|
846
|
+
});
|
|
847
|
+
|
|
837
848
|
// TODO(burdon): Fix.
|
|
838
849
|
// Note: The reason I wrote this test is because it does not seem to be working properly in Teamwork.
|
|
839
850
|
// I don't seem to be receiving an update after which `party.title` holds correct value.
|
package/src/echo.ts
CHANGED
|
@@ -19,11 +19,11 @@ import { Storage, createStorage, StorageType } from '@dxos/random-access-multi-s
|
|
|
19
19
|
import { SubscriptionGroup } from '@dxos/util';
|
|
20
20
|
|
|
21
21
|
import { ResultSet } from './api';
|
|
22
|
-
import { DataServiceRouter } from './database';
|
|
23
|
-
import { IdentityNotInitializedError, InvalidStorageVersionError } from './errors';
|
|
24
22
|
import { HALO } from './halo';
|
|
25
23
|
import { autoPartyOpener } from './halo/party-opener';
|
|
26
24
|
import { InvitationDescriptor, OfflineInvitationClaimer } from './invitations';
|
|
25
|
+
import { DataServiceRouter } from './packlets/database';
|
|
26
|
+
import { IdentityNotInitializedError, InvalidStorageVersionError } from './packlets/errors';
|
|
27
27
|
import { OpenProgress, PartyFactory, DataParty, PartyManager } from './parties';
|
|
28
28
|
import { MetadataStore, STORAGE_VERSION, PartyFeedProvider } from './pipeline';
|
|
29
29
|
import { SnapshotStore } from './snapshots';
|
|
@@ -87,6 +87,7 @@ export class ECHO {
|
|
|
87
87
|
private readonly _halo: HALO;
|
|
88
88
|
private readonly _keyring: Keyring;
|
|
89
89
|
|
|
90
|
+
private readonly _storage: Storage;
|
|
90
91
|
private readonly _feedStore: FeedStore;
|
|
91
92
|
private readonly _modelFactory: ModelFactory;
|
|
92
93
|
private readonly _networkManager: NetworkManager;
|
|
@@ -114,11 +115,12 @@ export class ECHO {
|
|
|
114
115
|
this._modelFactory = new ModelFactory()
|
|
115
116
|
.registerModel(ObjectModel);
|
|
116
117
|
|
|
118
|
+
this._storage = storage;
|
|
117
119
|
this._networkManager = new NetworkManager(networkManagerOptions);
|
|
118
|
-
this._snapshotStore = new SnapshotStore(storage.
|
|
119
|
-
this._metadataStore = new MetadataStore(storage.
|
|
120
|
+
this._snapshotStore = new SnapshotStore(storage.directory('snapshots'));
|
|
121
|
+
this._metadataStore = new MetadataStore(storage.directory('metadata'));
|
|
120
122
|
this._keyring = new Keyring(new KeyStore(keyStorage));
|
|
121
|
-
this._feedStore = new FeedStore(storage.
|
|
123
|
+
this._feedStore = new FeedStore(storage.directory('feeds'), { valueEncoding: codec });
|
|
122
124
|
|
|
123
125
|
const feedProviderFactory = (partyKey: PublicKey) => new PartyFeedProvider(
|
|
124
126
|
this._metadataStore,
|
|
@@ -141,6 +143,7 @@ export class ECHO {
|
|
|
141
143
|
this._modelFactory,
|
|
142
144
|
this._snapshotStore,
|
|
143
145
|
feedProviderFactory,
|
|
146
|
+
this._metadataStore,
|
|
144
147
|
options
|
|
145
148
|
);
|
|
146
149
|
|
|
@@ -275,26 +278,14 @@ export class ECHO {
|
|
|
275
278
|
await this.close();
|
|
276
279
|
|
|
277
280
|
try {
|
|
278
|
-
if (this.
|
|
279
|
-
await this.
|
|
281
|
+
if (this._storage.destroy) {
|
|
282
|
+
await this._storage.destroy();
|
|
280
283
|
}
|
|
281
284
|
} catch (err: any) {
|
|
282
|
-
error('Error clearing
|
|
285
|
+
error('Error clearing storage:', err);
|
|
283
286
|
}
|
|
284
287
|
|
|
285
288
|
await this.halo.reset();
|
|
286
|
-
|
|
287
|
-
try {
|
|
288
|
-
await this._snapshotStore.clear();
|
|
289
|
-
} catch (err: any) {
|
|
290
|
-
error('Error clearing snapshot storage:', err);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
try {
|
|
294
|
-
await this._metadataStore.clear();
|
|
295
|
-
} catch (err: any) {
|
|
296
|
-
error('Error clearing metadata storage:', err);
|
|
297
|
-
}
|
|
298
289
|
}
|
|
299
290
|
|
|
300
291
|
//
|
|
@@ -7,8 +7,9 @@ import { PublicKey } from '@dxos/crypto';
|
|
|
7
7
|
import { raise } from '@dxos/debug';
|
|
8
8
|
import { ObjectModel } from '@dxos/object-model';
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { ResultSet } from '../api';
|
|
11
|
+
import { Database, Item } from '../packlets/database';
|
|
12
|
+
import { IdentityNotInitializedError } from '../packlets/errors';
|
|
12
13
|
import { PartyMember } from '../parties';
|
|
13
14
|
import { HALO_PARTY_CONTACT_LIST_TYPE } from './halo-party';
|
|
14
15
|
|
package/src/halo/halo-factory.ts
CHANGED
|
@@ -13,9 +13,7 @@ import {
|
|
|
13
13
|
Keyring,
|
|
14
14
|
KeyType,
|
|
15
15
|
Filter,
|
|
16
|
-
SecretProvider
|
|
17
|
-
KeyHint,
|
|
18
|
-
createFeedAdmitMessage
|
|
16
|
+
SecretProvider
|
|
19
17
|
} from '@dxos/credentials';
|
|
20
18
|
import { keyToString, PublicKey, keyPairFromSeedPhrase } from '@dxos/crypto';
|
|
21
19
|
import { ModelFactory } from '@dxos/model-factory';
|
|
@@ -24,7 +22,7 @@ import { ObjectModel } from '@dxos/object-model';
|
|
|
24
22
|
|
|
25
23
|
import { createHaloPartyAdmissionMessage, GreetingInitiator, HaloRecoveryInitiator, InvitationDescriptor, InvitationDescriptorType, OfflineInvitationClaimer } from '../invitations';
|
|
26
24
|
import { PARTY_ITEM_TYPE } from '../parties';
|
|
27
|
-
import { PartyFeedProvider,
|
|
25
|
+
import { PartyFeedProvider, PipelineOptions } from '../pipeline';
|
|
28
26
|
import { CredentialsSigner } from '../protocol/credentials-signer';
|
|
29
27
|
import { SnapshotStore } from '../snapshots';
|
|
30
28
|
import {
|
|
@@ -52,19 +50,20 @@ export class HaloFactory {
|
|
|
52
50
|
private readonly _snapshotStore: SnapshotStore,
|
|
53
51
|
private readonly _feedProviderFactory: (partyKey: PublicKey) => PartyFeedProvider,
|
|
54
52
|
private readonly _keyring: Keyring,
|
|
55
|
-
private readonly _options:
|
|
53
|
+
private readonly _options: PipelineOptions = {}
|
|
56
54
|
) {}
|
|
57
55
|
|
|
58
|
-
async constructParty (
|
|
56
|
+
async constructParty (feedHints: PublicKey[]): Promise<HaloParty> {
|
|
59
57
|
const credentialsSigner = CredentialsSigner.createDirectDeviceSigner(this._keyring);
|
|
60
58
|
const feedProvider = this._feedProviderFactory(credentialsSigner.getIdentityKey().publicKey);
|
|
59
|
+
const writableFeed = await feedProvider.createOrOpenWritableFeed();
|
|
61
60
|
const halo = new HaloParty(
|
|
62
61
|
this._modelFactory,
|
|
63
62
|
this._snapshotStore,
|
|
64
63
|
feedProvider,
|
|
65
64
|
credentialsSigner,
|
|
66
65
|
this._networkManager,
|
|
67
|
-
|
|
66
|
+
[...feedHints, writableFeed.key],
|
|
68
67
|
undefined,
|
|
69
68
|
this._options
|
|
70
69
|
);
|
|
@@ -94,21 +93,21 @@ export class HaloFactory {
|
|
|
94
93
|
* B. Device key (the first "member" of the Identity's HALO).
|
|
95
94
|
* C. Feed key (the feed owned by the Device).
|
|
96
95
|
*/
|
|
97
|
-
await halo.
|
|
96
|
+
await halo.credentialsWriter.write(createPartyGenesisMessage(this._keyring, identityKey, feedKeyPair.publicKey, deviceKey));
|
|
98
97
|
|
|
99
98
|
/* 3. Make a special self-signed KeyAdmit message which will serve as an "IdentityGenesis" message. This
|
|
100
99
|
* message will be copied into other Parties which we create or join.
|
|
101
100
|
*/
|
|
102
|
-
await halo.
|
|
101
|
+
await halo.credentialsWriter.write(createKeyAdmitMessage(this._keyring, identityKey.publicKey, identityKey));
|
|
103
102
|
|
|
104
103
|
if (options.identityDisplayName) {
|
|
105
104
|
// 4. Write the IdentityInfo message with descriptive details (eg, display name).
|
|
106
|
-
await halo.
|
|
105
|
+
await halo.credentialsWriter.write(createIdentityInfoMessage(this._keyring, options.identityDisplayName, identityKey));
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
if (options.deviceDisplayName) {
|
|
110
109
|
// 5. Write the DeviceInfo message with descriptive details (eg, display name).
|
|
111
|
-
await halo.
|
|
110
|
+
await halo.credentialsWriter.write(createDeviceInfoMessage(this._keyring, options.deviceDisplayName, deviceKey));
|
|
112
111
|
}
|
|
113
112
|
|
|
114
113
|
// Create special properties item.
|
|
@@ -193,22 +192,11 @@ export class HaloFactory {
|
|
|
193
192
|
);
|
|
194
193
|
|
|
195
194
|
await initiator.connect();
|
|
196
|
-
const {
|
|
195
|
+
const { hints } = await initiator.redeemInvitation(secretProvider);
|
|
197
196
|
|
|
198
|
-
/*
|
|
199
|
-
* TODO(telackey): We shouldn't have to add our key here, it should be in the hints, but our hint
|
|
200
|
-
* mechanism is broken by not waiting on the messages to be processed before returning.
|
|
201
|
-
*/
|
|
202
197
|
const halo = await this.constructParty(hints);
|
|
203
198
|
await halo.open();
|
|
204
199
|
|
|
205
|
-
// Write the Feed genesis message.
|
|
206
|
-
await halo.processor.writeHaloMessage(createFeedAdmitMessage(
|
|
207
|
-
credentialsSigner.signer,
|
|
208
|
-
partyKey,
|
|
209
|
-
await halo.getWriteFeedKey(),
|
|
210
|
-
[credentialsSigner.getDeviceKey()]
|
|
211
|
-
));
|
|
212
200
|
await initiator.destroy();
|
|
213
201
|
|
|
214
202
|
await halo.database.createItem({
|
package/src/halo/halo-party.ts
CHANGED
|
@@ -14,9 +14,10 @@ import { NetworkManager } from '@dxos/network-manager';
|
|
|
14
14
|
|
|
15
15
|
import { InvitationAuthenticator, InvitationDescriptor, InvitationFactory, InvitationOptions } from '../invitations';
|
|
16
16
|
import { PARTY_ITEM_TYPE } from '../parties';
|
|
17
|
-
import { PartyFeedProvider, PartyProtocolFactory,
|
|
17
|
+
import { PartyFeedProvider, PartyProtocolFactory, PartyPipeline, PipelineOptions } from '../pipeline';
|
|
18
18
|
import { createAuthenticator, createAuthPlugin, createCredentialsProvider, createHaloRecoveryPlugin } from '../protocol';
|
|
19
19
|
import { CredentialsSigner } from '../protocol/credentials-signer';
|
|
20
|
+
import { createReplicatorPlugin } from '../protocol/replicator-plugin';
|
|
20
21
|
import { SnapshotStore } from '../snapshots';
|
|
21
22
|
import { ContactManager } from './contact-manager';
|
|
22
23
|
import { Preferences } from './preferences';
|
|
@@ -40,7 +41,7 @@ export interface JoinedParty {
|
|
|
40
41
|
export class HaloParty {
|
|
41
42
|
public readonly update = new Event<void>();
|
|
42
43
|
|
|
43
|
-
private readonly _partyCore:
|
|
44
|
+
private readonly _partyCore: PartyPipeline;
|
|
44
45
|
private _invitationManager?: InvitationFactory;
|
|
45
46
|
private _protocol?: PartyProtocolFactory;
|
|
46
47
|
|
|
@@ -53,17 +54,16 @@ export class HaloParty {
|
|
|
53
54
|
private readonly _feedProvider: PartyFeedProvider,
|
|
54
55
|
private readonly _credentialsSigner: CredentialsSigner,
|
|
55
56
|
private readonly _networkManager: NetworkManager,
|
|
56
|
-
private readonly
|
|
57
|
-
_initialTimeframe: Timeframe | undefined,
|
|
58
|
-
_options:
|
|
57
|
+
private readonly _feedHints: PublicKey[] = [],
|
|
58
|
+
private readonly _initialTimeframe: Timeframe | undefined,
|
|
59
|
+
_options: PipelineOptions
|
|
59
60
|
) {
|
|
60
|
-
this._partyCore = new
|
|
61
|
+
this._partyCore = new PartyPipeline(
|
|
61
62
|
_credentialsSigner.getIdentityKey().publicKey,
|
|
62
63
|
_feedProvider,
|
|
63
64
|
modelFactory,
|
|
64
65
|
snapshotStore,
|
|
65
66
|
_credentialsSigner.getIdentityKey().publicKey,
|
|
66
|
-
_initialTimeframe,
|
|
67
67
|
_options
|
|
68
68
|
);
|
|
69
69
|
|
|
@@ -113,10 +113,6 @@ export class HaloParty {
|
|
|
113
113
|
return this._partyCore.processor.credentialMessages.get(this._credentialsSigner.getIdentityKey().publicKey.toHex());
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
get memberKeys () {
|
|
117
|
-
return this._partyCore.processor.memberKeys;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
116
|
get credentialMessages () {
|
|
121
117
|
return this._partyCore.processor.credentialMessages;
|
|
122
118
|
}
|
|
@@ -125,6 +121,10 @@ export class HaloParty {
|
|
|
125
121
|
return this._partyCore.processor.feedKeys;
|
|
126
122
|
}
|
|
127
123
|
|
|
124
|
+
get credentialsWriter () {
|
|
125
|
+
return this._partyCore.credentialsWriter;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
128
|
async getWriteFeedKey () {
|
|
129
129
|
const feed = await this._feedProvider.createOrOpenWritableFeed();
|
|
130
130
|
return feed.key;
|
|
@@ -144,11 +144,15 @@ export class HaloParty {
|
|
|
144
144
|
return this;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
await this._partyCore.open(
|
|
147
|
+
await this._partyCore.open({
|
|
148
|
+
feedHints: this._feedHints,
|
|
149
|
+
initialTimeframe: this._initialTimeframe
|
|
150
|
+
});
|
|
148
151
|
|
|
149
152
|
this._invitationManager = new InvitationFactory(
|
|
150
153
|
this._partyCore.processor,
|
|
151
154
|
this._credentialsSigner,
|
|
155
|
+
this._partyCore.credentialsWriter,
|
|
152
156
|
this._networkManager
|
|
153
157
|
);
|
|
154
158
|
|
|
@@ -161,14 +165,18 @@ export class HaloParty {
|
|
|
161
165
|
this._protocol = new PartyProtocolFactory(
|
|
162
166
|
this._partyCore.key,
|
|
163
167
|
this._networkManager,
|
|
164
|
-
this._feedProvider,
|
|
165
168
|
peerId,
|
|
166
169
|
createCredentialsProvider(this._credentialsSigner, this._partyCore.key, writeFeed.key)
|
|
167
170
|
);
|
|
168
171
|
|
|
169
172
|
// Replication.
|
|
170
173
|
await this._protocol.start([
|
|
171
|
-
|
|
174
|
+
createReplicatorPlugin(this._feedProvider),
|
|
175
|
+
createAuthPlugin(createAuthenticator(
|
|
176
|
+
this._partyCore.processor,
|
|
177
|
+
this._credentialsSigner,
|
|
178
|
+
this._partyCore.credentialsWriter
|
|
179
|
+
), peerId),
|
|
172
180
|
createHaloRecoveryPlugin(this._credentialsSigner.getIdentityKey().publicKey, this._invitationManager, peerId)
|
|
173
181
|
]);
|
|
174
182
|
|
package/src/halo/halo.test.ts
CHANGED
|
@@ -26,10 +26,11 @@ describe('HALO', () => {
|
|
|
26
26
|
.registerModel(ObjectModel);
|
|
27
27
|
|
|
28
28
|
const networkManager = new NetworkManager();
|
|
29
|
-
const
|
|
30
|
-
const
|
|
29
|
+
const storage = createStorage('', StorageType.RAM);
|
|
30
|
+
const snapshotStore = new SnapshotStore(storage.directory('snapshots'));
|
|
31
|
+
const metadataStore = new MetadataStore(storage.directory('metadata'));
|
|
31
32
|
const keyring = new Keyring();
|
|
32
|
-
const feedStore = new FeedStore(
|
|
33
|
+
const feedStore = new FeedStore(storage.directory('feed'), { valueEncoding: codec });
|
|
33
34
|
|
|
34
35
|
const feedProviderFactory = (partyKey: PublicKey) => new PartyFeedProvider(
|
|
35
36
|
metadataStore,
|
package/src/halo/halo.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { NetworkManager } from '@dxos/network-manager';
|
|
|
15
15
|
import { ResultSet } from '../api';
|
|
16
16
|
import { InvitationAuthenticator, InvitationDescriptor, InvitationOptions } from '../invitations';
|
|
17
17
|
import { OpenProgress } from '../parties';
|
|
18
|
-
import { MetadataStore,
|
|
18
|
+
import { MetadataStore, PipelineOptions, PartyFeedProvider } from '../pipeline';
|
|
19
19
|
import { SnapshotStore } from '../snapshots';
|
|
20
20
|
import { Contact } from './contact-manager';
|
|
21
21
|
import { HaloFactory } from './halo-factory';
|
|
@@ -36,7 +36,7 @@ export interface HaloConfiguration {
|
|
|
36
36
|
modelFactory: ModelFactory,
|
|
37
37
|
snapshotStore: SnapshotStore,
|
|
38
38
|
feedProviderFactory: (partyKey: PublicKey) => PartyFeedProvider,
|
|
39
|
-
options:
|
|
39
|
+
options: PipelineOptions
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
package/src/halo/identity.ts
CHANGED
|
@@ -102,7 +102,7 @@ export class Identity implements IdentityCredentials {
|
|
|
102
102
|
|
|
103
103
|
export type IdentityProvider = () => Identity | undefined;
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
const getDeviceKeyChainFromHalo = (halo: HaloParty, deviceKey: KeyRecord) => {
|
|
106
106
|
try {
|
|
107
107
|
return Keyring.buildKeyChain(
|
|
108
108
|
deviceKey.publicKey,
|
|
@@ -113,4 +113,4 @@ function getDeviceKeyChainFromHalo (halo: HaloParty, deviceKey: KeyRecord) {
|
|
|
113
113
|
log('Unable to locate device KeyChain:', err);
|
|
114
114
|
throw err;
|
|
115
115
|
}
|
|
116
|
-
}
|
|
116
|
+
};
|
package/src/halo/party-opener.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import debug from 'debug';
|
|
6
6
|
|
|
7
|
+
import { KeyType } from '@dxos/credentials';
|
|
7
8
|
import { SubscriptionGroup, Unsubscribe } from '@dxos/util';
|
|
8
9
|
|
|
9
10
|
import { PartyManager } from '../parties';
|
|
@@ -14,7 +15,7 @@ const log = debug('dxos:echo-db:party-opener');
|
|
|
14
15
|
/**
|
|
15
16
|
* Automatically adds, opens, and clothes parties from HALO preferences.
|
|
16
17
|
*/
|
|
17
|
-
export
|
|
18
|
+
export const autoPartyOpener = (preferences: Preferences, partyManager: PartyManager): Unsubscribe => {
|
|
18
19
|
const subs = new SubscriptionGroup();
|
|
19
20
|
|
|
20
21
|
subs.push(preferences.subscribeToJoinedPartyList(async values => {
|
|
@@ -25,7 +26,8 @@ export function autoPartyOpener (preferences: Preferences, partyManager: PartyMa
|
|
|
25
26
|
for (const partyDesc of values) {
|
|
26
27
|
if (!partyManager.parties.some(x => x.key === partyDesc.partyKey)) {
|
|
27
28
|
log(`Auto-opening new Party from HALO: ${partyDesc.partyKey.toHex()} hints=${JSON.stringify(partyDesc.keyHints)}`);
|
|
28
|
-
|
|
29
|
+
const feedHints = partyDesc.keyHints.filter(hint => hint.type === KeyType.FEED).map(hint => hint.publicKey!);
|
|
30
|
+
await partyManager.addParty(partyDesc.partyKey, feedHints);
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
}));
|
|
@@ -46,4 +48,4 @@ export function autoPartyOpener (preferences: Preferences, partyManager: PartyMa
|
|
|
46
48
|
}));
|
|
47
49
|
|
|
48
50
|
return () => subs.unsubscribe();
|
|
49
|
-
}
|
|
51
|
+
};
|
package/src/halo/preferences.ts
CHANGED
|
@@ -12,8 +12,9 @@ import { PublicKey } from '@dxos/crypto';
|
|
|
12
12
|
import { raise } from '@dxos/debug';
|
|
13
13
|
import { ObjectModel } from '@dxos/object-model';
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import { ResultSet } from '../api';
|
|
16
|
+
import { Database, Item } from '../packlets/database';
|
|
17
|
+
import { IdentityNotInitializedError } from '../packlets/errors';
|
|
17
18
|
import { DataParty } from '../parties';
|
|
18
19
|
import {
|
|
19
20
|
HALO_PARTY_DESCRIPTOR_TYPE, HALO_PARTY_DEVICE_PREFERENCES_TYPE, HALO_PARTY_PREFERENCES_TYPE, JoinedParty
|
|
@@ -159,16 +160,13 @@ export class Preferences {
|
|
|
159
160
|
subscribeToJoinedPartyList (callback: (parties: JoinedParty[]) => void): () => void {
|
|
160
161
|
const database = this._getDatabase() ?? raise(new IdentityNotInitializedError());
|
|
161
162
|
|
|
162
|
-
const converter = (partyDesc: Item<any>) => {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
} as KeyHint))
|
|
170
|
-
};
|
|
171
|
-
};
|
|
163
|
+
const converter = (partyDesc: Item<any>) => ({
|
|
164
|
+
partyKey: PublicKey.from(partyDesc.model.get('publicKey')),
|
|
165
|
+
keyHints: Object.values(partyDesc.model.get('hints')).map((hint: any) => ({
|
|
166
|
+
...hint,
|
|
167
|
+
publicKey: PublicKey.from(hint.publicKey)
|
|
168
|
+
} as KeyHint))
|
|
169
|
+
});
|
|
172
170
|
|
|
173
171
|
const result = database.select({ type: HALO_PARTY_DESCRIPTOR_TYPE }).exec();
|
|
174
172
|
|
package/src/index.ts
CHANGED
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
export { codec } from '@dxos/echo-protocol';
|
|
6
6
|
|
|
7
|
+
export * from './packlets/database';
|
|
8
|
+
export * from './packlets/errors';
|
|
9
|
+
|
|
7
10
|
export * from './api';
|
|
8
|
-
export * from './database';
|
|
9
11
|
export * from './echo';
|
|
10
|
-
export * from './errors';
|
|
11
12
|
export * from './halo';
|
|
12
13
|
export * from './invitations';
|
|
13
14
|
export * from './protocol';
|
|
@@ -7,6 +7,7 @@ import debug from 'debug';
|
|
|
7
7
|
|
|
8
8
|
import { waitForEvent } from '@dxos/async';
|
|
9
9
|
import {
|
|
10
|
+
ERR_GREET_CONNECTED_TO_SWARM_TIMEOUT,
|
|
10
11
|
createEnvelopeMessage,
|
|
11
12
|
createGreetingBeginMessage,
|
|
12
13
|
createGreetingFinishMessage,
|
|
@@ -19,8 +20,8 @@ import {
|
|
|
19
20
|
Message,
|
|
20
21
|
SecretProvider,
|
|
21
22
|
WithTypeUrl,
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
SignedMessage,
|
|
24
|
+
NotarizeResponse
|
|
24
25
|
} from '@dxos/credentials';
|
|
25
26
|
import { keyToString, PublicKey } from '@dxos/crypto';
|
|
26
27
|
import { FullyConnectedTopology, NetworkManager } from '@dxos/network-manager';
|
|
@@ -46,10 +47,9 @@ export class GreetingInitiator {
|
|
|
46
47
|
|
|
47
48
|
/**
|
|
48
49
|
* @param _networkManager
|
|
49
|
-
* @param _identity
|
|
50
50
|
* @param _invitationDescriptor
|
|
51
|
-
* @param
|
|
52
|
-
*
|
|
51
|
+
* @param _getMessagesToNotarize
|
|
52
|
+
* Returns a list of credential messages that the inviter will be asked to write into the control feed.
|
|
53
53
|
*/
|
|
54
54
|
constructor (
|
|
55
55
|
private readonly _networkManager: NetworkManager,
|
|
@@ -93,7 +93,8 @@ export class GreetingInitiator {
|
|
|
93
93
|
log(keyToString(localPeerId), 'connecting to', keyToString(swarmKey));
|
|
94
94
|
|
|
95
95
|
const peerJoinedWaiter = waitForEvent(this._greeterPlugin, 'peer:joined',
|
|
96
|
-
(remotePeerId: any) => remotePeerId && Buffer.from(responderPeerId).equals(remotePeerId),
|
|
96
|
+
(remotePeerId: any) => remotePeerId && Buffer.from(responderPeerId).equals(remotePeerId),
|
|
97
|
+
timeout, ERR_GREET_CONNECTED_TO_SWARM_TIMEOUT);
|
|
97
98
|
|
|
98
99
|
await this._networkManager.joinProtocolSwarm({
|
|
99
100
|
topic: PublicKey.from(swarmKey),
|
|
@@ -111,7 +112,7 @@ export class GreetingInitiator {
|
|
|
111
112
|
/**
|
|
112
113
|
* Called after connecting to initiate greeting protocol exchange.
|
|
113
114
|
*/
|
|
114
|
-
async redeemInvitation (secretProvider: SecretProvider) {
|
|
115
|
+
async redeemInvitation (secretProvider: SecretProvider): Promise<{ partyKey: PublicKey, hints: PublicKey[] }> {
|
|
115
116
|
assert(this._state === GreetingState.CONNECTED);
|
|
116
117
|
const { swarmKey } = this._invitationDescriptor;
|
|
117
118
|
|
|
@@ -150,7 +151,7 @@ export class GreetingInitiator {
|
|
|
150
151
|
const credentialMessages = await this._getMessagesToNotarize(PublicKey.from(partyKey), nonce);
|
|
151
152
|
|
|
152
153
|
// Send the signed payload to the greeting responder.
|
|
153
|
-
const notarizeResponse = await this._greeterPlugin.send(responderPeerId,
|
|
154
|
+
const notarizeResponse: NotarizeResponse = await this._greeterPlugin.send(responderPeerId,
|
|
154
155
|
createGreetingNotarizeMessage(secret, credentialMessages as WithTypeUrl<Message>[]));
|
|
155
156
|
|
|
156
157
|
//
|
|
@@ -171,7 +172,7 @@ export class GreetingInitiator {
|
|
|
171
172
|
this._state = GreetingState.SUCCEEDED;
|
|
172
173
|
return {
|
|
173
174
|
partyKey,
|
|
174
|
-
hints: notarizeResponse.
|
|
175
|
+
hints: notarizeResponse.feedHints ?? []
|
|
175
176
|
};
|
|
176
177
|
}
|
|
177
178
|
|
|
@@ -14,12 +14,8 @@ import { protocolFactory } from '@dxos/network-manager';
|
|
|
14
14
|
*/
|
|
15
15
|
// TODO(burdon): When closed?
|
|
16
16
|
// TODO(dboreham): Write a test to check resources are released (no resource leaks).
|
|
17
|
-
export const greetingProtocolProvider = (rendezvousKey: any, peerId: Buffer | Uint8Array, protocolPlugins: any[]) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
session: { peerId: keyToString(peerId) },
|
|
23
|
-
plugins: protocolPlugins
|
|
24
|
-
});
|
|
25
|
-
};
|
|
17
|
+
export const greetingProtocolProvider = (rendezvousKey: any, peerId: Buffer | Uint8Array, protocolPlugins: any[]) => protocolFactory({
|
|
18
|
+
getTopics: () => [rendezvousKey],
|
|
19
|
+
session: { peerId: keyToString(peerId) },
|
|
20
|
+
plugins: protocolPlugins
|
|
21
|
+
});
|
|
@@ -14,12 +14,13 @@ import {
|
|
|
14
14
|
KeyType,
|
|
15
15
|
SecretProvider,
|
|
16
16
|
SecretValidator
|
|
17
|
+
, Message as HaloMessage
|
|
17
18
|
} from '@dxos/credentials';
|
|
18
19
|
import { keyToString, randomBytes, PublicKey } from '@dxos/crypto';
|
|
19
|
-
import { SwarmKey } from '@dxos/echo-protocol';
|
|
20
|
+
import { FeedWriter, SwarmKey } from '@dxos/echo-protocol';
|
|
20
21
|
import { FullyConnectedTopology, NetworkManager } from '@dxos/network-manager';
|
|
21
22
|
|
|
22
|
-
import {
|
|
23
|
+
import { PartyStateProvider } from '../pipeline';
|
|
23
24
|
import { CredentialsSigner } from '../protocol/credentials-signer';
|
|
24
25
|
import { InvitationOptions } from './common';
|
|
25
26
|
import { greetingProtocolProvider } from './greeting-protocol-provider';
|
|
@@ -57,8 +58,9 @@ export class GreetingResponder {
|
|
|
57
58
|
|
|
58
59
|
constructor (
|
|
59
60
|
private readonly _networkManager: NetworkManager,
|
|
60
|
-
private readonly _partyProcessor:
|
|
61
|
-
private readonly _credentialsSigner: CredentialsSigner
|
|
61
|
+
private readonly _partyProcessor: PartyStateProvider,
|
|
62
|
+
private readonly _credentialsSigner: CredentialsSigner,
|
|
63
|
+
private readonly _credentialsWriter: FeedWriter<HaloMessage>
|
|
62
64
|
) {
|
|
63
65
|
this._greeter = new Greeter(
|
|
64
66
|
this._partyProcessor.partyKey,
|
|
@@ -222,7 +224,7 @@ export class GreetingResponder {
|
|
|
222
224
|
[this._credentialsSigner.getDeviceSigningKeys()]
|
|
223
225
|
);
|
|
224
226
|
|
|
225
|
-
await this.
|
|
227
|
+
await this._credentialsWriter.write(envelope);
|
|
226
228
|
|
|
227
229
|
// Wait for keys to be admitted.
|
|
228
230
|
await waitForCondition(() => admittedKeys.every(hasKey));
|
|
@@ -243,19 +245,15 @@ export class GreetingResponder {
|
|
|
243
245
|
_gatherHints (): KeyHint[] {
|
|
244
246
|
assert(this._state === GreetingState.SUCCEEDED);
|
|
245
247
|
|
|
246
|
-
const memberKeys = this._partyProcessor.memberKeys.map(publicKey => {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
};
|
|
251
|
-
});
|
|
248
|
+
const memberKeys = this._partyProcessor.memberKeys.map((publicKey) => ({
|
|
249
|
+
publicKey,
|
|
250
|
+
type: KeyType.UNKNOWN
|
|
251
|
+
}));
|
|
252
252
|
|
|
253
|
-
const memberFeeds = this._partyProcessor.feedKeys.map(publicKey => {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
};
|
|
258
|
-
});
|
|
253
|
+
const memberFeeds = this._partyProcessor.feedKeys.map((publicKey) => ({
|
|
254
|
+
publicKey,
|
|
255
|
+
type: KeyType.FEED
|
|
256
|
+
}));
|
|
259
257
|
|
|
260
258
|
return [...memberKeys, ...memberFeeds];
|
|
261
259
|
}
|
|
@@ -22,8 +22,8 @@ import {
|
|
|
22
22
|
import { keyToBuffer, keyToString, PublicKey, randomBytes, verify } from '@dxos/crypto';
|
|
23
23
|
import { FullyConnectedTopology, NetworkManager } from '@dxos/network-manager';
|
|
24
24
|
|
|
25
|
-
import { InvalidInvitationError } from '../errors';
|
|
26
|
-
import { CredentialsSigner } from '../protocol
|
|
25
|
+
import { InvalidInvitationError } from '../packlets/errors';
|
|
26
|
+
import { CredentialsSigner } from '../protocol';
|
|
27
27
|
import { greetingProtocolProvider } from './greeting-protocol-provider';
|
|
28
28
|
import { GreetingState } from './greeting-responder';
|
|
29
29
|
import { InvitationDescriptor, InvitationDescriptorType } from './invitation-descriptor';
|
|
@@ -72,8 +72,8 @@ export class HaloRecoveryInitiator {
|
|
|
72
72
|
this._greeterPlugin = new GreetingCommandPlugin(this._peerId, async () => false);
|
|
73
73
|
|
|
74
74
|
log('Connecting');
|
|
75
|
-
const peerJoinedWaiter = waitForEvent(
|
|
76
|
-
() => this._greeterPlugin?.peers.length, timeout);
|
|
75
|
+
const peerJoinedWaiter = waitForEvent(
|
|
76
|
+
this._greeterPlugin, 'peer:joined', () => !!this._greeterPlugin?.peers.length, timeout);
|
|
77
77
|
|
|
78
78
|
await this._networkManager.joinProtocolSwarm({
|
|
79
79
|
topic: PublicKey.from(swarmKey),
|
|
@@ -10,7 +10,7 @@ import { keyToBuffer, keyToString, ripemd160, PublicKey } from '@dxos/crypto';
|
|
|
10
10
|
import { SwarmKey } from '@dxos/echo-protocol';
|
|
11
11
|
import * as proto from '@dxos/echo-protocol';
|
|
12
12
|
|
|
13
|
-
import { InvalidInvitationError } from '../errors';
|
|
13
|
+
import { InvalidInvitationError } from '../packlets/errors';
|
|
14
14
|
|
|
15
15
|
// Re-exporting type enum from protobuf definitions.
|
|
16
16
|
export import InvitationDescriptorType = proto.InvitationDescriptor.Type;
|