@dxos/echo-db 2.33.5-dev.4dcc5349 → 2.33.5-dev.8e90a74f
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 +0 -5
- 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 +9 -20
- package/dist/src/echo.js.map +1 -1
- package/dist/src/echo.test.js +12 -0
- 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 +2 -2
- package/dist/src/halo/halo-factory.d.ts.map +1 -1
- package/dist/src/halo/halo-factory.js +7 -13
- package/dist/src/halo/halo-factory.js.map +1 -1
- package/dist/src/halo/halo-party.d.ts +4 -3
- 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.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/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 +2 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/invitations/greeting-initiator.d.ts +2 -2
- package/dist/src/invitations/greeting-initiator.d.ts.map +1 -1
- package/dist/src/invitations/greeting-initiator.js +2 -1
- 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.js +1 -1
- package/dist/src/invitations/halo-recovery-initiator.js.map +1 -1
- package/dist/src/invitations/invitation-descriptor.js +1 -1
- 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 +6 -8
- 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 +0 -0
- 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 +0 -0
- package/dist/src/packlets/database/database-backend.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/database-backend.js +0 -0
- 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 +5 -0
- package/dist/src/packlets/database/index.js.map +1 -0
- package/dist/src/{database → packlets/database}/item-demuxer.d.ts +3 -2
- package/dist/src/packlets/database/item-demuxer.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/item-demuxer.js +3 -5
- 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 +2 -2
- 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 +0 -0
- 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 +4 -4
- package/dist/src/packlets/database/testing.js.map +1 -0
- package/dist/src/{database → packlets/database}/timeframe-clock.d.ts +0 -0
- package/dist/src/packlets/database/timeframe-clock.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/timeframe-clock.js +0 -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 +11 -8
- package/dist/src/parties/data-party.d.ts.map +1 -1
- package/dist/src/parties/data-party.js +21 -14
- package/dist/src/parties/data-party.js.map +1 -1
- package/dist/src/parties/data-party.test.js +23 -22
- package/dist/src/parties/data-party.test.js.map +1 -1
- package/dist/src/parties/party-factory.d.ts +2 -8
- package/dist/src/parties/party-factory.d.ts.map +1 -1
- package/dist/src/parties/party-factory.js +22 -50
- 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 +4 -5
- package/dist/src/parties/party-manager.js.map +1 -1
- package/dist/src/parties/party-manager.test.js +14 -13
- package/dist/src/parties/party-manager.test.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 +3 -3
- package/dist/src/pipeline/metadata-store.d.ts.map +1 -1
- package/dist/src/pipeline/metadata-store.js +5 -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-core.d.ts +21 -6
- package/dist/src/pipeline/party-core.d.ts.map +1 -1
- package/dist/src/pipeline/party-core.js +14 -17
- package/dist/src/pipeline/party-core.js.map +1 -1
- package/dist/src/pipeline/party-core.test.js +34 -33
- package/dist/src/pipeline/party-core.test.js.map +1 -1
- 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/pipeline/pipeline.d.ts +3 -5
- package/dist/src/pipeline/pipeline.d.ts.map +1 -1
- package/dist/src/pipeline/pipeline.js +8 -11
- package/dist/src/pipeline/pipeline.js.map +1 -1
- package/dist/src/pipeline/pipeline.test.js +4 -5
- package/dist/src/pipeline/pipeline.test.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/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/snapshot-generator.d.ts +2 -2
- 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/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 +18 -18
- package/src/api/index.ts +0 -5
- package/src/api/schema.test.ts +1 -2
- package/src/echo.test.ts +16 -1
- package/src/echo.ts +10 -20
- package/src/halo/contact-manager.ts +3 -2
- package/src/halo/halo-factory.ts +8 -21
- package/src/halo/halo-party.ts +18 -10
- package/src/halo/halo.test.ts +4 -3
- 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 +5 -4
- package/src/invitations/greeting-protocol-provider.ts +5 -9
- package/src/invitations/greeting-responder.ts +15 -17
- package/src/invitations/halo-recovery-initiator.ts +1 -1
- package/src/invitations/invitation-descriptor.ts +1 -1
- package/src/invitations/invitation-factory.ts +8 -5
- package/src/invitations/offline-invitation-claimer.ts +6 -8
- package/src/{database → packlets/database}/data-mirror.test.ts +1 -1
- 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 +0 -0
- 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 +1 -1
- package/src/{database → packlets/database}/item-demuxer.ts +5 -5
- 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 +2 -2
- package/src/{database → packlets/database}/timeframe-clock.ts +0 -0
- package/src/{errors.ts → packlets/errors/index.ts} +0 -0
- package/src/parties/data-party.test.ts +26 -23
- package/src/parties/data-party.ts +23 -16
- package/src/parties/party-factory.ts +28 -75
- package/src/parties/party-manager.test.ts +21 -14
- package/src/parties/party-manager.ts +4 -5
- package/src/pipeline/message-selector.ts +32 -35
- package/src/pipeline/metadata-store.test.ts +8 -4
- package/src/pipeline/metadata-store.ts +5 -5
- package/src/pipeline/party-core.test.ts +37 -40
- package/src/pipeline/party-core.ts +34 -19
- package/src/pipeline/party-processor.ts +23 -15
- package/src/pipeline/pipeline.test.ts +4 -5
- package/src/pipeline/pipeline.ts +12 -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 +13 -17
- 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
|
@@ -10,7 +10,7 @@ import { failUndefined } from '@dxos/debug';
|
|
|
10
10
|
import { DataService } from '@dxos/echo-protocol';
|
|
11
11
|
import { Model } from '@dxos/model-factory';
|
|
12
12
|
|
|
13
|
-
import { Entity } from '
|
|
13
|
+
import { Entity } from './entity';
|
|
14
14
|
import { ItemManager } from './item-manager';
|
|
15
15
|
|
|
16
16
|
const log = debug('dxos:echo-db:data-mirror');
|
|
@@ -18,10 +18,11 @@ import {
|
|
|
18
18
|
SubscribeEntityStreamResponse
|
|
19
19
|
} from '@dxos/echo-protocol';
|
|
20
20
|
|
|
21
|
-
import { Item, Link } from '../api';
|
|
22
21
|
import { EntityNotFoundError } from '../errors';
|
|
22
|
+
import { Item } from './item';
|
|
23
23
|
import { ItemDemuxer } from './item-demuxer';
|
|
24
24
|
import { ItemManager } from './item-manager';
|
|
25
|
+
import { Link } from './link';
|
|
25
26
|
|
|
26
27
|
const log = debug('dxos:echo-db:data-service-host');
|
|
27
28
|
|
|
File without changes
|
|
File without changes
|
|
@@ -10,9 +10,10 @@ import { ModelFactory, TestListModel } from '@dxos/model-factory';
|
|
|
10
10
|
import { ObjectModel } from '@dxos/object-model';
|
|
11
11
|
import { afterTest } from '@dxos/testutils';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { DataServiceHost } from './data-service-host';
|
|
14
14
|
import { Item } from './item';
|
|
15
15
|
import { ItemFilterDeleted } from './selection';
|
|
16
|
+
import { createInMemoryDatabase, createRemoteDatabaseFromDataServiceHost } from './testing';
|
|
16
17
|
|
|
17
18
|
const OBJECT_ORG = 'example:object/org';
|
|
18
19
|
const OBJECT_PERSON = 'example:object/person';
|
|
@@ -10,9 +10,11 @@ import { ItemID, ItemType } from '@dxos/echo-protocol';
|
|
|
10
10
|
import { Model, ModelConstructor, ModelFactory, validateModelClass } from '@dxos/model-factory';
|
|
11
11
|
import { ObjectModel } from '@dxos/object-model';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { DataServiceHost } from './data-service-host';
|
|
14
|
+
import { DatabaseBackend } from './database-backend';
|
|
14
15
|
import { Entity } from './entity';
|
|
15
16
|
import { Item } from './item';
|
|
17
|
+
import { ItemManager } from './item-manager';
|
|
16
18
|
import { Link } from './link';
|
|
17
19
|
import { RootFilter, Selection, createSelection } from './selection';
|
|
18
20
|
|
|
@@ -7,7 +7,7 @@ import { ItemID, ItemType } from '@dxos/echo-protocol';
|
|
|
7
7
|
import { Model, ModelMeta, StateManager } from '@dxos/model-factory';
|
|
8
8
|
import { SubscriptionGroup } from '@dxos/util';
|
|
9
9
|
|
|
10
|
-
import { ItemManager } from '
|
|
10
|
+
import { ItemManager } from './item-manager';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Base class for all ECHO entitities.
|
|
@@ -10,3 +10,8 @@ export * from './item-demuxer';
|
|
|
10
10
|
export * from './item-manager';
|
|
11
11
|
export * from './testing';
|
|
12
12
|
export * from './timeframe-clock';
|
|
13
|
+
export * from './item';
|
|
14
|
+
export * from './link';
|
|
15
|
+
export * from './entity';
|
|
16
|
+
export * from './selection';
|
|
17
|
+
export * from './database';
|
|
@@ -14,7 +14,7 @@ import { createTransform } from '@dxos/feed-store';
|
|
|
14
14
|
import { ModelFactory, TestModel } from '@dxos/model-factory';
|
|
15
15
|
import { ObjectModel } from '@dxos/object-model';
|
|
16
16
|
|
|
17
|
-
import { Item } from '
|
|
17
|
+
import { Item } from './item';
|
|
18
18
|
import { ItemDemuxer } from './item-demuxer';
|
|
19
19
|
import { ItemManager } from './item-manager';
|
|
20
20
|
|
|
@@ -10,10 +10,11 @@ import { failUndefined } from '@dxos/debug';
|
|
|
10
10
|
import { DatabaseSnapshot, IEchoStream, ItemID, ItemSnapshot, LinkSnapshot } from '@dxos/echo-protocol';
|
|
11
11
|
import { createWritable } from '@dxos/feed-store';
|
|
12
12
|
import { Model, ModelFactory, ModelMessage } from '@dxos/model-factory';
|
|
13
|
-
import { jsonReplacer } from '@dxos/util';
|
|
14
13
|
|
|
15
|
-
import { Entity
|
|
14
|
+
import { Entity } from './entity';
|
|
15
|
+
import { Item } from './item';
|
|
16
16
|
import { ItemManager, ModelConstructionOptions } from './item-manager';
|
|
17
|
+
import { Link } from './link';
|
|
17
18
|
|
|
18
19
|
const log = debug('dxos:echo-db:item-demuxer');
|
|
19
20
|
|
|
@@ -46,7 +47,6 @@ export class ItemDemuxer {
|
|
|
46
47
|
// TODO(burdon): Factor out.
|
|
47
48
|
// TODO(burdon): Should this implement some "back-pressure" (hints) to the PartyProcessor?
|
|
48
49
|
return createWritable<IEchoStream>(async (message: IEchoStream) => {
|
|
49
|
-
log('Reading:', JSON.stringify(message, jsonReplacer));
|
|
50
50
|
const { data: { itemId, genesis, itemMutation, mutation, snapshot }, meta } = message;
|
|
51
51
|
assert(itemId);
|
|
52
52
|
|
|
@@ -187,7 +187,7 @@ export class ItemDemuxer {
|
|
|
187
187
|
* Sort based on parents.
|
|
188
188
|
* @param items
|
|
189
189
|
*/
|
|
190
|
-
export
|
|
190
|
+
export const sortItemsTopologically = (items: ItemSnapshot[]): ItemSnapshot[] => {
|
|
191
191
|
const snapshots: ItemSnapshot[] = [];
|
|
192
192
|
const seenIds = new Set<ItemID>();
|
|
193
193
|
|
|
@@ -206,4 +206,4 @@ export function sortItemsTopologically (items: ItemSnapshot[]): ItemSnapshot[] {
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
return snapshots;
|
|
209
|
-
}
|
|
209
|
+
};
|
|
File without changes
|
|
@@ -11,8 +11,10 @@ import { timed } from '@dxos/debug';
|
|
|
11
11
|
import { EchoEnvelope, FeedWriter, ItemID, ItemType, mapFeedWriter, ModelSnapshot } from '@dxos/echo-protocol';
|
|
12
12
|
import { Model, ModelFactory, ModelMessage, ModelType, StateManager } from '@dxos/model-factory';
|
|
13
13
|
|
|
14
|
-
import { Entity, Item, Link } from '../api';
|
|
15
14
|
import { UnknownModelError } from '../errors';
|
|
15
|
+
import { Entity } from './entity';
|
|
16
|
+
import { Item } from './item';
|
|
17
|
+
import { Link } from './link';
|
|
16
18
|
|
|
17
19
|
const log = debug('dxos:echo-db:item-manager');
|
|
18
20
|
|
|
@@ -375,7 +377,7 @@ export class ItemManager {
|
|
|
375
377
|
/**
|
|
376
378
|
* Returns a new event that groups all of the updates emitted during single tick into a single event emission.
|
|
377
379
|
*/
|
|
378
|
-
|
|
380
|
+
const debounceEntityUpdateEvent = (event: Event<Entity<any>>): Event<Entity<any>[]> => {
|
|
379
381
|
const debouncedEvent = new Event<Entity<any>[]>();
|
|
380
382
|
|
|
381
383
|
let firing = false;
|
|
@@ -395,4 +397,4 @@ function debounceEntityUpdateEvent (event: Event<Entity<any>>): Event<Entity<any
|
|
|
395
397
|
}));
|
|
396
398
|
|
|
397
399
|
return debouncedEvent;
|
|
398
|
-
}
|
|
400
|
+
};
|
|
@@ -7,10 +7,10 @@ import debug from 'debug';
|
|
|
7
7
|
import { EchoEnvelope, ItemID, ItemMutation, ItemType, FeedWriter } from '@dxos/echo-protocol';
|
|
8
8
|
import { Model, StateManager } from '@dxos/model-factory';
|
|
9
9
|
|
|
10
|
-
import { ItemManager } from '../database';
|
|
11
10
|
import { Entity } from './entity';
|
|
11
|
+
import { ItemManager } from './item-manager';
|
|
12
12
|
import type { Link } from './link';
|
|
13
|
-
import {
|
|
13
|
+
import { createItemSelection, Selection } from './selection';
|
|
14
14
|
|
|
15
15
|
const log = debug('dxos:echo-db:item');
|
|
16
16
|
|
|
@@ -7,9 +7,9 @@ import assert from 'assert';
|
|
|
7
7
|
import { ItemID, ItemType } from '@dxos/echo-protocol';
|
|
8
8
|
import { Model, StateManager } from '@dxos/model-factory';
|
|
9
9
|
|
|
10
|
-
import { ItemManager } from '../database';
|
|
11
10
|
import { Entity } from './entity';
|
|
12
11
|
import { Item } from './item';
|
|
12
|
+
import { ItemManager } from './item-manager';
|
|
13
13
|
|
|
14
14
|
export interface LinkData {
|
|
15
15
|
sourceId: ItemID
|
|
File without changes
|
|
@@ -84,25 +84,21 @@ export const itemFilterToPredicate = (filter: ItemFilter | ItemIdFilter): Predic
|
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
-
export const linkFilterToPredicate = (filter: LinkFilter): Predicate<Link> =>
|
|
88
|
-
return link => (!filter.type || testOneOrMultiple(filter.type, link.type));
|
|
89
|
-
};
|
|
87
|
+
export const linkFilterToPredicate = (filter: LinkFilter): Predicate<Link> => link => (!filter.type || testOneOrMultiple(filter.type, link.type));
|
|
90
88
|
|
|
91
89
|
export const createQueryOptionsFilter = ({
|
|
92
90
|
deleted = ItemFilterDeleted.HIDE_DELETED
|
|
93
|
-
}: QueryOptions): Predicate<Entity> => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
};
|
|
91
|
+
}: QueryOptions): Predicate<Entity> => entity => {
|
|
92
|
+
if (entity.model === null) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
switch (deleted) {
|
|
97
|
+
case ItemFilterDeleted.HIDE_DELETED:
|
|
98
|
+
return !(entity instanceof Item) || !entity.deleted;
|
|
99
|
+
case ItemFilterDeleted.SHOW_DELETED:
|
|
100
|
+
return true;
|
|
101
|
+
case ItemFilterDeleted.SHOW_DELETED_ONLY:
|
|
102
|
+
return entity instanceof Item && entity.deleted;
|
|
103
|
+
}
|
|
108
104
|
};
|
|
File without changes
|
|
@@ -24,9 +24,7 @@ const modelFactory = new ModelFactory().registerModel(ObjectModel);
|
|
|
24
24
|
|
|
25
25
|
const createModel = (id: ItemID) => modelFactory.createModel(ObjectModel.meta.type, id, {}, PublicKey.random());
|
|
26
26
|
|
|
27
|
-
const createItem = (id: ItemID, type: ItemType, parent?: Item<any>) =>
|
|
28
|
-
return new Item(null as any, id, type, createModel(id), undefined, parent);
|
|
29
|
-
};
|
|
27
|
+
const createItem = (id: ItemID, type: ItemType, parent?: Item<any>) => new Item(null as any, id, type, createModel(id), undefined, parent);
|
|
30
28
|
|
|
31
29
|
const createLink = (id: ItemID, type: ItemType, source: Item<any>, target: Item<any>) => {
|
|
32
30
|
const link = new Link(null as any, id, type, createModel(id), {
|
|
@@ -262,17 +260,11 @@ describe('Selection', () => {
|
|
|
262
260
|
test('complex reducer', () => {
|
|
263
261
|
const query = createReducer({ numItems: 0, numLinks: 0 })
|
|
264
262
|
.filter({ type: ITEM_ORG })
|
|
265
|
-
.call((items: Item[], { numItems, ...rest }) => {
|
|
266
|
-
return { ...rest, numItems: numItems + items.length, stage: 'a' };
|
|
267
|
-
})
|
|
263
|
+
.call((items: Item[], { numItems, ...rest }) => ({ ...rest, numItems: numItems + items.length, stage: 'a' }))
|
|
268
264
|
.children({ type: ITEM_PROJECT })
|
|
269
|
-
.call((items: Item[], { numItems, ...rest }) => {
|
|
270
|
-
return { ...rest, numItems: numItems + items.length, stage: 'b' };
|
|
271
|
-
})
|
|
265
|
+
.call((items: Item[], { numItems, ...rest }) => ({ ...rest, numItems: numItems + items.length, stage: 'b' }))
|
|
272
266
|
.links({ type: LINK_MEMBER })
|
|
273
|
-
.call((links: Link[], { numLinks, ...rest }) => {
|
|
274
|
-
return { ...rest, numLinks: numLinks + links.length, stage: 'c' };
|
|
275
|
-
})
|
|
267
|
+
.call((links: Link[], { numLinks, ...rest }) => ({ ...rest, numLinks: numLinks + links.length, stage: 'c' }))
|
|
276
268
|
.target()
|
|
277
269
|
.exec();
|
|
278
270
|
|
|
@@ -57,13 +57,7 @@ export const createSelection = <R>(
|
|
|
57
57
|
* @param update
|
|
58
58
|
* @param value Initial reducer value.
|
|
59
59
|
*/
|
|
60
|
-
export const createItemSelection = <R>(
|
|
61
|
-
root: Item<any>,
|
|
62
|
-
update: Event<Entity[]>,
|
|
63
|
-
value: R
|
|
64
|
-
): Selection<Item<any>, R> => {
|
|
65
|
-
return new Selection(() => [[root], value], update, root, value !== undefined);
|
|
66
|
-
};
|
|
60
|
+
export const createItemSelection = <R>(root: Item<any>, update: Event<Entity[]>, value: R): Selection<Item<any>, R> => new Selection(() => [[root], value], update, root, value !== undefined);
|
|
67
61
|
|
|
68
62
|
/**
|
|
69
63
|
* Selections are used to construct database subscriptions.
|
|
File without changes
|
|
@@ -8,14 +8,14 @@ import { PublicKey } from '@dxos/crypto';
|
|
|
8
8
|
import { EchoEnvelope, MockFeedWriter, Timeframe } from '@dxos/echo-protocol';
|
|
9
9
|
import { ModelFactory } from '@dxos/model-factory';
|
|
10
10
|
|
|
11
|
-
import { Database } from '../api';
|
|
12
11
|
import { DataServiceHost } from './data-service-host';
|
|
13
12
|
import { DataServiceRouter } from './data-service-router';
|
|
13
|
+
import { Database } from './database';
|
|
14
14
|
import { FeedDatabaseBackend, RemoteDatabaseBackend } from './database-backend';
|
|
15
15
|
|
|
16
16
|
export const createInMemoryDatabase = async (modelFactory: ModelFactory) => {
|
|
17
17
|
const feed = new MockFeedWriter<EchoEnvelope>();
|
|
18
|
-
const inboundStream = new Readable({ read () {}, objectMode: true });
|
|
18
|
+
const inboundStream = new Readable({ read: () => {}, objectMode: true });
|
|
19
19
|
feed.written.on(([data, meta]) => inboundStream.push({ data, meta: { ...meta, memberKey: PublicKey.random(), timeframe: new Timeframe([[meta.feedKey, meta.seq]]) } }));
|
|
20
20
|
|
|
21
21
|
const database = new Database(
|
|
File without changes
|
|
File without changes
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import expect from 'expect';
|
|
6
6
|
import { it as test } from 'mocha';
|
|
7
7
|
|
|
8
|
-
import { createKeyAdmitMessage, createPartyGenesisMessage, defaultSecretProvider,
|
|
8
|
+
import { createKeyAdmitMessage, createPartyGenesisMessage, defaultSecretProvider, Keyring, KeyType, codec as haloCodec } from '@dxos/credentials';
|
|
9
9
|
import { PublicKey } from '@dxos/crypto';
|
|
10
10
|
import { codec } from '@dxos/echo-protocol';
|
|
11
11
|
import { FeedStore } from '@dxos/feed-store';
|
|
@@ -22,10 +22,12 @@ import { SnapshotStore } from '../snapshots';
|
|
|
22
22
|
import { DataParty } from './data-party';
|
|
23
23
|
|
|
24
24
|
describe('DataParty', () => {
|
|
25
|
-
const createParty = async (identity: IdentityCredentials, partyKey: PublicKey,
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
const snapshotStore = new SnapshotStore(
|
|
25
|
+
const createParty = async (identity: IdentityCredentials, partyKey: PublicKey, feedHints: PublicKey[]) => {
|
|
26
|
+
|
|
27
|
+
const storage = createStorage('', StorageType.RAM);
|
|
28
|
+
const snapshotStore = new SnapshotStore(storage.directory('snapshots'));
|
|
29
|
+
const metadataStore = new MetadataStore(storage.directory('metadata'));
|
|
30
|
+
const feedStore = new FeedStore(storage.directory('feed'), { valueEncoding: codec });
|
|
29
31
|
const modelFactory = new ModelFactory().registerModel(ObjectModel);
|
|
30
32
|
const networkManager = new NetworkManager();
|
|
31
33
|
const partyFeedProvider = new PartyFeedProvider(metadataStore, identity.keyring, feedStore, partyKey);
|
|
@@ -38,7 +40,7 @@ describe('DataParty', () => {
|
|
|
38
40
|
identity.createCredentialsSigner(),
|
|
39
41
|
identity.preferences,
|
|
40
42
|
networkManager,
|
|
41
|
-
|
|
43
|
+
feedHints
|
|
42
44
|
);
|
|
43
45
|
};
|
|
44
46
|
|
|
@@ -59,8 +61,8 @@ describe('DataParty', () => {
|
|
|
59
61
|
const party = await createParty(identity, partyKey.publicKey, []);
|
|
60
62
|
await party.open();
|
|
61
63
|
|
|
62
|
-
const feed = await party.
|
|
63
|
-
await party.
|
|
64
|
+
const feed = await party.getWriteFeed();
|
|
65
|
+
await party.credentialsWriter.write(createPartyGenesisMessage(
|
|
64
66
|
keyring,
|
|
65
67
|
partyKey,
|
|
66
68
|
feed.key,
|
|
@@ -79,15 +81,16 @@ describe('DataParty', () => {
|
|
|
79
81
|
|
|
80
82
|
const party = await createParty(identity, partyKey.publicKey, []);
|
|
81
83
|
await party.open();
|
|
82
|
-
const feed = await party.
|
|
83
|
-
await party.
|
|
84
|
+
const feed = await party.getWriteFeed();
|
|
85
|
+
await party.credentialsWriter.write(createPartyGenesisMessage(
|
|
84
86
|
keyring,
|
|
85
87
|
partyKey,
|
|
86
88
|
feed.key,
|
|
87
89
|
partyKey
|
|
88
90
|
));
|
|
91
|
+
await party.processor.feedAdded.waitForCount(1);
|
|
89
92
|
|
|
90
|
-
const authenticator = createAuthenticator(party.processor, identity.createCredentialsSigner());
|
|
93
|
+
const authenticator = createAuthenticator(party.processor, identity.createCredentialsSigner(), party.credentialsWriter);
|
|
91
94
|
const credentialsProvider = createCredentialsProvider(identity.createCredentialsSigner(), party.key, feed.key);
|
|
92
95
|
|
|
93
96
|
const wrappedCredentials = haloCodec.decode(credentialsProvider.get());
|
|
@@ -103,14 +106,16 @@ describe('DataParty', () => {
|
|
|
103
106
|
|
|
104
107
|
const party = await createParty(identityA, partyKey.publicKey, []);
|
|
105
108
|
await party.open();
|
|
106
|
-
const feed = await party.
|
|
107
|
-
await party.
|
|
109
|
+
const feed = await party.getWriteFeed();
|
|
110
|
+
await party.credentialsWriter.write(createPartyGenesisMessage(
|
|
108
111
|
keyring,
|
|
109
112
|
partyKey,
|
|
110
113
|
feed.key,
|
|
111
114
|
partyKey
|
|
112
115
|
));
|
|
113
|
-
|
|
116
|
+
await party.processor.feedAdded.waitForCount(1);
|
|
117
|
+
|
|
118
|
+
const authenticator = createAuthenticator(party.processor, identityA.createCredentialsSigner(), party.credentialsWriter);
|
|
114
119
|
|
|
115
120
|
const identityB = await deriveTestDeviceCredentials(identityA);
|
|
116
121
|
const credentialsProvider = createCredentialsProvider(identityB.createCredentialsSigner(), party.key, feed.key);
|
|
@@ -128,14 +133,14 @@ describe('DataParty', () => {
|
|
|
128
133
|
|
|
129
134
|
const partyA = await createParty(identityA, partyKey.publicKey, []);
|
|
130
135
|
await partyA.open();
|
|
131
|
-
const feedA = await partyA.
|
|
132
|
-
await partyA.
|
|
136
|
+
const feedA = await partyA.getWriteFeed();
|
|
137
|
+
await partyA.credentialsWriter.write(createPartyGenesisMessage(
|
|
133
138
|
keyring,
|
|
134
139
|
partyKey,
|
|
135
140
|
feedA.key,
|
|
136
141
|
partyKey
|
|
137
142
|
));
|
|
138
|
-
await partyA.
|
|
143
|
+
await partyA.credentialsWriter.write(createKeyAdmitMessage(
|
|
139
144
|
keyring,
|
|
140
145
|
partyKey.publicKey,
|
|
141
146
|
identityA.identityKey,
|
|
@@ -143,9 +148,7 @@ describe('DataParty', () => {
|
|
|
143
148
|
));
|
|
144
149
|
|
|
145
150
|
const identityB = await deriveTestDeviceCredentials(identityA);
|
|
146
|
-
const partyB = await createParty(identityB, partyKey.publicKey, [
|
|
147
|
-
{ type: KeyType.FEED, publicKey: feedA.key }
|
|
148
|
-
]);
|
|
151
|
+
const partyB = await createParty(identityB, partyKey.publicKey, [feedA.key]);
|
|
149
152
|
await partyB.open();
|
|
150
153
|
|
|
151
154
|
await partyA.database.createItem({ type: 'test:item-a' });
|
|
@@ -164,14 +167,14 @@ describe('DataParty', () => {
|
|
|
164
167
|
|
|
165
168
|
const partyA = await createParty(identityA, partyKeyA.publicKey, []);
|
|
166
169
|
await partyA.open();
|
|
167
|
-
const feedA = await partyA.
|
|
168
|
-
await partyA.
|
|
170
|
+
const feedA = await partyA.getWriteFeed();
|
|
171
|
+
await partyA.credentialsWriter.write(createPartyGenesisMessage(
|
|
169
172
|
identityA.keyring,
|
|
170
173
|
partyKeyA,
|
|
171
174
|
feedA.key,
|
|
172
175
|
partyKeyA
|
|
173
176
|
));
|
|
174
|
-
await partyA.
|
|
177
|
+
await partyA.credentialsWriter.write(createKeyAdmitMessage(
|
|
175
178
|
identityA.keyring,
|
|
176
179
|
partyKeyA.publicKey,
|
|
177
180
|
identityA.identityKey,
|
|
@@ -5,20 +5,22 @@
|
|
|
5
5
|
import assert from 'assert';
|
|
6
6
|
|
|
7
7
|
import { synchronized, Event } from '@dxos/async';
|
|
8
|
-
import { KeyHint } from '@dxos/credentials';
|
|
9
8
|
import { PublicKey } from '@dxos/crypto';
|
|
10
9
|
import { timed } from '@dxos/debug';
|
|
11
10
|
import { PartyKey, PartySnapshot, Timeframe } from '@dxos/echo-protocol';
|
|
11
|
+
import { FeedDescriptor } from '@dxos/feed-store';
|
|
12
12
|
import { ModelFactory } from '@dxos/model-factory';
|
|
13
13
|
import { NetworkManager } from '@dxos/network-manager';
|
|
14
14
|
import { ObjectModel } from '@dxos/object-model';
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import { ResultSet } from '../api';
|
|
17
17
|
import { ActivationOptions, PartyPreferences, Preferences } from '../halo';
|
|
18
18
|
import { InvitationFactory } from '../invitations';
|
|
19
|
+
import { Database, Item } from '../packlets/database';
|
|
19
20
|
import { PartyFeedProvider, PartyProtocolFactory, PartyCore, PartyOptions } from '../pipeline';
|
|
20
21
|
import { createAuthPlugin, createOfflineInvitationPlugin, createAuthenticator, createCredentialsProvider } from '../protocol';
|
|
21
22
|
import { CredentialsSigner } from '../protocol/credentials-signer';
|
|
23
|
+
import { createReplicatorPlugin } from '../protocol/replicator-plugin';
|
|
22
24
|
import { SnapshotStore } from '../snapshots';
|
|
23
25
|
import { CONTACT_DEBOUNCE_INTERVAL } from './party-manager';
|
|
24
26
|
|
|
@@ -54,8 +56,8 @@ export class DataParty {
|
|
|
54
56
|
// TODO(dmaretskyi): Pull this out to a higher level. Should preferences be part of client API instead?
|
|
55
57
|
private readonly _profilePreferences: Preferences | undefined,
|
|
56
58
|
private readonly _networkManager: NetworkManager,
|
|
57
|
-
private readonly
|
|
58
|
-
_initialTimeframe?: Timeframe,
|
|
59
|
+
private readonly _feedHints: PublicKey[] = [],
|
|
60
|
+
private readonly _initialTimeframe?: Timeframe,
|
|
59
61
|
_options: PartyOptions = {}
|
|
60
62
|
) {
|
|
61
63
|
this._partyCore = new PartyCore(
|
|
@@ -64,7 +66,6 @@ export class DataParty {
|
|
|
64
66
|
modelFactory,
|
|
65
67
|
snapshotStore,
|
|
66
68
|
this._credentialsSigner.getIdentityKey().publicKey,
|
|
67
|
-
_initialTimeframe,
|
|
68
69
|
_options
|
|
69
70
|
);
|
|
70
71
|
|
|
@@ -125,14 +126,8 @@ export class DataParty {
|
|
|
125
126
|
return this._invitationManager;
|
|
126
127
|
}
|
|
127
128
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
return this._feedProvider;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
get preferences (): PartyPreferences {
|
|
134
|
-
assert(this._preferences, 'Preferences not available.');
|
|
135
|
-
return this._preferences;
|
|
129
|
+
get credentialsWriter () {
|
|
130
|
+
return this._partyCore.credentialsWriter;
|
|
136
131
|
}
|
|
137
132
|
|
|
138
133
|
get title () {
|
|
@@ -155,11 +150,15 @@ export class DataParty {
|
|
|
155
150
|
return this;
|
|
156
151
|
}
|
|
157
152
|
|
|
158
|
-
await this._partyCore.open(
|
|
153
|
+
await this._partyCore.open({
|
|
154
|
+
feedHints: this._feedHints,
|
|
155
|
+
initialTimeframe: this._initialTimeframe
|
|
156
|
+
});
|
|
159
157
|
|
|
160
158
|
this._invitationManager = new InvitationFactory(
|
|
161
159
|
this._partyCore.processor,
|
|
162
160
|
this._credentialsSigner,
|
|
161
|
+
this._partyCore.credentialsWriter,
|
|
163
162
|
this._networkManager
|
|
164
163
|
);
|
|
165
164
|
|
|
@@ -173,13 +172,13 @@ export class DataParty {
|
|
|
173
172
|
this._protocol = new PartyProtocolFactory(
|
|
174
173
|
this._partyCore.key,
|
|
175
174
|
this._networkManager,
|
|
176
|
-
this._feedProvider,
|
|
177
175
|
deviceKey.publicKey,
|
|
178
176
|
createCredentialsProvider(this._credentialsSigner, this._partyCore.key, writeFeed.key)
|
|
179
177
|
);
|
|
180
178
|
|
|
181
179
|
await this._protocol.start([
|
|
182
|
-
|
|
180
|
+
createReplicatorPlugin(this._feedProvider),
|
|
181
|
+
createAuthPlugin(createAuthenticator(this._partyCore.processor, this._credentialsSigner, this.credentialsWriter), deviceKey.publicKey),
|
|
183
182
|
createOfflineInvitationPlugin(this._invitationManager, deviceKey.publicKey)
|
|
184
183
|
]);
|
|
185
184
|
|
|
@@ -210,6 +209,14 @@ export class DataParty {
|
|
|
210
209
|
return this;
|
|
211
210
|
}
|
|
212
211
|
|
|
212
|
+
async getWriteFeed (): Promise<FeedDescriptor> {
|
|
213
|
+
return this._feedProvider.createOrOpenWritableFeed();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
getFeeds (): FeedDescriptor[] {
|
|
217
|
+
return this._feedProvider.getFeeds();
|
|
218
|
+
}
|
|
219
|
+
|
|
213
220
|
get isActive (): boolean {
|
|
214
221
|
assert(this._preferences, 'PartyActivator required');
|
|
215
222
|
return this._preferences.isActive;
|