@dxos/client 2.24.1-dev.98738ed5 → 2.25.1-dev.839e2254

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 (66) 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 +4 -1
  5. package/dist/src/api/halo-proxy.d.ts.map +1 -1
  6. package/dist/src/api/halo-proxy.js +18 -9
  7. package/dist/src/api/halo-proxy.js.map +1 -1
  8. package/dist/src/api/party-proxy.d.ts +5 -1
  9. package/dist/src/api/party-proxy.d.ts.map +1 -1
  10. package/dist/src/api/party-proxy.js +12 -6
  11. package/dist/src/api/party-proxy.js.map +1 -1
  12. package/dist/src/client/client-services.test.js +5 -5
  13. package/dist/src/client/client.js +3 -3
  14. package/dist/src/client/client.js.map +1 -1
  15. package/dist/src/client/client.test.js +2 -2
  16. package/dist/src/client/client.test.js.map +1 -1
  17. package/dist/src/client/service-host/services/halo.d.ts +14 -0
  18. package/dist/src/client/service-host/services/halo.d.ts.map +1 -0
  19. package/dist/src/client/service-host/services/halo.js +73 -0
  20. package/dist/src/client/service-host/services/halo.js.map +1 -0
  21. package/dist/src/client/service-host/services/party.d.ts +10 -10
  22. package/dist/src/client/service-host/services/party.js +10 -10
  23. package/dist/src/client/service-host/services/profile.d.ts +7 -8
  24. package/dist/src/client/service-host/services/profile.d.ts.map +1 -1
  25. package/dist/src/client/service-host/services/profile.js +6 -25
  26. package/dist/src/client/service-host/services/profile.js.map +1 -1
  27. package/dist/src/client/service-host/services/services.d.ts.map +1 -1
  28. package/dist/src/client/service-host/services/services.js +4 -2
  29. package/dist/src/client/service-host/services/services.js.map +1 -1
  30. package/dist/src/client/service-host/services/system.js +2 -2
  31. package/dist/src/devtools/devtools-host.js +19 -19
  32. package/dist/src/devtools/items.js +2 -2
  33. package/dist/src/devtools/items.js.map +1 -1
  34. package/dist/src/interfaces/client-service-provider.d.ts +2 -1
  35. package/dist/src/interfaces/client-service-provider.d.ts.map +1 -1
  36. package/dist/src/interfaces/client-service-provider.js +1 -0
  37. package/dist/src/interfaces/client-service-provider.js.map +1 -1
  38. package/dist/src/proto/gen/dxos/client.d.ts +52 -34
  39. package/dist/src/proto/gen/dxos/client.d.ts.map +1 -1
  40. package/dist/src/proto/gen/dxos/client.js.map +1 -1
  41. package/dist/src/proto/gen/dxos/devtools.d.ts +21 -21
  42. package/dist/src/proto/gen/dxos/echo/service.d.ts +3 -3
  43. package/dist/src/proto/gen/index.d.ts +4 -0
  44. package/dist/src/proto/gen/index.d.ts.map +1 -1
  45. package/dist/src/proto/gen/index.js +1 -1
  46. package/dist/src/proto/gen/index.js.map +1 -1
  47. package/dist/tsconfig.tsbuildinfo +1 -1
  48. package/package.json +22 -19
  49. package/src/api/echo-proxy.ts +11 -7
  50. package/src/api/halo-proxy.ts +24 -10
  51. package/src/api/party-proxy.ts +14 -7
  52. package/src/client/client-services.test.ts +5 -5
  53. package/src/client/client.test.ts +2 -2
  54. package/src/client/client.ts +3 -3
  55. package/src/client/service-host/services/halo.ts +80 -0
  56. package/src/client/service-host/services/party.ts +10 -10
  57. package/src/client/service-host/services/profile.ts +7 -38
  58. package/src/client/service-host/services/services.ts +4 -2
  59. package/src/client/service-host/services/system.ts +2 -2
  60. package/src/devtools/devtools-host.ts +19 -19
  61. package/src/devtools/items.ts +2 -2
  62. package/src/interfaces/client-service-provider.ts +3 -1
  63. package/src/proto/gen/dxos/client.ts +51 -34
  64. package/src/proto/gen/dxos/devtools.ts +21 -21
  65. package/src/proto/gen/dxos/echo/service.ts +3 -3
  66. package/src/proto/gen/index.ts +5 -1
