@dxos/client 2.25.1-dev.be228d10 → 2.26.1-dev.4b9fb0c5

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 (49) hide show
  1. package/dist/src/api/echo-proxy.d.ts.map +1 -1
  2. package/dist/src/api/echo-proxy.js +9 -7
  3. package/dist/src/api/echo-proxy.js.map +1 -1
  4. package/dist/src/api/halo-proxy.d.ts.map +1 -1
  5. package/dist/src/api/halo-proxy.js +14 -11
  6. package/dist/src/api/halo-proxy.js.map +1 -1
  7. package/dist/src/api/party-proxy.d.ts +5 -1
  8. package/dist/src/api/party-proxy.d.ts.map +1 -1
  9. package/dist/src/api/party-proxy.js +12 -6
  10. package/dist/src/api/party-proxy.js.map +1 -1
  11. package/dist/src/client/client-services.test.js +5 -5
  12. package/dist/src/client/client.js +3 -3
  13. package/dist/src/client/client.js.map +1 -1
  14. package/dist/src/client/client.test.js +2 -2
  15. package/dist/src/client/client.test.js.map +1 -1
  16. package/dist/src/client/service-host/services/halo.d.ts +3 -3
  17. package/dist/src/client/service-host/services/halo.d.ts.map +1 -1
  18. package/dist/src/client/service-host/services/halo.js +7 -3
  19. package/dist/src/client/service-host/services/halo.js.map +1 -1
  20. package/dist/src/client/service-host/services/party.d.ts +10 -10
  21. package/dist/src/client/service-host/services/party.js +10 -10
  22. package/dist/src/client/service-host/services/profile.d.ts +6 -6
  23. package/dist/src/client/service-host/services/profile.js +6 -6
  24. package/dist/src/client/service-host/services/services.js +2 -2
  25. package/dist/src/client/service-host/services/system.js +2 -2
  26. package/dist/src/devtools/devtools-host.js +19 -19
  27. package/dist/src/devtools/items.js +2 -2
  28. package/dist/src/devtools/items.js.map +1 -1
  29. package/dist/src/proto/gen/dxos/client.d.ts +21 -21
  30. package/dist/src/proto/gen/dxos/devtools.d.ts +21 -21
  31. package/dist/src/proto/gen/dxos/echo/service.d.ts +3 -3
  32. package/dist/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +19 -19
  34. package/src/api/echo-proxy.ts +11 -7
  35. package/src/api/halo-proxy.ts +16 -11
  36. package/src/api/party-proxy.ts +14 -7
  37. package/src/client/client-services.test.ts +5 -5
  38. package/src/client/client.test.ts +2 -2
  39. package/src/client/client.ts +3 -3
  40. package/src/client/service-host/services/halo.ts +8 -3
  41. package/src/client/service-host/services/party.ts +10 -10
  42. package/src/client/service-host/services/profile.ts +6 -6
  43. package/src/client/service-host/services/services.ts +2 -2
  44. package/src/client/service-host/services/system.ts +2 -2
  45. package/src/devtools/devtools-host.ts +19 -19
  46. package/src/devtools/items.ts +2 -2
  47. package/src/proto/gen/dxos/client.ts +21 -21
  48. package/src/proto/gen/dxos/devtools.ts +21 -21
  49. package/src/proto/gen/dxos/echo/service.ts +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/client",
3
- "version": "2.25.1-dev.be228d10",
3
+ "version": "2.26.1-dev.4b9fb0c5",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "DXOS.org",
6
6
  "main": "dist/src/index.js",
@@ -10,21 +10,21 @@
10
10
  "src"
11
11
  ],
