@dxos/client-services 0.1.53-main.52ca4e9 → 0.1.53-main.5bcfb84
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.
- package/dist/lib/browser/{chunk-PWZ2J6KS.mjs → chunk-EYXOVYW5.mjs} +170 -90
- package/dist/lib/browser/chunk-EYXOVYW5.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +19 -2
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +165 -85
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +179 -83
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +11 -2
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +2 -1
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +7 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/package.json +32 -32
- package/src/packlets/identity/identity.ts +21 -26
- package/src/packlets/services/service-context.ts +9 -7
- package/src/packlets/spaces/data-space-manager.test.ts +72 -118
- package/src/packlets/spaces/data-space-manager.ts +13 -3
- package/src/packlets/spaces/data-space.ts +66 -20
- package/src/packlets/spaces/notarization-plugin.test.ts +1 -1
- package/src/packlets/spaces/notarization-plugin.ts +5 -1
- package/src/packlets/spaces/spaces-service.ts +26 -8
- package/src/packlets/testing/test-builder.ts +35 -2
- 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 {
|
|
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
|
}
|