@dxos/client-services 0.8.1 → 0.8.2-main.f081794
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-3JMPDE6D.mjs} +59 -69
- package/dist/lib/browser/chunk-3JMPDE6D.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-A2WCOW6P.cjs → chunk-OU5KJSPA.cjs} +231 -241
- package/dist/lib/node/chunk-OU5KJSPA.cjs.map +7 -0
- package/dist/lib/node/index.cjs +47 -47
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +8 -8
- package/dist/lib/node-esm/{chunk-SK52YZK7.mjs → chunk-YG5ZNYRZ.mjs} +59 -69
- package/dist/lib/node-esm/chunk-YG5ZNYRZ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +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/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/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/edge-feed-replicator.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/package.json +38 -38
- package/src/packlets/agents/edge-agent-service.ts +8 -11
- package/src/packlets/devices/devices-service.ts +5 -3
- package/src/packlets/identity/identity.test.ts +9 -6
- package/src/packlets/network/network-service.ts +9 -15
- package/src/packlets/services/service-host.ts +5 -1
- package/src/packlets/spaces/edge-feed-replicator.test.ts +2 -1
- package/src/packlets/spaces/edge-feed-replicator.ts +2 -1
- 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_OU5KJSPA_exports = {};
|
|
30
|
+
__export(chunk_OU5KJSPA_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_OU5KJSPA_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,6 +116,7 @@ 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");
|
|
120
121
|
var import_async7 = require("@dxos/async");
|
|
121
122
|
var import_automerge = require("@dxos/automerge/automerge");
|
|
@@ -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");
|
|
@@ -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");
|
|
@@ -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.f081794";
|
|
748
749
|
var getPlatform = () => {
|
|
749
750
|
if (process.browser) {
|
|
750
751
|
if (typeof window !== "undefined") {
|
|
@@ -1136,7 +1137,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1136
1137
|
async _open() {
|
|
1137
1138
|
(0, import_log3.log)("open", void 0, {
|
|
1138
1139
|
F: __dxlog_file5,
|
|
1139
|
-
L:
|
|
1140
|
+
L: 57,
|
|
1140
1141
|
S: this,
|
|
1141
1142
|
C: (f, a) => f(...a)
|
|
1142
1143
|
});
|
|
@@ -1155,7 +1156,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1155
1156
|
_spaceId: this._spaceId
|
|
1156
1157
|
}, {
|
|
1157
1158
|
F: __dxlog_file5,
|
|
1158
|
-
L:
|
|
1159
|
+
L: 71,
|
|
1159
1160
|
S: this,
|
|
1160
1161
|
C: (f, a) => f(...a)
|
|
1161
1162
|
});
|
|
@@ -1168,7 +1169,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1168
1169
|
type: payload.type
|
|
1169
1170
|
}, {
|
|
1170
1171
|
F: __dxlog_file5,
|
|
1171
|
-
L:
|
|
1172
|
+
L: 76,
|
|
1172
1173
|
S: this,
|
|
1173
1174
|
C: (f, a) => f(...a)
|
|
1174
1175
|
});
|
|
@@ -1180,14 +1181,14 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1180
1181
|
}
|
|
1181
1182
|
async _handleReconnect() {
|
|
1182
1183
|
await this._resetConnection();
|
|
1183
|
-
if (this._messenger.
|
|
1184
|
+
if (this._messenger.status === import_services4.EdgeStatus.CONNECTED) {
|
|
1184
1185
|
this._startReplication();
|
|
1185
1186
|
}
|
|
1186
1187
|
}
|
|
1187
1188
|
async _close() {
|
|
1188
1189
|
(0, import_log3.log)("close", void 0, {
|
|
1189
1190
|
F: __dxlog_file5,
|
|
1190
|
-
L:
|
|
1191
|
+
L: 96,
|
|
1191
1192
|
S: this,
|
|
1192
1193
|
C: (f, a) => f(...a)
|
|
1193
1194
|
});
|
|
@@ -1199,7 +1200,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1199
1200
|
this._connectionCtx = connectionCtx;
|
|
1200
1201
|
(0, import_log3.log)("connection context created", void 0, {
|
|
1201
1202
|
F: __dxlog_file5,
|
|
1202
|
-
L:
|
|
1203
|
+
L: 104,
|
|
1203
1204
|
S: this,
|
|
1204
1205
|
C: (f, a) => f(...a)
|
|
1205
1206
|
});
|
|
@@ -1212,7 +1213,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1212
1213
|
async _resetConnection() {
|
|
1213
1214
|
(0, import_log3.log)("resetConnection", void 0, {
|
|
1214
1215
|
F: __dxlog_file5,
|
|
1215
|
-
L:
|
|
1216
|
+
L: 113,
|
|
1216
1217
|
S: this,
|
|
1217
1218
|
C: (f, a) => f(...a)
|
|
1218
1219
|
});
|
|
@@ -1228,7 +1229,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1228
1229
|
hasConnectionCtx: !!this._connectionCtx
|
|
1229
1230
|
}, {
|
|
1230
1231
|
F: __dxlog_file5,
|
|
1231
|
-
L:
|
|
1232
|
+
L: 121,
|
|
1232
1233
|
S: this,
|
|
1233
1234
|
C: (f, a) => f(...a)
|
|
1234
1235
|
});
|
|
@@ -1245,7 +1246,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1245
1246
|
key: feed.key
|
|
1246
1247
|
}, {
|
|
1247
1248
|
F: __dxlog_file5,
|
|
1248
|
-
L:
|
|
1249
|
+
L: 134,
|
|
1249
1250
|
S: this,
|
|
1250
1251
|
C: (f, a) => f(...a)
|
|
1251
1252
|
});
|
|
@@ -1261,7 +1262,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1261
1262
|
if (!this._connectionCtx) {
|
|
1262
1263
|
(0, import_log3.log)("message dropped because connection was disposed", void 0, {
|
|
1263
1264
|
F: __dxlog_file5,
|
|
1264
|
-
L:
|
|
1265
|
+
L: 147,
|
|
1265
1266
|
S: this,
|
|
1266
1267
|
C: (f, a) => f(...a)
|
|
1267
1268
|
});
|
|
@@ -1273,14 +1274,14 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1273
1274
|
blocks: message.blocks.map((b) => b.index)
|
|
1274
1275
|
}, {
|
|
1275
1276
|
F: __dxlog_file5,
|
|
1276
|
-
L:
|
|
1277
|
+
L: 152,
|
|
1277
1278
|
S: this,
|
|
1278
1279
|
C: (f, a) => f(...a)
|
|
1279
1280
|
});
|
|
1280
1281
|
}
|
|
1281
1282
|
(0, import_invariant2.invariant)(message.feedKey, void 0, {
|
|
1282
1283
|
F: __dxlog_file5,
|
|
1283
|
-
L:
|
|
1284
|
+
L: 158,
|
|
1284
1285
|
S: this,
|
|
1285
1286
|
A: [
|
|
1286
1287
|
"message.feedKey",
|
|
@@ -1292,7 +1293,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1292
1293
|
type: message.type
|
|
1293
1294
|
}, {
|
|
1294
1295
|
F: __dxlog_file5,
|
|
1295
|
-
L:
|
|
1296
|
+
L: 161,
|
|
1296
1297
|
S: this,
|
|
1297
1298
|
C: (f, a) => f(...a)
|
|
1298
1299
|
});
|
|
@@ -1311,7 +1312,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1311
1312
|
if (!this._connectionCtx) {
|
|
1312
1313
|
import_log3.log.warn("received message after connection context was disposed", void 0, {
|
|
1313
1314
|
F: __dxlog_file5,
|
|
1314
|
-
L:
|
|
1315
|
+
L: 176,
|
|
1315
1316
|
S: this,
|
|
1316
1317
|
C: (f, a) => f(...a)
|
|
1317
1318
|
});
|
|
@@ -1329,7 +1330,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1329
1330
|
feedKey
|
|
1330
1331
|
}, {
|
|
1331
1332
|
F: __dxlog_file5,
|
|
1332
|
-
L:
|
|
1333
|
+
L: 185,
|
|
1333
1334
|
S: this,
|
|
1334
1335
|
C: (f, a) => f(...a)
|
|
1335
1336
|
});
|
|
@@ -1345,7 +1346,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1345
1346
|
if (message.length > feed.length) {
|
|
1346
1347
|
(0, import_log3.log)("requesting missing blocks", logMeta, {
|
|
1347
1348
|
F: __dxlog_file5,
|
|
1348
|
-
L:
|
|
1349
|
+
L: 195,
|
|
1349
1350
|
S: this,
|
|
1350
1351
|
C: (f, a) => f(...a)
|
|
1351
1352
|
});
|
|
@@ -1360,7 +1361,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1360
1361
|
} else if (message.length < feed.length) {
|
|
1361
1362
|
(0, import_log3.log)("pushing blocks to remote", logMeta, {
|
|
1362
1363
|
F: __dxlog_file5,
|
|
1363
|
-
L:
|
|
1364
|
+
L: 203,
|
|
1364
1365
|
S: this,
|
|
1365
1366
|
C: (f, a) => f(...a)
|
|
1366
1367
|
});
|
|
@@ -1379,7 +1380,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1379
1380
|
blocks: message.blocks.map((b) => b.index)
|
|
1380
1381
|
}, {
|
|
1381
1382
|
F: __dxlog_file5,
|
|
1382
|
-
L:
|
|
1383
|
+
L: 212,
|
|
1383
1384
|
S: this,
|
|
1384
1385
|
C: (f, a) => f(...a)
|
|
1385
1386
|
});
|
|
@@ -1390,7 +1391,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1390
1391
|
feedKey
|
|
1391
1392
|
}, {
|
|
1392
1393
|
F: __dxlog_file5,
|
|
1393
|
-
L:
|
|
1394
|
+
L: 217,
|
|
1394
1395
|
S: this,
|
|
1395
1396
|
C: (f, a) => f(...a)
|
|
1396
1397
|
});
|
|
@@ -1404,7 +1405,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1404
1405
|
...message
|
|
1405
1406
|
}, {
|
|
1406
1407
|
F: __dxlog_file5,
|
|
1407
|
-
L:
|
|
1408
|
+
L: 226,
|
|
1408
1409
|
S: this,
|
|
1409
1410
|
C: (f, a) => f(...a)
|
|
1410
1411
|
});
|
|
@@ -1419,7 +1420,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1419
1420
|
to
|
|
1420
1421
|
}, {
|
|
1421
1422
|
F: __dxlog_file5,
|
|
1422
|
-
L:
|
|
1423
|
+
L: 233,
|
|
1423
1424
|
S: this,
|
|
1424
1425
|
C: (f, a) => f(...a)
|
|
1425
1426
|
});
|
|
@@ -1429,7 +1430,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1429
1430
|
});
|
|
1430
1431
|
(0, import_invariant2.invariant)(data instanceof Uint8Array, void 0, {
|
|
1431
1432
|
F: __dxlog_file5,
|
|
1432
|
-
L:
|
|
1433
|
+
L: 238,
|
|
1433
1434
|
S: this,
|
|
1434
1435
|
A: [
|
|
1435
1436
|
"data instanceof Uint8Array",
|
|
@@ -1457,7 +1458,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1457
1458
|
blocks: blocks.length
|
|
1458
1459
|
}, {
|
|
1459
1460
|
F: __dxlog_file5,
|
|
1460
|
-
L:
|
|
1461
|
+
L: 259,
|
|
1461
1462
|
S: this,
|
|
1462
1463
|
C: (f, a) => f(...a)
|
|
1463
1464
|
});
|
|
@@ -1479,7 +1480,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1479
1480
|
if (!this._remoteLength.has(feed.key)) {
|
|
1480
1481
|
(0, import_log3.log)("blocks not pushed because remote length is unknown", void 0, {
|
|
1481
1482
|
F: __dxlog_file5,
|
|
1482
|
-
L:
|
|
1483
|
+
L: 280,
|
|
1483
1484
|
S: this,
|
|
1484
1485
|
C: (f, a) => f(...a)
|
|
1485
1486
|
});
|
|
@@ -1504,7 +1505,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1504
1505
|
if (err instanceof import_edge_client.EdgeIdentityChangedError || err instanceof import_edge_client.EdgeConnectionClosedError) {
|
|
1505
1506
|
(0, import_log3.log)("resetting on reconnect", void 0, {
|
|
1506
1507
|
F: __dxlog_file5,
|
|
1507
|
-
L:
|
|
1508
|
+
L: 297,
|
|
1508
1509
|
S: this,
|
|
1509
1510
|
C: (f, a) => f(...a)
|
|
1510
1511
|
});
|
|
@@ -1515,7 +1516,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1515
1516
|
}
|
|
1516
1517
|
}, {
|
|
1517
1518
|
F: __dxlog_file5,
|
|
1518
|
-
L:
|
|
1519
|
+
L: 291
|
|
1519
1520
|
});
|
|
1520
1521
|
return connectionCtx;
|
|
1521
1522
|
}
|
|
@@ -1577,14 +1578,14 @@ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/sr
|
|
|
1577
1578
|
var LOAD_DOC_TIMEOUT = 1e4;
|
|
1578
1579
|
var runEpochMigration = async (ctx, context) => {
|
|
1579
1580
|
switch (context.migration) {
|
|
1580
|
-
case
|
|
1581
|
+
case import_services6.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
|
|
1581
1582
|
const document = context.echoHost.createDoc();
|
|
1582
1583
|
await context.echoHost.flush();
|
|
1583
1584
|
return {
|
|
1584
1585
|
newRoot: document.url
|
|
1585
1586
|
};
|
|
1586
1587
|
}
|
|
1587
|
-
case
|
|
1588
|
+
case import_services6.CreateEpochRequest.Migration.PRUNE_AUTOMERGE_ROOT_HISTORY: {
|
|
1588
1589
|
if (!context.currentRoot) {
|
|
1589
1590
|
throw new Error("Space does not have an automerge root");
|
|
1590
1591
|
}
|
|
@@ -1597,14 +1598,14 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
1597
1598
|
newRoot: newRoot.url
|
|
1598
1599
|
};
|
|
1599
1600
|
}
|
|
1600
|
-
case
|
|
1601
|
+
case import_services6.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
|
|
1601
1602
|
throw new Error("Migration not available");
|
|
1602
1603
|
}
|
|
1603
|
-
case
|
|
1604
|
+
case import_services6.CreateEpochRequest.Migration.MIGRATE_REFERENCES_TO_DXN: {
|
|
1604
1605
|
throw new Error("Migration not available");
|
|
1605
1606
|
}
|
|
1606
1607
|
// TODO(dmaretskyi): This path doesn't seem to fit here. This is not a migration.
|
|
1607
|
-
case
|
|
1608
|
+
case import_services6.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
|
|
1608
1609
|
(0, import_invariant4.invariant)(context.newAutomergeRoot, void 0, {
|
|
1609
1610
|
F: __dxlog_file6,
|
|
1610
1611
|
L: 62,
|
|
@@ -2214,7 +2215,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2214
2215
|
const properties = rootDoc && (0, import_echo_pipeline2.findInlineObjectOfType)(rootDoc, import_client_protocol4.TYPE_PROPERTIES);
|
|
2215
2216
|
return {
|
|
2216
2217
|
key: space.key.toHex(),
|
|
2217
|
-
state:
|
|
2218
|
+
state: import_services7.SpaceState[space.state],
|
|
2218
2219
|
name: properties?.[1].data.name ?? null,
|
|
2219
2220
|
inlineObjects: rootDoc ? Object.keys(rootDoc.objects ?? {}).length : null,
|
|
2220
2221
|
linkedObjects: rootDoc ? Object.keys(rootDoc.links ?? {}).length : null,
|
|
@@ -2318,7 +2319,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2318
2319
|
genesisFeedKey: controlFeedKey,
|
|
2319
2320
|
controlFeedKey,
|
|
2320
2321
|
dataFeedKey,
|
|
2321
|
-
state:
|
|
2322
|
+
state: import_services7.SpaceState.SPACE_ACTIVE
|
|
2322
2323
|
};
|
|
2323
2324
|
(0, import_log8.log)("creating space...", {
|
|
2324
2325
|
spaceId,
|
|
@@ -2569,7 +2570,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2569
2570
|
async waitUntilSpaceReady(spaceKey) {
|
|
2570
2571
|
await (0, import_context7.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
|
|
2571
2572
|
const space = this._spaces.get(spaceKey);
|
|
2572
|
-
return !!space && space.state ===
|
|
2573
|
+
return !!space && space.state === import_services7.SpaceState.SPACE_READY;
|
|
2573
2574
|
}));
|
|
2574
2575
|
}
|
|
2575
2576
|
async requestSpaceAdmissionCredential(spaceKey) {
|
|
@@ -2674,7 +2675,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2674
2675
|
});
|
|
2675
2676
|
},
|
|
2676
2677
|
onMemberRolesChanged: async (members) => {
|
|
2677
|
-
if (dataSpace?.state ===
|
|
2678
|
+
if (dataSpace?.state === import_services7.SpaceState.SPACE_READY) {
|
|
2678
2679
|
this._handleMemberRoleChanges(presence, space.protocol, members);
|
|
2679
2680
|
}
|
|
2680
2681
|
},
|
|
@@ -2687,7 +2688,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2687
2688
|
dataFeed && await space.setDataFeed(dataFeed);
|
|
2688
2689
|
const dataSpace = new DataSpace({
|
|
2689
2690
|
inner: space,
|
|
2690
|
-
initialState: metadata.state ===
|
|
2691
|
+
initialState: metadata.state === import_services7.SpaceState.SPACE_INACTIVE ? import_services7.SpaceState.SPACE_INACTIVE : import_services7.SpaceState.SPACE_CLOSED,
|
|
2691
2692
|
metadataStore: this._metadataStore,
|
|
2692
2693
|
gossip,
|
|
2693
2694
|
presence,
|
|
@@ -2765,7 +2766,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2765
2766
|
}
|
|
2766
2767
|
});
|
|
2767
2768
|
presence.newPeer.on((peerState) => {
|
|
2768
|
-
if (dataSpace.state ===
|
|
2769
|
+
if (dataSpace.state === import_services7.SpaceState.SPACE_READY) {
|
|
2769
2770
|
this._handleNewPeerConnected(space, peerState);
|
|
2770
2771
|
}
|
|
2771
2772
|
});
|
|
@@ -2839,7 +2840,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2839
2840
|
}
|
|
2840
2841
|
}
|
|
2841
2842
|
async _handleInvitationStatusChange(dataSpace, delegatedInvitation, isActive) {
|
|
2842
|
-
if (dataSpace?.state !==
|
|
2843
|
+
if (dataSpace?.state !== import_services7.SpaceState.SPACE_READY) {
|
|
2843
2844
|
return;
|
|
2844
2845
|
}
|
|
2845
2846
|
if (isActive) {
|
|
@@ -2856,8 +2857,8 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2856
2857
|
async _createDelegatedInvitations(space, invitations) {
|
|
2857
2858
|
const tasks = invitations.map(([credentialId, invitation]) => {
|
|
2858
2859
|
return this._invitationsManager.createInvitation({
|
|
2859
|
-
type:
|
|
2860
|
-
kind:
|
|
2860
|
+
type: import_services7.Invitation.Type.DELEGATED,
|
|
2861
|
+
kind: import_services7.Invitation.Kind.SPACE,
|
|
2861
2862
|
spaceKey: space.key,
|
|
2862
2863
|
authMethod: invitation.authMethod,
|
|
2863
2864
|
invitationId: invitation.invitationId,
|
|
@@ -3056,10 +3057,10 @@ var SpacesServiceImpl = class {
|
|
|
3056
3057
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug3.raise)(new import_protocols6.SpaceNotFoundError(spaceKey));
|
|
3057
3058
|
if (state) {
|
|
3058
3059
|
switch (state) {
|
|
3059
|
-
case
|
|
3060
|
+
case import_services8.SpaceState.SPACE_ACTIVE:
|
|
3060
3061
|
await space.activate();
|
|
3061
3062
|
break;
|
|
3062
|
-
case
|
|
3063
|
+
case import_services8.SpaceState.SPACE_INACTIVE:
|
|
3063
3064
|
await space.deactivate();
|
|
3064
3065
|
break;
|
|
3065
3066
|
default:
|
|
@@ -3388,7 +3389,7 @@ var SpacesServiceImpl = class {
|
|
|
3388
3389
|
profile: member.profile ?? {}
|
|
3389
3390
|
},
|
|
3390
3391
|
role: member.role,
|
|
3391
|
-
presence: peers.length > 0 ?
|
|
3392
|
+
presence: peers.length > 0 ? import_services8.SpaceMember.PresenceState.ONLINE : import_services8.SpaceMember.PresenceState.OFFLINE,
|
|
3392
3393
|
peerStates: peers
|
|
3393
3394
|
};
|
|
3394
3395
|
})),
|
|
@@ -3975,8 +3976,8 @@ var IdentityManager = class {
|
|
|
3975
3976
|
this.stateUpdate.emit();
|
|
3976
3977
|
return {
|
|
3977
3978
|
deviceKey: this._identity.deviceKey,
|
|
3978
|
-
kind:
|
|
3979
|
-
presence:
|
|
3979
|
+
kind: import_services9.DeviceKind.CURRENT,
|
|
3980
|
+
presence: import_services9.Device.PresenceState.ONLINE,
|
|
3980
3981
|
profile
|
|
3981
3982
|
};
|
|
3982
3983
|
}
|
|
@@ -4250,9 +4251,9 @@ var IdentityServiceImpl = class extends import_context10.Resource {
|
|
|
4250
4251
|
const dataSpaceManager = this._dataSpaceManagerProvider();
|
|
4251
4252
|
const recordedDefaultSpaceTrigger = new import_async14.Trigger();
|
|
4252
4253
|
const allProcessed = (0, import_util9.safeAwaitAll)(dataSpaceManager.spaces.values(), async (space) => {
|
|
4253
|
-
if (space.state ===
|
|
4254
|
+
if (space.state === import_services10.SpaceState.SPACE_CLOSED) {
|
|
4254
4255
|
await space.open();
|
|
4255
|
-
const requiresMigration = space.stateUpdate.waitForCondition(() => space.state ===
|
|
4256
|
+
const requiresMigration = space.stateUpdate.waitForCondition(() => space.state === import_services10.SpaceState.SPACE_REQUIRES_MIGRATION);
|
|
4256
4257
|
await Promise.race([
|
|
4257
4258
|
space.initializeDataPipeline(),
|
|
4258
4259
|
requiresMigration
|
|
@@ -4372,7 +4373,7 @@ var DataSpace = class {
|
|
|
4372
4373
|
this._edgeFeedReplicator = void 0;
|
|
4373
4374
|
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
4374
4375
|
this._epochProcessingMutex = new import_async7.Mutex();
|
|
4375
|
-
this._state =
|
|
4376
|
+
this._state = import_services5.SpaceState.SPACE_CLOSED;
|
|
4376
4377
|
this._databaseRoot = null;
|
|
4377
4378
|
this.error = void 0;
|
|
4378
4379
|
this.stateUpdate = new import_async7.Event();
|
|
@@ -4412,7 +4413,7 @@ var DataSpace = class {
|
|
|
4412
4413
|
}
|
|
4413
4414
|
this._state = params.initialState;
|
|
4414
4415
|
(0, import_log4.log)("new state", {
|
|
4415
|
-
state:
|
|
4416
|
+
state: import_services5.SpaceState[this._state]
|
|
4416
4417
|
}, {
|
|
4417
4418
|
F: __dxlog_file15,
|
|
4418
4419
|
L: 173,
|
|
@@ -4458,7 +4459,7 @@ var DataSpace = class {
|
|
|
4458
4459
|
};
|
|
4459
4460
|
}
|
|
4460
4461
|
async open() {
|
|
4461
|
-
if (this._state ===
|
|
4462
|
+
if (this._state === import_services5.SpaceState.SPACE_CLOSED) {
|
|
4462
4463
|
await this._open();
|
|
4463
4464
|
}
|
|
4464
4465
|
}
|
|
@@ -4478,9 +4479,9 @@ var DataSpace = class {
|
|
|
4478
4479
|
}));
|
|
4479
4480
|
await this._inner.startProtocol();
|
|
4480
4481
|
await this._edgeFeedReplicator?.open();
|
|
4481
|
-
this._state =
|
|
4482
|
+
this._state = import_services5.SpaceState.SPACE_CONTROL_ONLY;
|
|
4482
4483
|
(0, import_log4.log)("new state", {
|
|
4483
|
-
state:
|
|
4484
|
+
state: import_services5.SpaceState[this._state]
|
|
4484
4485
|
}, {
|
|
4485
4486
|
F: __dxlog_file15,
|
|
4486
4487
|
L: 253,
|
|
@@ -4498,9 +4499,9 @@ var DataSpace = class {
|
|
|
4498
4499
|
async _close() {
|
|
4499
4500
|
await this._callbacks.beforeClose?.();
|
|
4500
4501
|
await this.preClose.callSerial();
|
|
4501
|
-
this._state =
|
|
4502
|
+
this._state = import_services5.SpaceState.SPACE_CLOSED;
|
|
4502
4503
|
(0, import_log4.log)("new state", {
|
|
4503
|
-
state:
|
|
4504
|
+
state: import_services5.SpaceState[this._state]
|
|
4504
4505
|
}, {
|
|
4505
4506
|
F: __dxlog_file15,
|
|
4506
4507
|
L: 272,
|
|
@@ -4555,9 +4556,9 @@ var DataSpace = class {
|
|
|
4555
4556
|
S: this,
|
|
4556
4557
|
C: (f, a) => f(...a)
|
|
4557
4558
|
});
|
|
4558
|
-
this._state =
|
|
4559
|
+
this._state = import_services5.SpaceState.SPACE_ERROR;
|
|
4559
4560
|
(0, import_log4.log)("new state", {
|
|
4560
|
-
state:
|
|
4561
|
+
state: import_services5.SpaceState[this._state]
|
|
4561
4562
|
}, {
|
|
4562
4563
|
F: __dxlog_file15,
|
|
4563
4564
|
L: 318,
|
|
@@ -4572,12 +4573,12 @@ var DataSpace = class {
|
|
|
4572
4573
|
});
|
|
4573
4574
|
}
|
|
4574
4575
|
async initializeDataPipeline() {
|
|
4575
|
-
if (this._state !==
|
|
4576
|
+
if (this._state !== import_services5.SpaceState.SPACE_CONTROL_ONLY) {
|
|
4576
4577
|
throw new import_protocols3.SystemError("Invalid operation");
|
|
4577
4578
|
}
|
|
4578
|
-
this._state =
|
|
4579
|
+
this._state = import_services5.SpaceState.SPACE_INITIALIZING;
|
|
4579
4580
|
(0, import_log4.log)("new state", {
|
|
4580
|
-
state:
|
|
4581
|
+
state: import_services5.SpaceState[this._state]
|
|
4581
4582
|
}, {
|
|
4582
4583
|
F: __dxlog_file15,
|
|
4583
4584
|
L: 334,
|
|
@@ -4592,7 +4593,7 @@ var DataSpace = class {
|
|
|
4592
4593
|
});
|
|
4593
4594
|
await this._initializeAndReadControlPipeline();
|
|
4594
4595
|
await (0, import_async7.sleep)(1);
|
|
4595
|
-
const ready = this.stateUpdate.waitForCondition(() => this._state ===
|
|
4596
|
+
const ready = this.stateUpdate.waitForCondition(() => this._state === import_services5.SpaceState.SPACE_READY);
|
|
4596
4597
|
(0, import_log4.log)("initializing automerge root", void 0, {
|
|
4597
4598
|
F: __dxlog_file15,
|
|
4598
4599
|
L: 344,
|
|
@@ -4643,9 +4644,9 @@ var DataSpace = class {
|
|
|
4643
4644
|
}
|
|
4644
4645
|
async _enterReadyState() {
|
|
4645
4646
|
await this._callbacks.beforeReady?.();
|
|
4646
|
-
this._state =
|
|
4647
|
+
this._state = import_services5.SpaceState.SPACE_READY;
|
|
4647
4648
|
(0, import_log4.log)("new state", {
|
|
4648
|
-
state:
|
|
4649
|
+
state: import_services5.SpaceState[this._state]
|
|
4649
4650
|
}, {
|
|
4650
4651
|
F: __dxlog_file15,
|
|
4651
4652
|
L: 369,
|
|
@@ -4782,9 +4783,9 @@ var DataSpace = class {
|
|
|
4782
4783
|
const root = await this._echoHost.openSpaceRoot(this.id, handle.url);
|
|
4783
4784
|
this._databaseRoot = root;
|
|
4784
4785
|
if (root.getVersion() !== import_echo_protocol.SpaceDocVersion.CURRENT) {
|
|
4785
|
-
this._state =
|
|
4786
|
+
this._state = import_services5.SpaceState.SPACE_REQUIRES_MIGRATION;
|
|
4786
4787
|
this.stateUpdate.emit();
|
|
4787
|
-
} else if (this._state !==
|
|
4788
|
+
} else if (this._state !== import_services5.SpaceState.SPACE_READY) {
|
|
4788
4789
|
await this._enterReadyState();
|
|
4789
4790
|
} else {
|
|
4790
4791
|
this.stateUpdate.emit();
|
|
@@ -4872,26 +4873,26 @@ var DataSpace = class {
|
|
|
4872
4873
|
}
|
|
4873
4874
|
async activate() {
|
|
4874
4875
|
if (![
|
|
4875
|
-
|
|
4876
|
-
|
|
4876
|
+
import_services5.SpaceState.SPACE_CLOSED,
|
|
4877
|
+
import_services5.SpaceState.SPACE_INACTIVE
|
|
4877
4878
|
].includes(this._state)) {
|
|
4878
4879
|
return;
|
|
4879
4880
|
}
|
|
4880
|
-
await this._metadataStore.setSpaceState(this.key,
|
|
4881
|
+
await this._metadataStore.setSpaceState(this.key, import_services5.SpaceState.SPACE_ACTIVE);
|
|
4881
4882
|
await this._open();
|
|
4882
4883
|
this.initializeDataPipelineAsync();
|
|
4883
4884
|
}
|
|
4884
4885
|
async deactivate() {
|
|
4885
|
-
if (this._state ===
|
|
4886
|
+
if (this._state === import_services5.SpaceState.SPACE_INACTIVE) {
|
|
4886
4887
|
return;
|
|
4887
4888
|
}
|
|
4888
|
-
await this._metadataStore.setSpaceState(this.key,
|
|
4889
|
-
if (this._state !==
|
|
4889
|
+
await this._metadataStore.setSpaceState(this.key, import_services5.SpaceState.SPACE_INACTIVE);
|
|
4890
|
+
if (this._state !== import_services5.SpaceState.SPACE_CLOSED) {
|
|
4890
4891
|
await this._close();
|
|
4891
4892
|
}
|
|
4892
|
-
this._state =
|
|
4893
|
+
this._state = import_services5.SpaceState.SPACE_INACTIVE;
|
|
4893
4894
|
(0, import_log4.log)("new state", {
|
|
4894
|
-
state:
|
|
4895
|
+
state: import_services5.SpaceState[this._state]
|
|
4895
4896
|
}, {
|
|
4896
4897
|
F: __dxlog_file15,
|
|
4897
4898
|
L: 585,
|
|
@@ -4915,7 +4916,7 @@ _ts_decorate6([
|
|
|
4915
4916
|
], DataSpace.prototype, "key", null);
|
|
4916
4917
|
_ts_decorate6([
|
|
4917
4918
|
import_tracing3.trace.info({
|
|
4918
|
-
enum:
|
|
4919
|
+
enum: import_services5.SpaceState
|
|
4919
4920
|
})
|
|
4920
4921
|
], DataSpace.prototype, "state", null);
|
|
4921
4922
|
_ts_decorate6([
|
|
@@ -4969,7 +4970,7 @@ var DeviceInvitationProtocol = class {
|
|
|
4969
4970
|
}
|
|
4970
4971
|
getInvitationContext() {
|
|
4971
4972
|
return {
|
|
4972
|
-
kind:
|
|
4973
|
+
kind: import_services11.Invitation.Kind.DEVICE
|
|
4973
4974
|
};
|
|
4974
4975
|
}
|
|
4975
4976
|
async delegate() {
|
|
@@ -5072,7 +5073,7 @@ var DeviceInvitationProtocol = class {
|
|
|
5072
5073
|
}
|
|
5073
5074
|
};
|
|
5074
5075
|
var stateToString = (state) => {
|
|
5075
|
-
return Object.entries(
|
|
5076
|
+
return Object.entries(import_services14.Invitation.State).find(([key, val]) => val === state)?.[0] ?? "unknown";
|
|
5076
5077
|
};
|
|
5077
5078
|
var computeExpirationTime = (invitation) => {
|
|
5078
5079
|
if (!invitation.lifetime) {
|
|
@@ -5115,7 +5116,7 @@ var EdgeInvitationHandler = class {
|
|
|
5115
5116
|
}
|
|
5116
5117
|
const invitation = guardedState.current;
|
|
5117
5118
|
const spaceId = invitation.spaceId;
|
|
5118
|
-
const canBeHandledByEdge = invitation.authMethod !==
|
|
5119
|
+
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
5120
|
if (!canBeHandledByEdge) {
|
|
5120
5121
|
(0, import_log14.log)("invitation could not be handled by edge", {
|
|
5121
5122
|
invitation
|
|
@@ -5184,7 +5185,7 @@ var EdgeInvitationHandler = class {
|
|
|
5184
5185
|
S: this,
|
|
5185
5186
|
C: (f, a) => f(...a)
|
|
5186
5187
|
});
|
|
5187
|
-
guardedState.set(this,
|
|
5188
|
+
guardedState.set(this, import_services13.Invitation.State.CONNECTING);
|
|
5188
5189
|
const response = await this._joinSpaceByInvitation(guardedState, spaceId, {
|
|
5189
5190
|
identityKey: admissionRequest.identityKey.toHex(),
|
|
5190
5191
|
invitationId: guardedState.current.invitationId
|
|
@@ -5194,7 +5195,7 @@ var EdgeInvitationHandler = class {
|
|
|
5194
5195
|
space: admissionRequest
|
|
5195
5196
|
});
|
|
5196
5197
|
} catch (error) {
|
|
5197
|
-
guardedState.set(this,
|
|
5198
|
+
guardedState.set(this, import_services13.Invitation.State.ERROR);
|
|
5198
5199
|
throw error;
|
|
5199
5200
|
} finally {
|
|
5200
5201
|
this._flowLock?.release();
|
|
@@ -5429,7 +5430,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5429
5430
|
C: (f, a) => f(...a)
|
|
5430
5431
|
});
|
|
5431
5432
|
const invitation = this._requireActiveInvitation();
|
|
5432
|
-
this._assertInvitationState(
|
|
5433
|
+
this._assertInvitationState(import_services15.Invitation.State.CONNECTED);
|
|
5433
5434
|
if (invitationId !== invitation?.invitationId) {
|
|
5434
5435
|
import_log16.log.warn("incorrect invitationId", {
|
|
5435
5436
|
expected: invitation.invitationId,
|
|
@@ -5443,7 +5444,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5443
5444
|
this._callbacks.onError(new Error("Incorrect invitationId."));
|
|
5444
5445
|
(0, import_async18.scheduleTask)(this._ctx, () => this.close());
|
|
5445
5446
|
return {
|
|
5446
|
-
authMethod:
|
|
5447
|
+
authMethod: import_services15.Invitation.AuthMethod.NONE
|
|
5447
5448
|
};
|
|
5448
5449
|
}
|
|
5449
5450
|
import_log16.log.verbose("guest introduced themselves", {
|
|
@@ -5455,8 +5456,8 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5455
5456
|
C: (f, a) => f(...a)
|
|
5456
5457
|
});
|
|
5457
5458
|
this.guestProfile = profile;
|
|
5458
|
-
this._callbacks.onStateUpdate(
|
|
5459
|
-
this._challenge = invitation.authMethod ===
|
|
5459
|
+
this._callbacks.onStateUpdate(import_services15.Invitation.State.READY_FOR_AUTHENTICATION);
|
|
5460
|
+
this._challenge = invitation.authMethod === import_services15.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? (0, import_crypto3.randomBytes)(32) : void 0;
|
|
5460
5461
|
import_log16.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols14.trace.end({
|
|
5461
5462
|
id: traceId
|
|
5462
5463
|
}), {
|
|
@@ -5491,12 +5492,12 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5491
5492
|
});
|
|
5492
5493
|
let status = import_invitations4.AuthenticationResponse.Status.OK;
|
|
5493
5494
|
this._assertInvitationState([
|
|
5494
|
-
|
|
5495
|
-
|
|
5495
|
+
import_services15.Invitation.State.AUTHENTICATING,
|
|
5496
|
+
import_services15.Invitation.State.READY_FOR_AUTHENTICATION
|
|
5496
5497
|
]);
|
|
5497
|
-
this._callbacks.onStateUpdate(
|
|
5498
|
+
this._callbacks.onStateUpdate(import_services15.Invitation.State.AUTHENTICATING);
|
|
5498
5499
|
switch (invitation.authMethod) {
|
|
5499
|
-
case
|
|
5500
|
+
case import_services15.Invitation.AuthMethod.NONE: {
|
|
5500
5501
|
(0, import_log16.log)("authentication not required", void 0, {
|
|
5501
5502
|
F: __dxlog_file19,
|
|
5502
5503
|
L: 154,
|
|
@@ -5507,7 +5508,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5507
5508
|
status: import_invitations4.AuthenticationResponse.Status.OK
|
|
5508
5509
|
};
|
|
5509
5510
|
}
|
|
5510
|
-
case
|
|
5511
|
+
case import_services15.Invitation.AuthMethod.SHARED_SECRET: {
|
|
5511
5512
|
if (invitation.authCode) {
|
|
5512
5513
|
if (this.authenticationRetry++ > MAX_OTP_ATTEMPTS) {
|
|
5513
5514
|
status = import_invitations4.AuthenticationResponse.Status.INVALID_OPT_ATTEMPTS;
|
|
@@ -5519,7 +5520,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5519
5520
|
}
|
|
5520
5521
|
break;
|
|
5521
5522
|
}
|
|
5522
|
-
case
|
|
5523
|
+
case import_services15.Invitation.AuthMethod.KNOWN_PUBLIC_KEY: {
|
|
5523
5524
|
if (!invitation.guestKeypair) {
|
|
5524
5525
|
status = import_invitations4.AuthenticationResponse.Status.INTERNAL_ERROR;
|
|
5525
5526
|
break;
|
|
@@ -5583,7 +5584,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5583
5584
|
const invitation = this._requireActiveInvitation();
|
|
5584
5585
|
try {
|
|
5585
5586
|
if (isAuthenticationRequired(invitation)) {
|
|
5586
|
-
this._assertInvitationState(
|
|
5587
|
+
this._assertInvitationState(import_services15.Invitation.State.AUTHENTICATING);
|
|
5587
5588
|
if (!this.authenticationPassed) {
|
|
5588
5589
|
throw new Error("Not authenticated");
|
|
5589
5590
|
}
|
|
@@ -5622,7 +5623,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5622
5623
|
S: this,
|
|
5623
5624
|
C: (f, a) => f(...a)
|
|
5624
5625
|
});
|
|
5625
|
-
this._callbacks.onStateUpdate(
|
|
5626
|
+
this._callbacks.onStateUpdate(import_services15.Invitation.State.CONNECTING);
|
|
5626
5627
|
await this.rpc.InvitationHostService.options({
|
|
5627
5628
|
role: import_invitations4.InvitationOptions.Role.HOST
|
|
5628
5629
|
});
|
|
@@ -5648,7 +5649,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5648
5649
|
remotePeerId: context.remotePeerId
|
|
5649
5650
|
});
|
|
5650
5651
|
}
|
|
5651
|
-
this._callbacks.onStateUpdate(
|
|
5652
|
+
this._callbacks.onStateUpdate(import_services15.Invitation.State.CONNECTED);
|
|
5652
5653
|
this._callbacks.onOpen(this._ctx, context);
|
|
5653
5654
|
} catch (err) {
|
|
5654
5655
|
if (this._invitationFlowLock != null) {
|
|
@@ -5697,7 +5698,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5697
5698
|
}
|
|
5698
5699
|
}
|
|
5699
5700
|
};
|
|
5700
|
-
var isAuthenticationRequired = (invitation) => invitation.authMethod !==
|
|
5701
|
+
var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services15.Invitation.AuthMethod.NONE;
|
|
5701
5702
|
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-state.ts";
|
|
5702
5703
|
var createGuardedInvitationState = (ctx, invitation, stream) => {
|
|
5703
5704
|
const mutex = new import_async19.Mutex();
|
|
@@ -5741,10 +5742,10 @@ var createGuardedInvitationState = (ctx, invitation, stream) => {
|
|
|
5741
5742
|
},
|
|
5742
5743
|
error: (lockHolder, error) => {
|
|
5743
5744
|
if (isStateChangeAllowed(lockHolder)) {
|
|
5744
|
-
logStateUpdate(currentInvitation, lockHolder,
|
|
5745
|
+
logStateUpdate(currentInvitation, lockHolder, import_services16.Invitation.State.ERROR, error);
|
|
5745
5746
|
currentInvitation = {
|
|
5746
5747
|
...currentInvitation,
|
|
5747
|
-
state:
|
|
5748
|
+
state: import_services16.Invitation.State.ERROR
|
|
5748
5749
|
};
|
|
5749
5750
|
stream.next(currentInvitation);
|
|
5750
5751
|
stream.error(error);
|
|
@@ -5782,11 +5783,11 @@ var logStateUpdate = (invitation, actor, newState, error) => {
|
|
|
5782
5783
|
};
|
|
5783
5784
|
var isNonTerminalState = (currentState) => {
|
|
5784
5785
|
return ![
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5786
|
+
import_services16.Invitation.State.SUCCESS,
|
|
5787
|
+
import_services16.Invitation.State.ERROR,
|
|
5788
|
+
import_services16.Invitation.State.CANCELLED,
|
|
5789
|
+
import_services16.Invitation.State.TIMEOUT,
|
|
5790
|
+
import_services16.Invitation.State.EXPIRED
|
|
5790
5791
|
].includes(currentState);
|
|
5791
5792
|
};
|
|
5792
5793
|
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
|
|
@@ -5892,7 +5893,7 @@ var InvitationsHandler = class {
|
|
|
5892
5893
|
return ctx.disposed ? null : guardedState.current;
|
|
5893
5894
|
},
|
|
5894
5895
|
onStateUpdate: (newState) => {
|
|
5895
|
-
if (newState !==
|
|
5896
|
+
if (newState !== import_services12.Invitation.State.ERROR && newState !== import_services12.Invitation.State.TIMEOUT) {
|
|
5896
5897
|
guardedState.set(extension, newState);
|
|
5897
5898
|
}
|
|
5898
5899
|
return guardedState.current;
|
|
@@ -5930,7 +5931,7 @@ var InvitationsHandler = class {
|
|
|
5930
5931
|
let admitted = false;
|
|
5931
5932
|
connectionCtx.onDispose(() => {
|
|
5932
5933
|
if (!admitted) {
|
|
5933
|
-
guardedState.set(extension,
|
|
5934
|
+
guardedState.set(extension, import_services12.Invitation.State.CONNECTING);
|
|
5934
5935
|
}
|
|
5935
5936
|
});
|
|
5936
5937
|
(0, import_async15.scheduleTask)(connectionCtx, async () => {
|
|
@@ -5964,7 +5965,7 @@ var InvitationsHandler = class {
|
|
|
5964
5965
|
S: this,
|
|
5965
5966
|
C: (f, a) => f(...a)
|
|
5966
5967
|
});
|
|
5967
|
-
guardedState.set(extension,
|
|
5968
|
+
guardedState.set(extension, import_services12.Invitation.State.SUCCESS);
|
|
5968
5969
|
metrics.increment("dxos.invitation.success");
|
|
5969
5970
|
import_log13.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols11.trace.end({
|
|
5970
5971
|
id: traceId
|
|
@@ -5979,7 +5980,7 @@ var InvitationsHandler = class {
|
|
|
5979
5980
|
await ctx.dispose();
|
|
5980
5981
|
}
|
|
5981
5982
|
} catch (err) {
|
|
5982
|
-
const stateChanged = guardedState.set(extension,
|
|
5983
|
+
const stateChanged = guardedState.set(extension, import_services12.Invitation.State.CONNECTING);
|
|
5983
5984
|
if (err instanceof import_async15.TimeoutError) {
|
|
5984
5985
|
if (stateChanged) {
|
|
5985
5986
|
metrics.increment("dxos.invitation.timeout");
|
|
@@ -6017,7 +6018,7 @@ var InvitationsHandler = class {
|
|
|
6017
6018
|
});
|
|
6018
6019
|
},
|
|
6019
6020
|
onError: (err) => {
|
|
6020
|
-
const stateChanged = guardedState.set(extension,
|
|
6021
|
+
const stateChanged = guardedState.set(extension, import_services12.Invitation.State.CONNECTING);
|
|
6021
6022
|
if (err instanceof import_protocols11.InvalidInvitationExtensionRoleError) {
|
|
6022
6023
|
(0, import_log13.log)("invalid role", {
|
|
6023
6024
|
...err.context
|
|
@@ -6065,7 +6066,7 @@ var InvitationsHandler = class {
|
|
|
6065
6066
|
S: this,
|
|
6066
6067
|
C: (f, a) => f(...a)
|
|
6067
6068
|
});
|
|
6068
|
-
guardedState.set(null,
|
|
6069
|
+
guardedState.set(null, import_services12.Invitation.State.EXPIRED);
|
|
6069
6070
|
void ctx.dispose().catch((err) => import_log13.log.catch(err, void 0, {
|
|
6070
6071
|
F: __dxlog_file22,
|
|
6071
6072
|
L: 196,
|
|
@@ -6076,7 +6077,7 @@ var InvitationsHandler = class {
|
|
|
6076
6077
|
}
|
|
6077
6078
|
(0, import_async15.scheduleTask)(ctx, async () => {
|
|
6078
6079
|
await swarmConnection.close();
|
|
6079
|
-
guardedState.set(null,
|
|
6080
|
+
guardedState.set(null, import_services12.Invitation.State.EXPIRED);
|
|
6080
6081
|
metrics.increment("dxos.invitation.expired");
|
|
6081
6082
|
await ctx.dispose();
|
|
6082
6083
|
}, expiresOn.getTime() - Date.now());
|
|
@@ -6084,7 +6085,7 @@ var InvitationsHandler = class {
|
|
|
6084
6085
|
let swarmConnection;
|
|
6085
6086
|
(0, import_async15.scheduleTask)(ctx, async () => {
|
|
6086
6087
|
swarmConnection = await this._joinSwarm(ctx, invitation, import_invitations2.InvitationOptions.Role.HOST, createExtension);
|
|
6087
|
-
guardedState.set(null,
|
|
6088
|
+
guardedState.set(null, import_services12.Invitation.State.CONNECTING);
|
|
6088
6089
|
});
|
|
6089
6090
|
}
|
|
6090
6091
|
acceptInvitation(ctx, stream, protocol, invitation, otpEnteredTrigger, deviceProfile) {
|
|
@@ -6101,7 +6102,7 @@ var InvitationsHandler = class {
|
|
|
6101
6102
|
});
|
|
6102
6103
|
const { timeout = import_client_protocol5.INVITATION_TIMEOUT } = invitation;
|
|
6103
6104
|
if (deviceProfile) {
|
|
6104
|
-
(0, import_invariant14.invariant)(invitation.kind ===
|
|
6105
|
+
(0, import_invariant14.invariant)(invitation.kind === import_services12.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
6105
6106
|
F: __dxlog_file22,
|
|
6106
6107
|
L: 236,
|
|
6107
6108
|
S: this,
|
|
@@ -6117,7 +6118,7 @@ var InvitationsHandler = class {
|
|
|
6117
6118
|
const isLockedByAnotherConnection = guardedState.mutex.isLocked() && !extension.hasFlowLock();
|
|
6118
6119
|
(0, import_log13.log)("should cancel invitation flow", {
|
|
6119
6120
|
isLockedByAnotherConnection,
|
|
6120
|
-
invitationType:
|
|
6121
|
+
invitationType: import_services12.Invitation.Type.DELEGATED,
|
|
6121
6122
|
triedPeers: triedPeersIds.size
|
|
6122
6123
|
}, {
|
|
6123
6124
|
F: __dxlog_file22,
|
|
@@ -6128,7 +6129,7 @@ var InvitationsHandler = class {
|
|
|
6128
6129
|
if (isLockedByAnotherConnection) {
|
|
6129
6130
|
return false;
|
|
6130
6131
|
}
|
|
6131
|
-
return invitation.type !==
|
|
6132
|
+
return invitation.type !== import_services12.Invitation.Type.DELEGATED || triedPeersIds.size >= MAX_DELEGATED_INVITATION_HOST_TRIES;
|
|
6132
6133
|
};
|
|
6133
6134
|
let admitted = false;
|
|
6134
6135
|
const createExtension = () => {
|
|
@@ -6171,7 +6172,7 @@ var InvitationsHandler = class {
|
|
|
6171
6172
|
C: (f, a) => f(...a)
|
|
6172
6173
|
});
|
|
6173
6174
|
(0, import_async15.scheduleTask)(connectionCtx, () => {
|
|
6174
|
-
guardedState.set(extension,
|
|
6175
|
+
guardedState.set(extension, import_services12.Invitation.State.TIMEOUT);
|
|
6175
6176
|
extensionCtx.close();
|
|
6176
6177
|
}, timeout);
|
|
6177
6178
|
import_log13.log.verbose("dxos.sdk.invitations-handler.guest.connected", {
|
|
@@ -6182,7 +6183,7 @@ var InvitationsHandler = class {
|
|
|
6182
6183
|
S: this,
|
|
6183
6184
|
C: (f, a) => f(...a)
|
|
6184
6185
|
});
|
|
6185
|
-
guardedState.set(extension,
|
|
6186
|
+
guardedState.set(extension, import_services12.Invitation.State.CONNECTED);
|
|
6186
6187
|
import_log13.log.verbose("dxos.sdk.invitations-handler.guest.introduce", {
|
|
6187
6188
|
invitationId: invitation.invitationId,
|
|
6188
6189
|
...protocol.toJSON()
|
|
@@ -6209,12 +6210,12 @@ var InvitationsHandler = class {
|
|
|
6209
6210
|
invitation.authMethod = introductionResponse.authMethod;
|
|
6210
6211
|
if (isAuthenticationRequired(invitation)) {
|
|
6211
6212
|
switch (invitation.authMethod) {
|
|
6212
|
-
case
|
|
6213
|
+
case import_services12.Invitation.AuthMethod.SHARED_SECRET:
|
|
6213
6214
|
await this._handleGuestOtpAuth(extension, (state) => guardedState.set(extension, state), otpEnteredTrigger, {
|
|
6214
6215
|
timeout
|
|
6215
6216
|
});
|
|
6216
6217
|
break;
|
|
6217
|
-
case
|
|
6218
|
+
case import_services12.Invitation.AuthMethod.KNOWN_PUBLIC_KEY:
|
|
6218
6219
|
await this._handleGuestKpkAuth(extension, (state) => guardedState.set(extension, state), invitation, introductionResponse);
|
|
6219
6220
|
break;
|
|
6220
6221
|
}
|
|
@@ -6244,7 +6245,7 @@ var InvitationsHandler = class {
|
|
|
6244
6245
|
guardedState.complete({
|
|
6245
6246
|
...guardedState.current,
|
|
6246
6247
|
...result,
|
|
6247
|
-
state:
|
|
6248
|
+
state: import_services12.Invitation.State.SUCCESS
|
|
6248
6249
|
});
|
|
6249
6250
|
import_log13.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols11.trace.end({
|
|
6250
6251
|
id: traceId
|
|
@@ -6264,7 +6265,7 @@ var InvitationsHandler = class {
|
|
|
6264
6265
|
S: this,
|
|
6265
6266
|
C: (f, a) => f(...a)
|
|
6266
6267
|
});
|
|
6267
|
-
guardedState.set(extension,
|
|
6268
|
+
guardedState.set(extension, import_services12.Invitation.State.TIMEOUT);
|
|
6268
6269
|
} else {
|
|
6269
6270
|
import_log13.log.verbose("auth failed", err, {
|
|
6270
6271
|
F: __dxlog_file22,
|
|
@@ -6300,7 +6301,7 @@ var InvitationsHandler = class {
|
|
|
6300
6301
|
S: this,
|
|
6301
6302
|
C: (f, a) => f(...a)
|
|
6302
6303
|
});
|
|
6303
|
-
guardedState.set(extension,
|
|
6304
|
+
guardedState.set(extension, import_services12.Invitation.State.TIMEOUT);
|
|
6304
6305
|
} else {
|
|
6305
6306
|
import_log13.log.verbose("auth failed", err, {
|
|
6306
6307
|
F: __dxlog_file22,
|
|
@@ -6328,7 +6329,7 @@ var InvitationsHandler = class {
|
|
|
6328
6329
|
guardedState.complete({
|
|
6329
6330
|
...guardedState.current,
|
|
6330
6331
|
...result,
|
|
6331
|
-
state:
|
|
6332
|
+
state: import_services12.Invitation.State.SUCCESS
|
|
6332
6333
|
});
|
|
6333
6334
|
}
|
|
6334
6335
|
});
|
|
@@ -6352,12 +6353,12 @@ var InvitationsHandler = class {
|
|
|
6352
6353
|
if (guardedState.mutex.isLocked()) {
|
|
6353
6354
|
(0, import_async15.scheduleTask)(ctx, timeoutInactive, timeout);
|
|
6354
6355
|
} else {
|
|
6355
|
-
guardedState.set(null,
|
|
6356
|
+
guardedState.set(null, import_services12.Invitation.State.TIMEOUT);
|
|
6356
6357
|
}
|
|
6357
6358
|
};
|
|
6358
6359
|
(0, import_async15.scheduleTask)(ctx, timeoutInactive, timeout);
|
|
6359
6360
|
await this._joinSwarm(ctx, invitation, import_invitations2.InvitationOptions.Role.GUEST, createExtension);
|
|
6360
|
-
guardedState.set(null,
|
|
6361
|
+
guardedState.set(null, import_services12.Invitation.State.CONNECTING);
|
|
6361
6362
|
}
|
|
6362
6363
|
});
|
|
6363
6364
|
}
|
|
@@ -6365,7 +6366,7 @@ var InvitationsHandler = class {
|
|
|
6365
6366
|
let label;
|
|
6366
6367
|
if (role === import_invitations2.InvitationOptions.Role.GUEST) {
|
|
6367
6368
|
label = "invitation guest";
|
|
6368
|
-
} else if (invitation.kind ===
|
|
6369
|
+
} else if (invitation.kind === import_services12.Invitation.Kind.DEVICE) {
|
|
6369
6370
|
label = "invitation host for device";
|
|
6370
6371
|
} else {
|
|
6371
6372
|
label = `invitation host for space ${invitation.spaceKey?.truncate()}`;
|
|
@@ -6389,7 +6390,7 @@ var InvitationsHandler = class {
|
|
|
6389
6390
|
S: this,
|
|
6390
6391
|
C: (f, a) => f(...a)
|
|
6391
6392
|
});
|
|
6392
|
-
setState(
|
|
6393
|
+
setState(import_services12.Invitation.State.READY_FOR_AUTHENTICATION);
|
|
6393
6394
|
const authCode = await authenticated.wait(options);
|
|
6394
6395
|
(0, import_log13.log)("sending authentication request", void 0, {
|
|
6395
6396
|
F: __dxlog_file22,
|
|
@@ -6397,7 +6398,7 @@ var InvitationsHandler = class {
|
|
|
6397
6398
|
S: this,
|
|
6398
6399
|
C: (f, a) => f(...a)
|
|
6399
6400
|
});
|
|
6400
|
-
setState(
|
|
6401
|
+
setState(import_services12.Invitation.State.AUTHENTICATING);
|
|
6401
6402
|
const response = await extension.rpc.InvitationHostService.authenticate({
|
|
6402
6403
|
authCode
|
|
6403
6404
|
});
|
|
@@ -6489,8 +6490,8 @@ var InvitationsServiceImpl = class {
|
|
|
6489
6490
|
return new import_stream9.Stream(({ next, ctx }) => {
|
|
6490
6491
|
this._invitationsManager.invitationCreated.on(ctx, (invitation) => {
|
|
6491
6492
|
next({
|
|
6492
|
-
action:
|
|
6493
|
-
type:
|
|
6493
|
+
action: import_services17.QueryInvitationsResponse.Action.ADDED,
|
|
6494
|
+
type: import_services17.QueryInvitationsResponse.Type.CREATED,
|
|
6494
6495
|
invitations: [
|
|
6495
6496
|
invitation
|
|
6496
6497
|
]
|
|
@@ -6498,8 +6499,8 @@ var InvitationsServiceImpl = class {
|
|
|
6498
6499
|
});
|
|
6499
6500
|
this._invitationsManager.invitationAccepted.on(ctx, (invitation) => {
|
|
6500
6501
|
next({
|
|
6501
|
-
action:
|
|
6502
|
-
type:
|
|
6502
|
+
action: import_services17.QueryInvitationsResponse.Action.ADDED,
|
|
6503
|
+
type: import_services17.QueryInvitationsResponse.Type.ACCEPTED,
|
|
6503
6504
|
invitations: [
|
|
6504
6505
|
invitation
|
|
6505
6506
|
]
|
|
@@ -6507,8 +6508,8 @@ var InvitationsServiceImpl = class {
|
|
|
6507
6508
|
});
|
|
6508
6509
|
this._invitationsManager.removedCreated.on(ctx, (invitation) => {
|
|
6509
6510
|
next({
|
|
6510
|
-
action:
|
|
6511
|
-
type:
|
|
6511
|
+
action: import_services17.QueryInvitationsResponse.Action.REMOVED,
|
|
6512
|
+
type: import_services17.QueryInvitationsResponse.Type.CREATED,
|
|
6512
6513
|
invitations: [
|
|
6513
6514
|
invitation
|
|
6514
6515
|
]
|
|
@@ -6516,8 +6517,8 @@ var InvitationsServiceImpl = class {
|
|
|
6516
6517
|
});
|
|
6517
6518
|
this._invitationsManager.removedAccepted.on(ctx, (invitation) => {
|
|
6518
6519
|
next({
|
|
6519
|
-
action:
|
|
6520
|
-
type:
|
|
6520
|
+
action: import_services17.QueryInvitationsResponse.Action.REMOVED,
|
|
6521
|
+
type: import_services17.QueryInvitationsResponse.Type.ACCEPTED,
|
|
6521
6522
|
invitations: [
|
|
6522
6523
|
invitation
|
|
6523
6524
|
]
|
|
@@ -6525,29 +6526,29 @@ var InvitationsServiceImpl = class {
|
|
|
6525
6526
|
});
|
|
6526
6527
|
this._invitationsManager.saved.on(ctx, (invitation) => {
|
|
6527
6528
|
next({
|
|
6528
|
-
action:
|
|
6529
|
-
type:
|
|
6529
|
+
action: import_services17.QueryInvitationsResponse.Action.SAVED,
|
|
6530
|
+
type: import_services17.QueryInvitationsResponse.Type.CREATED,
|
|
6530
6531
|
invitations: [
|
|
6531
6532
|
invitation
|
|
6532
6533
|
]
|
|
6533
6534
|
});
|
|
6534
6535
|
});
|
|
6535
6536
|
next({
|
|
6536
|
-
action:
|
|
6537
|
-
type:
|
|
6537
|
+
action: import_services17.QueryInvitationsResponse.Action.ADDED,
|
|
6538
|
+
type: import_services17.QueryInvitationsResponse.Type.CREATED,
|
|
6538
6539
|
invitations: this._invitationsManager.getCreatedInvitations(),
|
|
6539
6540
|
existing: true
|
|
6540
6541
|
});
|
|
6541
6542
|
next({
|
|
6542
|
-
action:
|
|
6543
|
-
type:
|
|
6543
|
+
action: import_services17.QueryInvitationsResponse.Action.ADDED,
|
|
6544
|
+
type: import_services17.QueryInvitationsResponse.Type.ACCEPTED,
|
|
6544
6545
|
invitations: this._invitationsManager.getAcceptedInvitations(),
|
|
6545
6546
|
existing: true
|
|
6546
6547
|
});
|
|
6547
6548
|
this._invitationsManager.onPersistentInvitationsLoaded(ctx, () => {
|
|
6548
6549
|
next({
|
|
6549
|
-
action:
|
|
6550
|
-
type:
|
|
6550
|
+
action: import_services17.QueryInvitationsResponse.Action.LOAD_COMPLETE,
|
|
6551
|
+
type: import_services17.QueryInvitationsResponse.Type.CREATED
|
|
6551
6552
|
});
|
|
6552
6553
|
});
|
|
6553
6554
|
});
|
|
@@ -6602,7 +6603,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6602
6603
|
]
|
|
6603
6604
|
});
|
|
6604
6605
|
return {
|
|
6605
|
-
kind:
|
|
6606
|
+
kind: import_services18.Invitation.Kind.SPACE,
|
|
6606
6607
|
spaceKey: this._spaceKey,
|
|
6607
6608
|
spaceId: space.id
|
|
6608
6609
|
};
|
|
@@ -6661,7 +6662,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6661
6662
|
""
|
|
6662
6663
|
]
|
|
6663
6664
|
});
|
|
6664
|
-
if (invitation.authMethod ===
|
|
6665
|
+
if (invitation.authMethod === import_services18.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
6665
6666
|
(0, import_invariant19.invariant)(invitation.guestKeypair?.publicKey, void 0, {
|
|
6666
6667
|
F: __dxlog_file23,
|
|
6667
6668
|
L: 105,
|
|
@@ -6688,7 +6689,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6688
6689
|
role: invitation.role ?? import_credentials19.SpaceMember.Role.ADMIN,
|
|
6689
6690
|
expiresOn: computeExpirationTime(invitation),
|
|
6690
6691
|
multiUse: invitation.multiUse ?? false,
|
|
6691
|
-
guestKey: invitation.authMethod ===
|
|
6692
|
+
guestKey: invitation.authMethod === import_services18.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
6692
6693
|
});
|
|
6693
6694
|
(0, import_invariant19.invariant)(credential.credential, void 0, {
|
|
6694
6695
|
F: __dxlog_file23,
|
|
@@ -6714,7 +6715,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6714
6715
|
""
|
|
6715
6716
|
]
|
|
6716
6717
|
});
|
|
6717
|
-
(0, import_invariant19.invariant)(invitation.type ===
|
|
6718
|
+
(0, import_invariant19.invariant)(invitation.type === import_services18.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
6718
6719
|
F: __dxlog_file23,
|
|
6719
6720
|
L: 133,
|
|
6720
6721
|
S: this,
|
|
@@ -6994,7 +6995,7 @@ var InvitationsManager = class {
|
|
|
6994
6995
|
if (created.get().persistent) {
|
|
6995
6996
|
await this._metadataStore.removeInvitation(invitationId);
|
|
6996
6997
|
}
|
|
6997
|
-
if (created.get().type ===
|
|
6998
|
+
if (created.get().type === import_services19.Invitation.Type.DELEGATED) {
|
|
6998
6999
|
const handler = this._getHandler(created.get());
|
|
6999
7000
|
await handler.cancelDelegation(created.get());
|
|
7000
7001
|
}
|
|
@@ -7028,8 +7029,8 @@ var InvitationsManager = class {
|
|
|
7028
7029
|
}
|
|
7029
7030
|
}
|
|
7030
7031
|
_createInvitation(protocol, _options) {
|
|
7031
|
-
const { invitationId = import_keys15.PublicKey.random().toHex(), type =
|
|
7032
|
-
const authCode = options?.authCode ?? (authMethod ===
|
|
7032
|
+
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 ?? {};
|
|
7033
|
+
const authCode = options?.authCode ?? (authMethod === import_services19.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials20.generatePasscode)(import_client_protocol6.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
7033
7034
|
return {
|
|
7034
7035
|
invitationId,
|
|
7035
7036
|
type,
|
|
@@ -7038,8 +7039,8 @@ var InvitationsManager = class {
|
|
|
7038
7039
|
swarmKey,
|
|
7039
7040
|
authCode,
|
|
7040
7041
|
timeout,
|
|
7041
|
-
persistent: persistent && type !==
|
|
7042
|
-
guestKeypair: guestKeypair ?? (authMethod ===
|
|
7042
|
+
persistent: persistent && type !== import_services19.Invitation.Type.DELEGATED,
|
|
7043
|
+
guestKeypair: guestKeypair ?? (authMethod === import_services19.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? createAdmissionKeypair() : void 0),
|
|
7043
7044
|
created,
|
|
7044
7045
|
lifetime,
|
|
7045
7046
|
role,
|
|
@@ -7077,7 +7078,7 @@ var InvitationsManager = class {
|
|
|
7077
7078
|
onCancel: async () => {
|
|
7078
7079
|
stream.next({
|
|
7079
7080
|
...invitation,
|
|
7080
|
-
state:
|
|
7081
|
+
state: import_services19.Invitation.State.CANCELLED
|
|
7081
7082
|
});
|
|
7082
7083
|
await ctx.dispose();
|
|
7083
7084
|
}
|
|
@@ -7104,7 +7105,7 @@ var InvitationsManager = class {
|
|
|
7104
7105
|
});
|
|
7105
7106
|
stream.next({
|
|
7106
7107
|
...initialState,
|
|
7107
|
-
state:
|
|
7108
|
+
state: import_services19.Invitation.State.TIMEOUT
|
|
7108
7109
|
});
|
|
7109
7110
|
} else {
|
|
7110
7111
|
import_log20.log.warn("auth failed", err, {
|
|
@@ -7115,7 +7116,7 @@ var InvitationsManager = class {
|
|
|
7115
7116
|
});
|
|
7116
7117
|
stream.next({
|
|
7117
7118
|
...initialState,
|
|
7118
|
-
state:
|
|
7119
|
+
state: import_services19.Invitation.State.ERROR
|
|
7119
7120
|
});
|
|
7120
7121
|
}
|
|
7121
7122
|
void ctx.dispose();
|
|
@@ -7141,7 +7142,7 @@ var InvitationsManager = class {
|
|
|
7141
7142
|
onCancel: async () => {
|
|
7142
7143
|
stream.next({
|
|
7143
7144
|
...initialState,
|
|
7144
|
-
state:
|
|
7145
|
+
state: import_services19.Invitation.State.CANCELLED
|
|
7145
7146
|
});
|
|
7146
7147
|
await ctx.dispose();
|
|
7147
7148
|
},
|
|
@@ -7157,7 +7158,7 @@ var InvitationsManager = class {
|
|
|
7157
7158
|
};
|
|
7158
7159
|
}
|
|
7159
7160
|
async _persistIfRequired(handler, changeStream, invitation) {
|
|
7160
|
-
if (invitation.type ===
|
|
7161
|
+
if (invitation.type === import_services19.Invitation.Type.DELEGATED && invitation.delegationCredentialId == null) {
|
|
7161
7162
|
const delegationCredentialId = await handler.delegate(invitation);
|
|
7162
7163
|
changeStream.next({
|
|
7163
7164
|
...invitation,
|
|
@@ -7494,8 +7495,8 @@ var EdgeAgentManager = class extends import_context16.Resource {
|
|
|
7494
7495
|
continue;
|
|
7495
7496
|
}
|
|
7496
7497
|
if ([
|
|
7497
|
-
|
|
7498
|
-
|
|
7498
|
+
import_services20.SpaceState.SPACE_INACTIVE,
|
|
7499
|
+
import_services20.SpaceState.SPACE_CLOSED
|
|
7499
7500
|
].includes(space.state)) {
|
|
7500
7501
|
space.notarizationPlugin.setActiveEdgePollingEnabled(false);
|
|
7501
7502
|
continue;
|
|
@@ -7544,22 +7545,16 @@ var EdgeAgentServiceImpl = class {
|
|
|
7544
7545
|
this._agentManagerProvider = _agentManagerProvider;
|
|
7545
7546
|
this._edgeConnection = _edgeConnection;
|
|
7546
7547
|
}
|
|
7548
|
+
// TODO(mykola): Reconcile with NetworkService.queryStatus.
|
|
7547
7549
|
queryEdgeStatus() {
|
|
7548
7550
|
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
|
-
);
|
|
7551
|
+
const update = () => {
|
|
7552
|
+
next({
|
|
7553
|
+
status: this._edgeConnection?.status ?? import_services21.EdgeStatus.NOT_CONNECTED
|
|
7554
|
+
});
|
|
7555
|
+
};
|
|
7556
|
+
this._edgeConnection?.statusChanged.on(ctx, update);
|
|
7557
|
+
update();
|
|
7563
7558
|
});
|
|
7564
7559
|
}
|
|
7565
7560
|
async createAgent() {
|
|
@@ -7568,7 +7563,7 @@ var EdgeAgentServiceImpl = class {
|
|
|
7568
7563
|
queryAgentStatus() {
|
|
7569
7564
|
return new import_stream10.Stream(({ ctx, next }) => {
|
|
7570
7565
|
next({
|
|
7571
|
-
status:
|
|
7566
|
+
status: import_services21.QueryAgentStatusResponse.AgentStatus.UNKNOWN
|
|
7572
7567
|
});
|
|
7573
7568
|
void this._agentManagerProvider().then((agentManager) => {
|
|
7574
7569
|
next({
|
|
@@ -7586,13 +7581,13 @@ var EdgeAgentServiceImpl = class {
|
|
|
7586
7581
|
var mapStatus = (agentStatus) => {
|
|
7587
7582
|
switch (agentStatus) {
|
|
7588
7583
|
case import_protocols17.EdgeAgentStatus.ACTIVE:
|
|
7589
|
-
return
|
|
7584
|
+
return import_services21.QueryAgentStatusResponse.AgentStatus.ACTIVE;
|
|
7590
7585
|
case import_protocols17.EdgeAgentStatus.INACTIVE:
|
|
7591
|
-
return
|
|
7586
|
+
return import_services21.QueryAgentStatusResponse.AgentStatus.INACTIVE;
|
|
7592
7587
|
case import_protocols17.EdgeAgentStatus.NOT_FOUND:
|
|
7593
|
-
return
|
|
7588
|
+
return import_services21.QueryAgentStatusResponse.AgentStatus.NOT_FOUND;
|
|
7594
7589
|
case void 0:
|
|
7595
|
-
return
|
|
7590
|
+
return import_services21.QueryAgentStatusResponse.AgentStatus.UNKNOWN;
|
|
7596
7591
|
}
|
|
7597
7592
|
};
|
|
7598
7593
|
var __dxlog_file27 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-recovery-manager.ts";
|
|
@@ -7926,7 +7921,7 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
7926
7921
|
this._meshReplicator = new import_echo_pipeline4.MeshEchoReplicator();
|
|
7927
7922
|
this.invitations = new InvitationsHandler(this.networkManager, this._edgeHttpClient, _runtimeParams?.invitationConnectionDefaultParams);
|
|
7928
7923
|
this.invitationsManager = new InvitationsManager(this.invitations, (invitation) => this.getInvitationHandler(invitation), this.metadataStore);
|
|
7929
|
-
this._handlerFactories.set(
|
|
7924
|
+
this._handlerFactories.set(import_services22.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug5.failUndefined)(), this._acceptIdentity.bind(this)));
|
|
7930
7925
|
if (!this._runtimeParams?.disableP2pReplication) {
|
|
7931
7926
|
this._meshReplicator = new import_echo_pipeline4.MeshEchoReplicator();
|
|
7932
7927
|
}
|
|
@@ -8032,7 +8027,7 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
8032
8027
|
return identity;
|
|
8033
8028
|
}
|
|
8034
8029
|
getInvitationHandler(invitation) {
|
|
8035
|
-
if (this.identityManager.identity == null && invitation.kind ===
|
|
8030
|
+
if (this.identityManager.identity == null && invitation.kind === import_services22.Invitation.Kind.SPACE) {
|
|
8036
8031
|
throw new Error("Identity must be created before joining a space.");
|
|
8037
8032
|
}
|
|
8038
8033
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
@@ -8114,7 +8109,7 @@ var ServiceContext = class extends import_context17.Resource {
|
|
|
8114
8109
|
await this.dataSpaceManager.open();
|
|
8115
8110
|
this.edgeAgentManager = new EdgeAgentManager(this._edgeFeatures, this._edgeHttpClient, this.dataSpaceManager, identity);
|
|
8116
8111
|
await this.edgeAgentManager.open();
|
|
8117
|
-
this._handlerFactories.set(
|
|
8112
|
+
this._handlerFactories.set(import_services22.Invitation.Kind.SPACE, (invitation) => {
|
|
8118
8113
|
(0, import_invariant23.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
8119
8114
|
F: __dxlog_file28,
|
|
8120
8115
|
L: 339,
|
|
@@ -8495,7 +8490,7 @@ var DevicesServiceImpl = class {
|
|
|
8495
8490
|
} else {
|
|
8496
8491
|
(0, import_invariant27.invariant)(this._identityManager.identity?.presence, "presence not present", {
|
|
8497
8492
|
F: __dxlog_file30,
|
|
8498
|
-
L:
|
|
8493
|
+
L: 37,
|
|
8499
8494
|
S: this,
|
|
8500
8495
|
A: [
|
|
8501
8496
|
"this._identityManager.identity?.presence",
|
|
@@ -8508,15 +8503,15 @@ var DevicesServiceImpl = class {
|
|
|
8508
8503
|
const isMe = this._identityManager.identity?.deviceKey.equals(key);
|
|
8509
8504
|
let presence;
|
|
8510
8505
|
if (isMe) {
|
|
8511
|
-
presence =
|
|
8506
|
+
presence = import_services24.Device.PresenceState.ONLINE;
|
|
8512
8507
|
} else if (profile.os?.toUpperCase() === "EDGE") {
|
|
8513
|
-
presence = this._edgeConnection?.
|
|
8508
|
+
presence = this._edgeConnection?.status === import_services24.EdgeStatus.CONNECTED ? import_services24.Device.PresenceState.ONLINE : import_services24.Device.PresenceState.OFFLINE;
|
|
8514
8509
|
} else {
|
|
8515
|
-
presence = peers.some((peer) => peer.identityKey.equals(key)) ?
|
|
8510
|
+
presence = peers.some((peer) => peer.identityKey.equals(key)) ? import_services24.Device.PresenceState.ONLINE : import_services24.Device.PresenceState.OFFLINE;
|
|
8516
8511
|
}
|
|
8517
8512
|
return {
|
|
8518
8513
|
deviceKey: key,
|
|
8519
|
-
kind: this._identityManager.identity?.deviceKey.equals(key) ?
|
|
8514
|
+
kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services24.DeviceKind.CURRENT : import_services24.DeviceKind.TRUSTED,
|
|
8520
8515
|
profile,
|
|
8521
8516
|
presence
|
|
8522
8517
|
};
|
|
@@ -8737,28 +8732,29 @@ var LoggingServiceImpl = class {
|
|
|
8737
8732
|
};
|
|
8738
8733
|
var matchFilter = (filter, level, path2, options) => {
|
|
8739
8734
|
switch (options) {
|
|
8740
|
-
case
|
|
8735
|
+
case import_services25.QueryLogsRequest.MatchingOptions.INCLUSIVE:
|
|
8741
8736
|
return level >= filter.level && (!filter.pattern || path2.includes(filter.pattern));
|
|
8742
|
-
case
|
|
8737
|
+
case import_services25.QueryLogsRequest.MatchingOptions.EXPLICIT:
|
|
8743
8738
|
return level === filter.level && (!filter.pattern || path2.includes(filter.pattern));
|
|
8744
8739
|
}
|
|
8745
8740
|
};
|
|
8746
8741
|
var shouldLog = (entry2, request) => {
|
|
8747
|
-
const options = request.options ??
|
|
8742
|
+
const options = request.options ?? import_services25.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
8748
8743
|
if (request.filters === void 0) {
|
|
8749
|
-
return options ===
|
|
8744
|
+
return options === import_services25.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
8750
8745
|
} else {
|
|
8751
8746
|
return request.filters.some((filter) => matchFilter(filter, entry2.level, entry2.meta?.F ?? "", options));
|
|
8752
8747
|
}
|
|
8753
8748
|
};
|
|
8754
8749
|
var LOG_PROCESSING = 0;
|
|
8755
8750
|
var NetworkServiceImpl = class {
|
|
8756
|
-
constructor(networkManager, signalManager) {
|
|
8751
|
+
constructor(networkManager, signalManager, edgeConnection) {
|
|
8757
8752
|
this.networkManager = networkManager;
|
|
8758
8753
|
this.signalManager = signalManager;
|
|
8754
|
+
this.edgeConnection = edgeConnection;
|
|
8759
8755
|
}
|
|
8760
8756
|
queryStatus() {
|
|
8761
|
-
return new import_stream14.Stream(({ next }) => {
|
|
8757
|
+
return new import_stream14.Stream(({ ctx, next }) => {
|
|
8762
8758
|
const update = () => {
|
|
8763
8759
|
next({
|
|
8764
8760
|
swarm: this.networkManager.connectionState,
|
|
@@ -8769,13 +8765,9 @@ var NetworkServiceImpl = class {
|
|
|
8769
8765
|
}))
|
|
8770
8766
|
});
|
|
8771
8767
|
};
|
|
8772
|
-
|
|
8773
|
-
|
|
8768
|
+
this.networkManager.connectionStateChanged.on(ctx, () => update());
|
|
8769
|
+
this.signalManager.statusChanged?.on(ctx, () => update());
|
|
8774
8770
|
update();
|
|
8775
|
-
return () => {
|
|
8776
|
-
unsubscribeSwarm();
|
|
8777
|
-
unsubscribeSignal?.();
|
|
8778
|
-
};
|
|
8779
8771
|
});
|
|
8780
8772
|
}
|
|
8781
8773
|
async updateConfig(request) {
|
|
@@ -8791,26 +8783,24 @@ var NetworkServiceImpl = class {
|
|
|
8791
8783
|
return this.signalManager.query(request);
|
|
8792
8784
|
}
|
|
8793
8785
|
subscribeSwarmState(request) {
|
|
8794
|
-
return new import_stream14.Stream(({ next }) => {
|
|
8795
|
-
|
|
8786
|
+
return new import_stream14.Stream(({ ctx, next }) => {
|
|
8787
|
+
this.signalManager.swarmState?.on(ctx, (state) => {
|
|
8796
8788
|
if (request.topic.equals(state.swarmKey)) {
|
|
8797
8789
|
next(state);
|
|
8798
8790
|
}
|
|
8799
8791
|
});
|
|
8800
|
-
return unsubscribe;
|
|
8801
8792
|
});
|
|
8802
8793
|
}
|
|
8803
8794
|
async sendMessage(message) {
|
|
8804
8795
|
return this.signalManager.sendMessage(message);
|
|
8805
8796
|
}
|
|
8806
8797
|
subscribeMessages(peer) {
|
|
8807
|
-
return new import_stream14.Stream(({ next }) => {
|
|
8808
|
-
|
|
8798
|
+
return new import_stream14.Stream(({ ctx, next }) => {
|
|
8799
|
+
this.signalManager.onMessage.on(ctx, (message) => {
|
|
8809
8800
|
if (message.recipient.peerKey === peer.peerKey) {
|
|
8810
8801
|
next(message);
|
|
8811
8802
|
}
|
|
8812
8803
|
});
|
|
8813
|
-
return unsubscribe;
|
|
8814
8804
|
});
|
|
8815
8805
|
}
|
|
8816
8806
|
};
|
|
@@ -8834,8 +8824,8 @@ var SystemServiceImpl = class {
|
|
|
8834
8824
|
return {
|
|
8835
8825
|
timestamp: /* @__PURE__ */ new Date(),
|
|
8836
8826
|
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util17.jsonKeyReplacer)({
|
|
8837
|
-
truncate: keys ===
|
|
8838
|
-
humanize: keys ===
|
|
8827
|
+
truncate: keys === import_services26.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
|
|
8828
|
+
humanize: keys === import_services26.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
|
|
8839
8829
|
})))
|
|
8840
8830
|
};
|
|
8841
8831
|
}
|
|
@@ -8923,14 +8913,14 @@ var ClientServicesHost = class {
|
|
|
8923
8913
|
this._systemService = new SystemServiceImpl({
|
|
8924
8914
|
config: () => this._config,
|
|
8925
8915
|
statusUpdate: this._statusUpdate,
|
|
8926
|
-
getCurrentStatus: () => this.isOpen && !this._resetting ?
|
|
8916
|
+
getCurrentStatus: () => this.isOpen && !this._resetting ? import_services23.SystemStatus.ACTIVE : import_services23.SystemStatus.INACTIVE,
|
|
8927
8917
|
getDiagnostics: () => {
|
|
8928
8918
|
return createDiagnostics(this._serviceRegistry.services, this._serviceContext, this._config);
|
|
8929
8919
|
},
|
|
8930
8920
|
onUpdateStatus: async (status) => {
|
|
8931
|
-
if (!this.isOpen && status ===
|
|
8921
|
+
if (!this.isOpen && status === import_services23.SystemStatus.ACTIVE) {
|
|
8932
8922
|
await this._resourceLock?.acquire();
|
|
8933
|
-
} else if (this.isOpen && status ===
|
|
8923
|
+
} else if (this.isOpen && status === import_services23.SystemStatus.INACTIVE) {
|
|
8934
8924
|
await this._resourceLock?.release();
|
|
8935
8925
|
}
|
|
8936
8926
|
},
|
|
@@ -9128,7 +9118,7 @@ var ClientServicesHost = class {
|
|
|
9128
9118
|
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
9129
9119
|
DataService: this._serviceContext.echoHost.dataService,
|
|
9130
9120
|
QueryService: this._serviceContext.echoHost.queryService,
|
|
9131
|
-
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
|
|
9121
|
+
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager, this._edgeConnection),
|
|
9132
9122
|
LoggingService: this._loggingService,
|
|
9133
9123
|
TracingService: this._tracingService,
|
|
9134
9124
|
// TODO(burdon): Move to new protobuf definitions.
|
|
@@ -9160,7 +9150,7 @@ var ClientServicesHost = class {
|
|
|
9160
9150
|
deviceKey
|
|
9161
9151
|
}, {
|
|
9162
9152
|
F: __dxlog_file31,
|
|
9163
|
-
L:
|
|
9153
|
+
L: 370,
|
|
9164
9154
|
S: this,
|
|
9165
9155
|
C: (f, a) => f(...a)
|
|
9166
9156
|
});
|
|
@@ -9168,7 +9158,7 @@ var ClientServicesHost = class {
|
|
|
9168
9158
|
id: traceId
|
|
9169
9159
|
}), {
|
|
9170
9160
|
F: __dxlog_file31,
|
|
9171
|
-
L:
|
|
9161
|
+
L: 371,
|
|
9172
9162
|
S: this,
|
|
9173
9163
|
C: (f, a) => f(...a)
|
|
9174
9164
|
});
|
|
@@ -9182,7 +9172,7 @@ var ClientServicesHost = class {
|
|
|
9182
9172
|
deviceKey
|
|
9183
9173
|
}, {
|
|
9184
9174
|
F: __dxlog_file31,
|
|
9185
|
-
L:
|
|
9175
|
+
L: 382,
|
|
9186
9176
|
S: this,
|
|
9187
9177
|
C: (f, a) => f(...a)
|
|
9188
9178
|
});
|
|
@@ -9200,7 +9190,7 @@ var ClientServicesHost = class {
|
|
|
9200
9190
|
deviceKey
|
|
9201
9191
|
}, {
|
|
9202
9192
|
F: __dxlog_file31,
|
|
9203
|
-
L:
|
|
9193
|
+
L: 391,
|
|
9204
9194
|
S: this,
|
|
9205
9195
|
C: (f, a) => f(...a)
|
|
9206
9196
|
});
|
|
@@ -9211,13 +9201,13 @@ var ClientServicesHost = class {
|
|
|
9211
9201
|
id: traceId
|
|
9212
9202
|
}), {
|
|
9213
9203
|
F: __dxlog_file31,
|
|
9214
|
-
L:
|
|
9204
|
+
L: 396,
|
|
9215
9205
|
S: this,
|
|
9216
9206
|
C: (f, a) => f(...a)
|
|
9217
9207
|
});
|
|
9218
9208
|
import_log26.log.info("resetting...", void 0, {
|
|
9219
9209
|
F: __dxlog_file31,
|
|
9220
|
-
L:
|
|
9210
|
+
L: 398,
|
|
9221
9211
|
S: this,
|
|
9222
9212
|
C: (f, a) => f(...a)
|
|
9223
9213
|
});
|
|
@@ -9227,7 +9217,7 @@ var ClientServicesHost = class {
|
|
|
9227
9217
|
await this._storage.reset();
|
|
9228
9218
|
import_log26.log.info("reset", void 0, {
|
|
9229
9219
|
F: __dxlog_file31,
|
|
9230
|
-
L:
|
|
9220
|
+
L: 405,
|
|
9231
9221
|
S: this,
|
|
9232
9222
|
C: (f, a) => f(...a)
|
|
9233
9223
|
});
|
|
@@ -9235,7 +9225,7 @@ var ClientServicesHost = class {
|
|
|
9235
9225
|
id: traceId
|
|
9236
9226
|
}), {
|
|
9237
9227
|
F: __dxlog_file31,
|
|
9238
|
-
L:
|
|
9228
|
+
L: 406,
|
|
9239
9229
|
S: this,
|
|
9240
9230
|
C: (f, a) => f(...a)
|
|
9241
9231
|
});
|
|
@@ -9313,4 +9303,4 @@ ClientServicesHost = _ts_decorate11([
|
|
|
9313
9303
|
subscribeToSpaces,
|
|
9314
9304
|
subscribeToSwarmInfo
|
|
9315
9305
|
});
|
|
9316
|
-
//# sourceMappingURL=chunk-
|
|
9306
|
+
//# sourceMappingURL=chunk-OU5KJSPA.cjs.map
|