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