@@ -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
  });
@@ -7,13 +7,14 @@ import { DataService, schema as schemaProtocol } from '@dxos/echo-protocol';
7
7
  import { createServiceBundle } from '@dxos/rpc';
8
8
 
9
9
  import { schema } from '../proto/gen';
10
- import { PartyService, ProfileService, SystemService } from '../proto/gen/dxos/client';
10
+ import { PartyService, ProfileService, SystemService, HaloService } from '../proto/gen/dxos/client';
11
11
  import { DevtoolsHost, TracingService } from '../proto/gen/dxos/devtools';
12
12
 
13
13
  // TODO(burdon): Is there a way to mark TS (generics) so cast isn't required for result of stream?
14
14
  export interface ClientServices {
15
15
  SystemService: SystemService;
16
16
  ProfileService: ProfileService;
17
+ HaloService: HaloService;
17
18
  PartyService: PartyService;
18
19
  DataService: DataService;
19
20
  DevtoolsHost: DevtoolsHost;
@@ -24,6 +25,7 @@ export const clientServiceBundle = createServiceBundle<ClientServices>({
24
25
  SystemService: schema.getService('dxos.client.SystemService'),
25
26
  ProfileService: schema.getService('dxos.client.ProfileService'),
26
27
  PartyService: schema.getService('dxos.client.PartyService'),
28
+ HaloService: schema.getService('dxos.client.HaloService'),
27
29
  // DataService is provided and implemented internally in ECHO so we import it from there.
28
30
  DataService: schemaProtocol.getService('dxos.echo.service.DataService'),
29
31
  DevtoolsHost: schema.getService('dxos.devtools.DevtoolsHost'),
@@ -11,23 +11,8 @@ import * as dxos_halo_keys from "./halo/keys";
11
11
  import * as dxos_rpc from "./rpc";
12
12
  import * as google_protobuf from "../google/protobuf";
13
13
  export interface SystemService {
14
- GetConfig: (request: void) => Promise<dxos_config.Config>;
15
- Reset: (request: void) => Promise<void>;
16
- }
17
- export interface Profile {
18
- publicKey: ReturnType<typeof substitutions["dxos.halo.keys.PubKey"]["decode"]>;
19
- username?: string;
20
- }
21
- export interface SubscribeProfileResponse {
22
- profile?: Profile;
23
- }
24
- export interface CreateProfileRequest {
25
- username?: string;
26
- publicKey?: Uint8Array;
27
- secretKey?: Uint8Array;
28
- }
29
- export interface RecoverProfileRequest {
30
- seedPhrase?: string;
14
+ getConfig: (request: void) => Promise<dxos_config.Config>;
15
+ reset: (request: void) => Promise<void>;
31
16
  }
32
17
  export enum InvitationState {
33
18
  WAITING_FOR_CONNECTION = 1,
@@ -68,6 +53,21 @@ export interface AuthenticateInvitationRequest {
68
53
  processId?: string;
69
54
  secret?: Uint8Array;
70
55
  }
56
+ export interface Profile {
57
+ publicKey: ReturnType<typeof substitutions["dxos.halo.keys.PubKey"]["decode"]>;
58
+ username?: string;
59
+ }
60
+ export interface SubscribeProfileResponse {
61
+ profile?: Profile;
62
+ }
63
+ export interface CreateProfileRequest {
64
+ username?: string;
65
+ publicKey?: Uint8Array;
66
+ secretKey?: Uint8Array;
67
+ }
68
+ export interface RecoverProfileRequest {
69
+ seedPhrase?: string;
70
+ }
71
71
  export interface Contact {
72
72
  publicKey?: ReturnType<typeof substitutions["dxos.halo.keys.PubKey"]["decode"]>;
73
73
  displayName?: string;
@@ -76,13 +76,30 @@ export interface Contacts {
76
76
  contacts?: Contact[];
77
77
  }
78
78
  export interface ProfileService {
79
- SubscribeProfile: (request: void) => Stream<SubscribeProfileResponse>;
80
- CreateProfile: (request: CreateProfileRequest) => Promise<Profile>;
81
- RecoverProfile: (request: RecoverProfileRequest) => Promise<Profile>;
82
- CreateInvitation: (request: void) => Stream<InvitationRequest>;
83
- AcceptInvitation: (request: dxos_echo_invitation.InvitationDescriptor) => Stream<RedeemedInvitation>;
84
- AuthenticateInvitation: (request: AuthenticateInvitationRequest) => Promise<void>;
85
- SubscribeContacts: (request: void) => Stream<Contacts>;
79
+ subscribeProfile: (request: void) => Stream<SubscribeProfileResponse>;
80
+ createProfile: (request: CreateProfileRequest) => Promise<Profile>;
81
+ recoverProfile: (request: RecoverProfileRequest) => Promise<Profile>;
82
+ createInvitation: (request: void) => Stream<InvitationRequest>;
83
+ acceptInvitation: (request: dxos_echo_invitation.InvitationDescriptor) => Stream<RedeemedInvitation>;
84
+ authenticateInvitation: (request: AuthenticateInvitationRequest) => Promise<void>;
85
+ }
86
+ export interface AddKeyRecordRequest {
87
+ keyRecord?: dxos_halo_keys.KeyRecord;
88
+ }
89
+ export interface SignRequest {
90
+ /**
91
+ * - The public key of the key that is supposed to be used for signing.
92
+ */
93
+ publicKey?: ReturnType<typeof substitutions["dxos.halo.keys.PubKey"]["decode"]>;
94
+ payload?: ReturnType<typeof substitutions["google.protobuf.Any"]["decode"]>;
95
+ }
96
+ export interface SignResponse {
97
+ signed?: ReturnType<typeof substitutions["google.protobuf.Any"]["decode"]>;
98
+ }
99
+ export interface HaloService {
100
+ subscribeContacts: (request: void) => Stream<Contacts>;
101
+ addKeyRecord: (request: AddKeyRecordRequest) => Promise<void>;
102
+ sign: (request: SignRequest) => Promise<SignResponse>;
86
103
  }
87
104
  export interface Party {
88
105
  publicKey: ReturnType<typeof substitutions["dxos.halo.keys.PubKey"]["decode"]>;
@@ -138,17 +155,17 @@ export interface CreateSnaspotRequest {
138
155
  partyKey?: ReturnType<typeof substitutions["dxos.halo.keys.PubKey"]["decode"]>;
139
156
  }
140
157
  export interface PartyService {
141
- SubscribeToParty: (request: SubscribePartyRequest) => Stream<SubscribePartyResponse>;
142
- SubscribeParties: (request: void) => Stream<SubscribePartiesResponse>;
143
- CreateParty: (request: void) => Promise<Party>;
144
- CloneParty: (request: dxos_echo_snapshot.PartySnapshot) => Promise<Party>;
158
+ subscribeToParty: (request: SubscribePartyRequest) => Stream<SubscribePartyResponse>;
159
+ subscribeParties: (request: void) => Stream<SubscribePartiesResponse>;
160
+ createParty: (request: void) => Promise<Party>;
161
+ cloneParty: (request: dxos_echo_snapshot.PartySnapshot) => Promise<Party>;
145
162
  /**
146
163
  * Open and close or activate and deactivate a party.
147
164
  */
148
- SetPartyState: (request: SetPartyStateRequest) => Promise<Party>;
149
- CreateInvitation: (request: CreateInvitationRequest) => Stream<InvitationRequest>;
150
- AcceptInvitation: (request: dxos_echo_invitation.InvitationDescriptor) => Stream<RedeemedInvitation>;
151
- AuthenticateInvitation: (request: AuthenticateInvitationRequest) => Promise<void>;
152
- SubscribeMembers: (request: SubscribeMembersRequest) => Stream<SubscribeMembersResponse>;
153
- CreateSnapshot: (request: CreateSnaspotRequest) => Promise<dxos_echo_snapshot.PartySnapshot>;
165
+ setPartyState: (request: SetPartyStateRequest) => Promise<Party>;
166
+ createInvitation: (request: CreateInvitationRequest) => Stream<InvitationRequest>;
167
+ acceptInvitation: (request: dxos_echo_invitation.InvitationDescriptor) => Stream<RedeemedInvitation>;
168
+ authenticateInvitation: (request: AuthenticateInvitationRequest) => Promise<void>;
169
+ subscribeMembers: (request: SubscribeMembersRequest) => Stream<SubscribeMembersResponse>;
170
+ createSnapshot: (request: CreateSnaspotRequest) => Promise<dxos_echo_snapshot.PartySnapshot>;
154
171
  }
@@ -11,25 +11,25 @@ import * as dxos_halo_keys from "./halo/keys";
11
11
  import * as dxos_rpc from "./rpc";
12
12
  import * as google_protobuf from "../google/protobuf";
13
13
  export interface DevtoolsHost {
14
- Events: (request: void) => Stream<Event>;
15
- GetConfig: (request: void) => Promise<GetConfigResponse>;
16
- ResetStorage: (request: ResetStorageRequest) => Promise<void>;
17
- EnableDebugLogging: (request: EnableDebugLoggingRequest) => Promise<EnableDebugLoggingResponse>;
18
- DisableDebugLogging: (request: EnableDebugLoggingRequest) => Promise<EnableDebugLoggingResponse>;
19
- SubscribeToKeyringKeys: (request: SubscribeToKeyringKeysRequest) => Stream<SubscribeToKeyringKeysResponse>;
20
- SubscribeToCredentialMessages: (request: SubscribeToCredentialMessagesRequest) => Stream<SubscribeToCredentialMessagesResponse>;
21
- SubscribeToParties: (request: SubscribeToPartiesRequest) => Stream<SubscribeToPartiesResponse>;
22
- SubscribeToItems: (request: SubscribeToItemsRequest) => Stream<SubscribeToItemsResponse>;
23
- SubscribeToFeeds: (request: SubscribeToFeedsRequest) => Stream<SubscribeToFeedsResponse>;
24
- SubscribeToFeed: (request: SubscribeToFeedRequest) => Stream<SubscribeToFeedResponse>;
25
- GetPartySnapshot: (request: GetPartySnapshotRequest) => Promise<GetPartySnapshotResponse>;
26
- SavePartySnapshot: (request: SavePartySnapshotRequest) => Promise<SavePartySnapshotResponse>;
27
- ClearSnapshots: (request: ClearSnapshotsRequest) => Promise<void>;
28
- GetNetworkPeers: (request: GetNetworkPeersRequest) => Promise<GetNetworkPeersResponse>;
29
- SubscribeToNetworkTopics: (request: void) => Stream<SubscribeToNetworkTopicsResponse>;
30
- SubscribeToSignalStatus: (request: void) => Stream<SubscribeToSignalStatusResponse>;
31
- SubscribeToSignalTrace: (request: void) => Stream<SubscribeToSignalTraceResponse>;
32
- SubscribeToSwarmInfo: (request: SubscribeToSwarmInfoRequest) => Stream<SubscribeToSwarmInfoResponse>;
14
+ events: (request: void) => Stream<Event>;
15
+ getConfig: (request: void) => Promise<GetConfigResponse>;
16
+ resetStorage: (request: ResetStorageRequest) => Promise<void>;
17
+ enableDebugLogging: (request: EnableDebugLoggingRequest) => Promise<EnableDebugLoggingResponse>;
18
+ disableDebugLogging: (request: EnableDebugLoggingRequest) => Promise<EnableDebugLoggingResponse>;
19
+ subscribeToKeyringKeys: (request: SubscribeToKeyringKeysRequest) => Stream<SubscribeToKeyringKeysResponse>;
20
+ subscribeToCredentialMessages: (request: SubscribeToCredentialMessagesRequest) => Stream<SubscribeToCredentialMessagesResponse>;
21
+ subscribeToParties: (request: SubscribeToPartiesRequest) => Stream<SubscribeToPartiesResponse>;
22
+ subscribeToItems: (request: SubscribeToItemsRequest) => Stream<SubscribeToItemsResponse>;
23
+ subscribeToFeeds: (request: SubscribeToFeedsRequest) => Stream<SubscribeToFeedsResponse>;
24
+ subscribeToFeed: (request: SubscribeToFeedRequest) => Stream<SubscribeToFeedResponse>;
25
+ getPartySnapshot: (request: GetPartySnapshotRequest) => Promise<GetPartySnapshotResponse>;
26
+ savePartySnapshot: (request: SavePartySnapshotRequest) => Promise<SavePartySnapshotResponse>;
27
+ clearSnapshots: (request: ClearSnapshotsRequest) => Promise<void>;
28
+ getNetworkPeers: (request: GetNetworkPeersRequest) => Promise<GetNetworkPeersResponse>;
29
+ subscribeToNetworkTopics: (request: void) => Stream<SubscribeToNetworkTopicsResponse>;
30
+ subscribeToSignalStatus: (request: void) => Stream<SubscribeToSignalStatusResponse>;
31
+ subscribeToSignalTrace: (request: void) => Stream<SubscribeToSignalTraceResponse>;
32
+ subscribeToSwarmInfo: (request: SubscribeToSwarmInfoRequest) => Stream<SubscribeToSwarmInfoResponse>;
33
33
  }
34
34
  export interface Event {
35
35
  ready?: ReadyEvent;
@@ -196,6 +196,6 @@ export interface SetTracingOptionsRequest {
196
196
  enable?: boolean;
197
197
  }
198
198
  export interface TracingService {
199
- SetTracingOptions: (request: SetTracingOptionsRequest) => Promise<void>;
200
- SubscribeToRpcTrace: (request: void) => Stream<dxos_rpc.RpcMessage>;
199
+ setTracingOptions: (request: SetTracingOptionsRequest) => Promise<void>;
200
+ subscribeToRpcTrace: (request: void) => Stream<dxos_rpc.RpcMessage>;
201
201
  }
@@ -47,7 +47,7 @@ export interface MutationReceipt {
47
47
  seq?: number;
48
48
  }
49
49
  export interface DataService {
50
- SubscribeEntitySet: (request: SubscribeEntitySetRequest) => Stream<SubscribeEntitySetResponse>;
51
- SubscribeEntityStream: (request: SubscribeEntityStreamRequest) => Stream<SubscribeEntityStreamResponse>;
52
- Write: (request: WriteRequest) => Promise<MutationReceipt>;
50
+ subscribeEntitySet: (request: SubscribeEntitySetRequest) => Stream<SubscribeEntitySetResponse>;
51
+ subscribeEntityStream: (request: SubscribeEntityStreamRequest) => Stream<SubscribeEntityStreamResponse>;
52
+ write: (request: WriteRequest) => Promise<MutationReceipt>;
53
53
  }