@dxos/client-services 0.8.4-main.7ace549 → 0.8.4-main.937b3ca
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-NQSC7HOE.mjs +22 -0
- package/dist/lib/browser/chunk-NQSC7HOE.mjs.map +7 -0
- package/dist/lib/browser/chunk-QCWEHHJW.mjs +24 -0
- package/dist/lib/browser/chunk-QCWEHHJW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-NXGWBEOK.mjs → chunk-UDCUM4WV.mjs} +922 -1265
- package/dist/lib/browser/chunk-UDCUM4WV.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +432 -65
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/diagnostics/browser-diagnostics-broadcast.mjs +93 -0
- package/dist/lib/browser/packlets/diagnostics/browser-diagnostics-broadcast.mjs.map +7 -0
- package/dist/lib/browser/packlets/diagnostics/diagnostics-broadcast.mjs +11 -0
- package/dist/lib/browser/packlets/diagnostics/diagnostics-broadcast.mjs.map +7 -0
- package/dist/lib/browser/packlets/locks/browser.mjs +126 -0
- package/dist/lib/browser/packlets/locks/browser.mjs.map +7 -0
- package/dist/lib/browser/packlets/locks/node.mjs +66 -0
- package/dist/lib/browser/packlets/locks/node.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +24 -12
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/chunk-2SZHAWBN.mjs +24 -0
- package/dist/lib/node-esm/chunk-2SZHAWBN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-PKEGMOQ4.mjs +22 -0
- package/dist/lib/node-esm/chunk-PKEGMOQ4.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-AO4R6IID.mjs → chunk-Q56HAUWS.mjs} +421 -633
- package/dist/lib/node-esm/chunk-Q56HAUWS.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +432 -65
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/packlets/diagnostics/browser-diagnostics-broadcast.mjs +93 -0
- package/dist/lib/node-esm/packlets/diagnostics/browser-diagnostics-broadcast.mjs.map +7 -0
- package/dist/lib/node-esm/packlets/diagnostics/diagnostics-broadcast.mjs +11 -0
- package/dist/lib/node-esm/packlets/diagnostics/diagnostics-broadcast.mjs.map +7 -0
- package/dist/lib/node-esm/packlets/locks/browser.mjs +126 -0
- package/dist/lib/node-esm/packlets/locks/browser.mjs.map +7 -0
- package/dist/lib/node-esm/packlets/locks/node.mjs +66 -0
- package/dist/lib/node-esm/packlets/locks/node.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +24 -12
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/packlets/devtools/devtools.d.ts +2 -2
- package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/index.d.ts +1 -1
- package/dist/types/src/packlets/diagnostics/index.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/authenticator.d.ts +2 -2
- package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/default-space-state-machine.d.ts +2 -2
- package/dist/types/src/packlets/identity/default-space-state-machine.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts +4 -4
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts +2 -2
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +2 -2
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +2 -2
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts +4 -4
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/locks/index.d.ts +1 -1
- package/dist/types/src/packlets/locks/index.d.ts.map +1 -1
- package/dist/types/src/packlets/services/client-rpc-server.d.ts +2 -2
- package/dist/types/src/packlets/services/client-rpc-server.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +13 -7
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +19 -5
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/space-export/space-archive-writer.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +10 -5
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +2 -2
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts +2 -2
- package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +6 -6
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts +6 -3
- package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +6 -5
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/worker/worker-runtime.d.ts +23 -4
- package/dist/types/src/packlets/worker/worker-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/worker/worker-session.d.ts +2 -2
- package/dist/types/src/packlets/worker/worker-session.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +70 -48
- package/src/packlets/devtools/devtools.ts +2 -2
- package/src/packlets/diagnostics/index.ts +1 -1
- package/src/packlets/identity/authenticator.ts +2 -2
- package/src/packlets/identity/default-space-state-machine.ts +2 -2
- package/src/packlets/identity/identity-manager.ts +6 -6
- package/src/packlets/identity/identity-recovery-manager.ts +2 -2
- package/src/packlets/identity/identity.ts +2 -2
- package/src/packlets/invitations/device-invitation-protocol.ts +2 -2
- package/src/packlets/invitations/invitations-handler.ts +6 -6
- package/src/packlets/locks/index.ts +1 -1
- package/src/packlets/services/client-rpc-server.ts +4 -4
- package/src/packlets/services/service-context.ts +30 -19
- package/src/packlets/services/service-host.ts +56 -16
- package/src/packlets/space-export/space-archive-writer.ts +3 -2
- package/src/packlets/spaces/data-space-manager.ts +35 -16
- package/src/packlets/spaces/data-space.ts +6 -5
- package/src/packlets/spaces/edge-feed-replicator.ts +2 -2
- package/src/packlets/spaces/epoch-migrations.ts +2 -2
- package/src/packlets/spaces/notarization-plugin.test.ts +2 -2
- package/src/packlets/spaces/notarization-plugin.ts +6 -6
- package/src/packlets/testing/invitation-utils.ts +7 -4
- package/src/packlets/testing/test-builder.ts +36 -10
- package/src/packlets/worker/worker-runtime.ts +141 -11
- package/src/packlets/worker/worker-session.ts +4 -4
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-NXGWBEOK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AO4R6IID.mjs.map +0 -7
package/package.json
CHANGED
|
@@ -1,13 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/client-services",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.937b3ca",
|
|
4
4
|
"description": "DXOS client services implementation",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
|
-
"sideEffects":
|
|
13
|
+
"sideEffects": false,
|
|
10
14
|
"type": "module",
|
|
15
|
+
"imports": {
|
|
16
|
+
"#locks-platform": {
|
|
17
|
+
"source": {
|
|
18
|
+
"browser": "./src/packlets/locks/browser.ts",
|
|
19
|
+
"default": "./src/packlets/locks/node.ts"
|
|
20
|
+
},
|
|
21
|
+
"types": "./dist/types/src/packlets/locks/node.d.ts",
|
|
22
|
+
"browser": "./dist/lib/browser/packlets/locks/browser.mjs",
|
|
23
|
+
"default": "./dist/lib/node-esm/packlets/locks/node.mjs"
|
|
24
|
+
},
|
|
25
|
+
"#diagnostics-broadcast": {
|
|
26
|
+
"source": {
|
|
27
|
+
"browser": "./src/packlets/diagnostics/browser-diagnostics-broadcast.ts",
|
|
28
|
+
"default": "./src/packlets/diagnostics/diagnostics-broadcast.ts"
|
|
29
|
+
},
|
|
30
|
+
"types": "./dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts",
|
|
31
|
+
"browser": "./dist/lib/browser/packlets/diagnostics/browser-diagnostics-broadcast.mjs",
|
|
32
|
+
"default": "./dist/lib/node-esm/packlets/diagnostics/diagnostics-broadcast.mjs"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
11
35
|
"exports": {
|
|
12
36
|
".": {
|
|
13
37
|
"source": "./src/index.ts",
|
|
@@ -22,12 +46,6 @@
|
|
|
22
46
|
"node": "./dist/lib/node-esm/testing/index.mjs"
|
|
23
47
|
}
|
|
24
48
|
},
|
|
25
|
-
"browser": {
|
|
26
|
-
"jsondown": false,
|
|
27
|
-
"./src/packlets/locks/node.ts": "./src/packlets/locks/browser.ts",
|
|
28
|
-
"./src/packlets/diagnostics/diagnostics-broadcast.ts": "./src/packlets/diagnostics/browser-diagnostics-broadcast.ts",
|
|
29
|
-
"./testing.js": "./dist/lib/browser/packlets/testing/index.mjs"
|
|
30
|
-
},
|
|
31
49
|
"types": "dist/types/src/index.d.ts",
|
|
32
50
|
"typesVersions": {
|
|
33
51
|
"*": {
|
|
@@ -37,58 +55,62 @@
|
|
|
37
55
|
}
|
|
38
56
|
},
|
|
39
57
|
"files": [
|
|
40
|
-
"testing.d.ts",
|
|
41
|
-
"testing.js",
|
|
42
58
|
"dist",
|
|
43
59
|
"src"
|
|
44
60
|
],
|
|
45
61
|
"dependencies": {
|
|
46
|
-
"@automerge/automerge": "3.
|
|
47
|
-
"@automerge/automerge-repo": "2.
|
|
62
|
+
"@automerge/automerge": "3.2.3",
|
|
63
|
+
"@automerge/automerge-repo": "2.5.1",
|
|
64
|
+
"@effect/experimental": "0.57.11",
|
|
65
|
+
"@effect/sql": "0.48.6",
|
|
66
|
+
"@effect/sql-sqlite-node": "0.49.1",
|
|
48
67
|
"@obsidize/tar-browserify": "^5.2.0",
|
|
49
68
|
"cbor-x": "^1.5.4",
|
|
69
|
+
"effect": "3.19.11",
|
|
50
70
|
"platform": "^1.3.6",
|
|
51
|
-
"@dxos/async": "0.8.4-main.
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/crypto": "0.8.4-main.
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/echo-db": "0.8.4-main.
|
|
61
|
-
"@dxos/echo-protocol": "0.8.4-main.
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/feed-store": "0.8.4-main.
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/keyring": "0.8.4-main.
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/log": "0.8.4-main.
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/random-access-storage": "0.8.4-main.
|
|
79
|
-
"@dxos/
|
|
80
|
-
"@dxos/teleport
|
|
81
|
-
"@dxos/
|
|
82
|
-
"@dxos/
|
|
83
|
-
"@dxos/
|
|
84
|
-
"@dxos/
|
|
71
|
+
"@dxos/async": "0.8.4-main.937b3ca",
|
|
72
|
+
"@dxos/codec-protobuf": "0.8.4-main.937b3ca",
|
|
73
|
+
"@dxos/client-protocol": "0.8.4-main.937b3ca",
|
|
74
|
+
"@dxos/context": "0.8.4-main.937b3ca",
|
|
75
|
+
"@dxos/credentials": "0.8.4-main.937b3ca",
|
|
76
|
+
"@dxos/config": "0.8.4-main.937b3ca",
|
|
77
|
+
"@dxos/crypto": "0.8.4-main.937b3ca",
|
|
78
|
+
"@dxos/echo": "0.8.4-main.937b3ca",
|
|
79
|
+
"@dxos/debug": "0.8.4-main.937b3ca",
|
|
80
|
+
"@dxos/echo-db": "0.8.4-main.937b3ca",
|
|
81
|
+
"@dxos/echo-protocol": "0.8.4-main.937b3ca",
|
|
82
|
+
"@dxos/edge-client": "0.8.4-main.937b3ca",
|
|
83
|
+
"@dxos/effect": "0.8.4-main.937b3ca",
|
|
84
|
+
"@dxos/feed-store": "0.8.4-main.937b3ca",
|
|
85
|
+
"@dxos/echo-pipeline": "0.8.4-main.937b3ca",
|
|
86
|
+
"@dxos/indexing": "0.8.4-main.937b3ca",
|
|
87
|
+
"@dxos/keyring": "0.8.4-main.937b3ca",
|
|
88
|
+
"@dxos/invariant": "0.8.4-main.937b3ca",
|
|
89
|
+
"@dxos/keys": "0.8.4-main.937b3ca",
|
|
90
|
+
"@dxos/kv-store": "0.8.4-main.937b3ca",
|
|
91
|
+
"@dxos/log": "0.8.4-main.937b3ca",
|
|
92
|
+
"@dxos/lock-file": "0.8.4-main.937b3ca",
|
|
93
|
+
"@dxos/messaging": "0.8.4-main.937b3ca",
|
|
94
|
+
"@dxos/network-manager": "0.8.4-main.937b3ca",
|
|
95
|
+
"@dxos/node-std": "0.8.4-main.937b3ca",
|
|
96
|
+
"@dxos/protocols": "0.8.4-main.937b3ca",
|
|
97
|
+
"@dxos/rpc": "0.8.4-main.937b3ca",
|
|
98
|
+
"@dxos/random-access-storage": "0.8.4-main.937b3ca",
|
|
99
|
+
"@dxos/sql-sqlite": "0.8.4-main.937b3ca",
|
|
100
|
+
"@dxos/teleport": "0.8.4-main.937b3ca",
|
|
101
|
+
"@dxos/teleport-extension-gossip": "0.8.4-main.937b3ca",
|
|
102
|
+
"@dxos/teleport-extension-object-sync": "0.8.4-main.937b3ca",
|
|
103
|
+
"@dxos/timeframe": "0.8.4-main.937b3ca",
|
|
104
|
+
"@dxos/tracing": "0.8.4-main.937b3ca",
|
|
105
|
+
"@dxos/util": "0.8.4-main.937b3ca",
|
|
106
|
+
"@dxos/websocket-rpc": "0.8.4-main.937b3ca"
|
|
85
107
|
},
|
|
86
108
|
"devDependencies": {
|
|
87
109
|
"@types/platform": "^1.3.4",
|
|
88
110
|
"@types/readable-stream": "^2.3.9",
|
|
89
111
|
"get-port-please": "^3.1.1",
|
|
90
|
-
"@dxos/signal": "0.8.4-main.
|
|
91
|
-
"@dxos/test-utils": "0.8.4-main.
|
|
112
|
+
"@dxos/signal": "0.8.4-main.937b3ca",
|
|
113
|
+
"@dxos/test-utils": "0.8.4-main.937b3ca"
|
|
92
114
|
},
|
|
93
115
|
"publishConfig": {
|
|
94
116
|
"access": "public"
|
|
@@ -53,7 +53,7 @@ export class DevtoolsHostEvents {
|
|
|
53
53
|
readonly ready = new AsyncEvent();
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export type
|
|
56
|
+
export type DevtoolsServiceProps = {
|
|
57
57
|
events: DevtoolsHostEvents;
|
|
58
58
|
config: Config;
|
|
59
59
|
context: ServiceContext;
|
|
@@ -63,7 +63,7 @@ export type DevtoolsServiceParams = {
|
|
|
63
63
|
* @deprecated
|
|
64
64
|
*/
|
|
65
65
|
export class DevtoolsServiceImpl implements DevtoolsHost {
|
|
66
|
-
constructor(private readonly params:
|
|
66
|
+
constructor(private readonly params: DevtoolsServiceProps) {}
|
|
67
67
|
|
|
68
68
|
events(_request: void): Stream<Event> {
|
|
69
69
|
return new Stream<Event>(({ next }) => {
|
|
@@ -27,7 +27,7 @@ export const createAuthProvider =
|
|
|
27
27
|
return Credential.encode(credential);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
export type
|
|
30
|
+
export type TrustedKeySetAuthVerifierProps = {
|
|
31
31
|
// TODO(dmaretskyi): Change to `isTrusted: (key) => bool`.
|
|
32
32
|
trustedKeysProvider: () => ComplexSet<PublicKey>;
|
|
33
33
|
update: Event<void>;
|
|
@@ -44,7 +44,7 @@ export type TrustedKeySetAuthVerifierParams = {
|
|
|
44
44
|
export class TrustedKeySetAuthVerifier {
|
|
45
45
|
private _ctx = new Context();
|
|
46
46
|
|
|
47
|
-
constructor(private readonly _params:
|
|
47
|
+
constructor(private readonly _params: TrustedKeySetAuthVerifierProps) {}
|
|
48
48
|
|
|
49
49
|
async close(): Promise<void> {
|
|
50
50
|
await this._ctx.dispose();
|
|
@@ -7,7 +7,7 @@ import { type PublicKey, SpaceId } from '@dxos/keys';
|
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
8
|
import { type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
9
9
|
|
|
10
|
-
type
|
|
10
|
+
type DefaultSpaceStateMachineProps = {
|
|
11
11
|
identityKey: PublicKey;
|
|
12
12
|
onUpdate?: () => void;
|
|
13
13
|
};
|
|
@@ -18,7 +18,7 @@ type DefaultSpaceStateMachineParams = {
|
|
|
18
18
|
export class DefaultSpaceStateMachine implements CredentialProcessor {
|
|
19
19
|
private _spaceId: SpaceId | undefined;
|
|
20
20
|
|
|
21
|
-
constructor(private readonly _params:
|
|
21
|
+
constructor(private readonly _params: DefaultSpaceStateMachineProps) {}
|
|
22
22
|
|
|
23
23
|
public get spaceId(): SpaceId | undefined {
|
|
24
24
|
return this._spaceId;
|
|
@@ -36,14 +36,14 @@ import { Identity } from './identity';
|
|
|
36
36
|
const DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 10_000;
|
|
37
37
|
const DEVICE_PRESENCE_OFFLINE_TIMEOUT = 20_000;
|
|
38
38
|
|
|
39
|
-
interface
|
|
39
|
+
interface ConstructSpaceProps {
|
|
40
40
|
spaceRecord: SpaceMetadata;
|
|
41
41
|
swarmIdentity: SwarmIdentity;
|
|
42
42
|
identityKey: PublicKey;
|
|
43
43
|
gossip: Gossip;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export type
|
|
46
|
+
export type JoinIdentityProps = {
|
|
47
47
|
identityKey: PublicKey;
|
|
48
48
|
deviceKey: PublicKey;
|
|
49
49
|
haloSpaceKey: PublicKey;
|
|
@@ -67,7 +67,7 @@ export type CreateIdentityOptions = {
|
|
|
67
67
|
deviceProfile?: DeviceProfileDocument;
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
export type
|
|
70
|
+
export type IdentityManagerProps = {
|
|
71
71
|
metadataStore: MetadataStore;
|
|
72
72
|
keyring: Keyring;
|
|
73
73
|
feedStore: FeedStore<FeedMessage>;
|
|
@@ -95,7 +95,7 @@ export class IdentityManager {
|
|
|
95
95
|
private _identity?: Identity;
|
|
96
96
|
|
|
97
97
|
// TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
|
|
98
|
-
constructor(params:
|
|
98
|
+
constructor(params: IdentityManagerProps) {
|
|
99
99
|
this._metadataStore = params.metadataStore;
|
|
100
100
|
this._keyring = params.keyring;
|
|
101
101
|
this._feedStore = params.feedStore;
|
|
@@ -240,7 +240,7 @@ export class IdentityManager {
|
|
|
240
240
|
/**
|
|
241
241
|
* Prepare an identity object as the first step of acceptIdentity flow.
|
|
242
242
|
*/
|
|
243
|
-
async prepareIdentity(params:
|
|
243
|
+
async prepareIdentity(params: JoinIdentityProps) {
|
|
244
244
|
log('accepting identity', { params });
|
|
245
245
|
invariant(!this._identity, 'Identity already exists.');
|
|
246
246
|
|
|
@@ -395,7 +395,7 @@ export class IdentityManager {
|
|
|
395
395
|
return identity;
|
|
396
396
|
}
|
|
397
397
|
|
|
398
|
-
private async _constructSpace({ spaceRecord, swarmIdentity, identityKey, gossip }:
|
|
398
|
+
private async _constructSpace({ spaceRecord, swarmIdentity, identityKey, gossip }: ConstructSpaceProps) {
|
|
399
399
|
return this._spaceManager.constructSpace({
|
|
400
400
|
metadata: {
|
|
401
401
|
key: spaceRecord.key,
|
|
@@ -22,14 +22,14 @@ import {
|
|
|
22
22
|
import { Timeframe } from '@dxos/timeframe';
|
|
23
23
|
|
|
24
24
|
import { type Identity } from './identity';
|
|
25
|
-
import { type
|
|
25
|
+
import { type JoinIdentityProps } from './identity-manager';
|
|
26
26
|
|
|
27
27
|
export class EdgeIdentityRecoveryManager {
|
|
28
28
|
constructor(
|
|
29
29
|
private readonly _keyring: Keyring,
|
|
30
30
|
private readonly _edgeClient: EdgeHttpClient | undefined,
|
|
31
31
|
private readonly _identityProvider: () => Identity | undefined,
|
|
32
|
-
private readonly _acceptRecoveredIdentity: (params:
|
|
32
|
+
private readonly _acceptRecoveredIdentity: (params: JoinIdentityProps) => Promise<Identity>,
|
|
33
33
|
) {}
|
|
34
34
|
|
|
35
35
|
public async createRecoveryCredential({
|
|
@@ -38,7 +38,7 @@ import { EdgeFeedReplicator } from '../spaces';
|
|
|
38
38
|
import { TrustedKeySetAuthVerifier } from './authenticator';
|
|
39
39
|
import { DefaultSpaceStateMachine } from './default-space-state-machine';
|
|
40
40
|
|
|
41
|
-
export type
|
|
41
|
+
export type IdentityProps = {
|
|
42
42
|
did: IdentityDid;
|
|
43
43
|
identityKey: PublicKey;
|
|
44
44
|
deviceKey: PublicKey;
|
|
@@ -71,7 +71,7 @@ export class Identity {
|
|
|
71
71
|
|
|
72
72
|
public readonly stateUpdate = new Event();
|
|
73
73
|
|
|
74
|
-
constructor(params:
|
|
74
|
+
constructor(params: IdentityProps) {
|
|
75
75
|
this.space = params.space;
|
|
76
76
|
this._signer = params.signer;
|
|
77
77
|
this._presence = params.presence;
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
type IntroductionRequest,
|
|
16
16
|
} from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
17
17
|
|
|
18
|
-
import { type Identity, type
|
|
18
|
+
import { type Identity, type JoinIdentityProps } from '../identity';
|
|
19
19
|
|
|
20
20
|
import { type InvitationProtocol } from './invitation-protocol';
|
|
21
21
|
|
|
@@ -23,7 +23,7 @@ export class DeviceInvitationProtocol implements InvitationProtocol {
|
|
|
23
23
|
constructor(
|
|
24
24
|
private readonly _keyring: Keyring,
|
|
25
25
|
private readonly _getIdentity: () => Identity,
|
|
26
|
-
private readonly _acceptIdentity: (identity:
|
|
26
|
+
private readonly _acceptIdentity: (identity: JoinIdentityProps) => Promise<Identity>,
|
|
27
27
|
) {}
|
|
28
28
|
|
|
29
29
|
toJSON(): object {
|
|
@@ -16,7 +16,7 @@ import { type AdmissionKeypair, Invitation } from '@dxos/protocols/proto/dxos/cl
|
|
|
16
16
|
import { type DeviceProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
17
17
|
import { AuthenticationResponse, type IntroductionResponse } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
18
18
|
import { InvitationOptions } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
19
|
-
import { type ExtensionContext, type TeleportExtension, type
|
|
19
|
+
import { type ExtensionContext, type TeleportExtension, type TeleportProps } from '@dxos/teleport';
|
|
20
20
|
import { trace as _trace } from '@dxos/tracing';
|
|
21
21
|
import { ComplexSet } from '@dxos/util';
|
|
22
22
|
|
|
@@ -31,8 +31,8 @@ const metrics = _trace.metrics;
|
|
|
31
31
|
|
|
32
32
|
const MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
|
|
33
33
|
|
|
34
|
-
export type
|
|
35
|
-
teleport: Partial<
|
|
34
|
+
export type InvitationConnectionProps = {
|
|
35
|
+
teleport: Partial<TeleportProps>;
|
|
36
36
|
edgeInvitations?: EdgeInvitationConfig;
|
|
37
37
|
};
|
|
38
38
|
|
|
@@ -71,7 +71,7 @@ export class InvitationsHandler {
|
|
|
71
71
|
constructor(
|
|
72
72
|
private readonly _networkManager: SwarmNetworkManager,
|
|
73
73
|
private readonly _edgeClient?: EdgeHttpClient,
|
|
74
|
-
private readonly
|
|
74
|
+
private readonly _connectionProps?: InvitationConnectionProps,
|
|
75
75
|
) {}
|
|
76
76
|
|
|
77
77
|
handleInvitationFlow(
|
|
@@ -388,7 +388,7 @@ export class InvitationsHandler {
|
|
|
388
388
|
return extension;
|
|
389
389
|
};
|
|
390
390
|
|
|
391
|
-
const edgeInvitationHandler = new EdgeInvitationHandler(this.
|
|
391
|
+
const edgeInvitationHandler = new EdgeInvitationHandler(this._connectionProps?.edgeInvitations, this._edgeClient, {
|
|
392
392
|
onInvitationSuccess: async (admissionResponse, admissionRequest) => {
|
|
393
393
|
const result = await protocol.accept(admissionResponse, admissionRequest);
|
|
394
394
|
log.info('admitted by edge', { ...protocol.toJSON() });
|
|
@@ -440,7 +440,7 @@ export class InvitationsHandler {
|
|
|
440
440
|
topic: invitation.swarmKey,
|
|
441
441
|
protocolProvider: createTeleportProtocolFactory(async (teleport) => {
|
|
442
442
|
teleport.addExtension('dxos.halo.invitations', extensionFactory());
|
|
443
|
-
}, this.
|
|
443
|
+
}, this._connectionProps?.teleport),
|
|
444
444
|
topology: new InvitationTopology(role),
|
|
445
445
|
label,
|
|
446
446
|
});
|
|
@@ -11,7 +11,7 @@ import { type MaybePromise } from '@dxos/util';
|
|
|
11
11
|
|
|
12
12
|
import { type ServiceRegistry } from './service-registry';
|
|
13
13
|
|
|
14
|
-
export type
|
|
14
|
+
export type ClientRpcServerProps = {
|
|
15
15
|
serviceRegistry: ServiceRegistry<ClientServices>;
|
|
16
16
|
handleCall?: (
|
|
17
17
|
method: string,
|
|
@@ -30,8 +30,8 @@ export class ClientRpcServer {
|
|
|
30
30
|
private readonly _serviceRegistry: ServiceRegistry<ClientServices>;
|
|
31
31
|
private readonly _rpcPeer: RpcPeer;
|
|
32
32
|
private readonly _handlerCache = new Map<string, ServiceHandler<any>>();
|
|
33
|
-
private readonly _handleCall:
|
|
34
|
-
private readonly _handleStream:
|
|
33
|
+
private readonly _handleCall: ClientRpcServerProps['handleCall'];
|
|
34
|
+
private readonly _handleStream: ClientRpcServerProps['handleStream'];
|
|
35
35
|
|
|
36
36
|
@trace.metricsCounter()
|
|
37
37
|
private readonly _callMetrics = new MapCounter();
|
|
@@ -41,7 +41,7 @@ export class ClientRpcServer {
|
|
|
41
41
|
return Object.keys(this._serviceRegistry.services);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
constructor(params:
|
|
44
|
+
constructor(params: ClientRpcServerProps) {
|
|
45
45
|
const { serviceRegistry, handleCall, handleStream, ...rpcOptions } = params;
|
|
46
46
|
this._handleCall = handleCall;
|
|
47
47
|
this._handleStream = handleStream;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import type * as SqlClient from '@effect/sql/SqlClient';
|
|
6
|
+
|
|
5
7
|
import { Mutex, Trigger } from '@dxos/async';
|
|
6
8
|
import { Context, Resource } from '@dxos/context';
|
|
7
9
|
import { type CredentialProcessor, getCredentialAssertion } from '@dxos/credentials';
|
|
@@ -16,6 +18,7 @@ import {
|
|
|
16
18
|
} from '@dxos/echo-pipeline';
|
|
17
19
|
import { createChainEdgeIdentity, createEphemeralEdgeIdentity } from '@dxos/edge-client';
|
|
18
20
|
import type { EdgeConnection, EdgeHttpClient, EdgeIdentity } from '@dxos/edge-client';
|
|
21
|
+
import { type RuntimeProvider } from '@dxos/effect';
|
|
19
22
|
import { FeedFactory, FeedStore } from '@dxos/feed-store';
|
|
20
23
|
import { invariant } from '@dxos/invariant';
|
|
21
24
|
import { Keyring } from '@dxos/keyring';
|
|
@@ -30,6 +33,7 @@ import { type Runtime } from '@dxos/protocols/proto/dxos/config';
|
|
|
30
33
|
import type { FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
31
34
|
import { type Credential, type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
32
35
|
import { type Storage } from '@dxos/random-access-storage';
|
|
36
|
+
import type * as SqlTransaction from '@dxos/sql-sqlite/SqlTransaction';
|
|
33
37
|
import { BlobStore } from '@dxos/teleport-extension-object-sync';
|
|
34
38
|
import { trace as Trace } from '@dxos/tracing';
|
|
35
39
|
import { safeInstanceof } from '@dxos/util';
|
|
@@ -38,28 +42,30 @@ import { EdgeAgentManager } from '../agents';
|
|
|
38
42
|
import {
|
|
39
43
|
type CreateIdentityOptions,
|
|
40
44
|
IdentityManager,
|
|
41
|
-
type
|
|
42
|
-
type
|
|
45
|
+
type IdentityManagerProps,
|
|
46
|
+
type JoinIdentityProps,
|
|
43
47
|
} from '../identity';
|
|
44
48
|
import { EdgeIdentityRecoveryManager } from '../identity/identity-recovery-manager';
|
|
45
49
|
import {
|
|
46
50
|
DeviceInvitationProtocol,
|
|
47
|
-
type
|
|
51
|
+
type InvitationConnectionProps,
|
|
48
52
|
type InvitationProtocol,
|
|
49
53
|
InvitationsHandler,
|
|
50
54
|
InvitationsManager,
|
|
51
55
|
SpaceInvitationProtocol,
|
|
52
56
|
} from '../invitations';
|
|
53
|
-
import { DataSpaceManager, type
|
|
57
|
+
import { DataSpaceManager, type DataSpaceManagerRuntimeProps, type SigningContext } from '../spaces';
|
|
54
58
|
|
|
55
|
-
export type
|
|
56
|
-
|
|
59
|
+
export type ServiceContextRuntimeProps = Pick<
|
|
60
|
+
IdentityManagerProps,
|
|
57
61
|
'devicePresenceOfflineTimeout' | 'devicePresenceAnnounceInterval'
|
|
58
62
|
> &
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
DataSpaceManagerRuntimeProps & {
|
|
64
|
+
invitationConnectionDefaultProps?: InvitationConnectionProps;
|
|
61
65
|
disableP2pReplication?: boolean;
|
|
62
66
|
enableVectorIndexing?: boolean;
|
|
67
|
+
enableSqlite?: boolean;
|
|
68
|
+
enableLocalQueues?: boolean;
|
|
63
69
|
};
|
|
64
70
|
/**
|
|
65
71
|
* Shared backend for all client services.
|
|
@@ -105,11 +111,15 @@ export class ServiceContext extends Resource {
|
|
|
105
111
|
public readonly signalManager: SignalManager,
|
|
106
112
|
private readonly _edgeConnection: EdgeConnection | undefined,
|
|
107
113
|
private readonly _edgeHttpClient: EdgeHttpClient | undefined,
|
|
108
|
-
|
|
114
|
+
private readonly _runtime: RuntimeProvider.RuntimeProvider<SqlClient.SqlClient | SqlTransaction.SqlTransaction>,
|
|
115
|
+
public readonly _runtimeProps?: ServiceContextRuntimeProps,
|
|
109
116
|
private readonly _edgeFeatures?: Runtime.Client.EdgeFeatures,
|
|
110
117
|
) {
|
|
111
118
|
super();
|
|
112
119
|
|
|
120
|
+
log('runtimeProps', this._runtimeProps);
|
|
121
|
+
log('edgeFeatures', this._edgeFeatures);
|
|
122
|
+
|
|
113
123
|
// TODO(burdon): Move strings to constants.
|
|
114
124
|
this.metadataStore = new MetadataStore(storage.createDirectory('metadata'));
|
|
115
125
|
this.blobStore = new BlobStore(storage.createDirectory('blobs'));
|
|
@@ -131,7 +141,7 @@ export class ServiceContext extends Resource {
|
|
|
131
141
|
networkManager: this.networkManager,
|
|
132
142
|
blobStore: this.blobStore,
|
|
133
143
|
metadataStore: this.metadataStore,
|
|
134
|
-
disableP2pReplication: this.
|
|
144
|
+
disableP2pReplication: this._runtimeProps?.disableP2pReplication,
|
|
135
145
|
});
|
|
136
146
|
|
|
137
147
|
this.identityManager = new IdentityManager({
|
|
@@ -139,8 +149,8 @@ export class ServiceContext extends Resource {
|
|
|
139
149
|
keyring: this.keyring,
|
|
140
150
|
feedStore: this.feedStore,
|
|
141
151
|
spaceManager: this.spaceManager,
|
|
142
|
-
devicePresenceOfflineTimeout: this.
|
|
143
|
-
devicePresenceAnnounceInterval: this.
|
|
152
|
+
devicePresenceOfflineTimeout: this._runtimeProps?.devicePresenceOfflineTimeout,
|
|
153
|
+
devicePresenceAnnounceInterval: this._runtimeProps?.devicePresenceAnnounceInterval,
|
|
144
154
|
edgeConnection: this._edgeConnection,
|
|
145
155
|
edgeFeatures: this._edgeFeatures,
|
|
146
156
|
});
|
|
@@ -157,16 +167,17 @@ export class ServiceContext extends Resource {
|
|
|
157
167
|
peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex(),
|
|
158
168
|
getSpaceKeyByRootDocumentId: (documentId) => this.spaceManager.findSpaceByRootDocumentId(documentId)?.key,
|
|
159
169
|
indexing: {
|
|
160
|
-
vector: this.
|
|
170
|
+
vector: this._runtimeProps?.enableVectorIndexing,
|
|
171
|
+
sqlIndex: this._runtimeProps?.enableSqlite,
|
|
161
172
|
},
|
|
173
|
+
runtime: this._runtime,
|
|
174
|
+
localQueues: this._runtimeProps?.enableLocalQueues,
|
|
162
175
|
});
|
|
163
176
|
|
|
164
|
-
this._meshReplicator = new MeshEchoReplicator();
|
|
165
|
-
|
|
166
177
|
this.invitations = new InvitationsHandler(
|
|
167
178
|
this.networkManager, //
|
|
168
179
|
this._edgeHttpClient,
|
|
169
|
-
|
|
180
|
+
_runtimeProps?.invitationConnectionDefaultProps,
|
|
170
181
|
);
|
|
171
182
|
this.invitationsManager = new InvitationsManager(
|
|
172
183
|
this.invitations,
|
|
@@ -186,7 +197,7 @@ export class ServiceContext extends Resource {
|
|
|
186
197
|
),
|
|
187
198
|
);
|
|
188
199
|
|
|
189
|
-
if (!this.
|
|
200
|
+
if (!this._runtimeProps?.disableP2pReplication) {
|
|
190
201
|
this._meshReplicator = new MeshEchoReplicator();
|
|
191
202
|
}
|
|
192
203
|
if (this._edgeConnection && this._edgeFeatures?.echoReplicator && this._edgeHttpClient) {
|
|
@@ -283,7 +294,7 @@ export class ServiceContext extends Resource {
|
|
|
283
294
|
}
|
|
284
295
|
}
|
|
285
296
|
|
|
286
|
-
private async _acceptIdentity(params:
|
|
297
|
+
private async _acceptIdentity(params: JoinIdentityProps) {
|
|
287
298
|
const { identity, identityRecord } = await this.identityManager.prepareIdentity(params);
|
|
288
299
|
await this._setNetworkIdentity({ deviceCredential: params.authorizedDeviceCredential! });
|
|
289
300
|
await identity.joinNetwork();
|
|
@@ -327,7 +338,7 @@ export class ServiceContext extends Resource {
|
|
|
327
338
|
edgeHttpClient: this._edgeHttpClient,
|
|
328
339
|
echoEdgeReplicator: this._echoEdgeReplicator,
|
|
329
340
|
meshReplicator: this._meshReplicator,
|
|
330
|
-
|
|
341
|
+
runtimeProps: this._runtimeProps as DataSpaceManagerRuntimeProps,
|
|
331
342
|
edgeFeatures: this._edgeFeatures,
|
|
332
343
|
});
|
|
333
344
|
await this.dataSpaceManager.open();
|