@dxos/client-services 0.1.53-main.f5aedb7 → 0.1.53-next.3ab34c0

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 (42) hide show
  1. package/dist/lib/browser/{chunk-PWZ2J6KS.mjs → chunk-F4BHRFH4.mjs} +250 -115
  2. package/dist/lib/browser/chunk-F4BHRFH4.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +20 -59
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/packlets/testing/index.mjs +19 -2
  7. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/index.cjs +274 -179
  9. package/dist/lib/node/index.cjs.map +4 -4
  10. package/dist/lib/node/meta.json +1 -1
  11. package/dist/lib/node/packlets/testing/index.cjs +247 -145
  12. package/dist/lib/node/packlets/testing/index.cjs.map +4 -4
  13. package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
  14. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  15. package/dist/types/src/packlets/services/index.d.ts +1 -0
  16. package/dist/types/src/packlets/services/index.d.ts.map +1 -1
  17. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  18. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  19. package/dist/types/src/packlets/spaces/data-space.d.ts +11 -2
  20. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  21. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +2 -1
  22. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
  23. package/dist/types/src/packlets/spaces/spaces-service.d.ts +1 -1
  24. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  25. package/dist/types/src/packlets/testing/test-builder.d.ts +7 -1
  26. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  27. package/dist/types/src/packlets/vault/worker-session.d.ts.map +1 -1
  28. package/package.json +32 -32
  29. package/src/packlets/identity/authenticator.ts +4 -2
  30. package/src/packlets/identity/identity.ts +21 -26
  31. package/src/packlets/services/index.ts +1 -0
  32. package/src/packlets/services/service-context.ts +9 -7
  33. package/src/packlets/spaces/data-space-manager.test.ts +75 -119
  34. package/src/packlets/spaces/data-space-manager.ts +13 -3
  35. package/src/packlets/spaces/data-space.ts +66 -20
  36. package/src/packlets/spaces/notarization-plugin.test.ts +1 -1
  37. package/src/packlets/spaces/notarization-plugin.ts +5 -1
  38. package/src/packlets/spaces/spaces-service.test.ts +5 -3
  39. package/src/packlets/spaces/spaces-service.ts +26 -8
  40. package/src/packlets/testing/test-builder.ts +35 -2
  41. package/src/packlets/vault/worker-session.ts +5 -4
  42. package/dist/lib/browser/chunk-PWZ2J6KS.mjs.map +0 -7
@@ -5,7 +5,15 @@
5
5
  import { Config } from '@dxos/config';
6
6
  import { Context } from '@dxos/context';
7
7
  import { createCredentialSignerWithChain, CredentialGenerator } from '@dxos/credentials';
8
- import { SnapshotStore, DataPipeline, MetadataStore, SpaceManager, valueEncoding } from '@dxos/echo-pipeline';
8
+ import { failUndefined } from '@dxos/debug';
9
+ import {
10
+ SnapshotStore,
11
+ DataPipeline,
12
+ MetadataStore,
13
+ SpaceManager,
14
+ valueEncoding,
15
+ DataServiceSubscriptions,
16
+ } from '@dxos/echo-pipeline';
9
17
  import { testLocalDatabase } from '@dxos/echo-pipeline/testing';
10
18
  import { FeedFactory, FeedStore } from '@dxos/feed-store';
11
19
  import { Keyring } from '@dxos/keyring';
@@ -15,7 +23,7 @@ import { createStorage, Storage, StorageType } from '@dxos/random-access-storage
15
23
  import { BlobStore } from '@dxos/teleport-extension-object-sync';
16
24
 
17
25
  import { ClientServicesHost, createDefaultModelFactory, ServiceContext } from '../services';
18
- import { SigningContext } from '../spaces';
26
+ import { DataSpaceManager, SigningContext } from '../spaces';
19
27
 
20
28
  //
21
29
  // TODO(burdon): Replace with test builder.
@@ -96,7 +104,9 @@ export type TestPeerProps = {
96
104
  keyring?: Keyring;
97
105
  networkManager?: NetworkManager;
98
106
  spaceManager?: SpaceManager;
107
+ dataSpaceManager?: DataSpaceManager;
99
108
  snapshotStore?: SnapshotStore;
109
+ signingContext?: SigningContext;
100
110
  blobStore?: BlobStore;
101
111
  };
102
112
 
@@ -108,6 +118,10 @@ export class TestPeer {
108
118
  private readonly opts: TestPeerOpts = { storageType: StorageType.RAM },
109
119
  ) {}
110
120
 
121
+ get props() {
122
+ return this._props;
123
+ }
124
+
111
125
  get storage() {
112
126
  return (this._props.storage ??= createStorage({ type: this.opts.storageType }));
113
127
  }
@@ -158,6 +172,25 @@ export class TestPeer {
158
172
  }));
159
173
  }
160
174
 
175
+ get identity() {
176
+ return this._props.signingContext ?? failUndefined();
177
+ }
178
+
179
+ get dataSpaceManager() {
180
+ return (this._props.dataSpaceManager ??= new DataSpaceManager(
181
+ this.spaceManager,
182
+ this.metadataStore,
183
+ new DataServiceSubscriptions(),
184
+ this.keyring,
185
+ this.identity,
186
+ this.feedStore,
187
+ ));
188
+ }
189
+
190
+ async createIdentity() {
191
+ this._props.signingContext ??= await createSigningContext(this.keyring);
192
+ }
193
+
161
194
  async destroy() {
162
195
  await this.storage.reset();
163
196
  }
@@ -16,8 +16,7 @@ import { BridgeService } from '@dxos/protocols/proto/dxos/mesh/bridge';
16
16
  import { createProtoRpcPeer, ProtoRpcPeer, RpcPort } from '@dxos/rpc';
17
17
  import { Callback, MaybePromise } from '@dxos/util';
18
18
 
19
- import { ClientServicesHost } from '../services';
20
- import { ClientRpcServer, ClientRpcServerParams } from '../services/client-rpc-server';
19
+ import { ClientServicesHost, ClientRpcServer, ClientRpcServerParams } from '../services';
21
20
 
22
21
  export type WorkerSessionParams = {
23
22
  serviceHost: ClientServicesHost;
@@ -111,17 +110,18 @@ export class WorkerSession {
111
110
  }
112
111
 
113
112
  async open() {
114
- log.info('opening..');
113
+ log.info('opening...');
115
114
  await Promise.all([this._clientRpc.open(), this._iframeRpc.open(), this._maybeOpenShell()]);
116
115
 
117
116
  await this._startTrigger.wait({ timeout: PROXY_CONNECTION_TIMEOUT });
118
117
  if (this.lockKey) {
119
118
  void this._afterLockReleases(this.lockKey, () => this.close());
120
119
  }
120
+ log.info('opened');
121
121
  }
122
122
 
123
123
  async close() {
124
- log.info('closing..');
124
+ log.info('closing...');
125
125
  try {
126
126
  await this.onClose.callIfSet();
127
127
  } catch (err: any) {
@@ -129,6 +129,7 @@ export class WorkerSession {
129
129
  }
130
130
 
131
131
  await Promise.all([this._clientRpc.close(), this._iframeRpc.close()]);
132
+ log.info('closed');
132
133
  }
133
134
 
134
135
  private async _maybeOpenShell() {