12
12
  "dependencies": {
13
- "@dxos/async": "2.25.1-dev.be228d10",
14
- "@dxos/codec-protobuf": "2.25.1-dev.be228d10",
15
- "@dxos/config": "2.25.1-dev.be228d10",
16
- "@dxos/credentials": "2.25.1-dev.be228d10",
17
- "@dxos/crypto": "2.25.1-dev.be228d10",
18
- "@dxos/debug": "2.25.1-dev.be228d10",
19
- "@dxos/echo-db": "2.25.1-dev.be228d10",
20
- "@dxos/echo-protocol": "2.25.1-dev.be228d10",
21
- "@dxos/feed-store": "2.25.1-dev.be228d10",
22
- "@dxos/model-factory": "2.25.1-dev.be228d10",
23
- "@dxos/network-manager": "2.25.1-dev.be228d10",
24
- "@dxos/object-model": "2.25.1-dev.be228d10",
25
- "@dxos/proto": "2.25.1-dev.be228d10",
26
- "@dxos/rpc": "2.25.1-dev.be228d10",
27
- "@dxos/util": "2.25.1-dev.be228d10",
13
+ "@dxos/async": "2.26.1-dev.4b9fb0c5",
14
+ "@dxos/codec-protobuf": "2.26.1-dev.4b9fb0c5",
15
+ "@dxos/config": "2.26.1-dev.4b9fb0c5",
16
+ "@dxos/credentials": "2.26.1-dev.4b9fb0c5",
17
+ "@dxos/crypto": "2.26.1-dev.4b9fb0c5",
18
+ "@dxos/debug": "2.26.1-dev.4b9fb0c5",
19
+ "@dxos/echo-db": "2.26.1-dev.4b9fb0c5",
20
+ "@dxos/echo-protocol": "2.26.1-dev.4b9fb0c5",
21
+ "@dxos/feed-store": "2.26.1-dev.4b9fb0c5",
22
+ "@dxos/model-factory": "2.26.1-dev.4b9fb0c5",
23
+ "@dxos/network-manager": "2.26.1-dev.4b9fb0c5",
24
+ "@dxos/object-model": "2.26.1-dev.4b9fb0c5",
25
+ "@dxos/proto": "2.26.1-dev.4b9fb0c5",
26
+ "@dxos/rpc": "2.26.1-dev.4b9fb0c5",
27
+ "@dxos/util": "2.26.1-dev.4b9fb0c5",
28
28
  "@polkadot/keyring": "6.11.1",
29
29
  "@polkadot/util": "6.11.1",
30
30
  "@polkadot/util-crypto": "6.11.1",
@@ -41,9 +41,9 @@
41
41
  "uuid": "^8.3.2"
42
42
  },
