@dxos/client-services 0.5.1-main.f81ddc4 → 0.5.1-next.0ef769d
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-OE6XNPWD.mjs → chunk-EZDHZKXT.mjs} +2 -2
- package/dist/lib/browser/{chunk-OE6XNPWD.mjs.map → chunk-EZDHZKXT.mjs.map} +1 -1
- package/dist/lib/browser/index.mjs +31 -2
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-PQ6V45LX.cjs → chunk-4E7K7B6U.cjs} +5 -5
- package/dist/lib/node/{chunk-PQ6V45LX.cjs.map → chunk-4E7K7B6U.cjs.map} +1 -1
- package/dist/lib/node/index.cjs +73 -44
- 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 +8 -8
- package/dist/types/src/packlets/vault/shell-runtime.d.ts +10 -2
- package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +36 -36
- package/src/packlets/invitations/invitations-handler.test.ts +1 -1
- package/src/packlets/vault/shell-runtime.ts +40 -2
- package/src/version.ts +1 -1
|
@@ -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_4E7K7B6U = require("../../chunk-4E7K7B6U.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_4E7K7B6U.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_4E7K7B6U.ServiceContext) {
|
|
241
241
|
return guest.invitationsManager.acceptInvitation({
|
|
242
242
|
invitation,
|
|
243
243
|
deviceProfile: guestDeviceProfile
|
|
@@ -246,7 +246,7 @@ var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
|
|
|
246
246
|
return guest.join(invitation, guestDeviceProfile);
|
|
247
247
|
};
|
|
248
248
|
var createServiceHost = (config, signalManagerContext) => {
|
|
249
|
-
return new
|
|
249
|
+
return new import_chunk_4E7K7B6U.ClientServicesHost({
|
|
250
250
|
config,
|
|
251
251
|
signalManager: new import_messaging.MemorySignalManager(signalManagerContext),
|
|
252
252
|
transportFactory: import_network_manager.MemoryTransportFactory
|
|
@@ -262,7 +262,7 @@ var createServiceContext = async ({ signalContext = new import_messaging.MemoryS
|
|
|
262
262
|
});
|
|
263
263
|
const level = (0, import_testing.createTestLevel)();
|
|
264
264
|
await level.open();
|
|
265
|
-
return new
|
|
265
|
+
return new import_chunk_4E7K7B6U.ServiceContext(storage, level, networkManager, signalManager, {
|
|
266
266
|
invitationConnectionDefaultParams: {
|
|
267
267
|
controlHeartbeatInterval: 200
|
|
268
268
|
}
|
|
@@ -363,12 +363,12 @@ var TestPeer = class {
|
|
|
363
363
|
});
|
|
364
364
|
}
|
|
365
365
|
get dataSpaceManager() {
|
|
366
|
-
return this._props.dataSpaceManager ??= new
|
|
366
|
+
return this._props.dataSpaceManager ??= new import_chunk_4E7K7B6U.DataSpaceManager(this.spaceManager, this.metadataStore, this.keyring, this.identity, this.feedStore, this.echoHost, this.invitationsManager);
|
|
367
367
|
}
|
|
368
368
|
get invitationsManager() {
|
|
369
|
-
return this._props.invitationsManager ??= new
|
|
369
|
+
return this._props.invitationsManager ??= new import_chunk_4E7K7B6U.InvitationsManager(new import_chunk_4E7K7B6U.InvitationsHandler(this.networkManager), (invitation) => {
|
|
370
370
|
if (invitation.kind === import_services2.Invitation.Kind.SPACE) {
|
|
371
|
-
return new
|
|
371
|
+
return new import_chunk_4E7K7B6U.SpaceInvitationProtocol(this.dataSpaceManager, this.identity, this.keyring, invitation.spaceKey);
|
|
372
372
|
} else {
|
|
373
373
|
throw new Error("not implemented");
|
|
374
374
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Event } from '@dxos/async';
|
|
2
2
|
import { type ShellRuntime } from '@dxos/client-protocol';
|
|
3
3
|
import { type PublicKey } from '@dxos/keys';
|
|
4
|
-
import { type AppContextRequest, type LayoutRequest, ShellLayout } from '@dxos/protocols/proto/dxos/iframe';
|
|
4
|
+
import { type AppContextRequest, type LayoutRequest, ShellLayout, type InvitationUrlRequest } from '@dxos/protocols/proto/dxos/iframe';
|
|
5
5
|
import { type RpcPort } from '@dxos/rpc';
|
|
6
6
|
/**
|
|
7
7
|
* Endpoint that handles shell services.
|
|
@@ -9,15 +9,23 @@ import { type RpcPort } from '@dxos/rpc';
|
|
|
9
9
|
export declare class ShellRuntimeImpl implements ShellRuntime {
|
|
10
10
|
private readonly _port;
|
|
11
11
|
readonly layoutUpdate: Event<LayoutRequest>;
|
|
12
|
+
readonly invitationUrlUpdate: Event<InvitationUrlRequest>;
|
|
12
13
|
private _appRpc?;
|
|
13
14
|
private _layout;
|
|
14
|
-
private _invitationCode?;
|
|
15
15
|
private _spaceKey?;
|
|
16
|
+
private _invitationCode?;
|
|
17
|
+
private _invitationUrl?;
|
|
18
|
+
private _deviceInvitationParam;
|
|
19
|
+
private _spaceInvitationParam;
|
|
16
20
|
constructor(_port: RpcPort);
|
|
17
21
|
get layout(): ShellLayout;
|
|
18
22
|
get invitationCode(): string | undefined;
|
|
19
23
|
get spaceKey(): PublicKey | undefined;
|
|
24
|
+
get invitationUrl(): string;
|
|
25
|
+
get deviceInvitationParam(): string;
|
|
26
|
+
get spaceInvitationParam(): string;
|
|
20
27
|
setLayout({ layout, invitationCode, spaceKey }: LayoutRequest): void;
|
|
28
|
+
setInvitationUrl({ invitationUrl, deviceInvitationParam, spaceInvitationParam }: InvitationUrlRequest): void;
|
|
21
29
|
setAppContext(context: AppContextRequest): Promise<void>;
|
|
22
30
|
open(): Promise<void>;
|
|
23
31
|
close(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-runtime.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/vault/shell-runtime.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAA2C,KAAK,YAAY,EAAsB,MAAM,uBAAuB,CAAC;AAEvH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,
|
|
1
|
+
{"version":3,"file":"shell-runtime.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/vault/shell-runtime.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAA2C,KAAK,YAAY,EAAsB,MAAM,uBAAuB,CAAC;AAEvH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,WAAW,EACX,KAAK,oBAAoB,EAC1B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAyC,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAEhF;;GAEG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IAevC,OAAO,CAAC,QAAQ,CAAC,KAAK;IAdlC,QAAQ,CAAC,YAAY,uBAA8B;IACnD,QAAQ,CAAC,mBAAmB,8BAAqC;IAEjE,OAAO,CAAC,OAAO,CAAC,CAAiC;IACjD,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,SAAS,CAAC,CAAY;IAE9B,OAAO,CAAC,eAAe,CAAC,CAAS;IACjC,OAAO,CAAC,cAAc,CAAC,CAAsE;IAG7F,OAAO,CAAC,sBAAsB,CAA0B;IACxD,OAAO,CAAC,qBAAqB,CAAyB;gBAEzB,KAAK,EAAE,OAAO;IAE3C,IAAI,MAAM,gBAET;IAED,IAAI,cAAc,uBAEjB;IAED,IAAI,QAAQ,0BAEX;IAED,IAAI,aAAa,WAEhB;IAED,IAAI,qBAAqB,WAExB;IAED,IAAI,oBAAoB,WAEvB;IAED,SAAS,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,aAAa;IAO7D,gBAAgB,CAAC,EAAE,aAAa,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,EAAE,oBAAoB;IAO/F,aAAa,CAAC,OAAO,EAAE,iBAAiB;IAMxC,IAAI;IA0BJ,KAAK;CAIZ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DXOS_VERSION = "0.5.1-
|
|
1
|
+
export declare const DXOS_VERSION = "0.5.1-next.0ef769d";
|
|
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.5.1-
|
|
3
|
+
"version": "0.5.1-next.0ef769d",
|
|
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.5.1-
|
|
27
|
-
"@dxos/
|
|
28
|
-
"@dxos/codec-protobuf": "0.5.1-
|
|
29
|
-
"@dxos/
|
|
30
|
-
"@dxos/config": "0.5.1-
|
|
31
|
-
"@dxos/context": "0.5.1-
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/echo-
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/echo-
|
|
38
|
-
"@dxos/echo-
|
|
39
|
-
"@dxos/feed-store": "0.5.1-
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/keyring": "0.5.1-
|
|
43
|
-
"@dxos/keys": "0.5.1-
|
|
44
|
-
"@dxos/kv-store": "0.5.1-
|
|
45
|
-
"@dxos/lock-file": "0.5.1-
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/network-manager": "0.5.1-
|
|
49
|
-
"@dxos/node-std": "0.5.1-
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/teleport": "0.5.1-
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/teleport-extension-object-sync": "0.5.1-
|
|
56
|
-
"@dxos/timeframe": "0.5.1-
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
26
|
+
"@dxos/async": "0.5.1-next.0ef769d",
|
|
27
|
+
"@dxos/automerge": "0.5.1-next.0ef769d",
|
|
28
|
+
"@dxos/codec-protobuf": "0.5.1-next.0ef769d",
|
|
29
|
+
"@dxos/client-protocol": "0.5.1-next.0ef769d",
|
|
30
|
+
"@dxos/config": "0.5.1-next.0ef769d",
|
|
31
|
+
"@dxos/context": "0.5.1-next.0ef769d",
|
|
32
|
+
"@dxos/crypto": "0.5.1-next.0ef769d",
|
|
33
|
+
"@dxos/credentials": "0.5.1-next.0ef769d",
|
|
34
|
+
"@dxos/debug": "0.5.1-next.0ef769d",
|
|
35
|
+
"@dxos/echo-db": "0.5.1-next.0ef769d",
|
|
36
|
+
"@dxos/echo-pipeline": "0.5.1-next.0ef769d",
|
|
37
|
+
"@dxos/echo-protocol": "0.5.1-next.0ef769d",
|
|
38
|
+
"@dxos/echo-schema": "0.5.1-next.0ef769d",
|
|
39
|
+
"@dxos/feed-store": "0.5.1-next.0ef769d",
|
|
40
|
+
"@dxos/indexing": "0.5.1-next.0ef769d",
|
|
41
|
+
"@dxos/invariant": "0.5.1-next.0ef769d",
|
|
42
|
+
"@dxos/keyring": "0.5.1-next.0ef769d",
|
|
43
|
+
"@dxos/keys": "0.5.1-next.0ef769d",
|
|
44
|
+
"@dxos/kv-store": "0.5.1-next.0ef769d",
|
|
45
|
+
"@dxos/lock-file": "0.5.1-next.0ef769d",
|
|
46
|
+
"@dxos/log": "0.5.1-next.0ef769d",
|
|
47
|
+
"@dxos/messaging": "0.5.1-next.0ef769d",
|
|
48
|
+
"@dxos/network-manager": "0.5.1-next.0ef769d",
|
|
49
|
+
"@dxos/node-std": "0.5.1-next.0ef769d",
|
|
50
|
+
"@dxos/random-access-storage": "0.5.1-next.0ef769d",
|
|
51
|
+
"@dxos/rpc": "0.5.1-next.0ef769d",
|
|
52
|
+
"@dxos/teleport": "0.5.1-next.0ef769d",
|
|
53
|
+
"@dxos/teleport-extension-gossip": "0.5.1-next.0ef769d",
|
|
54
|
+
"@dxos/protocols": "0.5.1-next.0ef769d",
|
|
55
|
+
"@dxos/teleport-extension-object-sync": "0.5.1-next.0ef769d",
|
|
56
|
+
"@dxos/timeframe": "0.5.1-next.0ef769d",
|
|
57
|
+
"@dxos/tracing": "0.5.1-next.0ef769d",
|
|
58
|
+
"@dxos/util": "0.5.1-next.0ef769d",
|
|
59
|
+
"@dxos/websocket-rpc": "0.5.1-next.0ef769d"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/platform": "^1.3.4",
|
|
63
63
|
"@types/readable-stream": "^2.3.9",
|
|
64
|
-
"@dxos/signal": "0.5.1-
|
|
64
|
+
"@dxos/signal": "0.5.1-next.0ef769d"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|
|
@@ -181,7 +181,7 @@ describe('InvitationHandler', () => {
|
|
|
181
181
|
|
|
182
182
|
await sleep(10);
|
|
183
183
|
expect(guest.sink.lastState).to.eq(Invitation.State.ERROR);
|
|
184
|
-
});
|
|
184
|
+
}).timeout(20_000);
|
|
185
185
|
|
|
186
186
|
test('single host - many guests', async () => {
|
|
187
187
|
const hosts: PeerSetup[] = [await createPeer()];
|
|
@@ -6,7 +6,12 @@ import { Event } from '@dxos/async';
|
|
|
6
6
|
import { appServiceBundle, type AppServiceBundle, type ShellRuntime, shellServiceBundle } from '@dxos/client-protocol';
|
|
7
7
|
import { invariant } from '@dxos/invariant';
|
|
8
8
|
import { type PublicKey } from '@dxos/keys';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
type AppContextRequest,
|
|
11
|
+
type LayoutRequest,
|
|
12
|
+
ShellLayout,
|
|
13
|
+
type InvitationUrlRequest,
|
|
14
|
+
} from '@dxos/protocols/proto/dxos/iframe';
|
|
10
15
|
import { createProtoRpcPeer, type ProtoRpcPeer, type RpcPort } from '@dxos/rpc';
|
|
11
16
|
|
|
12
17
|
/**
|
|
@@ -14,11 +19,19 @@ import { createProtoRpcPeer, type ProtoRpcPeer, type RpcPort } from '@dxos/rpc';
|
|
|
14
19
|
*/
|
|
15
20
|
export class ShellRuntimeImpl implements ShellRuntime {
|
|
16
21
|
readonly layoutUpdate = new Event<LayoutRequest>();
|
|
22
|
+
readonly invitationUrlUpdate = new Event<InvitationUrlRequest>();
|
|
23
|
+
|
|
17
24
|
private _appRpc?: ProtoRpcPeer<AppServiceBundle>;
|
|
18
25
|
private _layout = ShellLayout.DEFAULT;
|
|
19
|
-
private _invitationCode?: string;
|
|
20
26
|
private _spaceKey?: PublicKey;
|
|
21
27
|
|
|
28
|
+
private _invitationCode?: string;
|
|
29
|
+
private _invitationUrl? = typeof window !== 'undefined' ? window.location.origin : undefined;
|
|
30
|
+
|
|
31
|
+
// TODO(burdon): Change to using underscores (coordinate with @dxos/web-auth).
|
|
32
|
+
private _deviceInvitationParam = 'deviceInvitationCode'; // TODO(burdon): device_invitation_code
|
|
33
|
+
private _spaceInvitationParam = 'spaceInvitationCode'; // TODO(burdon): space_invitation_code
|
|
34
|
+
|
|
22
35
|
constructor(private readonly _port: RpcPort) {}
|
|
23
36
|
|
|
24
37
|
get layout() {
|
|
@@ -33,6 +46,18 @@ export class ShellRuntimeImpl implements ShellRuntime {
|
|
|
33
46
|
return this._spaceKey;
|
|
34
47
|
}
|
|
35
48
|
|
|
49
|
+
get invitationUrl() {
|
|
50
|
+
return this._invitationUrl!;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
get deviceInvitationParam() {
|
|
54
|
+
return this._deviceInvitationParam;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
get spaceInvitationParam() {
|
|
58
|
+
return this._spaceInvitationParam;
|
|
59
|
+
}
|
|
60
|
+
|
|
36
61
|
setLayout({ layout, invitationCode, spaceKey }: LayoutRequest) {
|
|
37
62
|
this._layout = layout;
|
|
38
63
|
this._invitationCode = invitationCode;
|
|
@@ -40,6 +65,13 @@ export class ShellRuntimeImpl implements ShellRuntime {
|
|
|
40
65
|
this.layoutUpdate.emit({ layout, invitationCode, spaceKey });
|
|
41
66
|
}
|
|
42
67
|
|
|
68
|
+
setInvitationUrl({ invitationUrl, deviceInvitationParam, spaceInvitationParam }: InvitationUrlRequest) {
|
|
69
|
+
this._invitationUrl = invitationUrl;
|
|
70
|
+
this._deviceInvitationParam = deviceInvitationParam;
|
|
71
|
+
this._spaceInvitationParam = spaceInvitationParam;
|
|
72
|
+
this.invitationUrlUpdate.emit({ invitationUrl, deviceInvitationParam, spaceInvitationParam });
|
|
73
|
+
}
|
|
74
|
+
|
|
43
75
|
async setAppContext(context: AppContextRequest) {
|
|
44
76
|
invariant(this._appRpc, 'runtime not open');
|
|
45
77
|
|
|
@@ -58,6 +90,12 @@ export class ShellRuntimeImpl implements ShellRuntime {
|
|
|
58
90
|
this._spaceKey = request.spaceKey;
|
|
59
91
|
this.layoutUpdate.emit(request);
|
|
60
92
|
},
|
|
93
|
+
setInvitationUrl: async (request) => {
|
|
94
|
+
this._invitationUrl = request.invitationUrl;
|
|
95
|
+
this._deviceInvitationParam = request.deviceInvitationParam;
|
|
96
|
+
this._spaceInvitationParam = request.spaceInvitationParam;
|
|
97
|
+
this.invitationUrlUpdate.emit(request);
|
|
98
|
+
},
|
|
61
99
|
},
|
|
62
100
|
},
|
|
63
101
|
port: this._port,
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const DXOS_VERSION = "0.5.1-
|
|
1
|
+
export const DXOS_VERSION = "0.5.1-next.0ef769d";
|