@dxos/client-services 0.6.1 → 0.6.2-main.000b1cc
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-YKDA73YQ.mjs → chunk-4AQBRHD7.mjs} +47 -38
- package/dist/lib/browser/chunk-4AQBRHD7.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 +1 -1
- package/dist/lib/node/{chunk-EPLLMAYG.cjs → chunk-6A7KGHXH.cjs} +78 -69
- package/dist/lib/node/chunk-6A7KGHXH.cjs.map +7 -0
- package/dist/lib/node/index.cjs +45 -45
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +8 -8
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/dist/types/src/version.d.ts.map +1 -1
- package/package.json +36 -36
- package/src/packlets/invitations/invitations-handler.ts +9 -0
- package/src/packlets/services/automerge-host.test.ts +4 -5
- package/src/packlets/services/service-context.test.ts +13 -11
- package/src/version.ts +1 -5
- package/dist/lib/browser/chunk-YKDA73YQ.mjs.map +0 -7
- package/dist/lib/node/chunk-EPLLMAYG.cjs.map +0 -7
|
@@ -30,7 +30,7 @@ __export(testing_exports, {
|
|
|
30
30
|
sanitizeInvitation: () => sanitizeInvitation
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(testing_exports);
|
|
33
|
-
var
|
|
33
|
+
var import_chunk_6A7KGHXH = require("../../chunk-6A7KGHXH.cjs");
|
|
34
34
|
var import_credentials = require("@dxos/credentials");
|
|
35
35
|
var import_keys = require("@dxos/keys");
|
|
36
36
|
var import_async = require("@dxos/async");
|
|
@@ -227,7 +227,7 @@ var createInvitation = async (host, options) => {
|
|
|
227
227
|
authMethod: import_services.Invitation.AuthMethod.NONE,
|
|
228
228
|
...options ?? {}
|
|
229
229
|
};
|
|
230
|
-
if (host instanceof
|
|
230
|
+
if (host instanceof import_chunk_6A7KGHXH.ServiceContext) {
|
|
231
231
|
return host.invitationsManager.createInvitation({
|
|
232
232
|
kind: import_services.Invitation.Kind.SPACE,
|
|
233
233
|
...options
|
|
@@ -237,7 +237,7 @@ var createInvitation = async (host, options) => {
|
|
|
237
237
|
};
|
|
238
238
|
var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
|
|
239
239
|
invitation = sanitizeInvitation(invitation);
|
|
240
|
-
if (guest instanceof
|
|
240
|
+
if (guest instanceof import_chunk_6A7KGHXH.ServiceContext) {
|
|
241
241
|
return guest.invitationsManager.acceptInvitation({
|
|
242
242
|
invitation,
|
|
243
243
|
deviceProfile: guestDeviceProfile
|
|
@@ -247,7 +247,7 @@ var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
|
|
|
247
247
|
};
|
|
248
248
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/testing/test-builder.ts";
|
|
249
249
|
var createServiceHost = (config, signalManagerContext) => {
|
|
250
|
-
return new
|
|
250
|
+
return new import_chunk_6A7KGHXH.ClientServicesHost({
|
|
251
251
|
config,
|
|
252
252
|
signalManager: new import_messaging.MemorySignalManager(signalManagerContext),
|
|
253
253
|
transportFactory: import_network_manager.MemoryTransportFactory
|
|
@@ -263,7 +263,7 @@ var createServiceContext = async ({ signalContext = new import_messaging.MemoryS
|
|
|
263
263
|
});
|
|
264
264
|
const level = (0, import_testing.createTestLevel)();
|
|
265
265
|
await level.open();
|
|
266
|
-
return new
|
|
266
|
+
return new import_chunk_6A7KGHXH.ServiceContext(storage, level, networkManager, signalManager, {
|
|
267
267
|
invitationConnectionDefaultParams: {
|
|
268
268
|
controlHeartbeatInterval: 200
|
|
269
269
|
},
|
|
@@ -370,12 +370,12 @@ var TestPeer = class {
|
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
372
|
get dataSpaceManager() {
|
|
373
|
-
return this._props.dataSpaceManager ??= new
|
|
373
|
+
return this._props.dataSpaceManager ??= new import_chunk_6A7KGHXH.DataSpaceManager(this.spaceManager, this.metadataStore, this.keyring, this.identity, this.feedStore, this.echoHost, this.invitationsManager, this._opts.dataSpaceParams);
|
|
374
374
|
}
|
|
375
375
|
get invitationsManager() {
|
|
376
|
-
return this._props.invitationsManager ??= new
|
|
376
|
+
return this._props.invitationsManager ??= new import_chunk_6A7KGHXH.InvitationsManager(new import_chunk_6A7KGHXH.InvitationsHandler(this.networkManager), (invitation) => {
|
|
377
377
|
if (invitation.kind === import_services2.Invitation.Kind.SPACE) {
|
|
378
|
-
return new
|
|
378
|
+
return new import_chunk_6A7KGHXH.SpaceInvitationProtocol(this.dataSpaceManager, this.identity, this.keyring, invitation.spaceKey);
|
|
379
379
|
} else {
|
|
380
380
|
throw new Error("not implemented");
|
|
381
381
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitations-handler.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/invitations-handler.ts"],"names":[],"mappings":";AAIA,OAAO,EAAS,KAAK,UAAU,EAA8B,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE/F,OAAO,EAAE,KAAK,OAAO,EAAwB,MAAM,eAAe,CAAC;AAOnE,OAAO,EAAE,KAAK,gBAAgB,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAC/F,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"invitations-handler.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/invitations-handler.ts"],"names":[],"mappings":";AAIA,OAAO,EAAS,KAAK,UAAU,EAA8B,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE/F,OAAO,EAAE,KAAK,OAAO,EAAwB,MAAM,eAAe,CAAC;AAOnE,OAAO,EAAE,KAAK,gBAAgB,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAC/F,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AASzF,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAShE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,kBAAkB;IAK3B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IAG1C,oBAAoB,CAClB,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,EAC9B,QAAQ,EAAE,kBAAkB,EAC5B,UAAU,EAAE,UAAU,GACrB,IAAI;IAwHP,gBAAgB,CACd,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,EAC9B,QAAQ,EAAE,kBAAkB,EAC5B,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,OAAO,CAAC,MAAM,CAAC,EAClC,aAAa,CAAC,EAAE,qBAAqB,GACpC,IAAI;YA+JO,UAAU;IA2BxB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAsD3B,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,cAAc;YAUR,mBAAmB;YA6BnB,mBAAmB;CAsBlC;AAED,eAAO,MAAM,sBAAsB,QAAO,gBAGzC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DXOS_VERSION = "0.6.
|
|
1
|
+
export declare const DXOS_VERSION = "0.6.2-main.000b1cc";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,uBAAuB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/client-services",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2-main.000b1cc",
|
|
4
4
|
"description": "DXOS client services implementation",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -23,45 +23,45 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"platform": "^1.3.6",
|
|
26
|
-
"@dxos/async": "0.6.
|
|
27
|
-
"@dxos/automerge": "0.6.
|
|
28
|
-
"@dxos/
|
|
29
|
-
"@dxos/
|
|
30
|
-
"@dxos/config": "0.6.
|
|
31
|
-
"@dxos/context": "0.6.
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/echo-db": "0.6.
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/echo-
|
|
37
|
-
"@dxos/echo-
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/indexing": "0.6.
|
|
41
|
-
"@dxos/invariant": "0.6.
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/lock-file": "0.6.
|
|
46
|
-
"@dxos/log": "0.6.
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/node-std": "0.6.
|
|
49
|
-
"@dxos/protocols": "0.6.
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/rpc": "0.6.
|
|
53
|
-
"@dxos/teleport": "0.6.
|
|
54
|
-
"@dxos/teleport-extension-gossip": "0.6.
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
26
|
+
"@dxos/async": "0.6.2-main.000b1cc",
|
|
27
|
+
"@dxos/automerge": "0.6.2-main.000b1cc",
|
|
28
|
+
"@dxos/client-protocol": "0.6.2-main.000b1cc",
|
|
29
|
+
"@dxos/codec-protobuf": "0.6.2-main.000b1cc",
|
|
30
|
+
"@dxos/config": "0.6.2-main.000b1cc",
|
|
31
|
+
"@dxos/context": "0.6.2-main.000b1cc",
|
|
32
|
+
"@dxos/credentials": "0.6.2-main.000b1cc",
|
|
33
|
+
"@dxos/debug": "0.6.2-main.000b1cc",
|
|
34
|
+
"@dxos/echo-db": "0.6.2-main.000b1cc",
|
|
35
|
+
"@dxos/crypto": "0.6.2-main.000b1cc",
|
|
36
|
+
"@dxos/echo-schema": "0.6.2-main.000b1cc",
|
|
37
|
+
"@dxos/echo-pipeline": "0.6.2-main.000b1cc",
|
|
38
|
+
"@dxos/feed-store": "0.6.2-main.000b1cc",
|
|
39
|
+
"@dxos/echo-protocol": "0.6.2-main.000b1cc",
|
|
40
|
+
"@dxos/indexing": "0.6.2-main.000b1cc",
|
|
41
|
+
"@dxos/invariant": "0.6.2-main.000b1cc",
|
|
42
|
+
"@dxos/keyring": "0.6.2-main.000b1cc",
|
|
43
|
+
"@dxos/kv-store": "0.6.2-main.000b1cc",
|
|
44
|
+
"@dxos/keys": "0.6.2-main.000b1cc",
|
|
45
|
+
"@dxos/lock-file": "0.6.2-main.000b1cc",
|
|
46
|
+
"@dxos/log": "0.6.2-main.000b1cc",
|
|
47
|
+
"@dxos/messaging": "0.6.2-main.000b1cc",
|
|
48
|
+
"@dxos/node-std": "0.6.2-main.000b1cc",
|
|
49
|
+
"@dxos/protocols": "0.6.2-main.000b1cc",
|
|
50
|
+
"@dxos/random-access-storage": "0.6.2-main.000b1cc",
|
|
51
|
+
"@dxos/network-manager": "0.6.2-main.000b1cc",
|
|
52
|
+
"@dxos/rpc": "0.6.2-main.000b1cc",
|
|
53
|
+
"@dxos/teleport": "0.6.2-main.000b1cc",
|
|
54
|
+
"@dxos/teleport-extension-gossip": "0.6.2-main.000b1cc",
|
|
55
|
+
"@dxos/teleport-extension-object-sync": "0.6.2-main.000b1cc",
|
|
56
|
+
"@dxos/timeframe": "0.6.2-main.000b1cc",
|
|
57
|
+
"@dxos/tracing": "0.6.2-main.000b1cc",
|
|
58
|
+
"@dxos/websocket-rpc": "0.6.2-main.000b1cc",
|
|
59
|
+
"@dxos/util": "0.6.2-main.000b1cc"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/platform": "^1.3.4",
|
|
63
63
|
"@types/readable-stream": "^2.3.9",
|
|
64
|
-
"@dxos/signal": "0.6.
|
|
64
|
+
"@dxos/signal": "0.6.2-main.000b1cc"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|
|
@@ -16,6 +16,7 @@ import { type DeviceProfileDocument } from '@dxos/protocols/proto/dxos/halo/cred
|
|
|
16
16
|
import { AuthenticationResponse, type IntroductionResponse } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
17
17
|
import { Options } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
18
18
|
import { type ExtensionContext, type TeleportExtension, type TeleportParams } from '@dxos/teleport';
|
|
19
|
+
import { trace as _trace } from '@dxos/tracing';
|
|
19
20
|
import { ComplexSet } from '@dxos/util';
|
|
20
21
|
|
|
21
22
|
import { InvitationGuestExtension } from './invitation-guest-extenstion';
|
|
@@ -24,6 +25,7 @@ import { type InvitationProtocol } from './invitation-protocol';
|
|
|
24
25
|
import { InvitationTopology } from './invitation-topology';
|
|
25
26
|
import { stateToString } from './utils';
|
|
26
27
|
|
|
28
|
+
const metrics = _trace.metrics;
|
|
27
29
|
const MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
|
|
28
30
|
|
|
29
31
|
type InvitationExtension = InvitationHostExtension | InvitationGuestExtension;
|
|
@@ -71,6 +73,7 @@ export class InvitationsHandler {
|
|
|
71
73
|
protocol: InvitationProtocol,
|
|
72
74
|
invitation: Invitation,
|
|
73
75
|
): void {
|
|
76
|
+
metrics.increment('invitation.created');
|
|
74
77
|
const guardedState = this._createGuardedState(ctx, invitation, stream);
|
|
75
78
|
// Called for every connecting peer.
|
|
76
79
|
const createExtension = (): InvitationHostExtension => {
|
|
@@ -117,6 +120,7 @@ export class InvitationsHandler {
|
|
|
117
120
|
const deviceKey = await extension.completedTrigger.wait({ timeout: invitation.timeout });
|
|
118
121
|
log('admitted guest', { guest: deviceKey, ...protocol.toJSON() });
|
|
119
122
|
guardedState.set(extension, Invitation.State.SUCCESS);
|
|
123
|
+
metrics.increment('invitation.success');
|
|
120
124
|
log.trace('dxos.sdk.invitations-handler.host.onOpen', trace.end({ id: traceId }));
|
|
121
125
|
admitted = true;
|
|
122
126
|
|
|
@@ -126,10 +130,12 @@ export class InvitationsHandler {
|
|
|
126
130
|
} catch (err: any) {
|
|
127
131
|
if (err instanceof TimeoutError) {
|
|
128
132
|
if (guardedState.set(extension, Invitation.State.TIMEOUT)) {
|
|
133
|
+
metrics.increment('invitation.timeout');
|
|
129
134
|
log('timeout', { ...protocol.toJSON() });
|
|
130
135
|
}
|
|
131
136
|
} else {
|
|
132
137
|
if (guardedState.error(extension, err)) {
|
|
138
|
+
metrics.increment('invitation.failed');
|
|
133
139
|
log.error('failed', err);
|
|
134
140
|
}
|
|
135
141
|
}
|
|
@@ -146,10 +152,12 @@ export class InvitationsHandler {
|
|
|
146
152
|
}
|
|
147
153
|
if (err instanceof TimeoutError) {
|
|
148
154
|
if (guardedState.set(extension, Invitation.State.TIMEOUT)) {
|
|
155
|
+
metrics.increment('invitation.timeout');
|
|
149
156
|
log('timeout', { err });
|
|
150
157
|
}
|
|
151
158
|
} else {
|
|
152
159
|
if (guardedState.error(extension, err)) {
|
|
160
|
+
metrics.increment('invitation.failed');
|
|
153
161
|
log.error('failed', err);
|
|
154
162
|
}
|
|
155
163
|
}
|
|
@@ -169,6 +177,7 @@ export class InvitationsHandler {
|
|
|
169
177
|
// ensure the swarm is closed before changing state and closing the stream.
|
|
170
178
|
await swarmConnection.close();
|
|
171
179
|
guardedState.set(null, Invitation.State.EXPIRED);
|
|
180
|
+
metrics.increment('invitation.expired');
|
|
172
181
|
await ctx.dispose();
|
|
173
182
|
},
|
|
174
183
|
invitation.created.getTime() + invitation.lifetime * 1000 - Date.now(),
|
|
@@ -5,12 +5,11 @@
|
|
|
5
5
|
import { expect } from 'chai';
|
|
6
6
|
|
|
7
7
|
import { asyncTimeout } from '@dxos/async';
|
|
8
|
-
import { getHeads } from '@dxos/automerge/automerge';
|
|
9
8
|
import { AutomergeContext } from '@dxos/echo-db';
|
|
10
9
|
import { AutomergeHost, DataServiceImpl } from '@dxos/echo-pipeline';
|
|
11
10
|
import { IndexMetadataStore } from '@dxos/indexing';
|
|
12
11
|
import { createTestLevel } from '@dxos/kv-store/testing';
|
|
13
|
-
import { afterTest, describe, test } from '@dxos/test';
|
|
12
|
+
import { afterTest, describe, openAndClose, test } from '@dxos/test';
|
|
14
13
|
|
|
15
14
|
describe('AutomergeHost', () => {
|
|
16
15
|
test('automerge context is being synced with host', async () => {
|
|
@@ -34,7 +33,7 @@ describe('AutomergeHost', () => {
|
|
|
34
33
|
|
|
35
34
|
const dataService = new DataServiceImpl({ automergeHost: host, updateIndexes: async () => {} });
|
|
36
35
|
const client = new AutomergeContext(dataService);
|
|
37
|
-
|
|
36
|
+
await openAndClose(client);
|
|
38
37
|
|
|
39
38
|
// Create document in repo.
|
|
40
39
|
const handle = host.repo.create();
|
|
@@ -44,7 +43,7 @@ describe('AutomergeHost', () => {
|
|
|
44
43
|
});
|
|
45
44
|
|
|
46
45
|
// Find document in repo.
|
|
47
|
-
const doc = client.repo.find(handle.url);
|
|
46
|
+
const doc = client.repo.find<{ text: string }>(handle.url);
|
|
48
47
|
await asyncTimeout(doc.whenReady(), 1_000);
|
|
49
48
|
expect(doc.docSync().text).to.equal(text);
|
|
50
49
|
|
|
@@ -53,7 +52,7 @@ describe('AutomergeHost', () => {
|
|
|
53
52
|
doc.change((doc: any) => {
|
|
54
53
|
doc.text = newText;
|
|
55
54
|
});
|
|
56
|
-
await client.flush({
|
|
55
|
+
await client.flush({ documentIds: [doc.documentId] });
|
|
57
56
|
|
|
58
57
|
await asyncTimeout(handle.whenReady(), 1_000);
|
|
59
58
|
expect(handle.docSync().text).to.equal(newText);
|
|
@@ -6,36 +6,32 @@ import { MemorySignalManagerContext } from '@dxos/messaging';
|
|
|
6
6
|
import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
7
7
|
import { describe, openAndClose, test } from '@dxos/test';
|
|
8
8
|
|
|
9
|
-
import { createServiceContext } from '../testing';
|
|
10
|
-
import { performInvitation } from '../testing/invitation-utils';
|
|
9
|
+
import { createServiceContext, performInvitation } from '../testing';
|
|
11
10
|
|
|
12
11
|
describe('services/ServiceContext', () => {
|
|
13
12
|
test('new space is synchronized on device invitations', async () => {
|
|
14
13
|
const networkContext = new MemorySignalManagerContext();
|
|
15
|
-
const device1 = await
|
|
14
|
+
const device1 = await createOpenServiceContext(networkContext);
|
|
16
15
|
await device1.createIdentity();
|
|
17
16
|
|
|
18
|
-
const device2 = await
|
|
17
|
+
const device2 = await createOpenServiceContext(networkContext);
|
|
19
18
|
await Promise.all(performInvitation({ host: device1, guest: device2, options: { kind: Invitation.Kind.DEVICE } }));
|
|
20
19
|
|
|
21
20
|
const space1 = await device1.dataSpaceManager!.createSpace();
|
|
22
21
|
await device2.dataSpaceManager!.waitUntilSpaceReady(space1!.key);
|
|
23
22
|
const space2 = await device2.dataSpaceManager!.spaces.get(space1.key);
|
|
24
23
|
await space2!.inner.controlPipeline.state.waitUntilTimeframe(space1.inner.controlPipeline.state.timeframe);
|
|
25
|
-
})
|
|
24
|
+
});
|
|
26
25
|
|
|
27
26
|
test('joined space is synchronized on device invitations', async () => {
|
|
28
27
|
const networkContext = new MemorySignalManagerContext();
|
|
29
|
-
const device1 = await
|
|
30
|
-
await openAndClose(device1.echoHost);
|
|
28
|
+
const device1 = await createOpenServiceContext(networkContext);
|
|
31
29
|
await device1.createIdentity();
|
|
32
30
|
|
|
33
|
-
const device2 = await
|
|
34
|
-
await openAndClose(device2.echoHost);
|
|
31
|
+
const device2 = await createOpenServiceContext(networkContext);
|
|
35
32
|
await Promise.all(performInvitation({ host: device1, guest: device2, options: { kind: Invitation.Kind.DEVICE } }));
|
|
36
33
|
|
|
37
|
-
const identity2 = await
|
|
38
|
-
await openAndClose(identity2.echoHost);
|
|
34
|
+
const identity2 = await createOpenServiceContext(networkContext);
|
|
39
35
|
await identity2.createIdentity();
|
|
40
36
|
const space1 = await identity2.dataSpaceManager!.createSpace();
|
|
41
37
|
await Promise.all(
|
|
@@ -50,4 +46,10 @@ describe('services/ServiceContext', () => {
|
|
|
50
46
|
const space2 = await device2.dataSpaceManager!.spaces.get(space1.key);
|
|
51
47
|
await space2!.inner.controlPipeline.state.waitUntilTimeframe(space1.inner.controlPipeline.state.timeframe);
|
|
52
48
|
});
|
|
49
|
+
|
|
50
|
+
const createOpenServiceContext = async (networkContext: MemorySignalManagerContext) => {
|
|
51
|
+
const serviceContext = await createServiceContext({ signalContext: networkContext });
|
|
52
|
+
await openAndClose(serviceContext);
|
|
53
|
+
return serviceContext;
|
|
54
|
+
};
|
|
53
55
|
});
|
package/src/version.ts
CHANGED