43
43
  "devDependencies": {
44
- "@dxos/random-access-multi-storage": "2.25.1-dev.be228d10",
45
- "@dxos/testutils": "2.25.0",
46
- "@dxos/toolchain-node-library": "2.25.0",
44
+ "@dxos/random-access-multi-storage": "2.26.1-dev.4b9fb0c5",
45
+ "@dxos/testutils": "2.26.0",
46
+ "@dxos/toolchain-node-library": "2.26.0",
47
47
  "@types/debug": "^4.1.7",
48
48
  "@types/expect": "~24.3.0",
49
49
  "@types/jest": "^26.0.7",
@@ -63,8 +63,10 @@ export class EchoProxy {
63
63
  /**
64
64
  * @internal
65
65
  */
66
- _open () {
67
- const partiesStream = this._serviceProvider.services.PartyService.SubscribeParties();
66
+ async _open () {
67
+ const gotParties = this._partiesChanged.waitForCount(1);
68
+
69
+ const partiesStream = this._serviceProvider.services.PartyService.subscribeParties();
68
70
  partiesStream.subscribe(async data => {
69
71
  for (const party of data.parties ?? []) {
70
72
  if (!this._parties.has(party.publicKey)) {
@@ -79,7 +81,7 @@ export class EchoProxy {
79
81
  }
80
82
  });
81
83
 
82
- const partyStream = this._serviceProvider.services.PartyService.SubscribeToParty({ partyKey: party.publicKey });
84
+ const partyStream = this._serviceProvider.services.PartyService.subscribeToParty({ partyKey: party.publicKey });
83
85
  partyStream.subscribe(async ({ party }) => {
84
86
  if (!party) {
85
87
  return;
@@ -94,6 +96,8 @@ export class EchoProxy {
94
96
  this._partiesChanged.emit();
95
97
  }, () => {});
96
98
  this._subscriptions.push(() => partiesStream.close());
99
+
100
+ await gotParties;
97
101
  }
98
102
 
99
103
  /**
@@ -117,7 +121,7 @@ export class EchoProxy {
117
121
  async createParty (): Promise<Party> {
118
122
  const [partyReceivedPromise, partyReceived] = latch();
119
123
 
120
- const party = await this._serviceProvider.services.PartyService.CreateParty();
124
+ const party = await this._serviceProvider.services.PartyService.createParty();
121
125
 
122
126
  const handler = () => {
123
127
  if (this._parties.has(party.publicKey)) {
@@ -138,7 +142,7 @@ export class EchoProxy {
138
142
  async cloneParty (snapshot: PartySnapshot): Promise<Party> {
139
143
  const [partyReceivedPromise, partyReceived] = latch();
140
144
 
141
- const party = await this._serviceProvider.services.PartyService.CloneParty(snapshot);
145
+ const party = await this._serviceProvider.services.PartyService.cloneParty(snapshot);
142
146
 
143
147
  const handler = () => {
144
148
  if (this._parties.has(party.publicKey)) {
@@ -170,12 +174,12 @@ export class EchoProxy {
170
174
  * To be used with `party.createInvitation` on the inviter side.
171
175
  */
172
176
  acceptInvitation (invitationDescriptor: InvitationDescriptor): PartyInvitation {
173
- const invitationProcessStream = this._serviceProvider.services.PartyService.AcceptInvitation(invitationDescriptor.toProto());
177
+ const invitationProcessStream = this._serviceProvider.services.PartyService.acceptInvitation(invitationDescriptor.toProto());
174
178
  const { authenticate, waitForFinish } = InvitationProxy.handleInvitationRedemption({
175
179
  stream: invitationProcessStream,
176
180
  invitationDescriptor,
177
181
  onAuthenticate: async (request) => {
178
- await this._serviceProvider.services.PartyService.AuthenticateInvitation(request);
182
+ await this._serviceProvider.services.PartyService.authenticateInvitation(request);
179
183
  }
180
184
  });
181
185
 
@@ -43,7 +43,7 @@ export class HaloProxy extends InvitationProxy {
43
43
  * Reset the identity and delete all key records.
44
44
  */
45
45
  async reset () {
46
- await this._serviceProvider.services.SystemService.Reset();
46
+ await this._serviceProvider.services.SystemService.reset();
47
47
  this._profileChanged.emit();
48
48
  }
49
49
 
@@ -58,7 +58,7 @@ export class HaloProxy extends InvitationProxy {
58
58
  * @returns User profile info.
59
59
  */
60
60
  async createProfile ({ publicKey, secretKey, username }: CreateProfileOptions = {}): Promise<Profile> {
61
- this._profile = await this._serviceProvider.services.ProfileService.CreateProfile({ publicKey, secretKey, username });
61
+ this._profile = await this._serviceProvider.services.ProfileService.createProfile({ publicKey, secretKey, username });
62
62
  return this._profile;
63
63
  }
64
64
 
@@ -73,7 +73,7 @@ export class HaloProxy extends InvitationProxy {
73
73
  * Joins an existing identity HALO from a recovery seed phrase.
74
74
  */
75
75
  async recoverProfile (seedPhrase: string) {
76
- this._profile = await this._serviceProvider.services.ProfileService.RecoverProfile({ seedPhrase });
76
+ this._profile = await this._serviceProvider.services.ProfileService.recoverProfile({ seedPhrase });
77
77
  return this._profile;
78
78
  }
79
79
 
@@ -86,7 +86,7 @@ export class HaloProxy extends InvitationProxy {
86
86
  * To be used with `client.halo.joinHaloInvitation` on the invitee side.
87
87
  */
88
88
  async createInvitation (): Promise<InvitationRequest> {
89
- const stream = await this._serviceProvider.services.ProfileService.CreateInvitation();
89
+ const stream = await this._serviceProvider.services.ProfileService.createInvitation();
90
90
  return this.createInvitationRequest({ stream });
91
91
  }
92
92
 
@@ -99,12 +99,12 @@ export class HaloProxy extends InvitationProxy {
99
99
  * To be used with `client.halo.createHaloInvitation` on the inviter side.
100
100
  */
101
101
  acceptInvitation (invitationDescriptor: InvitationDescriptor): Invitation {
102
- const invitationProcessStream = this._serviceProvider.services.ProfileService.AcceptInvitation(invitationDescriptor.toProto());
102
+ const invitationProcessStream = this._serviceProvider.services.ProfileService.acceptInvitation(invitationDescriptor.toProto());
103
103
  const { authenticate, waitForFinish } = InvitationProxy.handleInvitationRedemption({
104
104
  stream: invitationProcessStream,
105
105
  invitationDescriptor,
106
106
  onAuthenticate: async (request) => {
107
- await this._serviceProvider.services.ProfileService.AuthenticateInvitation(request);
107
+ await this._serviceProvider.services.ProfileService.authenticateInvitation(request);
108
108
  }
109
109
  });
110
110
 
@@ -121,11 +121,11 @@ export class HaloProxy extends InvitationProxy {
121
121
  }
122
122
 
123
123
  async addKeyRecord (keyRecord: KeyRecord) {
124
- await this._serviceProvider.services.HaloService.AddKeyRecord({ keyRecord });
124
+ await this._serviceProvider.services.HaloService.addKeyRecord({ keyRecord });
125
125
  }
126
126
 
127
127
  async sign (request: SignRequest) {
128
- return await this._serviceProvider.services.HaloService.Sign(request);
128
+ return await this._serviceProvider.services.HaloService.sign(request);
129
129
  }
130
130
 
131
131
  /**
@@ -133,20 +133,25 @@ export class HaloProxy extends InvitationProxy {
133
133
  *
134
134
  * @internal
135
135
  */
136
- _open () {
137
- const profileStream = this._serviceProvider.services.ProfileService.SubscribeProfile();
136
+ async _open () {
137
+ const gotProfile = this._profileChanged.waitForCount(1);
138
+ const gotContacts = this._contactsChanged.waitForCount(1);
139
+
140
+ const profileStream = this._serviceProvider.services.ProfileService.subscribeProfile();
138
141
  profileStream.subscribe(data => {
139
142
  this._profile = data.profile;
140
143
  this._profileChanged.emit();
141
144
  }, () => {});
142
145
  this._subscriptions.push(() => profileStream.close());
143
146
 
144
- const contactsStream = this._serviceProvider.services.HaloService.SubscribeContacts();
147
+ const contactsStream = this._serviceProvider.services.HaloService.subscribeContacts();
145
148
  contactsStream.subscribe(data => {
146
149
  this._contacts = data.contacts as PartyMember[];
147
150
  this._contactsChanged.emit();
148
151
  }, () => {});
149
152
  this._subscriptions.push(() => contactsStream.close());
153
+
154
+ await Promise.all([gotProfile, gotContacts]);
150
155
  }
151
156
 
152
157
  /**
@@ -5,7 +5,7 @@
5
5
  import { PublicKey } from '@dxos/crypto';
6
6
  import { failUndefined } from '@dxos/debug';
7
7
  import {
8
- ActivationOptions, Database, PARTY_ITEM_TYPE, PARTY_TITLE_PROPERTY, RemoteDatabaseBackend
8
+ ActivationOptions, Database, PARTY_ITEM_TYPE, PARTY_TITLE_PROPERTY, RemoteDatabaseBackend, RootSelector
9
9
  } from '@dxos/echo-db';
10
10
  import { PartyKey } from '@dxos/echo-protocol';
11
11
  import { ModelFactory } from '@dxos/model-factory';
@@ -109,7 +109,7 @@ export class Party extends InvitationProxy {
109
109
  }
110
110
 
111
111
  async setOpen (open: boolean) {
112
- await this._serviceProvider.services.PartyService.SetPartyState({
112
+ await this._serviceProvider.services.PartyService.setPartyState({
113
113
  partyKey: this.key,
114
114
  open
115
115
  });
@@ -118,13 +118,20 @@ export class Party extends InvitationProxy {
118
118
  async setActive (active: boolean, options: ActivationOptions) {
119
119
  const activeGlobal = options.global ? active : undefined;
120
120
  const activeDevice = options.device ? active : undefined;
121
- await this._serviceProvider.services.PartyService.SetPartyState({
121
+ await this._serviceProvider.services.PartyService.setPartyState({
122
122
  partyKey: this.key,
123
123
  activeGlobal,
124
124
  activeDevice
125
125
  });
126
126
  }
127
127
 
128
+ /**
129
+ * Returns a selection context, which can be used to traverse the object graph.
130
+ */
131
+ get select (): RootSelector {
132
+ return this.database.select.bind(this.database);
133
+ }
134
+
128
135
  /**
129
136
  * Creates an invitation to a given party.
130
137
  * The Invitation flow requires the inviter and invitee to be online at the same time.
@@ -136,13 +143,13 @@ export class Party extends InvitationProxy {
136
143
  * @param inviteeKey Public key of the invitee. In this case no secret exchange is required, but only the specified recipient can accept the invitation.
137
144
  */
138
145
  async createInvitation ({ inviteeKey }: CreationInvitationOptions = {}): Promise<InvitationRequest> {
139
- const stream = this._serviceProvider.services.PartyService.CreateInvitation({ partyKey: this.key, inviteeKey });
146
+ const stream = this._serviceProvider.services.PartyService.createInvitation({ partyKey: this.key, inviteeKey });
140
147
  return this.createInvitationRequest({ stream });
141
148
  }
142
149
 
143
150
  queryMembers () {
144
151
  return streamToResultSet(
145
- this._serviceProvider.services.PartyService.SubscribeMembers({ partyKey: this.key }),
152
+ this._serviceProvider.services.PartyService.subscribeMembers({ partyKey: this.key }),
146
153
  (response) => response?.members ?? []
147
154
  );
148
155
  }
@@ -164,11 +171,11 @@ export class Party extends InvitationProxy {
164
171
  }
165
172
 
166
173
  private getPropertiesItem () {
167
- const items = this.database.select(s => s.filter({ type: PARTY_ITEM_TYPE }).items).getValue();
174
+ const items = this.database.select({ type: PARTY_ITEM_TYPE }).query().result;
168
175
  return items[0];
169
176
  }
170
177
 
171
178
  createSnapshot () {
172
- return this._serviceProvider.services.PartyService.CreateSnapshot({ partyKey: this.key });
179
+ return this._serviceProvider.services.PartyService.createSnapshot({ partyKey: this.key });
173
180
  }
174
181
  }
@@ -31,24 +31,24 @@ describe('Client Services', () => {
31
31
  const invitee = await setup();
32
32
  afterTest(() => invitee.client.destroy());
33
33
 
34
- await inviter.services.ProfileService.CreateProfile({ username: 'test-user' });
34
+ await inviter.services.ProfileService.createProfile({ username: 'test-user' });
35
35
 
36
36
  const invitation = await new Promise<InvitationRequest>((resolve, reject) => {
37
- inviter.services.ProfileService.CreateInvitation().subscribe(resolve, reject);
37
+ inviter.services.ProfileService.createInvitation().subscribe(resolve, reject);
38
38
  });
39
39
  assert(invitation.descriptor);
40
40
 
41
41
  const redeemedInvitation = await new Promise<RedeemedInvitation>((resolve, reject) => {
42
- invitee.services.ProfileService.AcceptInvitation(invitation.descriptor!).subscribe(resolve, reject);
42
+ invitee.services.ProfileService.acceptInvitation(invitation.descriptor!).subscribe(resolve, reject);
43
43
  });
44
44
 
45
- await invitee.services.ProfileService.AuthenticateInvitation({
45
+ await invitee.services.ProfileService.authenticateInvitation({
46
46
  processId: redeemedInvitation.id,
47
47
  secret: invitation.descriptor.secret
48
48
  });
49
49
 
50
50
  const [inviteeProfileLatch, inviteeProfileTrigger] = latch();
51
- invitee.services.ProfileService.SubscribeProfile().subscribe(inviteeProfile => {
51
+ invitee.services.ProfileService.subscribeProfile().subscribe(inviteeProfile => {
52
52
  if (inviteeProfile.profile?.username === 'test-user') {
53
53
  inviteeProfileTrigger();
54
54
  }
@@ -309,8 +309,8 @@ describe('Client', () => {
309
309
  client.registerModel(TestModel);
310
310
 
311
311
  const party = client.echo.queryParties().first;
312
- const selection = party.database.select(s => s.filter({ type: 'test' }).items);
313
- await selection.update.waitForCondition(() => selection.getValue().length > 0);
312
+ const selection = party.database.select({ type: 'test' }).query();
313
+ await selection.update.waitForCondition(() => selection.result.length > 0);
314
314
 
315
315
  const item = selection.expectOne();
316
316
 
@@ -169,8 +169,8 @@ export class Client {
169
169
  this._halo = new HaloProxy(this._serviceProvider);
170
170
  this._echo = new EchoProxy(this._serviceProvider);
171
171
 
172
- this._halo._open();
173
- this._echo._open();
172
+ await this._halo._open();
173
+ await this._echo._open();
174
174
 
175
175
  this._initialized = true; // TODO(burdon): Initialized === halo.initialized?
176
176
  clearInterval(timeout);
@@ -233,7 +233,7 @@ export class Client {
233
233
  // Recreate echo instance? Big impact on hooks. Test.
234
234
  @synchronized
235
235
  async reset () {
236
- await this.services.SystemService.Reset();
236
+ await this.services.SystemService.reset();
237
237
  this._initialized = false;
238
238
  }
239
239
 
@@ -19,11 +19,16 @@ import { CreateServicesOpts } from './interfaces';
19
19
  export class HaloService implements IHaloService {
20
20
  constructor (private echo: ECHO) {}
21
21
 
22
- SubscribeContacts (): Stream<Contacts> {
22
+ subscribeContacts (): Stream<Contacts> {
23
23
  if (this.echo.halo.isInitialized) {
24
24
  return resultSetToStream(this.echo.halo.queryContacts(), (contacts): Contacts => ({ contacts }));
25
25
  } else {
26
26
  return new Stream(({ next }) => {
27
+ // If profile does not exist, send an empty array.
28
+ if (!this.echo.halo.isInitialized) {
29
+ next({ contacts: [] });
30
+ }
31
+
27
32
  const subGroup = new SubscriptionGroup();
28
33
 
29
34
  setImmediate(async () => {
@@ -39,7 +44,7 @@ export class HaloService implements IHaloService {
39
44
  }
40
45
  }
41
46
 
42
- async AddKeyRecord (request: AddKeyRecordRequest): Promise<void> {
47
+ async addKeyRecord (request: AddKeyRecordRequest): Promise<void> {
43
48
  assert(request.keyRecord && request.keyRecord.publicKey, 'Missing key record.');
44
49
  await this.echo.halo.keyring.addKeyRecord(request.keyRecord);
45
50
  assert(await this.echo.halo.keyring.getKey(request.keyRecord.publicKey), 'Key not inserted correctly.');
@@ -59,7 +64,7 @@ export class HaloService implements IHaloService {
59
64
  };
60
65
  }
61
66
 
62
- async Sign (request: SignRequest): Promise<SignResponse> {
67
+ async sign (request: SignRequest): Promise<SignResponse> {
63
68
  assert(request.publicKey, 'Provide a publicKey of the key that should be used for signing.');
64
69
  const key = await this.echo.halo.keyring.getFullKey(request.publicKey);
65
70
  assert(key, 'Key not found.');
@@ -37,7 +37,7 @@ class PartyService implements IPartyService {
37
37
 
38
38
  constructor (private echo: ECHO) {}
39
39
 
40
- SubscribeToParty (request: SubscribePartyRequest): Stream<SubscribePartyResponse> {
40
+ subscribeToParty (request: SubscribePartyRequest): Stream<SubscribePartyResponse> {
41
41
  const update = (next: (message: SubscribePartyResponse) => void) => {
42
42
  try {
43
43
  const party = this.echo.getParty(request.partyKey);
@@ -83,7 +83,7 @@ class PartyService implements IPartyService {
83
83
  }
84
84
  }
85
85
 
86
- SubscribeParties () {
86
+ subscribeParties () {
87
87
  return resultSetToStream(this.echo.queryParties(), (parties): SubscribePartiesResponse => {
88
88
  return ({
89
89
  parties: parties.map(party => ({
@@ -96,7 +96,7 @@ class PartyService implements IPartyService {
96
96
  });
97
97
  }
98
98
 
99
- async CreateParty () {
99
+ async createParty () {
100
100
  const party = await this.echo.createParty();
101
101
  return {
102
102
  publicKey: party.key,
@@ -105,7 +105,7 @@ class PartyService implements IPartyService {
105
105
  };
106
106
  }
107
107
 
108
- async CloneParty (snapshot: PartySnapshot): Promise<Party> {
108
+ async cloneParty (snapshot: PartySnapshot): Promise<Party> {
109
109
  const party = await this.echo.cloneParty(snapshot);
110
110
  return {
111
111
  publicKey: party.key,
@@ -114,7 +114,7 @@ class PartyService implements IPartyService {
114
114
  };
115
115
  }
116
116
 
117
- async SetPartyState (request: SetPartyStateRequest) {
117
+ async setPartyState (request: SetPartyStateRequest) {
118
118
  const party = this.echo.getParty(request.partyKey);
119
119
  if (!party) {
120
120
  throw new Error('Party not found');
@@ -144,7 +144,7 @@ class PartyService implements IPartyService {
144
144
  };
145
145
  }
146
146
 
147
- CreateInvitation (request: CreateInvitationRequest): Stream<InvitationRequest> {
147
+ createInvitation (request: CreateInvitationRequest): Stream<InvitationRequest> {
148
148
  return new Stream(({ next, close }) => {
149
149
  const party = this.echo.getParty(request.partyKey) ?? raise(new PartyNotFoundError(request.partyKey));
150
150
  setImmediate(async () => {
@@ -185,7 +185,7 @@ class PartyService implements IPartyService {
185
185
  });
186
186
  }
187
187
 
188
- AcceptInvitation (request: InvitationDescriptorProto): Stream<RedeemedInvitation> {
188
+ acceptInvitation (request: InvitationDescriptorProto): Stream<RedeemedInvitation> {
189
189
  return new Stream(({ next, close }) => {
190
190
  const id = v4();
191
191
  const [secretLatch, secretTrigger] = latch();
@@ -221,7 +221,7 @@ class PartyService implements IPartyService {
221
221
  });
222
222
  }
223
223
 
224
- async AuthenticateInvitation (request: AuthenticateInvitationRequest) {
224
+ async authenticateInvitation (request: AuthenticateInvitationRequest) {
225
225
  assert(request.processId, 'Process ID is missing.');
226
226
  const invitation = this.inviteeInvitations.get(request.processId);
227
227
  assert(invitation, 'Invitation not found.');
@@ -232,7 +232,7 @@ class PartyService implements IPartyService {
232
232
  invitation.secretTrigger?.();
233
233
  }
234
234
 
235
- SubscribeMembers (request: SubscribeMembersRequest): Stream<SubscribeMembersResponse> {
235
+ subscribeMembers (request: SubscribeMembersRequest): Stream<SubscribeMembersResponse> {
236
236
  const party = this.echo.getParty(request.partyKey);
237
237
  if (party) {
238
238
  return resultSetToStream(party.queryMembers(), (members): SubscribeMembersResponse => ({ members }));
@@ -256,7 +256,7 @@ class PartyService implements IPartyService {
256
256
  }
257
257
  }
258
258
 
259
- async CreateSnapshot (request: CreateSnaspotRequest): Promise<PartySnapshot> {
259
+ async createSnapshot (request: CreateSnaspotRequest): Promise<PartySnapshot> {
260
260
  assert(request.partyKey);
261
261
  const party = this.echo.getParty(request.partyKey) ?? raise(new PartyNotFoundError(request.partyKey));
262
262
  return party.createSnapshot();
@@ -21,7 +21,7 @@ export class ProfileService implements IProfileService {
21
21
 
22
22
  constructor (private echo: ECHO) {}
23
23
 
24
- SubscribeProfile (): Stream<SubscribeProfileResponse> {
24
+ subscribeProfile (): Stream<SubscribeProfileResponse> {
25
25
  return new Stream(({ next }) => {
26
26
  const emitNext = () => next({
27
27
  profile: this.echo.halo.isInitialized ? this.echo.halo.getProfile() : undefined
@@ -32,11 +32,11 @@ export class ProfileService implements IProfileService {
32
32
  });
33
33
  }
34
34
 
35
- async CreateProfile (request: CreateProfileRequest) {
35
+ async createProfile (request: CreateProfileRequest) {
36
36
  return this.echo.halo.createProfile(request);
37
37
  }
38
38
 
39
- async RecoverProfile (request: RecoverProfileRequest): Promise<Profile> {
39
+ async recoverProfile (request: RecoverProfileRequest): Promise<Profile> {
40
40
  if (!request.seedPhrase) {
41
41
  throw new Error('Recovery SeedPhrase not provided.');
42
42
  }
@@ -47,7 +47,7 @@ export class ProfileService implements IProfileService {
47
47
  return profile;
48
48
  }
49
49
 
50
- CreateInvitation (): Stream<InvitationRequest> {
50
+ createInvitation (): Stream<InvitationRequest> {
51
51
  return new Stream(({ next, close }) => {
52
52
  setImmediate(async () => {
53
53
  const secret = Buffer.from(generatePasscode());
@@ -71,7 +71,7 @@ export class ProfileService implements IProfileService {
71
71
  });
72
72
  }
73
73
 
74
- AcceptInvitation (request: InvitationDescriptorProto): Stream<RedeemedInvitation> {
74
+ acceptInvitation (request: InvitationDescriptorProto): Stream<RedeemedInvitation> {
75
75
  return new Stream(({ next, close }) => {
76
76
  const id = v4();
77
77
  const [secretLatch, secretTrigger] = latch();
@@ -101,7 +101,7 @@ export class ProfileService implements IProfileService {
101
101
  });
102
102
  }
103
103
 
104
- async AuthenticateInvitation (request: AuthenticateInvitationRequest) {
104
+ async authenticateInvitation (request: AuthenticateInvitationRequest) {
105
105
  assert(request.processId, 'Process ID is missing.');
106
106
  const invitation = this.inviteeInvitations.get(request.processId);
107
107
  assert(invitation, 'Invitation not found.');
@@ -17,10 +17,10 @@ export const createServices = (opts: CreateServicesOpts): Omit<ClientServices, '
17
17
  PartyService: createPartyService(opts),
18
18
  DataService: opts.echo.dataService,
19
19
  TracingService: {
20
- SetTracingOptions: () => {
20
+ setTracingOptions: () => {
21
21
  throw new Error('Tracing not available');
22
22
  },
23
- SubscribeToRpcTrace: () => {
23
+ subscribeToRpcTrace: () => {
24
24
  throw new Error('Tracing not available');
25
25
  }
26
26
  }
@@ -7,7 +7,7 @@ import { CreateServicesOpts } from './interfaces';
7
7
 
8
8
  export const createSystemService = ({ config, echo }: CreateServicesOpts): SystemService => {
9
9
  return {
10
- GetConfig: async () => {
10
+ getConfig: async () => {
11
11
  return {
12
12
  ...config.values,
13
13
  build: {
@@ -16,7 +16,7 @@ export const createSystemService = ({ config, echo }: CreateServicesOpts): Syste
16
16
  }
17
17
  };
18
18
  },
19
- Reset: async () => {
19
+ reset: async () => {
20
20
  await echo.reset();
21
21
  }
22
22
  };
@@ -24,68 +24,68 @@ import { resetStorage } from './storage';
24
24
 
25
25
  export const createDevtoolsHost = (context: DevtoolsServiceDependencies, events: DevtoolsHostEvents) : DevtoolsHost => {
26
26
  return {
27
- Events: () => {
27
+ events: () => {
28
28
  return new Stream<ClientAPIEvent>(({ next }) => {
29
29
  events.ready.on(() => {
30
30
  next({ ready: {} });
31
31
  });
32
32
  });
33
33
  },
34
- GetConfig: async () => {
34
+ getConfig: async () => {
35
35
  const config = getConfig(context);
36
36
  return config;
37
37
  },
38
- ResetStorage: async () => {
38
+ resetStorage: async () => {
39
39
  await resetStorage(context);
40
40
  },
41
- EnableDebugLogging: async (request) => {
41
+ enableDebugLogging: async (request) => {
42
42
  enableDebugLogging(context, request);
43
43
  return {};
44
44
  },
45
- DisableDebugLogging: async () => {
45
+ disableDebugLogging: async () => {
46
46
  disableDebugLogging(context);
47
47
  return {};
48
48
  },
49
- SubscribeToKeyringKeys: () => {
49
+ subscribeToKeyringKeys: () => {
50
50
  return subscribeToKeyringKeys(context);
51
51
  },
52
- SubscribeToCredentialMessages: (request) => {
52
+ subscribeToCredentialMessages: (request) => {
53
53
  return subscribeToCredentialMessages(context, request);
54
54
  },
55
- SubscribeToParties: () => {
55
+ subscribeToParties: () => {
56
56
  return subscribeToParties(context);
57
57
  },
58
- SubscribeToItems: () => {
58
+ subscribeToItems: () => {
59
59
  return subscribeToItems(context);
60
60
  },
61
- SubscribeToFeeds: () => {
61
+ subscribeToFeeds: () => {
62
62
  return subscribeToFeeds(context);
63
63
  },
64
- SubscribeToFeed: (request) => {
64
+ subscribeToFeed: (request) => {
65
65
  return subscribeToFeed(context, request);
66
66
  },
67
- GetPartySnapshot: async (request) => {
67
+ getPartySnapshot: async (request) => {
68
68
  return getPartySnapshot(context, request);
69
69
  },
70
- SavePartySnapshot: async (request) => {
70
+ savePartySnapshot: async (request) => {
71
71
  return savePartySnapshot(context, request);
72
72
  },
73
- ClearSnapshots: async () => {
73
+ clearSnapshots: async () => {
74
74
  await context.echo.snapshotStore.clear();
75
75
  },
76
- GetNetworkPeers: async (request) => {
76
+ getNetworkPeers: async (request) => {
77
77
  return getNetworkPeers(context, request);
78
78
  },
79
- SubscribeToNetworkTopics: () => {
79
+ subscribeToNetworkTopics: () => {
80
80
  return subscribeToNetworkTopics(context);
81
81
  },
82
- SubscribeToSignalStatus: () => {
82
+ subscribeToSignalStatus: () => {
83
83
  return subscribeToNetworkStatus(context);
84
84
  },
85
- SubscribeToSignalTrace: () => {
85
+ subscribeToSignalTrace: () => {
86
86
  return subscribeToSignalTrace(context);
87
87
  },
88
- SubscribeToSwarmInfo: () => {
88
+ subscribeToSwarmInfo: () => {
89
89
  return subscribeToSwarmInfo(context);
90
90
  }
91
91
  };
@@ -19,7 +19,7 @@ const getData = (echo: DevtoolsServiceDependencies['echo']): SubscribeToItemsRes
19
19
  items: []
20
20
  };
21
21
 
22
- const items = party.database.select(selection => selection.items).getValue();
22
+ const { result: items } = party.database.select().query();
23
23
  for (const item of items) {
24
24
  partyInfo.items.push({
25
25
  id: item.id,
@@ -48,7 +48,7 @@ export const subscribeToItems = ({ echo }: DevtoolsServiceDependencies) => {
48
48
  const unsubscribe = echo.queryParties().subscribe((parties) => {
49
49
  parties.forEach(party => {
50
50
  if (!partySubscriptions[party.key.toHex()]) {
51
- const sub = party.database.select(selection => selection.items).update.on(() => {
51
+ const sub = party.database.select().query().update.on(() => {
52
52
  // Send updates on items changes.
53
53
  update();
54
54
  });