@dxos/client-services 0.8.1 → 0.8.2-main.10c050d
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-MHDASPY5.mjs → chunk-LY3V7LMQ.mjs} +535 -551
- package/dist/lib/browser/chunk-LY3V7LMQ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-A2WCOW6P.cjs → chunk-LYHT7662.cjs} +704 -709
- package/dist/lib/node/chunk-LYHT7662.cjs.map +7 -0
- package/dist/lib/node/index.cjs +47 -47
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +8 -8
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/lib/node-esm/{chunk-SK52YZK7.mjs → chunk-LLRVFL7L.mjs} +535 -540
- package/dist/lib/node-esm/chunk-LLRVFL7L.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +1 -1
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- 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 +1 -1
- 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/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.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.map +1 -1
- package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/diagnostics.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
- 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 +2 -2
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts +1 -1
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- 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.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-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-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +1 -1
- 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/node.d.ts.map +1 -1
- package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -1
- package/dist/types/src/packlets/network/network-service.d.ts +3 -1
- package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/client-rpc-server.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +1 -0
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- 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/space-archive-reader.d.ts +1 -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.map +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 +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
- 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.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.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/worker/worker-runtime.d.ts.map +1 -1
- 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/src/version.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +39 -38
- package/src/packlets/agents/edge-agent-manager.ts +6 -6
- package/src/packlets/agents/edge-agent-service.ts +8 -11
- package/src/packlets/devices/devices-service.ts +5 -3
- package/src/packlets/identity/authenticator.ts +2 -2
- package/src/packlets/identity/default-space-state-machine.ts +1 -1
- package/src/packlets/identity/identity-manager.ts +13 -9
- package/src/packlets/identity/identity-recovery-manager.ts +6 -4
- package/src/packlets/identity/identity-service.ts +4 -4
- package/src/packlets/identity/identity.test.ts +9 -6
- package/src/packlets/identity/identity.ts +5 -5
- package/src/packlets/invitations/device-invitation-protocol.ts +1 -1
- package/src/packlets/invitations/edge-invitation-handler.ts +3 -3
- package/src/packlets/invitations/invitation-guest-extenstion.ts +3 -3
- package/src/packlets/invitations/invitation-host-extension.ts +5 -5
- package/src/packlets/invitations/invitation-topology.ts +1 -1
- package/src/packlets/invitations/invitations-handler.ts +2 -2
- package/src/packlets/invitations/invitations-manager.ts +15 -4
- package/src/packlets/invitations/space-invitation-protocol.ts +1 -1
- package/src/packlets/locks/browser.ts +4 -4
- package/src/packlets/locks/node.ts +2 -2
- package/src/packlets/logging/logging-service.ts +2 -2
- package/src/packlets/network/network-service.ts +11 -17
- package/src/packlets/services/client-rpc-server.ts +2 -2
- package/src/packlets/services/service-context.ts +10 -6
- package/src/packlets/services/service-host.ts +13 -5
- package/src/packlets/services/service-registry.ts +3 -3
- package/src/packlets/space-export/space-archive-reader.ts +2 -1
- package/src/packlets/space-export/space-archive-writer.ts +3 -3
- package/src/packlets/spaces/automerge-space-state.ts +3 -3
- package/src/packlets/spaces/data-space-manager.ts +47 -41
- package/src/packlets/spaces/data-space.ts +27 -20
- package/src/packlets/spaces/edge-feed-replicator.test.ts +2 -1
- package/src/packlets/spaces/edge-feed-replicator.ts +14 -13
- package/src/packlets/spaces/epoch-migrations.ts +3 -2
- package/src/packlets/spaces/notarization-plugin.test.ts +1 -1
- package/src/packlets/spaces/notarization-plugin.ts +18 -18
- package/src/packlets/spaces/spaces-service.ts +7 -6
- package/src/packlets/storage/profile-archive.ts +2 -1
- package/src/packlets/system/system-service.ts +2 -2
- package/src/packlets/testing/test-builder.ts +3 -3
- package/src/packlets/worker/worker-runtime.ts +4 -4
- package/src/packlets/worker/worker-session.ts +3 -3
- package/src/version.ts +1 -5
- package/dist/lib/browser/chunk-MHDASPY5.mjs.map +0 -7
- package/dist/lib/node/chunk-A2WCOW6P.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-SK52YZK7.mjs.map +0 -7
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_LYHT7662_exports = {};
|
|
30
|
+
__export(chunk_LYHT7662_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -72,7 +72,7 @@ __export(chunk_A2WCOW6P_exports, {
|
|
|
72
72
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
73
73
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
74
74
|
});
|
|
75
|
-
module.exports = __toCommonJS(
|
|
75
|
+
module.exports = __toCommonJS(chunk_LYHT7662_exports);
|
|
76
76
|
var import_async = require("@dxos/async");
|
|
77
77
|
var import_stream = require("@dxos/codec-protobuf/stream");
|
|
78
78
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -116,9 +116,10 @@ var import_log3 = require("@dxos/log");
|
|
|
116
116
|
var import_protocols2 = require("@dxos/protocols");
|
|
117
117
|
var import_buf = require("@dxos/protocols/buf");
|
|
118
118
|
var import_messenger_pb = require("@dxos/protocols/buf/dxos/edge/messenger_pb");
|
|
119
|
+
var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
|
|
119
120
|
var import_util3 = require("@dxos/util");
|
|
121
|
+
var import_automerge = require("@automerge/automerge");
|
|
120
122
|
var import_async7 = require("@dxos/async");
|
|
121
|
-
var import_automerge = require("@dxos/automerge/automerge");
|
|
122
123
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
123
124
|
var import_context4 = require("@dxos/context");
|
|
124
125
|
var import_debug = require("@dxos/debug");
|
|
@@ -128,7 +129,7 @@ var import_invariant3 = require("@dxos/invariant");
|
|
|
128
129
|
var import_keys4 = require("@dxos/keys");
|
|
129
130
|
var import_log4 = require("@dxos/log");
|
|
130
131
|
var import_protocols3 = require("@dxos/protocols");
|
|
131
|
-
var
|
|
132
|
+
var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
|
|
132
133
|
var import_credentials3 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
133
134
|
var import_timeframe = require("@dxos/timeframe");
|
|
134
135
|
var import_tracing3 = require("@dxos/tracing");
|
|
@@ -137,7 +138,7 @@ var import_async8 = require("@dxos/async");
|
|
|
137
138
|
var import_context5 = require("@dxos/context");
|
|
138
139
|
var import_credentials4 = require("@dxos/credentials");
|
|
139
140
|
var import_invariant4 = require("@dxos/invariant");
|
|
140
|
-
var
|
|
141
|
+
var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
|
|
141
142
|
var import_async9 = require("@dxos/async");
|
|
142
143
|
var import_context6 = require("@dxos/context");
|
|
143
144
|
var import_credentials5 = require("@dxos/credentials");
|
|
@@ -162,8 +163,8 @@ var import_util6 = require("@dxos/util");
|
|
|
162
163
|
var import_credentials8 = require("@dxos/credentials");
|
|
163
164
|
var import_keys7 = require("@dxos/keys");
|
|
164
165
|
var import_log7 = require("@dxos/log");
|
|
166
|
+
var import_automerge_repo = require("@automerge/automerge-repo");
|
|
165
167
|
var import_async11 = require("@dxos/async");
|
|
166
|
-
var import_automerge_repo = require("@dxos/automerge/automerge-repo");
|
|
167
168
|
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
168
169
|
var import_context7 = require("@dxos/context");
|
|
169
170
|
var import_credentials9 = require("@dxos/credentials");
|
|
@@ -175,7 +176,7 @@ var import_invariant7 = require("@dxos/invariant");
|
|
|
175
176
|
var import_keys8 = require("@dxos/keys");
|
|
176
177
|
var import_log8 = require("@dxos/log");
|
|
177
178
|
var import_protocols5 = require("@dxos/protocols");
|
|
178
|
-
var
|
|
179
|
+
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
179
180
|
var import_metadata = require("@dxos/protocols/proto/dxos/echo/metadata");
|
|
180
181
|
var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
181
182
|
var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
|
|
@@ -194,7 +195,7 @@ var import_invariant8 = require("@dxos/invariant");
|
|
|
194
195
|
var import_keys9 = require("@dxos/keys");
|
|
195
196
|
var import_log9 = require("@dxos/log");
|
|
196
197
|
var import_protocols6 = require("@dxos/protocols");
|
|
197
|
-
var
|
|
198
|
+
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
198
199
|
var import_tracing6 = require("@dxos/tracing");
|
|
199
200
|
var import_context8 = require("@dxos/context");
|
|
200
201
|
var import_invariant9 = require("@dxos/invariant");
|
|
@@ -210,7 +211,7 @@ var import_invariant11 = require("@dxos/invariant");
|
|
|
210
211
|
var import_keys10 = require("@dxos/keys");
|
|
211
212
|
var import_log11 = require("@dxos/log");
|
|
212
213
|
var import_protocols9 = require("@dxos/protocols");
|
|
213
|
-
var
|
|
214
|
+
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
214
215
|
var import_credentials15 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
215
216
|
var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
|
|
216
217
|
var import_timeframe4 = require("@dxos/timeframe");
|
|
@@ -222,12 +223,12 @@ var import_context10 = require("@dxos/context");
|
|
|
222
223
|
var import_credentials16 = require("@dxos/credentials");
|
|
223
224
|
var import_invariant12 = require("@dxos/invariant");
|
|
224
225
|
var import_log12 = require("@dxos/log");
|
|
225
|
-
var
|
|
226
|
+
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
226
227
|
var import_util9 = require("@dxos/util");
|
|
227
228
|
var import_credentials17 = require("@dxos/credentials");
|
|
228
229
|
var import_invariant13 = require("@dxos/invariant");
|
|
229
230
|
var import_protocols10 = require("@dxos/protocols");
|
|
230
|
-
var
|
|
231
|
+
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
231
232
|
var import_async15 = require("@dxos/async");
|
|
232
233
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
233
234
|
var import_context11 = require("@dxos/context");
|
|
@@ -237,7 +238,7 @@ var import_keys11 = require("@dxos/keys");
|
|
|
237
238
|
var import_log13 = require("@dxos/log");
|
|
238
239
|
var import_network_manager = require("@dxos/network-manager");
|
|
239
240
|
var import_protocols11 = require("@dxos/protocols");
|
|
240
|
-
var
|
|
241
|
+
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
241
242
|
var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
242
243
|
var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
243
244
|
var import_tracing8 = require("@dxos/tracing");
|
|
@@ -249,9 +250,9 @@ var import_keys12 = require("@dxos/keys");
|
|
|
249
250
|
var import_log14 = require("@dxos/log");
|
|
250
251
|
var import_protocols12 = require("@dxos/protocols");
|
|
251
252
|
var import_proto3 = require("@dxos/protocols/proto");
|
|
252
|
-
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
253
|
-
var import_context12 = require("@dxos/context");
|
|
254
253
|
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
254
|
+
var import_context12 = require("@dxos/context");
|
|
255
|
+
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
255
256
|
var import_async17 = require("@dxos/async");
|
|
256
257
|
var import_context13 = require("@dxos/context");
|
|
257
258
|
var import_invariant16 = require("@dxos/invariant");
|
|
@@ -268,26 +269,26 @@ var import_keys13 = require("@dxos/keys");
|
|
|
268
269
|
var import_log16 = require("@dxos/log");
|
|
269
270
|
var import_protocols14 = require("@dxos/protocols");
|
|
270
271
|
var import_proto5 = require("@dxos/protocols/proto");
|
|
271
|
-
var
|
|
272
|
+
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
272
273
|
var import_invitations4 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
273
274
|
var import_teleport3 = require("@dxos/teleport");
|
|
274
275
|
var import_async19 = require("@dxos/async");
|
|
275
276
|
var import_log17 = require("@dxos/log");
|
|
276
|
-
var
|
|
277
|
+
var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
|
|
277
278
|
var import_invariant18 = require("@dxos/invariant");
|
|
278
279
|
var import_keys14 = require("@dxos/keys");
|
|
279
280
|
var import_log18 = require("@dxos/log");
|
|
280
281
|
var import_invitations5 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
281
282
|
var import_util11 = require("@dxos/util");
|
|
282
283
|
var import_stream9 = require("@dxos/codec-protobuf/stream");
|
|
283
|
-
var
|
|
284
|
+
var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
|
|
284
285
|
var import_tracing9 = require("@dxos/tracing");
|
|
285
286
|
var import_credentials18 = require("@dxos/credentials");
|
|
286
287
|
var import_feed_store5 = require("@dxos/feed-store");
|
|
287
288
|
var import_invariant19 = require("@dxos/invariant");
|
|
288
289
|
var import_log19 = require("@dxos/log");
|
|
289
290
|
var import_protocols15 = require("@dxos/protocols");
|
|
290
|
-
var
|
|
291
|
+
var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
|
|
291
292
|
var import_credentials19 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
292
293
|
var import_async20 = require("@dxos/async");
|
|
293
294
|
var import_client_protocol6 = require("@dxos/client-protocol");
|
|
@@ -297,7 +298,7 @@ var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
|
297
298
|
var import_invariant20 = require("@dxos/invariant");
|
|
298
299
|
var import_keys15 = require("@dxos/keys");
|
|
299
300
|
var import_log20 = require("@dxos/log");
|
|
300
|
-
var
|
|
301
|
+
var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
|
|
301
302
|
var import_credentials21 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
302
303
|
var import_invariant21 = require("@dxos/invariant");
|
|
303
304
|
var import_lock_file = require("@dxos/lock-file");
|
|
@@ -312,11 +313,11 @@ var import_invariant22 = require("@dxos/invariant");
|
|
|
312
313
|
var import_keys16 = require("@dxos/keys");
|
|
313
314
|
var import_log22 = require("@dxos/log");
|
|
314
315
|
var import_protocols16 = require("@dxos/protocols");
|
|
315
|
-
var
|
|
316
|
+
var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
|
|
316
317
|
var import_metadata2 = require("@dxos/protocols/proto/dxos/echo/metadata");
|
|
317
318
|
var import_stream10 = require("@dxos/codec-protobuf/stream");
|
|
318
319
|
var import_protocols17 = require("@dxos/protocols");
|
|
319
|
-
var
|
|
320
|
+
var import_services21 = require("@dxos/protocols/proto/dxos/client/services");
|
|
320
321
|
var import_async22 = require("@dxos/async");
|
|
321
322
|
var import_context17 = require("@dxos/context");
|
|
322
323
|
var import_credentials22 = require("@dxos/credentials");
|
|
@@ -329,7 +330,7 @@ var import_keyring = require("@dxos/keyring");
|
|
|
329
330
|
var import_keys17 = require("@dxos/keys");
|
|
330
331
|
var import_log23 = require("@dxos/log");
|
|
331
332
|
var import_protocols18 = require("@dxos/protocols");
|
|
332
|
-
var
|
|
333
|
+
var import_services22 = require("@dxos/protocols/proto/dxos/client/services");
|
|
333
334
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
334
335
|
var import_tracing11 = require("@dxos/tracing");
|
|
335
336
|
var import_util12 = require("@dxos/util");
|
|
@@ -350,7 +351,7 @@ var import_util13 = require("@dxos/util");
|
|
|
350
351
|
var import_node_path = __toESM(require("node:path"));
|
|
351
352
|
var import_keys19 = require("@dxos/keys");
|
|
352
353
|
var import_kv_store = require("@dxos/kv-store");
|
|
353
|
-
var import_automerge_repo2 = require("@
|
|
354
|
+
var import_automerge_repo2 = require("@automerge/automerge-repo");
|
|
354
355
|
var import_invariant25 = require("@dxos/invariant");
|
|
355
356
|
var import_log25 = require("@dxos/log");
|
|
356
357
|
var import_protocols21 = require("@dxos/protocols");
|
|
@@ -365,13 +366,13 @@ var import_log26 = require("@dxos/log");
|
|
|
365
366
|
var import_messaging = require("@dxos/messaging");
|
|
366
367
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
367
368
|
var import_protocols22 = require("@dxos/protocols");
|
|
368
|
-
var
|
|
369
|
+
var import_services23 = require("@dxos/protocols/proto/dxos/client/services");
|
|
369
370
|
var import_tracing12 = require("@dxos/tracing");
|
|
370
371
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
371
372
|
var import_async24 = require("@dxos/async");
|
|
372
373
|
var import_stream11 = require("@dxos/codec-protobuf/stream");
|
|
373
374
|
var import_invariant27 = require("@dxos/invariant");
|
|
374
|
-
var
|
|
375
|
+
var import_services24 = require("@dxos/protocols/proto/dxos/client/services");
|
|
375
376
|
var import_async25 = require("@dxos/async");
|
|
376
377
|
var import_stream12 = require("@dxos/codec-protobuf/stream");
|
|
377
378
|
var import_keys21 = require("@dxos/keys");
|
|
@@ -380,11 +381,11 @@ var import_async26 = require("@dxos/async");
|
|
|
380
381
|
var import_stream13 = require("@dxos/codec-protobuf/stream");
|
|
381
382
|
var import_keys22 = require("@dxos/keys");
|
|
382
383
|
var import_log27 = require("@dxos/log");
|
|
383
|
-
var
|
|
384
|
+
var import_services25 = require("@dxos/protocols/proto/dxos/client/services");
|
|
384
385
|
var import_util16 = require("@dxos/util");
|
|
385
386
|
var import_stream14 = require("@dxos/codec-protobuf/stream");
|
|
386
387
|
var import_stream15 = require("@dxos/codec-protobuf/stream");
|
|
387
|
-
var
|
|
388
|
+
var import_services26 = require("@dxos/protocols/proto/dxos/client/services");
|
|
388
389
|
var import_util17 = require("@dxos/util");
|
|
389
390
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/feeds.ts";
|
|
390
391
|
var subscribeToFeeds = ({ feedStore, spaceManager }, { feedKeys }) => {
|
|
@@ -744,7 +745,7 @@ var DevtoolsServiceImpl = class {
|
|
|
744
745
|
});
|
|
745
746
|
}
|
|
746
747
|
};
|
|
747
|
-
var DXOS_VERSION = "0.8.
|
|
748
|
+
var DXOS_VERSION = "0.8.2-main.10c050d";
|
|
748
749
|
var getPlatform = () => {
|
|
749
750
|
if (process.browser) {
|
|
750
751
|
if (typeof window !== "undefined") {
|
|
@@ -1059,67 +1060,70 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
1059
1060
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1060
1061
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1061
1062
|
}
|
|
1062
|
-
function
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
a: isAwait
|
|
1093
|
-
});
|
|
1094
|
-
}
|
|
1095
|
-
return value;
|
|
1063
|
+
function _ts_add_disposable_resource(env, value, async) {
|
|
1064
|
+
if (value !== null && value !== void 0) {
|
|
1065
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
1066
|
+
var dispose, inner;
|
|
1067
|
+
if (async) {
|
|
1068
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
1069
|
+
dispose = value[Symbol.asyncDispose];
|
|
1070
|
+
}
|
|
1071
|
+
if (dispose === void 0) {
|
|
1072
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
1073
|
+
dispose = value[Symbol.dispose];
|
|
1074
|
+
if (async) inner = dispose;
|
|
1075
|
+
}
|
|
1076
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
1077
|
+
if (inner) dispose = function() {
|
|
1078
|
+
try {
|
|
1079
|
+
inner.call(this);
|
|
1080
|
+
} catch (e) {
|
|
1081
|
+
return Promise.reject(e);
|
|
1082
|
+
}
|
|
1083
|
+
};
|
|
1084
|
+
env.stack.push({
|
|
1085
|
+
value,
|
|
1086
|
+
dispose,
|
|
1087
|
+
async
|
|
1088
|
+
});
|
|
1089
|
+
} else if (async) {
|
|
1090
|
+
env.stack.push({
|
|
1091
|
+
async: true
|
|
1092
|
+
});
|
|
1096
1093
|
}
|
|
1097
|
-
return
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1094
|
+
return value;
|
|
1095
|
+
}
|
|
1096
|
+
function _ts_dispose_resources(env) {
|
|
1097
|
+
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
1098
|
+
var e = new Error(message);
|
|
1099
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
1100
|
+
};
|
|
1101
|
+
return (_ts_dispose_resources = function _ts_dispose_resources5(env2) {
|
|
1102
|
+
function fail(e) {
|
|
1103
|
+
env2.error = env2.hasError ? new _SuppressedError(e, env2.error, "An error was suppressed during disposal.") : e;
|
|
1104
|
+
env2.hasError = true;
|
|
1105
|
+
}
|
|
1106
|
+
var r, s = 0;
|
|
1107
|
+
function next() {
|
|
1108
|
+
while (r = env2.stack.pop()) {
|
|
1109
|
+
try {
|
|
1110
|
+
if (!r.async && s === 1) return s = 0, env2.stack.push(r), Promise.resolve().then(next);
|
|
1111
|
+
if (r.dispose) {
|
|
1112
|
+
var result = r.dispose.call(r.value);
|
|
1113
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
|
|
1114
|
+
fail(e);
|
|
1115
|
+
return next();
|
|
1116
|
+
});
|
|
1117
|
+
} else s |= 1;
|
|
1118
|
+
} catch (e) {
|
|
1119
|
+
fail(e);
|
|
1113
1120
|
}
|
|
1114
|
-
if (error !== empty) throw error;
|
|
1115
|
-
}
|
|
1116
|
-
function err(e) {
|
|
1117
|
-
error = error !== empty ? new _disposeSuppressedError(error, e) : e;
|
|
1118
|
-
return next();
|
|
1119
1121
|
}
|
|
1120
|
-
return
|
|
1122
|
+
if (s === 1) return env2.hasError ? Promise.reject(env2.error) : Promise.resolve();
|
|
1123
|
+
if (env2.hasError) throw env2.error;
|
|
1121
1124
|
}
|
|
1122
|
-
|
|
1125
|
+
return next();
|
|
1126
|
+
})(env);
|
|
1123
1127
|
}
|
|
1124
1128
|
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/edge-feed-replicator.ts";
|
|
1125
1129
|
var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
@@ -1136,7 +1140,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1136
1140
|
async _open() {
|
|
1137
1141
|
(0, import_log3.log)("open", void 0, {
|
|
1138
1142
|
F: __dxlog_file5,
|
|
1139
|
-
L:
|
|
1143
|
+
L: 57,
|
|
1140
1144
|
S: this,
|
|
1141
1145
|
C: (f, a) => f(...a)
|
|
1142
1146
|
});
|
|
@@ -1155,7 +1159,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1155
1159
|
_spaceId: this._spaceId
|
|
1156
1160
|
}, {
|
|
1157
1161
|
F: __dxlog_file5,
|
|
1158
|
-
L:
|
|
1162
|
+
L: 71,
|
|
1159
1163
|
S: this,
|
|
1160
1164
|
C: (f, a) => f(...a)
|
|
1161
1165
|
});
|
|
@@ -1168,7 +1172,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1168
1172
|
type: payload.type
|
|
1169
1173
|
}, {
|
|
1170
1174
|
F: __dxlog_file5,
|
|
1171
|
-
L:
|
|
1175
|
+
L: 76,
|
|
1172
1176
|
S: this,
|
|
1173
1177
|
C: (f, a) => f(...a)
|
|
1174
1178
|
});
|
|
@@ -1180,14 +1184,14 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1180
1184
|
}
|
|
1181
1185
|
async _handleReconnect() {
|
|
1182
1186
|
await this._resetConnection();
|
|
1183
|
-
if (this._messenger.
|
|
1187
|
+
if (this._messenger.status === import_services4.EdgeStatus.CONNECTED) {
|
|
1184
1188
|
this._startReplication();
|
|
1185
1189
|
}
|
|
1186
1190
|
}
|
|
1187
1191
|
async _close() {
|
|
1188
1192
|
(0, import_log3.log)("close", void 0, {
|
|
1189
1193
|
F: __dxlog_file5,
|
|
1190
|
-
L:
|
|
1194
|
+
L: 96,
|
|
1191
1195
|
S: this,
|
|
1192
1196
|
C: (f, a) => f(...a)
|
|
1193
1197
|
});
|
|
@@ -1199,7 +1203,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1199
1203
|
this._connectionCtx = connectionCtx;
|
|
1200
1204
|
(0, import_log3.log)("connection context created", void 0, {
|
|
1201
1205
|
F: __dxlog_file5,
|
|
1202
|
-
L:
|
|
1206
|
+
L: 104,
|
|
1203
1207
|
S: this,
|
|
1204
1208
|
C: (f, a) => f(...a)
|
|
1205
1209
|
});
|
|
@@ -1212,7 +1216,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1212
1216
|
async _resetConnection() {
|
|
1213
1217
|
(0, import_log3.log)("resetConnection", void 0, {
|
|
1214
1218
|
F: __dxlog_file5,
|
|
1215
|
-
L:
|
|
1219
|
+
L: 113,
|
|
1216
1220
|
S: this,
|
|
1217
1221
|
C: (f, a) => f(...a)
|
|
1218
1222
|
});
|
|
@@ -1228,7 +1232,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1228
1232
|
hasConnectionCtx: !!this._connectionCtx
|
|
1229
1233
|
}, {
|
|
1230
1234
|
F: __dxlog_file5,
|
|
1231
|
-
L:
|
|
1235
|
+
L: 121,
|
|
1232
1236
|
S: this,
|
|
1233
1237
|
C: (f, a) => f(...a)
|
|
1234
1238
|
});
|
|
@@ -1245,7 +1249,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1245
1249
|
key: feed.key
|
|
1246
1250
|
}, {
|
|
1247
1251
|
F: __dxlog_file5,
|
|
1248
|
-
L:
|
|
1252
|
+
L: 134,
|
|
1249
1253
|
S: this,
|
|
1250
1254
|
C: (f, a) => f(...a)
|
|
1251
1255
|
});
|
|
@@ -1261,7 +1265,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1261
1265
|
if (!this._connectionCtx) {
|
|
1262
1266
|
(0, import_log3.log)("message dropped because connection was disposed", void 0, {
|
|
1263
1267
|
F: __dxlog_file5,
|
|
1264
|
-
L:
|
|
1268
|
+
L: 147,
|
|
1265
1269
|
S: this,
|
|
1266
1270
|
C: (f, a) => f(...a)
|
|
1267
1271
|
});
|
|
@@ -1273,14 +1277,14 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1273
1277
|
blocks: message.blocks.map((b) => b.index)
|
|
1274
1278
|
}, {
|
|
1275
1279
|
F: __dxlog_file5,
|
|
1276
|
-
L:
|
|
1280
|
+
L: 152,
|
|
1277
1281
|
S: this,
|
|
1278
1282
|
C: (f, a) => f(...a)
|
|
1279
1283
|
});
|
|
1280
1284
|
}
|
|
1281
1285
|
(0, import_invariant2.invariant)(message.feedKey, void 0, {
|
|
1282
1286
|
F: __dxlog_file5,
|
|
1283
|
-
L:
|
|
1287
|
+
L: 158,
|
|
1284
1288
|
S: this,
|
|
1285
1289
|
A: [
|
|
1286
1290
|
"message.feedKey",
|
|
@@ -1292,7 +1296,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1292
1296
|
type: message.type
|
|
1293
1297
|
}, {
|
|
1294
1298
|
F: __dxlog_file5,
|
|
1295
|
-
L:
|
|
1299
|
+
L: 161,
|
|
1296
1300
|
S: this,
|
|
1297
1301
|
C: (f, a) => f(...a)
|
|
1298
1302
|
});
|
|
@@ -1311,7 +1315,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1311
1315
|
if (!this._connectionCtx) {
|
|
1312
1316
|
import_log3.log.warn("received message after connection context was disposed", void 0, {
|
|
1313
1317
|
F: __dxlog_file5,
|
|
1314
|
-
L:
|
|
1318
|
+
L: 176,
|
|
1315
1319
|
S: this,
|
|
1316
1320
|
C: (f, a) => f(...a)
|
|
1317
1321
|
});
|
|
@@ -1320,8 +1324,12 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1320
1324
|
(0, import_async6.scheduleMicroTask)(this._connectionCtx, async () => {
|
|
1321
1325
|
switch (message.type) {
|
|
1322
1326
|
case "metadata": {
|
|
1327
|
+
const env = {
|
|
1328
|
+
stack: [],
|
|
1329
|
+
error: void 0,
|
|
1330
|
+
hasError: false
|
|
1331
|
+
};
|
|
1323
1332
|
try {
|
|
1324
|
-
var _usingCtx = _using_ctx();
|
|
1325
1333
|
const feedKey = import_keys3.PublicKey.fromHex(message.feedKey);
|
|
1326
1334
|
const feed = this._feeds.get(feedKey);
|
|
1327
1335
|
if (!feed) {
|
|
@@ -1329,13 +1337,13 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1329
1337
|
feedKey
|
|
1330
1338
|
}, {
|
|
1331
1339
|
F: __dxlog_file5,
|
|
1332
|
-
L:
|
|
1340
|
+
L: 185,
|
|
1333
1341
|
S: this,
|
|
1334
1342
|
C: (f, a) => f(...a)
|
|
1335
1343
|
});
|
|
1336
1344
|
return;
|
|
1337
1345
|
}
|
|
1338
|
-
const _guard =
|
|
1346
|
+
const _guard = _ts_add_disposable_resource(env, await this._getPushMutex(feed.key).acquire(), false);
|
|
1339
1347
|
this._remoteLength.set(feedKey, message.length);
|
|
1340
1348
|
const logMeta = {
|
|
1341
1349
|
localLength: feed.length,
|
|
@@ -1345,7 +1353,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1345
1353
|
if (message.length > feed.length) {
|
|
1346
1354
|
(0, import_log3.log)("requesting missing blocks", logMeta, {
|
|
1347
1355
|
F: __dxlog_file5,
|
|
1348
|
-
L:
|
|
1356
|
+
L: 195,
|
|
1349
1357
|
S: this,
|
|
1350
1358
|
C: (f, a) => f(...a)
|
|
1351
1359
|
});
|
|
@@ -1360,17 +1368,18 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1360
1368
|
} else if (message.length < feed.length) {
|
|
1361
1369
|
(0, import_log3.log)("pushing blocks to remote", logMeta, {
|
|
1362
1370
|
F: __dxlog_file5,
|
|
1363
|
-
L:
|
|
1371
|
+
L: 203,
|
|
1364
1372
|
S: this,
|
|
1365
1373
|
C: (f, a) => f(...a)
|
|
1366
1374
|
});
|
|
1367
1375
|
await this._pushBlocks(feed, message.length, feed.length);
|
|
1368
1376
|
}
|
|
1369
1377
|
break;
|
|
1370
|
-
} catch (
|
|
1371
|
-
|
|
1378
|
+
} catch (e) {
|
|
1379
|
+
env.error = e;
|
|
1380
|
+
env.hasError = true;
|
|
1372
1381
|
} finally {
|
|
1373
|
-
|
|
1382
|
+
_ts_dispose_resources(env);
|
|
1374
1383
|
}
|
|
1375
1384
|
}
|
|
1376
1385
|
case "data": {
|
|
@@ -1379,7 +1388,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1379
1388
|
blocks: message.blocks.map((b) => b.index)
|
|
1380
1389
|
}, {
|
|
1381
1390
|
F: __dxlog_file5,
|
|
1382
|
-
L:
|
|
1391
|
+
L: 212,
|
|
1383
1392
|
S: this,
|
|
1384
1393
|
C: (f, a) => f(...a)
|
|
1385
1394
|
});
|
|
@@ -1390,7 +1399,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1390
1399
|
feedKey
|
|
1391
1400
|
}, {
|
|
1392
1401
|
F: __dxlog_file5,
|
|
1393
|
-
L:
|
|
1402
|
+
L: 217,
|
|
1394
1403
|
S: this,
|
|
1395
1404
|
C: (f, a) => f(...a)
|
|
1396
1405
|
});
|
|
@@ -1404,7 +1413,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1404
1413
|
...message
|
|
1405
1414
|
}, {
|
|
1406
1415
|
F: __dxlog_file5,
|
|
1407
|
-
L:
|
|
1416
|
+
L: 226,
|
|
1408
1417
|
S: this,
|
|
1409
1418
|
C: (f, a) => f(...a)
|
|
1410
1419
|
});
|
|
@@ -1419,7 +1428,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1419
1428
|
to
|
|
1420
1429
|
}, {
|
|
1421
1430
|
F: __dxlog_file5,
|
|
1422
|
-
L:
|
|
1431
|
+
L: 233,
|
|
1423
1432
|
S: this,
|
|
1424
1433
|
C: (f, a) => f(...a)
|
|
1425
1434
|
});
|
|
@@ -1429,7 +1438,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1429
1438
|
});
|
|
1430
1439
|
(0, import_invariant2.invariant)(data instanceof Uint8Array, void 0, {
|
|
1431
1440
|
F: __dxlog_file5,
|
|
1432
|
-
L:
|
|
1441
|
+
L: 238,
|
|
1433
1442
|
S: this,
|
|
1434
1443
|
A: [
|
|
1435
1444
|
"data instanceof Uint8Array",
|
|
@@ -1457,7 +1466,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1457
1466
|
blocks: blocks.length
|
|
1458
1467
|
}, {
|
|
1459
1468
|
F: __dxlog_file5,
|
|
1460
|
-
L:
|
|
1469
|
+
L: 259,
|
|
1461
1470
|
S: this,
|
|
1462
1471
|
C: (f, a) => f(...a)
|
|
1463
1472
|
});
|
|
@@ -1473,13 +1482,17 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1473
1482
|
}
|
|
1474
1483
|
}
|
|
1475
1484
|
async _pushBlocksIfNeeded(feed) {
|
|
1485
|
+
const env = {
|
|
1486
|
+
stack: [],
|
|
1487
|
+
error: void 0,
|
|
1488
|
+
hasError: false
|
|
1489
|
+
};
|
|
1476
1490
|
try {
|
|
1477
|
-
|
|
1478
|
-
const _ = _usingCtx.u(await this._getPushMutex(feed.key).acquire());
|
|
1491
|
+
const _ = _ts_add_disposable_resource(env, await this._getPushMutex(feed.key).acquire(), false);
|
|
1479
1492
|
if (!this._remoteLength.has(feed.key)) {
|
|
1480
1493
|
(0, import_log3.log)("blocks not pushed because remote length is unknown", void 0, {
|
|
1481
1494
|
F: __dxlog_file5,
|
|
1482
|
-
L:
|
|
1495
|
+
L: 280,
|
|
1483
1496
|
S: this,
|
|
1484
1497
|
C: (f, a) => f(...a)
|
|
1485
1498
|
});
|
|
@@ -1489,10 +1502,11 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1489
1502
|
if (remoteLength < feed.length) {
|
|
1490
1503
|
await this._pushBlocks(feed, remoteLength, feed.length);
|
|
1491
1504
|
}
|
|
1492
|
-
} catch (
|
|
1493
|
-
|
|
1505
|
+
} catch (e) {
|
|
1506
|
+
env.error = e;
|
|
1507
|
+
env.hasError = true;
|
|
1494
1508
|
} finally {
|
|
1495
|
-
|
|
1509
|
+
_ts_dispose_resources(env);
|
|
1496
1510
|
}
|
|
1497
1511
|
}
|
|
1498
1512
|
_createConnectionContext() {
|
|
@@ -1504,7 +1518,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1504
1518
|
if (err instanceof import_edge_client.EdgeIdentityChangedError || err instanceof import_edge_client.EdgeConnectionClosedError) {
|
|
1505
1519
|
(0, import_log3.log)("resetting on reconnect", void 0, {
|
|
1506
1520
|
F: __dxlog_file5,
|
|
1507
|
-
L:
|
|
1521
|
+
L: 297,
|
|
1508
1522
|
S: this,
|
|
1509
1523
|
C: (f, a) => f(...a)
|
|
1510
1524
|
});
|
|
@@ -1515,7 +1529,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1515
1529
|
}
|
|
1516
1530
|
}, {
|
|
1517
1531
|
F: __dxlog_file5,
|
|
1518
|
-
L:
|
|
1532
|
+
L: 291
|
|
1519
1533
|
});
|
|
1520
1534
|
return connectionCtx;
|
|
1521
1535
|
}
|
|
@@ -1535,12 +1549,7 @@ var bufferizeBlock = (block) => ({
|
|
|
1535
1549
|
});
|
|
1536
1550
|
var AutomergeSpaceState = class extends import_context5.Resource {
|
|
1537
1551
|
constructor(_onNewRoot) {
|
|
1538
|
-
super();
|
|
1539
|
-
this._onNewRoot = _onNewRoot;
|
|
1540
|
-
this.rootUrl = void 0;
|
|
1541
|
-
this.lastEpoch = void 0;
|
|
1542
|
-
this.onNewEpoch = new import_async8.Event();
|
|
1543
|
-
this._isProcessingRootDocs = false;
|
|
1552
|
+
super(), this._onNewRoot = _onNewRoot, this.rootUrl = void 0, this.lastEpoch = void 0, this.onNewEpoch = new import_async8.Event(), this._isProcessingRootDocs = false;
|
|
1544
1553
|
}
|
|
1545
1554
|
async _open(ctx) {
|
|
1546
1555
|
}
|
|
@@ -1577,37 +1586,37 @@ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/sr
|
|
|
1577
1586
|
var LOAD_DOC_TIMEOUT = 1e4;
|
|
1578
1587
|
var runEpochMigration = async (ctx, context) => {
|
|
1579
1588
|
switch (context.migration) {
|
|
1580
|
-
case
|
|
1589
|
+
case import_services6.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
|
|
1581
1590
|
const document = context.echoHost.createDoc();
|
|
1582
1591
|
await context.echoHost.flush();
|
|
1583
1592
|
return {
|
|
1584
1593
|
newRoot: document.url
|
|
1585
1594
|
};
|
|
1586
1595
|
}
|
|
1587
|
-
case
|
|
1596
|
+
case import_services6.CreateEpochRequest.Migration.PRUNE_AUTOMERGE_ROOT_HISTORY: {
|
|
1588
1597
|
if (!context.currentRoot) {
|
|
1589
1598
|
throw new Error("Space does not have an automerge root");
|
|
1590
1599
|
}
|
|
1591
1600
|
const rootHandle = await context.echoHost.loadDoc(ctx, context.currentRoot, {
|
|
1592
1601
|
timeout: LOAD_DOC_TIMEOUT
|
|
1593
1602
|
});
|
|
1594
|
-
const newRoot = context.echoHost.createDoc(rootHandle.
|
|
1603
|
+
const newRoot = context.echoHost.createDoc(rootHandle.doc());
|
|
1595
1604
|
await context.echoHost.flush();
|
|
1596
1605
|
return {
|
|
1597
1606
|
newRoot: newRoot.url
|
|
1598
1607
|
};
|
|
1599
1608
|
}
|
|
1600
|
-
case
|
|
1609
|
+
case import_services6.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
|
|
1601
1610
|
throw new Error("Migration not available");
|
|
1602
1611
|
}
|
|
1603
|
-
case
|
|
1612
|
+
case import_services6.CreateEpochRequest.Migration.MIGRATE_REFERENCES_TO_DXN: {
|
|
1604
1613
|
throw new Error("Migration not available");
|
|
1605
1614
|
}
|
|
1606
1615
|
// TODO(dmaretskyi): This path doesn't seem to fit here. This is not a migration.
|
|
1607
|
-
case
|
|
1616
|
+
case import_services6.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
|
|
1608
1617
|
(0, import_invariant4.invariant)(context.newAutomergeRoot, void 0, {
|
|
1609
1618
|
F: __dxlog_file6,
|
|
1610
|
-
L:
|
|
1619
|
+
L: 63,
|
|
1611
1620
|
S: void 0,
|
|
1612
1621
|
A: [
|
|
1613
1622
|
"context.newAutomergeRoot",
|
|
@@ -2042,8 +2051,7 @@ var NotarizationTeleportExtension = class extends import_teleport.RpcExtension {
|
|
|
2042
2051
|
exposed: {
|
|
2043
2052
|
NotarizationService: import_proto2.schema.getService("dxos.mesh.teleport.notarization.NotarizationService")
|
|
2044
2053
|
}
|
|
2045
|
-
});
|
|
2046
|
-
this._params = _params;
|
|
2054
|
+
}), this._params = _params;
|
|
2047
2055
|
}
|
|
2048
2056
|
async getHandlers() {
|
|
2049
2057
|
return {
|
|
@@ -2207,14 +2215,15 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2207
2215
|
id: "spaces",
|
|
2208
2216
|
name: "Spaces",
|
|
2209
2217
|
fetch: async () => {
|
|
2210
|
-
return Array.from(this._spaces.values()).map((space) => {
|
|
2218
|
+
return Promise.all(Array.from(this._spaces.values()).map(async (space) => {
|
|
2211
2219
|
const rootUrl = space.automergeSpaceState.rootUrl;
|
|
2212
|
-
const rootHandle = rootUrl ? this._echoHost.automergeRepo.find(rootUrl) : void 0;
|
|
2213
|
-
|
|
2220
|
+
const rootHandle = rootUrl ? await this._echoHost.automergeRepo.find(rootUrl, import_echo_pipeline2.FIND_PARAMS) : void 0;
|
|
2221
|
+
await rootHandle?.whenReady();
|
|
2222
|
+
const rootDoc = rootHandle?.doc();
|
|
2214
2223
|
const properties = rootDoc && (0, import_echo_pipeline2.findInlineObjectOfType)(rootDoc, import_client_protocol4.TYPE_PROPERTIES);
|
|
2215
2224
|
return {
|
|
2216
2225
|
key: space.key.toHex(),
|
|
2217
|
-
state:
|
|
2226
|
+
state: import_services7.SpaceState[space.state],
|
|
2218
2227
|
name: properties?.[1].data.name ?? null,
|
|
2219
2228
|
inlineObjects: rootDoc ? Object.keys(rootDoc.objects ?? {}).length : null,
|
|
2220
2229
|
linkedObjects: rootDoc ? Object.keys(rootDoc.links ?? {}).length : null,
|
|
@@ -2222,7 +2231,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2222
2231
|
members: space.inner.spaceState.members.size,
|
|
2223
2232
|
rootUrl
|
|
2224
2233
|
};
|
|
2225
|
-
});
|
|
2234
|
+
}));
|
|
2226
2235
|
}
|
|
2227
2236
|
});
|
|
2228
2237
|
}
|
|
@@ -2238,7 +2247,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2238
2247
|
async _open() {
|
|
2239
2248
|
(0, import_log8.log)("open", void 0, {
|
|
2240
2249
|
F: __dxlog_file9,
|
|
2241
|
-
L:
|
|
2250
|
+
L: 215,
|
|
2242
2251
|
S: this,
|
|
2243
2252
|
C: (f, a) => f(...a)
|
|
2244
2253
|
});
|
|
@@ -2246,7 +2255,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2246
2255
|
id: this._instanceId
|
|
2247
2256
|
}), {
|
|
2248
2257
|
F: __dxlog_file9,
|
|
2249
|
-
L:
|
|
2258
|
+
L: 216,
|
|
2250
2259
|
S: this,
|
|
2251
2260
|
C: (f, a) => f(...a)
|
|
2252
2261
|
});
|
|
@@ -2254,7 +2263,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2254
2263
|
spaces: this._metadataStore.spaces.length
|
|
2255
2264
|
}, {
|
|
2256
2265
|
F: __dxlog_file9,
|
|
2257
|
-
L:
|
|
2266
|
+
L: 217,
|
|
2258
2267
|
S: this,
|
|
2259
2268
|
C: (f, a) => f(...a)
|
|
2260
2269
|
});
|
|
@@ -2264,7 +2273,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2264
2273
|
spaceMetadata
|
|
2265
2274
|
}, {
|
|
2266
2275
|
F: __dxlog_file9,
|
|
2267
|
-
L:
|
|
2276
|
+
L: 221,
|
|
2268
2277
|
S: this,
|
|
2269
2278
|
C: (f, a) => f(...a)
|
|
2270
2279
|
});
|
|
@@ -2275,7 +2284,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2275
2284
|
err
|
|
2276
2285
|
}, {
|
|
2277
2286
|
F: __dxlog_file9,
|
|
2278
|
-
L:
|
|
2287
|
+
L: 224,
|
|
2279
2288
|
S: this,
|
|
2280
2289
|
C: (f, a) => f(...a)
|
|
2281
2290
|
});
|
|
@@ -2286,7 +2295,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2286
2295
|
id: this._instanceId
|
|
2287
2296
|
}), {
|
|
2288
2297
|
F: __dxlog_file9,
|
|
2289
|
-
L:
|
|
2298
|
+
L: 230,
|
|
2290
2299
|
S: this,
|
|
2291
2300
|
C: (f, a) => f(...a)
|
|
2292
2301
|
});
|
|
@@ -2294,7 +2303,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2294
2303
|
async _close() {
|
|
2295
2304
|
(0, import_log8.log)("close", void 0, {
|
|
2296
2305
|
F: __dxlog_file9,
|
|
2297
|
-
L:
|
|
2306
|
+
L: 235,
|
|
2298
2307
|
S: this,
|
|
2299
2308
|
C: (f, a) => f(...a)
|
|
2300
2309
|
});
|
|
@@ -2318,14 +2327,14 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2318
2327
|
genesisFeedKey: controlFeedKey,
|
|
2319
2328
|
controlFeedKey,
|
|
2320
2329
|
dataFeedKey,
|
|
2321
|
-
state:
|
|
2330
|
+
state: import_services7.SpaceState.SPACE_ACTIVE
|
|
2322
2331
|
};
|
|
2323
2332
|
(0, import_log8.log)("creating space...", {
|
|
2324
2333
|
spaceId,
|
|
2325
2334
|
spaceKey
|
|
2326
2335
|
}, {
|
|
2327
2336
|
F: __dxlog_file9,
|
|
2328
|
-
L:
|
|
2337
|
+
L: 264,
|
|
2329
2338
|
S: this,
|
|
2330
2339
|
C: (f, a) => f(...a)
|
|
2331
2340
|
});
|
|
@@ -2333,7 +2342,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2333
2342
|
if (options.documents) {
|
|
2334
2343
|
(0, import_invariant7.invariant)(Object.keys(options.documents).every((documentId) => /^[a-zA-Z0-9]+$/.test(documentId)), "Invalid document IDs", {
|
|
2335
2344
|
F: __dxlog_file9,
|
|
2336
|
-
L:
|
|
2345
|
+
L: 269,
|
|
2337
2346
|
S: this,
|
|
2338
2347
|
A: [
|
|
2339
2348
|
"Object.keys(options.documents).every((documentId) => /^[a-zA-Z0-9]+$/.test(documentId))",
|
|
@@ -2345,7 +2354,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2345
2354
|
documentId
|
|
2346
2355
|
}, {
|
|
2347
2356
|
F: __dxlog_file9,
|
|
2348
|
-
L:
|
|
2357
|
+
L: 276,
|
|
2349
2358
|
S: this,
|
|
2350
2359
|
C: (f, a) => f(...a)
|
|
2351
2360
|
});
|
|
@@ -2359,7 +2368,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2359
2368
|
spaceKey
|
|
2360
2369
|
}, {
|
|
2361
2370
|
F: __dxlog_file9,
|
|
2362
|
-
L:
|
|
2371
|
+
L: 283,
|
|
2363
2372
|
S: this,
|
|
2364
2373
|
C: (f, a) => f(...a)
|
|
2365
2374
|
});
|
|
@@ -2368,7 +2377,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2368
2377
|
const newRootDocId = documentIdMapping[(0, import_automerge_repo.interpretAsDocumentId)(options.rootUrl)] ?? (0, import_invariant7.failedInvariant)();
|
|
2369
2378
|
const rootDocHandle = await this._echoHost.loadDoc(import_context7.Context.default(void 0, {
|
|
2370
2379
|
F: __dxlog_file9,
|
|
2371
|
-
L:
|
|
2380
|
+
L: 288
|
|
2372
2381
|
}), newRootDocId);
|
|
2373
2382
|
import_echo_pipeline2.DatabaseRoot.mapLinks(rootDocHandle, documentIdMapping);
|
|
2374
2383
|
root = await this._echoHost.openSpaceRoot(spaceId, `automerge:${newRootDocId}`);
|
|
@@ -2379,7 +2388,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2379
2388
|
spaceKey
|
|
2380
2389
|
}, {
|
|
2381
2390
|
F: __dxlog_file9,
|
|
2382
|
-
L:
|
|
2391
|
+
L: 296,
|
|
2383
2392
|
S: this,
|
|
2384
2393
|
C: (f, a) => f(...a)
|
|
2385
2394
|
});
|
|
@@ -2389,7 +2398,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2389
2398
|
spaceKey
|
|
2390
2399
|
}, {
|
|
2391
2400
|
F: __dxlog_file9,
|
|
2392
|
-
L:
|
|
2401
|
+
L: 301,
|
|
2393
2402
|
S: this,
|
|
2394
2403
|
C: (f, a) => f(...a)
|
|
2395
2404
|
});
|
|
@@ -2398,7 +2407,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2398
2407
|
const memberCredential = credentials[1];
|
|
2399
2408
|
(0, import_invariant7.invariant)((0, import_credentials9.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2400
2409
|
F: __dxlog_file9,
|
|
2401
|
-
L:
|
|
2410
|
+
L: 307,
|
|
2402
2411
|
S: this,
|
|
2403
2412
|
A: [
|
|
2404
2413
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2412,7 +2421,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2412
2421
|
spaceKey
|
|
2413
2422
|
}, {
|
|
2414
2423
|
F: __dxlog_file9,
|
|
2415
|
-
L:
|
|
2424
|
+
L: 312,
|
|
2416
2425
|
S: this,
|
|
2417
2426
|
C: (f, a) => f(...a)
|
|
2418
2427
|
});
|
|
@@ -2425,7 +2434,18 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2425
2434
|
}
|
|
2426
2435
|
switch (space.databaseRoot.getVersion()) {
|
|
2427
2436
|
case import_echo_protocol2.SpaceDocVersion.CURRENT: {
|
|
2428
|
-
|
|
2437
|
+
if (!space.databaseRoot.handle.isReady()) {
|
|
2438
|
+
import_log8.log.warn("waiting for space root to be ready", {
|
|
2439
|
+
spaceId: space.id
|
|
2440
|
+
}, {
|
|
2441
|
+
F: __dxlog_file9,
|
|
2442
|
+
L: 325,
|
|
2443
|
+
S: this,
|
|
2444
|
+
C: (f, a) => f(...a)
|
|
2445
|
+
});
|
|
2446
|
+
await space.databaseRoot.handle.whenReady();
|
|
2447
|
+
}
|
|
2448
|
+
const [_, properties] = (0, import_echo_pipeline2.findInlineObjectOfType)(space.databaseRoot.doc(), import_client_protocol4.TYPE_PROPERTIES) ?? [];
|
|
2429
2449
|
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
2430
2450
|
}
|
|
2431
2451
|
case import_echo_protocol2.SpaceDocVersion.LEGACY: {
|
|
@@ -2437,7 +2457,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2437
2457
|
spaceId: space.id
|
|
2438
2458
|
}, {
|
|
2439
2459
|
F: __dxlog_file9,
|
|
2440
|
-
L:
|
|
2460
|
+
L: 336,
|
|
2441
2461
|
S: this,
|
|
2442
2462
|
C: (f, a) => f(...a)
|
|
2443
2463
|
});
|
|
@@ -2458,7 +2478,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2458
2478
|
keys: []
|
|
2459
2479
|
}
|
|
2460
2480
|
};
|
|
2461
|
-
const propertiesId =
|
|
2481
|
+
const propertiesId = import_echo_schema.ObjectId.random();
|
|
2462
2482
|
document.change((doc) => {
|
|
2463
2483
|
(0, import_util7.setDeep)(doc, [
|
|
2464
2484
|
"objects",
|
|
@@ -2472,14 +2492,14 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2472
2492
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
2473
2493
|
(0, import_invariant7.invariant)(automergeIndex, void 0, {
|
|
2474
2494
|
F: __dxlog_file9,
|
|
2475
|
-
L:
|
|
2495
|
+
L: 369,
|
|
2476
2496
|
S: this,
|
|
2477
2497
|
A: [
|
|
2478
2498
|
"automergeIndex",
|
|
2479
2499
|
""
|
|
2480
2500
|
]
|
|
2481
2501
|
});
|
|
2482
|
-
const document = this._echoHost.automergeRepo.find(automergeIndex);
|
|
2502
|
+
const document = await this._echoHost.automergeRepo.find(automergeIndex, import_echo_pipeline2.FIND_PARAMS);
|
|
2483
2503
|
await document.whenReady();
|
|
2484
2504
|
return document;
|
|
2485
2505
|
}
|
|
@@ -2489,13 +2509,13 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2489
2509
|
opts
|
|
2490
2510
|
}, {
|
|
2491
2511
|
F: __dxlog_file9,
|
|
2492
|
-
L:
|
|
2512
|
+
L: 378,
|
|
2493
2513
|
S: this,
|
|
2494
2514
|
C: (f, a) => f(...a)
|
|
2495
2515
|
});
|
|
2496
2516
|
(0, import_invariant7.invariant)(this._lifecycleState === import_context7.LifecycleState.OPEN, "Not open.", {
|
|
2497
2517
|
F: __dxlog_file9,
|
|
2498
|
-
L:
|
|
2518
|
+
L: 379,
|
|
2499
2519
|
S: this,
|
|
2500
2520
|
A: [
|
|
2501
2521
|
"this._lifecycleState === LifecycleState.OPEN",
|
|
@@ -2504,7 +2524,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2504
2524
|
});
|
|
2505
2525
|
(0, import_invariant7.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
2506
2526
|
F: __dxlog_file9,
|
|
2507
|
-
L:
|
|
2527
|
+
L: 380,
|
|
2508
2528
|
S: this,
|
|
2509
2529
|
A: [
|
|
2510
2530
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -2528,7 +2548,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2528
2548
|
const space = this._spaceManager.spaces.get(options.spaceKey);
|
|
2529
2549
|
(0, import_invariant7.invariant)(space, void 0, {
|
|
2530
2550
|
F: __dxlog_file9,
|
|
2531
|
-
L:
|
|
2551
|
+
L: 400,
|
|
2532
2552
|
S: this,
|
|
2533
2553
|
A: [
|
|
2534
2554
|
"space",
|
|
@@ -2541,7 +2561,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2541
2561
|
const credentials = await (0, import_credentials9.createAdmissionCredentials)(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
|
|
2542
2562
|
(0, import_invariant7.invariant)(credentials[0].credential, void 0, {
|
|
2543
2563
|
F: __dxlog_file9,
|
|
2544
|
-
L:
|
|
2564
|
+
L: 419,
|
|
2545
2565
|
S: this,
|
|
2546
2566
|
A: [
|
|
2547
2567
|
"credentials[0].credential",
|
|
@@ -2551,7 +2571,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2551
2571
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2552
2572
|
(0, import_invariant7.invariant)((0, import_credentials9.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2553
2573
|
F: __dxlog_file9,
|
|
2554
|
-
L:
|
|
2574
|
+
L: 421,
|
|
2555
2575
|
S: this,
|
|
2556
2576
|
A: [
|
|
2557
2577
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2569,7 +2589,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2569
2589
|
async waitUntilSpaceReady(spaceKey) {
|
|
2570
2590
|
await (0, import_context7.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
|
|
2571
2591
|
const space = this._spaces.get(spaceKey);
|
|
2572
|
-
return !!space && space.state ===
|
|
2592
|
+
return !!space && space.state === import_services7.SpaceState.SPACE_READY;
|
|
2573
2593
|
}));
|
|
2574
2594
|
}
|
|
2575
2595
|
async requestSpaceAdmissionCredential(spaceKey) {
|
|
@@ -2589,7 +2609,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2589
2609
|
const space = this._spaces.get(spaceKey);
|
|
2590
2610
|
(0, import_invariant7.invariant)(space, "Space not found.", {
|
|
2591
2611
|
F: __dxlog_file9,
|
|
2592
|
-
L:
|
|
2612
|
+
L: 458,
|
|
2593
2613
|
S: this,
|
|
2594
2614
|
A: [
|
|
2595
2615
|
"space",
|
|
@@ -2614,7 +2634,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2614
2634
|
metadata
|
|
2615
2635
|
}, {
|
|
2616
2636
|
F: __dxlog_file9,
|
|
2617
|
-
L:
|
|
2637
|
+
L: 477,
|
|
2618
2638
|
S: this,
|
|
2619
2639
|
C: (f, a) => f(...a)
|
|
2620
2640
|
});
|
|
@@ -2658,7 +2678,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2658
2678
|
err
|
|
2659
2679
|
}, {
|
|
2660
2680
|
F: __dxlog_file9,
|
|
2661
|
-
L:
|
|
2681
|
+
L: 519,
|
|
2662
2682
|
S: this,
|
|
2663
2683
|
C: (f, a) => f(...a)
|
|
2664
2684
|
});
|
|
@@ -2668,13 +2688,13 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2668
2688
|
onAuthFailure: () => {
|
|
2669
2689
|
import_log8.log.warn("auth failure", void 0, {
|
|
2670
2690
|
F: __dxlog_file9,
|
|
2671
|
-
L:
|
|
2691
|
+
L: 524,
|
|
2672
2692
|
S: this,
|
|
2673
2693
|
C: (f, a) => f(...a)
|
|
2674
2694
|
});
|
|
2675
2695
|
},
|
|
2676
2696
|
onMemberRolesChanged: async (members) => {
|
|
2677
|
-
if (dataSpace?.state ===
|
|
2697
|
+
if (dataSpace?.state === import_services7.SpaceState.SPACE_READY) {
|
|
2678
2698
|
this._handleMemberRoleChanges(presence, space.protocol, members);
|
|
2679
2699
|
}
|
|
2680
2700
|
},
|
|
@@ -2687,7 +2707,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2687
2707
|
dataFeed && await space.setDataFeed(dataFeed);
|
|
2688
2708
|
const dataSpace = new DataSpace({
|
|
2689
2709
|
inner: space,
|
|
2690
|
-
initialState: metadata.state ===
|
|
2710
|
+
initialState: metadata.state === import_services7.SpaceState.SPACE_INACTIVE ? import_services7.SpaceState.SPACE_INACTIVE : import_services7.SpaceState.SPACE_CLOSED,
|
|
2691
2711
|
metadataStore: this._metadataStore,
|
|
2692
2712
|
gossip,
|
|
2693
2713
|
presence,
|
|
@@ -2701,7 +2721,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2701
2721
|
space: space.key
|
|
2702
2722
|
}, {
|
|
2703
2723
|
F: __dxlog_file9,
|
|
2704
|
-
L:
|
|
2724
|
+
L: 551,
|
|
2705
2725
|
S: this,
|
|
2706
2726
|
C: (f, a) => f(...a)
|
|
2707
2727
|
});
|
|
@@ -2712,7 +2732,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2712
2732
|
open: this._lifecycleState === import_context7.LifecycleState.OPEN
|
|
2713
2733
|
}, {
|
|
2714
2734
|
F: __dxlog_file9,
|
|
2715
|
-
L:
|
|
2735
|
+
L: 554,
|
|
2716
2736
|
S: this,
|
|
2717
2737
|
C: (f, a) => f(...a)
|
|
2718
2738
|
});
|
|
@@ -2731,7 +2751,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2731
2751
|
space: space.key
|
|
2732
2752
|
}, {
|
|
2733
2753
|
F: __dxlog_file9,
|
|
2734
|
-
L:
|
|
2754
|
+
L: 562,
|
|
2735
2755
|
S: this,
|
|
2736
2756
|
C: (f, a) => f(...a)
|
|
2737
2757
|
});
|
|
@@ -2752,7 +2772,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2752
2772
|
spaceId: dataSpace.id
|
|
2753
2773
|
}, {
|
|
2754
2774
|
F: __dxlog_file9,
|
|
2755
|
-
L:
|
|
2775
|
+
L: 576,
|
|
2756
2776
|
S: this,
|
|
2757
2777
|
C: (f, a) => f(...a)
|
|
2758
2778
|
});
|
|
@@ -2765,7 +2785,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2765
2785
|
}
|
|
2766
2786
|
});
|
|
2767
2787
|
presence.newPeer.on((peerState) => {
|
|
2768
|
-
if (dataSpace.state ===
|
|
2788
|
+
if (dataSpace.state === import_services7.SpaceState.SPACE_READY) {
|
|
2769
2789
|
this._handleNewPeerConnected(space, peerState);
|
|
2770
2790
|
}
|
|
2771
2791
|
});
|
|
@@ -2782,7 +2802,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2782
2802
|
space: space.key
|
|
2783
2803
|
}, {
|
|
2784
2804
|
F: __dxlog_file9,
|
|
2785
|
-
L:
|
|
2805
|
+
L: 603,
|
|
2786
2806
|
S: this,
|
|
2787
2807
|
C: (f, a) => f(...a)
|
|
2788
2808
|
});
|
|
@@ -2815,7 +2835,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2815
2835
|
closedSessions
|
|
2816
2836
|
}, {
|
|
2817
2837
|
F: __dxlog_file9,
|
|
2818
|
-
L:
|
|
2838
|
+
L: 629,
|
|
2819
2839
|
S: this,
|
|
2820
2840
|
C: (f, a) => f(...a)
|
|
2821
2841
|
});
|
|
@@ -2830,7 +2850,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2830
2850
|
peerId: peerState.peerId
|
|
2831
2851
|
}, {
|
|
2832
2852
|
F: __dxlog_file9,
|
|
2833
|
-
L:
|
|
2853
|
+
L: 643,
|
|
2834
2854
|
S: this,
|
|
2835
2855
|
C: (f, a) => f(...a)
|
|
2836
2856
|
});
|
|
@@ -2839,7 +2859,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2839
2859
|
}
|
|
2840
2860
|
}
|
|
2841
2861
|
async _handleInvitationStatusChange(dataSpace, delegatedInvitation, isActive) {
|
|
2842
|
-
if (dataSpace?.state !==
|
|
2862
|
+
if (dataSpace?.state !== import_services7.SpaceState.SPACE_READY) {
|
|
2843
2863
|
return;
|
|
2844
2864
|
}
|
|
2845
2865
|
if (isActive) {
|
|
@@ -2856,8 +2876,8 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2856
2876
|
async _createDelegatedInvitations(space, invitations) {
|
|
2857
2877
|
const tasks = invitations.map(([credentialId, invitation]) => {
|
|
2858
2878
|
return this._invitationsManager.createInvitation({
|
|
2859
|
-
type:
|
|
2860
|
-
kind:
|
|
2879
|
+
type: import_services7.Invitation.Type.DELEGATED,
|
|
2880
|
+
kind: import_services7.Invitation.Kind.SPACE,
|
|
2861
2881
|
spaceKey: space.key,
|
|
2862
2882
|
authMethod: invitation.authMethod,
|
|
2863
2883
|
invitationId: invitation.invitationId,
|
|
@@ -2952,7 +2972,7 @@ var extractSpaceArchive = async (archive) => {
|
|
|
2952
2972
|
const documentId = entry2.fileName.replace(`${import_protocols8.SpaceArchiveFileStructure.documents}/`, "").replace(/\.bin$/, "");
|
|
2953
2973
|
(0, import_invariant10.invariant)(!documentId.includes("/"), void 0, {
|
|
2954
2974
|
F: __dxlog_file10,
|
|
2955
|
-
L:
|
|
2975
|
+
L: 28,
|
|
2956
2976
|
S: void 0,
|
|
2957
2977
|
A: [
|
|
2958
2978
|
"!documentId.includes('/')",
|
|
@@ -2966,7 +2986,7 @@ var extractSpaceArchive = async (archive) => {
|
|
|
2966
2986
|
documents
|
|
2967
2987
|
}, {
|
|
2968
2988
|
F: __dxlog_file10,
|
|
2969
|
-
L:
|
|
2989
|
+
L: 32,
|
|
2970
2990
|
S: void 0,
|
|
2971
2991
|
C: (f, a) => f(...a)
|
|
2972
2992
|
});
|
|
@@ -2975,67 +2995,70 @@ var extractSpaceArchive = async (archive) => {
|
|
|
2975
2995
|
documents
|
|
2976
2996
|
};
|
|
2977
2997
|
};
|
|
2978
|
-
function
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
a: isAwait
|
|
3009
|
-
});
|
|
3010
|
-
}
|
|
3011
|
-
return value;
|
|
2998
|
+
function _ts_add_disposable_resource2(env, value, async) {
|
|
2999
|
+
if (value !== null && value !== void 0) {
|
|
3000
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
3001
|
+
var dispose, inner;
|
|
3002
|
+
if (async) {
|
|
3003
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
3004
|
+
dispose = value[Symbol.asyncDispose];
|
|
3005
|
+
}
|
|
3006
|
+
if (dispose === void 0) {
|
|
3007
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
3008
|
+
dispose = value[Symbol.dispose];
|
|
3009
|
+
if (async) inner = dispose;
|
|
3010
|
+
}
|
|
3011
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
3012
|
+
if (inner) dispose = function() {
|
|
3013
|
+
try {
|
|
3014
|
+
inner.call(this);
|
|
3015
|
+
} catch (e) {
|
|
3016
|
+
return Promise.reject(e);
|
|
3017
|
+
}
|
|
3018
|
+
};
|
|
3019
|
+
env.stack.push({
|
|
3020
|
+
value,
|
|
3021
|
+
dispose,
|
|
3022
|
+
async
|
|
3023
|
+
});
|
|
3024
|
+
} else if (async) {
|
|
3025
|
+
env.stack.push({
|
|
3026
|
+
async: true
|
|
3027
|
+
});
|
|
3012
3028
|
}
|
|
3013
|
-
return
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
+
return value;
|
|
3030
|
+
}
|
|
3031
|
+
function _ts_dispose_resources2(env) {
|
|
3032
|
+
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
3033
|
+
var e = new Error(message);
|
|
3034
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
3035
|
+
};
|
|
3036
|
+
return (_ts_dispose_resources2 = function _ts_dispose_resources5(env2) {
|
|
3037
|
+
function fail(e) {
|
|
3038
|
+
env2.error = env2.hasError ? new _SuppressedError(e, env2.error, "An error was suppressed during disposal.") : e;
|
|
3039
|
+
env2.hasError = true;
|
|
3040
|
+
}
|
|
3041
|
+
var r, s = 0;
|
|
3042
|
+
function next() {
|
|
3043
|
+
while (r = env2.stack.pop()) {
|
|
3044
|
+
try {
|
|
3045
|
+
if (!r.async && s === 1) return s = 0, env2.stack.push(r), Promise.resolve().then(next);
|
|
3046
|
+
if (r.dispose) {
|
|
3047
|
+
var result = r.dispose.call(r.value);
|
|
3048
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
|
|
3049
|
+
fail(e);
|
|
3050
|
+
return next();
|
|
3051
|
+
});
|
|
3052
|
+
} else s |= 1;
|
|
3053
|
+
} catch (e) {
|
|
3054
|
+
fail(e);
|
|
3029
3055
|
}
|
|
3030
|
-
if (error !== empty) throw error;
|
|
3031
3056
|
}
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
return next();
|
|
3035
|
-
}
|
|
3036
|
-
return next();
|
|
3057
|
+
if (s === 1) return env2.hasError ? Promise.reject(env2.error) : Promise.resolve();
|
|
3058
|
+
if (env2.hasError) throw env2.error;
|
|
3037
3059
|
}
|
|
3038
|
-
|
|
3060
|
+
return next();
|
|
3061
|
+
})(env);
|
|
3039
3062
|
}
|
|
3040
3063
|
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
3041
3064
|
var SpacesServiceImpl = class {
|
|
@@ -3056,10 +3079,10 @@ var SpacesServiceImpl = class {
|
|
|
3056
3079
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug3.raise)(new import_protocols6.SpaceNotFoundError(spaceKey));
|
|
3057
3080
|
if (state) {
|
|
3058
3081
|
switch (state) {
|
|
3059
|
-
case
|
|
3082
|
+
case import_services8.SpaceState.SPACE_ACTIVE:
|
|
3060
3083
|
await space.activate();
|
|
3061
3084
|
break;
|
|
3062
|
-
case
|
|
3085
|
+
case import_services8.SpaceState.SPACE_INACTIVE:
|
|
3063
3086
|
await space.deactivate();
|
|
3064
3087
|
break;
|
|
3065
3088
|
default:
|
|
@@ -3085,7 +3108,7 @@ var SpacesServiceImpl = class {
|
|
|
3085
3108
|
const credentials = await (0, import_credentials13.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
3086
3109
|
(0, import_invariant8.invariant)(credentials[0].credential, void 0, {
|
|
3087
3110
|
F: __dxlog_file11,
|
|
3088
|
-
L:
|
|
3111
|
+
L: 119,
|
|
3089
3112
|
S: this,
|
|
3090
3113
|
A: [
|
|
3091
3114
|
"credentials[0].credential",
|
|
@@ -3095,7 +3118,7 @@ var SpacesServiceImpl = class {
|
|
|
3095
3118
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
3096
3119
|
(0, import_invariant8.invariant)((0, import_credentials13.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3097
3120
|
F: __dxlog_file11,
|
|
3098
|
-
L:
|
|
3121
|
+
L: 121,
|
|
3099
3122
|
S: this,
|
|
3100
3123
|
A: [
|
|
3101
3124
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3113,7 +3136,7 @@ var SpacesServiceImpl = class {
|
|
|
3113
3136
|
ids: spaces.map((space) => space.id)
|
|
3114
3137
|
}), {
|
|
3115
3138
|
F: __dxlog_file11,
|
|
3116
|
-
L:
|
|
3139
|
+
L: 134,
|
|
3117
3140
|
S: this,
|
|
3118
3141
|
C: (f, a) => f(...a)
|
|
3119
3142
|
});
|
|
@@ -3205,7 +3228,7 @@ var SpacesServiceImpl = class {
|
|
|
3205
3228
|
} else {
|
|
3206
3229
|
(0, import_invariant8.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
3207
3230
|
F: __dxlog_file11,
|
|
3208
|
-
L:
|
|
3231
|
+
L: 232,
|
|
3209
3232
|
S: this,
|
|
3210
3233
|
A: [
|
|
3211
3234
|
"!credential.id",
|
|
@@ -3214,7 +3237,7 @@ var SpacesServiceImpl = class {
|
|
|
3214
3237
|
});
|
|
3215
3238
|
(0, import_invariant8.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
3216
3239
|
F: __dxlog_file11,
|
|
3217
|
-
L:
|
|
3240
|
+
L: 233,
|
|
3218
3241
|
S: this,
|
|
3219
3242
|
A: [
|
|
3220
3243
|
"this._identityManager.identity",
|
|
@@ -3224,7 +3247,7 @@ var SpacesServiceImpl = class {
|
|
|
3224
3247
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
3225
3248
|
(0, import_invariant8.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
3226
3249
|
F: __dxlog_file11,
|
|
3227
|
-
L:
|
|
3250
|
+
L: 235,
|
|
3228
3251
|
S: this,
|
|
3229
3252
|
A: [
|
|
3230
3253
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -3271,9 +3294,13 @@ var SpacesServiceImpl = class {
|
|
|
3271
3294
|
});
|
|
3272
3295
|
}
|
|
3273
3296
|
async exportSpace(request) {
|
|
3297
|
+
const env = {
|
|
3298
|
+
stack: [],
|
|
3299
|
+
error: void 0,
|
|
3300
|
+
hasError: false
|
|
3301
|
+
};
|
|
3274
3302
|
try {
|
|
3275
|
-
|
|
3276
|
-
const writer = _usingCtx.a(await new SpaceArchiveWriter().open());
|
|
3303
|
+
const writer = _ts_add_disposable_resource2(env, await new SpaceArchiveWriter().open(), true);
|
|
3277
3304
|
(0, import_invariant8.assertArgument)(import_keys9.SpaceId.isValid(request.spaceId), "Invalid space ID");
|
|
3278
3305
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3279
3306
|
const space = dataSpaceManager.getSpaceById(request.spaceId) ?? (0, import_debug3.raise)(new Error("Space not found"));
|
|
@@ -3290,10 +3317,12 @@ var SpacesServiceImpl = class {
|
|
|
3290
3317
|
return {
|
|
3291
3318
|
archive
|
|
3292
3319
|
};
|
|
3293
|
-
} catch (
|
|
3294
|
-
|
|
3320
|
+
} catch (e) {
|
|
3321
|
+
env.error = e;
|
|
3322
|
+
env.hasError = true;
|
|
3295
3323
|
} finally {
|
|
3296
|
-
|
|
3324
|
+
const result = _ts_dispose_resources2(env);
|
|
3325
|
+
if (result) await result;
|
|
3297
3326
|
}
|
|
3298
3327
|
}
|
|
3299
3328
|
async importSpace(request) {
|
|
@@ -3301,7 +3330,7 @@ var SpacesServiceImpl = class {
|
|
|
3301
3330
|
const extracted = await extractSpaceArchive(request.archive);
|
|
3302
3331
|
(0, import_invariant8.invariant)(extracted.metadata.echo?.currentRootUrl, "Space archive does not contain a root URL", {
|
|
3303
3332
|
F: __dxlog_file11,
|
|
3304
|
-
L:
|
|
3333
|
+
L: 289,
|
|
3305
3334
|
S: this,
|
|
3306
3335
|
A: [
|
|
3307
3336
|
"extracted.metadata.echo?.currentRootUrl",
|
|
@@ -3321,7 +3350,7 @@ var SpacesServiceImpl = class {
|
|
|
3321
3350
|
const assertion = (0, import_credentials13.getCredentialAssertion)(credential);
|
|
3322
3351
|
(0, import_invariant8.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
3323
3352
|
F: __dxlog_file11,
|
|
3324
|
-
L:
|
|
3353
|
+
L: 300,
|
|
3325
3354
|
S: this,
|
|
3326
3355
|
A: [
|
|
3327
3356
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3331,7 +3360,7 @@ var SpacesServiceImpl = class {
|
|
|
3331
3360
|
const myIdentity = this._identityManager.identity;
|
|
3332
3361
|
(0, import_invariant8.invariant)(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
3333
3362
|
F: __dxlog_file11,
|
|
3334
|
-
L:
|
|
3363
|
+
L: 302,
|
|
3335
3364
|
S: this,
|
|
3336
3365
|
A: [
|
|
3337
3366
|
"myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
|
|
@@ -3388,7 +3417,7 @@ var SpacesServiceImpl = class {
|
|
|
3388
3417
|
profile: member.profile ?? {}
|
|
3389
3418
|
},
|
|
3390
3419
|
role: member.role,
|
|
3391
|
-
presence: peers.length > 0 ?
|
|
3420
|
+
presence: peers.length > 0 ? import_services8.SpaceMember.PresenceState.ONLINE : import_services8.SpaceMember.PresenceState.OFFLINE,
|
|
3392
3421
|
peerStates: peers
|
|
3393
3422
|
};
|
|
3394
3423
|
})),
|
|
@@ -3713,7 +3742,7 @@ var IdentityManager = class {
|
|
|
3713
3742
|
L: 135
|
|
3714
3743
|
}));
|
|
3715
3744
|
}
|
|
3716
|
-
async createIdentity({
|
|
3745
|
+
async createIdentity({ profile, deviceProfile } = {}) {
|
|
3717
3746
|
(0, import_invariant11.invariant)(!this._identity, "Identity already exists.", {
|
|
3718
3747
|
F: __dxlog_file13,
|
|
3719
3748
|
L: 140,
|
|
@@ -3771,10 +3800,8 @@ var IdentityManager = class {
|
|
|
3771
3800
|
// Feed admission.
|
|
3772
3801
|
await generator.createFeedAdmission(identityRecord.haloSpace.key, identityRecord.haloSpace.dataFeedKey, import_credentials15.AdmittedFeed.Designation.DATA)
|
|
3773
3802
|
];
|
|
3774
|
-
if (
|
|
3775
|
-
credentials.push(await generator.createProfileCredential(
|
|
3776
|
-
displayName
|
|
3777
|
-
}));
|
|
3803
|
+
if (profile) {
|
|
3804
|
+
credentials.push(await generator.createProfileCredential(profile));
|
|
3778
3805
|
}
|
|
3779
3806
|
credentials.push(await generator.createDeviceAuthorization(identityRecord.deviceKey));
|
|
3780
3807
|
credentials.push(await generator.createDeviceProfile({
|
|
@@ -3891,7 +3918,7 @@ var IdentityManager = class {
|
|
|
3891
3918
|
displayName: this._identity.profileDocument?.displayName
|
|
3892
3919
|
}, {
|
|
3893
3920
|
F: __dxlog_file13,
|
|
3894
|
-
L:
|
|
3921
|
+
L: 277,
|
|
3895
3922
|
S: this,
|
|
3896
3923
|
C: (f, a) => f(...a)
|
|
3897
3924
|
});
|
|
@@ -3905,7 +3932,7 @@ var IdentityManager = class {
|
|
|
3905
3932
|
deviceKey: identity.deviceKey
|
|
3906
3933
|
}, {
|
|
3907
3934
|
F: __dxlog_file13,
|
|
3908
|
-
L:
|
|
3935
|
+
L: 288,
|
|
3909
3936
|
S: this,
|
|
3910
3937
|
C: (f, a) => f(...a)
|
|
3911
3938
|
});
|
|
@@ -3916,7 +3943,7 @@ var IdentityManager = class {
|
|
|
3916
3943
|
async updateProfile(profile) {
|
|
3917
3944
|
(0, import_invariant11.invariant)(this._identity, "Identity not initialized.", {
|
|
3918
3945
|
F: __dxlog_file13,
|
|
3919
|
-
L:
|
|
3946
|
+
L: 295,
|
|
3920
3947
|
S: this,
|
|
3921
3948
|
A: [
|
|
3922
3949
|
"this._identity",
|
|
@@ -3947,7 +3974,7 @@ var IdentityManager = class {
|
|
|
3947
3974
|
async updateDeviceProfile(profile) {
|
|
3948
3975
|
(0, import_invariant11.invariant)(this._identity, "Identity not initialized.", {
|
|
3949
3976
|
F: __dxlog_file13,
|
|
3950
|
-
L:
|
|
3977
|
+
L: 312,
|
|
3951
3978
|
S: this,
|
|
3952
3979
|
A: [
|
|
3953
3980
|
"this._identity",
|
|
@@ -3975,15 +4002,15 @@ var IdentityManager = class {
|
|
|
3975
4002
|
this.stateUpdate.emit();
|
|
3976
4003
|
return {
|
|
3977
4004
|
deviceKey: this._identity.deviceKey,
|
|
3978
|
-
kind:
|
|
3979
|
-
presence:
|
|
4005
|
+
kind: import_services9.DeviceKind.CURRENT,
|
|
4006
|
+
presence: import_services9.Device.PresenceState.ONLINE,
|
|
3980
4007
|
profile
|
|
3981
4008
|
};
|
|
3982
4009
|
}
|
|
3983
4010
|
async _constructIdentity(identityRecord) {
|
|
3984
4011
|
(0, import_invariant11.invariant)(!this._identity, void 0, {
|
|
3985
4012
|
F: __dxlog_file13,
|
|
3986
|
-
L:
|
|
4013
|
+
L: 338,
|
|
3987
4014
|
S: this,
|
|
3988
4015
|
A: [
|
|
3989
4016
|
"!this._identity",
|
|
@@ -3994,7 +4021,7 @@ var IdentityManager = class {
|
|
|
3994
4021
|
identityRecord
|
|
3995
4022
|
}, {
|
|
3996
4023
|
F: __dxlog_file13,
|
|
3997
|
-
L:
|
|
4024
|
+
L: 339,
|
|
3998
4025
|
S: this,
|
|
3999
4026
|
C: (f, a) => f(...a)
|
|
4000
4027
|
});
|
|
@@ -4009,7 +4036,7 @@ var IdentityManager = class {
|
|
|
4009
4036
|
});
|
|
4010
4037
|
(0, import_invariant11.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
4011
4038
|
F: __dxlog_file13,
|
|
4012
|
-
L:
|
|
4039
|
+
L: 352,
|
|
4013
4040
|
S: this,
|
|
4014
4041
|
A: [
|
|
4015
4042
|
"identityRecord.haloSpace.controlFeedKey",
|
|
@@ -4021,7 +4048,7 @@ var IdentityManager = class {
|
|
|
4021
4048
|
});
|
|
4022
4049
|
(0, import_invariant11.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
4023
4050
|
F: __dxlog_file13,
|
|
4024
|
-
L:
|
|
4051
|
+
L: 356,
|
|
4025
4052
|
S: this,
|
|
4026
4053
|
A: [
|
|
4027
4054
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -4060,7 +4087,7 @@ var IdentityManager = class {
|
|
|
4060
4087
|
identityKey: identityRecord.identityKey
|
|
4061
4088
|
}, {
|
|
4062
4089
|
F: __dxlog_file13,
|
|
4063
|
-
L:
|
|
4090
|
+
L: 387,
|
|
4064
4091
|
S: this,
|
|
4065
4092
|
C: (f, a) => f(...a)
|
|
4066
4093
|
});
|
|
@@ -4085,7 +4112,7 @@ var IdentityManager = class {
|
|
|
4085
4112
|
onAuthFailure: () => {
|
|
4086
4113
|
import_log11.log.warn("auth failure", void 0, {
|
|
4087
4114
|
F: __dxlog_file13,
|
|
4088
|
-
L:
|
|
4115
|
+
L: 412,
|
|
4089
4116
|
S: this,
|
|
4090
4117
|
C: (f, a) => f(...a)
|
|
4091
4118
|
});
|
|
@@ -4110,13 +4137,7 @@ var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
|
|
|
4110
4137
|
var DEFAULT_SPACE_SEARCH_TIMEOUT = 1e4;
|
|
4111
4138
|
var IdentityServiceImpl = class extends import_context10.Resource {
|
|
4112
4139
|
constructor(_identityManager, _recoveryManager, _keyring, _dataSpaceManagerProvider, _createIdentity, _onProfileUpdate) {
|
|
4113
|
-
super();
|
|
4114
|
-
this._identityManager = _identityManager;
|
|
4115
|
-
this._recoveryManager = _recoveryManager;
|
|
4116
|
-
this._keyring = _keyring;
|
|
4117
|
-
this._dataSpaceManagerProvider = _dataSpaceManagerProvider;
|
|
4118
|
-
this._createIdentity = _createIdentity;
|
|
4119
|
-
this._onProfileUpdate = _onProfileUpdate;
|
|
4140
|
+
super(), this._identityManager = _identityManager, this._recoveryManager = _recoveryManager, this._keyring = _keyring, this._dataSpaceManagerProvider = _dataSpaceManagerProvider, this._createIdentity = _createIdentity, this._onProfileUpdate = _onProfileUpdate;
|
|
4120
4141
|
}
|
|
4121
4142
|
async _open() {
|
|
4122
4143
|
const identity = this._identityManager.identity;
|
|
@@ -4126,7 +4147,7 @@ var IdentityServiceImpl = class extends import_context10.Resource {
|
|
|
4126
4147
|
}
|
|
4127
4148
|
async createIdentity(request) {
|
|
4128
4149
|
await this._createIdentity({
|
|
4129
|
-
|
|
4150
|
+
profile: request.profile,
|
|
4130
4151
|
deviceProfile: request.deviceProfile
|
|
4131
4152
|
});
|
|
4132
4153
|
const dataSpaceManager = this._dataSpaceManagerProvider();
|
|
@@ -4250,9 +4271,9 @@ var IdentityServiceImpl = class extends import_context10.Resource {
|
|
|
4250
4271
|
const dataSpaceManager = this._dataSpaceManagerProvider();
|
|
4251
4272
|
const recordedDefaultSpaceTrigger = new import_async14.Trigger();
|
|
4252
4273
|
const allProcessed = (0, import_util9.safeAwaitAll)(dataSpaceManager.spaces.values(), async (space) => {
|
|
4253
|
-
if (space.state ===
|
|
4274
|
+
if (space.state === import_services10.SpaceState.SPACE_CLOSED) {
|
|
4254
4275
|
await space.open();
|
|
4255
|
-
const requiresMigration = space.stateUpdate.waitForCondition(() => space.state ===
|
|
4276
|
+
const requiresMigration = space.stateUpdate.waitForCondition(() => space.state === import_services10.SpaceState.SPACE_REQUIRES_MIGRATION);
|
|
4256
4277
|
await Promise.race([
|
|
4257
4278
|
space.initializeDataPipeline(),
|
|
4258
4279
|
requiresMigration
|
|
@@ -4299,80 +4320,83 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
4299
4320
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4300
4321
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4301
4322
|
}
|
|
4302
|
-
function
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
a: isAwait
|
|
4333
|
-
});
|
|
4334
|
-
}
|
|
4335
|
-
return value;
|
|
4323
|
+
function _ts_add_disposable_resource3(env, value, async) {
|
|
4324
|
+
if (value !== null && value !== void 0) {
|
|
4325
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4326
|
+
var dispose, inner;
|
|
4327
|
+
if (async) {
|
|
4328
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
4329
|
+
dispose = value[Symbol.asyncDispose];
|
|
4330
|
+
}
|
|
4331
|
+
if (dispose === void 0) {
|
|
4332
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
4333
|
+
dispose = value[Symbol.dispose];
|
|
4334
|
+
if (async) inner = dispose;
|
|
4335
|
+
}
|
|
4336
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
4337
|
+
if (inner) dispose = function() {
|
|
4338
|
+
try {
|
|
4339
|
+
inner.call(this);
|
|
4340
|
+
} catch (e) {
|
|
4341
|
+
return Promise.reject(e);
|
|
4342
|
+
}
|
|
4343
|
+
};
|
|
4344
|
+
env.stack.push({
|
|
4345
|
+
value,
|
|
4346
|
+
dispose,
|
|
4347
|
+
async
|
|
4348
|
+
});
|
|
4349
|
+
} else if (async) {
|
|
4350
|
+
env.stack.push({
|
|
4351
|
+
async: true
|
|
4352
|
+
});
|
|
4336
4353
|
}
|
|
4337
|
-
return
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4354
|
+
return value;
|
|
4355
|
+
}
|
|
4356
|
+
function _ts_dispose_resources3(env) {
|
|
4357
|
+
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
4358
|
+
var e = new Error(message);
|
|
4359
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
4360
|
+
};
|
|
4361
|
+
return (_ts_dispose_resources3 = function _ts_dispose_resources5(env2) {
|
|
4362
|
+
function fail(e) {
|
|
4363
|
+
env2.error = env2.hasError ? new _SuppressedError(e, env2.error, "An error was suppressed during disposal.") : e;
|
|
4364
|
+
env2.hasError = true;
|
|
4365
|
+
}
|
|
4366
|
+
var r, s = 0;
|
|
4367
|
+
function next() {
|
|
4368
|
+
while (r = env2.stack.pop()) {
|
|
4369
|
+
try {
|
|
4370
|
+
if (!r.async && s === 1) return s = 0, env2.stack.push(r), Promise.resolve().then(next);
|
|
4371
|
+
if (r.dispose) {
|
|
4372
|
+
var result = r.dispose.call(r.value);
|
|
4373
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
|
|
4374
|
+
fail(e);
|
|
4375
|
+
return next();
|
|
4376
|
+
});
|
|
4377
|
+
} else s |= 1;
|
|
4378
|
+
} catch (e) {
|
|
4379
|
+
fail(e);
|
|
4353
4380
|
}
|
|
4354
|
-
if (error !== empty) throw error;
|
|
4355
|
-
}
|
|
4356
|
-
function err(e) {
|
|
4357
|
-
error = error !== empty ? new _disposeSuppressedError(error, e) : e;
|
|
4358
|
-
return next();
|
|
4359
4381
|
}
|
|
4360
|
-
return
|
|
4382
|
+
if (s === 1) return env2.hasError ? Promise.reject(env2.error) : Promise.resolve();
|
|
4383
|
+
if (env2.hasError) throw env2.error;
|
|
4361
4384
|
}
|
|
4362
|
-
|
|
4385
|
+
return next();
|
|
4386
|
+
})(env);
|
|
4363
4387
|
}
|
|
4364
4388
|
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
4365
4389
|
var DataSpace = class {
|
|
4366
4390
|
constructor(params) {
|
|
4367
4391
|
this._ctx = new import_context4.Context(void 0, {
|
|
4368
4392
|
F: __dxlog_file15,
|
|
4369
|
-
L:
|
|
4393
|
+
L: 100
|
|
4370
4394
|
});
|
|
4371
4395
|
this._cache = void 0;
|
|
4372
4396
|
this._edgeFeedReplicator = void 0;
|
|
4373
4397
|
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
4374
4398
|
this._epochProcessingMutex = new import_async7.Mutex();
|
|
4375
|
-
this._state =
|
|
4399
|
+
this._state = import_services5.SpaceState.SPACE_CLOSED;
|
|
4376
4400
|
this._databaseRoot = null;
|
|
4377
4401
|
this.error = void 0;
|
|
4378
4402
|
this.stateUpdate = new import_async7.Event();
|
|
@@ -4412,10 +4436,10 @@ var DataSpace = class {
|
|
|
4412
4436
|
}
|
|
4413
4437
|
this._state = params.initialState;
|
|
4414
4438
|
(0, import_log4.log)("new state", {
|
|
4415
|
-
state:
|
|
4439
|
+
state: import_services5.SpaceState[this._state]
|
|
4416
4440
|
}, {
|
|
4417
4441
|
F: __dxlog_file15,
|
|
4418
|
-
L:
|
|
4442
|
+
L: 176,
|
|
4419
4443
|
S: this,
|
|
4420
4444
|
C: (f, a) => f(...a)
|
|
4421
4445
|
});
|
|
@@ -4458,7 +4482,7 @@ var DataSpace = class {
|
|
|
4458
4482
|
};
|
|
4459
4483
|
}
|
|
4460
4484
|
async open() {
|
|
4461
|
-
if (this._state ===
|
|
4485
|
+
if (this._state === import_services5.SpaceState.SPACE_CLOSED) {
|
|
4462
4486
|
await this._open();
|
|
4463
4487
|
}
|
|
4464
4488
|
}
|
|
@@ -4474,16 +4498,16 @@ var DataSpace = class {
|
|
|
4474
4498
|
}
|
|
4475
4499
|
await this._inner.open(new import_context4.Context(void 0, {
|
|
4476
4500
|
F: __dxlog_file15,
|
|
4477
|
-
L:
|
|
4501
|
+
L: 250
|
|
4478
4502
|
}));
|
|
4479
4503
|
await this._inner.startProtocol();
|
|
4480
4504
|
await this._edgeFeedReplicator?.open();
|
|
4481
|
-
this._state =
|
|
4505
|
+
this._state = import_services5.SpaceState.SPACE_CONTROL_ONLY;
|
|
4482
4506
|
(0, import_log4.log)("new state", {
|
|
4483
|
-
state:
|
|
4507
|
+
state: import_services5.SpaceState[this._state]
|
|
4484
4508
|
}, {
|
|
4485
4509
|
F: __dxlog_file15,
|
|
4486
|
-
L:
|
|
4510
|
+
L: 256,
|
|
4487
4511
|
S: this,
|
|
4488
4512
|
C: (f, a) => f(...a)
|
|
4489
4513
|
});
|
|
@@ -4498,19 +4522,19 @@ var DataSpace = class {
|
|
|
4498
4522
|
async _close() {
|
|
4499
4523
|
await this._callbacks.beforeClose?.();
|
|
4500
4524
|
await this.preClose.callSerial();
|
|
4501
|
-
this._state =
|
|
4525
|
+
this._state = import_services5.SpaceState.SPACE_CLOSED;
|
|
4502
4526
|
(0, import_log4.log)("new state", {
|
|
4503
|
-
state:
|
|
4527
|
+
state: import_services5.SpaceState[this._state]
|
|
4504
4528
|
}, {
|
|
4505
4529
|
F: __dxlog_file15,
|
|
4506
|
-
L:
|
|
4530
|
+
L: 275,
|
|
4507
4531
|
S: this,
|
|
4508
4532
|
C: (f, a) => f(...a)
|
|
4509
4533
|
});
|
|
4510
4534
|
await this._ctx.dispose();
|
|
4511
4535
|
this._ctx = new import_context4.Context(void 0, {
|
|
4512
4536
|
F: __dxlog_file15,
|
|
4513
|
-
L:
|
|
4537
|
+
L: 277
|
|
4514
4538
|
});
|
|
4515
4539
|
if (this._edgeFeedReplicator) {
|
|
4516
4540
|
this.inner.protocol.feedAdded.remove(this._onFeedAdded);
|
|
@@ -4543,7 +4567,7 @@ var DataSpace = class {
|
|
|
4543
4567
|
if (err instanceof import_protocols3.CancelledError || err instanceof import_context4.ContextDisposedError) {
|
|
4544
4568
|
(0, import_log4.log)("data pipeline initialization cancelled", err, {
|
|
4545
4569
|
F: __dxlog_file15,
|
|
4546
|
-
L:
|
|
4570
|
+
L: 315,
|
|
4547
4571
|
S: this,
|
|
4548
4572
|
C: (f, a) => f(...a)
|
|
4549
4573
|
});
|
|
@@ -4551,16 +4575,16 @@ var DataSpace = class {
|
|
|
4551
4575
|
}
|
|
4552
4576
|
import_log4.log.error("Error initializing data pipeline", err, {
|
|
4553
4577
|
F: __dxlog_file15,
|
|
4554
|
-
L:
|
|
4578
|
+
L: 319,
|
|
4555
4579
|
S: this,
|
|
4556
4580
|
C: (f, a) => f(...a)
|
|
4557
4581
|
});
|
|
4558
|
-
this._state =
|
|
4582
|
+
this._state = import_services5.SpaceState.SPACE_ERROR;
|
|
4559
4583
|
(0, import_log4.log)("new state", {
|
|
4560
|
-
state:
|
|
4584
|
+
state: import_services5.SpaceState[this._state]
|
|
4561
4585
|
}, {
|
|
4562
4586
|
F: __dxlog_file15,
|
|
4563
|
-
L:
|
|
4587
|
+
L: 321,
|
|
4564
4588
|
S: this,
|
|
4565
4589
|
C: (f, a) => f(...a)
|
|
4566
4590
|
});
|
|
@@ -4572,44 +4596,44 @@ var DataSpace = class {
|
|
|
4572
4596
|
});
|
|
4573
4597
|
}
|
|
4574
4598
|
async initializeDataPipeline() {
|
|
4575
|
-
if (this._state !==
|
|
4599
|
+
if (this._state !== import_services5.SpaceState.SPACE_CONTROL_ONLY) {
|
|
4576
4600
|
throw new import_protocols3.SystemError("Invalid operation");
|
|
4577
4601
|
}
|
|
4578
|
-
this._state =
|
|
4602
|
+
this._state = import_services5.SpaceState.SPACE_INITIALIZING;
|
|
4579
4603
|
(0, import_log4.log)("new state", {
|
|
4580
|
-
state:
|
|
4604
|
+
state: import_services5.SpaceState[this._state]
|
|
4581
4605
|
}, {
|
|
4582
4606
|
F: __dxlog_file15,
|
|
4583
|
-
L:
|
|
4607
|
+
L: 337,
|
|
4584
4608
|
S: this,
|
|
4585
4609
|
C: (f, a) => f(...a)
|
|
4586
4610
|
});
|
|
4587
4611
|
(0, import_log4.log)("initializing control pipeline", void 0, {
|
|
4588
4612
|
F: __dxlog_file15,
|
|
4589
|
-
L:
|
|
4613
|
+
L: 339,
|
|
4590
4614
|
S: this,
|
|
4591
4615
|
C: (f, a) => f(...a)
|
|
4592
4616
|
});
|
|
4593
4617
|
await this._initializeAndReadControlPipeline();
|
|
4594
4618
|
await (0, import_async7.sleep)(1);
|
|
4595
|
-
const ready = this.stateUpdate.waitForCondition(() => this._state ===
|
|
4619
|
+
const ready = this.stateUpdate.waitForCondition(() => this._state === import_services5.SpaceState.SPACE_READY);
|
|
4596
4620
|
(0, import_log4.log)("initializing automerge root", void 0, {
|
|
4597
4621
|
F: __dxlog_file15,
|
|
4598
|
-
L:
|
|
4622
|
+
L: 347,
|
|
4599
4623
|
S: this,
|
|
4600
4624
|
C: (f, a) => f(...a)
|
|
4601
4625
|
});
|
|
4602
4626
|
this._automergeSpaceState.startProcessingRootDocs();
|
|
4603
4627
|
(0, import_log4.log)("waiting for space to be ready", void 0, {
|
|
4604
4628
|
F: __dxlog_file15,
|
|
4605
|
-
L:
|
|
4629
|
+
L: 351,
|
|
4606
4630
|
S: this,
|
|
4607
4631
|
C: (f, a) => f(...a)
|
|
4608
4632
|
});
|
|
4609
4633
|
await ready;
|
|
4610
4634
|
(0, import_log4.log)("space is ready", void 0, {
|
|
4611
4635
|
F: __dxlog_file15,
|
|
4612
|
-
L:
|
|
4636
|
+
L: 353,
|
|
4613
4637
|
S: this,
|
|
4614
4638
|
C: (f, a) => f(...a)
|
|
4615
4639
|
});
|
|
@@ -4617,14 +4641,14 @@ var DataSpace = class {
|
|
|
4617
4641
|
async *getAllDocuments() {
|
|
4618
4642
|
(0, import_invariant3.invariant)(this._databaseRoot, "Space is not ready", {
|
|
4619
4643
|
F: __dxlog_file15,
|
|
4620
|
-
L:
|
|
4644
|
+
L: 357,
|
|
4621
4645
|
S: this,
|
|
4622
4646
|
A: [
|
|
4623
4647
|
"this._databaseRoot",
|
|
4624
4648
|
"'Space is not ready'"
|
|
4625
4649
|
]
|
|
4626
4650
|
});
|
|
4627
|
-
const doc = this._databaseRoot.
|
|
4651
|
+
const doc = this._databaseRoot.doc() ?? (0, import_invariant3.failedInvariant)();
|
|
4628
4652
|
const root = (0, import_automerge.save)(doc);
|
|
4629
4653
|
yield [
|
|
4630
4654
|
this._databaseRoot.documentId,
|
|
@@ -4633,7 +4657,7 @@ var DataSpace = class {
|
|
|
4633
4657
|
for (const documentUrl of this._databaseRoot.getAllLinkedDocuments()) {
|
|
4634
4658
|
const data = await this._echoHost.exportDoc(import_context4.Context.default(void 0, {
|
|
4635
4659
|
F: __dxlog_file15,
|
|
4636
|
-
L:
|
|
4660
|
+
L: 363
|
|
4637
4661
|
}), documentUrl);
|
|
4638
4662
|
yield [
|
|
4639
4663
|
documentUrl.replace(/^automerge:/, ""),
|
|
@@ -4643,12 +4667,12 @@ var DataSpace = class {
|
|
|
4643
4667
|
}
|
|
4644
4668
|
async _enterReadyState() {
|
|
4645
4669
|
await this._callbacks.beforeReady?.();
|
|
4646
|
-
this._state =
|
|
4670
|
+
this._state = import_services5.SpaceState.SPACE_READY;
|
|
4647
4671
|
(0, import_log4.log)("new state", {
|
|
4648
|
-
state:
|
|
4672
|
+
state: import_services5.SpaceState[this._state]
|
|
4649
4673
|
}, {
|
|
4650
4674
|
F: __dxlog_file15,
|
|
4651
|
-
L:
|
|
4675
|
+
L: 372,
|
|
4652
4676
|
S: this,
|
|
4653
4677
|
C: (f, a) => f(...a)
|
|
4654
4678
|
});
|
|
@@ -4665,7 +4689,7 @@ var DataSpace = class {
|
|
|
4665
4689
|
await this._createWritableFeeds();
|
|
4666
4690
|
(0, import_log4.log)("writable feeds created", void 0, {
|
|
4667
4691
|
F: __dxlog_file15,
|
|
4668
|
-
L:
|
|
4692
|
+
L: 389,
|
|
4669
4693
|
S: this,
|
|
4670
4694
|
C: (f, a) => f(...a)
|
|
4671
4695
|
});
|
|
@@ -4719,7 +4743,7 @@ var DataSpace = class {
|
|
|
4719
4743
|
count: credentials.length
|
|
4720
4744
|
}, {
|
|
4721
4745
|
F: __dxlog_file15,
|
|
4722
|
-
L:
|
|
4746
|
+
L: 447,
|
|
4723
4747
|
S: this,
|
|
4724
4748
|
C: (f, a) => f(...a)
|
|
4725
4749
|
});
|
|
@@ -4730,14 +4754,14 @@ var DataSpace = class {
|
|
|
4730
4754
|
});
|
|
4731
4755
|
(0, import_log4.log)("credentials notarized", void 0, {
|
|
4732
4756
|
F: __dxlog_file15,
|
|
4733
|
-
L:
|
|
4757
|
+
L: 451,
|
|
4734
4758
|
S: this,
|
|
4735
4759
|
C: (f, a) => f(...a)
|
|
4736
4760
|
});
|
|
4737
4761
|
} catch (err) {
|
|
4738
4762
|
import_log4.log.error("error notarizing credentials for feed admission", err, {
|
|
4739
4763
|
F: __dxlog_file15,
|
|
4740
|
-
L:
|
|
4764
|
+
L: 453,
|
|
4741
4765
|
S: this,
|
|
4742
4766
|
C: (f, a) => f(...a)
|
|
4743
4767
|
});
|
|
@@ -4752,26 +4776,28 @@ var DataSpace = class {
|
|
|
4752
4776
|
rootUrl
|
|
4753
4777
|
}, {
|
|
4754
4778
|
F: __dxlog_file15,
|
|
4755
|
-
L:
|
|
4779
|
+
L: 463,
|
|
4756
4780
|
S: this,
|
|
4757
4781
|
C: (f, a) => f(...a)
|
|
4758
4782
|
});
|
|
4759
|
-
|
|
4783
|
+
let handle;
|
|
4760
4784
|
queueMicrotask(async () => {
|
|
4761
4785
|
try {
|
|
4786
|
+
const env = {
|
|
4787
|
+
stack: [],
|
|
4788
|
+
error: void 0,
|
|
4789
|
+
hasError: false
|
|
4790
|
+
};
|
|
4762
4791
|
try {
|
|
4763
|
-
var _usingCtx = _using_ctx3();
|
|
4764
4792
|
await (0, import_debug.warnAfterTimeout)(5e3, "Automerge root doc load timeout (DataSpace)", async () => {
|
|
4793
|
+
handle = await (0, import_context4.cancelWithContext)(this._ctx, this._echoHost.automergeRepo.find(rootUrl, import_echo_pipeline.FIND_PARAMS));
|
|
4765
4794
|
await (0, import_context4.cancelWithContext)(this._ctx, handle.whenReady());
|
|
4766
4795
|
});
|
|
4767
4796
|
if (this._ctx.disposed) {
|
|
4768
4797
|
return;
|
|
4769
4798
|
}
|
|
4770
|
-
const _guard = (
|
|
4771
|
-
|
|
4772
|
-
_usingCtx.u(await this._epochProcessingMutex.acquire())
|
|
4773
|
-
);
|
|
4774
|
-
const doc = handle.docSync() ?? (0, import_invariant3.failedInvariant)();
|
|
4799
|
+
const _guard = _ts_add_disposable_resource3(env, await this._epochProcessingMutex.acquire(), false);
|
|
4800
|
+
const doc = handle.doc() ?? (0, import_invariant3.failedInvariant)();
|
|
4775
4801
|
if (!doc.access?.spaceKey) {
|
|
4776
4802
|
handle.change((doc2) => {
|
|
4777
4803
|
doc2.access = {
|
|
@@ -4782,17 +4808,18 @@ var DataSpace = class {
|
|
|
4782
4808
|
const root = await this._echoHost.openSpaceRoot(this.id, handle.url);
|
|
4783
4809
|
this._databaseRoot = root;
|
|
4784
4810
|
if (root.getVersion() !== import_echo_protocol.SpaceDocVersion.CURRENT) {
|
|
4785
|
-
this._state =
|
|
4811
|
+
this._state = import_services5.SpaceState.SPACE_REQUIRES_MIGRATION;
|
|
4786
4812
|
this.stateUpdate.emit();
|
|
4787
|
-
} else if (this._state !==
|
|
4813
|
+
} else if (this._state !== import_services5.SpaceState.SPACE_READY) {
|
|
4788
4814
|
await this._enterReadyState();
|
|
4789
4815
|
} else {
|
|
4790
4816
|
this.stateUpdate.emit();
|
|
4791
4817
|
}
|
|
4792
|
-
} catch (
|
|
4793
|
-
|
|
4818
|
+
} catch (e) {
|
|
4819
|
+
env.error = e;
|
|
4820
|
+
env.hasError = true;
|
|
4794
4821
|
} finally {
|
|
4795
|
-
|
|
4822
|
+
_ts_dispose_resources3(env);
|
|
4796
4823
|
}
|
|
4797
4824
|
} catch (err) {
|
|
4798
4825
|
if (err instanceof import_context4.ContextDisposedError) {
|
|
@@ -4804,7 +4831,7 @@ var DataSpace = class {
|
|
|
4804
4831
|
err
|
|
4805
4832
|
}, {
|
|
4806
4833
|
F: __dxlog_file15,
|
|
4807
|
-
L:
|
|
4834
|
+
L: 510,
|
|
4808
4835
|
S: this,
|
|
4809
4836
|
C: (f, a) => f(...a)
|
|
4810
4837
|
});
|
|
@@ -4872,29 +4899,29 @@ var DataSpace = class {
|
|
|
4872
4899
|
}
|
|
4873
4900
|
async activate() {
|
|
4874
4901
|
if (![
|
|
4875
|
-
|
|
4876
|
-
|
|
4902
|
+
import_services5.SpaceState.SPACE_CLOSED,
|
|
4903
|
+
import_services5.SpaceState.SPACE_INACTIVE
|
|
4877
4904
|
].includes(this._state)) {
|
|
4878
4905
|
return;
|
|
4879
4906
|
}
|
|
4880
|
-
await this._metadataStore.setSpaceState(this.key,
|
|
4907
|
+
await this._metadataStore.setSpaceState(this.key, import_services5.SpaceState.SPACE_ACTIVE);
|
|
4881
4908
|
await this._open();
|
|
4882
4909
|
this.initializeDataPipelineAsync();
|
|
4883
4910
|
}
|
|
4884
4911
|
async deactivate() {
|
|
4885
|
-
if (this._state ===
|
|
4912
|
+
if (this._state === import_services5.SpaceState.SPACE_INACTIVE) {
|
|
4886
4913
|
return;
|
|
4887
4914
|
}
|
|
4888
|
-
await this._metadataStore.setSpaceState(this.key,
|
|
4889
|
-
if (this._state !==
|
|
4915
|
+
await this._metadataStore.setSpaceState(this.key, import_services5.SpaceState.SPACE_INACTIVE);
|
|
4916
|
+
if (this._state !== import_services5.SpaceState.SPACE_CLOSED) {
|
|
4890
4917
|
await this._close();
|
|
4891
4918
|
}
|
|
4892
|
-
this._state =
|
|
4919
|
+
this._state = import_services5.SpaceState.SPACE_INACTIVE;
|
|
4893
4920
|
(0, import_log4.log)("new state", {
|
|
4894
|
-
state:
|
|
4921
|
+
state: import_services5.SpaceState[this._state]
|
|
4895
4922
|
}, {
|
|
4896
4923
|
F: __dxlog_file15,
|
|
4897
|
-
L:
|
|
4924
|
+
L: 592,
|
|
4898
4925
|
S: this,
|
|
4899
4926
|
C: (f, a) => f(...a)
|
|
4900
4927
|
});
|
|
@@ -4915,7 +4942,7 @@ _ts_decorate6([
|
|
|
4915
4942
|
], DataSpace.prototype, "key", null);
|
|
4916
4943
|
_ts_decorate6([
|
|
4917
4944
|
import_tracing3.trace.info({
|
|
4918
|
-
enum:
|
|
4945
|
+
enum: import_services5.SpaceState
|
|
4919
4946
|
})
|
|
4920
4947
|
], DataSpace.prototype, "state", null);
|
|
4921
4948
|
_ts_decorate6([
|
|
@@ -4969,7 +4996,7 @@ var DeviceInvitationProtocol = class {
|
|
|
4969
4996
|
}
|
|
4970
4997
|
getInvitationContext() {
|
|
4971
4998
|
return {
|
|
4972
|
-
kind:
|
|
4999
|
+
kind: import_services11.Invitation.Kind.DEVICE
|
|
4973
5000
|
};
|
|
4974
5001
|
}
|
|
4975
5002
|
async delegate() {
|
|
@@ -5072,7 +5099,7 @@ var DeviceInvitationProtocol = class {
|
|
|
5072
5099
|
}
|
|
5073
5100
|
};
|
|
5074
5101
|
var stateToString = (state) => {
|
|
5075
|
-
return Object.entries(
|
|
5102
|
+
return Object.entries(import_services14.Invitation.State).find(([key, val]) => val === state)?.[0] ?? "unknown";
|
|
5076
5103
|
};
|
|
5077
5104
|
var computeExpirationTime = (invitation) => {
|
|
5078
5105
|
if (!invitation.lifetime) {
|
|
@@ -5115,7 +5142,7 @@ var EdgeInvitationHandler = class {
|
|
|
5115
5142
|
}
|
|
5116
5143
|
const invitation = guardedState.current;
|
|
5117
5144
|
const spaceId = invitation.spaceId;
|
|
5118
|
-
const canBeHandledByEdge = invitation.authMethod !==
|
|
5145
|
+
const canBeHandledByEdge = invitation.authMethod !== import_services13.Invitation.AuthMethod.SHARED_SECRET && invitation.type === import_services13.Invitation.Type.DELEGATED && invitation.kind === import_services13.Invitation.Kind.SPACE && spaceId != null && import_keys12.SpaceId.isValid(spaceId);
|
|
5119
5146
|
if (!canBeHandledByEdge) {
|
|
5120
5147
|
(0, import_log14.log)("invitation could not be handled by edge", {
|
|
5121
5148
|
invitation
|
|
@@ -5184,7 +5211,7 @@ var EdgeInvitationHandler = class {
|
|
|
5184
5211
|
S: this,
|
|
5185
5212
|
C: (f, a) => f(...a)
|
|
5186
5213
|
});
|
|
5187
|
-
guardedState.set(this,
|
|
5214
|
+
guardedState.set(this, import_services13.Invitation.State.CONNECTING);
|
|
5188
5215
|
const response = await this._joinSpaceByInvitation(guardedState, spaceId, {
|
|
5189
5216
|
identityKey: admissionRequest.identityKey.toHex(),
|
|
5190
5217
|
invitationId: guardedState.current.invitationId
|
|
@@ -5194,7 +5221,7 @@ var EdgeInvitationHandler = class {
|
|
|
5194
5221
|
space: admissionRequest
|
|
5195
5222
|
});
|
|
5196
5223
|
} catch (error) {
|
|
5197
|
-
guardedState.set(this,
|
|
5224
|
+
guardedState.set(this, import_services13.Invitation.State.ERROR);
|
|
5198
5225
|
throw error;
|
|
5199
5226
|
} finally {
|
|
5200
5227
|
this._flowLock?.release();
|
|
@@ -5257,15 +5284,10 @@ var InvitationGuestExtension = class extends import_teleport2.RpcExtension {
|
|
|
5257
5284
|
exposed: {
|
|
5258
5285
|
InvitationHostService: import_proto4.schema.getService("dxos.halo.invitations.InvitationHostService")
|
|
5259
5286
|
}
|
|
5260
|
-
})
|
|
5261
|
-
this._invitationFlowMutex = _invitationFlowMutex;
|
|
5262
|
-
this._callbacks = _callbacks;
|
|
5263
|
-
this._ctx = new import_context13.Context(void 0, {
|
|
5287
|
+
}), this._invitationFlowMutex = _invitationFlowMutex, this._callbacks = _callbacks, this._ctx = new import_context13.Context(void 0, {
|
|
5264
5288
|
F: __dxlog_file18,
|
|
5265
5289
|
L: 38
|
|
5266
|
-
});
|
|
5267
|
-
this._remoteOptionsTrigger = new import_async17.Trigger();
|
|
5268
|
-
this._invitationFlowLock = null;
|
|
5290
|
+
}), this._remoteOptionsTrigger = new import_async17.Trigger(), this._invitationFlowLock = null;
|
|
5269
5291
|
}
|
|
5270
5292
|
hasFlowLock() {
|
|
5271
5293
|
return this._invitationFlowLock != null;
|
|
@@ -5381,20 +5403,10 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5381
5403
|
exposed: {
|
|
5382
5404
|
InvitationHostService: import_proto5.schema.getService("dxos.halo.invitations.InvitationHostService")
|
|
5383
5405
|
}
|
|
5384
|
-
})
|
|
5385
|
-
this._invitationFlowMutex = _invitationFlowMutex;
|
|
5386
|
-
this._callbacks = _callbacks;
|
|
5387
|
-
this._ctx = new import_context14.Context(void 0, {
|
|
5406
|
+
}), this._invitationFlowMutex = _invitationFlowMutex, this._callbacks = _callbacks, this._ctx = new import_context14.Context(void 0, {
|
|
5388
5407
|
F: __dxlog_file19,
|
|
5389
5408
|
L: 57
|
|
5390
|
-
});
|
|
5391
|
-
this._remoteOptionsTrigger = new import_async18.Trigger();
|
|
5392
|
-
this._challenge = void 0;
|
|
5393
|
-
this.guestProfile = void 0;
|
|
5394
|
-
this.authenticationPassed = false;
|
|
5395
|
-
this.authenticationRetry = 0;
|
|
5396
|
-
this.completedTrigger = new import_async18.Trigger();
|
|
5397
|
-
this._invitationFlowLock = null;
|
|
5409
|
+
}), this._remoteOptionsTrigger = new import_async18.Trigger(), this._challenge = void 0, this.guestProfile = void 0, this.authenticationPassed = false, this.authenticationRetry = 0, this.completedTrigger = new import_async18.Trigger(), this._invitationFlowLock = null;
|
|
5398
5410
|
}
|
|
5399
5411
|
hasFlowLock() {
|
|
5400
5412
|
return this._invitationFlowLock != null;
|
|
@@ -5429,7 +5441,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5429
5441
|
C: (f, a) => f(...a)
|
|
5430
5442
|
});
|
|
5431
5443
|
const invitation = this._requireActiveInvitation();
|
|
5432
|
-
this._assertInvitationState(
|
|
5444
|
+
this._assertInvitationState(import_services15.Invitation.State.CONNECTED);
|
|
5433
5445
|
if (invitationId !== invitation?.invitationId) {
|
|
5434
5446
|
import_log16.log.warn("incorrect invitationId", {
|
|
5435
5447
|
expected: invitation.invitationId,
|
|
@@ -5443,7 +5455,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5443
5455
|
this._callbacks.onError(new Error("Incorrect invitationId."));
|
|
5444
5456
|
(0, import_async18.scheduleTask)(this._ctx, () => this.close());
|
|
5445
5457
|
return {
|
|
5446
|
-
authMethod:
|
|
5458
|
+
authMethod: import_services15.Invitation.AuthMethod.NONE
|
|
5447
5459
|
};
|
|
5448
5460
|
}
|
|
5449
5461
|
import_log16.log.verbose("guest introduced themselves", {
|
|
@@ -5455,8 +5467,8 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5455
5467
|
C: (f, a) => f(...a)
|
|
5456
5468
|
});
|
|
5457
5469
|
this.guestProfile = profile;
|
|
5458
|
-
this._callbacks.onStateUpdate(
|
|
5459
|
-
this._challenge = invitation.authMethod ===
|
|
5470
|
+
this._callbacks.onStateUpdate(import_services15.Invitation.State.READY_FOR_AUTHENTICATION);
|
|
5471
|
+
this._challenge = invitation.authMethod === import_services15.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? (0, import_crypto3.randomBytes)(32) : void 0;
|
|
5460
5472
|
import_log16.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols14.trace.end({
|
|
5461
5473
|
id: traceId
|
|
5462
5474
|
}), {
|
|
@@ -5491,12 +5503,12 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5491
5503
|
});
|
|
5492
5504
|
let status = import_invitations4.AuthenticationResponse.Status.OK;
|
|
5493
5505
|
this._assertInvitationState([
|
|
5494
|
-
|
|
5495
|
-
|
|
5506
|
+
import_services15.Invitation.State.AUTHENTICATING,
|
|
5507
|
+
import_services15.Invitation.State.READY_FOR_AUTHENTICATION
|
|
5496
5508
|
]);
|
|
5497
|
-
this._callbacks.onStateUpdate(
|
|
5509
|
+
this._callbacks.onStateUpdate(import_services15.Invitation.State.AUTHENTICATING);
|
|
5498
5510
|
switch (invitation.authMethod) {
|
|
5499
|
-
case
|
|
5511
|
+
case import_services15.Invitation.AuthMethod.NONE: {
|
|
5500
5512
|
(0, import_log16.log)("authentication not required", void 0, {
|
|
5501
5513
|
F: __dxlog_file19,
|
|
5502
5514
|
L: 154,
|
|
@@ -5507,7 +5519,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5507
5519
|
status: import_invitations4.AuthenticationResponse.Status.OK
|
|
5508
5520
|
};
|
|
5509
5521
|
}
|
|
5510
|
-
case
|
|
5522
|
+
case import_services15.Invitation.AuthMethod.SHARED_SECRET: {
|
|
5511
5523
|
if (invitation.authCode) {
|
|
5512
5524
|
if (this.authenticationRetry++ > MAX_OTP_ATTEMPTS) {
|
|
5513
5525
|
status = import_invitations4.AuthenticationResponse.Status.INVALID_OPT_ATTEMPTS;
|
|
@@ -5519,7 +5531,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5519
5531
|
}
|
|
5520
5532
|
break;
|
|
5521
5533
|
}
|
|
5522
|
-
case
|
|
5534
|
+
case import_services15.Invitation.AuthMethod.KNOWN_PUBLIC_KEY: {
|
|
5523
5535
|
if (!invitation.guestKeypair) {
|
|
5524
5536
|
status = import_invitations4.AuthenticationResponse.Status.INTERNAL_ERROR;
|
|
5525
5537
|
break;
|
|
@@ -5583,7 +5595,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5583
5595
|
const invitation = this._requireActiveInvitation();
|
|
5584
5596
|
try {
|
|
5585
5597
|
if (isAuthenticationRequired(invitation)) {
|
|
5586
|
-
this._assertInvitationState(
|
|
5598
|
+
this._assertInvitationState(import_services15.Invitation.State.AUTHENTICATING);
|
|
5587
5599
|
if (!this.authenticationPassed) {
|
|
5588
5600
|
throw new Error("Not authenticated");
|
|
5589
5601
|
}
|
|
@@ -5622,7 +5634,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5622
5634
|
S: this,
|
|
5623
5635
|
C: (f, a) => f(...a)
|
|
5624
5636
|
});
|
|
5625
|
-
this._callbacks.onStateUpdate(
|
|
5637
|
+
this._callbacks.onStateUpdate(import_services15.Invitation.State.CONNECTING);
|
|
5626
5638
|
await this.rpc.InvitationHostService.options({
|
|
5627
5639
|
role: import_invitations4.InvitationOptions.Role.HOST
|
|
5628
5640
|
});
|
|
@@ -5648,7 +5660,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5648
5660
|
remotePeerId: context.remotePeerId
|
|
5649
5661
|
});
|
|
5650
5662
|
}
|
|
5651
|
-
this._callbacks.onStateUpdate(
|
|
5663
|
+
this._callbacks.onStateUpdate(import_services15.Invitation.State.CONNECTED);
|
|
5652
5664
|
this._callbacks.onOpen(this._ctx, context);
|
|
5653
5665
|
} catch (err) {
|
|
5654
5666
|
if (this._invitationFlowLock != null) {
|
|
@@ -5697,7 +5709,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5697
5709
|
}
|
|
5698
5710
|
}
|
|
5699
5711
|
};
|
|
5700
|
-
var isAuthenticationRequired = (invitation) => invitation.authMethod !==
|
|
5712
|
+
var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services15.Invitation.AuthMethod.NONE;
|
|
5701
5713
|
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-state.ts";
|
|
5702
5714
|
var createGuardedInvitationState = (ctx, invitation, stream) => {
|
|
5703
5715
|
const mutex = new import_async19.Mutex();
|
|
@@ -5741,10 +5753,10 @@ var createGuardedInvitationState = (ctx, invitation, stream) => {
|
|
|
5741
5753
|
},
|
|
5742
5754
|
error: (lockHolder, error) => {
|
|
5743
5755
|
if (isStateChangeAllowed(lockHolder)) {
|
|
5744
|
-
logStateUpdate(currentInvitation, lockHolder,
|
|
5756
|
+
logStateUpdate(currentInvitation, lockHolder, import_services16.Invitation.State.ERROR, error);
|
|
5745
5757
|
currentInvitation = {
|
|
5746
5758
|
...currentInvitation,
|
|
5747
|
-
state:
|
|
5759
|
+
state: import_services16.Invitation.State.ERROR
|
|
5748
5760
|
};
|
|
5749
5761
|
stream.next(currentInvitation);
|
|
5750
5762
|
stream.error(error);
|
|
@@ -5782,11 +5794,11 @@ var logStateUpdate = (invitation, actor, newState, error) => {
|
|
|
5782
5794
|
};
|
|
5783
5795
|
var isNonTerminalState = (currentState) => {
|
|
5784
5796
|
return ![
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5797
|
+
import_services16.Invitation.State.SUCCESS,
|
|
5798
|
+
import_services16.Invitation.State.ERROR,
|
|
5799
|
+
import_services16.Invitation.State.CANCELLED,
|
|
5800
|
+
import_services16.Invitation.State.TIMEOUT,
|
|
5801
|
+
import_services16.Invitation.State.EXPIRED
|
|
5790
5802
|
].includes(currentState);
|
|
5791
5803
|
};
|
|
5792
5804
|
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
|
|
@@ -5892,7 +5904,7 @@ var InvitationsHandler = class {
|
|
|
5892
5904
|
return ctx.disposed ? null : guardedState.current;
|
|
5893
5905
|
},
|
|
5894
5906
|
onStateUpdate: (newState) => {
|
|
5895
|
-
if (newState !==
|
|
5907
|
+
if (newState !== import_services12.Invitation.State.ERROR && newState !== import_services12.Invitation.State.TIMEOUT) {
|
|
5896
5908
|
guardedState.set(extension, newState);
|
|
5897
5909
|
}
|
|
5898
5910
|
return guardedState.current;
|
|
@@ -5930,7 +5942,7 @@ var InvitationsHandler = class {
|
|
|
5930
5942
|
let admitted = false;
|
|
5931
5943
|
connectionCtx.onDispose(() => {
|
|
5932
5944
|
if (!admitted) {
|
|
5933
|
-
guardedState.set(extension,
|
|
5945
|
+
guardedState.set(extension, import_services12.Invitation.State.CONNECTING);
|
|
5934
5946
|
}
|
|
5935
5947
|
});
|
|
5936
5948
|
(0, import_async15.scheduleTask)(connectionCtx, async () => {
|
|
@@ -5964,7 +5976,7 @@ var InvitationsHandler = class {
|
|
|
5964
5976
|
S: this,
|
|
5965
5977
|
C: (f, a) => f(...a)
|
|
5966
5978
|
});
|
|
5967
|
-
guardedState.set(extension,
|
|
5979
|
+
guardedState.set(extension, import_services12.Invitation.State.SUCCESS);
|
|
5968
5980
|
metrics.increment("dxos.invitation.success");
|
|
5969
5981
|
import_log13.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols11.trace.end({
|
|
5970
5982
|
id: traceId
|
|
@@ -5979,7 +5991,7 @@ var InvitationsHandler = class {
|
|
|
5979
5991
|
await ctx.dispose();
|
|
5980
5992
|
}
|
|
5981
5993
|
} catch (err) {
|
|
5982
|
-
const stateChanged = guardedState.set(extension,
|
|
5994
|
+
const stateChanged = guardedState.set(extension, import_services12.Invitation.State.CONNECTING);
|
|
5983
5995
|
if (err instanceof import_async15.TimeoutError) {
|
|
5984
5996
|
if (stateChanged) {
|
|
5985
5997
|
metrics.increment("dxos.invitation.timeout");
|
|
@@ -6017,7 +6029,7 @@ var InvitationsHandler = class {
|
|
|
6017
6029
|
});
|
|
6018
6030
|
},
|
|
6019
6031
|
onError: (err) => {
|
|
6020
|
-
const stateChanged = guardedState.set(extension,
|
|
6032
|
+
const stateChanged = guardedState.set(extension, import_services12.Invitation.State.CONNECTING);
|
|
6021
6033
|
if (err instanceof import_protocols11.InvalidInvitationExtensionRoleError) {
|
|
6022
6034
|
(0, import_log13.log)("invalid role", {
|
|
6023
6035
|
...err.context
|
|
@@ -6065,7 +6077,7 @@ var InvitationsHandler = class {
|
|
|
6065
6077
|
S: this,
|
|
6066
6078
|
C: (f, a) => f(...a)
|
|
6067
6079
|
});
|
|
6068
|
-
guardedState.set(null,
|
|
6080
|
+
guardedState.set(null, import_services12.Invitation.State.EXPIRED);
|
|
6069
6081
|
void ctx.dispose().catch((err) => import_log13.log.catch(err, void 0, {
|
|
6070
6082
|
F: __dxlog_file22,
|
|
6071
6083
|
L: 196,
|
|
@@ -6076,7 +6088,7 @@ var InvitationsHandler = class {
|
|
|
6076
6088
|
}
|
|
6077
6089
|
(0, import_async15.scheduleTask)(ctx, async () => {
|
|
6078
6090
|
await swarmConnection.close();
|
|
6079
|
-
guardedState.set(null,
|
|
6091
|
+
guardedState.set(null, import_services12.Invitation.State.EXPIRED);
|
|
6080
6092
|
metrics.increment("dxos.invitation.expired");
|
|
6081
6093
|
await ctx.dispose();
|
|
6082
6094
|
}, expiresOn.getTime() - Date.now());
|
|
@@ -6084,7 +6096,7 @@ var InvitationsHandler = class {
|
|
|
6084
6096
|
let swarmConnection;
|
|
6085
6097
|
(0, import_async15.scheduleTask)(ctx, async () => {
|
|
6086
6098
|
swarmConnection = await this._joinSwarm(ctx, invitation, import_invitations2.InvitationOptions.Role.HOST, createExtension);
|
|
6087
|
-
guardedState.set(null,
|
|
6099
|
+
guardedState.set(null, import_services12.Invitation.State.CONNECTING);
|
|
6088
6100
|
});
|
|
6089
6101
|
}
|
|
6090
6102
|
acceptInvitation(ctx, stream, protocol, invitation, otpEnteredTrigger, deviceProfile) {
|
|
@@ -6101,7 +6113,7 @@ var InvitationsHandler = class {
|
|
|
6101
6113
|
});
|
|
6102
6114
|
const { timeout = import_client_protocol5.INVITATION_TIMEOUT } = invitation;
|
|
6103
6115
|
if (deviceProfile) {
|
|
6104
|
-
(0, import_invariant14.invariant)(invitation.kind ===
|
|
6116
|
+
(0, import_invariant14.invariant)(invitation.kind === import_services12.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
6105
6117
|
F: __dxlog_file22,
|
|
6106
6118
|
L: 236,
|
|
6107
6119
|
S: this,
|
|
@@ -6117,7 +6129,7 @@ var InvitationsHandler = class {
|
|
|
6117
6129
|
const isLockedByAnotherConnection = guardedState.mutex.isLocked() && !extension.hasFlowLock();
|
|
6118
6130
|
(0, import_log13.log)("should cancel invitation flow", {
|
|
6119
6131
|
isLockedByAnotherConnection,
|
|
6120
|
-
invitationType:
|
|
6132
|
+
invitationType: import_services12.Invitation.Type.DELEGATED,
|
|
6121
6133
|
triedPeers: triedPeersIds.size
|
|
6122
6134
|
}, {
|
|
6123
6135
|
F: __dxlog_file22,
|
|
@@ -6128,7 +6140,7 @@ var InvitationsHandler = class {
|
|
|
6128
6140
|
if (isLockedByAnotherConnection) {
|
|
6129
6141
|
return false;
|
|
6130
6142
|
}
|
|
6131
|
-
return invitation.type !==
|
|
6143
|
+
return invitation.type !== import_services12.Invitation.Type.DELEGATED || triedPeersIds.size >= MAX_DELEGATED_INVITATION_HOST_TRIES;
|
|
6132
6144
|
};
|
|
6133
6145
|
let admitted = false;
|
|
6134
6146
|
const createExtension = () => {
|
|
@@ -6171,7 +6183,7 @@ var InvitationsHandler = class {
|
|
|
6171
6183
|
C: (f, a) => f(...a)
|
|
6172
6184
|
});
|
|
6173
6185
|
(0, import_async15.scheduleTask)(connectionCtx, () => {
|
|
6174
|
-
guardedState.set(extension,
|
|
6186
|
+
guardedState.set(extension, import_services12.Invitation.State.TIMEOUT);
|
|
6175
6187
|
extensionCtx.close();
|
|
6176
6188
|
}, timeout);
|
|
6177
6189
|
import_log13.log.verbose("dxos.sdk.invitations-handler.guest.connected", {
|
|
@@ -6182,7 +6194,7 @@ var InvitationsHandler = class {
|
|
|
6182
6194
|
S: this,
|
|
6183
6195
|
C: (f, a) => f(...a)
|
|
6184
6196
|
});
|
|
6185
|
-
guardedState.set(extension,
|
|
6197
|
+
guardedState.set(extension, import_services12.Invitation.State.CONNECTED);
|
|
6186
6198
|
import_log13.log.verbose("dxos.sdk.invitations-handler.guest.introduce", {
|
|
6187
6199
|
invitationId: invitation.invitationId,
|
|
6188
6200
|
...protocol.toJSON()
|
|
@@ -6209,12 +6221,12 @@ var InvitationsHandler = class {
|
|
|
6209
6221
|
invitation.authMethod = introductionResponse.authMethod;
|
|
6210
6222
|
if (isAuthenticationRequired(invitation)) {
|
|
6211
6223
|
switch (invitation.authMethod) {
|
|
6212
|
-
case
|
|
6224
|
+
case import_services12.Invitation.AuthMethod.SHARED_SECRET:
|
|
6213
6225
|
await this._handleGuestOtpAuth(extension, (state) => guardedState.set(extension, state), otpEnteredTrigger, {
|
|
6214
6226
|
timeout
|
|
6215
6227
|
});
|
|
6216
6228
|
break;
|
|
6217
|
-
case
|
|
6229
|
+
case import_services12.Invitation.AuthMethod.KNOWN_PUBLIC_KEY:
|
|
6218
6230
|
await this._handleGuestKpkAuth(extension, (state) => guardedState.set(extension, state), invitation, introductionResponse);
|
|
6219
6231
|
break;
|
|
6220
6232
|
}
|
|
@@ -6244,7 +6256,7 @@ var InvitationsHandler = class {
|
|
|
6244
6256
|
guardedState.complete({
|
|
6245
6257
|
...guardedState.current,
|
|
6246
6258
|
...result,
|
|
6247
|
-
state:
|
|
6259
|
+
state: import_services12.Invitation.State.SUCCESS
|
|
6248
6260
|
});
|
|
6249
6261
|
import_log13.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols11.trace.end({
|
|
6250
6262
|
id: traceId
|
|
@@ -6264,7 +6276,7 @@ var InvitationsHandler = class {
|
|
|
6264
6276
|
S: this,
|
|
6265
6277
|
C: (f, a) => f(...a)
|
|
6266
6278
|
});
|
|
6267
|
-
guardedState.set(extension,
|
|
6279
|
+
guardedState.set(extension, import_services12.Invitation.State.TIMEOUT);
|
|
6268
6280
|
} else {
|
|
6269
6281
|
import_log13.log.verbose("auth failed", err, {
|
|
6270
6282
|
F: __dxlog_file22,
|
|
@@ -6300,7 +6312,7 @@ var InvitationsHandler = class {
|
|
|
6300
6312
|
S: this,
|
|
6301
6313
|
C: (f, a) => f(...a)
|
|
6302
6314
|
});
|
|
6303
|
-
guardedState.set(extension,
|
|
6315
|
+
guardedState.set(extension, import_services12.Invitation.State.TIMEOUT);
|
|
6304
6316
|
} else {
|
|
6305
6317
|
import_log13.log.verbose("auth failed", err, {
|
|
6306
6318
|
F: __dxlog_file22,
|
|
@@ -6328,7 +6340,7 @@ var InvitationsHandler = class {
|
|
|
6328
6340
|
guardedState.complete({
|
|
6329
6341
|
...guardedState.current,
|
|
6330
6342
|
...result,
|
|
6331
|
-
state:
|
|
6343
|
+
state: import_services12.Invitation.State.SUCCESS
|
|
6332
6344
|
});
|
|
6333
6345
|
}
|
|
6334
6346
|
});
|
|
@@ -6352,12 +6364,12 @@ var InvitationsHandler = class {
|
|
|
6352
6364
|
if (guardedState.mutex.isLocked()) {
|
|
6353
6365
|
(0, import_async15.scheduleTask)(ctx, timeoutInactive, timeout);
|
|
6354
6366
|
} else {
|
|
6355
|
-
guardedState.set(null,
|
|
6367
|
+
guardedState.set(null, import_services12.Invitation.State.TIMEOUT);
|
|
6356
6368
|
}
|
|
6357
6369
|
};
|
|
6358
6370
|
(0, import_async15.scheduleTask)(ctx, timeoutInactive, timeout);
|
|
6359
6371
|
await this._joinSwarm(ctx, invitation, import_invitations2.InvitationOptions.Role.GUEST, createExtension);
|
|
6360
|
-
guardedState.set(null,
|
|
6372
|
+
guardedState.set(null, import_services12.Invitation.State.CONNECTING);
|
|
6361
6373
|
}
|
|
6362
6374
|
});
|
|
6363
6375
|
}
|
|
@@ -6365,7 +6377,7 @@ var InvitationsHandler = class {
|
|
|
6365
6377
|
let label;
|
|
6366
6378
|
if (role === import_invitations2.InvitationOptions.Role.GUEST) {
|
|
6367
6379
|
label = "invitation guest";
|
|
6368
|
-
} else if (invitation.kind ===
|
|
6380
|
+
} else if (invitation.kind === import_services12.Invitation.Kind.DEVICE) {
|
|
6369
6381
|
label = "invitation host for device";
|
|
6370
6382
|
} else {
|
|
6371
6383
|
label = `invitation host for space ${invitation.spaceKey?.truncate()}`;
|
|
@@ -6389,7 +6401,7 @@ var InvitationsHandler = class {
|
|
|
6389
6401
|
S: this,
|
|
6390
6402
|
C: (f, a) => f(...a)
|
|
6391
6403
|
});
|
|
6392
|
-
setState(
|
|
6404
|
+
setState(import_services12.Invitation.State.READY_FOR_AUTHENTICATION);
|
|
6393
6405
|
const authCode = await authenticated.wait(options);
|
|
6394
6406
|
(0, import_log13.log)("sending authentication request", void 0, {
|
|
6395
6407
|
F: __dxlog_file22,
|
|
@@ -6397,7 +6409,7 @@ var InvitationsHandler = class {
|
|
|
6397
6409
|
S: this,
|
|
6398
6410
|
C: (f, a) => f(...a)
|
|
6399
6411
|
});
|
|
6400
|
-
setState(
|
|
6412
|
+
setState(import_services12.Invitation.State.AUTHENTICATING);
|
|
6401
6413
|
const response = await extension.rpc.InvitationHostService.authenticate({
|
|
6402
6414
|
authCode
|
|
6403
6415
|
});
|
|
@@ -6489,8 +6501,8 @@ var InvitationsServiceImpl = class {
|
|
|
6489
6501
|
return new import_stream9.Stream(({ next, ctx }) => {
|
|
6490
6502
|
this._invitationsManager.invitationCreated.on(ctx, (invitation) => {
|
|
6491
6503
|
next({
|
|
6492
|
-
action:
|
|
6493
|
-
type:
|
|
6504
|
+
action: import_services17.QueryInvitationsResponse.Action.ADDED,
|
|
6505
|
+
type: import_services17.QueryInvitationsResponse.Type.CREATED,
|
|
6494
6506
|
invitations: [
|
|
6495
6507
|
invitation
|
|
6496
6508
|
]
|
|
@@ -6498,8 +6510,8 @@ var InvitationsServiceImpl = class {
|
|
|
6498
6510
|
});
|
|
6499
6511
|
this._invitationsManager.invitationAccepted.on(ctx, (invitation) => {
|
|
6500
6512
|
next({
|
|
6501
|
-
action:
|
|
6502
|
-
type:
|
|
6513
|
+
action: import_services17.QueryInvitationsResponse.Action.ADDED,
|
|
6514
|
+
type: import_services17.QueryInvitationsResponse.Type.ACCEPTED,
|
|
6503
6515
|
invitations: [
|
|
6504
6516
|
invitation
|
|
6505
6517
|
]
|
|
@@ -6507,8 +6519,8 @@ var InvitationsServiceImpl = class {
|
|
|
6507
6519
|
});
|
|
6508
6520
|
this._invitationsManager.removedCreated.on(ctx, (invitation) => {
|
|
6509
6521
|
next({
|
|
6510
|
-
action:
|
|
6511
|
-
type:
|
|
6522
|
+
action: import_services17.QueryInvitationsResponse.Action.REMOVED,
|
|
6523
|
+
type: import_services17.QueryInvitationsResponse.Type.CREATED,
|
|
6512
6524
|
invitations: [
|
|
6513
6525
|
invitation
|
|
6514
6526
|
]
|
|
@@ -6516,8 +6528,8 @@ var InvitationsServiceImpl = class {
|
|
|
6516
6528
|
});
|
|
6517
6529
|
this._invitationsManager.removedAccepted.on(ctx, (invitation) => {
|
|
6518
6530
|
next({
|
|
6519
|
-
action:
|
|
6520
|
-
type:
|
|
6531
|
+
action: import_services17.QueryInvitationsResponse.Action.REMOVED,
|
|
6532
|
+
type: import_services17.QueryInvitationsResponse.Type.ACCEPTED,
|
|
6521
6533
|
invitations: [
|
|
6522
6534
|
invitation
|
|
6523
6535
|
]
|
|
@@ -6525,29 +6537,29 @@ var InvitationsServiceImpl = class {
|
|
|
6525
6537
|
});
|
|
6526
6538
|
this._invitationsManager.saved.on(ctx, (invitation) => {
|
|
6527
6539
|
next({
|
|
6528
|
-
action:
|
|
6529
|
-
type:
|
|
6540
|
+
action: import_services17.QueryInvitationsResponse.Action.SAVED,
|
|
6541
|
+
type: import_services17.QueryInvitationsResponse.Type.CREATED,
|
|
6530
6542
|
invitations: [
|
|
6531
6543
|
invitation
|
|
6532
6544
|
]
|
|
6533
6545
|
});
|
|
6534
6546
|
});
|
|
6535
6547
|
next({
|
|
6536
|
-
action:
|
|
6537
|
-
type:
|
|
6548
|
+
action: import_services17.QueryInvitationsResponse.Action.ADDED,
|
|
6549
|
+
type: import_services17.QueryInvitationsResponse.Type.CREATED,
|
|
6538
6550
|
invitations: this._invitationsManager.getCreatedInvitations(),
|
|
6539
6551
|
existing: true
|
|
6540
6552
|
});
|
|
6541
6553
|
next({
|
|
6542
|
-
action:
|
|
6543
|
-
type:
|
|
6554
|
+
action: import_services17.QueryInvitationsResponse.Action.ADDED,
|
|
6555
|
+
type: import_services17.QueryInvitationsResponse.Type.ACCEPTED,
|
|
6544
6556
|
invitations: this._invitationsManager.getAcceptedInvitations(),
|
|
6545
6557
|
existing: true
|
|
6546
6558
|
});
|
|
6547
6559
|
this._invitationsManager.onPersistentInvitationsLoaded(ctx, () => {
|
|
6548
6560
|
next({
|
|
6549
|
-
action:
|
|
6550
|
-
type:
|
|
6561
|
+
action: import_services17.QueryInvitationsResponse.Action.LOAD_COMPLETE,
|
|
6562
|
+
type: import_services17.QueryInvitationsResponse.Type.CREATED
|
|
6551
6563
|
});
|
|
6552
6564
|
});
|
|
6553
6565
|
});
|
|
@@ -6602,7 +6614,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6602
6614
|
]
|
|
6603
6615
|
});
|
|
6604
6616
|
return {
|
|
6605
|
-
kind:
|
|
6617
|
+
kind: import_services18.Invitation.Kind.SPACE,
|
|
6606
6618
|
spaceKey: this._spaceKey,
|
|
6607
6619
|
spaceId: space.id
|
|
6608
6620
|
};
|
|
@@ -6661,7 +6673,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6661
6673
|
""
|
|
6662
6674
|
]
|
|
6663
6675
|
});
|
|
6664
|
-
if (invitation.authMethod ===
|
|
6676
|
+
if (invitation.authMethod === import_services18.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
6665
6677
|
(0, import_invariant19.invariant)(invitation.guestKeypair?.publicKey, void 0, {
|
|
6666
6678
|
F: __dxlog_file23,
|
|
6667
6679
|
L: 105,
|
|
@@ -6688,7 +6700,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6688
6700
|
role: invitation.role ?? import_credentials19.SpaceMember.Role.ADMIN,
|
|
6689
6701
|
expiresOn: computeExpirationTime(invitation),
|
|
6690
6702
|
multiUse: invitation.multiUse ?? false,
|
|
6691
|
-
guestKey: invitation.authMethod ===
|
|
6703
|
+
guestKey: invitation.authMethod === import_services18.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
6692
6704
|
});
|
|
6693
6705
|
(0, import_invariant19.invariant)(credential.credential, void 0, {
|
|
6694
6706
|
F: __dxlog_file23,
|
|
@@ -6714,7 +6726,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6714
6726
|
""
|
|
6715
6727
|
]
|
|
6716
6728
|
});
|
|
6717
|
-
(0, import_invariant19.invariant)(invitation.type ===
|
|
6729
|
+
(0, import_invariant19.invariant)(invitation.type === import_services18.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
6718
6730
|
F: __dxlog_file23,
|
|
6719
6731
|
L: 133,
|
|
6720
6732
|
S: this,
|
|
@@ -6994,7 +7006,7 @@ var InvitationsManager = class {
|
|
|
6994
7006
|
if (created.get().persistent) {
|
|
6995
7007
|
await this._metadataStore.removeInvitation(invitationId);
|
|
6996
7008
|
}
|
|
6997
|
-
if (created.get().type ===
|
|
7009
|
+
if (created.get().type === import_services19.Invitation.Type.DELEGATED) {
|
|
6998
7010
|
const handler = this._getHandler(created.get());
|
|
6999
7011
|
await handler.cancelDelegation(created.get());
|
|
7000
7012
|
}
|
|
@@ -7028,8 +7040,8 @@ var InvitationsManager = class {
|
|
|
7028
7040
|
}
|
|
7029
7041
|
}
|
|
7030
7042
|
_createInvitation(protocol, _options) {
|
|
7031
|
-
const { invitationId = import_keys15.PublicKey.random().toHex(), type =
|
|
7032
|
-
const authCode = options?.authCode ?? (authMethod ===
|
|
7043
|
+
const { invitationId = import_keys15.PublicKey.random().toHex(), type = import_services19.Invitation.Type.INTERACTIVE, authMethod = import_services19.Invitation.AuthMethod.SHARED_SECRET, state = import_services19.Invitation.State.INIT, timeout = import_client_protocol6.INVITATION_TIMEOUT, swarmKey = import_keys15.PublicKey.random(), persistent = _options?.authMethod !== import_services19.Invitation.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = import_credentials21.SpaceMember.Role.ADMIN, lifetime = 86400 * 7, multiUse = false, ...options } = _options ?? {};
|
|
7044
|
+
const authCode = options?.authCode ?? (authMethod === import_services19.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials20.generatePasscode)(import_client_protocol6.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
7033
7045
|
return {
|
|
7034
7046
|
invitationId,
|
|
7035
7047
|
type,
|
|
@@ -7038,8 +7050,8 @@ var InvitationsManager = class {
|
|
|
7038
7050
|
swarmKey,
|
|
7039
7051
|
authCode,
|
|
7040
7052
|
timeout,
|
|
7041
|
-
persistent: persistent && type !==
|
|
7042
|
-
guestKeypair: guestKeypair ?? (authMethod ===
|
|
7053
|
+
persistent: persistent && type !== import_services19.Invitation.Type.DELEGATED,
|
|
7054
|
+
guestKeypair: guestKeypair ?? (authMethod === import_services19.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? createAdmissionKeypair() : void 0),
|
|
7043
7055
|
created,
|
|
7044
7056
|
lifetime,
|
|
7045
7057
|
role,
|
|
@@ -7058,14 +7070,14 @@ var InvitationsManager = class {
|
|
|
7058
7070
|
}
|
|
7059
7071
|
}, {
|
|
7060
7072
|
F: __dxlog_file24,
|
|
7061
|
-
L:
|
|
7073
|
+
L: 239
|
|
7062
7074
|
});
|
|
7063
7075
|
ctx.onDispose(() => {
|
|
7064
7076
|
(0, import_log20.log)("complete", {
|
|
7065
7077
|
...handler.toJSON()
|
|
7066
7078
|
}, {
|
|
7067
7079
|
F: __dxlog_file24,
|
|
7068
|
-
L:
|
|
7080
|
+
L: 246,
|
|
7069
7081
|
S: this,
|
|
7070
7082
|
C: (f, a) => f(...a)
|
|
7071
7083
|
});
|
|
@@ -7077,7 +7089,7 @@ var InvitationsManager = class {
|
|
|
7077
7089
|
onCancel: async () => {
|
|
7078
7090
|
stream.next({
|
|
7079
7091
|
...invitation,
|
|
7080
|
-
state:
|
|
7092
|
+
state: import_services19.Invitation.State.CANCELLED
|
|
7081
7093
|
});
|
|
7082
7094
|
await ctx.dispose();
|
|
7083
7095
|
}
|
|
@@ -7098,38 +7110,38 @@ var InvitationsManager = class {
|
|
|
7098
7110
|
...handler.toJSON()
|
|
7099
7111
|
}, {
|
|
7100
7112
|
F: __dxlog_file24,
|
|
7101
|
-
L:
|
|
7113
|
+
L: 274,
|
|
7102
7114
|
S: this,
|
|
7103
7115
|
C: (f, a) => f(...a)
|
|
7104
7116
|
});
|
|
7105
7117
|
stream.next({
|
|
7106
7118
|
...initialState,
|
|
7107
|
-
state:
|
|
7119
|
+
state: import_services19.Invitation.State.TIMEOUT
|
|
7108
7120
|
});
|
|
7109
7121
|
} else {
|
|
7110
7122
|
import_log20.log.warn("auth failed", err, {
|
|
7111
7123
|
F: __dxlog_file24,
|
|
7112
|
-
L:
|
|
7124
|
+
L: 277,
|
|
7113
7125
|
S: this,
|
|
7114
7126
|
C: (f, a) => f(...a)
|
|
7115
7127
|
});
|
|
7116
7128
|
stream.next({
|
|
7117
7129
|
...initialState,
|
|
7118
|
-
state:
|
|
7130
|
+
state: import_services19.Invitation.State.ERROR
|
|
7119
7131
|
});
|
|
7120
7132
|
}
|
|
7121
7133
|
void ctx.dispose();
|
|
7122
7134
|
}
|
|
7123
7135
|
}, {
|
|
7124
7136
|
F: __dxlog_file24,
|
|
7125
|
-
L:
|
|
7137
|
+
L: 271
|
|
7126
7138
|
});
|
|
7127
7139
|
ctx.onDispose(() => {
|
|
7128
7140
|
(0, import_log20.log)("complete", {
|
|
7129
7141
|
...handler.toJSON()
|
|
7130
7142
|
}, {
|
|
7131
7143
|
F: __dxlog_file24,
|
|
7132
|
-
L:
|
|
7144
|
+
L: 284,
|
|
7133
7145
|
S: this,
|
|
7134
7146
|
C: (f, a) => f(...a)
|
|
7135
7147
|
});
|
|
@@ -7141,7 +7153,7 @@ var InvitationsManager = class {
|
|
|
7141
7153
|
onCancel: async () => {
|
|
7142
7154
|
stream.next({
|
|
7143
7155
|
...initialState,
|
|
7144
|
-
state:
|
|
7156
|
+
state: import_services19.Invitation.State.CANCELLED
|
|
7145
7157
|
});
|
|
7146
7158
|
await ctx.dispose();
|
|
7147
7159
|
},
|
|
@@ -7157,7 +7169,7 @@ var InvitationsManager = class {
|
|
|
7157
7169
|
};
|
|
7158
7170
|
}
|
|
7159
7171
|
async _persistIfRequired(handler, changeStream, invitation) {
|
|
7160
|
-
if (invitation.type ===
|
|
7172
|
+
if (invitation.type === import_services19.Invitation.Type.DELEGATED && invitation.delegationCredentialId == null) {
|
|
7161
7173
|
const delegationCredentialId = await handler.delegate(invitation);
|
|
7162
7174
|
changeStream.next({
|
|
7163
7175
|
...invitation,
|
|
@@ -7174,7 +7186,7 @@ var InvitationsManager = class {
|
|
|
7174
7186
|
} catch (err) {
|
|
7175
7187
|
import_log20.log.catch(err, void 0, {
|
|
7176
7188
|
F: __dxlog_file24,
|
|
7177
|
-
L:
|
|
7189
|
+
L: 320,
|
|
7178
7190
|
S: this,
|
|
7179
7191
|
C: (f, a) => f(...a)
|
|
7180
7192
|
});
|
|
@@ -7319,13 +7331,7 @@ var AGENT_STATUS_QUERY_RETRY_JITTER = 1e3;
|
|
|
7319
7331
|
var AGENT_FEED_ADDED_CHECK_INTERVAL_MS = 3e3;
|
|
7320
7332
|
var EdgeAgentManager = class extends import_context16.Resource {
|
|
7321
7333
|
constructor(_edgeFeatures, _edgeHttpClient, _dataSpaceManager, _identity) {
|
|
7322
|
-
super();
|
|
7323
|
-
this._edgeFeatures = _edgeFeatures;
|
|
7324
|
-
this._edgeHttpClient = _edgeHttpClient;
|
|
7325
|
-
this._dataSpaceManager = _dataSpaceManager;
|
|
7326
|
-
this._identity = _identity;
|
|
7327
|
-
this.agentStatusChanged = new import_async21.Event();
|
|
7328
|
-
this._lastKnownDeviceCount = 0;
|
|
7334
|
+
super(), this._edgeFeatures = _edgeFeatures, this._edgeHttpClient = _edgeHttpClient, this._dataSpaceManager = _dataSpaceManager, this._identity = _identity, this.agentStatusChanged = new import_async21.Event(), this._lastKnownDeviceCount = 0;
|
|
7329
7335
|
}
|
|
7330
7336
|
get agentStatus() {
|
|
7331
7337
|
return this._agentStatus;
|
|
@@ -7494,8 +7500,8 @@ var EdgeAgentManager = class extends import_context16.Resource {
|
|
|
7494
7500
|
continue;
|
|
7495
7501
|
}
|
|
7496
7502
|
if ([
|
|
7497
|
-
|
|
7498
|
-
|
|
7503
|
+
import_services20.SpaceState.SPACE_INACTIVE,
|
|
7504
|
+
import_services20.SpaceState.SPACE_CLOSED
|
|
7499
7505
|
].includes(space.state)) {
|
|
7500
7506
|
space.notarizationPlugin.setActiveEdgePollingEnabled(false);
|
|
7501
7507
|
continue;
|
|
@@ -7544,22 +7550,16 @@ var EdgeAgentServiceImpl = class {
|
|
|
7544
7550
|
this._agentManagerProvider = _agentManagerProvider;
|
|
7545
7551
|
this._edgeConnection = _edgeConnection;
|
|
7546
7552
|
}
|
|
7553
|
+
// TODO(mykola): Reconcile with NetworkService.queryStatus.
|
|
7547
7554
|
queryEdgeStatus() {
|
|
7548
7555
|
return new import_stream10.Stream(({ ctx, next }) => {
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
// TODO(wittjosiah): EdgeConnection should include a disconnected event as well.
|
|
7557
|
-
this._edgeConnection.onReconnected(() => {
|
|
7558
|
-
next({
|
|
7559
|
-
status: import_services20.QueryEdgeStatusResponse.EdgeStatus.CONNECTED
|
|
7560
|
-
});
|
|
7561
|
-
})
|
|
7562
|
-
);
|
|
7556
|
+
const update = () => {
|
|
7557
|
+
next({
|
|
7558
|
+
status: this._edgeConnection?.status ?? import_services21.EdgeStatus.NOT_CONNECTED
|
|
7559
|
+
});
|
|
7560
|
+
};
|
|
7561
|
+
this._edgeConnection?.statusChanged.on(ctx, update);
|
|
7562
|
+
update();
|
|
7563
7563
|
});
|
|
7564
7564
|
}
|
|
7565
7565
|
async createAgent() {
|
|
@@ -7568,7 +7568,7 @@ var EdgeAgentServiceImpl = class {
|
|
|
7568
7568
|
queryAgentStatus() {
|
|
7569
7569
|
return new import_stream10.Stream(({ ctx, next }) => {
|
|
7570
7570
|
next({
|
|
7571
|
-
status:
|
|
7571
|
+
status: import_services21.QueryAgentStatusResponse.AgentStatus.UNKNOWN
|
|
7572
7572
|
});
|
|
7573
7573
|
void this._agentManagerProvider().then((agentManager) => {
|
|
7574
7574
|
next({
|
|
@@ -7586,13 +7586,13 @@ var EdgeAgentServiceImpl = class {
|
|
|
7586
7586
|
var mapStatus = (agentStatus) => {
|
|
7587
7587
|
switch (agentStatus) {
|
|
7588
7588
|
case import_protocols17.EdgeAgentStatus.ACTIVE:
|
|
7589
|
-
return
|
|
7589
|
+
return import_services21.QueryAgentStatusResponse.AgentStatus.ACTIVE;
|
|
7590
7590
|
case import_protocols17.EdgeAgentStatus.INACTIVE:
|
|
7591
|
-
return
|
|
7591
|
+
return import_services21.QueryAgentStatusResponse.AgentStatus.INACTIVE;
|
|
7592
7592
|
case import_protocols17.EdgeAgentStatus.NOT_FOUND:
|
|
7593
|
-
return
|
|
7593
|
+
return import_services21.QueryAgentStatusResponse.AgentStatus.NOT_FOUND;
|
|
7594
7594
|
case void 0:
|
|
7595
|
-
return
|
|
7595
|
+
return import_services21.QueryAgentStatusResponse.AgentStatus.UNKNOWN;
|
|
7596
7596
|
}
|
|
7597
7597
|
};
|
|
7598
7598
|
var __dxlog_file27 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-recovery-manager.ts";
|
|
@@ -7607,7 +7607,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7607
7607
|
const identity = this._identityProvider();
|
|
7608
7608
|
(0, import_invariant24.invariant)(identity, void 0, {
|
|
7609
7609
|
F: __dxlog_file27,
|
|
7610
|
-
L:
|
|
7610
|
+
L: 39,
|
|
7611
7611
|
S: this,
|
|
7612
7612
|
A: [
|
|
7613
7613
|
"identity",
|
|
@@ -7658,7 +7658,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7658
7658
|
async requestRecoveryChallenge() {
|
|
7659
7659
|
(0, import_invariant24.invariant)(this._edgeClient, "Not connected to EDGE.", {
|
|
7660
7660
|
F: __dxlog_file27,
|
|
7661
|
-
L:
|
|
7661
|
+
L: 76,
|
|
7662
7662
|
S: this,
|
|
7663
7663
|
A: [
|
|
7664
7664
|
"this._edgeClient",
|
|
@@ -7688,7 +7688,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7688
7688
|
async recoverIdentityWithExternalSignature({ lookupKey, deviceKey, controlFeedKey, signature, clientDataJson, authenticatorData }) {
|
|
7689
7689
|
(0, import_invariant24.invariant)(this._edgeClient, "Not connected to EDGE.", {
|
|
7690
7690
|
F: __dxlog_file27,
|
|
7691
|
-
L:
|
|
7691
|
+
L: 108,
|
|
7692
7692
|
S: this,
|
|
7693
7693
|
A: [
|
|
7694
7694
|
"this._edgeClient",
|
|
@@ -7722,7 +7722,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7722
7722
|
async recoverIdentityWithToken({ token }) {
|
|
7723
7723
|
(0, import_invariant24.invariant)(this._edgeClient, "Not connected to EDGE.", {
|
|
7724
7724
|
F: __dxlog_file27,
|
|
7725
|
-
L:
|
|
7725
|
+
L: 141,
|
|
7726
7726
|
S: this,
|
|
7727
7727
|
A: [
|
|
7728
7728
|
"this._edgeClient",
|
|
@@ -7750,7 +7750,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7750
7750
|
async recoverIdentity({ recoveryCode }) {
|
|
7751
7751
|
(0, import_invariant24.invariant)(this._edgeClient, "Not connected to EDGE.", {
|
|
7752
7752
|
F: __dxlog_file27,
|
|
7753
|
-
L:
|
|
7753
|
+
L: 165,
|
|
7754
7754
|
S: this,
|
|
7755
7755
|
A: [
|
|
7756
7756
|
"this._edgeClient",
|
|
@@ -7781,7 +7781,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7781
7781
|
}
|
|
7782
7782
|
import_log24.log.info("recovering identity", response, {
|
|
7783
7783
|
F: __dxlog_file27,
|
|
7784
|
-
L:
|
|
7784
|
+
L: 191,
|
|
7785
7785
|
S: this,
|
|
7786
7786
|
C: (f, a) => f(...a)
|
|
7787
7787
|
});
|
|
@@ -7807,86 +7807,75 @@ function _ts_decorate10(decorators, target, key, desc) {
|
|
|
7807
7807
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7808
7808
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7809
7809
|
}
|
|
7810
|
-
function
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
a: isAwait
|
|
7841
|
-
});
|
|
7842
|
-
}
|
|
7843
|
-
return value;
|
|
7810
|
+
function _ts_add_disposable_resource4(env, value, async) {
|
|
7811
|
+
if (value !== null && value !== void 0) {
|
|
7812
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
7813
|
+
var dispose, inner;
|
|
7814
|
+
if (async) {
|
|
7815
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7816
|
+
dispose = value[Symbol.asyncDispose];
|
|
7817
|
+
}
|
|
7818
|
+
if (dispose === void 0) {
|
|
7819
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
7820
|
+
dispose = value[Symbol.dispose];
|
|
7821
|
+
if (async) inner = dispose;
|
|
7822
|
+
}
|
|
7823
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
7824
|
+
if (inner) dispose = function() {
|
|
7825
|
+
try {
|
|
7826
|
+
inner.call(this);
|
|
7827
|
+
} catch (e) {
|
|
7828
|
+
return Promise.reject(e);
|
|
7829
|
+
}
|
|
7830
|
+
};
|
|
7831
|
+
env.stack.push({
|
|
7832
|
+
value,
|
|
7833
|
+
dispose,
|
|
7834
|
+
async
|
|
7835
|
+
});
|
|
7836
|
+
} else if (async) {
|
|
7837
|
+
env.stack.push({
|
|
7838
|
+
async: true
|
|
7839
|
+
});
|
|
7844
7840
|
}
|
|
7845
|
-
return
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7841
|
+
return value;
|
|
7842
|
+
}
|
|
7843
|
+
function _ts_dispose_resources4(env) {
|
|
7844
|
+
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
7845
|
+
var e = new Error(message);
|
|
7846
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
7847
|
+
};
|
|
7848
|
+
return (_ts_dispose_resources4 = function _ts_dispose_resources5(env2) {
|
|
7849
|
+
function fail(e) {
|
|
7850
|
+
env2.error = env2.hasError ? new _SuppressedError(e, env2.error, "An error was suppressed during disposal.") : e;
|
|
7851
|
+
env2.hasError = true;
|
|
7852
|
+
}
|
|
7853
|
+
var r, s = 0;
|
|
7854
|
+
function next() {
|
|
7855
|
+
while (r = env2.stack.pop()) {
|
|
7856
|
+
try {
|
|
7857
|
+
if (!r.async && s === 1) return s = 0, env2.stack.push(r), Promise.resolve().then(next);
|
|
7858
|
+
if (r.dispose) {
|
|
7859
|
+
var result = r.dispose.call(r.value);
|
|
7860
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
|
|
7861
|
+
fail(e);
|
|
7862
|
+
return next();
|
|
7863
|
+
});
|
|
7864
|
+
} else s |= 1;
|
|
7865
|
+
} catch (e) {
|
|
7866
|
+
fail(e);
|
|
7861
7867
|
}
|
|
7862
|
-
if (error !== empty) throw error;
|
|
7863
7868
|
}
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
return next();
|
|
7867
|
-
}
|
|
7868
|
-
return next();
|
|
7869
|
+
if (s === 1) return env2.hasError ? Promise.reject(env2.error) : Promise.resolve();
|
|
7870
|
+
if (env2.hasError) throw env2.error;
|
|
7869
7871
|
}
|
|
7870
|
-
|
|
7872
|
+
return next();
|
|
7873
|
+
})(env);
|
|
7871
7874
|
}
|
|
7872
7875
|
var __dxlog_file28 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
7873
7876
|
var ServiceContext = class extends import_context17.Resource {
|
|
7874
7877
|
constructor(storage, level, networkManager, signalManager, _edgeConnection, _edgeHttpClient, _runtimeParams, _edgeFeatures) {
|
|
7875
|
-
super();
|
|
7876
|
-
this.storage = storage;
|
|
7877
|
-
this.level = level;
|
|
7878
|
-
this.networkManager = networkManager;
|
|
7879
|
-
this.signalManager = signalManager;
|
|
7880
|
-
this._edgeConnection = _edgeConnection;
|
|
7881
|
-
this._edgeHttpClient = _edgeHttpClient;
|
|
7882
|
-
this._runtimeParams = _runtimeParams;
|
|
7883
|
-
this._edgeFeatures = _edgeFeatures;
|
|
7884
|
-
this._edgeIdentityUpdateMutex = new import_async22.Mutex();
|
|
7885
|
-
this.initialized = new import_async22.Trigger();
|
|
7886
|
-
this._meshReplicator = void 0;
|
|
7887
|
-
this._echoEdgeReplicator = void 0;
|
|
7888
|
-
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
7889
|
-
this._instanceId = import_keys17.PublicKey.random().toHex();
|
|
7878
|
+
super(), this.storage = storage, this.level = level, this.networkManager = networkManager, this.signalManager = signalManager, this._edgeConnection = _edgeConnection, this._edgeHttpClient = _edgeHttpClient, this._runtimeParams = _runtimeParams, this._edgeFeatures = _edgeFeatures, this._edgeIdentityUpdateMutex = new import_async22.Mutex(), this.initialized = new import_async22.Trigger(), this._meshReplicator = void 0, this._echoEdgeReplicator = void 0, this._handlerFactories = /* @__PURE__ */ new Map(), this._instanceId = import_keys17.PublicKey.random().toHex();
|
|
7890
7879
|
this.metadataStore = new import_echo_pipeline4.MetadataStore(storage.createDirectory("metadata"));
|
|
7891
7880
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
7892
7881
|
this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
|
|
@@ -7921,12 +7910,15 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
7921
7910
|
this.echoHost = new import_echo_pipeline4.EchoHost({
|
|
7922
7911
|
kv: this.level,
|
|
7923
7912
|
peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex(),
|
|
7924
|
-
getSpaceKeyByRootDocumentId: (documentId) => this.spaceManager.findSpaceByRootDocumentId(documentId)?.key
|
|
7913
|
+
getSpaceKeyByRootDocumentId: (documentId) => this.spaceManager.findSpaceByRootDocumentId(documentId)?.key,
|
|
7914
|
+
indexing: {
|
|
7915
|
+
vector: this._runtimeParams?.enableVectorIndexing
|
|
7916
|
+
}
|
|
7925
7917
|
});
|
|
7926
7918
|
this._meshReplicator = new import_echo_pipeline4.MeshEchoReplicator();
|
|
7927
7919
|
this.invitations = new InvitationsHandler(this.networkManager, this._edgeHttpClient, _runtimeParams?.invitationConnectionDefaultParams);
|
|
7928
7920
|
this.invitationsManager = new InvitationsManager(this.invitations, (invitation) => this.getInvitationHandler(invitation), this.metadataStore);
|
|
7929
|
-
this._handlerFactories.set(
|
|
7921
|
+
this._handlerFactories.set(import_services22.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug5.failUndefined)(), this._acceptIdentity.bind(this)));
|
|
7930
7922
|
if (!this._runtimeParams?.disableP2pReplication) {
|
|
7931
7923
|
this._meshReplicator = new import_echo_pipeline4.MeshEchoReplicator();
|
|
7932
7924
|
}
|
|
@@ -7940,7 +7932,7 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
7940
7932
|
await this._checkStorageVersion();
|
|
7941
7933
|
(0, import_log23.log)("opening...", void 0, {
|
|
7942
7934
|
F: __dxlog_file28,
|
|
7943
|
-
L:
|
|
7935
|
+
L: 203,
|
|
7944
7936
|
S: this,
|
|
7945
7937
|
C: (f, a) => f(...a)
|
|
7946
7938
|
});
|
|
@@ -7948,7 +7940,7 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
7948
7940
|
id: this._instanceId
|
|
7949
7941
|
}), {
|
|
7950
7942
|
F: __dxlog_file28,
|
|
7951
|
-
L:
|
|
7943
|
+
L: 204,
|
|
7952
7944
|
S: this,
|
|
7953
7945
|
C: (f, a) => f(...a)
|
|
7954
7946
|
});
|
|
@@ -7975,7 +7967,7 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
7975
7967
|
count: loadedInvitations.invitations?.length
|
|
7976
7968
|
}, {
|
|
7977
7969
|
F: __dxlog_file28,
|
|
7978
|
-
L:
|
|
7970
|
+
L: 232,
|
|
7979
7971
|
S: this,
|
|
7980
7972
|
C: (f, a) => f(...a)
|
|
7981
7973
|
});
|
|
@@ -7983,13 +7975,13 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
7983
7975
|
id: this._instanceId
|
|
7984
7976
|
}), {
|
|
7985
7977
|
F: __dxlog_file28,
|
|
7986
|
-
L:
|
|
7978
|
+
L: 234,
|
|
7987
7979
|
S: this,
|
|
7988
7980
|
C: (f, a) => f(...a)
|
|
7989
7981
|
});
|
|
7990
7982
|
(0, import_log23.log)("opened", void 0, {
|
|
7991
7983
|
F: __dxlog_file28,
|
|
7992
|
-
L:
|
|
7984
|
+
L: 235,
|
|
7993
7985
|
S: this,
|
|
7994
7986
|
C: (f, a) => f(...a)
|
|
7995
7987
|
});
|
|
@@ -7997,7 +7989,7 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
7997
7989
|
async _close(ctx) {
|
|
7998
7990
|
(0, import_log23.log)("closing...", void 0, {
|
|
7999
7991
|
F: __dxlog_file28,
|
|
8000
|
-
L:
|
|
7992
|
+
L: 239,
|
|
8001
7993
|
S: this,
|
|
8002
7994
|
C: (f, a) => f(...a)
|
|
8003
7995
|
});
|
|
@@ -8016,7 +8008,7 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
8016
8008
|
await this._edgeConnection?.close();
|
|
8017
8009
|
(0, import_log23.log)("closed", void 0, {
|
|
8018
8010
|
F: __dxlog_file28,
|
|
8019
|
-
L:
|
|
8011
|
+
L: 255,
|
|
8020
8012
|
S: this,
|
|
8021
8013
|
C: (f, a) => f(...a)
|
|
8022
8014
|
});
|
|
@@ -8027,18 +8019,18 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
8027
8019
|
await identity.joinNetwork();
|
|
8028
8020
|
await this._initialize(new import_context17.Context(void 0, {
|
|
8029
8021
|
F: __dxlog_file28,
|
|
8030
|
-
L:
|
|
8022
|
+
L: 262
|
|
8031
8023
|
}));
|
|
8032
8024
|
return identity;
|
|
8033
8025
|
}
|
|
8034
8026
|
getInvitationHandler(invitation) {
|
|
8035
|
-
if (this.identityManager.identity == null && invitation.kind ===
|
|
8027
|
+
if (this.identityManager.identity == null && invitation.kind === import_services22.Invitation.Kind.SPACE) {
|
|
8036
8028
|
throw new Error("Identity must be created before joining a space.");
|
|
8037
8029
|
}
|
|
8038
8030
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
8039
8031
|
(0, import_invariant23.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
8040
8032
|
F: __dxlog_file28,
|
|
8041
|
-
L:
|
|
8033
|
+
L: 271,
|
|
8042
8034
|
S: this,
|
|
8043
8035
|
A: [
|
|
8044
8036
|
"factory",
|
|
@@ -8064,7 +8056,7 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
8064
8056
|
await this.identityManager.acceptIdentity(identity, identityRecord, params.deviceProfile);
|
|
8065
8057
|
await this._initialize(new import_context17.Context(void 0, {
|
|
8066
8058
|
F: __dxlog_file28,
|
|
8067
|
-
L:
|
|
8059
|
+
L: 290
|
|
8068
8060
|
}));
|
|
8069
8061
|
return identity;
|
|
8070
8062
|
}
|
|
@@ -8078,7 +8070,7 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
8078
8070
|
async _initialize(ctx) {
|
|
8079
8071
|
(0, import_log23.log)("initializing spaces...", void 0, {
|
|
8080
8072
|
F: __dxlog_file28,
|
|
8081
|
-
L:
|
|
8073
|
+
L: 305,
|
|
8082
8074
|
S: this,
|
|
8083
8075
|
C: (f, a) => f(...a)
|
|
8084
8076
|
});
|
|
@@ -8114,10 +8106,10 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
8114
8106
|
await this.dataSpaceManager.open();
|
|
8115
8107
|
this.edgeAgentManager = new EdgeAgentManager(this._edgeFeatures, this._edgeHttpClient, this.dataSpaceManager, identity);
|
|
8116
8108
|
await this.edgeAgentManager.open();
|
|
8117
|
-
this._handlerFactories.set(
|
|
8109
|
+
this._handlerFactories.set(import_services22.Invitation.Kind.SPACE, (invitation) => {
|
|
8118
8110
|
(0, import_invariant23.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
8119
8111
|
F: __dxlog_file28,
|
|
8120
|
-
L:
|
|
8112
|
+
L: 343,
|
|
8121
8113
|
S: this,
|
|
8122
8114
|
A: [
|
|
8123
8115
|
"this.dataSpaceManager",
|
|
@@ -8141,7 +8133,7 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
8141
8133
|
details: assertion
|
|
8142
8134
|
}, {
|
|
8143
8135
|
F: __dxlog_file28,
|
|
8144
|
-
L:
|
|
8136
|
+
L: 359,
|
|
8145
8137
|
S: this,
|
|
8146
8138
|
C: (f, a) => f(...a)
|
|
8147
8139
|
});
|
|
@@ -8152,7 +8144,7 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
8152
8144
|
details: assertion
|
|
8153
8145
|
}, {
|
|
8154
8146
|
F: __dxlog_file28,
|
|
8155
|
-
L:
|
|
8147
|
+
L: 363,
|
|
8156
8148
|
S: this,
|
|
8157
8149
|
C: (f, a) => f(...a)
|
|
8158
8150
|
});
|
|
@@ -8163,7 +8155,7 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
8163
8155
|
details: assertion
|
|
8164
8156
|
}, {
|
|
8165
8157
|
F: __dxlog_file28,
|
|
8166
|
-
L:
|
|
8158
|
+
L: 368,
|
|
8167
8159
|
S: this,
|
|
8168
8160
|
C: (f, a) => f(...a)
|
|
8169
8161
|
});
|
|
@@ -8174,7 +8166,7 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
8174
8166
|
} catch (err) {
|
|
8175
8167
|
import_log23.log.catch(err, void 0, {
|
|
8176
8168
|
F: __dxlog_file28,
|
|
8177
|
-
L:
|
|
8169
|
+
L: 374,
|
|
8178
8170
|
S: this,
|
|
8179
8171
|
C: (f, a) => f(...a)
|
|
8180
8172
|
});
|
|
@@ -8184,9 +8176,13 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
8184
8176
|
await identity.space.spaceState.addCredentialProcessor(this._deviceSpaceSync);
|
|
8185
8177
|
}
|
|
8186
8178
|
async _setNetworkIdentity(params) {
|
|
8179
|
+
const env = {
|
|
8180
|
+
stack: [],
|
|
8181
|
+
error: void 0,
|
|
8182
|
+
hasError: false
|
|
8183
|
+
};
|
|
8187
8184
|
try {
|
|
8188
|
-
|
|
8189
|
-
const _ = _usingCtx.u(await this._edgeIdentityUpdateMutex.acquire());
|
|
8185
|
+
const _ = _ts_add_disposable_resource4(env, await this._edgeIdentityUpdateMutex.acquire(), false);
|
|
8190
8186
|
let edgeIdentity;
|
|
8191
8187
|
const identity = this.identityManager.identity;
|
|
8192
8188
|
if (identity) {
|
|
@@ -8195,7 +8191,7 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
8195
8191
|
swarms: this.networkManager.topics
|
|
8196
8192
|
}, {
|
|
8197
8193
|
F: __dxlog_file28,
|
|
8198
|
-
L:
|
|
8194
|
+
L: 388,
|
|
8199
8195
|
S: this,
|
|
8200
8196
|
C: (f, a) => f(...a)
|
|
8201
8197
|
});
|
|
@@ -8209,7 +8205,7 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
8209
8205
|
});
|
|
8210
8206
|
(0, import_invariant23.invariant)(identity.deviceCredentialChain, void 0, {
|
|
8211
8207
|
F: __dxlog_file28,
|
|
8212
|
-
L:
|
|
8208
|
+
L: 407,
|
|
8213
8209
|
S: this,
|
|
8214
8210
|
A: [
|
|
8215
8211
|
"identity.deviceCredentialChain",
|
|
@@ -8227,10 +8223,11 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
8227
8223
|
identityKey: edgeIdentity.identityKey,
|
|
8228
8224
|
peerKey: edgeIdentity.peerKey
|
|
8229
8225
|
});
|
|
8230
|
-
} catch (
|
|
8231
|
-
|
|
8226
|
+
} catch (e) {
|
|
8227
|
+
env.error = e;
|
|
8228
|
+
env.hasError = true;
|
|
8232
8229
|
} finally {
|
|
8233
|
-
|
|
8230
|
+
_ts_dispose_resources4(env);
|
|
8234
8231
|
}
|
|
8235
8232
|
}
|
|
8236
8233
|
};
|
|
@@ -8340,7 +8337,7 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
8340
8337
|
count: files.length
|
|
8341
8338
|
}, {
|
|
8342
8339
|
F: __dxlog_file29,
|
|
8343
|
-
L:
|
|
8340
|
+
L: 31,
|
|
8344
8341
|
S: void 0,
|
|
8345
8342
|
C: (f, a) => f(...a)
|
|
8346
8343
|
});
|
|
@@ -8358,7 +8355,7 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
8358
8355
|
count: files.length
|
|
8359
8356
|
}, {
|
|
8360
8357
|
F: __dxlog_file29,
|
|
8361
|
-
L:
|
|
8358
|
+
L: 42,
|
|
8362
8359
|
S: void 0,
|
|
8363
8360
|
C: (f, a) => f(...a)
|
|
8364
8361
|
});
|
|
@@ -8366,7 +8363,7 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
8366
8363
|
{
|
|
8367
8364
|
import_log25.log.info("begin exporting kv pairs", void 0, {
|
|
8368
8365
|
F: __dxlog_file29,
|
|
8369
|
-
L:
|
|
8366
|
+
L: 46,
|
|
8370
8367
|
S: void 0,
|
|
8371
8368
|
C: (f, a) => f(...a)
|
|
8372
8369
|
});
|
|
@@ -8387,7 +8384,7 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
8387
8384
|
count
|
|
8388
8385
|
}, {
|
|
8389
8386
|
F: __dxlog_file29,
|
|
8390
|
-
L:
|
|
8387
|
+
L: 57,
|
|
8391
8388
|
S: void 0,
|
|
8392
8389
|
C: (f, a) => f(...a)
|
|
8393
8390
|
});
|
|
@@ -8403,7 +8400,7 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
8403
8400
|
const directory = await storage.createDirectory();
|
|
8404
8401
|
(0, import_invariant25.invariant)(typeof entry2.key === "string", "Invalid key type", {
|
|
8405
8402
|
F: __dxlog_file29,
|
|
8406
|
-
L:
|
|
8403
|
+
L: 80,
|
|
8407
8404
|
S: void 0,
|
|
8408
8405
|
A: [
|
|
8409
8406
|
"typeof entry.key === 'string'",
|
|
@@ -8413,7 +8410,7 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
8413
8410
|
const file = await directory.getOrCreateFile(entry2.key);
|
|
8414
8411
|
(0, import_invariant25.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
8415
8412
|
F: __dxlog_file29,
|
|
8416
|
-
L:
|
|
8413
|
+
L: 82,
|
|
8417
8414
|
S: void 0,
|
|
8418
8415
|
A: [
|
|
8419
8416
|
"entry.value instanceof Uint8Array",
|
|
@@ -8427,7 +8424,7 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
8427
8424
|
case import_protocols21.ProfileArchiveEntryType.KEY_VALUE: {
|
|
8428
8425
|
(0, import_invariant25.invariant)(entry2.key instanceof Uint8Array, "Invalid key type", {
|
|
8429
8426
|
F: __dxlog_file29,
|
|
8430
|
-
L:
|
|
8427
|
+
L: 88,
|
|
8431
8428
|
S: void 0,
|
|
8432
8429
|
A: [
|
|
8433
8430
|
"entry.key instanceof Uint8Array",
|
|
@@ -8436,7 +8433,7 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
8436
8433
|
});
|
|
8437
8434
|
(0, import_invariant25.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
8438
8435
|
F: __dxlog_file29,
|
|
8439
|
-
L:
|
|
8436
|
+
L: 89,
|
|
8440
8437
|
S: void 0,
|
|
8441
8438
|
A: [
|
|
8442
8439
|
"entry.value instanceof Uint8Array",
|
|
@@ -8461,7 +8458,7 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
8461
8458
|
progress: `${(count / archive.storage.length * 100).toFixed()}%`
|
|
8462
8459
|
}, {
|
|
8463
8460
|
F: __dxlog_file29,
|
|
8464
|
-
L:
|
|
8461
|
+
L: 102,
|
|
8465
8462
|
S: void 0,
|
|
8466
8463
|
C: (f, a) => f(...a)
|
|
8467
8464
|
});
|
|
@@ -8469,7 +8466,7 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
8469
8466
|
}
|
|
8470
8467
|
import_log25.log.info("committing changes..", void 0, {
|
|
8471
8468
|
F: __dxlog_file29,
|
|
8472
|
-
L:
|
|
8469
|
+
L: 110,
|
|
8473
8470
|
S: void 0,
|
|
8474
8471
|
C: (f, a) => f(...a)
|
|
8475
8472
|
});
|
|
@@ -8495,7 +8492,7 @@ var DevicesServiceImpl = class {
|
|
|
8495
8492
|
} else {
|
|
8496
8493
|
(0, import_invariant27.invariant)(this._identityManager.identity?.presence, "presence not present", {
|
|
8497
8494
|
F: __dxlog_file30,
|
|
8498
|
-
L:
|
|
8495
|
+
L: 37,
|
|
8499
8496
|
S: this,
|
|
8500
8497
|
A: [
|
|
8501
8498
|
"this._identityManager.identity?.presence",
|
|
@@ -8508,15 +8505,15 @@ var DevicesServiceImpl = class {
|
|
|
8508
8505
|
const isMe = this._identityManager.identity?.deviceKey.equals(key);
|
|
8509
8506
|
let presence;
|
|
8510
8507
|
if (isMe) {
|
|
8511
|
-
presence =
|
|
8508
|
+
presence = import_services24.Device.PresenceState.ONLINE;
|
|
8512
8509
|
} else if (profile.os?.toUpperCase() === "EDGE") {
|
|
8513
|
-
presence = this._edgeConnection?.
|
|
8510
|
+
presence = this._edgeConnection?.status === import_services24.EdgeStatus.CONNECTED ? import_services24.Device.PresenceState.ONLINE : import_services24.Device.PresenceState.OFFLINE;
|
|
8514
8511
|
} else {
|
|
8515
|
-
presence = peers.some((peer) => peer.identityKey.equals(key)) ?
|
|
8512
|
+
presence = peers.some((peer) => peer.identityKey.equals(key)) ? import_services24.Device.PresenceState.ONLINE : import_services24.Device.PresenceState.OFFLINE;
|
|
8516
8513
|
}
|
|
8517
8514
|
return {
|
|
8518
8515
|
deviceKey: key,
|
|
8519
|
-
kind: this._identityManager.identity?.deviceKey.equals(key) ?
|
|
8516
|
+
kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services24.DeviceKind.CURRENT : import_services24.DeviceKind.TRUSTED,
|
|
8520
8517
|
profile,
|
|
8521
8518
|
presence
|
|
8522
8519
|
};
|
|
@@ -8737,28 +8734,29 @@ var LoggingServiceImpl = class {
|
|
|
8737
8734
|
};
|
|
8738
8735
|
var matchFilter = (filter, level, path2, options) => {
|
|
8739
8736
|
switch (options) {
|
|
8740
|
-
case
|
|
8737
|
+
case import_services25.QueryLogsRequest.MatchingOptions.INCLUSIVE:
|
|
8741
8738
|
return level >= filter.level && (!filter.pattern || path2.includes(filter.pattern));
|
|
8742
|
-
case
|
|
8739
|
+
case import_services25.QueryLogsRequest.MatchingOptions.EXPLICIT:
|
|
8743
8740
|
return level === filter.level && (!filter.pattern || path2.includes(filter.pattern));
|
|
8744
8741
|
}
|
|
8745
8742
|
};
|
|
8746
8743
|
var shouldLog = (entry2, request) => {
|
|
8747
|
-
const options = request.options ??
|
|
8744
|
+
const options = request.options ?? import_services25.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
8748
8745
|
if (request.filters === void 0) {
|
|
8749
|
-
return options ===
|
|
8746
|
+
return options === import_services25.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
8750
8747
|
} else {
|
|
8751
8748
|
return request.filters.some((filter) => matchFilter(filter, entry2.level, entry2.meta?.F ?? "", options));
|
|
8752
8749
|
}
|
|
8753
8750
|
};
|
|
8754
8751
|
var LOG_PROCESSING = 0;
|
|
8755
8752
|
var NetworkServiceImpl = class {
|
|
8756
|
-
constructor(networkManager, signalManager) {
|
|
8753
|
+
constructor(networkManager, signalManager, edgeConnection) {
|
|
8757
8754
|
this.networkManager = networkManager;
|
|
8758
8755
|
this.signalManager = signalManager;
|
|
8756
|
+
this.edgeConnection = edgeConnection;
|
|
8759
8757
|
}
|
|
8760
8758
|
queryStatus() {
|
|
8761
|
-
return new import_stream14.Stream(({ next }) => {
|
|
8759
|
+
return new import_stream14.Stream(({ ctx, next }) => {
|
|
8762
8760
|
const update = () => {
|
|
8763
8761
|
next({
|
|
8764
8762
|
swarm: this.networkManager.connectionState,
|
|
@@ -8769,13 +8767,9 @@ var NetworkServiceImpl = class {
|
|
|
8769
8767
|
}))
|
|
8770
8768
|
});
|
|
8771
8769
|
};
|
|
8772
|
-
|
|
8773
|
-
|
|
8770
|
+
this.networkManager.connectionStateChanged.on(ctx, () => update());
|
|
8771
|
+
this.signalManager.statusChanged?.on(ctx, () => update());
|
|
8774
8772
|
update();
|
|
8775
|
-
return () => {
|
|
8776
|
-
unsubscribeSwarm();
|
|
8777
|
-
unsubscribeSignal?.();
|
|
8778
|
-
};
|
|
8779
8773
|
});
|
|
8780
8774
|
}
|
|
8781
8775
|
async updateConfig(request) {
|
|
@@ -8791,26 +8785,24 @@ var NetworkServiceImpl = class {
|
|
|
8791
8785
|
return this.signalManager.query(request);
|
|
8792
8786
|
}
|
|
8793
8787
|
subscribeSwarmState(request) {
|
|
8794
|
-
return new import_stream14.Stream(({ next }) => {
|
|
8795
|
-
|
|
8788
|
+
return new import_stream14.Stream(({ ctx, next }) => {
|
|
8789
|
+
this.signalManager.swarmState?.on(ctx, (state) => {
|
|
8796
8790
|
if (request.topic.equals(state.swarmKey)) {
|
|
8797
8791
|
next(state);
|
|
8798
8792
|
}
|
|
8799
8793
|
});
|
|
8800
|
-
return unsubscribe;
|
|
8801
8794
|
});
|
|
8802
8795
|
}
|
|
8803
8796
|
async sendMessage(message) {
|
|
8804
8797
|
return this.signalManager.sendMessage(message);
|
|
8805
8798
|
}
|
|
8806
8799
|
subscribeMessages(peer) {
|
|
8807
|
-
return new import_stream14.Stream(({ next }) => {
|
|
8808
|
-
|
|
8800
|
+
return new import_stream14.Stream(({ ctx, next }) => {
|
|
8801
|
+
this.signalManager.onMessage.on(ctx, (message) => {
|
|
8809
8802
|
if (message.recipient.peerKey === peer.peerKey) {
|
|
8810
8803
|
next(message);
|
|
8811
8804
|
}
|
|
8812
8805
|
});
|
|
8813
|
-
return unsubscribe;
|
|
8814
8806
|
});
|
|
8815
8807
|
}
|
|
8816
8808
|
};
|
|
@@ -8834,8 +8826,8 @@ var SystemServiceImpl = class {
|
|
|
8834
8826
|
return {
|
|
8835
8827
|
timestamp: /* @__PURE__ */ new Date(),
|
|
8836
8828
|
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util17.jsonKeyReplacer)({
|
|
8837
|
-
truncate: keys ===
|
|
8838
|
-
humanize: keys ===
|
|
8829
|
+
truncate: keys === import_services26.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
|
|
8830
|
+
humanize: keys === import_services26.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
|
|
8839
8831
|
})))
|
|
8840
8832
|
};
|
|
8841
8833
|
}
|
|
@@ -8899,6 +8891,9 @@ var ClientServicesHost = class {
|
|
|
8899
8891
|
if (this._runtimeParams.disableP2pReplication === void 0) {
|
|
8900
8892
|
this._runtimeParams.disableP2pReplication = config?.get("runtime.client.disableP2pReplication", false);
|
|
8901
8893
|
}
|
|
8894
|
+
if (this._runtimeParams.enableVectorIndexing === void 0) {
|
|
8895
|
+
this._runtimeParams.enableVectorIndexing = config?.get("runtime.client.enableVectorIndexing", false);
|
|
8896
|
+
}
|
|
8902
8897
|
if (config) {
|
|
8903
8898
|
this.initialize({
|
|
8904
8899
|
config,
|
|
@@ -8913,7 +8908,7 @@ var ClientServicesHost = class {
|
|
|
8913
8908
|
if (!this._opening) {
|
|
8914
8909
|
void this.open(new import_context18.Context(void 0, {
|
|
8915
8910
|
F: __dxlog_file31,
|
|
8916
|
-
L:
|
|
8911
|
+
L: 141
|
|
8917
8912
|
}));
|
|
8918
8913
|
}
|
|
8919
8914
|
},
|
|
@@ -8923,14 +8918,14 @@ var ClientServicesHost = class {
|
|
|
8923
8918
|
this._systemService = new SystemServiceImpl({
|
|
8924
8919
|
config: () => this._config,
|
|
8925
8920
|
statusUpdate: this._statusUpdate,
|
|
8926
|
-
getCurrentStatus: () => this.isOpen && !this._resetting ?
|
|
8921
|
+
getCurrentStatus: () => this.isOpen && !this._resetting ? import_services23.SystemStatus.ACTIVE : import_services23.SystemStatus.INACTIVE,
|
|
8927
8922
|
getDiagnostics: () => {
|
|
8928
8923
|
return createDiagnostics(this._serviceRegistry.services, this._serviceContext, this._config);
|
|
8929
8924
|
},
|
|
8930
8925
|
onUpdateStatus: async (status) => {
|
|
8931
|
-
if (!this.isOpen && status ===
|
|
8926
|
+
if (!this.isOpen && status === import_services23.SystemStatus.ACTIVE) {
|
|
8932
8927
|
await this._resourceLock?.acquire();
|
|
8933
|
-
} else if (this.isOpen && status ===
|
|
8928
|
+
} else if (this.isOpen && status === import_services23.SystemStatus.INACTIVE) {
|
|
8934
8929
|
await this._resourceLock?.release();
|
|
8935
8930
|
}
|
|
8936
8931
|
},
|
|
@@ -8971,7 +8966,7 @@ var ClientServicesHost = class {
|
|
|
8971
8966
|
initialize({ config, ...options }) {
|
|
8972
8967
|
(0, import_invariant26.invariant)(!this._open, "service host is open", {
|
|
8973
8968
|
F: __dxlog_file31,
|
|
8974
|
-
L:
|
|
8969
|
+
L: 207,
|
|
8975
8970
|
S: this,
|
|
8976
8971
|
A: [
|
|
8977
8972
|
"!this._open",
|
|
@@ -8980,14 +8975,14 @@ var ClientServicesHost = class {
|
|
|
8980
8975
|
});
|
|
8981
8976
|
(0, import_log26.log)("initializing...", void 0, {
|
|
8982
8977
|
F: __dxlog_file31,
|
|
8983
|
-
L:
|
|
8978
|
+
L: 208,
|
|
8984
8979
|
S: this,
|
|
8985
8980
|
C: (f, a) => f(...a)
|
|
8986
8981
|
});
|
|
8987
8982
|
if (config) {
|
|
8988
8983
|
(0, import_invariant26.invariant)(!this._config, "config already set", {
|
|
8989
8984
|
F: __dxlog_file31,
|
|
8990
|
-
L:
|
|
8985
|
+
L: 211,
|
|
8991
8986
|
S: this,
|
|
8992
8987
|
A: [
|
|
8993
8988
|
"!this._config",
|
|
@@ -9002,7 +8997,7 @@ var ClientServicesHost = class {
|
|
|
9002
8997
|
if (!options.signalManager) {
|
|
9003
8998
|
import_log26.log.warn("running signaling without telemetry metadata.", void 0, {
|
|
9004
8999
|
F: __dxlog_file31,
|
|
9005
|
-
L:
|
|
9000
|
+
L: 219,
|
|
9006
9001
|
S: this,
|
|
9007
9002
|
C: (f, a) => f(...a)
|
|
9008
9003
|
});
|
|
@@ -9022,7 +9017,7 @@ var ClientServicesHost = class {
|
|
|
9022
9017
|
this._signalManager = signalManager;
|
|
9023
9018
|
(0, import_invariant26.invariant)(!this._networkManager, "network manager already set", {
|
|
9024
9019
|
F: __dxlog_file31,
|
|
9025
|
-
L:
|
|
9020
|
+
L: 241,
|
|
9026
9021
|
S: this,
|
|
9027
9022
|
A: [
|
|
9028
9023
|
"!this._networkManager",
|
|
@@ -9040,7 +9035,7 @@ var ClientServicesHost = class {
|
|
|
9040
9035
|
});
|
|
9041
9036
|
(0, import_log26.log)("initialized", void 0, {
|
|
9042
9037
|
F: __dxlog_file31,
|
|
9043
|
-
L:
|
|
9038
|
+
L: 254,
|
|
9044
9039
|
S: this,
|
|
9045
9040
|
C: (f, a) => f(...a)
|
|
9046
9041
|
});
|
|
@@ -9054,13 +9049,13 @@ var ClientServicesHost = class {
|
|
|
9054
9049
|
id: traceId
|
|
9055
9050
|
}), {
|
|
9056
9051
|
F: __dxlog_file31,
|
|
9057
|
-
L:
|
|
9052
|
+
L: 265,
|
|
9058
9053
|
S: this,
|
|
9059
9054
|
C: (f, a) => f(...a)
|
|
9060
9055
|
});
|
|
9061
9056
|
(0, import_invariant26.invariant)(this._config, "config not set", {
|
|
9062
9057
|
F: __dxlog_file31,
|
|
9063
|
-
L:
|
|
9058
|
+
L: 267,
|
|
9064
9059
|
S: this,
|
|
9065
9060
|
A: [
|
|
9066
9061
|
"this._config",
|
|
@@ -9069,7 +9064,7 @@ var ClientServicesHost = class {
|
|
|
9069
9064
|
});
|
|
9070
9065
|
(0, import_invariant26.invariant)(this._storage, "storage not set", {
|
|
9071
9066
|
F: __dxlog_file31,
|
|
9072
|
-
L:
|
|
9067
|
+
L: 268,
|
|
9073
9068
|
S: this,
|
|
9074
9069
|
A: [
|
|
9075
9070
|
"this._storage",
|
|
@@ -9078,7 +9073,7 @@ var ClientServicesHost = class {
|
|
|
9078
9073
|
});
|
|
9079
9074
|
(0, import_invariant26.invariant)(this._signalManager, "signal manager not set", {
|
|
9080
9075
|
F: __dxlog_file31,
|
|
9081
|
-
L:
|
|
9076
|
+
L: 269,
|
|
9082
9077
|
S: this,
|
|
9083
9078
|
A: [
|
|
9084
9079
|
"this._signalManager",
|
|
@@ -9087,7 +9082,7 @@ var ClientServicesHost = class {
|
|
|
9087
9082
|
});
|
|
9088
9083
|
(0, import_invariant26.invariant)(this._networkManager, "network manager not set", {
|
|
9089
9084
|
F: __dxlog_file31,
|
|
9090
|
-
L:
|
|
9085
|
+
L: 270,
|
|
9091
9086
|
S: this,
|
|
9092
9087
|
A: [
|
|
9093
9088
|
"this._networkManager",
|
|
@@ -9099,7 +9094,7 @@ var ClientServicesHost = class {
|
|
|
9099
9094
|
lockKey: this._resourceLock?.lockKey
|
|
9100
9095
|
}, {
|
|
9101
9096
|
F: __dxlog_file31,
|
|
9102
|
-
L:
|
|
9097
|
+
L: 273,
|
|
9103
9098
|
S: this,
|
|
9104
9099
|
C: (f, a) => f(...a)
|
|
9105
9100
|
});
|
|
@@ -9128,7 +9123,7 @@ var ClientServicesHost = class {
|
|
|
9128
9123
|
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
9129
9124
|
DataService: this._serviceContext.echoHost.dataService,
|
|
9130
9125
|
QueryService: this._serviceContext.echoHost.queryService,
|
|
9131
|
-
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
|
|
9126
|
+
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager, this._edgeConnection),
|
|
9132
9127
|
LoggingService: this._loggingService,
|
|
9133
9128
|
TracingService: this._tracingService,
|
|
9134
9129
|
// TODO(burdon): Move to new protobuf definitions.
|
|
@@ -9160,7 +9155,7 @@ var ClientServicesHost = class {
|
|
|
9160
9155
|
deviceKey
|
|
9161
9156
|
}, {
|
|
9162
9157
|
F: __dxlog_file31,
|
|
9163
|
-
L:
|
|
9158
|
+
L: 374,
|
|
9164
9159
|
S: this,
|
|
9165
9160
|
C: (f, a) => f(...a)
|
|
9166
9161
|
});
|
|
@@ -9168,7 +9163,7 @@ var ClientServicesHost = class {
|
|
|
9168
9163
|
id: traceId
|
|
9169
9164
|
}), {
|
|
9170
9165
|
F: __dxlog_file31,
|
|
9171
|
-
L:
|
|
9166
|
+
L: 375,
|
|
9172
9167
|
S: this,
|
|
9173
9168
|
C: (f, a) => f(...a)
|
|
9174
9169
|
});
|
|
@@ -9182,7 +9177,7 @@ var ClientServicesHost = class {
|
|
|
9182
9177
|
deviceKey
|
|
9183
9178
|
}, {
|
|
9184
9179
|
F: __dxlog_file31,
|
|
9185
|
-
L:
|
|
9180
|
+
L: 386,
|
|
9186
9181
|
S: this,
|
|
9187
9182
|
C: (f, a) => f(...a)
|
|
9188
9183
|
});
|
|
@@ -9200,7 +9195,7 @@ var ClientServicesHost = class {
|
|
|
9200
9195
|
deviceKey
|
|
9201
9196
|
}, {
|
|
9202
9197
|
F: __dxlog_file31,
|
|
9203
|
-
L:
|
|
9198
|
+
L: 395,
|
|
9204
9199
|
S: this,
|
|
9205
9200
|
C: (f, a) => f(...a)
|
|
9206
9201
|
});
|
|
@@ -9211,13 +9206,13 @@ var ClientServicesHost = class {
|
|
|
9211
9206
|
id: traceId
|
|
9212
9207
|
}), {
|
|
9213
9208
|
F: __dxlog_file31,
|
|
9214
|
-
L:
|
|
9209
|
+
L: 400,
|
|
9215
9210
|
S: this,
|
|
9216
9211
|
C: (f, a) => f(...a)
|
|
9217
9212
|
});
|
|
9218
9213
|
import_log26.log.info("resetting...", void 0, {
|
|
9219
9214
|
F: __dxlog_file31,
|
|
9220
|
-
L:
|
|
9215
|
+
L: 402,
|
|
9221
9216
|
S: this,
|
|
9222
9217
|
C: (f, a) => f(...a)
|
|
9223
9218
|
});
|
|
@@ -9227,7 +9222,7 @@ var ClientServicesHost = class {
|
|
|
9227
9222
|
await this._storage.reset();
|
|
9228
9223
|
import_log26.log.info("reset", void 0, {
|
|
9229
9224
|
F: __dxlog_file31,
|
|
9230
|
-
L:
|
|
9225
|
+
L: 409,
|
|
9231
9226
|
S: this,
|
|
9232
9227
|
C: (f, a) => f(...a)
|
|
9233
9228
|
});
|
|
@@ -9235,7 +9230,7 @@ var ClientServicesHost = class {
|
|
|
9235
9230
|
id: traceId
|
|
9236
9231
|
}), {
|
|
9237
9232
|
F: __dxlog_file31,
|
|
9238
|
-
L:
|
|
9233
|
+
L: 410,
|
|
9239
9234
|
S: this,
|
|
9240
9235
|
C: (f, a) => f(...a)
|
|
9241
9236
|
});
|
|
@@ -9313,4 +9308,4 @@ ClientServicesHost = _ts_decorate11([
|
|
|
9313
9308
|
subscribeToSpaces,
|
|
9314
9309
|
subscribeToSwarmInfo
|
|
9315
9310
|
});
|
|
9316
|
-
//# sourceMappingURL=chunk-
|
|
9311
|
+
//# sourceMappingURL=chunk-LYHT7662.cjs.map
|