@dxos/echo-db 2.33.8-dev.8609bc45 → 2.33.9-dev.e605934d

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.
Files changed (141) hide show
  1. package/dist/src/echo.test.js +10 -10
  2. package/dist/src/echo.test.js.map +1 -1
  3. package/dist/src/halo/halo-factory.d.ts +1 -1
  4. package/dist/src/halo/halo-factory.d.ts.map +1 -1
  5. package/dist/src/halo/halo-factory.js +8 -8
  6. package/dist/src/halo/halo-factory.js.map +1 -1
  7. package/dist/src/halo/halo-party.d.ts +4 -6
  8. package/dist/src/halo/halo-party.d.ts.map +1 -1
  9. package/dist/src/halo/halo-party.js +10 -4
  10. package/dist/src/halo/halo-party.js.map +1 -1
  11. package/dist/src/halo/halo.d.ts.map +1 -1
  12. package/dist/src/halo/halo.js +2 -1
  13. package/dist/src/halo/halo.js.map +1 -1
  14. package/dist/src/halo/identity-manager.d.ts.map +1 -1
  15. package/dist/src/halo/identity-manager.js +8 -2
  16. package/dist/src/halo/identity-manager.js.map +1 -1
  17. package/dist/src/halo/party-opener.d.ts.map +1 -1
  18. package/dist/src/halo/party-opener.js +2 -4
  19. package/dist/src/halo/party-opener.js.map +1 -1
  20. package/dist/src/halo/preferences.d.ts.map +1 -1
  21. package/dist/src/halo/preferences.js +3 -6
  22. package/dist/src/halo/preferences.js.map +1 -1
  23. package/dist/src/invitations/greeting-initiator.d.ts +5 -4
  24. package/dist/src/invitations/greeting-initiator.d.ts.map +1 -1
  25. package/dist/src/invitations/greeting-initiator.js +4 -5
  26. package/dist/src/invitations/greeting-initiator.js.map +1 -1
  27. package/dist/src/invitations/greeting-protocol-provider.js +2 -2
  28. package/dist/src/invitations/greeting-protocol-provider.js.map +1 -1
  29. package/dist/src/invitations/greeting-responder.d.ts +4 -7
  30. package/dist/src/invitations/greeting-responder.d.ts.map +1 -1
  31. package/dist/src/invitations/greeting-responder.js +7 -21
  32. package/dist/src/invitations/greeting-responder.js.map +1 -1
  33. package/dist/src/invitations/halo-recovery-initiator.js +2 -2
  34. package/dist/src/invitations/halo-recovery-initiator.js.map +1 -1
  35. package/dist/src/invitations/invitation-descriptor.js +3 -3
  36. package/dist/src/invitations/invitation-descriptor.js.map +1 -1
  37. package/dist/src/invitations/invitation-factory.d.ts +2 -1
  38. package/dist/src/invitations/invitation-factory.d.ts.map +1 -1
  39. package/dist/src/invitations/invitation-factory.js +3 -5
  40. package/dist/src/invitations/invitation-factory.js.map +1 -1
  41. package/dist/src/invitations/offline-invitation-claimer.js +2 -2
  42. package/dist/src/invitations/offline-invitation-claimer.js.map +1 -1
  43. package/dist/src/packlets/database/data-mirror.test.js +1 -1
  44. package/dist/src/packlets/database/data-mirror.test.js.map +1 -1
  45. package/dist/src/packlets/database/item-demuxer.test.js +1 -1
  46. package/dist/src/packlets/database/item-demuxer.test.js.map +1 -1
  47. package/dist/src/packlets/database/testing.js +1 -1
  48. package/dist/src/packlets/database/testing.js.map +1 -1
  49. package/dist/src/packlets/database/timeframe-clock.d.ts +2 -1
  50. package/dist/src/packlets/database/timeframe-clock.d.ts.map +1 -1
  51. package/dist/src/packlets/database/timeframe-clock.js +15 -5
  52. package/dist/src/packlets/database/timeframe-clock.js.map +1 -1
  53. package/dist/src/parties/data-party.d.ts +4 -3
  54. package/dist/src/parties/data-party.d.ts.map +1 -1
  55. package/dist/src/parties/data-party.js +9 -5
  56. package/dist/src/parties/data-party.js.map +1 -1
  57. package/dist/src/parties/data-party.test.js +12 -12
  58. package/dist/src/parties/data-party.test.js.map +1 -1
  59. package/dist/src/parties/party-factory.d.ts +2 -4
  60. package/dist/src/parties/party-factory.d.ts.map +1 -1
  61. package/dist/src/parties/party-factory.js +14 -11
  62. package/dist/src/parties/party-factory.js.map +1 -1
  63. package/dist/src/parties/party-manager.d.ts +1 -1
  64. package/dist/src/parties/party-manager.d.ts.map +1 -1
  65. package/dist/src/parties/party-manager.js +13 -13
  66. package/dist/src/parties/party-manager.js.map +1 -1
  67. package/dist/src/parties/party-manager.test.js +16 -12
  68. package/dist/src/parties/party-manager.test.js.map +1 -1
  69. package/dist/src/pipeline/feed-muxer.d.ts.map +1 -1
  70. package/dist/src/pipeline/feed-muxer.js +3 -3
  71. package/dist/src/pipeline/feed-muxer.js.map +1 -1
  72. package/dist/src/pipeline/feed-muxer.test.js +2 -2
  73. package/dist/src/pipeline/feed-muxer.test.js.map +1 -1
  74. package/dist/src/pipeline/message-selector.d.ts +1 -2
  75. package/dist/src/pipeline/message-selector.d.ts.map +1 -1
  76. package/dist/src/pipeline/message-selector.js +4 -31
  77. package/dist/src/pipeline/message-selector.js.map +1 -1
  78. package/dist/src/pipeline/metadata-store.d.ts +7 -2
  79. package/dist/src/pipeline/metadata-store.d.ts.map +1 -1
  80. package/dist/src/pipeline/metadata-store.js +9 -0
  81. package/dist/src/pipeline/metadata-store.js.map +1 -1
  82. package/dist/src/pipeline/party-feed-provider.d.ts +2 -2
  83. package/dist/src/pipeline/party-feed-provider.d.ts.map +1 -1
  84. package/dist/src/pipeline/party-feed-provider.js +2 -1
  85. package/dist/src/pipeline/party-feed-provider.js.map +1 -1
  86. package/dist/src/pipeline/party-pipeline.d.ts +5 -5
  87. package/dist/src/pipeline/party-pipeline.d.ts.map +1 -1
  88. package/dist/src/pipeline/party-pipeline.js +6 -7
  89. package/dist/src/pipeline/party-pipeline.js.map +1 -1
  90. package/dist/src/pipeline/party-pipeline.test.js +13 -18
  91. package/dist/src/pipeline/party-pipeline.test.js.map +1 -1
  92. package/dist/src/protocol/identity-credentials.d.ts.map +1 -1
  93. package/dist/src/protocol/identity-credentials.js +2 -2
  94. package/dist/src/protocol/identity-credentials.js.map +1 -1
  95. package/dist/src/protocol/party-protocol-factory.js +1 -1
  96. package/dist/src/protocol/party-protocol-factory.js.map +1 -1
  97. package/dist/src/protocol/replicator-plugin.d.ts.map +1 -1
  98. package/dist/src/protocol/replicator-plugin.js +1 -2
  99. package/dist/src/protocol/replicator-plugin.js.map +1 -1
  100. package/dist/src/snapshots/snapshot-generator.js +2 -2
  101. package/dist/src/snapshots/snapshot-generator.js.map +1 -1
  102. package/dist/src/snapshots/snapshot-store.d.ts.map +1 -1
  103. package/dist/src/snapshots/snapshot-store.js +2 -2
  104. package/dist/src/snapshots/snapshot-store.js.map +1 -1
  105. package/dist/tsconfig.tsbuildinfo +1 -1
  106. package/package.json +20 -20
  107. package/src/echo.test.ts +1 -1
  108. package/src/halo/halo-factory.ts +7 -8
  109. package/src/halo/halo-party.ts +14 -6
  110. package/src/halo/halo.ts +3 -1
  111. package/src/halo/identity-manager.ts +11 -2
  112. package/src/halo/party-opener.ts +2 -4
  113. package/src/halo/preferences.ts +4 -8
  114. package/src/invitations/greeting-initiator.ts +10 -5
  115. package/src/invitations/greeting-protocol-provider.ts +2 -2
  116. package/src/invitations/greeting-responder.ts +11 -30
  117. package/src/invitations/halo-recovery-initiator.ts +3 -3
  118. package/src/invitations/invitation-descriptor.ts +5 -5
  119. package/src/invitations/invitation-factory.ts +2 -2
  120. package/src/invitations/offline-invitation-claimer.ts +3 -3
  121. package/src/packlets/database/data-mirror.test.ts +2 -2
  122. package/src/packlets/database/item-demuxer.test.ts +2 -2
  123. package/src/packlets/database/testing.ts +2 -2
  124. package/src/packlets/database/timeframe-clock.ts +4 -1
  125. package/src/parties/data-party.test.ts +12 -12
  126. package/src/parties/data-party.ts +14 -6
  127. package/src/parties/party-factory.ts +20 -12
  128. package/src/parties/party-manager.test.ts +12 -8
  129. package/src/parties/party-manager.ts +14 -12
  130. package/src/pipeline/feed-muxer.test.ts +2 -2
  131. package/src/pipeline/feed-muxer.ts +4 -4
  132. package/src/pipeline/message-selector.ts +4 -35
  133. package/src/pipeline/metadata-store.ts +15 -2
  134. package/src/pipeline/party-feed-provider.ts +2 -2
  135. package/src/pipeline/party-pipeline.test.ts +13 -19
  136. package/src/pipeline/party-pipeline.ts +13 -12
  137. package/src/protocol/identity-credentials.ts +5 -2
  138. package/src/protocol/party-protocol-factory.ts +2 -2
  139. package/src/protocol/replicator-plugin.ts +1 -2
  140. package/src/snapshots/snapshot-generator.ts +1 -1
  141. package/src/snapshots/snapshot-store.ts +2 -2
