@dxos/client-services 0.1.53-next.63b0547 → 0.1.53-next.e9dc2bc

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-RKD47ENR.mjs → chunk-3EI4PM2V.mjs} +194 -110
  2. package/dist/lib/browser/chunk-3EI4PM2V.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +8 -2
  4. package/dist/lib/browser/index.mjs.map +3 -3
  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 +196 -106
  9. package/dist/lib/node/index.cjs.map +3 -3
  10. package/dist/lib/node/meta.json +1 -1
  11. package/dist/lib/node/packlets/testing/index.cjs +203 -103
  12. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  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/service-context.d.ts.map +1 -1
  16. package/dist/types/src/packlets/services/service-host.d.ts +6 -1
  17. package/dist/types/src/packlets/services/service-host.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/package.json +32 -32
  28. package/src/packlets/identity/authenticator.ts +4 -2
  29. package/src/packlets/identity/identity.ts +21 -26
  30. package/src/packlets/services/service-context.ts +9 -7
  31. package/src/packlets/services/service-host.test.ts +50 -2
  32. package/src/packlets/services/service-host.ts +9 -0
  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-runtime.ts +1 -1
  42. package/dist/lib/browser/chunk-RKD47ENR.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
  }
@@ -37,7 +37,7 @@ export class WorkerRuntime {
37
37
  constructor(
38
38
  private readonly _configProvider: () => MaybePromise<Config>
39
39
  ) {
40
- this._clientServices = new ClientServicesHost();
40
+ this._clientServices = new ClientServicesHost({ callbacks: { onReset: async () => { self.close(); } } });
41
41
  }
42
42
 
43
43
  get host() {