@dxos/client-services 0.4.5-main.7620b9e → 0.4.5-main.ab29abe

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.
@@ -31,7 +31,7 @@ __export(testing_exports, {
31
31
  syncItemsLocal: () => syncItemsLocal
32
32
  });
33
33
  module.exports = __toCommonJS(testing_exports);
34
- var import_chunk_42LQCRND = require("../../chunk-42LQCRND.cjs");
34
+ var import_chunk_AD4VYBRQ = require("../../chunk-AD4VYBRQ.cjs");
35
35
  var import_credentials = require("@dxos/credentials");
36
36
  var import_keys = require("@dxos/keys");
37
37
  var import_async = require("@dxos/async");
@@ -209,7 +209,7 @@ var createInvitation = (host, options) => {
209
209
  authMethod: import_services.Invitation.AuthMethod.NONE,
210
210
  ...options ?? {}
211
211
  };
212
- if (host instanceof import_chunk_42LQCRND.ServiceContext) {
212
+ if (host instanceof import_chunk_AD4VYBRQ.ServiceContext) {
213
213
  const hostHandler = host.getInvitationHandler({
214
214
  kind: import_services.Invitation.Kind.SPACE,
215
215
  ...options
@@ -220,7 +220,7 @@ var createInvitation = (host, options) => {
220
220
  };
221
221
  var acceptInvitation = (guest, invitation) => {
222
222
  invitation = sanitizeInvitation(invitation);
223
- if (guest instanceof import_chunk_42LQCRND.ServiceContext) {
223
+ if (guest instanceof import_chunk_AD4VYBRQ.ServiceContext) {
224
224
  const guestHandler = guest.getInvitationHandler({
225
225
  kind: invitation.kind
226
226
  });
@@ -229,7 +229,7 @@ var acceptInvitation = (guest, invitation) => {
229
229
  return guest.join(invitation);
230
230
  };
231
231
  var createServiceHost = (config, signalManagerContext) => {
232
- return new import_chunk_42LQCRND.ClientServicesHost({
232
+ return new import_chunk_AD4VYBRQ.ClientServicesHost({
233
233
  config,
234
234
  signalManager: new import_messaging.MemorySignalManager(signalManagerContext),
235
235
  transportFactory: import_network_manager.MemoryTransportFactory
@@ -243,8 +243,8 @@ var createServiceContext = ({ signalContext = new import_messaging.MemorySignalM
243
243
  signalManager,
244
244
  transportFactory: import_network_manager.MemoryTransportFactory
245
245
  });
246
- const modelFactory = (0, import_chunk_42LQCRND.createDefaultModelFactory)();
247
- return new import_chunk_42LQCRND.ServiceContext(storage, networkManager, signalManager, modelFactory);
246
+ const modelFactory = (0, import_chunk_AD4VYBRQ.createDefaultModelFactory)();
247
+ return new import_chunk_AD4VYBRQ.ServiceContext(storage, networkManager, signalManager, modelFactory);
248
248
  };
249
249
  var createPeers = async (numPeers) => {
250
250
  const signalContext = new import_messaging.MemorySignalManagerContext();
@@ -328,7 +328,7 @@ var TestPeer = class {
328
328
  feedStore: this.feedStore,
329
329
  networkManager: this.networkManager,
330
330
  metadataStore: this.metadataStore,
331
- modelFactory: (0, import_chunk_42LQCRND.createDefaultModelFactory)(),
331
+ modelFactory: (0, import_chunk_AD4VYBRQ.createDefaultModelFactory)(),
332
332
  snapshotStore: this.snapshotStore,
333
333
  blobStore: this.blobStore
334
334
  });
@@ -340,7 +340,7 @@ var TestPeer = class {
340
340
  return this._props.automergeHost ??= new import_echo_pipeline.AutomergeHost(this.storage.createDirectory("automerge"));
341
341
  }
342
342
  get dataSpaceManager() {
343
- return this._props.dataSpaceManager ??= new import_chunk_42LQCRND.DataSpaceManager(this.spaceManager, this.metadataStore, new import_echo_pipeline.DataServiceSubscriptions(), this.keyring, this.identity, this.feedStore, this.automergeHost);
343
+ return this._props.dataSpaceManager ??= new import_chunk_AD4VYBRQ.DataSpaceManager(this.spaceManager, this.metadataStore, new import_echo_pipeline.DataServiceSubscriptions(), this.keyring, this.identity, this.feedStore, this.automergeHost);
344
344
  }
345
345
  async createIdentity() {
346
346
  this._props.signingContext ??= await createSigningContext(this.keyring);
@@ -4,8 +4,9 @@ import { type MetadataStore, type SpaceManager } from '@dxos/echo-pipeline';
4
4
  import { type FeedStore } from '@dxos/feed-store';
5
5
  import { type Keyring } from '@dxos/keyring';
6
6
  import { PublicKey } from '@dxos/keys';
7
+ import { type Device } from '@dxos/protocols/proto/dxos/client/services';
7
8
  import { type FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
8
- import { type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
9
+ import { type DeviceProfileDocument, type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
9
10
  import { Timeframe } from '@dxos/timeframe';
10
11
  import { Identity } from './identity';
11
12
  export type JoinIdentityParams = {
@@ -44,6 +45,7 @@ export declare class IdentityManager {
44
45
  * Update the profile document of an existing identity.
45
46
  */
46
47
  updateProfile(profile: ProfileDocument): Promise<ProfileDocument>;
48
+ updateDeviceProfile(profile: DeviceProfileDocument): Promise<Device>;
47
49
  private _constructIdentity;
48
50
  private _constructSpace;
49
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"identity-manager.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/identity/identity-manager.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAChG,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAgB,KAAK,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACjG,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAK5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQtC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,EAAE,SAAS,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,YAAY,EAAE,SAAS,CAAC;IACxB,kBAAkB,EAAE,SAAS,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AAkB;IA+B/C;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,eAAe;IAiBtC,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;YAqB5D,kBAAkB;YA2ClB,eAAe;CAc9B"}
@@ -1,2 +1,2 @@
1
- export declare const DXOS_VERSION = "0.4.5-main.7620b9e";
1
+ export declare const DXOS_VERSION = "0.4.5-main.ab29abe";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/client-services",
3
- "version": "0.4.5-main.7620b9e",
3
+ "version": "0.4.5-main.ab29abe",
4
4
  "description": "DXOS client services implementation",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -22,44 +22,44 @@
22
22
  ],
23
23
  "dependencies": {
24
24
  "platform": "^1.3.6",
25
- "@dxos/async": "0.4.5-main.7620b9e",
26
- "@dxos/codec-protobuf": "0.4.5-main.7620b9e",
27
- "@dxos/context": "0.4.5-main.7620b9e",
28
- "@dxos/config": "0.4.5-main.7620b9e",
29
- "@dxos/client-protocol": "0.4.5-main.7620b9e",
30
- "@dxos/crypto": "0.4.5-main.7620b9e",
31
- "@dxos/credentials": "0.4.5-main.7620b9e",
32
- "@dxos/debug": "0.4.5-main.7620b9e",
33
- "@dxos/echo-db": "0.4.5-main.7620b9e",
34
- "@dxos/document-model": "0.4.5-main.7620b9e",
35
- "@dxos/echo-pipeline": "0.4.5-main.7620b9e",
36
- "@dxos/echo-schema": "0.4.5-main.7620b9e",
37
- "@dxos/feed-store": "0.4.5-main.7620b9e",
38
- "@dxos/invariant": "0.4.5-main.7620b9e",
39
- "@dxos/lock-file": "0.4.5-main.7620b9e",
40
- "@dxos/keys": "0.4.5-main.7620b9e",
41
- "@dxos/messaging": "0.4.5-main.7620b9e",
42
- "@dxos/keyring": "0.4.5-main.7620b9e",
43
- "@dxos/model-factory": "0.4.5-main.7620b9e",
44
- "@dxos/log": "0.4.5-main.7620b9e",
45
- "@dxos/network-manager": "0.4.5-main.7620b9e",
46
- "@dxos/node-std": "0.4.5-main.7620b9e",
47
- "@dxos/protocols": "0.4.5-main.7620b9e",
48
- "@dxos/random-access-storage": "0.4.5-main.7620b9e",
49
- "@dxos/rpc": "0.4.5-main.7620b9e",
50
- "@dxos/teleport": "0.4.5-main.7620b9e",
51
- "@dxos/teleport-extension-object-sync": "0.4.5-main.7620b9e",
52
- "@dxos/timeframe": "0.4.5-main.7620b9e",
53
- "@dxos/teleport-extension-gossip": "0.4.5-main.7620b9e",
54
- "@dxos/text-model": "0.4.5-main.7620b9e",
55
- "@dxos/tracing": "0.4.5-main.7620b9e",
56
- "@dxos/util": "0.4.5-main.7620b9e",
57
- "@dxos/websocket-rpc": "0.4.5-main.7620b9e"
25
+ "@dxos/async": "0.4.5-main.ab29abe",
26
+ "@dxos/client-protocol": "0.4.5-main.ab29abe",
27
+ "@dxos/codec-protobuf": "0.4.5-main.ab29abe",
28
+ "@dxos/context": "0.4.5-main.ab29abe",
29
+ "@dxos/config": "0.4.5-main.ab29abe",
30
+ "@dxos/credentials": "0.4.5-main.ab29abe",
31
+ "@dxos/crypto": "0.4.5-main.ab29abe",
32
+ "@dxos/debug": "0.4.5-main.ab29abe",
33
+ "@dxos/document-model": "0.4.5-main.ab29abe",
34
+ "@dxos/echo-db": "0.4.5-main.ab29abe",
35
+ "@dxos/echo-pipeline": "0.4.5-main.ab29abe",
36
+ "@dxos/feed-store": "0.4.5-main.ab29abe",
37
+ "@dxos/echo-schema": "0.4.5-main.ab29abe",
38
+ "@dxos/invariant": "0.4.5-main.ab29abe",
39
+ "@dxos/keyring": "0.4.5-main.ab29abe",
40
+ "@dxos/lock-file": "0.4.5-main.ab29abe",
41
+ "@dxos/keys": "0.4.5-main.ab29abe",
42
+ "@dxos/messaging": "0.4.5-main.ab29abe",
43
+ "@dxos/log": "0.4.5-main.ab29abe",
44
+ "@dxos/model-factory": "0.4.5-main.ab29abe",
45
+ "@dxos/network-manager": "0.4.5-main.ab29abe",
46
+ "@dxos/node-std": "0.4.5-main.ab29abe",
47
+ "@dxos/protocols": "0.4.5-main.ab29abe",
48
+ "@dxos/random-access-storage": "0.4.5-main.ab29abe",
49
+ "@dxos/rpc": "0.4.5-main.ab29abe",
50
+ "@dxos/teleport-extension-gossip": "0.4.5-main.ab29abe",
51
+ "@dxos/teleport-extension-object-sync": "0.4.5-main.ab29abe",
52
+ "@dxos/teleport": "0.4.5-main.ab29abe",
53
+ "@dxos/timeframe": "0.4.5-main.ab29abe",
54
+ "@dxos/text-model": "0.4.5-main.ab29abe",
55
+ "@dxos/tracing": "0.4.5-main.ab29abe",
56
+ "@dxos/util": "0.4.5-main.ab29abe",
57
+ "@dxos/websocket-rpc": "0.4.5-main.ab29abe"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/platform": "^1.3.4",
61
61
  "@types/readable-stream": "^2.3.9",
62
- "@dxos/signal": "0.4.5-main.7620b9e"
62
+ "@dxos/signal": "0.4.5-main.ab29abe"
63
63
  },
64
64
  "publishConfig": {
65
65
  "access": "public"
@@ -27,7 +27,18 @@ describe('DevicesService', () => {
27
27
  await serviceContext.close();
28
28
  });
29
29
 
30
- describe.skip('updateDevice', () => {});
30
+ describe('updateDevice', () => {
31
+ test.skip('updates device profile', async () => {
32
+ const query = devicesService.queryDevices();
33
+ const device = await devicesService.updateDevice({ label: 'test-device' });
34
+ const result = new Trigger<Device[] | undefined>();
35
+ query.subscribe(({ devices }) => {
36
+ result.wake(devices);
37
+ });
38
+ afterTest(() => query.close());
39
+ expect(device.profile?.label).to.equal('test-device');
40
+ });
41
+ });
31
42
 
32
43
  describe('queryDevices', () => {
33
44
  test('returns empty list if no identity is available', async () => {
@@ -18,7 +18,7 @@ export class DevicesServiceImpl implements DevicesService {
18
18
  constructor(private readonly _identityManager: IdentityManager) {}
19
19
 
20
20
  async updateDevice(profile: DeviceProfileDocument): Promise<Device> {
21
- throw new Error('Method not implemented.');
21
+ return this._identityManager.updateDeviceProfile(profile);
22
22
  }
23
23
 
24
24
  queryDevices(): Stream<QueryDevicesResponse> {
@@ -163,4 +163,23 @@ describe('identity/identity-manager', () => {
163
163
 
164
164
  expect(!!identity.authorizedDeviceKeys.get(identity.deviceKey)?.platform).is.true;
165
165
  });
166
+
167
+ test('updates device profile', async () => {
168
+ const signalContext = new MemorySignalManagerContext();
169
+
170
+ const peer = await setupPeer({ signalContext });
171
+
172
+ const identity = await peer.identityManager.createIdentity();
173
+
174
+ // Note: Waiting for device profile credential to be processed.
175
+ await identity.stateUpdate.waitForCount(1);
176
+
177
+ const deviceProfile = identity.authorizedDeviceKeys.get(identity.deviceKey);
178
+ expect(deviceProfile).to.exist;
179
+
180
+ deviceProfile!.label = 'updated profile';
181
+ await peer.identityManager.updateDeviceProfile(deviceProfile!);
182
+
183
+ expect(identity.authorizedDeviceKeys.get(identity.deviceKey)?.label).to.equal('updated profile');
184
+ });
166
185
  });
@@ -14,9 +14,14 @@ import { type Keyring } from '@dxos/keyring';
14
14
  import { PublicKey } from '@dxos/keys';
15
15
  import { log } from '@dxos/log';
16
16
  import { trace } from '@dxos/protocols';
17
+ import { type Device, DeviceKind } from '@dxos/protocols/proto/dxos/client/services';
17
18
  import { type FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
18
19
  import { type IdentityRecord, type SpaceMetadata } from '@dxos/protocols/proto/dxos/echo/metadata';
19
- import { AdmittedFeed, type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
20
+ import {
21
+ AdmittedFeed,
22
+ type DeviceProfileDocument,
23
+ type ProfileDocument,
24
+ } from '@dxos/protocols/proto/dxos/halo/credentials';
20
25
  import { Timeframe } from '@dxos/timeframe';
21
26
  import { trace as Trace } from '@dxos/tracing';
22
27
  import { deferFunction } from '@dxos/util';
@@ -224,6 +229,27 @@ export class IdentityManager {
224
229
  return profile;
225
230
  }
226
231
 
232
+ async updateDeviceProfile(profile: DeviceProfileDocument): Promise<Device> {
233
+ invariant(this._identity, 'Identity not initialized.');
234
+
235
+ // TODO(nf): CredentialGenerator doesn't work when not updating own device.
236
+ // const generator = new CredentialGenerator(this._keyring, this._identity.identityKey, this._identity.deviceKey);
237
+ // const credential = await generator.createDeviceProfile(profile);
238
+
239
+ const credential = await this._identity.getIdentityCredentialSigner().createCredential({
240
+ subject: this._identity.deviceKey,
241
+ assertion: {
242
+ '@type': 'dxos.halo.credentials.DeviceProfile',
243
+ profile,
244
+ },
245
+ });
246
+
247
+ const receipt = await this._identity.controlPipeline.writer.write({ credential: { credential } });
248
+ await this._identity.controlPipeline.state.waitUntilTimeframe(new Timeframe([[receipt.feedKey, receipt.seq]]));
249
+ this.stateUpdate.emit();
250
+ return { deviceKey: this._identity.deviceKey, kind: DeviceKind.CURRENT, profile };
251
+ }
252
+
227
253
  private async _constructIdentity(identityRecord: IdentityRecord) {
228
254
  invariant(!this._identity);
229
255
  log('constructing identity', { identityRecord });
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const DXOS_VERSION = "0.4.5-main.7620b9e";
1
+ export const DXOS_VERSION = "0.4.5-main.ab29abe";