@@ -7,9 +7,11 @@ import assert from 'assert';
7
7
  import { synchronized } from '@dxos/async';
8
8
  import { KeyType, Message as HaloMessage } from '@dxos/credentials';
9
9
  import { timed } from '@dxos/debug';
10
- import { createFeedWriter, DatabaseSnapshot, FeedSelector, FeedWriter, PartyKey, PartySnapshot, Timeframe } from '@dxos/echo-protocol';
10
+ import {
11
+ createFeedWriter, DatabaseSnapshot, FeedSelector, FeedWriter, PartyKey, PartySnapshot
12
+ } from '@dxos/echo-protocol';
11
13
  import { ModelFactory } from '@dxos/model-factory';
12
- import { PublicKey } from '@dxos/protocols';
14
+ import { PublicKey, Timeframe } from '@dxos/protocols';
13
15
  import { SubscriptionGroup } from '@dxos/util';
14
16
 
15
17
  import { createMessageSelector, PartyProcessor, PartyFeedProvider, FeedMuxer } from '.';
@@ -30,9 +32,9 @@ export interface PipelineOptions {
30
32
 
31
33
  export interface OpenOptions {
32
34
  /**
33
- * Keys of initial feeds needed to bootstrap the party.
35
+ * Initial feed that contains PartyGenesis message and acts as the root for the feed DAG.
34
36
  */
35
- feedHints?: PublicKey[]
37
+ genesisFeedKey: PublicKey
36
38
  /**
37
39
  * Timeframe to start processing feed messages from.
38
40
  */
@@ -123,9 +125,9 @@ export class PartyPipeline {
123
125
  */
124
126
  @synchronized
125
127
  @timed(1_000)
126
- async open (options: OpenOptions = {}) {
128
+ async open (options: OpenOptions) {
127
129
  const {
128
- feedHints = [],
130
+ genesisFeedKey,
129
131
  initialTimeframe,
130
132
  targetTimeframe
131
133
  } = options;
@@ -147,17 +149,16 @@ export class PartyPipeline {
147
149
  void this._feedProvider.createOrOpenReadOnlyFeed(feed);
148
150
  }));
149
151
 
150
- if (feedHints.length > 0) {
151
- await this._partyProcessor.takeHints(feedHints.map(publicKey => ({ publicKey, type: KeyType.FEED })));
152
- }
152
+ // TODO(dmaretskyi): We still need to hint at the genesis feed for some reason, not doing this breaks invitation tests.
153
+ await this._partyProcessor.takeHints([{ type: KeyType.FEED, publicKey: genesisFeedKey }]);
153
154
 
154
155
  //
155
156
  // Pipeline
156
157
  //
157
158
 
158
159
  const iterator = await this._feedProvider.createIterator(
159
- createMessageSelector(this._partyProcessor, this._timeframeClock),
160
- createFeedSelector(this._partyProcessor, feedHints),
160
+ createMessageSelector(this._timeframeClock),
161
+ createFeedSelector(this._partyProcessor, genesisFeedKey),
161
162
  initialTimeframe
162
163
  );
163
164
 
@@ -256,4 +257,4 @@ export class PartyPipeline {
256
257
  }
257
258
  }
258
259
 
259
- const createFeedSelector = (partyProcessor: PartyProcessor, hints: PublicKey[]): FeedSelector => feed => hints.some(hint => hint.equals(feed.key)) || partyProcessor.isFeedAdmitted(feed.key);
260
+ const createFeedSelector = (partyProcessor: PartyProcessor, genesisFeed: PublicKey): FeedSelector => feed => genesisFeed.equals(feed.key) || partyProcessor.isFeedAdmitted(feed.key);
@@ -2,8 +2,11 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- import { createIdentityInfoMessage, createKeyAdmitMessage, createPartyGenesisMessage, KeyChain, KeyRecord, Keyring, KeyType, SignedMessage } from '@dxos/credentials';
6
- import { humanize } from '@dxos/crypto';
5
+ import {
6
+ createIdentityInfoMessage, createKeyAdmitMessage, createPartyGenesisMessage,
7
+ KeyChain, KeyRecord, Keyring, KeyType, SignedMessage
8
+ } from '@dxos/credentials';
9
+ import { humanize } from '@dxos/util';
7
10
 
8
11
  import { ContactManager, Preferences } from '../halo';
9
12
  import { CredentialsSigner } from './credentials-signer';
@@ -4,7 +4,7 @@
4
4
 
5
5
  import debug from 'debug';
6
6
 
7
- import { discoveryKey, keyToString } from '@dxos/crypto';
7
+ import { discoveryKey } from '@dxos/crypto';
8
8
  import { PartyKey } from '@dxos/echo-protocol';
9
9
  import { Protocol } from '@dxos/mesh-protocol';
10
10
  import { MMSTTopology, NetworkManager, Plugin } from '@dxos/network-manager';
@@ -93,7 +93,7 @@ export class PartyProtocolFactory {
93
93
 
94
94
  userSession: {
95
95
  // TODO(burdon): See deprecated `protocolFactory` in HALO.
96
- peerId: keyToString(this._peerId.asBuffer()),
96
+ peerId: this._peerId.toHex(),
97
97
  // TODO(telackey): This ought to be the CredentialsProvider itself, so that fresh credentials can be minted.
98
98
  credentials: this._credentials.get().toString('base64')
99
99
  },
@@ -4,7 +4,6 @@
4
4
 
5
5
  import debug from 'debug';
6
6
 
7
- import { keyToString } from '@dxos/crypto';
8
7
  import { Replicator } from '@dxos/protocol-plugin-replicator';
9
8
 
10
9
  import { PartyFeedProvider } from '../pipeline';
@@ -18,7 +17,7 @@ export const createReplicatorPlugin = (feedProvider: PartyFeedProvider) =>
18
17
  new Replicator({
19
18
  load: async () => {
20
19
  const feeds = feedProvider.getFeeds();
21
- log(`Loading feeds: ${feeds.map(feed => keyToString(feed.key))}`);
20
+ log(`Loading feeds: ${feeds.map(feed => feed.key.toHex())}`);
22
21
  return feeds.map((feed) => ({ discoveryKey: feed.feed.discoveryKey }));
23
22
  },
24
23
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  import debug from 'debug';
6
6
 
7
- import { humanize } from '@dxos/crypto';
7
+ import { humanize } from '@dxos/util';
8
8
 
9
9
  import { TimeframeClock } from '../packlets/database';
10
10
  import { PartyPipeline } from '../pipeline';
@@ -5,8 +5,8 @@
5
5
  import assert from 'assert';
6
6
  import debug from 'debug';
7
7
 
8
- import { keyToString } from '@dxos/crypto';
9
8
  import { schema, PartyKey, PartySnapshot } from '@dxos/echo-protocol';
9
+ import { PublicKey } from '@dxos/protocols';
10
10
  import { Directory } from '@dxos/random-access-multi-storage';
11
11
 
12
12
  const log = debug('dxos:snapshot-store');
@@ -44,7 +44,7 @@ export class SnapshotStore {
44
44
 
45
45
  async save (snapshot: PartySnapshot) {
46
46
  assert(snapshot.partyKey);
47
- const file = this._directory.createOrOpen(keyToString(snapshot.partyKey), { truncate: true, size: 0 });
47
+ const file = this._directory.createOrOpen(PublicKey.stringify(snapshot.partyKey), { truncate: true, size: 0 });
48
48
 
49
49
  try {
50
50
  const data = schema.getCodecForType('dxos.echo.snapshot.PartySnapshot').encode(snapshot);