@dxos/client-services 0.6.9 → 0.6.10-main.48c066e
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-67XXCVHL.mjs → chunk-ADTM2VNF.mjs} +623 -584
- package/dist/lib/browser/chunk-ADTM2VNF.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 +7 -8
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-WTK4Q3EG.cjs → chunk-4Y7QCEWZ.cjs} +669 -630
- package/dist/lib/node/chunk-4Y7QCEWZ.cjs.map +7 -0
- package/dist/lib/node/index.cjs +45 -45
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +13 -14
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/devtools/feeds.d.ts +3 -1
- package/dist/types/src/packlets/devtools/feeds.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-guest-extenstion.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +2 -4
- package/dist/types/src/packlets/testing/test-builder.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 +37 -37
- package/src/packlets/devtools/devtools.ts +1 -1
- package/src/packlets/devtools/feeds.ts +37 -4
- package/src/packlets/identity/authenticator.ts +1 -1
- package/src/packlets/invitations/invitation-guest-extenstion.ts +2 -1
- package/src/packlets/invitations/invitation-host-extension.ts +2 -1
- package/src/packlets/services/service-context.ts +3 -3
- package/src/packlets/services/service-host.ts +4 -5
- package/src/packlets/services/service-registry.test.ts +1 -1
- package/src/packlets/spaces/edge-feed-replicator.ts +2 -2
- package/src/packlets/spaces/notarization-plugin.ts +1 -1
- package/src/packlets/testing/test-builder.ts +3 -10
- package/src/version.ts +1 -5
- package/dist/lib/browser/chunk-67XXCVHL.mjs.map +0 -7
- package/dist/lib/node/chunk-WTK4Q3EG.cjs.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_4Y7QCEWZ_exports = {};
|
|
30
|
+
__export(chunk_4Y7QCEWZ_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -70,11 +70,12 @@ __export(chunk_WTK4Q3EG_exports, {
|
|
|
70
70
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
71
71
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
72
72
|
});
|
|
73
|
-
module.exports = __toCommonJS(
|
|
73
|
+
module.exports = __toCommonJS(chunk_4Y7QCEWZ_exports);
|
|
74
74
|
var import_async = require("@dxos/async");
|
|
75
75
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
76
76
|
var import_feed_store = require("@dxos/feed-store");
|
|
77
77
|
var import_keys = require("@dxos/keys");
|
|
78
|
+
var import_log = require("@dxos/log");
|
|
78
79
|
var import_util = require("@dxos/util");
|
|
79
80
|
var import_codec_protobuf2 = require("@dxos/codec-protobuf");
|
|
80
81
|
var import_context = require("@dxos/context");
|
|
@@ -101,30 +102,30 @@ var import_util2 = require("@dxos/util");
|
|
|
101
102
|
var import_async5 = require("@dxos/async");
|
|
102
103
|
var import_context2 = require("@dxos/context");
|
|
103
104
|
var import_credentials2 = require("@dxos/credentials");
|
|
104
|
-
var
|
|
105
|
-
var
|
|
105
|
+
var import_log2 = require("@dxos/log");
|
|
106
|
+
var import_proto = require("@dxos/protocols/proto");
|
|
106
107
|
var import_async6 = require("@dxos/async");
|
|
107
108
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
108
109
|
var import_credentials3 = require("@dxos/credentials");
|
|
109
110
|
var import_feed_store2 = require("@dxos/feed-store");
|
|
110
111
|
var import_invariant2 = require("@dxos/invariant");
|
|
111
112
|
var import_keys3 = require("@dxos/keys");
|
|
112
|
-
var
|
|
113
|
+
var import_log3 = require("@dxos/log");
|
|
113
114
|
var import_credentials4 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
114
115
|
var import_timeframe = require("@dxos/timeframe");
|
|
115
116
|
var import_tracing3 = require("@dxos/tracing");
|
|
116
117
|
var import_util3 = require("@dxos/util");
|
|
117
118
|
var import_credentials5 = require("@dxos/credentials");
|
|
118
119
|
var import_keys4 = require("@dxos/keys");
|
|
119
|
-
var
|
|
120
|
+
var import_log4 = require("@dxos/log");
|
|
120
121
|
var import_platform = __toESM(require("platform"));
|
|
121
122
|
var import_async7 = require("@dxos/async");
|
|
122
123
|
var import_context3 = require("@dxos/context");
|
|
123
124
|
var import_credentials6 = require("@dxos/credentials");
|
|
124
125
|
var import_invariant3 = require("@dxos/invariant");
|
|
125
126
|
var import_keys5 = require("@dxos/keys");
|
|
126
|
-
var
|
|
127
|
-
var
|
|
127
|
+
var import_log5 = require("@dxos/log");
|
|
128
|
+
var import_protocols2 = require("@dxos/protocols");
|
|
128
129
|
var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
|
|
129
130
|
var import_credentials7 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
130
131
|
var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
|
|
@@ -137,11 +138,11 @@ var import_context4 = require("@dxos/context");
|
|
|
137
138
|
var import_credentials8 = require("@dxos/credentials");
|
|
138
139
|
var import_debug = require("@dxos/debug");
|
|
139
140
|
var import_invariant4 = require("@dxos/invariant");
|
|
140
|
-
var
|
|
141
|
+
var import_log6 = require("@dxos/log");
|
|
141
142
|
var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
|
|
142
143
|
var import_util5 = require("@dxos/util");
|
|
143
144
|
var import_invariant5 = require("@dxos/invariant");
|
|
144
|
-
var
|
|
145
|
+
var import_protocols3 = require("@dxos/protocols");
|
|
145
146
|
var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
|
|
146
147
|
var import_async9 = require("@dxos/async");
|
|
147
148
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
@@ -149,9 +150,9 @@ var import_context5 = require("@dxos/context");
|
|
|
149
150
|
var import_crypto = require("@dxos/crypto");
|
|
150
151
|
var import_invariant6 = require("@dxos/invariant");
|
|
151
152
|
var import_keys6 = require("@dxos/keys");
|
|
152
|
-
var
|
|
153
|
+
var import_log7 = require("@dxos/log");
|
|
153
154
|
var import_network_manager = require("@dxos/network-manager");
|
|
154
|
-
var
|
|
155
|
+
var import_protocols4 = require("@dxos/protocols");
|
|
155
156
|
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
156
157
|
var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
157
158
|
var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
@@ -160,8 +161,9 @@ var import_util6 = require("@dxos/util");
|
|
|
160
161
|
var import_async10 = require("@dxos/async");
|
|
161
162
|
var import_context6 = require("@dxos/context");
|
|
162
163
|
var import_invariant7 = require("@dxos/invariant");
|
|
163
|
-
var
|
|
164
|
-
var
|
|
164
|
+
var import_log8 = require("@dxos/log");
|
|
165
|
+
var import_protocols5 = require("@dxos/protocols");
|
|
166
|
+
var import_proto2 = require("@dxos/protocols/proto");
|
|
165
167
|
var import_invitations3 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
166
168
|
var import_teleport = require("@dxos/teleport");
|
|
167
169
|
var import_context7 = require("@dxos/context");
|
|
@@ -171,14 +173,15 @@ var import_context8 = require("@dxos/context");
|
|
|
171
173
|
var import_crypto2 = require("@dxos/crypto");
|
|
172
174
|
var import_invariant8 = require("@dxos/invariant");
|
|
173
175
|
var import_keys7 = require("@dxos/keys");
|
|
174
|
-
var
|
|
175
|
-
var
|
|
176
|
+
var import_log9 = require("@dxos/log");
|
|
177
|
+
var import_protocols6 = require("@dxos/protocols");
|
|
178
|
+
var import_proto3 = require("@dxos/protocols/proto");
|
|
176
179
|
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
177
180
|
var import_invitations4 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
178
181
|
var import_teleport2 = require("@dxos/teleport");
|
|
179
182
|
var import_invariant9 = require("@dxos/invariant");
|
|
180
183
|
var import_keys8 = require("@dxos/keys");
|
|
181
|
-
var
|
|
184
|
+
var import_log10 = require("@dxos/log");
|
|
182
185
|
var import_invitations5 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
183
186
|
var import_util7 = require("@dxos/util");
|
|
184
187
|
var import_codec_protobuf9 = require("@dxos/codec-protobuf");
|
|
@@ -186,8 +189,8 @@ var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
186
189
|
var import_credentials9 = require("@dxos/credentials");
|
|
187
190
|
var import_feed_store3 = require("@dxos/feed-store");
|
|
188
191
|
var import_invariant10 = require("@dxos/invariant");
|
|
189
|
-
var
|
|
190
|
-
var
|
|
192
|
+
var import_log11 = require("@dxos/log");
|
|
193
|
+
var import_protocols7 = require("@dxos/protocols");
|
|
191
194
|
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
192
195
|
var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
193
196
|
var import_async12 = require("@dxos/async");
|
|
@@ -197,12 +200,12 @@ var import_credentials11 = require("@dxos/credentials");
|
|
|
197
200
|
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
198
201
|
var import_invariant11 = require("@dxos/invariant");
|
|
199
202
|
var import_keys9 = require("@dxos/keys");
|
|
200
|
-
var
|
|
203
|
+
var import_log12 = require("@dxos/log");
|
|
201
204
|
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
202
205
|
var import_credentials12 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
203
206
|
var import_invariant12 = require("@dxos/invariant");
|
|
204
207
|
var import_lock_file = require("@dxos/lock-file");
|
|
205
|
-
var
|
|
208
|
+
var import_log13 = require("@dxos/log");
|
|
206
209
|
var import_codec_protobuf10 = require("@dxos/codec-protobuf");
|
|
207
210
|
var import_debug2 = require("@dxos/debug");
|
|
208
211
|
var import_rpc = require("@dxos/rpc");
|
|
@@ -212,8 +215,8 @@ var import_async13 = require("@dxos/async");
|
|
|
212
215
|
var import_context10 = require("@dxos/context");
|
|
213
216
|
var import_invariant13 = require("@dxos/invariant");
|
|
214
217
|
var import_keys10 = require("@dxos/keys");
|
|
215
|
-
var
|
|
216
|
-
var
|
|
218
|
+
var import_log14 = require("@dxos/log");
|
|
219
|
+
var import_protocols8 = require("@dxos/protocols");
|
|
217
220
|
var import_buf = require("@dxos/protocols/buf");
|
|
218
221
|
var import_messenger_pb = require("@dxos/protocols/buf/dxos/edge/messenger_pb");
|
|
219
222
|
var import_util8 = require("@dxos/util");
|
|
@@ -225,8 +228,8 @@ var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
|
225
228
|
var import_echo_protocol = require("@dxos/echo-protocol");
|
|
226
229
|
var import_invariant14 = require("@dxos/invariant");
|
|
227
230
|
var import_keys11 = require("@dxos/keys");
|
|
228
|
-
var
|
|
229
|
-
var
|
|
231
|
+
var import_log15 = require("@dxos/log");
|
|
232
|
+
var import_protocols9 = require("@dxos/protocols");
|
|
230
233
|
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
231
234
|
var import_credentials13 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
232
235
|
var import_timeframe3 = require("@dxos/timeframe");
|
|
@@ -239,14 +242,14 @@ var import_echo_db = require("@dxos/echo-db");
|
|
|
239
242
|
var import_echo_protocol2 = require("@dxos/echo-protocol");
|
|
240
243
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
241
244
|
var import_invariant15 = require("@dxos/invariant");
|
|
242
|
-
var
|
|
245
|
+
var import_log16 = require("@dxos/log");
|
|
243
246
|
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
244
247
|
var import_async16 = require("@dxos/async");
|
|
245
248
|
var import_context13 = require("@dxos/context");
|
|
246
249
|
var import_invariant16 = require("@dxos/invariant");
|
|
247
250
|
var import_keys12 = require("@dxos/keys");
|
|
248
|
-
var
|
|
249
|
-
var
|
|
251
|
+
var import_log17 = require("@dxos/log");
|
|
252
|
+
var import_proto4 = require("@dxos/protocols/proto");
|
|
250
253
|
var import_teleport3 = require("@dxos/teleport");
|
|
251
254
|
var import_util10 = require("@dxos/util");
|
|
252
255
|
var import_async17 = require("@dxos/async");
|
|
@@ -260,8 +263,8 @@ var import_echo_schema2 = require("@dxos/echo-schema");
|
|
|
260
263
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
261
264
|
var import_invariant17 = require("@dxos/invariant");
|
|
262
265
|
var import_keys13 = require("@dxos/keys");
|
|
263
|
-
var
|
|
264
|
-
var
|
|
266
|
+
var import_log18 = require("@dxos/log");
|
|
267
|
+
var import_protocols10 = require("@dxos/protocols");
|
|
265
268
|
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
266
269
|
var import_credentials16 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
267
270
|
var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
|
|
@@ -277,8 +280,8 @@ var import_credentials19 = require("@dxos/credentials");
|
|
|
277
280
|
var import_debug5 = require("@dxos/debug");
|
|
278
281
|
var import_feed_store5 = require("@dxos/feed-store");
|
|
279
282
|
var import_invariant18 = require("@dxos/invariant");
|
|
280
|
-
var
|
|
281
|
-
var
|
|
283
|
+
var import_log19 = require("@dxos/log");
|
|
284
|
+
var import_protocols11 = require("@dxos/protocols");
|
|
282
285
|
var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
|
|
283
286
|
var import_tracing9 = require("@dxos/tracing");
|
|
284
287
|
var import_async19 = require("@dxos/async");
|
|
@@ -291,13 +294,13 @@ var import_feed_store6 = require("@dxos/feed-store");
|
|
|
291
294
|
var import_invariant19 = require("@dxos/invariant");
|
|
292
295
|
var import_keyring = require("@dxos/keyring");
|
|
293
296
|
var import_keys14 = require("@dxos/keys");
|
|
294
|
-
var
|
|
295
|
-
var
|
|
297
|
+
var import_log20 = require("@dxos/log");
|
|
298
|
+
var import_protocols12 = require("@dxos/protocols");
|
|
296
299
|
var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
|
|
297
300
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
298
301
|
var import_tracing10 = require("@dxos/tracing");
|
|
299
302
|
var import_util12 = require("@dxos/util");
|
|
300
|
-
var
|
|
303
|
+
var import_protocols13 = require("@dxos/protocols");
|
|
301
304
|
var import_config2 = require("@dxos/protocols/proto/dxos/config");
|
|
302
305
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
303
306
|
var import_client_protocol7 = require("@dxos/client-protocol");
|
|
@@ -308,8 +311,8 @@ var import_keys15 = require("@dxos/keys");
|
|
|
308
311
|
var import_kv_store = require("@dxos/kv-store");
|
|
309
312
|
var import_automerge_repo = require("@dxos/automerge/automerge-repo");
|
|
310
313
|
var import_invariant20 = require("@dxos/invariant");
|
|
311
|
-
var
|
|
312
|
-
var
|
|
314
|
+
var import_log21 = require("@dxos/log");
|
|
315
|
+
var import_protocols14 = require("@dxos/protocols");
|
|
313
316
|
var import_util14 = require("@dxos/util");
|
|
314
317
|
var import_async20 = require("@dxos/async");
|
|
315
318
|
var import_client_protocol8 = require("@dxos/client-protocol");
|
|
@@ -317,10 +320,10 @@ var import_context16 = require("@dxos/context");
|
|
|
317
320
|
var import_edge_client = require("@dxos/edge-client");
|
|
318
321
|
var import_invariant21 = require("@dxos/invariant");
|
|
319
322
|
var import_keys16 = require("@dxos/keys");
|
|
320
|
-
var
|
|
323
|
+
var import_log22 = require("@dxos/log");
|
|
321
324
|
var import_messaging = require("@dxos/messaging");
|
|
322
325
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
323
|
-
var
|
|
326
|
+
var import_protocols15 = require("@dxos/protocols");
|
|
324
327
|
var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
|
|
325
328
|
var import_tracing11 = require("@dxos/tracing");
|
|
326
329
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
@@ -335,14 +338,15 @@ var import_util15 = require("@dxos/util");
|
|
|
335
338
|
var import_async23 = require("@dxos/async");
|
|
336
339
|
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
337
340
|
var import_keys18 = require("@dxos/keys");
|
|
338
|
-
var
|
|
341
|
+
var import_log23 = require("@dxos/log");
|
|
339
342
|
var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
|
|
340
343
|
var import_util16 = require("@dxos/util");
|
|
341
344
|
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
342
345
|
var import_codec_protobuf16 = require("@dxos/codec-protobuf");
|
|
343
346
|
var import_services21 = require("@dxos/protocols/proto/dxos/client/services");
|
|
344
347
|
var import_util17 = require("@dxos/util");
|
|
345
|
-
var
|
|
348
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/feeds.ts";
|
|
349
|
+
var subscribeToFeeds = ({ feedStore, spaceManager }, { feedKeys }) => {
|
|
346
350
|
return new import_codec_protobuf.Stream(({ next }) => {
|
|
347
351
|
const subscriptions = new import_async.EventSubscriptions();
|
|
348
352
|
const feedMap = new import_util.ComplexMap(import_keys.PublicKey.hash);
|
|
@@ -350,17 +354,23 @@ var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
|
350
354
|
const { feeds } = feedStore;
|
|
351
355
|
feeds.filter((feed) => !feedKeys?.length || feedKeys.some((feedKey) => feedKey.equals(feed.key))).forEach((feed) => {
|
|
352
356
|
if (!feedMap.has(feed.key)) {
|
|
353
|
-
feedMap.set(feed.key,
|
|
357
|
+
feedMap.set(feed.key, {
|
|
358
|
+
feed
|
|
359
|
+
});
|
|
354
360
|
feed.on("close", update);
|
|
355
361
|
subscriptions.add(() => feed.off("close", update));
|
|
356
362
|
}
|
|
363
|
+
if (!feedMap.get(feed.key)?.owner) {
|
|
364
|
+
feedMap.get(feed.key).owner = findFeedOwner(spaceManager, feed.key);
|
|
365
|
+
}
|
|
357
366
|
});
|
|
358
367
|
next({
|
|
359
|
-
feeds: Array.from(feedMap.values()).map((feed) => ({
|
|
368
|
+
feeds: Array.from(feedMap.values()).map(({ feed, owner }) => ({
|
|
360
369
|
feedKey: feed.key,
|
|
361
370
|
length: feed.properties.length,
|
|
362
371
|
bytes: feed.core.byteLength,
|
|
363
|
-
downloaded: feed.core.bitfield?.data.toBuffer() ?? new Uint8Array()
|
|
372
|
+
downloaded: feed.core.bitfield?.data.toBuffer() ?? new Uint8Array(),
|
|
373
|
+
owner
|
|
364
374
|
}))
|
|
365
375
|
});
|
|
366
376
|
};
|
|
@@ -371,6 +381,30 @@ var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
|
371
381
|
};
|
|
372
382
|
});
|
|
373
383
|
};
|
|
384
|
+
var findFeedOwner = (spaceManager, feedKey) => {
|
|
385
|
+
const feedInfo = [
|
|
386
|
+
...spaceManager.spaces.values()
|
|
387
|
+
].flatMap((space) => [
|
|
388
|
+
...space.spaceState.feeds.values()
|
|
389
|
+
]).find((feed) => feed.key.equals(feedKey));
|
|
390
|
+
import_log.log.info("feeds", {
|
|
391
|
+
feedInfo,
|
|
392
|
+
key: feedKey.truncate(),
|
|
393
|
+
allSpaces: spaceManager.spaces.size
|
|
394
|
+
}, {
|
|
395
|
+
F: __dxlog_file,
|
|
396
|
+
L: 75,
|
|
397
|
+
S: void 0,
|
|
398
|
+
C: (f, a) => f(...a)
|
|
399
|
+
});
|
|
400
|
+
if (!feedInfo) {
|
|
401
|
+
return void 0;
|
|
402
|
+
}
|
|
403
|
+
return {
|
|
404
|
+
identity: feedInfo.assertion.identityKey,
|
|
405
|
+
device: feedInfo.assertion.deviceKey
|
|
406
|
+
};
|
|
407
|
+
};
|
|
374
408
|
var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
375
409
|
return new import_codec_protobuf.Stream(({ next }) => {
|
|
376
410
|
if (!feedKey) {
|
|
@@ -383,6 +417,12 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
383
417
|
return;
|
|
384
418
|
}
|
|
385
419
|
const update = async () => {
|
|
420
|
+
if (!feed.properties.length) {
|
|
421
|
+
next({
|
|
422
|
+
blocks: []
|
|
423
|
+
});
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
386
426
|
const iterator = new import_feed_store.FeedIterator(feed);
|
|
387
427
|
await iterator.open();
|
|
388
428
|
const blocks = [];
|
|
@@ -409,7 +449,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
409
449
|
};
|
|
410
450
|
});
|
|
411
451
|
};
|
|
412
|
-
var
|
|
452
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/network.ts";
|
|
413
453
|
var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2.Stream(({ next, close }) => {
|
|
414
454
|
const update = () => {
|
|
415
455
|
try {
|
|
@@ -426,7 +466,7 @@ var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2
|
|
|
426
466
|
});
|
|
427
467
|
var subscribeToSignal = ({ signalManager }) => new import_codec_protobuf2.Stream(({ next }) => {
|
|
428
468
|
const ctx = new import_context.Context(void 0, {
|
|
429
|
-
F:
|
|
469
|
+
F: __dxlog_file2,
|
|
430
470
|
L: 36
|
|
431
471
|
});
|
|
432
472
|
signalManager.onMessage.on(ctx, (message) => {
|
|
@@ -620,9 +660,7 @@ var DevtoolsServiceImpl = class {
|
|
|
620
660
|
throw new Error();
|
|
621
661
|
}
|
|
622
662
|
subscribeToFeeds(request) {
|
|
623
|
-
return subscribeToFeeds(
|
|
624
|
-
feedStore: this.params.context.feedStore
|
|
625
|
-
}, request);
|
|
663
|
+
return subscribeToFeeds(this.params.context, request);
|
|
626
664
|
}
|
|
627
665
|
subscribeToFeedBlocks(request) {
|
|
628
666
|
return subscribeToFeedBlocks({
|
|
@@ -665,7 +703,7 @@ var DevtoolsServiceImpl = class {
|
|
|
665
703
|
});
|
|
666
704
|
}
|
|
667
705
|
};
|
|
668
|
-
var DXOS_VERSION = "0.6.
|
|
706
|
+
var DXOS_VERSION = "0.6.10-main.48c066e";
|
|
669
707
|
var getPlatform = () => {
|
|
670
708
|
if (process.browser) {
|
|
671
709
|
if (typeof window !== "undefined") {
|
|
@@ -693,7 +731,7 @@ var getPlatform = () => {
|
|
|
693
731
|
};
|
|
694
732
|
}
|
|
695
733
|
};
|
|
696
|
-
var
|
|
734
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts";
|
|
697
735
|
var DEFAULT_TIMEOUT = 1e3;
|
|
698
736
|
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
699
737
|
const diagnostics = {
|
|
@@ -710,7 +748,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
710
748
|
await Promise.all([
|
|
711
749
|
(async () => {
|
|
712
750
|
(0, import_invariant.invariant)(clientServices.LoggingService, "SystemService is not available.", {
|
|
713
|
-
F:
|
|
751
|
+
F: __dxlog_file3,
|
|
714
752
|
L: 110,
|
|
715
753
|
S: void 0,
|
|
716
754
|
A: [
|
|
@@ -858,8 +896,8 @@ var findConfigs = () => {
|
|
|
858
896
|
const configs = import_tracing2.TRACE_PROCESSOR.findResourcesByAnnotation(import_config.ConfigResource);
|
|
859
897
|
return configs.map((r) => r.instance.deref()).filter(import_util2.nonNullable);
|
|
860
898
|
};
|
|
861
|
-
var
|
|
862
|
-
var Credential =
|
|
899
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
|
|
900
|
+
var Credential = import_proto.schema.getCodecForType("dxos.halo.credentials.Credential");
|
|
863
901
|
var createAuthProvider = (signer) => async (nonce) => {
|
|
864
902
|
const credential = await signer.createCredential({
|
|
865
903
|
assertion: {
|
|
@@ -874,7 +912,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
874
912
|
constructor(_params) {
|
|
875
913
|
this._params = _params;
|
|
876
914
|
this._ctx = new import_context2.Context(void 0, {
|
|
877
|
-
F:
|
|
915
|
+
F: __dxlog_file4,
|
|
878
916
|
L: 45
|
|
879
917
|
});
|
|
880
918
|
}
|
|
@@ -884,20 +922,20 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
884
922
|
get verifier() {
|
|
885
923
|
return async (nonce, auth) => {
|
|
886
924
|
const credential = Credential.decode(auth);
|
|
887
|
-
(0,
|
|
925
|
+
(0, import_log2.log)("authenticating...", {
|
|
888
926
|
credential
|
|
889
927
|
}, {
|
|
890
|
-
F:
|
|
928
|
+
F: __dxlog_file4,
|
|
891
929
|
L: 56,
|
|
892
930
|
S: this,
|
|
893
931
|
C: (f, a) => f(...a)
|
|
894
932
|
});
|
|
895
933
|
const result = await (0, import_credentials2.verifyCredential)(credential);
|
|
896
934
|
if (result.kind === "fail") {
|
|
897
|
-
(0,
|
|
935
|
+
(0, import_log2.log)("Invalid credential", {
|
|
898
936
|
result
|
|
899
937
|
}, {
|
|
900
|
-
F:
|
|
938
|
+
F: __dxlog_file4,
|
|
901
939
|
L: 60,
|
|
902
940
|
S: this,
|
|
903
941
|
C: (f, a) => f(...a)
|
|
@@ -905,11 +943,11 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
905
943
|
return false;
|
|
906
944
|
}
|
|
907
945
|
if (!credential.proof.nonce || !Buffer.from(nonce).equals(credential.proof.nonce)) {
|
|
908
|
-
(0,
|
|
946
|
+
(0, import_log2.log)("Invalid nonce", {
|
|
909
947
|
nonce,
|
|
910
948
|
credential
|
|
911
949
|
}, {
|
|
912
|
-
F:
|
|
950
|
+
F: __dxlog_file4,
|
|
913
951
|
L: 65,
|
|
914
952
|
S: this,
|
|
915
953
|
C: (f, a) => f(...a)
|
|
@@ -917,10 +955,10 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
917
955
|
return false;
|
|
918
956
|
}
|
|
919
957
|
if (this._isTrustedKey(credential.issuer)) {
|
|
920
|
-
(0,
|
|
958
|
+
(0, import_log2.log)("key is not currently in trusted set, waiting...", {
|
|
921
959
|
key: credential.issuer
|
|
922
960
|
}, {
|
|
923
|
-
F:
|
|
961
|
+
F: __dxlog_file4,
|
|
924
962
|
L: 70,
|
|
925
963
|
S: this,
|
|
926
964
|
C: (f, a) => f(...a)
|
|
@@ -933,20 +971,20 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
933
971
|
});
|
|
934
972
|
const clear = this._params.update.on(this._ctx, () => {
|
|
935
973
|
if (this._isTrustedKey(credential.issuer)) {
|
|
936
|
-
(0,
|
|
974
|
+
(0, import_log2.log)("auth success", {
|
|
937
975
|
key: credential.issuer
|
|
938
976
|
}, {
|
|
939
|
-
F:
|
|
977
|
+
F: __dxlog_file4,
|
|
940
978
|
L: 81,
|
|
941
979
|
S: this,
|
|
942
980
|
C: (f, a) => f(...a)
|
|
943
981
|
});
|
|
944
982
|
trigger.wake(true);
|
|
945
983
|
} else {
|
|
946
|
-
(0,
|
|
984
|
+
(0, import_log2.log)("key is not currently in trusted set, waiting...", {
|
|
947
985
|
key: credential.issuer
|
|
948
986
|
}, {
|
|
949
|
-
F:
|
|
987
|
+
F: __dxlog_file4,
|
|
950
988
|
L: 84,
|
|
951
989
|
S: this,
|
|
952
990
|
C: (f, a) => f(...a)
|
|
@@ -969,7 +1007,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
969
1007
|
return deviceSet.has(deviceKey);
|
|
970
1008
|
}
|
|
971
1009
|
};
|
|
972
|
-
var
|
|
1010
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts";
|
|
973
1011
|
var DefaultSpaceStateMachine = class {
|
|
974
1012
|
constructor(_params) {
|
|
975
1013
|
this._params = _params;
|
|
@@ -982,11 +1020,11 @@ var DefaultSpaceStateMachine = class {
|
|
|
982
1020
|
switch (assertion["@type"]) {
|
|
983
1021
|
case "dxos.halo.credentials.DefaultSpace": {
|
|
984
1022
|
if (!credential.subject.id.equals(this._params.identityKey)) {
|
|
985
|
-
|
|
1023
|
+
import_log4.log.warn("Invalid default space credential", {
|
|
986
1024
|
expectedIdentity: this._params.identityKey,
|
|
987
1025
|
credential
|
|
988
1026
|
}, {
|
|
989
|
-
F:
|
|
1027
|
+
F: __dxlog_file5,
|
|
990
1028
|
L: 32,
|
|
991
1029
|
S: this,
|
|
992
1030
|
C: (f, a) => f(...a)
|
|
@@ -994,10 +1032,10 @@ var DefaultSpaceStateMachine = class {
|
|
|
994
1032
|
return;
|
|
995
1033
|
}
|
|
996
1034
|
if (!import_keys4.SpaceId.isValid(assertion.spaceId)) {
|
|
997
|
-
|
|
1035
|
+
import_log4.log.warn("Invalid default space id", {
|
|
998
1036
|
id: assertion.spaceId
|
|
999
1037
|
}, {
|
|
1000
|
-
F:
|
|
1038
|
+
F: __dxlog_file5,
|
|
1001
1039
|
L: 36,
|
|
1002
1040
|
S: this,
|
|
1003
1041
|
C: (f, a) => f(...a)
|
|
@@ -1020,7 +1058,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
1020
1058
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1021
1059
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1022
1060
|
}
|
|
1023
|
-
var
|
|
1061
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
1024
1062
|
var Identity = class {
|
|
1025
1063
|
constructor({ space, signer, identityKey, deviceKey, presence }) {
|
|
1026
1064
|
this.stateUpdate = new import_async6.Event();
|
|
@@ -1029,10 +1067,10 @@ var Identity = class {
|
|
|
1029
1067
|
this._presence = presence;
|
|
1030
1068
|
this.identityKey = identityKey;
|
|
1031
1069
|
this.deviceKey = deviceKey;
|
|
1032
|
-
|
|
1070
|
+
import_log3.log.trace("dxos.halo.device", {
|
|
1033
1071
|
deviceKey
|
|
1034
1072
|
}, {
|
|
1035
|
-
F:
|
|
1073
|
+
F: __dxlog_file6,
|
|
1036
1074
|
L: 70,
|
|
1037
1075
|
S: this,
|
|
1038
1076
|
C: (f, a) => f(...a)
|
|
@@ -1111,7 +1149,7 @@ var Identity = class {
|
|
|
1111
1149
|
*/
|
|
1112
1150
|
getIdentityCredentialSigner() {
|
|
1113
1151
|
(0, import_invariant2.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
1114
|
-
F:
|
|
1152
|
+
F: __dxlog_file6,
|
|
1115
1153
|
L: 159,
|
|
1116
1154
|
S: this,
|
|
1117
1155
|
A: [
|
|
@@ -1148,14 +1186,14 @@ var Identity = class {
|
|
|
1148
1186
|
]));
|
|
1149
1187
|
}
|
|
1150
1188
|
async admitDevice({ deviceKey, controlFeedKey, dataFeedKey }) {
|
|
1151
|
-
(0,
|
|
1189
|
+
(0, import_log3.log)("Admitting device:", {
|
|
1152
1190
|
identityKey: this.identityKey,
|
|
1153
1191
|
hostDevice: this.deviceKey,
|
|
1154
1192
|
deviceKey,
|
|
1155
1193
|
controlFeedKey,
|
|
1156
1194
|
dataFeedKey
|
|
1157
1195
|
}, {
|
|
1158
|
-
F:
|
|
1196
|
+
F: __dxlog_file6,
|
|
1159
1197
|
L: 184,
|
|
1160
1198
|
S: this,
|
|
1161
1199
|
C: (f, a) => f(...a)
|
|
@@ -1216,7 +1254,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
1216
1254
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1217
1255
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1218
1256
|
}
|
|
1219
|
-
var
|
|
1257
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
|
|
1220
1258
|
var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
1221
1259
|
var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
1222
1260
|
var IdentityManager = class {
|
|
@@ -1238,19 +1276,19 @@ var IdentityManager = class {
|
|
|
1238
1276
|
}
|
|
1239
1277
|
async open(ctx) {
|
|
1240
1278
|
const traceId = import_keys5.PublicKey.random().toHex();
|
|
1241
|
-
|
|
1279
|
+
import_log5.log.trace("dxos.halo.identity-manager.open", import_protocols2.trace.begin({
|
|
1242
1280
|
id: traceId
|
|
1243
1281
|
}), {
|
|
1244
|
-
F:
|
|
1282
|
+
F: __dxlog_file7,
|
|
1245
1283
|
L: 107,
|
|
1246
1284
|
S: this,
|
|
1247
1285
|
C: (f, a) => f(...a)
|
|
1248
1286
|
});
|
|
1249
1287
|
const identityRecord = this._metadataStore.getIdentityRecord();
|
|
1250
|
-
(0,
|
|
1288
|
+
(0, import_log5.log)("identity record", {
|
|
1251
1289
|
identityRecord
|
|
1252
1290
|
}, {
|
|
1253
|
-
F:
|
|
1291
|
+
F: __dxlog_file7,
|
|
1254
1292
|
L: 110,
|
|
1255
1293
|
S: this,
|
|
1256
1294
|
C: (f, a) => f(...a)
|
|
@@ -1259,21 +1297,21 @@ var IdentityManager = class {
|
|
|
1259
1297
|
this._identity = await this._constructIdentity(identityRecord);
|
|
1260
1298
|
await this._identity.open(ctx);
|
|
1261
1299
|
await this._identity.ready();
|
|
1262
|
-
|
|
1300
|
+
import_log5.log.trace("dxos.halo.identity", {
|
|
1263
1301
|
identityKey: identityRecord.identityKey,
|
|
1264
1302
|
displayName: this._identity.profileDocument?.displayName
|
|
1265
1303
|
}, {
|
|
1266
|
-
F:
|
|
1304
|
+
F: __dxlog_file7,
|
|
1267
1305
|
L: 115,
|
|
1268
1306
|
S: this,
|
|
1269
1307
|
C: (f, a) => f(...a)
|
|
1270
1308
|
});
|
|
1271
1309
|
this.stateUpdate.emit();
|
|
1272
1310
|
}
|
|
1273
|
-
|
|
1311
|
+
import_log5.log.trace("dxos.halo.identity-manager.open", import_protocols2.trace.end({
|
|
1274
1312
|
id: traceId
|
|
1275
1313
|
}), {
|
|
1276
|
-
F:
|
|
1314
|
+
F: __dxlog_file7,
|
|
1277
1315
|
L: 122,
|
|
1278
1316
|
S: this,
|
|
1279
1317
|
C: (f, a) => f(...a)
|
|
@@ -1281,13 +1319,13 @@ var IdentityManager = class {
|
|
|
1281
1319
|
}
|
|
1282
1320
|
async close() {
|
|
1283
1321
|
await this._identity?.close(new import_context3.Context(void 0, {
|
|
1284
|
-
F:
|
|
1322
|
+
F: __dxlog_file7,
|
|
1285
1323
|
L: 126
|
|
1286
1324
|
}));
|
|
1287
1325
|
}
|
|
1288
1326
|
async createIdentity({ displayName, deviceProfile } = {}) {
|
|
1289
1327
|
(0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
|
|
1290
|
-
F:
|
|
1328
|
+
F: __dxlog_file7,
|
|
1291
1329
|
L: 131,
|
|
1292
1330
|
S: this,
|
|
1293
1331
|
A: [
|
|
@@ -1295,8 +1333,8 @@ var IdentityManager = class {
|
|
|
1295
1333
|
"'Identity already exists.'"
|
|
1296
1334
|
]
|
|
1297
1335
|
});
|
|
1298
|
-
(0,
|
|
1299
|
-
F:
|
|
1336
|
+
(0, import_log5.log)("creating identity...", void 0, {
|
|
1337
|
+
F: __dxlog_file7,
|
|
1300
1338
|
L: 132,
|
|
1301
1339
|
S: this,
|
|
1302
1340
|
C: (f, a) => f(...a)
|
|
@@ -1314,13 +1352,13 @@ var IdentityManager = class {
|
|
|
1314
1352
|
};
|
|
1315
1353
|
const identity = await this._constructIdentity(identityRecord);
|
|
1316
1354
|
await identity.open(new import_context3.Context(void 0, {
|
|
1317
|
-
F:
|
|
1355
|
+
F: __dxlog_file7,
|
|
1318
1356
|
L: 147
|
|
1319
1357
|
}));
|
|
1320
1358
|
{
|
|
1321
1359
|
const generator = new import_credentials6.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
1322
1360
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
1323
|
-
F:
|
|
1361
|
+
F: __dxlog_file7,
|
|
1324
1362
|
L: 151,
|
|
1325
1363
|
S: this,
|
|
1326
1364
|
A: [
|
|
@@ -1329,7 +1367,7 @@ var IdentityManager = class {
|
|
|
1329
1367
|
]
|
|
1330
1368
|
});
|
|
1331
1369
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
1332
|
-
F:
|
|
1370
|
+
F: __dxlog_file7,
|
|
1333
1371
|
L: 152,
|
|
1334
1372
|
S: this,
|
|
1335
1373
|
A: [
|
|
@@ -1364,22 +1402,22 @@ var IdentityManager = class {
|
|
|
1364
1402
|
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
1365
1403
|
this._identity = identity;
|
|
1366
1404
|
await this._identity.ready();
|
|
1367
|
-
|
|
1405
|
+
import_log5.log.trace("dxos.halo.identity", {
|
|
1368
1406
|
identityKey: identityRecord.identityKey,
|
|
1369
1407
|
displayName: this._identity.profileDocument?.displayName
|
|
1370
1408
|
}, {
|
|
1371
|
-
F:
|
|
1409
|
+
F: __dxlog_file7,
|
|
1372
1410
|
L: 194,
|
|
1373
1411
|
S: this,
|
|
1374
1412
|
C: (f, a) => f(...a)
|
|
1375
1413
|
});
|
|
1376
1414
|
this.stateUpdate.emit();
|
|
1377
|
-
(0,
|
|
1415
|
+
(0, import_log5.log)("created identity", {
|
|
1378
1416
|
identityKey: identity.identityKey,
|
|
1379
1417
|
deviceKey: identity.deviceKey,
|
|
1380
1418
|
profile: identity.profileDocument
|
|
1381
1419
|
}, {
|
|
1382
|
-
F:
|
|
1420
|
+
F: __dxlog_file7,
|
|
1383
1421
|
L: 200,
|
|
1384
1422
|
S: this,
|
|
1385
1423
|
C: (f, a) => f(...a)
|
|
@@ -1413,16 +1451,16 @@ var IdentityManager = class {
|
|
|
1413
1451
|
* Accept an existing identity. Expects its device key to be authorized (now or later).
|
|
1414
1452
|
*/
|
|
1415
1453
|
async acceptIdentity(params) {
|
|
1416
|
-
(0,
|
|
1454
|
+
(0, import_log5.log)("accepting identity", {
|
|
1417
1455
|
params
|
|
1418
1456
|
}, {
|
|
1419
|
-
F:
|
|
1457
|
+
F: __dxlog_file7,
|
|
1420
1458
|
L: 238,
|
|
1421
1459
|
S: this,
|
|
1422
1460
|
C: (f, a) => f(...a)
|
|
1423
1461
|
});
|
|
1424
1462
|
(0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
|
|
1425
|
-
F:
|
|
1463
|
+
F: __dxlog_file7,
|
|
1426
1464
|
L: 239,
|
|
1427
1465
|
S: this,
|
|
1428
1466
|
A: [
|
|
@@ -1443,17 +1481,17 @@ var IdentityManager = class {
|
|
|
1443
1481
|
};
|
|
1444
1482
|
const identity = await this._constructIdentity(identityRecord);
|
|
1445
1483
|
await identity.open(new import_context3.Context(void 0, {
|
|
1446
|
-
F:
|
|
1484
|
+
F: __dxlog_file7,
|
|
1447
1485
|
L: 254
|
|
1448
1486
|
}));
|
|
1449
1487
|
this._identity = identity;
|
|
1450
1488
|
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
1451
1489
|
await this._identity.ready();
|
|
1452
|
-
|
|
1490
|
+
import_log5.log.trace("dxos.halo.identity", {
|
|
1453
1491
|
identityKey: identityRecord.identityKey,
|
|
1454
1492
|
displayName: this._identity.profileDocument?.displayName
|
|
1455
1493
|
}, {
|
|
1456
|
-
F:
|
|
1494
|
+
F: __dxlog_file7,
|
|
1457
1495
|
L: 258,
|
|
1458
1496
|
S: this,
|
|
1459
1497
|
C: (f, a) => f(...a)
|
|
@@ -1463,11 +1501,11 @@ var IdentityManager = class {
|
|
|
1463
1501
|
...params.deviceProfile
|
|
1464
1502
|
});
|
|
1465
1503
|
this.stateUpdate.emit();
|
|
1466
|
-
(0,
|
|
1504
|
+
(0, import_log5.log)("accepted identity", {
|
|
1467
1505
|
identityKey: identity.identityKey,
|
|
1468
1506
|
deviceKey: identity.deviceKey
|
|
1469
1507
|
}, {
|
|
1470
|
-
F:
|
|
1508
|
+
F: __dxlog_file7,
|
|
1471
1509
|
L: 268,
|
|
1472
1510
|
S: this,
|
|
1473
1511
|
C: (f, a) => f(...a)
|
|
@@ -1479,7 +1517,7 @@ var IdentityManager = class {
|
|
|
1479
1517
|
*/
|
|
1480
1518
|
async updateProfile(profile) {
|
|
1481
1519
|
(0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
|
|
1482
|
-
F:
|
|
1520
|
+
F: __dxlog_file7,
|
|
1483
1521
|
L: 276,
|
|
1484
1522
|
S: this,
|
|
1485
1523
|
A: [
|
|
@@ -1510,7 +1548,7 @@ var IdentityManager = class {
|
|
|
1510
1548
|
}
|
|
1511
1549
|
async updateDeviceProfile(profile) {
|
|
1512
1550
|
(0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
|
|
1513
|
-
F:
|
|
1551
|
+
F: __dxlog_file7,
|
|
1514
1552
|
L: 293,
|
|
1515
1553
|
S: this,
|
|
1516
1554
|
A: [
|
|
@@ -1546,7 +1584,7 @@ var IdentityManager = class {
|
|
|
1546
1584
|
}
|
|
1547
1585
|
async _constructIdentity(identityRecord) {
|
|
1548
1586
|
(0, import_invariant3.invariant)(!this._identity, void 0, {
|
|
1549
|
-
F:
|
|
1587
|
+
F: __dxlog_file7,
|
|
1550
1588
|
L: 319,
|
|
1551
1589
|
S: this,
|
|
1552
1590
|
A: [
|
|
@@ -1554,10 +1592,10 @@ var IdentityManager = class {
|
|
|
1554
1592
|
""
|
|
1555
1593
|
]
|
|
1556
1594
|
});
|
|
1557
|
-
(0,
|
|
1595
|
+
(0, import_log5.log)("constructing identity", {
|
|
1558
1596
|
identityRecord
|
|
1559
1597
|
}, {
|
|
1560
|
-
F:
|
|
1598
|
+
F: __dxlog_file7,
|
|
1561
1599
|
L: 320,
|
|
1562
1600
|
S: this,
|
|
1563
1601
|
C: (f, a) => f(...a)
|
|
@@ -1572,7 +1610,7 @@ var IdentityManager = class {
|
|
|
1572
1610
|
gossip
|
|
1573
1611
|
});
|
|
1574
1612
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
1575
|
-
F:
|
|
1613
|
+
F: __dxlog_file7,
|
|
1576
1614
|
L: 333,
|
|
1577
1615
|
S: this,
|
|
1578
1616
|
A: [
|
|
@@ -1584,7 +1622,7 @@ var IdentityManager = class {
|
|
|
1584
1622
|
writable: true
|
|
1585
1623
|
});
|
|
1586
1624
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
1587
|
-
F:
|
|
1625
|
+
F: __dxlog_file7,
|
|
1588
1626
|
L: 337,
|
|
1589
1627
|
S: this,
|
|
1590
1628
|
A: [
|
|
@@ -1616,10 +1654,10 @@ var IdentityManager = class {
|
|
|
1616
1654
|
identityKey: identityRecord.identityKey,
|
|
1617
1655
|
deviceKey: identityRecord.deviceKey
|
|
1618
1656
|
});
|
|
1619
|
-
(0,
|
|
1657
|
+
(0, import_log5.log)("done", {
|
|
1620
1658
|
identityKey: identityRecord.identityKey
|
|
1621
1659
|
}, {
|
|
1622
|
-
F:
|
|
1660
|
+
F: __dxlog_file7,
|
|
1623
1661
|
L: 364,
|
|
1624
1662
|
S: this,
|
|
1625
1663
|
C: (f, a) => f(...a)
|
|
@@ -1644,8 +1682,8 @@ var IdentityManager = class {
|
|
|
1644
1682
|
}));
|
|
1645
1683
|
},
|
|
1646
1684
|
onAuthFailure: () => {
|
|
1647
|
-
|
|
1648
|
-
F:
|
|
1685
|
+
import_log5.log.warn("auth failure", void 0, {
|
|
1686
|
+
F: __dxlog_file7,
|
|
1649
1687
|
L: 390,
|
|
1650
1688
|
S: this,
|
|
1651
1689
|
C: (f, a) => f(...a)
|
|
@@ -1667,7 +1705,7 @@ _ts_decorate2([
|
|
|
1667
1705
|
IdentityManager = _ts_decorate2([
|
|
1668
1706
|
import_tracing4.trace.resource()
|
|
1669
1707
|
], IdentityManager);
|
|
1670
|
-
var
|
|
1708
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
1671
1709
|
var DEFAULT_SPACE_SEARCH_TIMEOUT = 1e4;
|
|
1672
1710
|
var IdentityServiceImpl = class extends import_context4.Resource {
|
|
1673
1711
|
constructor(_identityManager, _keyring, _dataSpaceManagerProvider, _createIdentity, _onProfileUpdate) {
|
|
@@ -1697,7 +1735,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1697
1735
|
const space = await dataSpaceManager.createDefaultSpace();
|
|
1698
1736
|
const identity = this._identityManager.identity;
|
|
1699
1737
|
(0, import_invariant4.invariant)(identity, void 0, {
|
|
1700
|
-
F:
|
|
1738
|
+
F: __dxlog_file8,
|
|
1701
1739
|
L: 59,
|
|
1702
1740
|
S: this,
|
|
1703
1741
|
A: [
|
|
@@ -1731,7 +1769,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1731
1769
|
}
|
|
1732
1770
|
async updateProfile(profile) {
|
|
1733
1771
|
(0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1734
|
-
F:
|
|
1772
|
+
F: __dxlog_file8,
|
|
1735
1773
|
L: 89,
|
|
1736
1774
|
S: this,
|
|
1737
1775
|
A: [
|
|
@@ -1746,7 +1784,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1746
1784
|
// TODO(burdon): Rename createPresentation?
|
|
1747
1785
|
async signPresentation({ presentation, nonce }) {
|
|
1748
1786
|
(0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1749
|
-
F:
|
|
1787
|
+
F: __dxlog_file8,
|
|
1750
1788
|
L: 97,
|
|
1751
1789
|
S: this,
|
|
1752
1790
|
A: [
|
|
@@ -1778,10 +1816,10 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1778
1816
|
}
|
|
1779
1817
|
if (await dataSpaceManager.isDefaultSpace(space)) {
|
|
1780
1818
|
if (foundDefaultSpace) {
|
|
1781
|
-
|
|
1819
|
+
import_log6.log.warn("Multiple default spaces found. Using the first one.", {
|
|
1782
1820
|
duplicate: space.id
|
|
1783
1821
|
}, {
|
|
1784
|
-
F:
|
|
1822
|
+
F: __dxlog_file8,
|
|
1785
1823
|
L: 130,
|
|
1786
1824
|
S: this,
|
|
1787
1825
|
C: (f, a) => f(...a)
|
|
@@ -1794,8 +1832,8 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1794
1832
|
recordedDefaultSpaceTrigger.wake();
|
|
1795
1833
|
}
|
|
1796
1834
|
}, (err) => {
|
|
1797
|
-
|
|
1798
|
-
F:
|
|
1835
|
+
import_log6.log.catch(err, void 0, {
|
|
1836
|
+
F: __dxlog_file8,
|
|
1799
1837
|
L: 141,
|
|
1800
1838
|
S: this,
|
|
1801
1839
|
C: (f, a) => f(...a)
|
|
@@ -1811,7 +1849,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1811
1849
|
}
|
|
1812
1850
|
}
|
|
1813
1851
|
};
|
|
1814
|
-
var
|
|
1852
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
|
|
1815
1853
|
var DeviceInvitationProtocol = class {
|
|
1816
1854
|
constructor(_keyring, _getIdentity, _acceptIdentity) {
|
|
1817
1855
|
this._keyring = _keyring;
|
|
@@ -1837,7 +1875,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1837
1875
|
}
|
|
1838
1876
|
async admit(_, request) {
|
|
1839
1877
|
(0, import_invariant5.invariant)(request.device, void 0, {
|
|
1840
|
-
F:
|
|
1878
|
+
F: __dxlog_file9,
|
|
1841
1879
|
L: 50,
|
|
1842
1880
|
S: this,
|
|
1843
1881
|
A: [
|
|
@@ -1860,7 +1898,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1860
1898
|
try {
|
|
1861
1899
|
const identity = this._getIdentity();
|
|
1862
1900
|
if (identity) {
|
|
1863
|
-
return new
|
|
1901
|
+
return new import_protocols3.AlreadyJoinedError("Currently only one identity per client is supported.");
|
|
1864
1902
|
}
|
|
1865
1903
|
} catch {
|
|
1866
1904
|
}
|
|
@@ -1883,7 +1921,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1883
1921
|
}
|
|
1884
1922
|
async accept(response, request) {
|
|
1885
1923
|
(0, import_invariant5.invariant)(response.device, void 0, {
|
|
1886
|
-
F:
|
|
1924
|
+
F: __dxlog_file9,
|
|
1887
1925
|
L: 95,
|
|
1888
1926
|
S: this,
|
|
1889
1927
|
A: [
|
|
@@ -1893,7 +1931,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1893
1931
|
});
|
|
1894
1932
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
1895
1933
|
(0, import_invariant5.invariant)(request.device, void 0, {
|
|
1896
|
-
F:
|
|
1934
|
+
F: __dxlog_file9,
|
|
1897
1935
|
L: 98,
|
|
1898
1936
|
S: this,
|
|
1899
1937
|
A: [
|
|
@@ -1932,23 +1970,23 @@ var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
|
1932
1970
|
return guard;
|
|
1933
1971
|
})());
|
|
1934
1972
|
};
|
|
1935
|
-
var
|
|
1973
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
|
|
1936
1974
|
var OPTIONS_TIMEOUT = 1e4;
|
|
1937
1975
|
var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
1938
1976
|
constructor(_invitationFlowMutex, _callbacks) {
|
|
1939
1977
|
super({
|
|
1940
1978
|
requested: {
|
|
1941
|
-
InvitationHostService:
|
|
1979
|
+
InvitationHostService: import_proto2.schema.getService("dxos.halo.invitations.InvitationHostService")
|
|
1942
1980
|
},
|
|
1943
1981
|
exposed: {
|
|
1944
|
-
InvitationHostService:
|
|
1982
|
+
InvitationHostService: import_proto2.schema.getService("dxos.halo.invitations.InvitationHostService")
|
|
1945
1983
|
}
|
|
1946
1984
|
});
|
|
1947
1985
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
1948
1986
|
this._callbacks = _callbacks;
|
|
1949
1987
|
this._ctx = new import_context6.Context(void 0, {
|
|
1950
|
-
F:
|
|
1951
|
-
L:
|
|
1988
|
+
F: __dxlog_file10,
|
|
1989
|
+
L: 34
|
|
1952
1990
|
});
|
|
1953
1991
|
this._remoteOptionsTrigger = new import_async10.Trigger();
|
|
1954
1992
|
this._invitationFlowLock = null;
|
|
@@ -1961,8 +1999,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1961
1999
|
InvitationHostService: {
|
|
1962
2000
|
options: async (options) => {
|
|
1963
2001
|
(0, import_invariant7.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
1964
|
-
F:
|
|
1965
|
-
L:
|
|
2002
|
+
F: __dxlog_file10,
|
|
2003
|
+
L: 64,
|
|
1966
2004
|
S: this,
|
|
1967
2005
|
A: [
|
|
1968
2006
|
"!this._remoteOptions",
|
|
@@ -1987,39 +2025,39 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1987
2025
|
async onOpen(context) {
|
|
1988
2026
|
await super.onOpen(context);
|
|
1989
2027
|
try {
|
|
1990
|
-
(0,
|
|
1991
|
-
F:
|
|
1992
|
-
L:
|
|
2028
|
+
(0, import_log8.log)("guest acquire lock", void 0, {
|
|
2029
|
+
F: __dxlog_file10,
|
|
2030
|
+
L: 85,
|
|
1993
2031
|
S: this,
|
|
1994
2032
|
C: (f, a) => f(...a)
|
|
1995
2033
|
});
|
|
1996
2034
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
1997
|
-
(0,
|
|
1998
|
-
F:
|
|
1999
|
-
L:
|
|
2035
|
+
(0, import_log8.log)("guest lock acquired", void 0, {
|
|
2036
|
+
F: __dxlog_file10,
|
|
2037
|
+
L: 87,
|
|
2000
2038
|
S: this,
|
|
2001
2039
|
C: (f, a) => f(...a)
|
|
2002
2040
|
});
|
|
2003
2041
|
await (0, import_context6.cancelWithContext)(this._ctx, this.rpc.InvitationHostService.options({
|
|
2004
2042
|
role: import_invitations3.InvitationOptions.Role.GUEST
|
|
2005
2043
|
}));
|
|
2006
|
-
(0,
|
|
2007
|
-
F:
|
|
2008
|
-
L:
|
|
2044
|
+
(0, import_log8.log)("options sent", void 0, {
|
|
2045
|
+
F: __dxlog_file10,
|
|
2046
|
+
L: 92,
|
|
2009
2047
|
S: this,
|
|
2010
2048
|
C: (f, a) => f(...a)
|
|
2011
2049
|
});
|
|
2012
2050
|
await (0, import_context6.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
|
|
2013
2051
|
timeout: OPTIONS_TIMEOUT
|
|
2014
2052
|
}));
|
|
2015
|
-
(0,
|
|
2016
|
-
F:
|
|
2017
|
-
L:
|
|
2053
|
+
(0, import_log8.log)("options received", void 0, {
|
|
2054
|
+
F: __dxlog_file10,
|
|
2055
|
+
L: 94,
|
|
2018
2056
|
S: this,
|
|
2019
2057
|
C: (f, a) => f(...a)
|
|
2020
2058
|
});
|
|
2021
2059
|
if (this._remoteOptions?.role !== import_invitations3.InvitationOptions.Role.HOST) {
|
|
2022
|
-
throw new
|
|
2060
|
+
throw new import_protocols5.InvalidInvitationExtensionRoleError(void 0, {
|
|
2023
2061
|
expected: import_invitations3.InvitationOptions.Role.HOST,
|
|
2024
2062
|
remoteOptions: this._remoteOptions,
|
|
2025
2063
|
remotePeerId: context.remotePeerId
|
|
@@ -2046,33 +2084,33 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
2046
2084
|
if (this._invitationFlowLock != null) {
|
|
2047
2085
|
this._invitationFlowLock.release();
|
|
2048
2086
|
this._invitationFlowLock = null;
|
|
2049
|
-
(0,
|
|
2050
|
-
F:
|
|
2051
|
-
L:
|
|
2087
|
+
(0, import_log8.log)("invitation flow lock released", void 0, {
|
|
2088
|
+
F: __dxlog_file10,
|
|
2089
|
+
L: 127,
|
|
2052
2090
|
S: this,
|
|
2053
2091
|
C: (f, a) => f(...a)
|
|
2054
2092
|
});
|
|
2055
2093
|
}
|
|
2056
2094
|
}
|
|
2057
2095
|
};
|
|
2058
|
-
var
|
|
2096
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
|
|
2059
2097
|
var OPTIONS_TIMEOUT2 = 1e4;
|
|
2060
2098
|
var MAX_OTP_ATTEMPTS = 3;
|
|
2061
2099
|
var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
2062
2100
|
constructor(_invitationFlowMutex, _callbacks) {
|
|
2063
2101
|
super({
|
|
2064
2102
|
requested: {
|
|
2065
|
-
InvitationHostService:
|
|
2103
|
+
InvitationHostService: import_proto3.schema.getService("dxos.halo.invitations.InvitationHostService")
|
|
2066
2104
|
},
|
|
2067
2105
|
exposed: {
|
|
2068
|
-
InvitationHostService:
|
|
2106
|
+
InvitationHostService: import_proto3.schema.getService("dxos.halo.invitations.InvitationHostService")
|
|
2069
2107
|
}
|
|
2070
2108
|
});
|
|
2071
2109
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
2072
2110
|
this._callbacks = _callbacks;
|
|
2073
2111
|
this._ctx = new import_context8.Context(void 0, {
|
|
2074
|
-
F:
|
|
2075
|
-
L:
|
|
2112
|
+
F: __dxlog_file11,
|
|
2113
|
+
L: 53
|
|
2076
2114
|
});
|
|
2077
2115
|
this._remoteOptionsTrigger = new import_async11.Trigger();
|
|
2078
2116
|
this._challenge = void 0;
|
|
@@ -2092,8 +2130,8 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2092
2130
|
InvitationHostService: {
|
|
2093
2131
|
options: async (options) => {
|
|
2094
2132
|
(0, import_invariant8.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
2095
|
-
F:
|
|
2096
|
-
L:
|
|
2133
|
+
F: __dxlog_file11,
|
|
2134
|
+
L: 102,
|
|
2097
2135
|
S: this,
|
|
2098
2136
|
A: [
|
|
2099
2137
|
"!this._remoteOptions",
|
|
@@ -2106,23 +2144,23 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2106
2144
|
introduce: async (request) => {
|
|
2107
2145
|
const { profile, invitationId } = request;
|
|
2108
2146
|
const traceId = import_keys7.PublicKey.random().toHex();
|
|
2109
|
-
|
|
2147
|
+
import_log9.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols6.trace.begin({
|
|
2110
2148
|
id: traceId
|
|
2111
2149
|
}), {
|
|
2112
|
-
F:
|
|
2113
|
-
L:
|
|
2150
|
+
F: __dxlog_file11,
|
|
2151
|
+
L: 111,
|
|
2114
2152
|
S: this,
|
|
2115
2153
|
C: (f, a) => f(...a)
|
|
2116
2154
|
});
|
|
2117
2155
|
const invitation = this._requireActiveInvitation();
|
|
2118
2156
|
this._assertInvitationState(import_services9.Invitation.State.CONNECTED);
|
|
2119
2157
|
if (invitationId !== invitation?.invitationId) {
|
|
2120
|
-
|
|
2158
|
+
import_log9.log.warn("incorrect invitationId", {
|
|
2121
2159
|
expected: invitation.invitationId,
|
|
2122
2160
|
actual: invitationId
|
|
2123
2161
|
}, {
|
|
2124
|
-
F:
|
|
2125
|
-
L:
|
|
2162
|
+
F: __dxlog_file11,
|
|
2163
|
+
L: 117,
|
|
2126
2164
|
S: this,
|
|
2127
2165
|
C: (f, a) => f(...a)
|
|
2128
2166
|
});
|
|
@@ -2132,22 +2170,22 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2132
2170
|
authMethod: import_services9.Invitation.AuthMethod.NONE
|
|
2133
2171
|
};
|
|
2134
2172
|
}
|
|
2135
|
-
(0,
|
|
2173
|
+
(0, import_log9.log)("guest introduced themselves", {
|
|
2136
2174
|
guestProfile: profile
|
|
2137
2175
|
}, {
|
|
2138
|
-
F:
|
|
2139
|
-
L:
|
|
2176
|
+
F: __dxlog_file11,
|
|
2177
|
+
L: 126,
|
|
2140
2178
|
S: this,
|
|
2141
2179
|
C: (f, a) => f(...a)
|
|
2142
2180
|
});
|
|
2143
2181
|
this.guestProfile = profile;
|
|
2144
2182
|
this._callbacks.onStateUpdate(import_services9.Invitation.State.READY_FOR_AUTHENTICATION);
|
|
2145
2183
|
this._challenge = invitation.authMethod === import_services9.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? (0, import_crypto2.randomBytes)(32) : void 0;
|
|
2146
|
-
|
|
2184
|
+
import_log9.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols6.trace.end({
|
|
2147
2185
|
id: traceId
|
|
2148
2186
|
}), {
|
|
2149
|
-
F:
|
|
2150
|
-
L:
|
|
2187
|
+
F: __dxlog_file11,
|
|
2188
|
+
L: 133,
|
|
2151
2189
|
S: this,
|
|
2152
2190
|
C: (f, a) => f(...a)
|
|
2153
2191
|
});
|
|
@@ -2158,20 +2196,20 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2158
2196
|
},
|
|
2159
2197
|
authenticate: async ({ authCode: code, signedChallenge }) => {
|
|
2160
2198
|
const traceId = import_keys7.PublicKey.random().toHex();
|
|
2161
|
-
|
|
2199
|
+
import_log9.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols6.trace.begin({
|
|
2162
2200
|
id: traceId
|
|
2163
2201
|
}), {
|
|
2164
|
-
F:
|
|
2165
|
-
L:
|
|
2202
|
+
F: __dxlog_file11,
|
|
2203
|
+
L: 142,
|
|
2166
2204
|
S: this,
|
|
2167
2205
|
C: (f, a) => f(...a)
|
|
2168
2206
|
});
|
|
2169
2207
|
const invitation = this._requireActiveInvitation();
|
|
2170
|
-
(0,
|
|
2208
|
+
(0, import_log9.log)("received authentication request", {
|
|
2171
2209
|
authCode: code
|
|
2172
2210
|
}, {
|
|
2173
|
-
F:
|
|
2174
|
-
L:
|
|
2211
|
+
F: __dxlog_file11,
|
|
2212
|
+
L: 145,
|
|
2175
2213
|
S: this,
|
|
2176
2214
|
C: (f, a) => f(...a)
|
|
2177
2215
|
});
|
|
@@ -2183,9 +2221,9 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2183
2221
|
this._callbacks.onStateUpdate(import_services9.Invitation.State.AUTHENTICATING);
|
|
2184
2222
|
switch (invitation.authMethod) {
|
|
2185
2223
|
case import_services9.Invitation.AuthMethod.NONE: {
|
|
2186
|
-
(0,
|
|
2187
|
-
F:
|
|
2188
|
-
L:
|
|
2224
|
+
(0, import_log9.log)("authentication not required", void 0, {
|
|
2225
|
+
F: __dxlog_file11,
|
|
2226
|
+
L: 153,
|
|
2189
2227
|
S: this,
|
|
2190
2228
|
C: (f, a) => f(...a)
|
|
2191
2229
|
});
|
|
@@ -2219,11 +2257,11 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2219
2257
|
break;
|
|
2220
2258
|
}
|
|
2221
2259
|
default: {
|
|
2222
|
-
|
|
2260
|
+
import_log9.log.error("invalid authentication method", {
|
|
2223
2261
|
authMethod: invitation.authMethod
|
|
2224
2262
|
}, {
|
|
2225
|
-
F:
|
|
2226
|
-
L:
|
|
2263
|
+
F: __dxlog_file11,
|
|
2264
|
+
L: 191,
|
|
2227
2265
|
S: this,
|
|
2228
2266
|
C: (f, a) => f(...a)
|
|
2229
2267
|
});
|
|
@@ -2241,14 +2279,14 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2241
2279
|
status
|
|
2242
2280
|
};
|
|
2243
2281
|
}
|
|
2244
|
-
|
|
2282
|
+
import_log9.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols6.trace.end({
|
|
2245
2283
|
id: traceId,
|
|
2246
2284
|
data: {
|
|
2247
2285
|
status
|
|
2248
2286
|
}
|
|
2249
2287
|
}), {
|
|
2250
|
-
F:
|
|
2251
|
-
L:
|
|
2288
|
+
F: __dxlog_file11,
|
|
2289
|
+
L: 203,
|
|
2252
2290
|
S: this,
|
|
2253
2291
|
C: (f, a) => f(...a)
|
|
2254
2292
|
});
|
|
@@ -2258,11 +2296,11 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2258
2296
|
},
|
|
2259
2297
|
admit: async (request) => {
|
|
2260
2298
|
const traceId = import_keys7.PublicKey.random().toHex();
|
|
2261
|
-
|
|
2299
|
+
import_log9.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols6.trace.begin({
|
|
2262
2300
|
id: traceId
|
|
2263
2301
|
}), {
|
|
2264
|
-
F:
|
|
2265
|
-
L:
|
|
2302
|
+
F: __dxlog_file11,
|
|
2303
|
+
L: 209,
|
|
2266
2304
|
S: this,
|
|
2267
2305
|
C: (f, a) => f(...a)
|
|
2268
2306
|
});
|
|
@@ -2275,11 +2313,11 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2275
2313
|
}
|
|
2276
2314
|
}
|
|
2277
2315
|
const response = await this._callbacks.admit(request);
|
|
2278
|
-
|
|
2316
|
+
import_log9.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols6.trace.end({
|
|
2279
2317
|
id: traceId
|
|
2280
2318
|
}), {
|
|
2281
|
-
F:
|
|
2282
|
-
L:
|
|
2319
|
+
F: __dxlog_file11,
|
|
2320
|
+
L: 223,
|
|
2283
2321
|
S: this,
|
|
2284
2322
|
C: (f, a) => f(...a)
|
|
2285
2323
|
});
|
|
@@ -2295,16 +2333,16 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2295
2333
|
async onOpen(context) {
|
|
2296
2334
|
await super.onOpen(context);
|
|
2297
2335
|
try {
|
|
2298
|
-
(0,
|
|
2299
|
-
F:
|
|
2300
|
-
L:
|
|
2336
|
+
(0, import_log9.log)("host acquire lock", void 0, {
|
|
2337
|
+
F: __dxlog_file11,
|
|
2338
|
+
L: 238,
|
|
2301
2339
|
S: this,
|
|
2302
2340
|
C: (f, a) => f(...a)
|
|
2303
2341
|
});
|
|
2304
2342
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
2305
|
-
(0,
|
|
2306
|
-
F:
|
|
2307
|
-
L:
|
|
2343
|
+
(0, import_log9.log)("host lock acquired", void 0, {
|
|
2344
|
+
F: __dxlog_file11,
|
|
2345
|
+
L: 240,
|
|
2308
2346
|
S: this,
|
|
2309
2347
|
C: (f, a) => f(...a)
|
|
2310
2348
|
});
|
|
@@ -2313,24 +2351,24 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2313
2351
|
await this.rpc.InvitationHostService.options({
|
|
2314
2352
|
role: import_invitations4.InvitationOptions.Role.HOST
|
|
2315
2353
|
});
|
|
2316
|
-
(0,
|
|
2317
|
-
F:
|
|
2318
|
-
L:
|
|
2354
|
+
(0, import_log9.log)("options sent", void 0, {
|
|
2355
|
+
F: __dxlog_file11,
|
|
2356
|
+
L: 244,
|
|
2319
2357
|
S: this,
|
|
2320
2358
|
C: (f, a) => f(...a)
|
|
2321
2359
|
});
|
|
2322
2360
|
await (0, import_context8.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
|
|
2323
2361
|
timeout: OPTIONS_TIMEOUT2
|
|
2324
2362
|
}));
|
|
2325
|
-
(0,
|
|
2326
|
-
F:
|
|
2327
|
-
L:
|
|
2363
|
+
(0, import_log9.log)("options received", void 0, {
|
|
2364
|
+
F: __dxlog_file11,
|
|
2365
|
+
L: 246,
|
|
2328
2366
|
S: this,
|
|
2329
2367
|
C: (f, a) => f(...a)
|
|
2330
2368
|
});
|
|
2331
2369
|
if (this._remoteOptions?.role !== import_invitations4.InvitationOptions.Role.GUEST) {
|
|
2332
2370
|
this._callbacks.onStateUpdate(lastState);
|
|
2333
|
-
throw new
|
|
2371
|
+
throw new import_protocols6.InvalidInvitationExtensionRoleError(void 0, {
|
|
2334
2372
|
expected: import_invitations4.InvitationOptions.Role.GUEST,
|
|
2335
2373
|
remoteOptions: this._remoteOptions,
|
|
2336
2374
|
remotePeerId: context.remotePeerId
|
|
@@ -2376,9 +2414,9 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2376
2414
|
if (this._invitationFlowLock != null) {
|
|
2377
2415
|
this._invitationFlowLock?.release();
|
|
2378
2416
|
this._invitationFlowLock = null;
|
|
2379
|
-
(0,
|
|
2380
|
-
F:
|
|
2381
|
-
L:
|
|
2417
|
+
(0, import_log9.log)("invitation flow lock released", void 0, {
|
|
2418
|
+
F: __dxlog_file11,
|
|
2419
|
+
L: 301,
|
|
2382
2420
|
S: this,
|
|
2383
2421
|
C: (f, a) => f(...a)
|
|
2384
2422
|
});
|
|
@@ -2386,7 +2424,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2386
2424
|
}
|
|
2387
2425
|
};
|
|
2388
2426
|
var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services9.Invitation.AuthMethod.NONE;
|
|
2389
|
-
var
|
|
2427
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
|
|
2390
2428
|
var InvitationTopology = class {
|
|
2391
2429
|
constructor(_role) {
|
|
2392
2430
|
this._role = _role;
|
|
@@ -2394,7 +2432,7 @@ var InvitationTopology = class {
|
|
|
2394
2432
|
}
|
|
2395
2433
|
init(controller) {
|
|
2396
2434
|
(0, import_invariant9.invariant)(!this._controller, "Already initialized.", {
|
|
2397
|
-
F:
|
|
2435
|
+
F: __dxlog_file12,
|
|
2398
2436
|
L: 42,
|
|
2399
2437
|
S: this,
|
|
2400
2438
|
A: [
|
|
@@ -2406,7 +2444,7 @@ var InvitationTopology = class {
|
|
|
2406
2444
|
}
|
|
2407
2445
|
update() {
|
|
2408
2446
|
(0, import_invariant9.invariant)(this._controller, "Not initialized.", {
|
|
2409
|
-
F:
|
|
2447
|
+
F: __dxlog_file12,
|
|
2410
2448
|
L: 47,
|
|
2411
2449
|
S: this,
|
|
2412
2450
|
A: [
|
|
@@ -2425,11 +2463,11 @@ var InvitationTopology = class {
|
|
|
2425
2463
|
const firstUnknownPeer = candidates.find((peerId) => !this._seenPeers.has(peerId));
|
|
2426
2464
|
this._seenPeers = new import_util7.ComplexSet(import_keys8.PublicKey.hash, allPeers.filter((peerId) => this._seenPeers.has(peerId)));
|
|
2427
2465
|
if (firstUnknownPeer != null) {
|
|
2428
|
-
(0,
|
|
2466
|
+
(0, import_log10.log)("invitation connect", {
|
|
2429
2467
|
ownPeerId,
|
|
2430
2468
|
remotePeerId: firstUnknownPeer
|
|
2431
2469
|
}, {
|
|
2432
|
-
F:
|
|
2470
|
+
F: __dxlog_file12,
|
|
2433
2471
|
L: 69,
|
|
2434
2472
|
S: this,
|
|
2435
2473
|
C: (f, a) => f(...a)
|
|
@@ -2440,7 +2478,7 @@ var InvitationTopology = class {
|
|
|
2440
2478
|
}
|
|
2441
2479
|
async onOffer(peer) {
|
|
2442
2480
|
(0, import_invariant9.invariant)(this._controller, "Not initialized.", {
|
|
2443
|
-
F:
|
|
2481
|
+
F: __dxlog_file12,
|
|
2444
2482
|
L: 76,
|
|
2445
2483
|
S: this,
|
|
2446
2484
|
A: [
|
|
@@ -2457,7 +2495,7 @@ var InvitationTopology = class {
|
|
|
2457
2495
|
return `InvitationTopology(${this._role === import_invitations5.InvitationOptions.Role.GUEST ? "guest" : "host"})`;
|
|
2458
2496
|
}
|
|
2459
2497
|
};
|
|
2460
|
-
var
|
|
2498
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
|
|
2461
2499
|
var metrics = import_tracing5.trace.metrics;
|
|
2462
2500
|
var MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
|
|
2463
2501
|
var InvitationsHandler = class {
|
|
@@ -2484,7 +2522,7 @@ var InvitationsHandler = class {
|
|
|
2484
2522
|
try {
|
|
2485
2523
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
2486
2524
|
(0, import_invariant6.invariant)(deviceKey, void 0, {
|
|
2487
|
-
F:
|
|
2525
|
+
F: __dxlog_file13,
|
|
2488
2526
|
L: 94,
|
|
2489
2527
|
S: this,
|
|
2490
2528
|
A: [
|
|
@@ -2510,18 +2548,18 @@ var InvitationsHandler = class {
|
|
|
2510
2548
|
(0, import_async9.scheduleTask)(connectionCtx, async () => {
|
|
2511
2549
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
2512
2550
|
try {
|
|
2513
|
-
|
|
2551
|
+
import_log7.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.begin({
|
|
2514
2552
|
id: traceId
|
|
2515
2553
|
}), {
|
|
2516
|
-
F:
|
|
2554
|
+
F: __dxlog_file13,
|
|
2517
2555
|
L: 119,
|
|
2518
2556
|
S: this,
|
|
2519
2557
|
C: (f, a) => f(...a)
|
|
2520
2558
|
});
|
|
2521
|
-
(0,
|
|
2559
|
+
(0, import_log7.log)("connected", {
|
|
2522
2560
|
...protocol.toJSON()
|
|
2523
2561
|
}, {
|
|
2524
|
-
F:
|
|
2562
|
+
F: __dxlog_file13,
|
|
2525
2563
|
L: 120,
|
|
2526
2564
|
S: this,
|
|
2527
2565
|
C: (f, a) => f(...a)
|
|
@@ -2529,21 +2567,21 @@ var InvitationsHandler = class {
|
|
|
2529
2567
|
const deviceKey = await extension.completedTrigger.wait({
|
|
2530
2568
|
timeout: invitation.timeout
|
|
2531
2569
|
});
|
|
2532
|
-
(0,
|
|
2570
|
+
(0, import_log7.log)("admitted guest", {
|
|
2533
2571
|
guest: deviceKey,
|
|
2534
2572
|
...protocol.toJSON()
|
|
2535
2573
|
}, {
|
|
2536
|
-
F:
|
|
2574
|
+
F: __dxlog_file13,
|
|
2537
2575
|
L: 122,
|
|
2538
2576
|
S: this,
|
|
2539
2577
|
C: (f, a) => f(...a)
|
|
2540
2578
|
});
|
|
2541
2579
|
guardedState.set(extension, import_services7.Invitation.State.SUCCESS);
|
|
2542
2580
|
metrics.increment("dxos.invitation.success");
|
|
2543
|
-
|
|
2581
|
+
import_log7.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.end({
|
|
2544
2582
|
id: traceId
|
|
2545
2583
|
}), {
|
|
2546
|
-
F:
|
|
2584
|
+
F: __dxlog_file13,
|
|
2547
2585
|
L: 125,
|
|
2548
2586
|
S: this,
|
|
2549
2587
|
C: (f, a) => f(...a)
|
|
@@ -2556,10 +2594,10 @@ var InvitationsHandler = class {
|
|
|
2556
2594
|
if (err instanceof import_async9.TimeoutError) {
|
|
2557
2595
|
if (guardedState.set(extension, import_services7.Invitation.State.TIMEOUT)) {
|
|
2558
2596
|
metrics.increment("dxos.invitation.timeout");
|
|
2559
|
-
(0,
|
|
2597
|
+
(0, import_log7.log)("timeout", {
|
|
2560
2598
|
...protocol.toJSON()
|
|
2561
2599
|
}, {
|
|
2562
|
-
F:
|
|
2600
|
+
F: __dxlog_file13,
|
|
2563
2601
|
L: 135,
|
|
2564
2602
|
S: this,
|
|
2565
2603
|
C: (f, a) => f(...a)
|
|
@@ -2568,19 +2606,19 @@ var InvitationsHandler = class {
|
|
|
2568
2606
|
} else {
|
|
2569
2607
|
if (guardedState.error(extension, err)) {
|
|
2570
2608
|
metrics.increment("dxos.invitation.failed");
|
|
2571
|
-
|
|
2572
|
-
F:
|
|
2609
|
+
import_log7.log.error("failed", err, {
|
|
2610
|
+
F: __dxlog_file13,
|
|
2573
2611
|
L: 140,
|
|
2574
2612
|
S: this,
|
|
2575
2613
|
C: (f, a) => f(...a)
|
|
2576
2614
|
});
|
|
2577
2615
|
}
|
|
2578
2616
|
}
|
|
2579
|
-
|
|
2617
|
+
import_log7.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.error({
|
|
2580
2618
|
id: traceId,
|
|
2581
2619
|
error: err
|
|
2582
2620
|
}), {
|
|
2583
|
-
F:
|
|
2621
|
+
F: __dxlog_file13,
|
|
2584
2622
|
L: 143,
|
|
2585
2623
|
S: this,
|
|
2586
2624
|
C: (f, a) => f(...a)
|
|
@@ -2590,11 +2628,11 @@ var InvitationsHandler = class {
|
|
|
2590
2628
|
});
|
|
2591
2629
|
},
|
|
2592
2630
|
onError: (err) => {
|
|
2593
|
-
if (err instanceof
|
|
2594
|
-
(0,
|
|
2631
|
+
if (err instanceof import_protocols4.InvalidInvitationExtensionRoleError) {
|
|
2632
|
+
(0, import_log7.log)("invalid role", {
|
|
2595
2633
|
...err.context
|
|
2596
2634
|
}, {
|
|
2597
|
-
F:
|
|
2635
|
+
F: __dxlog_file13,
|
|
2598
2636
|
L: 151,
|
|
2599
2637
|
S: this,
|
|
2600
2638
|
C: (f, a) => f(...a)
|
|
@@ -2604,10 +2642,10 @@ var InvitationsHandler = class {
|
|
|
2604
2642
|
if (err instanceof import_async9.TimeoutError) {
|
|
2605
2643
|
if (guardedState.set(extension, import_services7.Invitation.State.TIMEOUT)) {
|
|
2606
2644
|
metrics.increment("dxos.invitation.timeout");
|
|
2607
|
-
(0,
|
|
2645
|
+
(0, import_log7.log)("timeout", {
|
|
2608
2646
|
err
|
|
2609
2647
|
}, {
|
|
2610
|
-
F:
|
|
2648
|
+
F: __dxlog_file13,
|
|
2611
2649
|
L: 157,
|
|
2612
2650
|
S: this,
|
|
2613
2651
|
C: (f, a) => f(...a)
|
|
@@ -2616,8 +2654,8 @@ var InvitationsHandler = class {
|
|
|
2616
2654
|
} else {
|
|
2617
2655
|
if (guardedState.error(extension, err)) {
|
|
2618
2656
|
metrics.increment("dxos.invitation.failed");
|
|
2619
|
-
|
|
2620
|
-
F:
|
|
2657
|
+
import_log7.log.error("failed", err, {
|
|
2658
|
+
F: __dxlog_file13,
|
|
2621
2659
|
L: 162,
|
|
2622
2660
|
S: this,
|
|
2623
2661
|
C: (f, a) => f(...a)
|
|
@@ -2630,8 +2668,8 @@ var InvitationsHandler = class {
|
|
|
2630
2668
|
};
|
|
2631
2669
|
if (invitation.lifetime && invitation.created) {
|
|
2632
2670
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
2633
|
-
|
|
2634
|
-
F:
|
|
2671
|
+
import_log7.log.warn("invitation has already expired", void 0, {
|
|
2672
|
+
F: __dxlog_file13,
|
|
2635
2673
|
L: 173,
|
|
2636
2674
|
S: this,
|
|
2637
2675
|
C: (f, a) => f(...a)
|
|
@@ -2655,7 +2693,7 @@ var InvitationsHandler = class {
|
|
|
2655
2693
|
const { timeout = import_client_protocol3.INVITATION_TIMEOUT } = invitation;
|
|
2656
2694
|
if (deviceProfile) {
|
|
2657
2695
|
(0, import_invariant6.invariant)(invitation.kind === import_services7.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2658
|
-
F:
|
|
2696
|
+
F: __dxlog_file13,
|
|
2659
2697
|
L: 207,
|
|
2660
2698
|
S: this,
|
|
2661
2699
|
A: [
|
|
@@ -2668,12 +2706,12 @@ var InvitationsHandler = class {
|
|
|
2668
2706
|
const guardedState = this._createGuardedState(ctx, invitation, stream);
|
|
2669
2707
|
const shouldCancelInvitationFlow = (extension) => {
|
|
2670
2708
|
const isLockedByAnotherConnection = guardedState.mutex.isLocked() && !extension.hasFlowLock();
|
|
2671
|
-
(0,
|
|
2709
|
+
(0, import_log7.log)("should cancel invitation flow", {
|
|
2672
2710
|
isLockedByAnotherConnection,
|
|
2673
2711
|
invitationType: import_services7.Invitation.Type.DELEGATED,
|
|
2674
2712
|
triedPeers: triedPeersIds.size
|
|
2675
2713
|
}, {
|
|
2676
|
-
F:
|
|
2714
|
+
F: __dxlog_file13,
|
|
2677
2715
|
L: 215,
|
|
2678
2716
|
S: this,
|
|
2679
2717
|
C: (f, a) => f(...a)
|
|
@@ -2696,11 +2734,11 @@ var InvitationsHandler = class {
|
|
|
2696
2734
|
return;
|
|
2697
2735
|
}
|
|
2698
2736
|
connectionCtx.onDispose(async () => {
|
|
2699
|
-
(0,
|
|
2737
|
+
(0, import_log7.log)("extension disposed", {
|
|
2700
2738
|
admitted,
|
|
2701
2739
|
currentState: guardedState.current.state
|
|
2702
2740
|
}, {
|
|
2703
|
-
F:
|
|
2741
|
+
F: __dxlog_file13,
|
|
2704
2742
|
L: 243,
|
|
2705
2743
|
S: this,
|
|
2706
2744
|
C: (f, a) => f(...a)
|
|
@@ -2715,10 +2753,10 @@ var InvitationsHandler = class {
|
|
|
2715
2753
|
(0, import_async9.scheduleTask)(connectionCtx, async () => {
|
|
2716
2754
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
2717
2755
|
try {
|
|
2718
|
-
|
|
2756
|
+
import_log7.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.begin({
|
|
2719
2757
|
id: traceId
|
|
2720
2758
|
}), {
|
|
2721
|
-
F:
|
|
2759
|
+
F: __dxlog_file13,
|
|
2722
2760
|
L: 255,
|
|
2723
2761
|
S: this,
|
|
2724
2762
|
C: (f, a) => f(...a)
|
|
@@ -2727,19 +2765,19 @@ var InvitationsHandler = class {
|
|
|
2727
2765
|
guardedState.set(extension, import_services7.Invitation.State.TIMEOUT);
|
|
2728
2766
|
extensionCtx.close();
|
|
2729
2767
|
}, timeout);
|
|
2730
|
-
(0,
|
|
2768
|
+
(0, import_log7.log)("connected", {
|
|
2731
2769
|
...protocol.toJSON()
|
|
2732
2770
|
}, {
|
|
2733
|
-
F:
|
|
2771
|
+
F: __dxlog_file13,
|
|
2734
2772
|
L: 266,
|
|
2735
2773
|
S: this,
|
|
2736
2774
|
C: (f, a) => f(...a)
|
|
2737
2775
|
});
|
|
2738
2776
|
guardedState.set(extension, import_services7.Invitation.State.CONNECTED);
|
|
2739
|
-
(0,
|
|
2777
|
+
(0, import_log7.log)("introduce", {
|
|
2740
2778
|
...protocol.toJSON()
|
|
2741
2779
|
}, {
|
|
2742
|
-
F:
|
|
2780
|
+
F: __dxlog_file13,
|
|
2743
2781
|
L: 270,
|
|
2744
2782
|
S: this,
|
|
2745
2783
|
C: (f, a) => f(...a)
|
|
@@ -2748,11 +2786,11 @@ var InvitationsHandler = class {
|
|
|
2748
2786
|
invitationId: invitation.invitationId,
|
|
2749
2787
|
...protocol.createIntroduction()
|
|
2750
2788
|
});
|
|
2751
|
-
(0,
|
|
2789
|
+
(0, import_log7.log)("introduce response", {
|
|
2752
2790
|
...protocol.toJSON(),
|
|
2753
2791
|
response: introductionResponse
|
|
2754
2792
|
}, {
|
|
2755
|
-
F:
|
|
2793
|
+
F: __dxlog_file13,
|
|
2756
2794
|
L: 275,
|
|
2757
2795
|
S: this,
|
|
2758
2796
|
C: (f, a) => f(...a)
|
|
@@ -2770,10 +2808,10 @@ var InvitationsHandler = class {
|
|
|
2770
2808
|
break;
|
|
2771
2809
|
}
|
|
2772
2810
|
}
|
|
2773
|
-
(0,
|
|
2811
|
+
(0, import_log7.log)("request admission", {
|
|
2774
2812
|
...protocol.toJSON()
|
|
2775
2813
|
}, {
|
|
2776
|
-
F:
|
|
2814
|
+
F: __dxlog_file13,
|
|
2777
2815
|
L: 301,
|
|
2778
2816
|
S: this,
|
|
2779
2817
|
C: (f, a) => f(...a)
|
|
@@ -2782,10 +2820,10 @@ var InvitationsHandler = class {
|
|
|
2782
2820
|
const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
|
|
2783
2821
|
admitted = true;
|
|
2784
2822
|
const result = await protocol.accept(admissionResponse, admissionRequest);
|
|
2785
|
-
(0,
|
|
2823
|
+
(0, import_log7.log)("admitted by host", {
|
|
2786
2824
|
...protocol.toJSON()
|
|
2787
2825
|
}, {
|
|
2788
|
-
F:
|
|
2826
|
+
F: __dxlog_file13,
|
|
2789
2827
|
L: 312,
|
|
2790
2828
|
S: this,
|
|
2791
2829
|
C: (f, a) => f(...a)
|
|
@@ -2795,28 +2833,28 @@ var InvitationsHandler = class {
|
|
|
2795
2833
|
...result,
|
|
2796
2834
|
state: import_services7.Invitation.State.SUCCESS
|
|
2797
2835
|
});
|
|
2798
|
-
|
|
2836
|
+
import_log7.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.end({
|
|
2799
2837
|
id: traceId
|
|
2800
2838
|
}), {
|
|
2801
|
-
F:
|
|
2839
|
+
F: __dxlog_file13,
|
|
2802
2840
|
L: 318,
|
|
2803
2841
|
S: this,
|
|
2804
2842
|
C: (f, a) => f(...a)
|
|
2805
2843
|
});
|
|
2806
2844
|
} catch (err) {
|
|
2807
2845
|
if (err instanceof import_async9.TimeoutError) {
|
|
2808
|
-
(0,
|
|
2846
|
+
(0, import_log7.log)("timeout", {
|
|
2809
2847
|
...protocol.toJSON()
|
|
2810
2848
|
}, {
|
|
2811
|
-
F:
|
|
2849
|
+
F: __dxlog_file13,
|
|
2812
2850
|
L: 321,
|
|
2813
2851
|
S: this,
|
|
2814
2852
|
C: (f, a) => f(...a)
|
|
2815
2853
|
});
|
|
2816
2854
|
guardedState.set(extension, import_services7.Invitation.State.TIMEOUT);
|
|
2817
2855
|
} else {
|
|
2818
|
-
(0,
|
|
2819
|
-
F:
|
|
2856
|
+
(0, import_log7.log)("auth failed", err, {
|
|
2857
|
+
F: __dxlog_file13,
|
|
2820
2858
|
L: 324,
|
|
2821
2859
|
S: this,
|
|
2822
2860
|
C: (f, a) => f(...a)
|
|
@@ -2824,11 +2862,11 @@ var InvitationsHandler = class {
|
|
|
2824
2862
|
guardedState.error(extension, err);
|
|
2825
2863
|
}
|
|
2826
2864
|
extensionCtx.close(err);
|
|
2827
|
-
|
|
2865
|
+
import_log7.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.error({
|
|
2828
2866
|
id: traceId,
|
|
2829
2867
|
error: err
|
|
2830
2868
|
}), {
|
|
2831
|
-
F:
|
|
2869
|
+
F: __dxlog_file13,
|
|
2832
2870
|
L: 328,
|
|
2833
2871
|
S: this,
|
|
2834
2872
|
C: (f, a) => f(...a)
|
|
@@ -2837,22 +2875,22 @@ var InvitationsHandler = class {
|
|
|
2837
2875
|
});
|
|
2838
2876
|
},
|
|
2839
2877
|
onError: (err) => {
|
|
2840
|
-
if (err instanceof
|
|
2878
|
+
if (err instanceof import_protocols4.InvalidInvitationExtensionRoleError) {
|
|
2841
2879
|
return;
|
|
2842
2880
|
}
|
|
2843
2881
|
if (err instanceof import_async9.TimeoutError) {
|
|
2844
|
-
(0,
|
|
2882
|
+
(0, import_log7.log)("timeout", {
|
|
2845
2883
|
...protocol.toJSON()
|
|
2846
2884
|
}, {
|
|
2847
|
-
F:
|
|
2885
|
+
F: __dxlog_file13,
|
|
2848
2886
|
L: 337,
|
|
2849
2887
|
S: this,
|
|
2850
2888
|
C: (f, a) => f(...a)
|
|
2851
2889
|
});
|
|
2852
2890
|
guardedState.set(extension, import_services7.Invitation.State.TIMEOUT);
|
|
2853
2891
|
} else {
|
|
2854
|
-
(0,
|
|
2855
|
-
F:
|
|
2892
|
+
(0, import_log7.log)("auth failed", err, {
|
|
2893
|
+
F: __dxlog_file13,
|
|
2856
2894
|
L: 340,
|
|
2857
2895
|
S: this,
|
|
2858
2896
|
C: (f, a) => f(...a)
|
|
@@ -2870,7 +2908,7 @@ var InvitationsHandler = class {
|
|
|
2870
2908
|
await ctx.dispose();
|
|
2871
2909
|
} else {
|
|
2872
2910
|
(0, import_invariant6.invariant)(invitation.swarmKey, void 0, {
|
|
2873
|
-
F:
|
|
2911
|
+
F: __dxlog_file13,
|
|
2874
2912
|
L: 355,
|
|
2875
2913
|
S: this,
|
|
2876
2914
|
A: [
|
|
@@ -2972,23 +3010,23 @@ var InvitationsHandler = class {
|
|
|
2972
3010
|
}
|
|
2973
3011
|
_logStateUpdate(invitation, actor, newState) {
|
|
2974
3012
|
if (this._isNotTerminal(newState)) {
|
|
2975
|
-
(0,
|
|
3013
|
+
(0, import_log7.log)("invitation state update", {
|
|
2976
3014
|
actor: actor?.constructor.name,
|
|
2977
3015
|
newState: stateToString(newState),
|
|
2978
3016
|
oldState: stateToString(invitation.state)
|
|
2979
3017
|
}, {
|
|
2980
|
-
F:
|
|
3018
|
+
F: __dxlog_file13,
|
|
2981
3019
|
L: 460,
|
|
2982
3020
|
S: this,
|
|
2983
3021
|
C: (f, a) => f(...a)
|
|
2984
3022
|
});
|
|
2985
3023
|
} else {
|
|
2986
|
-
|
|
3024
|
+
import_log7.log.info("invitation state update", {
|
|
2987
3025
|
actor: actor?.constructor.name,
|
|
2988
3026
|
newState: stateToString(newState),
|
|
2989
3027
|
oldState: stateToString(invitation.state)
|
|
2990
3028
|
}, {
|
|
2991
|
-
F:
|
|
3029
|
+
F: __dxlog_file13,
|
|
2992
3030
|
L: 466,
|
|
2993
3031
|
S: this,
|
|
2994
3032
|
C: (f, a) => f(...a)
|
|
@@ -3006,16 +3044,16 @@ var InvitationsHandler = class {
|
|
|
3006
3044
|
}
|
|
3007
3045
|
async _handleGuestOtpAuth(extension, setState, authenticated, options) {
|
|
3008
3046
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
3009
|
-
(0,
|
|
3010
|
-
F:
|
|
3047
|
+
(0, import_log7.log)("guest waiting for authentication code...", void 0, {
|
|
3048
|
+
F: __dxlog_file13,
|
|
3011
3049
|
L: 491,
|
|
3012
3050
|
S: this,
|
|
3013
3051
|
C: (f, a) => f(...a)
|
|
3014
3052
|
});
|
|
3015
3053
|
setState(import_services7.Invitation.State.READY_FOR_AUTHENTICATION);
|
|
3016
3054
|
const authCode = await authenticated.wait(options);
|
|
3017
|
-
(0,
|
|
3018
|
-
F:
|
|
3055
|
+
(0, import_log7.log)("sending authentication request", void 0, {
|
|
3056
|
+
F: __dxlog_file13,
|
|
3019
3057
|
L: 495,
|
|
3020
3058
|
S: this,
|
|
3021
3059
|
C: (f, a) => f(...a)
|
|
@@ -3031,10 +3069,10 @@ var InvitationsHandler = class {
|
|
|
3031
3069
|
if (attempt === MAX_OTP_ATTEMPTS) {
|
|
3032
3070
|
throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
|
|
3033
3071
|
} else {
|
|
3034
|
-
(0,
|
|
3072
|
+
(0, import_log7.log)("retrying invalid code", {
|
|
3035
3073
|
attempt
|
|
3036
3074
|
}, {
|
|
3037
|
-
F:
|
|
3075
|
+
F: __dxlog_file13,
|
|
3038
3076
|
L: 506,
|
|
3039
3077
|
S: this,
|
|
3040
3078
|
C: (f, a) => f(...a)
|
|
@@ -3051,8 +3089,8 @@ var InvitationsHandler = class {
|
|
|
3051
3089
|
if (introductionResponse.challenge == null) {
|
|
3052
3090
|
throw new Error("challenge missing in the introduction");
|
|
3053
3091
|
}
|
|
3054
|
-
(0,
|
|
3055
|
-
F:
|
|
3092
|
+
(0, import_log7.log)("sending authentication request", void 0, {
|
|
3093
|
+
F: __dxlog_file13,
|
|
3056
3094
|
L: 525,
|
|
3057
3095
|
S: this,
|
|
3058
3096
|
C: (f, a) => f(...a)
|
|
@@ -3167,7 +3205,7 @@ var InvitationsServiceImpl = class {
|
|
|
3167
3205
|
});
|
|
3168
3206
|
}
|
|
3169
3207
|
};
|
|
3170
|
-
var
|
|
3208
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
3171
3209
|
var SpaceInvitationProtocol = class {
|
|
3172
3210
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
3173
3211
|
this._spaceManager = _spaceManager;
|
|
@@ -3183,14 +3221,14 @@ var SpaceInvitationProtocol = class {
|
|
|
3183
3221
|
}
|
|
3184
3222
|
checkCanInviteNewMembers() {
|
|
3185
3223
|
if (this._spaceKey == null) {
|
|
3186
|
-
return new
|
|
3224
|
+
return new import_protocols7.InvalidInvitationError("No spaceKey was provided for a space invitation.");
|
|
3187
3225
|
}
|
|
3188
3226
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3189
3227
|
if (space == null) {
|
|
3190
|
-
return new
|
|
3228
|
+
return new import_protocols7.SpaceNotFoundError(this._spaceKey);
|
|
3191
3229
|
}
|
|
3192
3230
|
if (!space?.inner.spaceState.hasMembershipManagementPermission(this._signingContext.identityKey)) {
|
|
3193
|
-
return new
|
|
3231
|
+
return new import_protocols7.AuthorizationError("No member management permission.");
|
|
3194
3232
|
}
|
|
3195
3233
|
return void 0;
|
|
3196
3234
|
}
|
|
@@ -3202,7 +3240,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3202
3240
|
}
|
|
3203
3241
|
async admit(invitation, request, guestProfile) {
|
|
3204
3242
|
(0, import_invariant10.invariant)(this._spaceKey && request.space, void 0, {
|
|
3205
|
-
F:
|
|
3243
|
+
F: __dxlog_file14,
|
|
3206
3244
|
L: 74,
|
|
3207
3245
|
S: this,
|
|
3208
3246
|
A: [
|
|
@@ -3210,11 +3248,11 @@ var SpaceInvitationProtocol = class {
|
|
|
3210
3248
|
""
|
|
3211
3249
|
]
|
|
3212
3250
|
});
|
|
3213
|
-
(0,
|
|
3251
|
+
(0, import_log11.log)("writing guest credentials", {
|
|
3214
3252
|
host: this._signingContext.deviceKey,
|
|
3215
3253
|
guest: request.space.deviceKey
|
|
3216
3254
|
}, {
|
|
3217
|
-
F:
|
|
3255
|
+
F: __dxlog_file14,
|
|
3218
3256
|
L: 75,
|
|
3219
3257
|
S: this,
|
|
3220
3258
|
C: (f, a) => f(...a)
|
|
@@ -3236,7 +3274,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3236
3274
|
}
|
|
3237
3275
|
async delegate(invitation) {
|
|
3238
3276
|
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3239
|
-
F:
|
|
3277
|
+
F: __dxlog_file14,
|
|
3240
3278
|
L: 95,
|
|
3241
3279
|
S: this,
|
|
3242
3280
|
A: [
|
|
@@ -3246,7 +3284,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3246
3284
|
});
|
|
3247
3285
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3248
3286
|
(0, import_invariant10.invariant)(space, void 0, {
|
|
3249
|
-
F:
|
|
3287
|
+
F: __dxlog_file14,
|
|
3250
3288
|
L: 97,
|
|
3251
3289
|
S: this,
|
|
3252
3290
|
A: [
|
|
@@ -3256,7 +3294,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3256
3294
|
});
|
|
3257
3295
|
if (invitation.authMethod === import_services11.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
3258
3296
|
(0, import_invariant10.invariant)(invitation.guestKeypair?.publicKey, void 0, {
|
|
3259
|
-
F:
|
|
3297
|
+
F: __dxlog_file14,
|
|
3260
3298
|
L: 99,
|
|
3261
3299
|
S: this,
|
|
3262
3300
|
A: [
|
|
@@ -3265,11 +3303,11 @@ var SpaceInvitationProtocol = class {
|
|
|
3265
3303
|
]
|
|
3266
3304
|
});
|
|
3267
3305
|
}
|
|
3268
|
-
(0,
|
|
3306
|
+
(0, import_log11.log)("writing delegate space invitation", {
|
|
3269
3307
|
host: this._signingContext.deviceKey,
|
|
3270
3308
|
id: invitation.invitationId
|
|
3271
3309
|
}, {
|
|
3272
|
-
F:
|
|
3310
|
+
F: __dxlog_file14,
|
|
3273
3311
|
L: 102,
|
|
3274
3312
|
S: this,
|
|
3275
3313
|
C: (f, a) => f(...a)
|
|
@@ -3284,7 +3322,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3284
3322
|
guestKey: invitation.authMethod === import_services11.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
3285
3323
|
});
|
|
3286
3324
|
(0, import_invariant10.invariant)(credential.credential, void 0, {
|
|
3287
|
-
F:
|
|
3325
|
+
F: __dxlog_file14,
|
|
3288
3326
|
L: 122,
|
|
3289
3327
|
S: this,
|
|
3290
3328
|
A: [
|
|
@@ -3299,7 +3337,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3299
3337
|
}
|
|
3300
3338
|
async cancelDelegation(invitation) {
|
|
3301
3339
|
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3302
|
-
F:
|
|
3340
|
+
F: __dxlog_file14,
|
|
3303
3341
|
L: 128,
|
|
3304
3342
|
S: this,
|
|
3305
3343
|
A: [
|
|
@@ -3308,7 +3346,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3308
3346
|
]
|
|
3309
3347
|
});
|
|
3310
3348
|
(0, import_invariant10.invariant)(invitation.type === import_services11.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
3311
|
-
F:
|
|
3349
|
+
F: __dxlog_file14,
|
|
3312
3350
|
L: 129,
|
|
3313
3351
|
S: this,
|
|
3314
3352
|
A: [
|
|
@@ -3318,7 +3356,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3318
3356
|
});
|
|
3319
3357
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3320
3358
|
(0, import_invariant10.invariant)(space, void 0, {
|
|
3321
|
-
F:
|
|
3359
|
+
F: __dxlog_file14,
|
|
3322
3360
|
L: 131,
|
|
3323
3361
|
S: this,
|
|
3324
3362
|
A: [
|
|
@@ -3326,18 +3364,18 @@ var SpaceInvitationProtocol = class {
|
|
|
3326
3364
|
""
|
|
3327
3365
|
]
|
|
3328
3366
|
});
|
|
3329
|
-
(0,
|
|
3367
|
+
(0, import_log11.log)("cancelling delegated space invitation", {
|
|
3330
3368
|
host: this._signingContext.deviceKey,
|
|
3331
3369
|
id: invitation.invitationId
|
|
3332
3370
|
}, {
|
|
3333
|
-
F:
|
|
3371
|
+
F: __dxlog_file14,
|
|
3334
3372
|
L: 133,
|
|
3335
3373
|
S: this,
|
|
3336
3374
|
C: (f, a) => f(...a)
|
|
3337
3375
|
});
|
|
3338
3376
|
const credential = await (0, import_credentials9.createCancelDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
3339
3377
|
(0, import_invariant10.invariant)(credential.credential, void 0, {
|
|
3340
|
-
F:
|
|
3378
|
+
F: __dxlog_file14,
|
|
3341
3379
|
L: 140,
|
|
3342
3380
|
S: this,
|
|
3343
3381
|
A: [
|
|
@@ -3351,10 +3389,10 @@ var SpaceInvitationProtocol = class {
|
|
|
3351
3389
|
}
|
|
3352
3390
|
checkInvitation(invitation) {
|
|
3353
3391
|
if (invitation.spaceKey == null) {
|
|
3354
|
-
return new
|
|
3392
|
+
return new import_protocols7.InvalidInvitationError("No spaceKey was provided for a space invitation.");
|
|
3355
3393
|
}
|
|
3356
3394
|
if (this._spaceManager.spaces.has(invitation.spaceKey)) {
|
|
3357
|
-
return new
|
|
3395
|
+
return new import_protocols7.AlreadyJoinedError("Already joined space.");
|
|
3358
3396
|
}
|
|
3359
3397
|
}
|
|
3360
3398
|
createIntroduction() {
|
|
@@ -3376,7 +3414,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3376
3414
|
}
|
|
3377
3415
|
async accept(response) {
|
|
3378
3416
|
(0, import_invariant10.invariant)(response.space, void 0, {
|
|
3379
|
-
F:
|
|
3417
|
+
F: __dxlog_file14,
|
|
3380
3418
|
L: 175,
|
|
3381
3419
|
S: this,
|
|
3382
3420
|
A: [
|
|
@@ -3387,7 +3425,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3387
3425
|
const { credential, controlTimeframe, dataTimeframe } = response.space;
|
|
3388
3426
|
const assertion = (0, import_credentials9.getCredentialAssertion)(credential);
|
|
3389
3427
|
(0, import_invariant10.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
3390
|
-
F:
|
|
3428
|
+
F: __dxlog_file14,
|
|
3391
3429
|
L: 178,
|
|
3392
3430
|
S: this,
|
|
3393
3431
|
A: [
|
|
@@ -3396,7 +3434,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3396
3434
|
]
|
|
3397
3435
|
});
|
|
3398
3436
|
(0, import_invariant10.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
3399
|
-
F:
|
|
3437
|
+
F: __dxlog_file14,
|
|
3400
3438
|
L: 179,
|
|
3401
3439
|
S: this,
|
|
3402
3440
|
A: [
|
|
@@ -3405,7 +3443,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3405
3443
|
]
|
|
3406
3444
|
});
|
|
3407
3445
|
if (this._spaceManager.spaces.has(assertion.spaceKey)) {
|
|
3408
|
-
throw new
|
|
3446
|
+
throw new import_protocols7.AlreadyJoinedError("Already joined space.");
|
|
3409
3447
|
}
|
|
3410
3448
|
await this._spaceManager.acceptSpace({
|
|
3411
3449
|
spaceKey: assertion.spaceKey,
|
|
@@ -3419,7 +3457,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3419
3457
|
};
|
|
3420
3458
|
}
|
|
3421
3459
|
};
|
|
3422
|
-
var
|
|
3460
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
|
|
3423
3461
|
var InvitationsManager = class {
|
|
3424
3462
|
constructor(_invitationsHandler, _getHandler, _metadataStore) {
|
|
3425
3463
|
this._invitationsHandler = _invitationsHandler;
|
|
@@ -3461,8 +3499,8 @@ var InvitationsManager = class {
|
|
|
3461
3499
|
try {
|
|
3462
3500
|
await this._persistIfRequired(handler, stream, invitation);
|
|
3463
3501
|
} catch (err) {
|
|
3464
|
-
|
|
3465
|
-
F:
|
|
3502
|
+
import_log12.log.catch(err, void 0, {
|
|
3503
|
+
F: __dxlog_file15,
|
|
3466
3504
|
L: 82,
|
|
3467
3505
|
S: this,
|
|
3468
3506
|
C: (f, a) => f(...a)
|
|
@@ -3485,7 +3523,7 @@ var InvitationsManager = class {
|
|
|
3485
3523
|
const freshInvitations = persistentInvitations.filter((invitation) => !(0, import_echo_pipeline.hasInvitationExpired)(invitation));
|
|
3486
3524
|
const loadTasks = freshInvitations.map((persistentInvitation) => {
|
|
3487
3525
|
(0, import_invariant11.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
3488
|
-
F:
|
|
3526
|
+
F: __dxlog_file15,
|
|
3489
3527
|
L: 103,
|
|
3490
3528
|
S: this,
|
|
3491
3529
|
A: [
|
|
@@ -3503,8 +3541,8 @@ var InvitationsManager = class {
|
|
|
3503
3541
|
invitations: cInvitations.map((invitation) => invitation.get())
|
|
3504
3542
|
};
|
|
3505
3543
|
} catch (err) {
|
|
3506
|
-
|
|
3507
|
-
F:
|
|
3544
|
+
import_log12.log.catch(err, void 0, {
|
|
3545
|
+
F: __dxlog_file15,
|
|
3508
3546
|
L: 110,
|
|
3509
3547
|
S: this,
|
|
3510
3548
|
C: (f, a) => f(...a)
|
|
@@ -3535,14 +3573,14 @@ var InvitationsManager = class {
|
|
|
3535
3573
|
return invitation;
|
|
3536
3574
|
}
|
|
3537
3575
|
async authenticate({ invitationId, authCode }) {
|
|
3538
|
-
(0,
|
|
3539
|
-
F:
|
|
3576
|
+
(0, import_log12.log)("authenticating...", void 0, {
|
|
3577
|
+
F: __dxlog_file15,
|
|
3540
3578
|
L: 140,
|
|
3541
3579
|
S: this,
|
|
3542
3580
|
C: (f, a) => f(...a)
|
|
3543
3581
|
});
|
|
3544
3582
|
(0, import_invariant11.invariant)(invitationId, void 0, {
|
|
3545
|
-
F:
|
|
3583
|
+
F: __dxlog_file15,
|
|
3546
3584
|
L: 141,
|
|
3547
3585
|
S: this,
|
|
3548
3586
|
A: [
|
|
@@ -3552,10 +3590,10 @@ var InvitationsManager = class {
|
|
|
3552
3590
|
});
|
|
3553
3591
|
const observable = this._acceptInvitations.get(invitationId);
|
|
3554
3592
|
if (!observable) {
|
|
3555
|
-
|
|
3593
|
+
import_log12.log.warn("invalid invitation", {
|
|
3556
3594
|
invitationId
|
|
3557
3595
|
}, {
|
|
3558
|
-
F:
|
|
3596
|
+
F: __dxlog_file15,
|
|
3559
3597
|
L: 144,
|
|
3560
3598
|
S: this,
|
|
3561
3599
|
C: (f, a) => f(...a)
|
|
@@ -3565,16 +3603,16 @@ var InvitationsManager = class {
|
|
|
3565
3603
|
}
|
|
3566
3604
|
}
|
|
3567
3605
|
async cancelInvitation({ invitationId }) {
|
|
3568
|
-
(0,
|
|
3606
|
+
(0, import_log12.log)("cancelInvitation...", {
|
|
3569
3607
|
invitationId
|
|
3570
3608
|
}, {
|
|
3571
|
-
F:
|
|
3609
|
+
F: __dxlog_file15,
|
|
3572
3610
|
L: 151,
|
|
3573
3611
|
S: this,
|
|
3574
3612
|
C: (f, a) => f(...a)
|
|
3575
3613
|
});
|
|
3576
3614
|
(0, import_invariant11.invariant)(invitationId, void 0, {
|
|
3577
|
-
F:
|
|
3615
|
+
F: __dxlog_file15,
|
|
3578
3616
|
L: 152,
|
|
3579
3617
|
S: this,
|
|
3580
3618
|
A: [
|
|
@@ -3649,14 +3687,14 @@ var InvitationsManager = class {
|
|
|
3649
3687
|
void ctx.dispose();
|
|
3650
3688
|
}
|
|
3651
3689
|
}, {
|
|
3652
|
-
F:
|
|
3690
|
+
F: __dxlog_file15,
|
|
3653
3691
|
L: 234
|
|
3654
3692
|
});
|
|
3655
3693
|
ctx.onDispose(() => {
|
|
3656
|
-
(0,
|
|
3694
|
+
(0, import_log12.log)("complete", {
|
|
3657
3695
|
...handler.toJSON()
|
|
3658
3696
|
}, {
|
|
3659
|
-
F:
|
|
3697
|
+
F: __dxlog_file15,
|
|
3660
3698
|
L: 241,
|
|
3661
3699
|
S: this,
|
|
3662
3700
|
C: (f, a) => f(...a)
|
|
@@ -3686,10 +3724,10 @@ var InvitationsManager = class {
|
|
|
3686
3724
|
const ctx = new import_context9.Context({
|
|
3687
3725
|
onError: (err) => {
|
|
3688
3726
|
if (err instanceof import_async12.TimeoutError) {
|
|
3689
|
-
(0,
|
|
3727
|
+
(0, import_log12.log)("timeout", {
|
|
3690
3728
|
...handler.toJSON()
|
|
3691
3729
|
}, {
|
|
3692
|
-
F:
|
|
3730
|
+
F: __dxlog_file15,
|
|
3693
3731
|
L: 261,
|
|
3694
3732
|
S: this,
|
|
3695
3733
|
C: (f, a) => f(...a)
|
|
@@ -3699,8 +3737,8 @@ var InvitationsManager = class {
|
|
|
3699
3737
|
state: import_services12.Invitation.State.TIMEOUT
|
|
3700
3738
|
});
|
|
3701
3739
|
} else {
|
|
3702
|
-
|
|
3703
|
-
F:
|
|
3740
|
+
import_log12.log.warn("auth failed", err, {
|
|
3741
|
+
F: __dxlog_file15,
|
|
3704
3742
|
L: 264,
|
|
3705
3743
|
S: this,
|
|
3706
3744
|
C: (f, a) => f(...a)
|
|
@@ -3713,14 +3751,14 @@ var InvitationsManager = class {
|
|
|
3713
3751
|
void ctx.dispose();
|
|
3714
3752
|
}
|
|
3715
3753
|
}, {
|
|
3716
|
-
F:
|
|
3754
|
+
F: __dxlog_file15,
|
|
3717
3755
|
L: 258
|
|
3718
3756
|
});
|
|
3719
3757
|
ctx.onDispose(() => {
|
|
3720
|
-
(0,
|
|
3758
|
+
(0, import_log12.log)("complete", {
|
|
3721
3759
|
...handler.toJSON()
|
|
3722
3760
|
}, {
|
|
3723
|
-
F:
|
|
3761
|
+
F: __dxlog_file15,
|
|
3724
3762
|
L: 271,
|
|
3725
3763
|
S: this,
|
|
3726
3764
|
C: (f, a) => f(...a)
|
|
@@ -3764,8 +3802,8 @@ var InvitationsManager = class {
|
|
|
3764
3802
|
try {
|
|
3765
3803
|
await this._metadataStore.removeInvitation(invitation.invitationId);
|
|
3766
3804
|
} catch (err) {
|
|
3767
|
-
|
|
3768
|
-
F:
|
|
3805
|
+
import_log12.log.catch(err, void 0, {
|
|
3806
|
+
F: __dxlog_file15,
|
|
3769
3807
|
L: 307,
|
|
3770
3808
|
S: this,
|
|
3771
3809
|
C: (f, a) => f(...a)
|
|
@@ -3788,7 +3826,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
3788
3826
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3789
3827
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3790
3828
|
}
|
|
3791
|
-
var
|
|
3829
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
|
|
3792
3830
|
var Lock = class {
|
|
3793
3831
|
constructor({ lockKey: lockPath, onAcquire, onRelease }) {
|
|
3794
3832
|
this._lockPath = lockPath;
|
|
@@ -3799,16 +3837,16 @@ var Lock = class {
|
|
|
3799
3837
|
return this._lockPath;
|
|
3800
3838
|
}
|
|
3801
3839
|
async acquire() {
|
|
3802
|
-
(0,
|
|
3803
|
-
F:
|
|
3840
|
+
(0, import_log13.log)("acquiring lock...", void 0, {
|
|
3841
|
+
F: __dxlog_file16,
|
|
3804
3842
|
L: 32,
|
|
3805
3843
|
S: this,
|
|
3806
3844
|
C: (f, a) => f(...a)
|
|
3807
3845
|
});
|
|
3808
3846
|
this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
|
|
3809
3847
|
await this._onAcquire?.();
|
|
3810
|
-
(0,
|
|
3811
|
-
F:
|
|
3848
|
+
(0, import_log13.log)("acquired lock", void 0, {
|
|
3849
|
+
F: __dxlog_file16,
|
|
3812
3850
|
L: 37,
|
|
3813
3851
|
S: this,
|
|
3814
3852
|
C: (f, a) => f(...a)
|
|
@@ -3817,7 +3855,7 @@ var Lock = class {
|
|
|
3817
3855
|
async release() {
|
|
3818
3856
|
await this._onRelease?.();
|
|
3819
3857
|
(0, import_invariant12.invariant)(this._fileHandle, "Lock is not acquired", {
|
|
3820
|
-
F:
|
|
3858
|
+
F: __dxlog_file16,
|
|
3821
3859
|
L: 42,
|
|
3822
3860
|
S: this,
|
|
3823
3861
|
A: [
|
|
@@ -3829,7 +3867,7 @@ var Lock = class {
|
|
|
3829
3867
|
}
|
|
3830
3868
|
};
|
|
3831
3869
|
_ts_decorate3([
|
|
3832
|
-
|
|
3870
|
+
import_log13.logInfo
|
|
3833
3871
|
], Lock.prototype, "lockKey", null);
|
|
3834
3872
|
var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
|
|
3835
3873
|
function _ts_decorate4(decorators, target, key, desc) {
|
|
@@ -3970,7 +4008,7 @@ function _using_ctx() {
|
|
|
3970
4008
|
}
|
|
3971
4009
|
};
|
|
3972
4010
|
}
|
|
3973
|
-
var
|
|
4011
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/edge-feed-replicator.ts";
|
|
3974
4012
|
var EdgeFeedReplicator = class extends import_context10.Resource {
|
|
3975
4013
|
constructor({ messenger, spaceId }) {
|
|
3976
4014
|
super();
|
|
@@ -3988,16 +4026,16 @@ var EdgeFeedReplicator = class extends import_context10.Resource {
|
|
|
3988
4026
|
return;
|
|
3989
4027
|
}
|
|
3990
4028
|
const [service, ...rest] = message.serviceId.split(":");
|
|
3991
|
-
if (service !==
|
|
4029
|
+
if (service !== import_protocols8.EdgeService.FEED_REPLICATOR) {
|
|
3992
4030
|
return;
|
|
3993
4031
|
}
|
|
3994
4032
|
const [spaceId] = rest;
|
|
3995
4033
|
if (spaceId !== this._spaceId) {
|
|
3996
|
-
(0,
|
|
4034
|
+
(0, import_log14.log)("spaceID mismatch", {
|
|
3997
4035
|
spaceId,
|
|
3998
4036
|
_spaceId: this._spaceId
|
|
3999
4037
|
}, {
|
|
4000
|
-
F:
|
|
4038
|
+
F: __dxlog_file17,
|
|
4001
4039
|
L: 62,
|
|
4002
4040
|
S: this,
|
|
4003
4041
|
C: (f, a) => f(...a)
|
|
@@ -4005,11 +4043,11 @@ var EdgeFeedReplicator = class extends import_context10.Resource {
|
|
|
4005
4043
|
return;
|
|
4006
4044
|
}
|
|
4007
4045
|
const payload = (0, import_cbor_x.decode)(message.payload.value);
|
|
4008
|
-
|
|
4046
|
+
import_log14.log.info("recv", {
|
|
4009
4047
|
from: message.source,
|
|
4010
4048
|
payload
|
|
4011
4049
|
}, {
|
|
4012
|
-
F:
|
|
4050
|
+
F: __dxlog_file17,
|
|
4013
4051
|
L: 67,
|
|
4014
4052
|
S: this,
|
|
4015
4053
|
C: (f, a) => f(...a)
|
|
@@ -4030,10 +4068,10 @@ var EdgeFeedReplicator = class extends import_context10.Resource {
|
|
|
4030
4068
|
this._remoteLength.clear();
|
|
4031
4069
|
}
|
|
4032
4070
|
async addFeed(feed) {
|
|
4033
|
-
|
|
4071
|
+
import_log14.log.info("addFeed", {
|
|
4034
4072
|
key: feed.key
|
|
4035
4073
|
}, {
|
|
4036
|
-
F:
|
|
4074
|
+
F: __dxlog_file17,
|
|
4037
4075
|
L: 89,
|
|
4038
4076
|
S: this,
|
|
4039
4077
|
C: (f, a) => f(...a)
|
|
@@ -4048,7 +4086,7 @@ var EdgeFeedReplicator = class extends import_context10.Resource {
|
|
|
4048
4086
|
}
|
|
4049
4087
|
async _replicateFeed(feed) {
|
|
4050
4088
|
(0, import_invariant13.invariant)(this._connectionCtx, void 0, {
|
|
4051
|
-
F:
|
|
4089
|
+
F: __dxlog_file17,
|
|
4052
4090
|
L: 102,
|
|
4053
4091
|
S: this,
|
|
4054
4092
|
A: [
|
|
@@ -4065,16 +4103,16 @@ var EdgeFeedReplicator = class extends import_context10.Resource {
|
|
|
4065
4103
|
});
|
|
4066
4104
|
}
|
|
4067
4105
|
async _sendMessage(message) {
|
|
4068
|
-
|
|
4106
|
+
import_log14.log.info("sending message", {
|
|
4069
4107
|
message
|
|
4070
4108
|
}, {
|
|
4071
|
-
F:
|
|
4109
|
+
F: __dxlog_file17,
|
|
4072
4110
|
L: 115,
|
|
4073
4111
|
S: this,
|
|
4074
4112
|
C: (f, a) => f(...a)
|
|
4075
4113
|
});
|
|
4076
4114
|
(0, import_invariant13.invariant)(message.feedKey, void 0, {
|
|
4077
|
-
F:
|
|
4115
|
+
F: __dxlog_file17,
|
|
4078
4116
|
L: 117,
|
|
4079
4117
|
S: this,
|
|
4080
4118
|
A: [
|
|
@@ -4085,20 +4123,20 @@ var EdgeFeedReplicator = class extends import_context10.Resource {
|
|
|
4085
4123
|
const payloadValue = (0, import_util8.bufferToArray)((0, import_cbor_x.encode)(message));
|
|
4086
4124
|
await this._messenger.send(import_buf.buf.create(import_messenger_pb.MessageSchema, {
|
|
4087
4125
|
source: {
|
|
4088
|
-
identityKey: this._messenger.identityKey
|
|
4089
|
-
peerKey: this._messenger.
|
|
4126
|
+
identityKey: this._messenger.identityKey,
|
|
4127
|
+
peerKey: this._messenger.peerKey
|
|
4090
4128
|
},
|
|
4091
|
-
serviceId: `${
|
|
4129
|
+
serviceId: `${import_protocols8.EdgeService.FEED_REPLICATOR}:${this._spaceId}`,
|
|
4092
4130
|
payload: {
|
|
4093
4131
|
value: payloadValue
|
|
4094
4132
|
}
|
|
4095
4133
|
}));
|
|
4096
4134
|
}
|
|
4097
4135
|
_onMessage(message) {
|
|
4098
|
-
|
|
4136
|
+
import_log14.log.info("received message", {
|
|
4099
4137
|
message
|
|
4100
4138
|
}, {
|
|
4101
|
-
F:
|
|
4139
|
+
F: __dxlog_file17,
|
|
4102
4140
|
L: 133,
|
|
4103
4141
|
S: this,
|
|
4104
4142
|
C: (f, a) => f(...a)
|
|
@@ -4111,10 +4149,10 @@ var EdgeFeedReplicator = class extends import_context10.Resource {
|
|
|
4111
4149
|
const feedKey = import_keys10.PublicKey.fromHex(message.feedKey);
|
|
4112
4150
|
const feed = this._feeds.get(feedKey);
|
|
4113
4151
|
if (!feed) {
|
|
4114
|
-
|
|
4152
|
+
import_log14.log.warn("Feed not found", {
|
|
4115
4153
|
feedKey
|
|
4116
4154
|
}, {
|
|
4117
|
-
F:
|
|
4155
|
+
F: __dxlog_file17,
|
|
4118
4156
|
L: 141,
|
|
4119
4157
|
S: this,
|
|
4120
4158
|
C: (f, a) => f(...a)
|
|
@@ -4146,10 +4184,10 @@ var EdgeFeedReplicator = class extends import_context10.Resource {
|
|
|
4146
4184
|
const feedKey = import_keys10.PublicKey.fromHex(message.feedKey);
|
|
4147
4185
|
const feed = this._feeds.get(feedKey);
|
|
4148
4186
|
if (!feed) {
|
|
4149
|
-
|
|
4187
|
+
import_log14.log.warn("Feed not found", {
|
|
4150
4188
|
feedKey
|
|
4151
4189
|
}, {
|
|
4152
|
-
F:
|
|
4190
|
+
F: __dxlog_file17,
|
|
4153
4191
|
L: 166,
|
|
4154
4192
|
S: this,
|
|
4155
4193
|
C: (f, a) => f(...a)
|
|
@@ -4160,10 +4198,10 @@ var EdgeFeedReplicator = class extends import_context10.Resource {
|
|
|
4160
4198
|
break;
|
|
4161
4199
|
}
|
|
4162
4200
|
default: {
|
|
4163
|
-
|
|
4201
|
+
import_log14.log.warn("Unknown message", {
|
|
4164
4202
|
...message
|
|
4165
4203
|
}, {
|
|
4166
|
-
F:
|
|
4204
|
+
F: __dxlog_file17,
|
|
4167
4205
|
L: 175,
|
|
4168
4206
|
S: this,
|
|
4169
4207
|
C: (f, a) => f(...a)
|
|
@@ -4173,12 +4211,12 @@ var EdgeFeedReplicator = class extends import_context10.Resource {
|
|
|
4173
4211
|
});
|
|
4174
4212
|
}
|
|
4175
4213
|
async _pushBlocks(feed, from, to) {
|
|
4176
|
-
|
|
4214
|
+
import_log14.log.info("pushing blocks", {
|
|
4177
4215
|
feed: feed.key.toHex(),
|
|
4178
4216
|
from,
|
|
4179
4217
|
to
|
|
4180
4218
|
}, {
|
|
4181
|
-
F:
|
|
4219
|
+
F: __dxlog_file17,
|
|
4182
4220
|
L: 182,
|
|
4183
4221
|
S: this,
|
|
4184
4222
|
C: (f, a) => f(...a)
|
|
@@ -4188,7 +4226,7 @@ var EdgeFeedReplicator = class extends import_context10.Resource {
|
|
|
4188
4226
|
valueEncoding: "binary"
|
|
4189
4227
|
});
|
|
4190
4228
|
(0, import_invariant13.invariant)(data instanceof Uint8Array, void 0, {
|
|
4191
|
-
F:
|
|
4229
|
+
F: __dxlog_file17,
|
|
4192
4230
|
L: 187,
|
|
4193
4231
|
S: this,
|
|
4194
4232
|
A: [
|
|
@@ -4212,11 +4250,11 @@ var EdgeFeedReplicator = class extends import_context10.Resource {
|
|
|
4212
4250
|
this._remoteLength.set(feed.key, to);
|
|
4213
4251
|
}
|
|
4214
4252
|
async _integrateBlocks(feed, blocks) {
|
|
4215
|
-
|
|
4253
|
+
import_log14.log.info("integrating blocks", {
|
|
4216
4254
|
feed: feed.key.toHex(),
|
|
4217
4255
|
blocks: blocks.length
|
|
4218
4256
|
}, {
|
|
4219
|
-
F:
|
|
4257
|
+
F: __dxlog_file17,
|
|
4220
4258
|
L: 208,
|
|
4221
4259
|
S: this,
|
|
4222
4260
|
C: (f, a) => f(...a)
|
|
@@ -4300,7 +4338,7 @@ var AutomergeSpaceState = class extends import_context12.Resource {
|
|
|
4300
4338
|
await this.onNewEpoch.waitForCondition(() => !!this.lastEpoch);
|
|
4301
4339
|
}
|
|
4302
4340
|
};
|
|
4303
|
-
var
|
|
4341
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts";
|
|
4304
4342
|
var LOAD_DOC_TIMEOUT = 1e4;
|
|
4305
4343
|
var runEpochMigration = async (ctx, context) => {
|
|
4306
4344
|
switch (context.migration) {
|
|
@@ -4325,8 +4363,8 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4325
4363
|
};
|
|
4326
4364
|
}
|
|
4327
4365
|
case import_services14.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
|
|
4328
|
-
|
|
4329
|
-
F:
|
|
4366
|
+
import_log16.log.info("Fragmenting", void 0, {
|
|
4367
|
+
F: __dxlog_file18,
|
|
4330
4368
|
L: 64,
|
|
4331
4369
|
S: void 0,
|
|
4332
4370
|
C: (f, a) => f(...a)
|
|
@@ -4339,7 +4377,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4339
4377
|
const properties = (0, import_echo_db.findInlineObjectOfType)(rootHandle.docSync(), import_echo_schema.TYPE_PROPERTIES);
|
|
4340
4378
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
4341
4379
|
(0, import_invariant15.invariant)(properties, "Properties not found", {
|
|
4342
|
-
F:
|
|
4380
|
+
F: __dxlog_file18,
|
|
4343
4381
|
L: 75,
|
|
4344
4382
|
S: void 0,
|
|
4345
4383
|
A: [
|
|
@@ -4354,7 +4392,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4354
4392
|
])
|
|
4355
4393
|
});
|
|
4356
4394
|
(0, import_invariant15.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
4357
|
-
F:
|
|
4395
|
+
F: __dxlog_file18,
|
|
4358
4396
|
L: 82,
|
|
4359
4397
|
S: void 0,
|
|
4360
4398
|
A: [
|
|
@@ -4395,7 +4433,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4395
4433
|
timeout: LOAD_DOC_TIMEOUT
|
|
4396
4434
|
});
|
|
4397
4435
|
(0, import_invariant15.invariant)(rootHandle.docSync(), "Root doc not found", {
|
|
4398
|
-
F:
|
|
4436
|
+
F: __dxlog_file18,
|
|
4399
4437
|
L: 115,
|
|
4400
4438
|
S: void 0,
|
|
4401
4439
|
A: [
|
|
@@ -4410,7 +4448,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4410
4448
|
timeout: LOAD_DOC_TIMEOUT
|
|
4411
4449
|
});
|
|
4412
4450
|
(0, import_invariant15.invariant)(handle.docSync(), void 0, {
|
|
4413
|
-
F:
|
|
4451
|
+
F: __dxlog_file18,
|
|
4414
4452
|
L: 122,
|
|
4415
4453
|
S: void 0,
|
|
4416
4454
|
A: [
|
|
@@ -4425,12 +4463,12 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4425
4463
|
});
|
|
4426
4464
|
newRootContent.links[id] = newHandle.url;
|
|
4427
4465
|
} catch (err) {
|
|
4428
|
-
|
|
4466
|
+
import_log16.log.warn("Failed to migrate reference", {
|
|
4429
4467
|
id,
|
|
4430
4468
|
url,
|
|
4431
4469
|
error: err
|
|
4432
4470
|
}, {
|
|
4433
|
-
F:
|
|
4471
|
+
F: __dxlog_file18,
|
|
4434
4472
|
L: 128,
|
|
4435
4473
|
S: void 0,
|
|
4436
4474
|
C: (f, a) => f(...a)
|
|
@@ -4449,7 +4487,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4449
4487
|
}
|
|
4450
4488
|
case import_services14.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
|
|
4451
4489
|
(0, import_invariant15.invariant)(context.newAutomergeRoot, void 0, {
|
|
4452
|
-
F:
|
|
4490
|
+
F: __dxlog_file18,
|
|
4453
4491
|
L: 143,
|
|
4454
4492
|
S: void 0,
|
|
4455
4493
|
A: [
|
|
@@ -4465,7 +4503,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4465
4503
|
}
|
|
4466
4504
|
return {};
|
|
4467
4505
|
};
|
|
4468
|
-
var
|
|
4506
|
+
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
4469
4507
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
4470
4508
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
4471
4509
|
var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
@@ -4473,7 +4511,7 @@ var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
|
4473
4511
|
var NotarizationPlugin = class {
|
|
4474
4512
|
constructor() {
|
|
4475
4513
|
this._ctx = new import_context13.Context(void 0, {
|
|
4476
|
-
F:
|
|
4514
|
+
F: __dxlog_file19,
|
|
4477
4515
|
L: 62
|
|
4478
4516
|
});
|
|
4479
4517
|
this._extensionOpened = new import_async16.Event();
|
|
@@ -4493,16 +4531,16 @@ var NotarizationPlugin = class {
|
|
|
4493
4531
|
* Request credentials to be notarized.
|
|
4494
4532
|
*/
|
|
4495
4533
|
async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY }) {
|
|
4496
|
-
(0,
|
|
4534
|
+
(0, import_log17.log)("notarize", {
|
|
4497
4535
|
credentials
|
|
4498
4536
|
}, {
|
|
4499
|
-
F:
|
|
4537
|
+
F: __dxlog_file19,
|
|
4500
4538
|
L: 90,
|
|
4501
4539
|
S: this,
|
|
4502
4540
|
C: (f, a) => f(...a)
|
|
4503
4541
|
});
|
|
4504
4542
|
(0, import_invariant16.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
4505
|
-
F:
|
|
4543
|
+
F: __dxlog_file19,
|
|
4506
4544
|
L: 91,
|
|
4507
4545
|
S: this,
|
|
4508
4546
|
A: [
|
|
@@ -4513,10 +4551,10 @@ var NotarizationPlugin = class {
|
|
|
4513
4551
|
const errors = new import_async16.Trigger();
|
|
4514
4552
|
const ctx = this._ctx.derive({
|
|
4515
4553
|
onError: (err) => {
|
|
4516
|
-
|
|
4554
|
+
import_log17.log.warn("Notarization error", {
|
|
4517
4555
|
err
|
|
4518
4556
|
}, {
|
|
4519
|
-
F:
|
|
4557
|
+
F: __dxlog_file19,
|
|
4520
4558
|
L: 99,
|
|
4521
4559
|
S: this,
|
|
4522
4560
|
C: (f, a) => f(...a)
|
|
@@ -4528,11 +4566,11 @@ var NotarizationPlugin = class {
|
|
|
4528
4566
|
opCtx?.onDispose(() => ctx.dispose());
|
|
4529
4567
|
if (timeout !== 0) {
|
|
4530
4568
|
(0, import_async16.scheduleTask)(ctx, () => {
|
|
4531
|
-
|
|
4569
|
+
import_log17.log.warn("Notarization timeout", {
|
|
4532
4570
|
timeout,
|
|
4533
4571
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
4534
4572
|
}, {
|
|
4535
|
-
F:
|
|
4573
|
+
F: __dxlog_file19,
|
|
4536
4574
|
L: 111,
|
|
4537
4575
|
S: this,
|
|
4538
4576
|
C: (f, a) => f(...a)
|
|
@@ -4552,10 +4590,10 @@ var NotarizationPlugin = class {
|
|
|
4552
4590
|
...this._extensions
|
|
4553
4591
|
].find((peer2) => !peersTried.has(peer2));
|
|
4554
4592
|
if (!peer) {
|
|
4555
|
-
|
|
4593
|
+
import_log17.log.info("Exhausted all peers to notarize with", {
|
|
4556
4594
|
retryIn: retryTimeout
|
|
4557
4595
|
}, {
|
|
4558
|
-
F:
|
|
4596
|
+
F: __dxlog_file19,
|
|
4559
4597
|
L: 136,
|
|
4560
4598
|
S: this,
|
|
4561
4599
|
C: (f, a) => f(...a)
|
|
@@ -4565,11 +4603,11 @@ var NotarizationPlugin = class {
|
|
|
4565
4603
|
return;
|
|
4566
4604
|
}
|
|
4567
4605
|
peersTried.add(peer);
|
|
4568
|
-
(0,
|
|
4606
|
+
(0, import_log17.log)("try notarizing", {
|
|
4569
4607
|
peer: peer.localPeerId,
|
|
4570
4608
|
credentialId: credentials.map((credential) => credential.id)
|
|
4571
4609
|
}, {
|
|
4572
|
-
F:
|
|
4610
|
+
F: __dxlog_file19,
|
|
4573
4611
|
L: 143,
|
|
4574
4612
|
S: this,
|
|
4575
4613
|
C: (f, a) => f(...a)
|
|
@@ -4577,8 +4615,8 @@ var NotarizationPlugin = class {
|
|
|
4577
4615
|
await peer.rpc.NotarizationService.notarize({
|
|
4578
4616
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
4579
4617
|
});
|
|
4580
|
-
(0,
|
|
4581
|
-
F:
|
|
4618
|
+
(0, import_log17.log)("success", void 0, {
|
|
4619
|
+
F: __dxlog_file19,
|
|
4582
4620
|
L: 147,
|
|
4583
4621
|
S: this,
|
|
4584
4622
|
C: (f, a) => f(...a)
|
|
@@ -4586,8 +4624,8 @@ var NotarizationPlugin = class {
|
|
|
4586
4624
|
await (0, import_async16.sleep)(successDelay);
|
|
4587
4625
|
} catch (err) {
|
|
4588
4626
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
4589
|
-
|
|
4590
|
-
F:
|
|
4627
|
+
import_log17.log.info("error notarizing (recoverable)", err, {
|
|
4628
|
+
F: __dxlog_file19,
|
|
4591
4629
|
L: 151,
|
|
4592
4630
|
S: this,
|
|
4593
4631
|
C: (f, a) => f(...a)
|
|
@@ -4604,8 +4642,8 @@ var NotarizationPlugin = class {
|
|
|
4604
4642
|
allNotarized,
|
|
4605
4643
|
errors.wait()
|
|
4606
4644
|
]);
|
|
4607
|
-
(0,
|
|
4608
|
-
F:
|
|
4645
|
+
(0, import_log17.log)("done", void 0, {
|
|
4646
|
+
F: __dxlog_file19,
|
|
4609
4647
|
L: 162,
|
|
4610
4648
|
S: this,
|
|
4611
4649
|
C: (f, a) => f(...a)
|
|
@@ -4627,7 +4665,7 @@ var NotarizationPlugin = class {
|
|
|
4627
4665
|
}
|
|
4628
4666
|
setWriter(writer) {
|
|
4629
4667
|
(0, import_invariant16.invariant)(!this._writer, "Writer already set.", {
|
|
4630
|
-
F:
|
|
4668
|
+
F: __dxlog_file19,
|
|
4631
4669
|
L: 181,
|
|
4632
4670
|
S: this,
|
|
4633
4671
|
A: [
|
|
@@ -4652,7 +4690,7 @@ var NotarizationPlugin = class {
|
|
|
4652
4690
|
}
|
|
4653
4691
|
for (const credential of request.credentials ?? []) {
|
|
4654
4692
|
(0, import_invariant16.invariant)(credential.id, "Credential must have an id", {
|
|
4655
|
-
F:
|
|
4693
|
+
F: __dxlog_file19,
|
|
4656
4694
|
L: 200,
|
|
4657
4695
|
S: this,
|
|
4658
4696
|
A: [
|
|
@@ -4669,10 +4707,10 @@ var NotarizationPlugin = class {
|
|
|
4669
4707
|
createExtension() {
|
|
4670
4708
|
const extension = new NotarizationTeleportExtension({
|
|
4671
4709
|
onOpen: async () => {
|
|
4672
|
-
(0,
|
|
4710
|
+
(0, import_log17.log)("extension opened", {
|
|
4673
4711
|
peer: extension.localPeerId
|
|
4674
4712
|
}, {
|
|
4675
|
-
F:
|
|
4713
|
+
F: __dxlog_file19,
|
|
4676
4714
|
L: 211,
|
|
4677
4715
|
S: this,
|
|
4678
4716
|
C: (f, a) => f(...a)
|
|
@@ -4681,10 +4719,10 @@ var NotarizationPlugin = class {
|
|
|
4681
4719
|
this._extensionOpened.emit();
|
|
4682
4720
|
},
|
|
4683
4721
|
onClose: async () => {
|
|
4684
|
-
(0,
|
|
4722
|
+
(0, import_log17.log)("extension closed", {
|
|
4685
4723
|
peer: extension.localPeerId
|
|
4686
4724
|
}, {
|
|
4687
|
-
F:
|
|
4725
|
+
F: __dxlog_file19,
|
|
4688
4726
|
L: 216,
|
|
4689
4727
|
S: this,
|
|
4690
4728
|
C: (f, a) => f(...a)
|
|
@@ -4700,10 +4738,10 @@ var NotarizationTeleportExtension = class extends import_teleport3.RpcExtension
|
|
|
4700
4738
|
constructor(_params) {
|
|
4701
4739
|
super({
|
|
4702
4740
|
requested: {
|
|
4703
|
-
NotarizationService:
|
|
4741
|
+
NotarizationService: import_proto4.schema.getService("dxos.mesh.teleport.notarization.NotarizationService")
|
|
4704
4742
|
},
|
|
4705
4743
|
exposed: {
|
|
4706
|
-
NotarizationService:
|
|
4744
|
+
NotarizationService: import_proto4.schema.getService("dxos.mesh.teleport.notarization.NotarizationService")
|
|
4707
4745
|
}
|
|
4708
4746
|
});
|
|
4709
4747
|
this._params = _params;
|
|
@@ -4799,11 +4837,11 @@ function _using_ctx2() {
|
|
|
4799
4837
|
}
|
|
4800
4838
|
};
|
|
4801
4839
|
}
|
|
4802
|
-
var
|
|
4840
|
+
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
4803
4841
|
var DataSpace = class {
|
|
4804
4842
|
constructor(params) {
|
|
4805
4843
|
this._ctx = new import_context11.Context(void 0, {
|
|
4806
|
-
F:
|
|
4844
|
+
F: __dxlog_file20,
|
|
4807
4845
|
L: 89
|
|
4808
4846
|
});
|
|
4809
4847
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
@@ -4844,10 +4882,10 @@ var DataSpace = class {
|
|
|
4844
4882
|
});
|
|
4845
4883
|
}
|
|
4846
4884
|
this._state = params.initialState;
|
|
4847
|
-
(0,
|
|
4885
|
+
(0, import_log15.log)("new state", {
|
|
4848
4886
|
state: import_services13.SpaceState[this._state]
|
|
4849
4887
|
}, {
|
|
4850
|
-
F:
|
|
4888
|
+
F: __dxlog_file20,
|
|
4851
4889
|
L: 159,
|
|
4852
4890
|
S: this,
|
|
4853
4891
|
C: (f, a) => f(...a)
|
|
@@ -4906,15 +4944,15 @@ var DataSpace = class {
|
|
|
4906
4944
|
this.inner.protocol.feedAdded.append(this._onFeedAdded);
|
|
4907
4945
|
}
|
|
4908
4946
|
await this._inner.open(new import_context11.Context(void 0, {
|
|
4909
|
-
F:
|
|
4947
|
+
F: __dxlog_file20,
|
|
4910
4948
|
L: 233
|
|
4911
4949
|
}));
|
|
4912
4950
|
await this._edgeFeedReplicator?.open();
|
|
4913
4951
|
this._state = import_services13.SpaceState.SPACE_CONTROL_ONLY;
|
|
4914
|
-
(0,
|
|
4952
|
+
(0, import_log15.log)("new state", {
|
|
4915
4953
|
state: import_services13.SpaceState[this._state]
|
|
4916
4954
|
}, {
|
|
4917
|
-
F:
|
|
4955
|
+
F: __dxlog_file20,
|
|
4918
4956
|
L: 238,
|
|
4919
4957
|
S: this,
|
|
4920
4958
|
C: (f, a) => f(...a)
|
|
@@ -4931,17 +4969,17 @@ var DataSpace = class {
|
|
|
4931
4969
|
await this._callbacks.beforeClose?.();
|
|
4932
4970
|
await this.preClose.callSerial();
|
|
4933
4971
|
this._state = import_services13.SpaceState.SPACE_CLOSED;
|
|
4934
|
-
(0,
|
|
4972
|
+
(0, import_log15.log)("new state", {
|
|
4935
4973
|
state: import_services13.SpaceState[this._state]
|
|
4936
4974
|
}, {
|
|
4937
|
-
F:
|
|
4975
|
+
F: __dxlog_file20,
|
|
4938
4976
|
L: 257,
|
|
4939
4977
|
S: this,
|
|
4940
4978
|
C: (f, a) => f(...a)
|
|
4941
4979
|
});
|
|
4942
4980
|
await this._ctx.dispose();
|
|
4943
4981
|
this._ctx = new import_context11.Context(void 0, {
|
|
4944
|
-
F:
|
|
4982
|
+
F: __dxlog_file20,
|
|
4945
4983
|
L: 259
|
|
4946
4984
|
});
|
|
4947
4985
|
if (this._edgeFeedReplicator) {
|
|
@@ -4972,26 +5010,26 @@ var DataSpace = class {
|
|
|
4972
5010
|
this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
|
|
4973
5011
|
await this.initializeDataPipeline();
|
|
4974
5012
|
} catch (err) {
|
|
4975
|
-
if (err instanceof
|
|
4976
|
-
(0,
|
|
4977
|
-
F:
|
|
5013
|
+
if (err instanceof import_protocols9.CancelledError || err instanceof import_context11.ContextDisposedError) {
|
|
5014
|
+
(0, import_log15.log)("data pipeline initialization cancelled", err, {
|
|
5015
|
+
F: __dxlog_file20,
|
|
4978
5016
|
L: 297,
|
|
4979
5017
|
S: this,
|
|
4980
5018
|
C: (f, a) => f(...a)
|
|
4981
5019
|
});
|
|
4982
5020
|
return;
|
|
4983
5021
|
}
|
|
4984
|
-
|
|
4985
|
-
F:
|
|
5022
|
+
import_log15.log.error("Error initializing data pipeline", err, {
|
|
5023
|
+
F: __dxlog_file20,
|
|
4986
5024
|
L: 301,
|
|
4987
5025
|
S: this,
|
|
4988
5026
|
C: (f, a) => f(...a)
|
|
4989
5027
|
});
|
|
4990
5028
|
this._state = import_services13.SpaceState.SPACE_ERROR;
|
|
4991
|
-
(0,
|
|
5029
|
+
(0, import_log15.log)("new state", {
|
|
4992
5030
|
state: import_services13.SpaceState[this._state]
|
|
4993
5031
|
}, {
|
|
4994
|
-
F:
|
|
5032
|
+
F: __dxlog_file20,
|
|
4995
5033
|
L: 303,
|
|
4996
5034
|
S: this,
|
|
4997
5035
|
C: (f, a) => f(...a)
|
|
@@ -5005,13 +5043,13 @@ var DataSpace = class {
|
|
|
5005
5043
|
}
|
|
5006
5044
|
async initializeDataPipeline() {
|
|
5007
5045
|
if (this._state !== import_services13.SpaceState.SPACE_CONTROL_ONLY) {
|
|
5008
|
-
throw new
|
|
5046
|
+
throw new import_protocols9.SystemError("Invalid operation");
|
|
5009
5047
|
}
|
|
5010
5048
|
this._state = import_services13.SpaceState.SPACE_INITIALIZING;
|
|
5011
|
-
(0,
|
|
5049
|
+
(0, import_log15.log)("new state", {
|
|
5012
5050
|
state: import_services13.SpaceState[this._state]
|
|
5013
5051
|
}, {
|
|
5014
|
-
F:
|
|
5052
|
+
F: __dxlog_file20,
|
|
5015
5053
|
L: 319,
|
|
5016
5054
|
S: this,
|
|
5017
5055
|
C: (f, a) => f(...a)
|
|
@@ -5025,10 +5063,10 @@ var DataSpace = class {
|
|
|
5025
5063
|
async _enterReadyState() {
|
|
5026
5064
|
await this._callbacks.beforeReady?.();
|
|
5027
5065
|
this._state = import_services13.SpaceState.SPACE_READY;
|
|
5028
|
-
(0,
|
|
5066
|
+
(0, import_log15.log)("new state", {
|
|
5029
5067
|
state: import_services13.SpaceState[this._state]
|
|
5030
5068
|
}, {
|
|
5031
|
-
F:
|
|
5069
|
+
F: __dxlog_file20,
|
|
5032
5070
|
L: 338,
|
|
5033
5071
|
S: this,
|
|
5034
5072
|
C: (f, a) => f(...a)
|
|
@@ -5043,8 +5081,8 @@ var DataSpace = class {
|
|
|
5043
5081
|
});
|
|
5044
5082
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
5045
5083
|
await this._createWritableFeeds();
|
|
5046
|
-
(0,
|
|
5047
|
-
F:
|
|
5084
|
+
(0, import_log15.log)("writable feeds created", void 0, {
|
|
5085
|
+
F: __dxlog_file20,
|
|
5048
5086
|
L: 354,
|
|
5049
5087
|
S: this,
|
|
5050
5088
|
C: (f, a) => f(...a)
|
|
@@ -5103,11 +5141,11 @@ var DataSpace = class {
|
|
|
5103
5141
|
}
|
|
5104
5142
|
}
|
|
5105
5143
|
_onNewAutomergeRoot(rootUrl) {
|
|
5106
|
-
(0,
|
|
5144
|
+
(0, import_log15.log)("loading automerge root doc for space", {
|
|
5107
5145
|
space: this.key,
|
|
5108
5146
|
rootUrl
|
|
5109
5147
|
}, {
|
|
5110
|
-
F:
|
|
5148
|
+
F: __dxlog_file20,
|
|
5111
5149
|
L: 420,
|
|
5112
5150
|
S: this,
|
|
5113
5151
|
C: (f, a) => f(...a)
|
|
@@ -5154,12 +5192,12 @@ var DataSpace = class {
|
|
|
5154
5192
|
if (err instanceof import_context11.ContextDisposedError) {
|
|
5155
5193
|
return;
|
|
5156
5194
|
}
|
|
5157
|
-
|
|
5195
|
+
import_log15.log.warn("error loading automerge root doc", {
|
|
5158
5196
|
space: this.key,
|
|
5159
5197
|
rootUrl,
|
|
5160
5198
|
err
|
|
5161
5199
|
}, {
|
|
5162
|
-
F:
|
|
5200
|
+
F: __dxlog_file20,
|
|
5163
5201
|
L: 463,
|
|
5164
5202
|
S: this,
|
|
5165
5203
|
C: (f, a) => f(...a)
|
|
@@ -5246,10 +5284,10 @@ var DataSpace = class {
|
|
|
5246
5284
|
await this._close();
|
|
5247
5285
|
}
|
|
5248
5286
|
this._state = import_services13.SpaceState.SPACE_INACTIVE;
|
|
5249
|
-
(0,
|
|
5287
|
+
(0, import_log15.log)("new state", {
|
|
5250
5288
|
state: import_services13.SpaceState[this._state]
|
|
5251
5289
|
}, {
|
|
5252
|
-
F:
|
|
5290
|
+
F: __dxlog_file20,
|
|
5253
5291
|
L: 545,
|
|
5254
5292
|
S: this,
|
|
5255
5293
|
C: (f, a) => f(...a)
|
|
@@ -5379,7 +5417,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
5379
5417
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5380
5418
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5381
5419
|
}
|
|
5382
|
-
var
|
|
5420
|
+
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
5383
5421
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
5384
5422
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
5385
5423
|
var DEFAULT_SPACE_KEY = "__DEFAULT__";
|
|
@@ -5434,45 +5472,45 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5434
5472
|
return this._spaces;
|
|
5435
5473
|
}
|
|
5436
5474
|
async _open() {
|
|
5437
|
-
(0,
|
|
5438
|
-
F:
|
|
5475
|
+
(0, import_log18.log)("open", void 0, {
|
|
5476
|
+
F: __dxlog_file21,
|
|
5439
5477
|
L: 192,
|
|
5440
5478
|
S: this,
|
|
5441
5479
|
C: (f, a) => f(...a)
|
|
5442
5480
|
});
|
|
5443
|
-
|
|
5481
|
+
import_log18.log.trace("dxos.echo.data-space-manager.open", import_protocols10.trace.begin({
|
|
5444
5482
|
id: this._instanceId
|
|
5445
5483
|
}), {
|
|
5446
|
-
F:
|
|
5484
|
+
F: __dxlog_file21,
|
|
5447
5485
|
L: 193,
|
|
5448
5486
|
S: this,
|
|
5449
5487
|
C: (f, a) => f(...a)
|
|
5450
5488
|
});
|
|
5451
|
-
(0,
|
|
5489
|
+
(0, import_log18.log)("metadata loaded", {
|
|
5452
5490
|
spaces: this._metadataStore.spaces.length
|
|
5453
5491
|
}, {
|
|
5454
|
-
F:
|
|
5492
|
+
F: __dxlog_file21,
|
|
5455
5493
|
L: 194,
|
|
5456
5494
|
S: this,
|
|
5457
5495
|
C: (f, a) => f(...a)
|
|
5458
5496
|
});
|
|
5459
5497
|
await (0, import_util11.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
|
|
5460
5498
|
try {
|
|
5461
|
-
(0,
|
|
5499
|
+
(0, import_log18.log)("load space", {
|
|
5462
5500
|
spaceMetadata
|
|
5463
5501
|
}, {
|
|
5464
|
-
F:
|
|
5502
|
+
F: __dxlog_file21,
|
|
5465
5503
|
L: 198,
|
|
5466
5504
|
S: this,
|
|
5467
5505
|
C: (f, a) => f(...a)
|
|
5468
5506
|
});
|
|
5469
5507
|
await this._constructSpace(spaceMetadata);
|
|
5470
5508
|
} catch (err) {
|
|
5471
|
-
|
|
5509
|
+
import_log18.log.error("Error loading space", {
|
|
5472
5510
|
spaceMetadata,
|
|
5473
5511
|
err
|
|
5474
5512
|
}, {
|
|
5475
|
-
F:
|
|
5513
|
+
F: __dxlog_file21,
|
|
5476
5514
|
L: 201,
|
|
5477
5515
|
S: this,
|
|
5478
5516
|
C: (f, a) => f(...a)
|
|
@@ -5480,18 +5518,18 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5480
5518
|
}
|
|
5481
5519
|
});
|
|
5482
5520
|
this.updated.emit();
|
|
5483
|
-
|
|
5521
|
+
import_log18.log.trace("dxos.echo.data-space-manager.open", import_protocols10.trace.end({
|
|
5484
5522
|
id: this._instanceId
|
|
5485
5523
|
}), {
|
|
5486
|
-
F:
|
|
5524
|
+
F: __dxlog_file21,
|
|
5487
5525
|
L: 207,
|
|
5488
5526
|
S: this,
|
|
5489
5527
|
C: (f, a) => f(...a)
|
|
5490
5528
|
});
|
|
5491
5529
|
}
|
|
5492
5530
|
async _close() {
|
|
5493
|
-
(0,
|
|
5494
|
-
F:
|
|
5531
|
+
(0, import_log18.log)("close", void 0, {
|
|
5532
|
+
F: __dxlog_file21,
|
|
5495
5533
|
L: 212,
|
|
5496
5534
|
S: this,
|
|
5497
5535
|
C: (f, a) => f(...a)
|
|
@@ -5506,7 +5544,7 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5506
5544
|
*/
|
|
5507
5545
|
async createSpace() {
|
|
5508
5546
|
(0, import_invariant17.invariant)(this._lifecycleState === import_context14.LifecycleState.OPEN, "Not open.", {
|
|
5509
|
-
F:
|
|
5547
|
+
F: __dxlog_file21,
|
|
5510
5548
|
L: 224,
|
|
5511
5549
|
S: this,
|
|
5512
5550
|
A: [
|
|
@@ -5524,10 +5562,10 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5524
5562
|
dataFeedKey,
|
|
5525
5563
|
state: import_services15.SpaceState.SPACE_ACTIVE
|
|
5526
5564
|
};
|
|
5527
|
-
(0,
|
|
5565
|
+
(0, import_log18.log)("creating space...", {
|
|
5528
5566
|
spaceKey
|
|
5529
5567
|
}, {
|
|
5530
|
-
F:
|
|
5568
|
+
F: __dxlog_file21,
|
|
5531
5569
|
L: 236,
|
|
5532
5570
|
S: this,
|
|
5533
5571
|
C: (f, a) => f(...a)
|
|
@@ -5539,7 +5577,7 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5539
5577
|
await this._metadataStore.addSpace(metadata);
|
|
5540
5578
|
const memberCredential = credentials[1];
|
|
5541
5579
|
(0, import_invariant17.invariant)((0, import_credentials15.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5542
|
-
F:
|
|
5580
|
+
F: __dxlog_file21,
|
|
5543
5581
|
L: 246,
|
|
5544
5582
|
S: this,
|
|
5545
5583
|
A: [
|
|
@@ -5567,11 +5605,11 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5567
5605
|
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
5568
5606
|
}
|
|
5569
5607
|
default:
|
|
5570
|
-
|
|
5608
|
+
import_log18.log.warn("unknown space version", {
|
|
5571
5609
|
version: space.databaseRoot.getVersion(),
|
|
5572
5610
|
spaceId: space.id
|
|
5573
5611
|
}, {
|
|
5574
|
-
F:
|
|
5612
|
+
F: __dxlog_file21,
|
|
5575
5613
|
L: 271,
|
|
5576
5614
|
S: this,
|
|
5577
5615
|
C: (f, a) => f(...a)
|
|
@@ -5606,7 +5644,7 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5606
5644
|
async _getSpaceRootDocument(space) {
|
|
5607
5645
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5608
5646
|
(0, import_invariant17.invariant)(automergeIndex, void 0, {
|
|
5609
|
-
F:
|
|
5647
|
+
F: __dxlog_file21,
|
|
5610
5648
|
L: 304,
|
|
5611
5649
|
S: this,
|
|
5612
5650
|
A: [
|
|
@@ -5620,16 +5658,16 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5620
5658
|
}
|
|
5621
5659
|
// TODO(burdon): Rename join space.
|
|
5622
5660
|
async acceptSpace(opts) {
|
|
5623
|
-
(0,
|
|
5661
|
+
(0, import_log18.log)("accept space", {
|
|
5624
5662
|
opts
|
|
5625
5663
|
}, {
|
|
5626
|
-
F:
|
|
5664
|
+
F: __dxlog_file21,
|
|
5627
5665
|
L: 313,
|
|
5628
5666
|
S: this,
|
|
5629
5667
|
C: (f, a) => f(...a)
|
|
5630
5668
|
});
|
|
5631
5669
|
(0, import_invariant17.invariant)(this._lifecycleState === import_context14.LifecycleState.OPEN, "Not open.", {
|
|
5632
|
-
F:
|
|
5670
|
+
F: __dxlog_file21,
|
|
5633
5671
|
L: 314,
|
|
5634
5672
|
S: this,
|
|
5635
5673
|
A: [
|
|
@@ -5638,7 +5676,7 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5638
5676
|
]
|
|
5639
5677
|
});
|
|
5640
5678
|
(0, import_invariant17.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
5641
|
-
F:
|
|
5679
|
+
F: __dxlog_file21,
|
|
5642
5680
|
L: 315,
|
|
5643
5681
|
S: this,
|
|
5644
5682
|
A: [
|
|
@@ -5662,7 +5700,7 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5662
5700
|
async admitMember(options) {
|
|
5663
5701
|
const space = this._spaceManager.spaces.get(options.spaceKey);
|
|
5664
5702
|
(0, import_invariant17.invariant)(space, void 0, {
|
|
5665
|
-
F:
|
|
5703
|
+
F: __dxlog_file21,
|
|
5666
5704
|
L: 335,
|
|
5667
5705
|
S: this,
|
|
5668
5706
|
A: [
|
|
@@ -5671,11 +5709,11 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5671
5709
|
]
|
|
5672
5710
|
});
|
|
5673
5711
|
if (space.spaceState.getMemberRole(options.identityKey) !== import_credentials16.SpaceMember.Role.REMOVED) {
|
|
5674
|
-
throw new
|
|
5712
|
+
throw new import_protocols10.AlreadyJoinedError();
|
|
5675
5713
|
}
|
|
5676
5714
|
const credentials = await (0, import_credentials15.createAdmissionCredentials)(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
|
|
5677
5715
|
(0, import_invariant17.invariant)(credentials[0].credential, void 0, {
|
|
5678
|
-
F:
|
|
5716
|
+
F: __dxlog_file21,
|
|
5679
5717
|
L: 354,
|
|
5680
5718
|
S: this,
|
|
5681
5719
|
A: [
|
|
@@ -5685,7 +5723,7 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5685
5723
|
});
|
|
5686
5724
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5687
5725
|
(0, import_invariant17.invariant)((0, import_credentials15.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5688
|
-
F:
|
|
5726
|
+
F: __dxlog_file21,
|
|
5689
5727
|
L: 356,
|
|
5690
5728
|
S: this,
|
|
5691
5729
|
A: [
|
|
@@ -5721,10 +5759,10 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5721
5759
|
});
|
|
5722
5760
|
}
|
|
5723
5761
|
async _constructSpace(metadata) {
|
|
5724
|
-
(0,
|
|
5762
|
+
(0, import_log18.log)("construct space", {
|
|
5725
5763
|
metadata
|
|
5726
5764
|
}, {
|
|
5727
|
-
F:
|
|
5765
|
+
F: __dxlog_file21,
|
|
5728
5766
|
L: 392,
|
|
5729
5767
|
S: this,
|
|
5730
5768
|
C: (f, a) => f(...a)
|
|
@@ -5765,10 +5803,10 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5765
5803
|
session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
|
|
5766
5804
|
await this._connectEchoMeshReplicator(space, session);
|
|
5767
5805
|
} catch (err) {
|
|
5768
|
-
|
|
5806
|
+
import_log18.log.warn("error on authorized connection", {
|
|
5769
5807
|
err
|
|
5770
5808
|
}, {
|
|
5771
|
-
F:
|
|
5809
|
+
F: __dxlog_file21,
|
|
5772
5810
|
L: 434,
|
|
5773
5811
|
S: this,
|
|
5774
5812
|
C: (f, a) => f(...a)
|
|
@@ -5777,8 +5815,8 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5777
5815
|
}
|
|
5778
5816
|
}),
|
|
5779
5817
|
onAuthFailure: () => {
|
|
5780
|
-
|
|
5781
|
-
F:
|
|
5818
|
+
import_log18.log.warn("auth failure", void 0, {
|
|
5819
|
+
F: __dxlog_file21,
|
|
5782
5820
|
L: 439,
|
|
5783
5821
|
S: this,
|
|
5784
5822
|
C: (f, a) => f(...a)
|
|
@@ -5808,21 +5846,21 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5808
5846
|
signingContext: this._signingContext,
|
|
5809
5847
|
callbacks: {
|
|
5810
5848
|
beforeReady: async () => {
|
|
5811
|
-
(0,
|
|
5849
|
+
(0, import_log18.log)("before space ready", {
|
|
5812
5850
|
space: space.key
|
|
5813
5851
|
}, {
|
|
5814
|
-
F:
|
|
5852
|
+
F: __dxlog_file21,
|
|
5815
5853
|
L: 466,
|
|
5816
5854
|
S: this,
|
|
5817
5855
|
C: (f, a) => f(...a)
|
|
5818
5856
|
});
|
|
5819
5857
|
},
|
|
5820
5858
|
afterReady: async () => {
|
|
5821
|
-
(0,
|
|
5859
|
+
(0, import_log18.log)("after space ready", {
|
|
5822
5860
|
space: space.key,
|
|
5823
5861
|
open: this._lifecycleState === import_context14.LifecycleState.OPEN
|
|
5824
5862
|
}, {
|
|
5825
|
-
F:
|
|
5863
|
+
F: __dxlog_file21,
|
|
5826
5864
|
L: 469,
|
|
5827
5865
|
S: this,
|
|
5828
5866
|
C: (f, a) => f(...a)
|
|
@@ -5838,10 +5876,10 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5838
5876
|
}
|
|
5839
5877
|
},
|
|
5840
5878
|
beforeClose: async () => {
|
|
5841
|
-
(0,
|
|
5879
|
+
(0, import_log18.log)("before space close", {
|
|
5842
5880
|
space: space.key
|
|
5843
5881
|
}, {
|
|
5844
|
-
F:
|
|
5882
|
+
F: __dxlog_file21,
|
|
5845
5883
|
L: 477,
|
|
5846
5884
|
S: this,
|
|
5847
5885
|
C: (f, a) => f(...a)
|
|
@@ -5872,10 +5910,10 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5872
5910
|
async _connectEchoMeshReplicator(space, session) {
|
|
5873
5911
|
const replicator = this._meshReplicator;
|
|
5874
5912
|
if (!replicator) {
|
|
5875
|
-
|
|
5913
|
+
import_log18.log.warn("p2p automerge replication disabled", {
|
|
5876
5914
|
space: space.key
|
|
5877
5915
|
}, {
|
|
5878
|
-
F:
|
|
5916
|
+
F: __dxlog_file21,
|
|
5879
5917
|
L: 508,
|
|
5880
5918
|
S: this,
|
|
5881
5919
|
C: (f, a) => f(...a)
|
|
@@ -5899,16 +5937,16 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5899
5937
|
return (s && member.role === import_credentials16.SpaceMember.Role.REMOVED !== (s.authStatus === import_echo_pipeline3.AuthStatus.FAILURE)) ?? false;
|
|
5900
5938
|
});
|
|
5901
5939
|
sessionsToClose.forEach((session) => {
|
|
5902
|
-
void session.close().catch(
|
|
5940
|
+
void session.close().catch(import_log18.log.error);
|
|
5903
5941
|
});
|
|
5904
5942
|
closedSessions += sessionsToClose.length;
|
|
5905
5943
|
}
|
|
5906
|
-
(0,
|
|
5944
|
+
(0, import_log18.log)("processed member role changes", {
|
|
5907
5945
|
roleChangeCount: memberInfo.length,
|
|
5908
5946
|
peersOnline: presence.getPeersOnline().length,
|
|
5909
5947
|
closedSessions
|
|
5910
5948
|
}, {
|
|
5911
|
-
F:
|
|
5949
|
+
F: __dxlog_file21,
|
|
5912
5950
|
L: 534,
|
|
5913
5951
|
S: this,
|
|
5914
5952
|
C: (f, a) => f(...a)
|
|
@@ -5920,15 +5958,15 @@ var DataSpaceManager = class extends import_context14.Resource {
|
|
|
5920
5958
|
if (role === import_credentials16.SpaceMember.Role.REMOVED) {
|
|
5921
5959
|
const session = peerState.peerId && space.protocol.sessions.get(peerState.peerId);
|
|
5922
5960
|
if (session != null) {
|
|
5923
|
-
(0,
|
|
5961
|
+
(0, import_log18.log)("closing a session with a removed peer", {
|
|
5924
5962
|
peerId: peerState.peerId
|
|
5925
5963
|
}, {
|
|
5926
|
-
F:
|
|
5964
|
+
F: __dxlog_file21,
|
|
5927
5965
|
L: 548,
|
|
5928
5966
|
S: this,
|
|
5929
5967
|
C: (f, a) => f(...a)
|
|
5930
5968
|
});
|
|
5931
|
-
void session.close().catch(
|
|
5969
|
+
void session.close().catch(import_log18.log.error);
|
|
5932
5970
|
}
|
|
5933
5971
|
}
|
|
5934
5972
|
}
|
|
@@ -5983,7 +6021,7 @@ _ts_decorate6([
|
|
|
5983
6021
|
DataSpaceManager = _ts_decorate6([
|
|
5984
6022
|
(0, import_async17.trackLeaks)("open", "close")
|
|
5985
6023
|
], DataSpaceManager);
|
|
5986
|
-
var
|
|
6024
|
+
var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
5987
6025
|
var SpacesServiceImpl = class {
|
|
5988
6026
|
constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
|
|
5989
6027
|
this._identityManager = _identityManager;
|
|
@@ -5999,7 +6037,7 @@ var SpacesServiceImpl = class {
|
|
|
5999
6037
|
}
|
|
6000
6038
|
async updateSpace({ spaceKey, state }) {
|
|
6001
6039
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
6002
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new
|
|
6040
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
6003
6041
|
if (state) {
|
|
6004
6042
|
switch (state) {
|
|
6005
6043
|
case import_services16.SpaceState.SPACE_ACTIVE:
|
|
@@ -6009,7 +6047,7 @@ var SpacesServiceImpl = class {
|
|
|
6009
6047
|
await space.deactivate();
|
|
6010
6048
|
break;
|
|
6011
6049
|
default:
|
|
6012
|
-
throw new
|
|
6050
|
+
throw new import_protocols11.ApiError("Invalid space state");
|
|
6013
6051
|
}
|
|
6014
6052
|
}
|
|
6015
6053
|
}
|
|
@@ -6017,17 +6055,17 @@ var SpacesServiceImpl = class {
|
|
|
6017
6055
|
const identity = this._requireIdentity();
|
|
6018
6056
|
const space = this._spaceManager.spaces.get(request.spaceKey);
|
|
6019
6057
|
if (space == null) {
|
|
6020
|
-
throw new
|
|
6058
|
+
throw new import_protocols11.SpaceNotFoundError(request.spaceKey);
|
|
6021
6059
|
}
|
|
6022
6060
|
if (!space.spaceState.hasMembershipManagementPermission(identity.identityKey)) {
|
|
6023
|
-
throw new
|
|
6061
|
+
throw new import_protocols11.AuthorizationError("No member management permission.", {
|
|
6024
6062
|
spaceKey: space.key,
|
|
6025
6063
|
role: space.spaceState.getMemberRole(identity.identityKey)
|
|
6026
6064
|
});
|
|
6027
6065
|
}
|
|
6028
6066
|
const credentials = await (0, import_credentials19.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
6029
6067
|
(0, import_invariant18.invariant)(credentials[0].credential, void 0, {
|
|
6030
|
-
F:
|
|
6068
|
+
F: __dxlog_file22,
|
|
6031
6069
|
L: 102,
|
|
6032
6070
|
S: this,
|
|
6033
6071
|
A: [
|
|
@@ -6037,7 +6075,7 @@ var SpacesServiceImpl = class {
|
|
|
6037
6075
|
});
|
|
6038
6076
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
6039
6077
|
(0, import_invariant18.invariant)((0, import_credentials19.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
6040
|
-
F:
|
|
6078
|
+
F: __dxlog_file22,
|
|
6041
6079
|
L: 104,
|
|
6042
6080
|
S: this,
|
|
6043
6081
|
A: [
|
|
@@ -6052,10 +6090,10 @@ var SpacesServiceImpl = class {
|
|
|
6052
6090
|
const scheduler = new import_async18.UpdateScheduler(ctx, async () => {
|
|
6053
6091
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
6054
6092
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
6055
|
-
(0,
|
|
6093
|
+
(0, import_log19.log)("update", () => ({
|
|
6056
6094
|
ids: spaces.map((space) => space.id)
|
|
6057
6095
|
}), {
|
|
6058
|
-
F:
|
|
6096
|
+
F: __dxlog_file22,
|
|
6059
6097
|
L: 115,
|
|
6060
6098
|
S: this,
|
|
6061
6099
|
C: (f, a) => f(...a)
|
|
@@ -6104,14 +6142,14 @@ var SpacesServiceImpl = class {
|
|
|
6104
6142
|
}
|
|
6105
6143
|
async postMessage({ spaceKey, channel, message }) {
|
|
6106
6144
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
6107
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new
|
|
6145
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
6108
6146
|
await space.postMessage(getChannelId(channel), message);
|
|
6109
6147
|
}
|
|
6110
6148
|
subscribeMessages({ spaceKey, channel }) {
|
|
6111
6149
|
return new import_codec_protobuf11.Stream(({ ctx, next }) => {
|
|
6112
6150
|
(0, import_async18.scheduleTask)(ctx, async () => {
|
|
6113
6151
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
6114
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new
|
|
6152
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
6115
6153
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
6116
6154
|
next(message);
|
|
6117
6155
|
});
|
|
@@ -6121,7 +6159,7 @@ var SpacesServiceImpl = class {
|
|
|
6121
6159
|
}
|
|
6122
6160
|
queryCredentials({ spaceKey, noTail }) {
|
|
6123
6161
|
return new import_codec_protobuf11.Stream(({ ctx, next, close }) => {
|
|
6124
|
-
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new
|
|
6162
|
+
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
6125
6163
|
const processor = {
|
|
6126
6164
|
processCredential: async (credential) => {
|
|
6127
6165
|
next(credential);
|
|
@@ -6137,7 +6175,7 @@ var SpacesServiceImpl = class {
|
|
|
6137
6175
|
});
|
|
6138
6176
|
}
|
|
6139
6177
|
async writeCredentials({ spaceKey, credentials }) {
|
|
6140
|
-
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new
|
|
6178
|
+
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
6141
6179
|
for (const credential of credentials ?? []) {
|
|
6142
6180
|
if (credential.proof) {
|
|
6143
6181
|
await space.controlPipeline.writer.write({
|
|
@@ -6147,7 +6185,7 @@ var SpacesServiceImpl = class {
|
|
|
6147
6185
|
});
|
|
6148
6186
|
} else {
|
|
6149
6187
|
(0, import_invariant18.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
6150
|
-
F:
|
|
6188
|
+
F: __dxlog_file22,
|
|
6151
6189
|
L: 213,
|
|
6152
6190
|
S: this,
|
|
6153
6191
|
A: [
|
|
@@ -6156,7 +6194,7 @@ var SpacesServiceImpl = class {
|
|
|
6156
6194
|
]
|
|
6157
6195
|
});
|
|
6158
6196
|
(0, import_invariant18.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
6159
|
-
F:
|
|
6197
|
+
F: __dxlog_file22,
|
|
6160
6198
|
L: 214,
|
|
6161
6199
|
S: this,
|
|
6162
6200
|
A: [
|
|
@@ -6166,7 +6204,7 @@ var SpacesServiceImpl = class {
|
|
|
6166
6204
|
});
|
|
6167
6205
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
6168
6206
|
(0, import_invariant18.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
6169
|
-
F:
|
|
6207
|
+
F: __dxlog_file22,
|
|
6170
6208
|
L: 216,
|
|
6171
6209
|
S: this,
|
|
6172
6210
|
A: [
|
|
@@ -6188,7 +6226,7 @@ var SpacesServiceImpl = class {
|
|
|
6188
6226
|
}
|
|
6189
6227
|
async createEpoch({ spaceKey, migration, automergeRootUrl }) {
|
|
6190
6228
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
6191
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new
|
|
6229
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
6192
6230
|
const result = await space.createEpoch({
|
|
6193
6231
|
migration,
|
|
6194
6232
|
newAutomergeRoot: automergeRootUrl
|
|
@@ -6216,7 +6254,7 @@ var SpacesServiceImpl = class {
|
|
|
6216
6254
|
async _joinByAdmission({ credential }) {
|
|
6217
6255
|
const assertion = (0, import_credentials19.getCredentialAssertion)(credential);
|
|
6218
6256
|
(0, import_invariant18.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
6219
|
-
F:
|
|
6257
|
+
F: __dxlog_file22,
|
|
6220
6258
|
L: 250,
|
|
6221
6259
|
S: this,
|
|
6222
6260
|
A: [
|
|
@@ -6226,7 +6264,7 @@ var SpacesServiceImpl = class {
|
|
|
6226
6264
|
});
|
|
6227
6265
|
const myIdentity = this._identityManager.identity;
|
|
6228
6266
|
(0, import_invariant18.invariant)(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
6229
|
-
F:
|
|
6267
|
+
F: __dxlog_file22,
|
|
6230
6268
|
L: 252,
|
|
6231
6269
|
S: this,
|
|
6232
6270
|
A: [
|
|
@@ -6256,7 +6294,7 @@ var SpacesServiceImpl = class {
|
|
|
6256
6294
|
id: space.id,
|
|
6257
6295
|
spaceKey: space.key,
|
|
6258
6296
|
state: space.state,
|
|
6259
|
-
error: space.error ? (0,
|
|
6297
|
+
error: space.error ? (0, import_protocols11.encodeError)(space.error) : void 0,
|
|
6260
6298
|
pipeline: {
|
|
6261
6299
|
currentEpoch: space.automergeSpaceState.lastEpoch,
|
|
6262
6300
|
appliedEpoch: space.automergeSpaceState.lastEpoch,
|
|
@@ -6294,7 +6332,7 @@ var SpacesServiceImpl = class {
|
|
|
6294
6332
|
}
|
|
6295
6333
|
_requireIdentity() {
|
|
6296
6334
|
if (!this._identityManager.identity) {
|
|
6297
|
-
throw new
|
|
6335
|
+
throw new import_protocols11.IdentityNotInitializedError("This device has no HALO identity available. See https://docs.dxos.org/guide/platform/halo");
|
|
6298
6336
|
}
|
|
6299
6337
|
return this._identityManager.identity;
|
|
6300
6338
|
}
|
|
@@ -6321,7 +6359,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
6321
6359
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6322
6360
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6323
6361
|
}
|
|
6324
|
-
var
|
|
6362
|
+
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
6325
6363
|
var ServiceContext = class extends import_context15.Resource {
|
|
6326
6364
|
constructor(storage, level, networkManager, signalManager, _edgeConnection, _runtimeParams, _edgeFeatures) {
|
|
6327
6365
|
super();
|
|
@@ -6360,19 +6398,19 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
6360
6398
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams, {
|
|
6361
6399
|
onIdentityConstruction: (identity) => {
|
|
6362
6400
|
if (this._edgeConnection) {
|
|
6363
|
-
|
|
6401
|
+
import_log20.log.info("Setting identity on edge connection", {
|
|
6364
6402
|
identity: identity.identityKey.toHex(),
|
|
6365
|
-
oldIdentity: this._edgeConnection.identityKey
|
|
6403
|
+
oldIdentity: this._edgeConnection.identityKey,
|
|
6366
6404
|
swarms: this.networkManager.topics
|
|
6367
6405
|
}, {
|
|
6368
|
-
F:
|
|
6406
|
+
F: __dxlog_file23,
|
|
6369
6407
|
L: 128,
|
|
6370
6408
|
S: this,
|
|
6371
6409
|
C: (f, a) => f(...a)
|
|
6372
6410
|
});
|
|
6373
6411
|
this._edgeConnection.setIdentity({
|
|
6374
|
-
|
|
6375
|
-
identityKey: identity.identityKey
|
|
6412
|
+
peerKey: identity.deviceKey.toHex(),
|
|
6413
|
+
identityKey: identity.identityKey.toHex()
|
|
6376
6414
|
});
|
|
6377
6415
|
this.networkManager.setPeerInfo({
|
|
6378
6416
|
identityKey: identity.identityKey.toHex(),
|
|
@@ -6399,16 +6437,16 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
6399
6437
|
}
|
|
6400
6438
|
async _open(ctx) {
|
|
6401
6439
|
await this._checkStorageVersion();
|
|
6402
|
-
(0,
|
|
6403
|
-
F:
|
|
6440
|
+
(0, import_log20.log)("opening...", void 0, {
|
|
6441
|
+
F: __dxlog_file23,
|
|
6404
6442
|
L: 186,
|
|
6405
6443
|
S: this,
|
|
6406
6444
|
C: (f, a) => f(...a)
|
|
6407
6445
|
});
|
|
6408
|
-
|
|
6446
|
+
import_log20.log.trace("dxos.sdk.service-context.open", import_protocols12.trace.begin({
|
|
6409
6447
|
id: this._instanceId
|
|
6410
6448
|
}), {
|
|
6411
|
-
F:
|
|
6449
|
+
F: __dxlog_file23,
|
|
6412
6450
|
L: 187,
|
|
6413
6451
|
S: this,
|
|
6414
6452
|
C: (f, a) => f(...a)
|
|
@@ -6430,32 +6468,32 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
6430
6468
|
await this._initialize(ctx);
|
|
6431
6469
|
}
|
|
6432
6470
|
const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
|
|
6433
|
-
(0,
|
|
6471
|
+
(0, import_log20.log)("loaded persistent invitations", {
|
|
6434
6472
|
count: loadedInvitations.invitations?.length
|
|
6435
6473
|
}, {
|
|
6436
|
-
F:
|
|
6474
|
+
F: __dxlog_file23,
|
|
6437
6475
|
L: 210,
|
|
6438
6476
|
S: this,
|
|
6439
6477
|
C: (f, a) => f(...a)
|
|
6440
6478
|
});
|
|
6441
|
-
|
|
6479
|
+
import_log20.log.trace("dxos.sdk.service-context.open", import_protocols12.trace.end({
|
|
6442
6480
|
id: this._instanceId
|
|
6443
6481
|
}), {
|
|
6444
|
-
F:
|
|
6482
|
+
F: __dxlog_file23,
|
|
6445
6483
|
L: 212,
|
|
6446
6484
|
S: this,
|
|
6447
6485
|
C: (f, a) => f(...a)
|
|
6448
6486
|
});
|
|
6449
|
-
(0,
|
|
6450
|
-
F:
|
|
6487
|
+
(0, import_log20.log)("opened", void 0, {
|
|
6488
|
+
F: __dxlog_file23,
|
|
6451
6489
|
L: 213,
|
|
6452
6490
|
S: this,
|
|
6453
6491
|
C: (f, a) => f(...a)
|
|
6454
6492
|
});
|
|
6455
6493
|
}
|
|
6456
6494
|
async _close(ctx) {
|
|
6457
|
-
(0,
|
|
6458
|
-
F:
|
|
6495
|
+
(0, import_log20.log)("closing...", void 0, {
|
|
6496
|
+
F: __dxlog_file23,
|
|
6459
6497
|
L: 217,
|
|
6460
6498
|
S: this,
|
|
6461
6499
|
C: (f, a) => f(...a)
|
|
@@ -6472,8 +6510,8 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
6472
6510
|
await this.networkManager.close();
|
|
6473
6511
|
await this.signalManager.close();
|
|
6474
6512
|
await this._edgeConnection?.close();
|
|
6475
|
-
(0,
|
|
6476
|
-
F:
|
|
6513
|
+
(0, import_log20.log)("closed", void 0, {
|
|
6514
|
+
F: __dxlog_file23,
|
|
6477
6515
|
L: 232,
|
|
6478
6516
|
S: this,
|
|
6479
6517
|
C: (f, a) => f(...a)
|
|
@@ -6482,7 +6520,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
6482
6520
|
async createIdentity(params = {}) {
|
|
6483
6521
|
const identity = await this.identityManager.createIdentity(params);
|
|
6484
6522
|
await this._initialize(new import_context15.Context(void 0, {
|
|
6485
|
-
F:
|
|
6523
|
+
F: __dxlog_file23,
|
|
6486
6524
|
L: 237
|
|
6487
6525
|
}));
|
|
6488
6526
|
return identity;
|
|
@@ -6490,7 +6528,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
6490
6528
|
getInvitationHandler(invitation) {
|
|
6491
6529
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
6492
6530
|
(0, import_invariant19.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
6493
|
-
F:
|
|
6531
|
+
F: __dxlog_file23,
|
|
6494
6532
|
L: 243,
|
|
6495
6533
|
S: this,
|
|
6496
6534
|
A: [
|
|
@@ -6511,21 +6549,21 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
6511
6549
|
async _acceptIdentity(params) {
|
|
6512
6550
|
const identity = await this.identityManager.acceptIdentity(params);
|
|
6513
6551
|
await this._initialize(new import_context15.Context(void 0, {
|
|
6514
|
-
F:
|
|
6552
|
+
F: __dxlog_file23,
|
|
6515
6553
|
L: 259
|
|
6516
6554
|
}));
|
|
6517
6555
|
return identity;
|
|
6518
6556
|
}
|
|
6519
6557
|
async _checkStorageVersion() {
|
|
6520
6558
|
await this.metadataStore.load();
|
|
6521
|
-
if (this.metadataStore.version !==
|
|
6522
|
-
throw new
|
|
6559
|
+
if (this.metadataStore.version !== import_protocols12.STORAGE_VERSION) {
|
|
6560
|
+
throw new import_protocols12.InvalidStorageVersionError(import_protocols12.STORAGE_VERSION, this.metadataStore.version);
|
|
6523
6561
|
}
|
|
6524
6562
|
}
|
|
6525
6563
|
// Called when identity is created.
|
|
6526
6564
|
async _initialize(ctx) {
|
|
6527
|
-
(0,
|
|
6528
|
-
F:
|
|
6565
|
+
(0, import_log20.log)("initializing spaces...", void 0, {
|
|
6566
|
+
F: __dxlog_file23,
|
|
6529
6567
|
L: 274,
|
|
6530
6568
|
S: this,
|
|
6531
6569
|
C: (f, a) => f(...a)
|
|
@@ -6561,7 +6599,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
6561
6599
|
await this.dataSpaceManager.open();
|
|
6562
6600
|
this._handlerFactories.set(import_services17.Invitation.Kind.SPACE, (invitation) => {
|
|
6563
6601
|
(0, import_invariant19.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
6564
|
-
F:
|
|
6602
|
+
F: __dxlog_file23,
|
|
6565
6603
|
L: 303,
|
|
6566
6604
|
S: this,
|
|
6567
6605
|
A: [
|
|
@@ -6582,10 +6620,10 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
6582
6620
|
return;
|
|
6583
6621
|
}
|
|
6584
6622
|
if (!this.dataSpaceManager) {
|
|
6585
|
-
(0,
|
|
6623
|
+
(0, import_log20.log)("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
6586
6624
|
details: assertion
|
|
6587
6625
|
}, {
|
|
6588
|
-
F:
|
|
6626
|
+
F: __dxlog_file23,
|
|
6589
6627
|
L: 319,
|
|
6590
6628
|
S: this,
|
|
6591
6629
|
C: (f, a) => f(...a)
|
|
@@ -6593,10 +6631,10 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
6593
6631
|
return;
|
|
6594
6632
|
}
|
|
6595
6633
|
if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
|
|
6596
|
-
(0,
|
|
6634
|
+
(0, import_log20.log)("space already exists, ignoring space admission", {
|
|
6597
6635
|
details: assertion
|
|
6598
6636
|
}, {
|
|
6599
|
-
F:
|
|
6637
|
+
F: __dxlog_file23,
|
|
6600
6638
|
L: 323,
|
|
6601
6639
|
S: this,
|
|
6602
6640
|
C: (f, a) => f(...a)
|
|
@@ -6604,10 +6642,10 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
6604
6642
|
return;
|
|
6605
6643
|
}
|
|
6606
6644
|
try {
|
|
6607
|
-
(0,
|
|
6645
|
+
(0, import_log20.log)("accepting space recorded in halo", {
|
|
6608
6646
|
details: assertion
|
|
6609
6647
|
}, {
|
|
6610
|
-
F:
|
|
6648
|
+
F: __dxlog_file23,
|
|
6611
6649
|
L: 328,
|
|
6612
6650
|
S: this,
|
|
6613
6651
|
C: (f, a) => f(...a)
|
|
@@ -6617,8 +6655,8 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
6617
6655
|
genesisFeedKey: assertion.genesisFeedKey
|
|
6618
6656
|
});
|
|
6619
6657
|
} catch (err) {
|
|
6620
|
-
|
|
6621
|
-
F:
|
|
6658
|
+
import_log20.log.catch(err, void 0, {
|
|
6659
|
+
F: __dxlog_file23,
|
|
6622
6660
|
L: 334,
|
|
6623
6661
|
S: this,
|
|
6624
6662
|
C: (f, a) => f(...a)
|
|
@@ -6673,16 +6711,16 @@ var StorageDriver = import_config2.Runtime.Client.Storage.StorageDriver;
|
|
|
6673
6711
|
var createStorageObjects = (config) => {
|
|
6674
6712
|
const { persistent = false, keyStore, dataStore } = config ?? {};
|
|
6675
6713
|
if (persistent && dataStore === StorageDriver.RAM) {
|
|
6676
|
-
throw new
|
|
6714
|
+
throw new import_protocols13.InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
6677
6715
|
}
|
|
6678
6716
|
if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
|
|
6679
|
-
throw new
|
|
6717
|
+
throw new import_protocols13.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
|
|
6680
6718
|
}
|
|
6681
6719
|
if (persistent && keyStore === StorageDriver.RAM) {
|
|
6682
|
-
throw new
|
|
6720
|
+
throw new import_protocols13.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
|
|
6683
6721
|
}
|
|
6684
6722
|
if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
|
|
6685
|
-
throw new
|
|
6723
|
+
throw new import_protocols13.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
|
|
6686
6724
|
}
|
|
6687
6725
|
return {
|
|
6688
6726
|
storage: (0, import_random_access_storage.createStorage)({
|
|
@@ -6718,7 +6756,7 @@ var createLevel = async (config) => {
|
|
|
6718
6756
|
await level.open();
|
|
6719
6757
|
return level;
|
|
6720
6758
|
};
|
|
6721
|
-
var
|
|
6759
|
+
var __dxlog_file24 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
|
|
6722
6760
|
var encodeProfileArchive = (profile) => import_automerge_repo.cbor.encode(profile);
|
|
6723
6761
|
var decodeProfileArchive = (data) => import_automerge_repo.cbor.decode(data);
|
|
6724
6762
|
var exportProfileData = async ({ storage, level }) => {
|
|
@@ -6731,10 +6769,10 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6731
6769
|
{
|
|
6732
6770
|
const directory = await storage.createDirectory();
|
|
6733
6771
|
const files = await directory.list();
|
|
6734
|
-
|
|
6772
|
+
import_log21.log.info("begin exporting files", {
|
|
6735
6773
|
count: files.length
|
|
6736
6774
|
}, {
|
|
6737
|
-
F:
|
|
6775
|
+
F: __dxlog_file24,
|
|
6738
6776
|
L: 30,
|
|
6739
6777
|
S: void 0,
|
|
6740
6778
|
C: (f, a) => f(...a)
|
|
@@ -6744,23 +6782,23 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6744
6782
|
const { size } = await file.stat();
|
|
6745
6783
|
const data = await file.read(0, size);
|
|
6746
6784
|
archive.storage.push({
|
|
6747
|
-
type:
|
|
6785
|
+
type: import_protocols14.ProfileArchiveEntryType.FILE,
|
|
6748
6786
|
key: filename,
|
|
6749
6787
|
value: data
|
|
6750
6788
|
});
|
|
6751
6789
|
}
|
|
6752
|
-
|
|
6790
|
+
import_log21.log.info("done exporting files", {
|
|
6753
6791
|
count: files.length
|
|
6754
6792
|
}, {
|
|
6755
|
-
F:
|
|
6793
|
+
F: __dxlog_file24,
|
|
6756
6794
|
L: 41,
|
|
6757
6795
|
S: void 0,
|
|
6758
6796
|
C: (f, a) => f(...a)
|
|
6759
6797
|
});
|
|
6760
6798
|
}
|
|
6761
6799
|
{
|
|
6762
|
-
|
|
6763
|
-
F:
|
|
6800
|
+
import_log21.log.info("begin exporting kv pairs", void 0, {
|
|
6801
|
+
F: __dxlog_file24,
|
|
6764
6802
|
L: 45,
|
|
6765
6803
|
S: void 0,
|
|
6766
6804
|
C: (f, a) => f(...a)
|
|
@@ -6772,16 +6810,16 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6772
6810
|
let count = 0;
|
|
6773
6811
|
for await (const [key, value] of iter) {
|
|
6774
6812
|
archive.storage.push({
|
|
6775
|
-
type:
|
|
6813
|
+
type: import_protocols14.ProfileArchiveEntryType.KEY_VALUE,
|
|
6776
6814
|
key,
|
|
6777
6815
|
value
|
|
6778
6816
|
});
|
|
6779
6817
|
count++;
|
|
6780
6818
|
}
|
|
6781
|
-
|
|
6819
|
+
import_log21.log.info("done exporting kv pairs", {
|
|
6782
6820
|
count
|
|
6783
6821
|
}, {
|
|
6784
|
-
F:
|
|
6822
|
+
F: __dxlog_file24,
|
|
6785
6823
|
L: 56,
|
|
6786
6824
|
S: void 0,
|
|
6787
6825
|
C: (f, a) => f(...a)
|
|
@@ -6794,10 +6832,10 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6794
6832
|
let count = 0;
|
|
6795
6833
|
for (const entry2 of archive.storage) {
|
|
6796
6834
|
switch (entry2.type) {
|
|
6797
|
-
case
|
|
6835
|
+
case import_protocols14.ProfileArchiveEntryType.FILE: {
|
|
6798
6836
|
const directory = await storage.createDirectory();
|
|
6799
6837
|
(0, import_invariant20.invariant)(typeof entry2.key === "string", "Invalid key type", {
|
|
6800
|
-
F:
|
|
6838
|
+
F: __dxlog_file24,
|
|
6801
6839
|
L: 79,
|
|
6802
6840
|
S: void 0,
|
|
6803
6841
|
A: [
|
|
@@ -6807,7 +6845,7 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6807
6845
|
});
|
|
6808
6846
|
const file = await directory.getOrCreateFile(entry2.key);
|
|
6809
6847
|
(0, import_invariant20.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6810
|
-
F:
|
|
6848
|
+
F: __dxlog_file24,
|
|
6811
6849
|
L: 81,
|
|
6812
6850
|
S: void 0,
|
|
6813
6851
|
A: [
|
|
@@ -6819,9 +6857,9 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6819
6857
|
await file.close();
|
|
6820
6858
|
break;
|
|
6821
6859
|
}
|
|
6822
|
-
case
|
|
6860
|
+
case import_protocols14.ProfileArchiveEntryType.KEY_VALUE: {
|
|
6823
6861
|
(0, import_invariant20.invariant)(entry2.key instanceof Uint8Array, "Invalid key type", {
|
|
6824
|
-
F:
|
|
6862
|
+
F: __dxlog_file24,
|
|
6825
6863
|
L: 87,
|
|
6826
6864
|
S: void 0,
|
|
6827
6865
|
A: [
|
|
@@ -6830,7 +6868,7 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6830
6868
|
]
|
|
6831
6869
|
});
|
|
6832
6870
|
(0, import_invariant20.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6833
|
-
F:
|
|
6871
|
+
F: __dxlog_file24,
|
|
6834
6872
|
L: 88,
|
|
6835
6873
|
S: void 0,
|
|
6836
6874
|
A: [
|
|
@@ -6850,27 +6888,27 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6850
6888
|
if (++count % 1e3 === 0) {
|
|
6851
6889
|
await batch.write();
|
|
6852
6890
|
batch = level.batch();
|
|
6853
|
-
|
|
6891
|
+
import_log21.log.info("importing", {
|
|
6854
6892
|
count,
|
|
6855
6893
|
total: archive.storage.length,
|
|
6856
6894
|
progress: `${(count / archive.storage.length * 100).toFixed()}%`
|
|
6857
6895
|
}, {
|
|
6858
|
-
F:
|
|
6896
|
+
F: __dxlog_file24,
|
|
6859
6897
|
L: 101,
|
|
6860
6898
|
S: void 0,
|
|
6861
6899
|
C: (f, a) => f(...a)
|
|
6862
6900
|
});
|
|
6863
6901
|
}
|
|
6864
6902
|
}
|
|
6865
|
-
|
|
6866
|
-
F:
|
|
6903
|
+
import_log21.log.info("committing changes..", void 0, {
|
|
6904
|
+
F: __dxlog_file24,
|
|
6867
6905
|
L: 109,
|
|
6868
6906
|
S: void 0,
|
|
6869
6907
|
C: (f, a) => f(...a)
|
|
6870
6908
|
});
|
|
6871
6909
|
await batch.write();
|
|
6872
6910
|
};
|
|
6873
|
-
var
|
|
6911
|
+
var __dxlog_file25 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
6874
6912
|
var DevicesServiceImpl = class {
|
|
6875
6913
|
constructor(_identityManager) {
|
|
6876
6914
|
this._identityManager = _identityManager;
|
|
@@ -6888,7 +6926,7 @@ var DevicesServiceImpl = class {
|
|
|
6888
6926
|
});
|
|
6889
6927
|
} else {
|
|
6890
6928
|
(0, import_invariant22.invariant)(this._identityManager.identity?.presence, "presence not present", {
|
|
6891
|
-
F:
|
|
6929
|
+
F: __dxlog_file25,
|
|
6892
6930
|
L: 32,
|
|
6893
6931
|
S: this,
|
|
6894
6932
|
A: [
|
|
@@ -7033,11 +7071,11 @@ var LoggingServiceImpl = class {
|
|
|
7033
7071
|
};
|
|
7034
7072
|
}
|
|
7035
7073
|
async open() {
|
|
7036
|
-
|
|
7074
|
+
import_log23.log.runtimeConfig.processors.push(this._logProcessor);
|
|
7037
7075
|
}
|
|
7038
7076
|
async close() {
|
|
7039
|
-
const index =
|
|
7040
|
-
|
|
7077
|
+
const index = import_log23.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
7078
|
+
import_log23.log.runtimeConfig.processors.splice(index, 1);
|
|
7041
7079
|
}
|
|
7042
7080
|
async controlMetrics({ reset, record }) {
|
|
7043
7081
|
if (reset) {
|
|
@@ -7098,7 +7136,7 @@ var LoggingServiceImpl = class {
|
|
|
7098
7136
|
}
|
|
7099
7137
|
const record = {
|
|
7100
7138
|
...entry2,
|
|
7101
|
-
context: (0, import_util16.jsonify)((0,
|
|
7139
|
+
context: (0, import_util16.jsonify)((0, import_log23.getContextFromEntry)(entry2)),
|
|
7102
7140
|
timestamp: /* @__PURE__ */ new Date(),
|
|
7103
7141
|
meta: {
|
|
7104
7142
|
// TODO(dmaretskyi): Fix proto.
|
|
@@ -7231,7 +7269,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
7231
7269
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7232
7270
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7233
7271
|
}
|
|
7234
|
-
var
|
|
7272
|
+
var __dxlog_file26 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
7235
7273
|
var ClientServicesHost = class {
|
|
7236
7274
|
constructor({
|
|
7237
7275
|
config,
|
|
@@ -7269,7 +7307,7 @@ var ClientServicesHost = class {
|
|
|
7269
7307
|
onAcquire: () => {
|
|
7270
7308
|
if (!this._opening) {
|
|
7271
7309
|
void this.open(new import_context16.Context(void 0, {
|
|
7272
|
-
F:
|
|
7310
|
+
F: __dxlog_file26,
|
|
7273
7311
|
L: 132
|
|
7274
7312
|
}));
|
|
7275
7313
|
}
|
|
@@ -7327,7 +7365,7 @@ var ClientServicesHost = class {
|
|
|
7327
7365
|
*/
|
|
7328
7366
|
initialize({ config, ...options }) {
|
|
7329
7367
|
(0, import_invariant21.invariant)(!this._open, "service host is open", {
|
|
7330
|
-
F:
|
|
7368
|
+
F: __dxlog_file26,
|
|
7331
7369
|
L: 198,
|
|
7332
7370
|
S: this,
|
|
7333
7371
|
A: [
|
|
@@ -7335,15 +7373,15 @@ var ClientServicesHost = class {
|
|
|
7335
7373
|
"'service host is open'"
|
|
7336
7374
|
]
|
|
7337
7375
|
});
|
|
7338
|
-
(0,
|
|
7339
|
-
F:
|
|
7376
|
+
(0, import_log22.log)("initializing...", void 0, {
|
|
7377
|
+
F: __dxlog_file26,
|
|
7340
7378
|
L: 199,
|
|
7341
7379
|
S: this,
|
|
7342
7380
|
C: (f, a) => f(...a)
|
|
7343
7381
|
});
|
|
7344
7382
|
if (config) {
|
|
7345
7383
|
(0, import_invariant21.invariant)(!this._config, "config already set", {
|
|
7346
|
-
F:
|
|
7384
|
+
F: __dxlog_file26,
|
|
7347
7385
|
L: 202,
|
|
7348
7386
|
S: this,
|
|
7349
7387
|
A: [
|
|
@@ -7357,8 +7395,8 @@ var ClientServicesHost = class {
|
|
|
7357
7395
|
}
|
|
7358
7396
|
}
|
|
7359
7397
|
if (!options.signalManager) {
|
|
7360
|
-
|
|
7361
|
-
F:
|
|
7398
|
+
import_log22.log.warn("running signaling without telemetry metadata.", void 0, {
|
|
7399
|
+
F: __dxlog_file26,
|
|
7362
7400
|
L: 210,
|
|
7363
7401
|
S: this,
|
|
7364
7402
|
C: (f, a) => f(...a)
|
|
@@ -7366,7 +7404,8 @@ var ClientServicesHost = class {
|
|
|
7366
7404
|
}
|
|
7367
7405
|
const edgeEndpoint = config?.get("runtime.services.edge.url");
|
|
7368
7406
|
if (edgeEndpoint) {
|
|
7369
|
-
|
|
7407
|
+
const randomKey = import_keys16.PublicKey.random().toHex();
|
|
7408
|
+
this._edgeConnection = new import_edge_client.EdgeClient(randomKey, randomKey, {
|
|
7370
7409
|
socketEndpoint: edgeEndpoint
|
|
7371
7410
|
});
|
|
7372
7411
|
}
|
|
@@ -7377,8 +7416,8 @@ var ClientServicesHost = class {
|
|
|
7377
7416
|
}) : new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
7378
7417
|
this._signalManager = signalManager;
|
|
7379
7418
|
(0, import_invariant21.invariant)(!this._networkManager, "network manager already set", {
|
|
7380
|
-
F:
|
|
7381
|
-
L:
|
|
7419
|
+
F: __dxlog_file26,
|
|
7420
|
+
L: 232,
|
|
7382
7421
|
S: this,
|
|
7383
7422
|
A: [
|
|
7384
7423
|
"!this._networkManager",
|
|
@@ -7390,13 +7429,13 @@ var ClientServicesHost = class {
|
|
|
7390
7429
|
transportFactory,
|
|
7391
7430
|
signalManager,
|
|
7392
7431
|
peerInfo: this._edgeConnection ? {
|
|
7393
|
-
identityKey: this._edgeConnection.identityKey
|
|
7394
|
-
peerKey: this._edgeConnection.
|
|
7432
|
+
identityKey: this._edgeConnection.identityKey,
|
|
7433
|
+
peerKey: this._edgeConnection.peerKey
|
|
7395
7434
|
} : void 0
|
|
7396
7435
|
});
|
|
7397
|
-
(0,
|
|
7398
|
-
F:
|
|
7399
|
-
L:
|
|
7436
|
+
(0, import_log22.log)("initialized", void 0, {
|
|
7437
|
+
F: __dxlog_file26,
|
|
7438
|
+
L: 245,
|
|
7400
7439
|
S: this,
|
|
7401
7440
|
C: (f, a) => f(...a)
|
|
7402
7441
|
});
|
|
@@ -7406,17 +7445,17 @@ var ClientServicesHost = class {
|
|
|
7406
7445
|
return;
|
|
7407
7446
|
}
|
|
7408
7447
|
const traceId = import_keys16.PublicKey.random().toHex();
|
|
7409
|
-
|
|
7448
|
+
import_log22.log.trace("dxos.client-services.host.open", import_protocols15.trace.begin({
|
|
7410
7449
|
id: traceId
|
|
7411
7450
|
}), {
|
|
7412
|
-
F:
|
|
7413
|
-
L:
|
|
7451
|
+
F: __dxlog_file26,
|
|
7452
|
+
L: 256,
|
|
7414
7453
|
S: this,
|
|
7415
7454
|
C: (f, a) => f(...a)
|
|
7416
7455
|
});
|
|
7417
7456
|
(0, import_invariant21.invariant)(this._config, "config not set", {
|
|
7418
|
-
F:
|
|
7419
|
-
L:
|
|
7457
|
+
F: __dxlog_file26,
|
|
7458
|
+
L: 258,
|
|
7420
7459
|
S: this,
|
|
7421
7460
|
A: [
|
|
7422
7461
|
"this._config",
|
|
@@ -7424,8 +7463,8 @@ var ClientServicesHost = class {
|
|
|
7424
7463
|
]
|
|
7425
7464
|
});
|
|
7426
7465
|
(0, import_invariant21.invariant)(this._storage, "storage not set", {
|
|
7427
|
-
F:
|
|
7428
|
-
L:
|
|
7466
|
+
F: __dxlog_file26,
|
|
7467
|
+
L: 259,
|
|
7429
7468
|
S: this,
|
|
7430
7469
|
A: [
|
|
7431
7470
|
"this._storage",
|
|
@@ -7433,8 +7472,8 @@ var ClientServicesHost = class {
|
|
|
7433
7472
|
]
|
|
7434
7473
|
});
|
|
7435
7474
|
(0, import_invariant21.invariant)(this._signalManager, "signal manager not set", {
|
|
7436
|
-
F:
|
|
7437
|
-
L:
|
|
7475
|
+
F: __dxlog_file26,
|
|
7476
|
+
L: 260,
|
|
7438
7477
|
S: this,
|
|
7439
7478
|
A: [
|
|
7440
7479
|
"this._signalManager",
|
|
@@ -7442,8 +7481,8 @@ var ClientServicesHost = class {
|
|
|
7442
7481
|
]
|
|
7443
7482
|
});
|
|
7444
7483
|
(0, import_invariant21.invariant)(this._networkManager, "network manager not set", {
|
|
7445
|
-
F:
|
|
7446
|
-
L:
|
|
7484
|
+
F: __dxlog_file26,
|
|
7485
|
+
L: 261,
|
|
7447
7486
|
S: this,
|
|
7448
7487
|
A: [
|
|
7449
7488
|
"this._networkManager",
|
|
@@ -7451,11 +7490,11 @@ var ClientServicesHost = class {
|
|
|
7451
7490
|
]
|
|
7452
7491
|
});
|
|
7453
7492
|
this._opening = true;
|
|
7454
|
-
(0,
|
|
7493
|
+
(0, import_log22.log)("opening...", {
|
|
7455
7494
|
lockKey: this._resourceLock?.lockKey
|
|
7456
7495
|
}, {
|
|
7457
|
-
F:
|
|
7458
|
-
L:
|
|
7496
|
+
F: __dxlog_file26,
|
|
7497
|
+
L: 264,
|
|
7459
7498
|
S: this,
|
|
7460
7499
|
C: (f, a) => f(...a)
|
|
7461
7500
|
});
|
|
@@ -7507,19 +7546,19 @@ var ClientServicesHost = class {
|
|
|
7507
7546
|
this._open = true;
|
|
7508
7547
|
this._statusUpdate.emit();
|
|
7509
7548
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
7510
|
-
(0,
|
|
7549
|
+
(0, import_log22.log)("opened", {
|
|
7511
7550
|
deviceKey
|
|
7512
7551
|
}, {
|
|
7513
|
-
F:
|
|
7514
|
-
L:
|
|
7552
|
+
F: __dxlog_file26,
|
|
7553
|
+
L: 352,
|
|
7515
7554
|
S: this,
|
|
7516
7555
|
C: (f, a) => f(...a)
|
|
7517
7556
|
});
|
|
7518
|
-
|
|
7557
|
+
import_log22.log.trace("dxos.client-services.host.open", import_protocols15.trace.end({
|
|
7519
7558
|
id: traceId
|
|
7520
7559
|
}), {
|
|
7521
|
-
F:
|
|
7522
|
-
L:
|
|
7560
|
+
F: __dxlog_file26,
|
|
7561
|
+
L: 353,
|
|
7523
7562
|
S: this,
|
|
7524
7563
|
C: (f, a) => f(...a)
|
|
7525
7564
|
});
|
|
@@ -7529,11 +7568,11 @@ var ClientServicesHost = class {
|
|
|
7529
7568
|
return;
|
|
7530
7569
|
}
|
|
7531
7570
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
7532
|
-
(0,
|
|
7571
|
+
(0, import_log22.log)("closing...", {
|
|
7533
7572
|
deviceKey
|
|
7534
7573
|
}, {
|
|
7535
|
-
F:
|
|
7536
|
-
L:
|
|
7574
|
+
F: __dxlog_file26,
|
|
7575
|
+
L: 364,
|
|
7537
7576
|
S: this,
|
|
7538
7577
|
C: (f, a) => f(...a)
|
|
7539
7578
|
});
|
|
@@ -7547,44 +7586,44 @@ var ClientServicesHost = class {
|
|
|
7547
7586
|
await this._level?.close();
|
|
7548
7587
|
this._open = false;
|
|
7549
7588
|
this._statusUpdate.emit();
|
|
7550
|
-
(0,
|
|
7589
|
+
(0, import_log22.log)("closed", {
|
|
7551
7590
|
deviceKey
|
|
7552
7591
|
}, {
|
|
7553
|
-
F:
|
|
7554
|
-
L:
|
|
7592
|
+
F: __dxlog_file26,
|
|
7593
|
+
L: 373,
|
|
7555
7594
|
S: this,
|
|
7556
7595
|
C: (f, a) => f(...a)
|
|
7557
7596
|
});
|
|
7558
7597
|
}
|
|
7559
7598
|
async reset() {
|
|
7560
7599
|
const traceId = import_keys16.PublicKey.random().toHex();
|
|
7561
|
-
|
|
7600
|
+
import_log22.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.begin({
|
|
7562
7601
|
id: traceId
|
|
7563
7602
|
}), {
|
|
7564
|
-
F:
|
|
7565
|
-
L:
|
|
7603
|
+
F: __dxlog_file26,
|
|
7604
|
+
L: 378,
|
|
7566
7605
|
S: this,
|
|
7567
7606
|
C: (f, a) => f(...a)
|
|
7568
7607
|
});
|
|
7569
|
-
|
|
7570
|
-
F:
|
|
7571
|
-
L:
|
|
7608
|
+
import_log22.log.info("resetting...", void 0, {
|
|
7609
|
+
F: __dxlog_file26,
|
|
7610
|
+
L: 380,
|
|
7572
7611
|
S: this,
|
|
7573
7612
|
C: (f, a) => f(...a)
|
|
7574
7613
|
});
|
|
7575
7614
|
await this._serviceContext?.close();
|
|
7576
7615
|
await this._storage.reset();
|
|
7577
|
-
|
|
7578
|
-
F:
|
|
7579
|
-
L:
|
|
7616
|
+
import_log22.log.info("reset", void 0, {
|
|
7617
|
+
F: __dxlog_file26,
|
|
7618
|
+
L: 383,
|
|
7580
7619
|
S: this,
|
|
7581
7620
|
C: (f, a) => f(...a)
|
|
7582
7621
|
});
|
|
7583
|
-
|
|
7622
|
+
import_log22.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.end({
|
|
7584
7623
|
id: traceId
|
|
7585
7624
|
}), {
|
|
7586
|
-
F:
|
|
7587
|
-
L:
|
|
7625
|
+
F: __dxlog_file26,
|
|
7626
|
+
L: 384,
|
|
7588
7627
|
S: this,
|
|
7589
7628
|
C: (f, a) => f(...a)
|
|
7590
7629
|
});
|
|
@@ -7657,4 +7696,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
7657
7696
|
subscribeToSpaces,
|
|
7658
7697
|
subscribeToSwarmInfo
|
|
7659
7698
|
});
|
|
7660
|
-
//# sourceMappingURL=chunk-
|
|
7699
|
+
//# sourceMappingURL=chunk-4Y7QCEWZ.cjs.map
|