@dxos/client-services 0.8.4-main.b97322e → 0.8.4-main.bc2380dfbc
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/browser/chunk-QCWEHHJW.mjs +24 -0
- package/dist/lib/browser/chunk-QCWEHHJW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WKKP35EC.mjs → chunk-TUCJORVO.mjs} +3173 -4457
- package/dist/lib/browser/chunk-TUCJORVO.mjs.map +7 -0
- package/dist/lib/browser/chunk-XJRPB3GA.mjs +22 -0
- package/dist/lib/browser/chunk-XJRPB3GA.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +451 -145
- 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 +88 -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 +86 -0
- package/dist/lib/browser/packlets/locks/browser.mjs.map +7 -0
- package/dist/lib/browser/packlets/locks/node.mjs +48 -0
- package/dist/lib/browser/packlets/locks/node.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +35 -36
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/chunk-2DT3MZRL.mjs +22 -0
- package/dist/lib/node-esm/chunk-2DT3MZRL.mjs.map +7 -0
- 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-ZE2HYS56.mjs → chunk-IQLAKNSR.mjs} +3052 -4204
- package/dist/lib/node-esm/chunk-IQLAKNSR.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +451 -145
- 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 +88 -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 +86 -0
- package/dist/lib/node-esm/packlets/locks/browser.mjs.map +7 -0
- package/dist/lib/node-esm/packlets/locks/node.mjs +48 -0
- package/dist/lib/node-esm/packlets/locks/node.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +35 -36
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/packlets/agents/edge-agent-manager.d.ts +3 -2
- package/dist/types/src/packlets/agents/edge-agent-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/agents/edge-agent-service.d.ts +3 -2
- package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -1
- package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/devtools.d.ts +20 -20
- package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/feeds.d.ts +1 -1
- package/dist/types/src/packlets/devtools/feeds.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/keys.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/metadata.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/network.d.ts +1 -1
- package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/spaces.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/browser-diagnostics-broadcast.d.ts +1 -1
- package/dist/types/src/packlets/diagnostics/browser-diagnostics-broadcast.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts +1 -1
- package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/diagnostics-collector.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/diagnostics.d.ts +3 -4
- package/dist/types/src/packlets/diagnostics/diagnostics.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/contacts-service.d.ts +1 -1
- package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts +7 -7
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts +8 -7
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-service.d.ts +6 -10
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +9 -12
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +6 -5
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts +2 -2
- package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-guest-extenstion.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts +8 -5
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-state.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-topology.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/invitations/invitations-manager.d.ts +3 -3
- package/dist/types/src/packlets/invitations/invitations-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts +4 -4
- package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +5 -4
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/utils.d.ts.map +1 -1
- package/dist/types/src/packlets/locks/browser.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/locks/node.d.ts.map +1 -1
- package/dist/types/src/packlets/logging/logging-service.d.ts +5 -1
- package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -1
- package/dist/types/src/packlets/network/network-service.d.ts +7 -6
- package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/client-rpc-server.d.ts +5 -5
- package/dist/types/src/packlets/services/client-rpc-server.d.ts.map +1 -1
- package/dist/types/src/packlets/services/feed-syncer.d.ts +59 -0
- package/dist/types/src/packlets/services/feed-syncer.d.ts.map +1 -0
- package/dist/types/src/packlets/services/feed-syncer.test.d.ts +2 -0
- package/dist/types/src/packlets/services/feed-syncer.test.d.ts.map +1 -0
- package/dist/types/src/packlets/services/platform.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +14 -10
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +20 -7
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-registry.d.ts.map +1 -1
- package/dist/types/src/packlets/services/util.d.ts.map +1 -1
- package/dist/types/src/packlets/space-export/archive-format.d.ts +9 -0
- package/dist/types/src/packlets/space-export/archive-format.d.ts.map +1 -0
- package/dist/types/src/packlets/space-export/index.d.ts +4 -1
- package/dist/types/src/packlets/space-export/index.d.ts.map +1 -1
- package/dist/types/src/packlets/space-export/serialized-space-reader.d.ts +23 -0
- package/dist/types/src/packlets/space-export/serialized-space-reader.d.ts.map +1 -0
- package/dist/types/src/packlets/space-export/serialized-space-writer.d.ts +36 -0
- package/dist/types/src/packlets/space-export/serialized-space-writer.d.ts.map +1 -0
- package/dist/types/src/packlets/space-export/space-archive-reader.d.ts +9 -1
- package/dist/types/src/packlets/space-export/space-archive-reader.d.ts.map +1 -1
- package/dist/types/src/packlets/space-export/space-archive-writer.d.ts +8 -2
- package/dist/types/src/packlets/space-export/space-archive-writer.d.ts.map +1 -1
- package/dist/types/src/packlets/space-export/space-archive.test.d.ts +2 -0
- package/dist/types/src/packlets/space-export/space-archive.test.d.ts.map +1 -0
- package/dist/types/src/packlets/spaces/automerge-space-state.d.ts +1 -1
- package/dist/types/src/packlets/spaces/automerge-space-state.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +31 -20
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +30 -13
- 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/epoch-migrations.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/genesis.d.ts +2 -1
- package/dist/types/src/packlets/spaces/genesis.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +6 -9
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +11 -8
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/level.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/profile-archive.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/storage.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/util.d.ts.map +1 -1
- package/dist/types/src/packlets/system/system-service.d.ts +2 -2
- package/dist/types/src/packlets/system/system-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/credential-utils.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 +8 -7
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/worker/worker-runtime.d.ts +41 -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 -4
- package/dist/types/src/packlets/worker/worker-session.d.ts.map +1 -1
- package/dist/types/src/testing/setup.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/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +73 -56
- package/src/index.ts +1 -0
- package/src/packlets/agents/edge-agent-manager.ts +10 -7
- package/src/packlets/agents/edge-agent-service.ts +17 -5
- package/src/packlets/devices/devices-service.test.ts +3 -3
- package/src/packlets/devices/devices-service.ts +2 -2
- package/src/packlets/devtools/devtools.ts +29 -29
- package/src/packlets/devtools/feeds.ts +2 -2
- package/src/packlets/devtools/network.ts +1 -1
- package/src/packlets/diagnostics/browser-diagnostics-broadcast.ts +1 -1
- package/src/packlets/diagnostics/diagnostics-broadcast.ts +1 -1
- package/src/packlets/diagnostics/diagnostics-collector.ts +1 -1
- package/src/packlets/diagnostics/diagnostics.ts +2 -3
- package/src/packlets/diagnostics/index.ts +1 -1
- package/src/packlets/identity/authenticator.node.test.ts +1 -1
- package/src/packlets/identity/authenticator.ts +3 -3
- package/src/packlets/identity/contacts-service.ts +2 -2
- package/src/packlets/identity/identity-manager.test.ts +8 -8
- package/src/packlets/identity/identity-manager.ts +25 -24
- package/src/packlets/identity/identity-recovery-manager.ts +22 -18
- package/src/packlets/identity/identity-service.test.ts +8 -28
- package/src/packlets/identity/identity-service.ts +13 -80
- package/src/packlets/identity/identity.test.ts +11 -11
- package/src/packlets/identity/identity.ts +17 -39
- package/src/packlets/invitations/device-invitation-protocol.test.ts +1 -1
- package/src/packlets/invitations/device-invitation-protocol.ts +8 -6
- package/src/packlets/invitations/edge-invitation-handler.ts +10 -6
- package/src/packlets/invitations/invitation-guest-extenstion.ts +7 -5
- package/src/packlets/invitations/invitation-host-extension.ts +15 -16
- package/src/packlets/invitations/invitation-protocol.ts +8 -5
- package/src/packlets/invitations/invitation-state.ts +1 -15
- package/src/packlets/invitations/invitations-handler.test.ts +7 -7
- package/src/packlets/invitations/invitations-handler.ts +77 -25
- package/src/packlets/invitations/invitations-manager.ts +43 -18
- package/src/packlets/invitations/invitations-service.ts +10 -10
- package/src/packlets/invitations/space-invitation-protocol.test.ts +19 -18
- package/src/packlets/invitations/space-invitation-protocol.ts +13 -17
- package/src/packlets/invitations/utils.ts +1 -1
- package/src/packlets/locks/browser.ts +1 -1
- package/src/packlets/locks/index.ts +1 -1
- package/src/packlets/logging/logging-service.ts +22 -18
- package/src/packlets/logging/logging.test.ts +1 -1
- package/src/packlets/network/network-service.test.ts +3 -3
- package/src/packlets/network/network-service.ts +12 -10
- package/src/packlets/services/client-rpc-server.ts +20 -17
- package/src/packlets/services/feed-syncer.test.ts +340 -0
- package/src/packlets/services/feed-syncer.ts +377 -0
- package/src/packlets/services/platform.ts +7 -1
- package/src/packlets/services/service-context.test.ts +4 -3
- package/src/packlets/services/service-context.ts +160 -67
- package/src/packlets/services/service-host.test.ts +10 -9
- package/src/packlets/services/service-host.ts +85 -47
- package/src/packlets/services/service-registry.test.ts +1 -1
- package/src/packlets/space-export/archive-format.ts +42 -0
- package/src/packlets/space-export/index.ts +4 -1
- package/src/packlets/space-export/serialized-space-reader.ts +111 -0
- package/src/packlets/space-export/serialized-space-writer.ts +252 -0
- package/src/packlets/space-export/space-archive-reader.ts +65 -4
- package/src/packlets/space-export/space-archive-writer.ts +44 -6
- package/src/packlets/space-export/space-archive.test.ts +461 -0
- package/src/packlets/space-export/tar.test.ts +1 -1
- package/src/packlets/spaces/automerge-space-state.ts +1 -1
- package/src/packlets/spaces/data-space-manager.test.ts +79 -13
- package/src/packlets/spaces/data-space-manager.ts +134 -129
- package/src/packlets/spaces/data-space.ts +71 -42
- package/src/packlets/spaces/edge-feed-replicator.test.ts +4 -4
- package/src/packlets/spaces/edge-feed-replicator.ts +13 -11
- package/src/packlets/spaces/epoch-migrations.ts +6 -5
- package/src/packlets/spaces/genesis.ts +6 -1
- package/src/packlets/spaces/notarization-plugin.test.ts +3 -3
- package/src/packlets/spaces/notarization-plugin.ts +13 -12
- package/src/packlets/spaces/spaces-service.test.ts +20 -12
- package/src/packlets/spaces/spaces-service.ts +139 -38
- package/src/packlets/storage/profile-archive.ts +1 -1
- package/src/packlets/storage/storage.ts +7 -8
- package/src/packlets/system/system-service.test.ts +1 -1
- package/src/packlets/system/system-service.ts +4 -4
- package/src/packlets/testing/invitation-utils.ts +11 -7
- package/src/packlets/testing/test-builder.ts +39 -13
- package/src/packlets/worker/worker-runtime.ts +189 -17
- package/src/packlets/worker/worker-session.ts +15 -21
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-WKKP35EC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZE2HYS56.mjs.map +0 -7
- package/dist/types/src/packlets/identity/default-space-state-machine.d.ts +0 -19
- package/dist/types/src/packlets/identity/default-space-state-machine.d.ts.map +0 -1
- package/src/packlets/identity/default-space-state-machine.ts +0 -44
|
@@ -3,72 +3,67 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Doc } from '@automerge/automerge';
|
|
6
|
-
import {
|
|
6
|
+
import { type AutomergeUrl, type DocumentId, interpretAsDocumentId } from '@automerge/automerge-repo';
|
|
7
7
|
|
|
8
8
|
import { Event, synchronized, trackLeaks } from '@dxos/async';
|
|
9
|
-
import {
|
|
9
|
+
import { SpaceProperties } from '@dxos/client-protocol';
|
|
10
10
|
import { Context, LifecycleState, Resource, cancelWithContext } from '@dxos/context';
|
|
11
11
|
import {
|
|
12
|
-
createAdmissionCredentials,
|
|
13
|
-
getCredentialAssertion,
|
|
14
12
|
type CredentialSigner,
|
|
15
13
|
type DelegateInvitationCredential,
|
|
16
14
|
type MemberInfo,
|
|
15
|
+
createAdmissionCredentials,
|
|
16
|
+
getCredentialAssertion,
|
|
17
17
|
} from '@dxos/credentials';
|
|
18
|
+
import { Type } from '@dxos/echo';
|
|
18
19
|
import {
|
|
19
|
-
DatabaseRoot,
|
|
20
|
-
findInlineObjectOfType,
|
|
21
|
-
type EchoEdgeReplicator,
|
|
22
|
-
type EchoHost,
|
|
23
20
|
AuthStatus,
|
|
24
21
|
CredentialServerExtension,
|
|
22
|
+
DatabaseRoot,
|
|
23
|
+
type EchoHost,
|
|
24
|
+
type EdgeAutomergeReplicator,
|
|
25
25
|
type MeshEchoReplicator,
|
|
26
26
|
type MetadataStore,
|
|
27
27
|
type Space,
|
|
28
28
|
type SpaceManager,
|
|
29
29
|
type SpaceProtocol,
|
|
30
30
|
type SpaceProtocolSession,
|
|
31
|
-
|
|
31
|
+
findInlineObjectOfType,
|
|
32
32
|
} from '@dxos/echo-pipeline';
|
|
33
|
-
import {
|
|
34
|
-
SpaceDocVersion,
|
|
35
|
-
createIdFromSpaceKey,
|
|
36
|
-
encodeReference,
|
|
37
|
-
type ObjectStructure,
|
|
38
|
-
type DatabaseDirectory,
|
|
39
|
-
} from '@dxos/echo-protocol';
|
|
40
|
-
import { ObjectId, getTypeReference } from '@dxos/echo-schema';
|
|
33
|
+
import { type DatabaseDirectory, createIdFromSpaceKey } from '@dxos/echo-protocol';
|
|
41
34
|
import type { EdgeConnection, EdgeHttpClient } from '@dxos/edge-client';
|
|
42
|
-
import {
|
|
35
|
+
import { type FeedStore, writeMessages } from '@dxos/feed-store';
|
|
43
36
|
import { assertArgument, assertState, failedInvariant, invariant } from '@dxos/invariant';
|
|
44
37
|
import { type Keyring } from '@dxos/keyring';
|
|
45
38
|
import { PublicKey, type SpaceId } from '@dxos/keys';
|
|
46
39
|
import { log } from '@dxos/log';
|
|
47
|
-
import { AlreadyJoinedError
|
|
40
|
+
import { AlreadyJoinedError } from '@dxos/protocols';
|
|
48
41
|
import { Invitation, SpaceState } from '@dxos/protocols/proto/dxos/client/services';
|
|
49
42
|
import { type Runtime } from '@dxos/protocols/proto/dxos/config';
|
|
50
43
|
import { type FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
51
|
-
import { type SpaceMetadata
|
|
52
|
-
import {
|
|
44
|
+
import { EdgeReplicationSetting, type SpaceMetadata } from '@dxos/protocols/proto/dxos/echo/metadata';
|
|
45
|
+
import {
|
|
46
|
+
type Credential,
|
|
47
|
+
MembershipPolicy,
|
|
48
|
+
type ProfileDocument,
|
|
49
|
+
SpaceMember,
|
|
50
|
+
} from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
53
51
|
import { type DelegateSpaceInvitation } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
54
52
|
import { type PeerState } from '@dxos/protocols/proto/dxos/mesh/presence';
|
|
55
53
|
import { type Teleport } from '@dxos/teleport';
|
|
56
54
|
import { Gossip, Presence } from '@dxos/teleport-extension-gossip';
|
|
57
55
|
import { type Timeframe } from '@dxos/timeframe';
|
|
58
56
|
import { trace } from '@dxos/tracing';
|
|
59
|
-
import { ComplexMap,
|
|
57
|
+
import { ComplexMap, deferFunction, forEachAsync } from '@dxos/util';
|
|
60
58
|
|
|
61
|
-
import { DataSpace } from './data-space';
|
|
62
|
-
import { spaceGenesis } from './genesis';
|
|
63
59
|
import { createAuthProvider } from '../identity';
|
|
64
60
|
import { type InvitationsManager } from '../invitations';
|
|
61
|
+
import { DataSpace } from './data-space';
|
|
62
|
+
import { spaceGenesis } from './genesis';
|
|
65
63
|
|
|
66
64
|
const PRESENCE_ANNOUNCE_INTERVAL = 10_000;
|
|
67
65
|
const PRESENCE_OFFLINE_TIMEOUT = 20_000;
|
|
68
66
|
|
|
69
|
-
// Space properties key for default metadata.
|
|
70
|
-
const DEFAULT_SPACE_KEY = '__DEFAULT__';
|
|
71
|
-
|
|
72
67
|
export interface SigningContext {
|
|
73
68
|
identityKey: PublicKey;
|
|
74
69
|
deviceKey: PublicKey;
|
|
@@ -93,6 +88,9 @@ export type AcceptSpaceOptions = {
|
|
|
93
88
|
* We will try to catch up to this timeframe before initializing the database.
|
|
94
89
|
*/
|
|
95
90
|
dataTimeframe?: Timeframe;
|
|
91
|
+
|
|
92
|
+
/** Tags assigned to the space member. */
|
|
93
|
+
tags?: string[];
|
|
96
94
|
};
|
|
97
95
|
|
|
98
96
|
export type AdmitMemberOptions = {
|
|
@@ -101,9 +99,10 @@ export type AdmitMemberOptions = {
|
|
|
101
99
|
role: SpaceMember.Role;
|
|
102
100
|
profile?: ProfileDocument;
|
|
103
101
|
delegationCredentialId?: PublicKey;
|
|
102
|
+
tags?: string[];
|
|
104
103
|
};
|
|
105
104
|
|
|
106
|
-
export type
|
|
105
|
+
export type DataSpaceManagerProps = {
|
|
107
106
|
spaceManager: SpaceManager;
|
|
108
107
|
metadataStore: MetadataStore;
|
|
109
108
|
keyring: Keyring;
|
|
@@ -114,31 +113,37 @@ export type DataSpaceManagerParams = {
|
|
|
114
113
|
edgeConnection?: EdgeConnection;
|
|
115
114
|
edgeHttpClient?: EdgeHttpClient;
|
|
116
115
|
meshReplicator?: MeshEchoReplicator;
|
|
117
|
-
echoEdgeReplicator?:
|
|
118
|
-
|
|
116
|
+
echoEdgeReplicator?: EdgeAutomergeReplicator;
|
|
117
|
+
runtimeProps?: DataSpaceManagerRuntimeProps;
|
|
119
118
|
edgeFeatures?: Runtime.Client.EdgeFeatures;
|
|
120
119
|
};
|
|
121
120
|
|
|
122
|
-
export type
|
|
121
|
+
export type DataSpaceManagerRuntimeProps = {
|
|
123
122
|
spaceMemberPresenceAnnounceInterval?: number;
|
|
124
123
|
spaceMemberPresenceOfflineTimeout?: number;
|
|
125
124
|
activeEdgeNotarizationPollingInterval?: number;
|
|
126
125
|
disableP2pReplication?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* If true, spaces that were previously SPACE_ACTIVE will be automatically activated on startup.
|
|
128
|
+
* This is used in dedicated worker mode to restore space state after leader changeover.
|
|
129
|
+
*/
|
|
130
|
+
autoActivateSpaces?: boolean;
|
|
127
131
|
};
|
|
128
132
|
|
|
129
133
|
export type CreateSpaceOptions = {
|
|
130
134
|
rootUrl?: AutomergeUrl;
|
|
131
135
|
documents?: Record<DocumentId, Uint8Array>;
|
|
136
|
+
tags?: string[];
|
|
137
|
+
membershipPolicy?: MembershipPolicy;
|
|
132
138
|
};
|
|
133
139
|
|
|
134
140
|
@trackLeaks('open', 'close')
|
|
141
|
+
@trace.resource({ lifecycle: true })
|
|
135
142
|
export class DataSpaceManager extends Resource {
|
|
136
143
|
public readonly updated = new Event();
|
|
137
144
|
|
|
138
145
|
private readonly _spaces = new ComplexMap<PublicKey, DataSpace>(PublicKey.hash);
|
|
139
146
|
|
|
140
|
-
private readonly _instanceId = PublicKey.random().toHex();
|
|
141
|
-
|
|
142
147
|
private readonly _spaceManager: SpaceManager;
|
|
143
148
|
private readonly _metadataStore: MetadataStore;
|
|
144
149
|
private readonly _keyring: Keyring;
|
|
@@ -150,10 +155,10 @@ export class DataSpaceManager extends Resource {
|
|
|
150
155
|
private readonly _edgeHttpClient?: EdgeHttpClient = undefined;
|
|
151
156
|
private readonly _edgeFeatures?: Runtime.Client.EdgeFeatures = undefined;
|
|
152
157
|
private readonly _meshReplicator?: MeshEchoReplicator = undefined;
|
|
153
|
-
private readonly _echoEdgeReplicator?:
|
|
154
|
-
private readonly
|
|
158
|
+
private readonly _echoEdgeReplicator?: EdgeAutomergeReplicator = undefined;
|
|
159
|
+
private readonly _runtimeProps?: DataSpaceManagerRuntimeProps = undefined;
|
|
155
160
|
|
|
156
|
-
constructor(params:
|
|
161
|
+
constructor(params: DataSpaceManagerProps) {
|
|
157
162
|
super();
|
|
158
163
|
|
|
159
164
|
this._spaceManager = params.spaceManager;
|
|
@@ -168,7 +173,7 @@ export class DataSpaceManager extends Resource {
|
|
|
168
173
|
this._edgeFeatures = params.edgeFeatures;
|
|
169
174
|
this._echoEdgeReplicator = params.echoEdgeReplicator;
|
|
170
175
|
this._edgeHttpClient = params.edgeHttpClient;
|
|
171
|
-
this.
|
|
176
|
+
this._runtimeProps = params.runtimeProps;
|
|
172
177
|
|
|
173
178
|
trace.diagnostic({
|
|
174
179
|
id: 'spaces',
|
|
@@ -178,12 +183,11 @@ export class DataSpaceManager extends Resource {
|
|
|
178
183
|
Array.from(this._spaces.values()).map(async (space) => {
|
|
179
184
|
const rootUrl = space.automergeSpaceState.rootUrl;
|
|
180
185
|
const rootHandle = rootUrl
|
|
181
|
-
? await this._echoHost.
|
|
186
|
+
? await this._echoHost.loadDoc<Doc<DatabaseDirectory>>(this._ctx, rootUrl as AutomergeUrl)
|
|
182
187
|
: undefined;
|
|
183
|
-
await rootHandle?.whenReady();
|
|
184
188
|
const rootDoc = rootHandle?.doc();
|
|
185
189
|
|
|
186
|
-
const properties = rootDoc && findInlineObjectOfType(rootDoc,
|
|
190
|
+
const properties = rootDoc && findInlineObjectOfType(rootDoc, Type.getTypename(SpaceProperties));
|
|
187
191
|
|
|
188
192
|
return {
|
|
189
193
|
key: space.key.toHex(),
|
|
@@ -211,30 +215,41 @@ export class DataSpaceManager extends Resource {
|
|
|
211
215
|
}
|
|
212
216
|
|
|
213
217
|
@synchronized
|
|
214
|
-
|
|
218
|
+
@trace.span({ showInBrowserTimeline: true, op: 'lifecycle' })
|
|
219
|
+
protected override async _open(ctx: Context): Promise<void> {
|
|
215
220
|
log('open');
|
|
216
|
-
log.trace('dxos.echo.data-space-manager.open', Trace.begin({ id: this._instanceId }));
|
|
217
221
|
log('metadata loaded', { spaces: this._metadataStore.spaces.length });
|
|
218
222
|
|
|
223
|
+
const spacesToActivate: DataSpace[] = [];
|
|
219
224
|
await forEachAsync(this._metadataStore.spaces, async (spaceMetadata) => {
|
|
220
225
|
try {
|
|
221
226
|
log('load space', { spaceMetadata });
|
|
222
|
-
await this._constructSpace(spaceMetadata);
|
|
227
|
+
const space = await this._constructSpace(ctx, spaceMetadata);
|
|
228
|
+
// Track spaces that were previously active for auto-activation (used in dedicated worker mode).
|
|
229
|
+
if (this._runtimeProps?.autoActivateSpaces && spaceMetadata.state === SpaceState.SPACE_ACTIVE) {
|
|
230
|
+
spacesToActivate.push(space);
|
|
231
|
+
}
|
|
223
232
|
} catch (err) {
|
|
224
233
|
log.error('Error loading space', { spaceMetadata, err });
|
|
225
234
|
}
|
|
226
235
|
});
|
|
227
236
|
|
|
228
|
-
|
|
237
|
+
// Auto-activate spaces that were previously active (used in dedicated worker mode after leader changeover).
|
|
238
|
+
for (const space of spacesToActivate) {
|
|
239
|
+
log('auto-activating space', { spaceKey: space.key });
|
|
240
|
+
space.activate(ctx).catch((err) => {
|
|
241
|
+
log.error('Error auto-activating space', { spaceKey: space.key, err });
|
|
242
|
+
});
|
|
243
|
+
}
|
|
229
244
|
|
|
230
|
-
|
|
245
|
+
this.updated.emit();
|
|
231
246
|
}
|
|
232
247
|
|
|
233
248
|
@synchronized
|
|
234
|
-
protected override async _close(): Promise<void> {
|
|
249
|
+
protected override async _close(ctx: Context): Promise<void> {
|
|
235
250
|
log('close');
|
|
236
251
|
for (const space of this._spaces.values()) {
|
|
237
|
-
await space.close();
|
|
252
|
+
await space.close(ctx);
|
|
238
253
|
}
|
|
239
254
|
this._spaces.clear();
|
|
240
255
|
}
|
|
@@ -243,10 +258,17 @@ export class DataSpaceManager extends Resource {
|
|
|
243
258
|
* Creates a new space writing the genesis credentials to the control feed.
|
|
244
259
|
*/
|
|
245
260
|
@synchronized
|
|
246
|
-
|
|
247
|
-
|
|
261
|
+
@trace.span({ showInBrowserTimeline: true, op: 'lifecycle' })
|
|
262
|
+
async createSpace(ctx: Context, options: CreateSpaceOptions = {}): Promise<DataSpace> {
|
|
263
|
+
assertArgument(
|
|
264
|
+
!!options.rootUrl === !!options.documents,
|
|
265
|
+
'options',
|
|
266
|
+
'root url must be required when providing documents',
|
|
267
|
+
);
|
|
248
268
|
|
|
249
269
|
assertState(this._lifecycleState === LifecycleState.OPEN, 'Not open.');
|
|
270
|
+
|
|
271
|
+
const tags = options.tags ? Array.from(options.tags) : [];
|
|
250
272
|
const spaceKey = await this._keyring.createKey();
|
|
251
273
|
const controlFeedKey = await this._keyring.createKey();
|
|
252
274
|
const dataFeedKey = await this._keyring.createKey();
|
|
@@ -259,6 +281,7 @@ export class DataSpaceManager extends Resource {
|
|
|
259
281
|
controlFeedKey,
|
|
260
282
|
dataFeedKey,
|
|
261
283
|
state: SpaceState.SPACE_ACTIVE,
|
|
284
|
+
tags,
|
|
262
285
|
};
|
|
263
286
|
|
|
264
287
|
log('creating space...', { spaceId, spaceKey });
|
|
@@ -274,7 +297,18 @@ export class DataSpaceManager extends Resource {
|
|
|
274
297
|
await Promise.all(
|
|
275
298
|
Object.entries(options.documents).map(async ([documentId, data]) => {
|
|
276
299
|
log('creating document...', { documentId });
|
|
277
|
-
|
|
300
|
+
// TODO(dmaretskyi): Broken types -- the bytes get interpreted as CRDT data.
|
|
301
|
+
const newDoc = await this._echoHost.createDoc(data as any as DatabaseDirectory, {
|
|
302
|
+
preserveHistory: true,
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
// The archived documents might have the spaceKey from the space they were expored from, we need to update it to the new spaceKey.
|
|
306
|
+
if (newDoc.doc().access !== undefined && newDoc.doc().access!.spaceKey !== spaceKey.toHex()) {
|
|
307
|
+
newDoc.change((doc) => {
|
|
308
|
+
doc.access!.spaceKey = spaceKey.toHex();
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
|
|
278
312
|
documentIdMapping[documentId as DocumentId] = newDoc.documentId;
|
|
279
313
|
}),
|
|
280
314
|
);
|
|
@@ -285,29 +319,38 @@ export class DataSpaceManager extends Resource {
|
|
|
285
319
|
let root: DatabaseRoot;
|
|
286
320
|
if (options.rootUrl) {
|
|
287
321
|
const newRootDocId = documentIdMapping[interpretAsDocumentId(options.rootUrl)] ?? failedInvariant();
|
|
288
|
-
const rootDocHandle = await this._echoHost.loadDoc<DatabaseDirectory>(
|
|
322
|
+
const rootDocHandle = await this._echoHost.loadDoc<DatabaseDirectory>(ctx, newRootDocId);
|
|
323
|
+
invariant(rootDocHandle, 'Root document must be available after import.');
|
|
289
324
|
DatabaseRoot.mapLinks(rootDocHandle, documentIdMapping);
|
|
290
325
|
|
|
291
|
-
root = await this._echoHost.openSpaceRoot(spaceId, `automerge:${newRootDocId}` as AutomergeUrl);
|
|
326
|
+
root = await this._echoHost.openSpaceRoot(ctx, spaceId, `automerge:${newRootDocId}` as AutomergeUrl);
|
|
292
327
|
} else {
|
|
293
|
-
root = await this._echoHost.createSpaceRoot(spaceKey);
|
|
328
|
+
root = await this._echoHost.createSpaceRoot(ctx, spaceKey);
|
|
294
329
|
}
|
|
330
|
+
await this._echoHost.flush(ctx);
|
|
295
331
|
|
|
296
332
|
log('constructing space...', { spaceKey });
|
|
297
333
|
|
|
298
|
-
const space = await this._constructSpace(metadata);
|
|
299
|
-
await space.open();
|
|
334
|
+
const space = await this._constructSpace(ctx, metadata);
|
|
335
|
+
await space.open(ctx);
|
|
300
336
|
|
|
301
337
|
log('adding space...', { spaceKey });
|
|
302
338
|
|
|
303
|
-
const credentials = await spaceGenesis(
|
|
339
|
+
const credentials = await spaceGenesis(
|
|
340
|
+
this._keyring,
|
|
341
|
+
this._signingContext,
|
|
342
|
+
space.inner,
|
|
343
|
+
root.url,
|
|
344
|
+
tags,
|
|
345
|
+
options.membershipPolicy,
|
|
346
|
+
);
|
|
304
347
|
await this._metadataStore.addSpace(metadata);
|
|
305
348
|
|
|
306
349
|
const memberCredential = credentials[1];
|
|
307
350
|
invariant(getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember');
|
|
308
351
|
await this._signingContext.recordCredential(memberCredential);
|
|
309
352
|
|
|
310
|
-
await space.initializeDataPipeline();
|
|
353
|
+
await space.initializeDataPipeline(ctx);
|
|
311
354
|
|
|
312
355
|
log('space ready.', { spaceId, spaceKey });
|
|
313
356
|
|
|
@@ -315,81 +358,36 @@ export class DataSpaceManager extends Resource {
|
|
|
315
358
|
return space;
|
|
316
359
|
}
|
|
317
360
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
case SpaceDocVersion.CURRENT: {
|
|
324
|
-
if (!space.databaseRoot.handle.isReady()) {
|
|
325
|
-
log.warn('waiting for space root to be ready', { spaceId: space.id });
|
|
326
|
-
await space.databaseRoot.handle.whenReady();
|
|
327
|
-
}
|
|
328
|
-
const [_, properties] = findInlineObjectOfType(space.databaseRoot.doc()!, TYPE_PROPERTIES) ?? [];
|
|
329
|
-
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
330
|
-
}
|
|
331
|
-
case SpaceDocVersion.LEGACY: {
|
|
332
|
-
throw new Error('Legacy space version is not supported');
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
default:
|
|
336
|
-
log.warn('unknown space version', { version: space.databaseRoot.getVersion(), spaceId: space.id });
|
|
337
|
-
return false;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
async createDefaultSpace(): Promise<DataSpace> {
|
|
342
|
-
const space = await this.createSpace();
|
|
343
|
-
const document = await this._getSpaceRootDocument(space);
|
|
344
|
-
|
|
345
|
-
// TODO(dmaretskyi): Better API for low-level data access.
|
|
346
|
-
const properties: ObjectStructure = {
|
|
347
|
-
system: {
|
|
348
|
-
type: encodeReference(getTypeReference(PropertiesType)!),
|
|
349
|
-
},
|
|
350
|
-
data: {
|
|
351
|
-
[DEFAULT_SPACE_KEY]: this._signingContext.identityKey.toHex(),
|
|
352
|
-
},
|
|
353
|
-
meta: {
|
|
354
|
-
keys: [],
|
|
355
|
-
},
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
const propertiesId = ObjectId.random();
|
|
359
|
-
document.change((doc: DatabaseDirectory) => {
|
|
360
|
-
setDeep(doc, ['objects', propertiesId], properties);
|
|
361
|
-
});
|
|
362
|
-
|
|
363
|
-
await this._echoHost.flush();
|
|
364
|
-
return space;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
private async _getSpaceRootDocument(space: DataSpace): Promise<DocHandle<DatabaseDirectory>> {
|
|
368
|
-
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
369
|
-
invariant(automergeIndex);
|
|
370
|
-
const document = await this._echoHost.automergeRepo.find<DatabaseDirectory>(automergeIndex as any, FIND_PARAMS);
|
|
371
|
-
await document.whenReady();
|
|
372
|
-
return document;
|
|
373
|
-
}
|
|
374
|
-
|
|
361
|
+
/**
|
|
362
|
+
* Accepts an existing space by joining its swarm and initializing the data pipeline.
|
|
363
|
+
* @param ctx - Caller context for cancellation and tracing.
|
|
364
|
+
* @param opts - Space keys and optional timeframes for catch-up.
|
|
365
|
+
*/
|
|
375
366
|
// TODO(burdon): Rename join space.
|
|
376
367
|
@synchronized
|
|
377
|
-
|
|
368
|
+
@trace.span({ showInBrowserTimeline: true, op: 'lifecycle' })
|
|
369
|
+
async acceptSpace(ctx: Context, opts: AcceptSpaceOptions): Promise<DataSpace> {
|
|
378
370
|
log('accept space', { opts });
|
|
379
371
|
invariant(this._lifecycleState === LifecycleState.OPEN, 'Not open.');
|
|
380
372
|
invariant(!this._spaces.has(opts.spaceKey), 'Space already exists.');
|
|
381
373
|
|
|
374
|
+
const tags = opts.tags ? Array.from(opts.tags) : [];
|
|
382
375
|
const metadata: SpaceMetadata = {
|
|
383
376
|
key: opts.spaceKey,
|
|
384
377
|
genesisFeedKey: opts.genesisFeedKey,
|
|
385
378
|
controlTimeframe: opts.controlTimeframe,
|
|
386
379
|
dataTimeframe: opts.dataTimeframe,
|
|
380
|
+
tags,
|
|
387
381
|
};
|
|
388
382
|
|
|
389
|
-
const space = await this._constructSpace(metadata);
|
|
390
|
-
await space.open();
|
|
383
|
+
const space = await this._constructSpace(ctx, metadata);
|
|
384
|
+
await space.open(ctx);
|
|
391
385
|
await this._metadataStore.addSpace(metadata);
|
|
392
|
-
|
|
386
|
+
// Use DSM lifecycle ctx: the invitation accept flow disposes `ctx` as soon as
|
|
387
|
+
// `acceptSpace` returns (guardedState.complete -> ctx.dispose). Detached data-pipeline
|
|
388
|
+
// initialization must outlive the invitation flow, and its span must be parented to a
|
|
389
|
+
// long-lived context.
|
|
390
|
+
space.initializeDataPipelineAsync(this._ctx);
|
|
393
391
|
|
|
394
392
|
this.updated.emit();
|
|
395
393
|
return space;
|
|
@@ -413,6 +411,7 @@ export class DataSpaceManager extends Resource {
|
|
|
413
411
|
space.spaceState.membershipChainHeads,
|
|
414
412
|
options.profile,
|
|
415
413
|
options.delegationCredentialId,
|
|
414
|
+
space.spaceState.tags,
|
|
416
415
|
);
|
|
417
416
|
|
|
418
417
|
// TODO(dmaretskyi): Refactor.
|
|
@@ -439,8 +438,8 @@ export class DataSpaceManager extends Resource {
|
|
|
439
438
|
);
|
|
440
439
|
}
|
|
441
440
|
|
|
442
|
-
public async requestSpaceAdmissionCredential(spaceKey: PublicKey): Promise<Credential> {
|
|
443
|
-
return this._spaceManager.requestSpaceAdmissionCredential({
|
|
441
|
+
public async requestSpaceAdmissionCredential(ctx: Context, spaceKey: PublicKey): Promise<Credential> {
|
|
442
|
+
return this._spaceManager.requestSpaceAdmissionCredential(ctx, {
|
|
444
443
|
spaceKey,
|
|
445
444
|
identityKey: this._signingContext.identityKey,
|
|
446
445
|
timeout: 15_000,
|
|
@@ -453,7 +452,11 @@ export class DataSpaceManager extends Resource {
|
|
|
453
452
|
});
|
|
454
453
|
}
|
|
455
454
|
|
|
456
|
-
async setSpaceEdgeReplicationSetting(
|
|
455
|
+
async setSpaceEdgeReplicationSetting(
|
|
456
|
+
ctx: Context,
|
|
457
|
+
spaceKey: PublicKey,
|
|
458
|
+
setting: EdgeReplicationSetting,
|
|
459
|
+
): Promise<void> {
|
|
457
460
|
const space = this._spaces.get(spaceKey);
|
|
458
461
|
invariant(space, 'Space not found.');
|
|
459
462
|
|
|
@@ -465,7 +468,7 @@ export class DataSpaceManager extends Resource {
|
|
|
465
468
|
await this._echoEdgeReplicator?.disconnectFromSpace(space.id);
|
|
466
469
|
break;
|
|
467
470
|
case EdgeReplicationSetting.ENABLED:
|
|
468
|
-
await this._echoEdgeReplicator?.connectToSpace(space.id);
|
|
471
|
+
await this._echoEdgeReplicator?.connectToSpace(ctx, space.id);
|
|
469
472
|
break;
|
|
470
473
|
}
|
|
471
474
|
}
|
|
@@ -473,14 +476,14 @@ export class DataSpaceManager extends Resource {
|
|
|
473
476
|
space.stateUpdate.emit();
|
|
474
477
|
}
|
|
475
478
|
|
|
476
|
-
private async _constructSpace(metadata: SpaceMetadata): Promise<DataSpace> {
|
|
479
|
+
private async _constructSpace(ctx: Context, metadata: SpaceMetadata): Promise<DataSpace> {
|
|
477
480
|
log('construct space', { metadata });
|
|
478
481
|
const gossip = new Gossip({
|
|
479
482
|
localPeerId: this._signingContext.deviceKey,
|
|
480
483
|
});
|
|
481
484
|
const presence = new Presence({
|
|
482
|
-
announceInterval: this.
|
|
483
|
-
offlineTimeout: this.
|
|
485
|
+
announceInterval: this._runtimeProps?.spaceMemberPresenceAnnounceInterval ?? PRESENCE_ANNOUNCE_INTERVAL,
|
|
486
|
+
offlineTimeout: this._runtimeProps?.spaceMemberPresenceOfflineTimeout ?? PRESENCE_OFFLINE_TIMEOUT,
|
|
484
487
|
identityKey: this._signingContext.identityKey,
|
|
485
488
|
gossip,
|
|
486
489
|
});
|
|
@@ -563,17 +566,19 @@ export class DataSpaceManager extends Resource {
|
|
|
563
566
|
},
|
|
564
567
|
},
|
|
565
568
|
cache: metadata.cache,
|
|
569
|
+
tags: metadata.tags,
|
|
566
570
|
edgeConnection: this._edgeConnection,
|
|
567
571
|
edgeHttpClient: this._edgeHttpClient,
|
|
568
572
|
edgeFeatures: this._edgeFeatures,
|
|
569
|
-
activeEdgeNotarizationPollingInterval: this.
|
|
573
|
+
activeEdgeNotarizationPollingInterval: this._runtimeProps?.activeEdgeNotarizationPollingInterval,
|
|
570
574
|
});
|
|
571
575
|
dataSpace.postOpen.append(async () => {
|
|
572
576
|
const setting = dataSpace.getEdgeReplicationSetting();
|
|
573
577
|
if (!setting || setting === EdgeReplicationSetting.ENABLED) {
|
|
574
|
-
|
|
578
|
+
// Use lifecycle ctx: the caller ctx from _constructSpace may be disposed by the time postOpen fires.
|
|
579
|
+
await this._echoEdgeReplicator?.connectToSpace(this._ctx, dataSpace.id);
|
|
575
580
|
} else if (this._echoEdgeReplicator) {
|
|
576
|
-
log('not connecting
|
|
581
|
+
log('not connecting edge replicator because of EdgeReplicationSetting', { spaceId: dataSpace.id });
|
|
577
582
|
}
|
|
578
583
|
});
|
|
579
584
|
dataSpace.preClose.append(async () => {
|
|
@@ -668,7 +673,7 @@ export class DataSpaceManager extends Resource {
|
|
|
668
673
|
invitations: Array<[PublicKey, DelegateSpaceInvitation]>,
|
|
669
674
|
): Promise<void> {
|
|
670
675
|
const tasks = invitations.map(([credentialId, invitation]) => {
|
|
671
|
-
return this._invitationsManager.createInvitation({
|
|
676
|
+
return this._invitationsManager.createInvitation(this._ctx, {
|
|
672
677
|
type: Invitation.Type.DELEGATED,
|
|
673
678
|
kind: Invitation.Kind.SPACE,
|
|
674
679
|
spaceKey: space.key,
|