@dxos/client-services 0.5.1-next.2ad6c47 → 0.5.1-next.39e0ee2
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-CMVTOS5E.mjs → chunk-YFXM4YAE.mjs} +1337 -1040
- package/dist/lib/browser/chunk-YFXM4YAE.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +36 -5
- 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 +36 -14
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-EAWN3LCD.cjs → chunk-DSYIRKI6.cjs} +1463 -1170
- package/dist/lib/node/chunk-DSYIRKI6.cjs.map +7 -0
- package/dist/lib/node/index.cjs +78 -47
- 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 +40 -18
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +2 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-guest-extenstion.d.ts +39 -0
- package/dist/types/src/packlets/invitations/invitation-guest-extenstion.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/{invitation-extension.d.ts → invitation-host-extension.d.ts} +17 -31
- package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts +6 -1
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-topology.d.ts +37 -0
- package/dist/types/src/packlets/invitations/invitation-topology.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts +19 -10
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.test.d.ts +2 -0
- package/dist/types/src/packlets/invitations/invitations-handler.test.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/invitations-manager.d.ts +2 -1
- package/dist/types/src/packlets/invitations/invitations-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +1 -0
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/utils.d.ts +6 -0
- package/dist/types/src/packlets/invitations/utils.d.ts.map +1 -0
- package/dist/types/src/packlets/services/service-context.d.ts +12 -11
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +1 -2
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +4 -3
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +4 -3
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/level.d.ts +1 -2
- package/dist/types/src/packlets/storage/level.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts +2 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +5 -3
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- 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/packlets/vault/worker-runtime.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +36 -35
- package/src/packlets/invitations/device-invitation-protocol.ts +5 -1
- package/src/packlets/invitations/invitation-guest-extenstion.ts +126 -0
- package/src/packlets/invitations/{invitation-extension.ts → invitation-host-extension.ts} +99 -105
- package/src/packlets/invitations/invitation-protocol.ts +7 -1
- package/src/packlets/invitations/invitation-topology.ts +87 -0
- package/src/packlets/invitations/invitations-handler.test.ts +361 -0
- package/src/packlets/invitations/invitations-handler.ts +246 -149
- package/src/packlets/invitations/invitations-manager.ts +42 -3
- package/src/packlets/invitations/space-invitation-protocol.ts +19 -1
- package/src/packlets/invitations/utils.ts +27 -0
- package/src/packlets/services/automerge-host.test.ts +6 -4
- package/src/packlets/services/service-context.test.ts +3 -3
- package/src/packlets/services/service-context.ts +18 -31
- package/src/packlets/services/service-host.test.ts +6 -0
- package/src/packlets/services/service-host.ts +9 -26
- package/src/packlets/spaces/data-space-manager.test.ts +4 -4
- package/src/packlets/spaces/data-space-manager.ts +8 -11
- package/src/packlets/spaces/data-space.ts +14 -18
- package/src/packlets/storage/level.ts +3 -2
- package/src/packlets/testing/invitation-utils.ts +23 -3
- package/src/packlets/testing/test-builder.ts +13 -15
- package/src/packlets/vault/shell-runtime.ts +40 -2
- package/src/packlets/vault/worker-runtime.ts +3 -1
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-CMVTOS5E.mjs.map +0 -7
- package/dist/lib/node/chunk-EAWN3LCD.cjs.map +0 -7
- package/dist/types/src/packlets/indexing/index.d.ts +0 -2
- package/dist/types/src/packlets/indexing/index.d.ts.map +0 -1
- package/dist/types/src/packlets/indexing/util.d.ts +0 -11
- package/dist/types/src/packlets/indexing/util.d.ts.map +0 -1
- package/dist/types/src/packlets/invitations/invitation-extension.d.ts.map +0 -1
- package/src/packlets/indexing/index.ts +0 -5
- package/src/packlets/indexing/util.ts +0 -32
|
@@ -6,17 +6,12 @@ import { type Config } from '@dxos/config';
|
|
|
6
6
|
import { Context } from '@dxos/context';
|
|
7
7
|
import { createCredentialSignerWithChain, CredentialGenerator } from '@dxos/credentials';
|
|
8
8
|
import { failUndefined } from '@dxos/debug';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
MetadataStore,
|
|
12
|
-
type LevelDB,
|
|
13
|
-
SnapshotStore,
|
|
14
|
-
SpaceManager,
|
|
15
|
-
valueEncoding,
|
|
16
|
-
} from '@dxos/echo-pipeline';
|
|
17
|
-
import { createTestLevel } from '@dxos/echo-pipeline/testing';
|
|
9
|
+
import { EchoHost } from '@dxos/echo-db';
|
|
10
|
+
import { MetadataStore, SnapshotStore, SpaceManager, valueEncoding } from '@dxos/echo-pipeline';
|
|
18
11
|
import { FeedFactory, FeedStore } from '@dxos/feed-store';
|
|
19
12
|
import { Keyring } from '@dxos/keyring';
|
|
13
|
+
import { type LevelDB } from '@dxos/kv-store';
|
|
14
|
+
import { createTestLevel } from '@dxos/kv-store/testing';
|
|
20
15
|
import { MemorySignalManager, MemorySignalManagerContext } from '@dxos/messaging';
|
|
21
16
|
import { MemoryTransportFactory, NetworkManager } from '@dxos/network-manager';
|
|
22
17
|
import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
@@ -54,7 +49,9 @@ export const createServiceContext = async ({
|
|
|
54
49
|
const level = createTestLevel();
|
|
55
50
|
await level.open();
|
|
56
51
|
|
|
57
|
-
return new ServiceContext(storage, level, networkManager, signalManager
|
|
52
|
+
return new ServiceContext(storage, level, networkManager, signalManager, {
|
|
53
|
+
invitationConnectionDefaultParams: { controlHeartbeatInterval: 200 },
|
|
54
|
+
});
|
|
58
55
|
};
|
|
59
56
|
|
|
60
57
|
export const createPeers = async (numPeers: number) => {
|
|
@@ -105,7 +102,7 @@ export type TestPeerProps = {
|
|
|
105
102
|
snapshotStore?: SnapshotStore;
|
|
106
103
|
signingContext?: SigningContext;
|
|
107
104
|
blobStore?: BlobStore;
|
|
108
|
-
|
|
105
|
+
echoHost?: EchoHost;
|
|
109
106
|
invitationsManager?: InvitationsManager;
|
|
110
107
|
};
|
|
111
108
|
|
|
@@ -178,9 +175,10 @@ export class TestPeer {
|
|
|
178
175
|
return this._props.signingContext ?? failUndefined();
|
|
179
176
|
}
|
|
180
177
|
|
|
181
|
-
get
|
|
182
|
-
return (this._props.
|
|
183
|
-
|
|
178
|
+
get echoHost() {
|
|
179
|
+
return (this._props.echoHost ??= new EchoHost({
|
|
180
|
+
kv: this.level,
|
|
181
|
+
storage: this.storage,
|
|
184
182
|
}));
|
|
185
183
|
}
|
|
186
184
|
|
|
@@ -191,7 +189,7 @@ export class TestPeer {
|
|
|
191
189
|
this.keyring,
|
|
192
190
|
this.identity,
|
|
193
191
|
this.feedStore,
|
|
194
|
-
this.
|
|
192
|
+
this.echoHost,
|
|
195
193
|
this.invitationsManager,
|
|
196
194
|
));
|
|
197
195
|
}
|
|
@@ -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,
|
|
@@ -120,7 +120,9 @@ export class WorkerRuntime {
|
|
|
120
120
|
this._sessions.delete(session);
|
|
121
121
|
if (this._sessions.size === 0) {
|
|
122
122
|
// Terminate the worker when all sessions are closed.
|
|
123
|
-
self
|
|
123
|
+
if (globalThis.self) {
|
|
124
|
+
self.close();
|
|
125
|
+
}
|
|
124
126
|
} else {
|
|
125
127
|
this._reconnectWebrtc();
|
|
126
128
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const DXOS_VERSION = "0.5.1-next.
|
|
1
|
+
export const DXOS_VERSION = "0.5.1-next.39e0ee2";
|