@dxos/client-services 0.5.9-main.df0042a → 0.5.9-main.e183eeb
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-SLSPX47D.mjs → chunk-S5DPO2DT.mjs} +212 -189
- package/dist/lib/browser/chunk-S5DPO2DT.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-2K5VPBW6.cjs → chunk-F2EIFQZH.cjs} +308 -285
- package/dist/lib/node/chunk-F2EIFQZH.cjs.map +7 -0
- package/dist/lib/node/index.cjs +41 -41
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +8 -8
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +36 -36
- package/src/packlets/identity/identity-service.ts +27 -6
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-SLSPX47D.mjs.map +0 -7
- package/dist/lib/node/chunk-2K5VPBW6.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_F2EIFQZH_exports = {};
|
|
30
|
+
__export(chunk_F2EIFQZH_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
ClientServicesProviderResource: () => ClientServicesProviderResource,
|
|
@@ -66,7 +66,7 @@ __export(chunk_2K5VPBW6_exports, {
|
|
|
66
66
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
67
67
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
68
68
|
});
|
|
69
|
-
module.exports = __toCommonJS(
|
|
69
|
+
module.exports = __toCommonJS(chunk_F2EIFQZH_exports);
|
|
70
70
|
var import_async = require("@dxos/async");
|
|
71
71
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
72
72
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -126,72 +126,75 @@ var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip"
|
|
|
126
126
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
127
127
|
var import_tracing4 = require("@dxos/tracing");
|
|
128
128
|
var import_util3 = require("@dxos/util");
|
|
129
|
+
var import_async8 = require("@dxos/async");
|
|
129
130
|
var import_codec_protobuf9 = require("@dxos/codec-protobuf");
|
|
130
131
|
var import_context4 = require("@dxos/context");
|
|
131
132
|
var import_credentials8 = require("@dxos/credentials");
|
|
132
133
|
var import_debug2 = require("@dxos/debug");
|
|
133
134
|
var import_invariant4 = require("@dxos/invariant");
|
|
135
|
+
var import_log5 = require("@dxos/log");
|
|
134
136
|
var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
|
|
137
|
+
var import_util4 = require("@dxos/util");
|
|
135
138
|
var import_invariant5 = require("@dxos/invariant");
|
|
136
139
|
var import_protocols4 = require("@dxos/protocols");
|
|
137
140
|
var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
|
|
138
|
-
var
|
|
141
|
+
var import_async9 = require("@dxos/async");
|
|
139
142
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
140
143
|
var import_context5 = require("@dxos/context");
|
|
141
144
|
var import_crypto = require("@dxos/crypto");
|
|
142
145
|
var import_invariant6 = require("@dxos/invariant");
|
|
143
146
|
var import_keys6 = require("@dxos/keys");
|
|
144
|
-
var
|
|
147
|
+
var import_log6 = require("@dxos/log");
|
|
145
148
|
var import_network_manager = require("@dxos/network-manager");
|
|
146
149
|
var import_protocols5 = require("@dxos/protocols");
|
|
147
150
|
var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
|
|
148
151
|
var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
149
152
|
var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
150
|
-
var
|
|
151
|
-
var
|
|
153
|
+
var import_util5 = require("@dxos/util");
|
|
154
|
+
var import_async10 = require("@dxos/async");
|
|
152
155
|
var import_context6 = require("@dxos/context");
|
|
153
156
|
var import_invariant7 = require("@dxos/invariant");
|
|
154
|
-
var
|
|
157
|
+
var import_log7 = require("@dxos/log");
|
|
155
158
|
var import_protocols6 = require("@dxos/protocols");
|
|
156
159
|
var import_invitations3 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
157
160
|
var import_teleport = require("@dxos/teleport");
|
|
158
161
|
var import_context7 = require("@dxos/context");
|
|
159
162
|
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
160
|
-
var
|
|
163
|
+
var import_async11 = require("@dxos/async");
|
|
161
164
|
var import_context8 = require("@dxos/context");
|
|
162
165
|
var import_crypto2 = require("@dxos/crypto");
|
|
163
166
|
var import_invariant8 = require("@dxos/invariant");
|
|
164
167
|
var import_keys7 = require("@dxos/keys");
|
|
165
|
-
var
|
|
168
|
+
var import_log8 = require("@dxos/log");
|
|
166
169
|
var import_protocols7 = require("@dxos/protocols");
|
|
167
170
|
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
168
171
|
var import_invitations4 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
169
172
|
var import_teleport2 = require("@dxos/teleport");
|
|
170
173
|
var import_invariant9 = require("@dxos/invariant");
|
|
171
174
|
var import_keys8 = require("@dxos/keys");
|
|
172
|
-
var
|
|
175
|
+
var import_log9 = require("@dxos/log");
|
|
173
176
|
var import_invitations5 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
174
|
-
var
|
|
177
|
+
var import_util6 = require("@dxos/util");
|
|
175
178
|
var import_codec_protobuf10 = require("@dxos/codec-protobuf");
|
|
176
179
|
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
177
180
|
var import_credentials9 = require("@dxos/credentials");
|
|
178
181
|
var import_feed_store3 = require("@dxos/feed-store");
|
|
179
182
|
var import_invariant10 = require("@dxos/invariant");
|
|
180
|
-
var
|
|
183
|
+
var import_log10 = require("@dxos/log");
|
|
181
184
|
var import_protocols8 = require("@dxos/protocols");
|
|
182
185
|
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
183
186
|
var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
184
|
-
var
|
|
187
|
+
var import_async12 = require("@dxos/async");
|
|
185
188
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
186
189
|
var import_context9 = require("@dxos/context");
|
|
187
190
|
var import_credentials11 = require("@dxos/credentials");
|
|
188
191
|
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
189
192
|
var import_invariant11 = require("@dxos/invariant");
|
|
190
193
|
var import_keys9 = require("@dxos/keys");
|
|
191
|
-
var
|
|
194
|
+
var import_log11 = require("@dxos/log");
|
|
192
195
|
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
193
196
|
var import_credentials12 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
194
|
-
var
|
|
197
|
+
var import_async13 = require("@dxos/async");
|
|
195
198
|
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
196
199
|
var import_context10 = require("@dxos/context");
|
|
197
200
|
var import_debug3 = require("@dxos/debug");
|
|
@@ -199,35 +202,35 @@ var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
|
199
202
|
var import_echo_protocol = require("@dxos/echo-protocol");
|
|
200
203
|
var import_invariant12 = require("@dxos/invariant");
|
|
201
204
|
var import_keys10 = require("@dxos/keys");
|
|
202
|
-
var
|
|
205
|
+
var import_log12 = require("@dxos/log");
|
|
203
206
|
var import_protocols9 = require("@dxos/protocols");
|
|
204
207
|
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
205
208
|
var import_credentials13 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
206
209
|
var import_timeframe3 = require("@dxos/timeframe");
|
|
207
210
|
var import_tracing5 = require("@dxos/tracing");
|
|
208
|
-
var
|
|
209
|
-
var
|
|
211
|
+
var import_util7 = require("@dxos/util");
|
|
212
|
+
var import_async14 = require("@dxos/async");
|
|
210
213
|
var import_context11 = require("@dxos/context");
|
|
211
214
|
var import_credentials14 = require("@dxos/credentials");
|
|
212
|
-
var
|
|
215
|
+
var import_async15 = require("@dxos/async");
|
|
213
216
|
var import_automerge = require("@dxos/automerge/automerge");
|
|
214
217
|
var import_context12 = require("@dxos/context");
|
|
215
218
|
var import_echo_db = require("@dxos/echo-db");
|
|
216
219
|
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
217
220
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
218
221
|
var import_invariant13 = require("@dxos/invariant");
|
|
219
|
-
var
|
|
222
|
+
var import_log13 = require("@dxos/log");
|
|
220
223
|
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
221
|
-
var
|
|
222
|
-
var
|
|
224
|
+
var import_util8 = require("@dxos/util");
|
|
225
|
+
var import_async16 = require("@dxos/async");
|
|
223
226
|
var import_context13 = require("@dxos/context");
|
|
224
227
|
var import_invariant14 = require("@dxos/invariant");
|
|
225
228
|
var import_keys11 = require("@dxos/keys");
|
|
226
|
-
var
|
|
229
|
+
var import_log14 = require("@dxos/log");
|
|
227
230
|
var import_protocols10 = require("@dxos/protocols");
|
|
228
231
|
var import_teleport3 = require("@dxos/teleport");
|
|
229
|
-
var
|
|
230
|
-
var
|
|
232
|
+
var import_util9 = require("@dxos/util");
|
|
233
|
+
var import_async17 = require("@dxos/async");
|
|
231
234
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
232
235
|
var import_context14 = require("@dxos/context");
|
|
233
236
|
var import_credentials15 = require("@dxos/credentials");
|
|
@@ -237,28 +240,28 @@ var import_echo_protocol2 = require("@dxos/echo-protocol");
|
|
|
237
240
|
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
238
241
|
var import_invariant15 = require("@dxos/invariant");
|
|
239
242
|
var import_keys12 = require("@dxos/keys");
|
|
240
|
-
var
|
|
243
|
+
var import_log15 = require("@dxos/log");
|
|
241
244
|
var import_protocols11 = require("@dxos/protocols");
|
|
242
245
|
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
243
246
|
var import_credentials16 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
244
247
|
var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
|
|
245
248
|
var import_tracing6 = require("@dxos/tracing");
|
|
246
|
-
var
|
|
249
|
+
var import_util10 = require("@dxos/util");
|
|
247
250
|
var import_credentials17 = require("@dxos/credentials");
|
|
248
251
|
var import_debug4 = require("@dxos/debug");
|
|
249
252
|
var import_credentials18 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
250
253
|
var import_timeframe4 = require("@dxos/timeframe");
|
|
251
|
-
var
|
|
254
|
+
var import_async18 = require("@dxos/async");
|
|
252
255
|
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
253
256
|
var import_credentials19 = require("@dxos/credentials");
|
|
254
257
|
var import_debug5 = require("@dxos/debug");
|
|
255
258
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
256
259
|
var import_invariant16 = require("@dxos/invariant");
|
|
257
|
-
var
|
|
260
|
+
var import_log16 = require("@dxos/log");
|
|
258
261
|
var import_protocols12 = require("@dxos/protocols");
|
|
259
262
|
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
260
263
|
var import_tracing7 = require("@dxos/tracing");
|
|
261
|
-
var
|
|
264
|
+
var import_async19 = require("@dxos/async");
|
|
262
265
|
var import_context15 = require("@dxos/context");
|
|
263
266
|
var import_credentials20 = require("@dxos/credentials");
|
|
264
267
|
var import_debug6 = require("@dxos/debug");
|
|
@@ -268,56 +271,56 @@ var import_feed_store5 = require("@dxos/feed-store");
|
|
|
268
271
|
var import_invariant17 = require("@dxos/invariant");
|
|
269
272
|
var import_keyring = require("@dxos/keyring");
|
|
270
273
|
var import_keys13 = require("@dxos/keys");
|
|
271
|
-
var
|
|
274
|
+
var import_log17 = require("@dxos/log");
|
|
272
275
|
var import_protocols13 = require("@dxos/protocols");
|
|
273
276
|
var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
|
|
274
277
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
275
278
|
var import_tracing8 = require("@dxos/tracing");
|
|
276
|
-
var
|
|
279
|
+
var import_util11 = require("@dxos/util");
|
|
277
280
|
var import_invariant18 = require("@dxos/invariant");
|
|
278
281
|
var import_lock_file = require("@dxos/lock-file");
|
|
279
|
-
var
|
|
282
|
+
var import_log18 = require("@dxos/log");
|
|
280
283
|
var import_protocols14 = require("@dxos/protocols");
|
|
281
284
|
var import_config = require("@dxos/protocols/proto/dxos/config");
|
|
282
285
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
283
286
|
var import_client_protocol6 = require("@dxos/client-protocol");
|
|
284
287
|
var import_config2 = require("@dxos/protocols/proto/dxos/config");
|
|
285
|
-
var
|
|
288
|
+
var import_util12 = require("@dxos/util");
|
|
286
289
|
var import_node_path = __toESM(require("node:path"));
|
|
287
290
|
var import_keys14 = require("@dxos/keys");
|
|
288
291
|
var import_kv_store = require("@dxos/kv-store");
|
|
289
|
-
var
|
|
292
|
+
var import_async20 = require("@dxos/async");
|
|
290
293
|
var import_client_protocol7 = require("@dxos/client-protocol");
|
|
291
294
|
var import_context16 = require("@dxos/context");
|
|
292
295
|
var import_invariant19 = require("@dxos/invariant");
|
|
293
296
|
var import_keys15 = require("@dxos/keys");
|
|
294
|
-
var
|
|
297
|
+
var import_log19 = require("@dxos/log");
|
|
295
298
|
var import_messaging = require("@dxos/messaging");
|
|
296
299
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
297
300
|
var import_protocols15 = require("@dxos/protocols");
|
|
298
301
|
var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
|
|
299
302
|
var import_tracing9 = require("@dxos/tracing");
|
|
300
303
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
301
|
-
var
|
|
304
|
+
var import_async21 = require("@dxos/async");
|
|
302
305
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
303
306
|
var import_invariant20 = require("@dxos/invariant");
|
|
304
307
|
var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
|
|
305
308
|
var import_config3 = require("@dxos/config");
|
|
306
309
|
var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
|
|
307
310
|
var import_tracing10 = require("@dxos/tracing");
|
|
308
|
-
var import_util12 = require("@dxos/util");
|
|
309
|
-
var import_keys16 = require("@dxos/keys");
|
|
310
311
|
var import_util13 = require("@dxos/util");
|
|
311
|
-
var
|
|
312
|
+
var import_keys16 = require("@dxos/keys");
|
|
313
|
+
var import_util14 = require("@dxos/util");
|
|
314
|
+
var import_async22 = require("@dxos/async");
|
|
312
315
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
313
316
|
var import_keys17 = require("@dxos/keys");
|
|
314
|
-
var
|
|
317
|
+
var import_log20 = require("@dxos/log");
|
|
315
318
|
var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
|
|
316
|
-
var
|
|
319
|
+
var import_util15 = require("@dxos/util");
|
|
317
320
|
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
318
321
|
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
319
322
|
var import_services21 = require("@dxos/protocols/proto/dxos/client/services");
|
|
320
|
-
var
|
|
323
|
+
var import_util16 = require("@dxos/util");
|
|
321
324
|
var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
322
325
|
return new import_codec_protobuf.Stream(({ next }) => {
|
|
323
326
|
const subscriptions = new import_async.EventSubscriptions();
|
|
@@ -628,7 +631,7 @@ var DevtoolsServiceImpl = class {
|
|
|
628
631
|
});
|
|
629
632
|
}
|
|
630
633
|
};
|
|
631
|
-
var DXOS_VERSION = "0.5.9-main.
|
|
634
|
+
var DXOS_VERSION = "0.5.9-main.e183eeb";
|
|
632
635
|
var getPlatform = () => {
|
|
633
636
|
if (process.browser) {
|
|
634
637
|
if (typeof window !== "undefined") {
|
|
@@ -1657,6 +1660,7 @@ IdentityManager = _ts_decorate3([
|
|
|
1657
1660
|
import_tracing4.trace.resource()
|
|
1658
1661
|
], IdentityManager);
|
|
1659
1662
|
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
1663
|
+
var DEFAULT_SPACE_SEARCH_TIMEOUT = 1e4;
|
|
1660
1664
|
var IdentityServiceImpl = class extends import_context4.Resource {
|
|
1661
1665
|
constructor(_identityManager, _keyring, _dataSpaceManagerProvider, _createIdentity, _onProfileUpdate) {
|
|
1662
1666
|
super();
|
|
@@ -1686,7 +1690,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1686
1690
|
const identity = this._identityManager.identity;
|
|
1687
1691
|
(0, import_invariant4.invariant)(identity, void 0, {
|
|
1688
1692
|
F: __dxlog_file6,
|
|
1689
|
-
L:
|
|
1693
|
+
L: 59,
|
|
1690
1694
|
S: this,
|
|
1691
1695
|
A: [
|
|
1692
1696
|
"identity",
|
|
@@ -1720,7 +1724,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1720
1724
|
async updateProfile(profile) {
|
|
1721
1725
|
(0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1722
1726
|
F: __dxlog_file6,
|
|
1723
|
-
L:
|
|
1727
|
+
L: 89,
|
|
1724
1728
|
S: this,
|
|
1725
1729
|
A: [
|
|
1726
1730
|
"this._identityManager.identity",
|
|
@@ -1734,7 +1738,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1734
1738
|
async signPresentation({ presentation, nonce }) {
|
|
1735
1739
|
(0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1736
1740
|
F: __dxlog_file6,
|
|
1737
|
-
L:
|
|
1741
|
+
L: 96,
|
|
1738
1742
|
S: this,
|
|
1739
1743
|
A: [
|
|
1740
1744
|
"this._identityManager.identity",
|
|
@@ -1750,9 +1754,11 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1750
1754
|
});
|
|
1751
1755
|
}
|
|
1752
1756
|
async _fixIdentityWithoutDefaultSpace(identity) {
|
|
1753
|
-
let
|
|
1757
|
+
let recodedDefaultSpace = false;
|
|
1758
|
+
let foundDefaultSpace = false;
|
|
1754
1759
|
const dataSpaceManager = this._dataSpaceManagerProvider();
|
|
1755
|
-
|
|
1760
|
+
const recordedDefaultSpaceTrigger = new import_async8.Trigger();
|
|
1761
|
+
const allProcessed = (0, import_util4.safeAwaitAll)(dataSpaceManager.spaces.values(), async (space) => {
|
|
1756
1762
|
if (space.state === import_services4.SpaceState.CLOSED) {
|
|
1757
1763
|
await space.open();
|
|
1758
1764
|
const requiresMigration = space.stateUpdate.waitForCondition(() => space.state === import_services4.SpaceState.REQUIRES_MIGRATION);
|
|
@@ -1762,12 +1768,29 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1762
1768
|
]);
|
|
1763
1769
|
}
|
|
1764
1770
|
if (await dataSpaceManager.isDefaultSpace(space)) {
|
|
1771
|
+
if (foundDefaultSpace) {
|
|
1772
|
+
import_log5.log.warn("Multiple default spaces found. Using the first one.", {
|
|
1773
|
+
duplicate: space.id
|
|
1774
|
+
}, {
|
|
1775
|
+
F: __dxlog_file6,
|
|
1776
|
+
L: 127,
|
|
1777
|
+
S: this,
|
|
1778
|
+
C: (f, a) => f(...a)
|
|
1779
|
+
});
|
|
1780
|
+
return;
|
|
1781
|
+
}
|
|
1782
|
+
foundDefaultSpace = true;
|
|
1765
1783
|
await identity.updateDefaultSpace(space.id);
|
|
1766
|
-
|
|
1767
|
-
|
|
1784
|
+
recodedDefaultSpace = true;
|
|
1785
|
+
recordedDefaultSpaceTrigger.wake();
|
|
1768
1786
|
}
|
|
1769
|
-
}
|
|
1770
|
-
|
|
1787
|
+
});
|
|
1788
|
+
await Promise.race([
|
|
1789
|
+
allProcessed,
|
|
1790
|
+
recordedDefaultSpaceTrigger.wait(),
|
|
1791
|
+
(0, import_async8.sleep)(DEFAULT_SPACE_SEARCH_TIMEOUT)
|
|
1792
|
+
]);
|
|
1793
|
+
if (!recodedDefaultSpace) {
|
|
1771
1794
|
await this._createDefaultSpace(dataSpaceManager);
|
|
1772
1795
|
}
|
|
1773
1796
|
}
|
|
@@ -1908,7 +1931,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1908
1931
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
1909
1932
|
this._callbacks = _callbacks;
|
|
1910
1933
|
this._ctx = new import_context6.Context();
|
|
1911
|
-
this._remoteOptionsTrigger = new
|
|
1934
|
+
this._remoteOptionsTrigger = new import_async10.Trigger();
|
|
1912
1935
|
this._invitationFlowLock = null;
|
|
1913
1936
|
}
|
|
1914
1937
|
hasFlowLock() {
|
|
@@ -1945,14 +1968,14 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1945
1968
|
async onOpen(context) {
|
|
1946
1969
|
await super.onOpen(context);
|
|
1947
1970
|
try {
|
|
1948
|
-
(0,
|
|
1971
|
+
(0, import_log7.log)("guest acquire lock", void 0, {
|
|
1949
1972
|
F: __dxlog_file8,
|
|
1950
1973
|
L: 84,
|
|
1951
1974
|
S: this,
|
|
1952
1975
|
C: (f, a) => f(...a)
|
|
1953
1976
|
});
|
|
1954
1977
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
1955
|
-
(0,
|
|
1978
|
+
(0, import_log7.log)("guest lock acquired", void 0, {
|
|
1956
1979
|
F: __dxlog_file8,
|
|
1957
1980
|
L: 86,
|
|
1958
1981
|
S: this,
|
|
@@ -1961,7 +1984,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1961
1984
|
await (0, import_context6.cancelWithContext)(this._ctx, this.rpc.InvitationHostService.options({
|
|
1962
1985
|
role: import_invitations3.Options.Role.GUEST
|
|
1963
1986
|
}));
|
|
1964
|
-
(0,
|
|
1987
|
+
(0, import_log7.log)("options sent", void 0, {
|
|
1965
1988
|
F: __dxlog_file8,
|
|
1966
1989
|
L: 88,
|
|
1967
1990
|
S: this,
|
|
@@ -1970,7 +1993,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1970
1993
|
await (0, import_context6.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
|
|
1971
1994
|
timeout: OPTIONS_TIMEOUT
|
|
1972
1995
|
}));
|
|
1973
|
-
(0,
|
|
1996
|
+
(0, import_log7.log)("options received", void 0, {
|
|
1974
1997
|
F: __dxlog_file8,
|
|
1975
1998
|
L: 90,
|
|
1976
1999
|
S: this,
|
|
@@ -2004,7 +2027,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
2004
2027
|
if (this._invitationFlowLock != null) {
|
|
2005
2028
|
this._invitationFlowLock.release();
|
|
2006
2029
|
this._invitationFlowLock = null;
|
|
2007
|
-
(0,
|
|
2030
|
+
(0, import_log7.log)("invitation flow lock released", void 0, {
|
|
2008
2031
|
F: __dxlog_file8,
|
|
2009
2032
|
L: 123,
|
|
2010
2033
|
S: this,
|
|
@@ -2029,12 +2052,12 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2029
2052
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
2030
2053
|
this._callbacks = _callbacks;
|
|
2031
2054
|
this._ctx = new import_context8.Context();
|
|
2032
|
-
this._remoteOptionsTrigger = new
|
|
2055
|
+
this._remoteOptionsTrigger = new import_async11.Trigger();
|
|
2033
2056
|
this._challenge = void 0;
|
|
2034
2057
|
this.guestProfile = void 0;
|
|
2035
2058
|
this.authenticationPassed = false;
|
|
2036
2059
|
this.authenticationRetry = 0;
|
|
2037
|
-
this.completedTrigger = new
|
|
2060
|
+
this.completedTrigger = new import_async11.Trigger();
|
|
2038
2061
|
this._invitationFlowLock = null;
|
|
2039
2062
|
}
|
|
2040
2063
|
hasFlowLock() {
|
|
@@ -2061,7 +2084,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2061
2084
|
introduce: async (request) => {
|
|
2062
2085
|
const { profile, invitationId } = request;
|
|
2063
2086
|
const traceId = import_keys7.PublicKey.random().toHex();
|
|
2064
|
-
|
|
2087
|
+
import_log8.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.begin({
|
|
2065
2088
|
id: traceId
|
|
2066
2089
|
}), {
|
|
2067
2090
|
F: __dxlog_file9,
|
|
@@ -2072,7 +2095,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2072
2095
|
const invitation = this._requireActiveInvitation();
|
|
2073
2096
|
this._assertInvitationState(import_services8.Invitation.State.CONNECTED);
|
|
2074
2097
|
if (invitationId !== invitation?.invitationId) {
|
|
2075
|
-
|
|
2098
|
+
import_log8.log.warn("incorrect invitationId", {
|
|
2076
2099
|
expected: invitation.invitationId,
|
|
2077
2100
|
actual: invitationId
|
|
2078
2101
|
}, {
|
|
@@ -2082,12 +2105,12 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2082
2105
|
C: (f, a) => f(...a)
|
|
2083
2106
|
});
|
|
2084
2107
|
this._callbacks.onError(new Error("Incorrect invitationId."));
|
|
2085
|
-
(0,
|
|
2108
|
+
(0, import_async11.scheduleTask)(this._ctx, () => this.close());
|
|
2086
2109
|
return {
|
|
2087
2110
|
authMethod: import_services8.Invitation.AuthMethod.NONE
|
|
2088
2111
|
};
|
|
2089
2112
|
}
|
|
2090
|
-
(0,
|
|
2113
|
+
(0, import_log8.log)("guest introduced themselves", {
|
|
2091
2114
|
guestProfile: profile
|
|
2092
2115
|
}, {
|
|
2093
2116
|
F: __dxlog_file9,
|
|
@@ -2098,7 +2121,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2098
2121
|
this.guestProfile = profile;
|
|
2099
2122
|
this._callbacks.onStateUpdate(import_services8.Invitation.State.READY_FOR_AUTHENTICATION);
|
|
2100
2123
|
this._challenge = invitation.authMethod === import_services8.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? (0, import_crypto2.randomBytes)(32) : void 0;
|
|
2101
|
-
|
|
2124
|
+
import_log8.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.end({
|
|
2102
2125
|
id: traceId
|
|
2103
2126
|
}), {
|
|
2104
2127
|
F: __dxlog_file9,
|
|
@@ -2113,7 +2136,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2113
2136
|
},
|
|
2114
2137
|
authenticate: async ({ authCode: code, signedChallenge }) => {
|
|
2115
2138
|
const traceId = import_keys7.PublicKey.random().toHex();
|
|
2116
|
-
|
|
2139
|
+
import_log8.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols7.trace.begin({
|
|
2117
2140
|
id: traceId
|
|
2118
2141
|
}), {
|
|
2119
2142
|
F: __dxlog_file9,
|
|
@@ -2122,7 +2145,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2122
2145
|
C: (f, a) => f(...a)
|
|
2123
2146
|
});
|
|
2124
2147
|
const invitation = this._requireActiveInvitation();
|
|
2125
|
-
(0,
|
|
2148
|
+
(0, import_log8.log)("received authentication request", {
|
|
2126
2149
|
authCode: code
|
|
2127
2150
|
}, {
|
|
2128
2151
|
F: __dxlog_file9,
|
|
@@ -2138,7 +2161,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2138
2161
|
this._callbacks.onStateUpdate(import_services8.Invitation.State.AUTHENTICATING);
|
|
2139
2162
|
switch (invitation.authMethod) {
|
|
2140
2163
|
case import_services8.Invitation.AuthMethod.NONE: {
|
|
2141
|
-
(0,
|
|
2164
|
+
(0, import_log8.log)("authentication not required", void 0, {
|
|
2142
2165
|
F: __dxlog_file9,
|
|
2143
2166
|
L: 152,
|
|
2144
2167
|
S: this,
|
|
@@ -2174,7 +2197,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2174
2197
|
break;
|
|
2175
2198
|
}
|
|
2176
2199
|
default: {
|
|
2177
|
-
|
|
2200
|
+
import_log8.log.error("invalid authentication method", {
|
|
2178
2201
|
authMethod: invitation.authMethod
|
|
2179
2202
|
}, {
|
|
2180
2203
|
F: __dxlog_file9,
|
|
@@ -2191,12 +2214,12 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2191
2214
|
import_invitations4.AuthenticationResponse.Status.INVALID_OTP
|
|
2192
2215
|
].includes(status)) {
|
|
2193
2216
|
this._callbacks.onError(new Error(`Authentication failed, with status=${status}`));
|
|
2194
|
-
(0,
|
|
2217
|
+
(0, import_async11.scheduleTask)(this._ctx, () => this.close());
|
|
2195
2218
|
return {
|
|
2196
2219
|
status
|
|
2197
2220
|
};
|
|
2198
2221
|
}
|
|
2199
|
-
|
|
2222
|
+
import_log8.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols7.trace.end({
|
|
2200
2223
|
id: traceId,
|
|
2201
2224
|
data: {
|
|
2202
2225
|
status
|
|
@@ -2213,7 +2236,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2213
2236
|
},
|
|
2214
2237
|
admit: async (request) => {
|
|
2215
2238
|
const traceId = import_keys7.PublicKey.random().toHex();
|
|
2216
|
-
|
|
2239
|
+
import_log8.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.begin({
|
|
2217
2240
|
id: traceId
|
|
2218
2241
|
}), {
|
|
2219
2242
|
F: __dxlog_file9,
|
|
@@ -2230,7 +2253,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2230
2253
|
}
|
|
2231
2254
|
}
|
|
2232
2255
|
const response = await this._callbacks.admit(request);
|
|
2233
|
-
|
|
2256
|
+
import_log8.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.end({
|
|
2234
2257
|
id: traceId
|
|
2235
2258
|
}), {
|
|
2236
2259
|
F: __dxlog_file9,
|
|
@@ -2250,14 +2273,14 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2250
2273
|
async onOpen(context) {
|
|
2251
2274
|
await super.onOpen(context);
|
|
2252
2275
|
try {
|
|
2253
|
-
(0,
|
|
2276
|
+
(0, import_log8.log)("host acquire lock", void 0, {
|
|
2254
2277
|
F: __dxlog_file9,
|
|
2255
2278
|
L: 237,
|
|
2256
2279
|
S: this,
|
|
2257
2280
|
C: (f, a) => f(...a)
|
|
2258
2281
|
});
|
|
2259
2282
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
2260
|
-
(0,
|
|
2283
|
+
(0, import_log8.log)("host lock acquired", void 0, {
|
|
2261
2284
|
F: __dxlog_file9,
|
|
2262
2285
|
L: 239,
|
|
2263
2286
|
S: this,
|
|
@@ -2268,7 +2291,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2268
2291
|
await this.rpc.InvitationHostService.options({
|
|
2269
2292
|
role: import_invitations4.Options.Role.HOST
|
|
2270
2293
|
});
|
|
2271
|
-
(0,
|
|
2294
|
+
(0, import_log8.log)("options sent", void 0, {
|
|
2272
2295
|
F: __dxlog_file9,
|
|
2273
2296
|
L: 243,
|
|
2274
2297
|
S: this,
|
|
@@ -2277,7 +2300,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2277
2300
|
await (0, import_context8.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
|
|
2278
2301
|
timeout: OPTIONS_TIMEOUT2
|
|
2279
2302
|
}));
|
|
2280
|
-
(0,
|
|
2303
|
+
(0, import_log8.log)("options received", void 0, {
|
|
2281
2304
|
F: __dxlog_file9,
|
|
2282
2305
|
L: 245,
|
|
2283
2306
|
S: this,
|
|
@@ -2305,7 +2328,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2305
2328
|
_requireActiveInvitation() {
|
|
2306
2329
|
const invitation = this._callbacks.activeInvitation;
|
|
2307
2330
|
if (invitation == null) {
|
|
2308
|
-
(0,
|
|
2331
|
+
(0, import_async11.scheduleTask)(this._ctx, () => this.close());
|
|
2309
2332
|
throw new Error("Active invitation not found");
|
|
2310
2333
|
}
|
|
2311
2334
|
return invitation;
|
|
@@ -2316,7 +2339,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2316
2339
|
stateOrMany
|
|
2317
2340
|
];
|
|
2318
2341
|
if (!validStates.includes(invitation.state)) {
|
|
2319
|
-
(0,
|
|
2342
|
+
(0, import_async11.scheduleTask)(this._ctx, () => this.close());
|
|
2320
2343
|
throw new import_invariant8.InvariantViolation(`Expected ${stateToString(invitation.state)} to be one of [${validStates.map(stateToString).join(", ")}]`);
|
|
2321
2344
|
}
|
|
2322
2345
|
}
|
|
@@ -2331,7 +2354,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2331
2354
|
if (this._invitationFlowLock != null) {
|
|
2332
2355
|
this._invitationFlowLock?.release();
|
|
2333
2356
|
this._invitationFlowLock = null;
|
|
2334
|
-
(0,
|
|
2357
|
+
(0, import_log8.log)("invitation flow lock released", void 0, {
|
|
2335
2358
|
F: __dxlog_file9,
|
|
2336
2359
|
L: 300,
|
|
2337
2360
|
S: this,
|
|
@@ -2345,7 +2368,7 @@ var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
|
|
|
2345
2368
|
var InvitationTopology = class {
|
|
2346
2369
|
constructor(_role) {
|
|
2347
2370
|
this._role = _role;
|
|
2348
|
-
this._seenPeers = new
|
|
2371
|
+
this._seenPeers = new import_util6.ComplexSet(import_keys8.PublicKey.hash);
|
|
2349
2372
|
}
|
|
2350
2373
|
init(controller) {
|
|
2351
2374
|
(0, import_invariant9.invariant)(!this._controller, "Already initialized.", {
|
|
@@ -2378,9 +2401,9 @@ var InvitationTopology = class {
|
|
|
2378
2401
|
return;
|
|
2379
2402
|
}
|
|
2380
2403
|
const firstUnknownPeer = candidates.find((peerId) => !this._seenPeers.has(peerId));
|
|
2381
|
-
this._seenPeers = new
|
|
2404
|
+
this._seenPeers = new import_util6.ComplexSet(import_keys8.PublicKey.hash, allPeers.filter((peerId) => this._seenPeers.has(peerId)));
|
|
2382
2405
|
if (firstUnknownPeer != null) {
|
|
2383
|
-
(0,
|
|
2406
|
+
(0, import_log9.log)("invitation connect", {
|
|
2384
2407
|
ownPeerId,
|
|
2385
2408
|
remotePeerId: firstUnknownPeer
|
|
2386
2409
|
}, {
|
|
@@ -2460,10 +2483,10 @@ var InvitationsHandler = class {
|
|
|
2460
2483
|
guardedState.error(extension, new import_context5.ContextDisposedError());
|
|
2461
2484
|
}
|
|
2462
2485
|
});
|
|
2463
|
-
(0,
|
|
2486
|
+
(0, import_async9.scheduleTask)(connectionCtx, async () => {
|
|
2464
2487
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
2465
2488
|
try {
|
|
2466
|
-
|
|
2489
|
+
import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.begin({
|
|
2467
2490
|
id: traceId
|
|
2468
2491
|
}), {
|
|
2469
2492
|
F: __dxlog_file11,
|
|
@@ -2471,7 +2494,7 @@ var InvitationsHandler = class {
|
|
|
2471
2494
|
S: this,
|
|
2472
2495
|
C: (f, a) => f(...a)
|
|
2473
2496
|
});
|
|
2474
|
-
(0,
|
|
2497
|
+
(0, import_log6.log)("connected", {
|
|
2475
2498
|
...protocol.toJSON()
|
|
2476
2499
|
}, {
|
|
2477
2500
|
F: __dxlog_file11,
|
|
@@ -2482,7 +2505,7 @@ var InvitationsHandler = class {
|
|
|
2482
2505
|
const deviceKey = await extension.completedTrigger.wait({
|
|
2483
2506
|
timeout: invitation.timeout
|
|
2484
2507
|
});
|
|
2485
|
-
(0,
|
|
2508
|
+
(0, import_log6.log)("admitted guest", {
|
|
2486
2509
|
guest: deviceKey,
|
|
2487
2510
|
...protocol.toJSON()
|
|
2488
2511
|
}, {
|
|
@@ -2492,7 +2515,7 @@ var InvitationsHandler = class {
|
|
|
2492
2515
|
C: (f, a) => f(...a)
|
|
2493
2516
|
});
|
|
2494
2517
|
guardedState.set(extension, import_services6.Invitation.State.SUCCESS);
|
|
2495
|
-
|
|
2518
|
+
import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.end({
|
|
2496
2519
|
id: traceId
|
|
2497
2520
|
}), {
|
|
2498
2521
|
F: __dxlog_file11,
|
|
@@ -2505,9 +2528,9 @@ var InvitationsHandler = class {
|
|
|
2505
2528
|
await ctx.dispose();
|
|
2506
2529
|
}
|
|
2507
2530
|
} catch (err) {
|
|
2508
|
-
if (err instanceof
|
|
2531
|
+
if (err instanceof import_async9.TimeoutError) {
|
|
2509
2532
|
if (guardedState.set(extension, import_services6.Invitation.State.TIMEOUT)) {
|
|
2510
|
-
(0,
|
|
2533
|
+
(0, import_log6.log)("timeout", {
|
|
2511
2534
|
...protocol.toJSON()
|
|
2512
2535
|
}, {
|
|
2513
2536
|
F: __dxlog_file11,
|
|
@@ -2518,7 +2541,7 @@ var InvitationsHandler = class {
|
|
|
2518
2541
|
}
|
|
2519
2542
|
} else {
|
|
2520
2543
|
if (guardedState.error(extension, err)) {
|
|
2521
|
-
|
|
2544
|
+
import_log6.log.error("failed", err, {
|
|
2522
2545
|
F: __dxlog_file11,
|
|
2523
2546
|
L: 133,
|
|
2524
2547
|
S: this,
|
|
@@ -2526,7 +2549,7 @@ var InvitationsHandler = class {
|
|
|
2526
2549
|
});
|
|
2527
2550
|
}
|
|
2528
2551
|
}
|
|
2529
|
-
|
|
2552
|
+
import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.error({
|
|
2530
2553
|
id: traceId,
|
|
2531
2554
|
error: err
|
|
2532
2555
|
}), {
|
|
@@ -2541,7 +2564,7 @@ var InvitationsHandler = class {
|
|
|
2541
2564
|
},
|
|
2542
2565
|
onError: (err) => {
|
|
2543
2566
|
if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
|
|
2544
|
-
(0,
|
|
2567
|
+
(0, import_log6.log)("invalid role", {
|
|
2545
2568
|
...err.context
|
|
2546
2569
|
}, {
|
|
2547
2570
|
F: __dxlog_file11,
|
|
@@ -2551,9 +2574,9 @@ var InvitationsHandler = class {
|
|
|
2551
2574
|
});
|
|
2552
2575
|
return;
|
|
2553
2576
|
}
|
|
2554
|
-
if (err instanceof
|
|
2577
|
+
if (err instanceof import_async9.TimeoutError) {
|
|
2555
2578
|
if (guardedState.set(extension, import_services6.Invitation.State.TIMEOUT)) {
|
|
2556
|
-
(0,
|
|
2579
|
+
(0, import_log6.log)("timeout", {
|
|
2557
2580
|
err
|
|
2558
2581
|
}, {
|
|
2559
2582
|
F: __dxlog_file11,
|
|
@@ -2564,7 +2587,7 @@ var InvitationsHandler = class {
|
|
|
2564
2587
|
}
|
|
2565
2588
|
} else {
|
|
2566
2589
|
if (guardedState.error(extension, err)) {
|
|
2567
|
-
|
|
2590
|
+
import_log6.log.error("failed", err, {
|
|
2568
2591
|
F: __dxlog_file11,
|
|
2569
2592
|
L: 153,
|
|
2570
2593
|
S: this,
|
|
@@ -2578,14 +2601,14 @@ var InvitationsHandler = class {
|
|
|
2578
2601
|
};
|
|
2579
2602
|
if (invitation.lifetime && invitation.created) {
|
|
2580
2603
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
2581
|
-
|
|
2604
|
+
import_log6.log.warn("invitation has already expired", void 0, {
|
|
2582
2605
|
F: __dxlog_file11,
|
|
2583
2606
|
L: 164,
|
|
2584
2607
|
S: this,
|
|
2585
2608
|
C: (f, a) => f(...a)
|
|
2586
2609
|
});
|
|
2587
2610
|
} else {
|
|
2588
|
-
(0,
|
|
2611
|
+
(0, import_async9.scheduleTask)(ctx, async () => {
|
|
2589
2612
|
await swarmConnection.close();
|
|
2590
2613
|
guardedState.set(null, import_services6.Invitation.State.EXPIRED);
|
|
2591
2614
|
await ctx.dispose();
|
|
@@ -2593,7 +2616,7 @@ var InvitationsHandler = class {
|
|
|
2593
2616
|
}
|
|
2594
2617
|
}
|
|
2595
2618
|
let swarmConnection;
|
|
2596
|
-
(0,
|
|
2619
|
+
(0, import_async9.scheduleTask)(ctx, async () => {
|
|
2597
2620
|
swarmConnection = await this._joinSwarm(ctx, invitation, import_invitations2.Options.Role.HOST, createExtension);
|
|
2598
2621
|
guardedState.set(null, import_services6.Invitation.State.CONNECTING);
|
|
2599
2622
|
});
|
|
@@ -2611,11 +2634,11 @@ var InvitationsHandler = class {
|
|
|
2611
2634
|
]
|
|
2612
2635
|
});
|
|
2613
2636
|
}
|
|
2614
|
-
const triedPeersIds = new
|
|
2637
|
+
const triedPeersIds = new import_util5.ComplexSet(import_keys6.PublicKey.hash);
|
|
2615
2638
|
const guardedState = this._createGuardedState(ctx, invitation, stream);
|
|
2616
2639
|
const shouldCancelInvitationFlow = (extension) => {
|
|
2617
2640
|
const isLockedByAnotherConnection = guardedState.mutex.isLocked() && !extension.hasFlowLock();
|
|
2618
|
-
(0,
|
|
2641
|
+
(0, import_log6.log)("should cancel invitation flow", {
|
|
2619
2642
|
isLockedByAnotherConnection,
|
|
2620
2643
|
invitationType: import_services6.Invitation.Type.DELEGATED,
|
|
2621
2644
|
triedPeers: triedPeersIds.size
|
|
@@ -2643,7 +2666,7 @@ var InvitationsHandler = class {
|
|
|
2643
2666
|
return;
|
|
2644
2667
|
}
|
|
2645
2668
|
connectionCtx.onDispose(async () => {
|
|
2646
|
-
(0,
|
|
2669
|
+
(0, import_log6.log)("extension disposed", {
|
|
2647
2670
|
admitted,
|
|
2648
2671
|
currentState: guardedState.current.state
|
|
2649
2672
|
}, {
|
|
@@ -2659,10 +2682,10 @@ var InvitationsHandler = class {
|
|
|
2659
2682
|
}
|
|
2660
2683
|
}
|
|
2661
2684
|
});
|
|
2662
|
-
(0,
|
|
2685
|
+
(0, import_async9.scheduleTask)(connectionCtx, async () => {
|
|
2663
2686
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
2664
2687
|
try {
|
|
2665
|
-
|
|
2688
|
+
import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.begin({
|
|
2666
2689
|
id: traceId
|
|
2667
2690
|
}), {
|
|
2668
2691
|
F: __dxlog_file11,
|
|
@@ -2670,11 +2693,11 @@ var InvitationsHandler = class {
|
|
|
2670
2693
|
S: this,
|
|
2671
2694
|
C: (f, a) => f(...a)
|
|
2672
2695
|
});
|
|
2673
|
-
(0,
|
|
2696
|
+
(0, import_async9.scheduleTask)(connectionCtx, () => {
|
|
2674
2697
|
guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
|
|
2675
2698
|
extensionCtx.close();
|
|
2676
2699
|
}, timeout);
|
|
2677
|
-
(0,
|
|
2700
|
+
(0, import_log6.log)("connected", {
|
|
2678
2701
|
...protocol.toJSON()
|
|
2679
2702
|
}, {
|
|
2680
2703
|
F: __dxlog_file11,
|
|
@@ -2683,7 +2706,7 @@ var InvitationsHandler = class {
|
|
|
2683
2706
|
C: (f, a) => f(...a)
|
|
2684
2707
|
});
|
|
2685
2708
|
guardedState.set(extension, import_services6.Invitation.State.CONNECTED);
|
|
2686
|
-
(0,
|
|
2709
|
+
(0, import_log6.log)("introduce", {
|
|
2687
2710
|
...protocol.toJSON()
|
|
2688
2711
|
}, {
|
|
2689
2712
|
F: __dxlog_file11,
|
|
@@ -2695,7 +2718,7 @@ var InvitationsHandler = class {
|
|
|
2695
2718
|
invitationId: invitation.invitationId,
|
|
2696
2719
|
...protocol.createIntroduction()
|
|
2697
2720
|
});
|
|
2698
|
-
(0,
|
|
2721
|
+
(0, import_log6.log)("introduce response", {
|
|
2699
2722
|
...protocol.toJSON(),
|
|
2700
2723
|
response: introductionResponse
|
|
2701
2724
|
}, {
|
|
@@ -2717,7 +2740,7 @@ var InvitationsHandler = class {
|
|
|
2717
2740
|
break;
|
|
2718
2741
|
}
|
|
2719
2742
|
}
|
|
2720
|
-
(0,
|
|
2743
|
+
(0, import_log6.log)("request admission", {
|
|
2721
2744
|
...protocol.toJSON()
|
|
2722
2745
|
}, {
|
|
2723
2746
|
F: __dxlog_file11,
|
|
@@ -2729,7 +2752,7 @@ var InvitationsHandler = class {
|
|
|
2729
2752
|
const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
|
|
2730
2753
|
admitted = true;
|
|
2731
2754
|
const result = await protocol.accept(admissionResponse, admissionRequest);
|
|
2732
|
-
(0,
|
|
2755
|
+
(0, import_log6.log)("admitted by host", {
|
|
2733
2756
|
...protocol.toJSON()
|
|
2734
2757
|
}, {
|
|
2735
2758
|
F: __dxlog_file11,
|
|
@@ -2742,7 +2765,7 @@ var InvitationsHandler = class {
|
|
|
2742
2765
|
...result,
|
|
2743
2766
|
state: import_services6.Invitation.State.SUCCESS
|
|
2744
2767
|
});
|
|
2745
|
-
|
|
2768
|
+
import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.end({
|
|
2746
2769
|
id: traceId
|
|
2747
2770
|
}), {
|
|
2748
2771
|
F: __dxlog_file11,
|
|
@@ -2751,8 +2774,8 @@ var InvitationsHandler = class {
|
|
|
2751
2774
|
C: (f, a) => f(...a)
|
|
2752
2775
|
});
|
|
2753
2776
|
} catch (err) {
|
|
2754
|
-
if (err instanceof
|
|
2755
|
-
(0,
|
|
2777
|
+
if (err instanceof import_async9.TimeoutError) {
|
|
2778
|
+
(0, import_log6.log)("timeout", {
|
|
2756
2779
|
...protocol.toJSON()
|
|
2757
2780
|
}, {
|
|
2758
2781
|
F: __dxlog_file11,
|
|
@@ -2762,7 +2785,7 @@ var InvitationsHandler = class {
|
|
|
2762
2785
|
});
|
|
2763
2786
|
guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
|
|
2764
2787
|
} else {
|
|
2765
|
-
(0,
|
|
2788
|
+
(0, import_log6.log)("auth failed", err, {
|
|
2766
2789
|
F: __dxlog_file11,
|
|
2767
2790
|
L: 314,
|
|
2768
2791
|
S: this,
|
|
@@ -2771,7 +2794,7 @@ var InvitationsHandler = class {
|
|
|
2771
2794
|
guardedState.error(extension, err);
|
|
2772
2795
|
}
|
|
2773
2796
|
extensionCtx.close(err);
|
|
2774
|
-
|
|
2797
|
+
import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.error({
|
|
2775
2798
|
id: traceId,
|
|
2776
2799
|
error: err
|
|
2777
2800
|
}), {
|
|
@@ -2787,8 +2810,8 @@ var InvitationsHandler = class {
|
|
|
2787
2810
|
if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
|
|
2788
2811
|
return;
|
|
2789
2812
|
}
|
|
2790
|
-
if (err instanceof
|
|
2791
|
-
(0,
|
|
2813
|
+
if (err instanceof import_async9.TimeoutError) {
|
|
2814
|
+
(0, import_log6.log)("timeout", {
|
|
2792
2815
|
...protocol.toJSON()
|
|
2793
2816
|
}, {
|
|
2794
2817
|
F: __dxlog_file11,
|
|
@@ -2798,7 +2821,7 @@ var InvitationsHandler = class {
|
|
|
2798
2821
|
});
|
|
2799
2822
|
guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
|
|
2800
2823
|
} else {
|
|
2801
|
-
(0,
|
|
2824
|
+
(0, import_log6.log)("auth failed", err, {
|
|
2802
2825
|
F: __dxlog_file11,
|
|
2803
2826
|
L: 330,
|
|
2804
2827
|
S: this,
|
|
@@ -2810,7 +2833,7 @@ var InvitationsHandler = class {
|
|
|
2810
2833
|
});
|
|
2811
2834
|
return extension;
|
|
2812
2835
|
};
|
|
2813
|
-
(0,
|
|
2836
|
+
(0, import_async9.scheduleTask)(ctx, async () => {
|
|
2814
2837
|
const error = protocol.checkInvitation(invitation);
|
|
2815
2838
|
if (error) {
|
|
2816
2839
|
stream.error(error);
|
|
@@ -2856,7 +2879,7 @@ var InvitationsHandler = class {
|
|
|
2856
2879
|
* invitation flow connections.
|
|
2857
2880
|
*/
|
|
2858
2881
|
_createGuardedState(ctx, invitation, stream) {
|
|
2859
|
-
const mutex = new
|
|
2882
|
+
const mutex = new import_async9.Mutex();
|
|
2860
2883
|
let lastActiveExtension = null;
|
|
2861
2884
|
let currentInvitation = {
|
|
2862
2885
|
...invitation
|
|
@@ -2911,7 +2934,7 @@ var InvitationsHandler = class {
|
|
|
2911
2934
|
};
|
|
2912
2935
|
}
|
|
2913
2936
|
_logStateUpdate(invitation, actor, newState) {
|
|
2914
|
-
(0,
|
|
2937
|
+
(0, import_log6.log)("invitation state update", {
|
|
2915
2938
|
actor: actor?.constructor.name,
|
|
2916
2939
|
newState: stateToString(newState),
|
|
2917
2940
|
oldState: stateToString(invitation.state)
|
|
@@ -2933,7 +2956,7 @@ var InvitationsHandler = class {
|
|
|
2933
2956
|
}
|
|
2934
2957
|
async _handleGuestOtpAuth(extension, setState, authenticated, options) {
|
|
2935
2958
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
2936
|
-
(0,
|
|
2959
|
+
(0, import_log6.log)("guest waiting for authentication code...", void 0, {
|
|
2937
2960
|
F: __dxlog_file11,
|
|
2938
2961
|
L: 462,
|
|
2939
2962
|
S: this,
|
|
@@ -2941,7 +2964,7 @@ var InvitationsHandler = class {
|
|
|
2941
2964
|
});
|
|
2942
2965
|
setState(import_services6.Invitation.State.READY_FOR_AUTHENTICATION);
|
|
2943
2966
|
const authCode = await authenticated.wait(options);
|
|
2944
|
-
(0,
|
|
2967
|
+
(0, import_log6.log)("sending authentication request", void 0, {
|
|
2945
2968
|
F: __dxlog_file11,
|
|
2946
2969
|
L: 466,
|
|
2947
2970
|
S: this,
|
|
@@ -2958,7 +2981,7 @@ var InvitationsHandler = class {
|
|
|
2958
2981
|
if (attempt === MAX_OTP_ATTEMPTS) {
|
|
2959
2982
|
throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
|
|
2960
2983
|
} else {
|
|
2961
|
-
(0,
|
|
2984
|
+
(0, import_log6.log)("retrying invalid code", {
|
|
2962
2985
|
attempt
|
|
2963
2986
|
}, {
|
|
2964
2987
|
F: __dxlog_file11,
|
|
@@ -2978,7 +3001,7 @@ var InvitationsHandler = class {
|
|
|
2978
3001
|
if (introductionResponse.challenge == null) {
|
|
2979
3002
|
throw new Error("challenge missing in the introduction");
|
|
2980
3003
|
}
|
|
2981
|
-
(0,
|
|
3004
|
+
(0, import_log6.log)("sending authentication request", void 0, {
|
|
2982
3005
|
F: __dxlog_file11,
|
|
2983
3006
|
L: 496,
|
|
2984
3007
|
S: this,
|
|
@@ -3160,7 +3183,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3160
3183
|
if (space.inner.spaceState.getMemberRole(identityKey) !== import_credentials10.SpaceMember.Role.REMOVED) {
|
|
3161
3184
|
throw new import_protocols8.AlreadyJoinedError();
|
|
3162
3185
|
}
|
|
3163
|
-
(0,
|
|
3186
|
+
(0, import_log10.log)("writing guest credentials", {
|
|
3164
3187
|
host: this._signingContext.deviceKey,
|
|
3165
3188
|
guest: deviceKey
|
|
3166
3189
|
}, {
|
|
@@ -3228,7 +3251,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3228
3251
|
]
|
|
3229
3252
|
});
|
|
3230
3253
|
}
|
|
3231
|
-
(0,
|
|
3254
|
+
(0, import_log10.log)("writing delegate space invitation", {
|
|
3232
3255
|
host: this._signingContext.deviceKey,
|
|
3233
3256
|
id: invitation.invitationId
|
|
3234
3257
|
}, {
|
|
@@ -3289,7 +3312,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3289
3312
|
""
|
|
3290
3313
|
]
|
|
3291
3314
|
});
|
|
3292
|
-
(0,
|
|
3315
|
+
(0, import_log10.log)("cancelling delegated space invitation", {
|
|
3293
3316
|
host: this._signingContext.deviceKey,
|
|
3294
3317
|
id: invitation.invitationId
|
|
3295
3318
|
}, {
|
|
@@ -3390,12 +3413,12 @@ var InvitationsManager = class {
|
|
|
3390
3413
|
this._metadataStore = _metadataStore;
|
|
3391
3414
|
this._createInvitations = /* @__PURE__ */ new Map();
|
|
3392
3415
|
this._acceptInvitations = /* @__PURE__ */ new Map();
|
|
3393
|
-
this.invitationCreated = new
|
|
3394
|
-
this.invitationAccepted = new
|
|
3395
|
-
this.removedCreated = new
|
|
3396
|
-
this.removedAccepted = new
|
|
3397
|
-
this.saved = new
|
|
3398
|
-
this._persistentInvitationsLoadedEvent = new
|
|
3416
|
+
this.invitationCreated = new import_async12.Event();
|
|
3417
|
+
this.invitationAccepted = new import_async12.Event();
|
|
3418
|
+
this.removedCreated = new import_async12.Event();
|
|
3419
|
+
this.removedAccepted = new import_async12.Event();
|
|
3420
|
+
this.saved = new import_async12.Event();
|
|
3421
|
+
this._persistentInvitationsLoadedEvent = new import_async12.Event();
|
|
3399
3422
|
this._persistentInvitationsLoaded = false;
|
|
3400
3423
|
}
|
|
3401
3424
|
async createInvitation(options) {
|
|
@@ -3424,7 +3447,7 @@ var InvitationsManager = class {
|
|
|
3424
3447
|
try {
|
|
3425
3448
|
await this._persistIfRequired(handler, stream, invitation);
|
|
3426
3449
|
} catch (err) {
|
|
3427
|
-
|
|
3450
|
+
import_log11.log.catch(err, void 0, {
|
|
3428
3451
|
F: __dxlog_file13,
|
|
3429
3452
|
L: 82,
|
|
3430
3453
|
S: this,
|
|
@@ -3466,7 +3489,7 @@ var InvitationsManager = class {
|
|
|
3466
3489
|
invitations: cInvitations.map((invitation) => invitation.get())
|
|
3467
3490
|
};
|
|
3468
3491
|
} catch (err) {
|
|
3469
|
-
|
|
3492
|
+
import_log11.log.catch(err, void 0, {
|
|
3470
3493
|
F: __dxlog_file13,
|
|
3471
3494
|
L: 110,
|
|
3472
3495
|
S: this,
|
|
@@ -3498,7 +3521,7 @@ var InvitationsManager = class {
|
|
|
3498
3521
|
return invitation;
|
|
3499
3522
|
}
|
|
3500
3523
|
async authenticate({ invitationId, authCode }) {
|
|
3501
|
-
(0,
|
|
3524
|
+
(0, import_log11.log)("authenticating...", void 0, {
|
|
3502
3525
|
F: __dxlog_file13,
|
|
3503
3526
|
L: 140,
|
|
3504
3527
|
S: this,
|
|
@@ -3515,7 +3538,7 @@ var InvitationsManager = class {
|
|
|
3515
3538
|
});
|
|
3516
3539
|
const observable = this._acceptInvitations.get(invitationId);
|
|
3517
3540
|
if (!observable) {
|
|
3518
|
-
|
|
3541
|
+
import_log11.log.warn("invalid invitation", {
|
|
3519
3542
|
invitationId
|
|
3520
3543
|
}, {
|
|
3521
3544
|
F: __dxlog_file13,
|
|
@@ -3528,7 +3551,7 @@ var InvitationsManager = class {
|
|
|
3528
3551
|
}
|
|
3529
3552
|
}
|
|
3530
3553
|
async cancelInvitation({ invitationId }) {
|
|
3531
|
-
(0,
|
|
3554
|
+
(0, import_log11.log)("cancelInvitation...", {
|
|
3532
3555
|
invitationId
|
|
3533
3556
|
}, {
|
|
3534
3557
|
F: __dxlog_file13,
|
|
@@ -3605,7 +3628,7 @@ var InvitationsManager = class {
|
|
|
3605
3628
|
};
|
|
3606
3629
|
}
|
|
3607
3630
|
_createObservableInvitation(handler, invitation) {
|
|
3608
|
-
const stream = new
|
|
3631
|
+
const stream = new import_async12.PushStream();
|
|
3609
3632
|
const ctx = new import_context9.Context({
|
|
3610
3633
|
onError: (err) => {
|
|
3611
3634
|
stream.error(err);
|
|
@@ -3613,7 +3636,7 @@ var InvitationsManager = class {
|
|
|
3613
3636
|
}
|
|
3614
3637
|
});
|
|
3615
3638
|
ctx.onDispose(() => {
|
|
3616
|
-
(0,
|
|
3639
|
+
(0, import_log11.log)("complete", {
|
|
3617
3640
|
...handler.toJSON()
|
|
3618
3641
|
}, {
|
|
3619
3642
|
F: __dxlog_file13,
|
|
@@ -3641,12 +3664,12 @@ var InvitationsManager = class {
|
|
|
3641
3664
|
};
|
|
3642
3665
|
}
|
|
3643
3666
|
_createObservableAcceptingInvitation(handler, initialState) {
|
|
3644
|
-
const otpEnteredTrigger = new
|
|
3645
|
-
const stream = new
|
|
3667
|
+
const otpEnteredTrigger = new import_async12.Trigger();
|
|
3668
|
+
const stream = new import_async12.PushStream();
|
|
3646
3669
|
const ctx = new import_context9.Context({
|
|
3647
3670
|
onError: (err) => {
|
|
3648
|
-
if (err instanceof
|
|
3649
|
-
(0,
|
|
3671
|
+
if (err instanceof import_async12.TimeoutError) {
|
|
3672
|
+
(0, import_log11.log)("timeout", {
|
|
3650
3673
|
...handler.toJSON()
|
|
3651
3674
|
}, {
|
|
3652
3675
|
F: __dxlog_file13,
|
|
@@ -3659,7 +3682,7 @@ var InvitationsManager = class {
|
|
|
3659
3682
|
state: import_services11.Invitation.State.TIMEOUT
|
|
3660
3683
|
});
|
|
3661
3684
|
} else {
|
|
3662
|
-
|
|
3685
|
+
import_log11.log.warn("auth failed", err, {
|
|
3663
3686
|
F: __dxlog_file13,
|
|
3664
3687
|
L: 264,
|
|
3665
3688
|
S: this,
|
|
@@ -3674,7 +3697,7 @@ var InvitationsManager = class {
|
|
|
3674
3697
|
}
|
|
3675
3698
|
});
|
|
3676
3699
|
ctx.onDispose(() => {
|
|
3677
|
-
(0,
|
|
3700
|
+
(0, import_log11.log)("complete", {
|
|
3678
3701
|
...handler.toJSON()
|
|
3679
3702
|
}, {
|
|
3680
3703
|
F: __dxlog_file13,
|
|
@@ -3721,7 +3744,7 @@ var InvitationsManager = class {
|
|
|
3721
3744
|
try {
|
|
3722
3745
|
await this._metadataStore.removeInvitation(invitation.invitationId);
|
|
3723
3746
|
} catch (err) {
|
|
3724
|
-
|
|
3747
|
+
import_log11.log.catch(err, void 0, {
|
|
3725
3748
|
F: __dxlog_file13,
|
|
3726
3749
|
L: 307,
|
|
3727
3750
|
S: this,
|
|
@@ -3741,7 +3764,7 @@ var AutomergeSpaceState = class extends import_context11.Resource {
|
|
|
3741
3764
|
this._onNewRoot = _onNewRoot;
|
|
3742
3765
|
this.rootUrl = void 0;
|
|
3743
3766
|
this.lastEpoch = void 0;
|
|
3744
|
-
this.onNewEpoch = new
|
|
3767
|
+
this.onNewEpoch = new import_async14.Event();
|
|
3745
3768
|
this._isProcessingRootDocs = false;
|
|
3746
3769
|
}
|
|
3747
3770
|
async _open(ctx) {
|
|
@@ -3790,7 +3813,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3790
3813
|
throw new Error("Space does not have an automerge root");
|
|
3791
3814
|
}
|
|
3792
3815
|
const rootHandle = context.repo.find(context.currentRoot);
|
|
3793
|
-
await (0, import_context12.cancelWithContext)(ctx, (0,
|
|
3816
|
+
await (0, import_context12.cancelWithContext)(ctx, (0, import_async15.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
3794
3817
|
const newRoot = context.repo.create(rootHandle.docSync());
|
|
3795
3818
|
await context.repo.flush();
|
|
3796
3819
|
return {
|
|
@@ -3798,7 +3821,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3798
3821
|
};
|
|
3799
3822
|
}
|
|
3800
3823
|
case import_services13.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
|
|
3801
|
-
|
|
3824
|
+
import_log13.log.info("Fragmenting", void 0, {
|
|
3802
3825
|
F: __dxlog_file14,
|
|
3803
3826
|
L: 63,
|
|
3804
3827
|
S: void 0,
|
|
@@ -3806,7 +3829,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3806
3829
|
});
|
|
3807
3830
|
const currentRootUrl = context.currentRoot;
|
|
3808
3831
|
const rootHandle = context.repo.find(currentRootUrl);
|
|
3809
|
-
await (0, import_context12.cancelWithContext)(ctx, (0,
|
|
3832
|
+
await (0, import_context12.cancelWithContext)(ctx, (0, import_async15.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
3810
3833
|
const objects = Object.entries(rootHandle.docSync().objects);
|
|
3811
3834
|
const properties = (0, import_echo_db.findInlineObjectOfType)(rootHandle.docSync(), import_echo_schema.TYPE_PROPERTIES);
|
|
3812
3835
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
@@ -3842,7 +3865,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3842
3865
|
otherObjects.forEach(([key, value]) => {
|
|
3843
3866
|
const handle = docLoader.createDocumentForObject(key);
|
|
3844
3867
|
handle.change((doc) => {
|
|
3845
|
-
(0,
|
|
3868
|
+
(0, import_util8.assignDeep)(doc, [
|
|
3846
3869
|
"objects",
|
|
3847
3870
|
key
|
|
3848
3871
|
], value);
|
|
@@ -3856,7 +3879,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3856
3879
|
case import_services13.CreateEpochRequest.Migration.MIGRATE_REFERENCES_TO_DXN: {
|
|
3857
3880
|
const currentRootUrl = context.currentRoot;
|
|
3858
3881
|
const rootHandle = context.repo.find(currentRootUrl);
|
|
3859
|
-
await (0, import_context12.cancelWithContext)(ctx, (0,
|
|
3882
|
+
await (0, import_context12.cancelWithContext)(ctx, (0, import_async15.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
3860
3883
|
(0, import_invariant13.invariant)(rootHandle.docSync(), "Root doc not found", {
|
|
3861
3884
|
F: __dxlog_file14,
|
|
3862
3885
|
L: 100,
|
|
@@ -3869,7 +3892,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3869
3892
|
const newRootContent = await (0, import_echo_db.convertLegacySpaceRootDoc)(structuredClone(rootHandle.docSync()));
|
|
3870
3893
|
for (const [id, url] of Object.entries(newRootContent.links ?? {})) {
|
|
3871
3894
|
const handle = context.repo.find(url);
|
|
3872
|
-
await (0, import_context12.cancelWithContext)(ctx, (0,
|
|
3895
|
+
await (0, import_context12.cancelWithContext)(ctx, (0, import_async15.asyncTimeout)(handle.whenReady(), 1e4));
|
|
3873
3896
|
(0, import_invariant13.invariant)(handle.docSync(), "Doc not found", {
|
|
3874
3897
|
F: __dxlog_file14,
|
|
3875
3898
|
L: 107,
|
|
@@ -3917,10 +3940,10 @@ var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
|
3917
3940
|
var NotarizationPlugin = class {
|
|
3918
3941
|
constructor() {
|
|
3919
3942
|
this._ctx = new import_context13.Context();
|
|
3920
|
-
this._extensionOpened = new
|
|
3943
|
+
this._extensionOpened = new import_async16.Event();
|
|
3921
3944
|
this._extensions = /* @__PURE__ */ new Set();
|
|
3922
|
-
this._processedCredentials = new
|
|
3923
|
-
this._processCredentialsTriggers = new
|
|
3945
|
+
this._processedCredentials = new import_util9.ComplexSet(import_keys11.PublicKey.hash);
|
|
3946
|
+
this._processCredentialsTriggers = new import_util9.ComplexMap(import_keys11.PublicKey.hash);
|
|
3924
3947
|
}
|
|
3925
3948
|
get hasWriter() {
|
|
3926
3949
|
return !!this._writer;
|
|
@@ -3934,7 +3957,7 @@ var NotarizationPlugin = class {
|
|
|
3934
3957
|
* Request credentials to be notarized.
|
|
3935
3958
|
*/
|
|
3936
3959
|
async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY }) {
|
|
3937
|
-
(0,
|
|
3960
|
+
(0, import_log14.log)("notarize", {
|
|
3938
3961
|
credentials
|
|
3939
3962
|
}, {
|
|
3940
3963
|
F: __dxlog_file15,
|
|
@@ -3951,10 +3974,10 @@ var NotarizationPlugin = class {
|
|
|
3951
3974
|
"'Credentials must have an id'"
|
|
3952
3975
|
]
|
|
3953
3976
|
});
|
|
3954
|
-
const errors = new
|
|
3977
|
+
const errors = new import_async16.Trigger();
|
|
3955
3978
|
const ctx = this._ctx.derive({
|
|
3956
3979
|
onError: (err) => {
|
|
3957
|
-
|
|
3980
|
+
import_log14.log.warn("Notarization error", {
|
|
3958
3981
|
err
|
|
3959
3982
|
}, {
|
|
3960
3983
|
F: __dxlog_file15,
|
|
@@ -3968,8 +3991,8 @@ var NotarizationPlugin = class {
|
|
|
3968
3991
|
});
|
|
3969
3992
|
opCtx?.onDispose(() => ctx.dispose());
|
|
3970
3993
|
if (timeout !== 0) {
|
|
3971
|
-
(0,
|
|
3972
|
-
|
|
3994
|
+
(0, import_async16.scheduleTask)(ctx, () => {
|
|
3995
|
+
import_log14.log.warn("Notarization timeout", {
|
|
3973
3996
|
timeout,
|
|
3974
3997
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
3975
3998
|
}, {
|
|
@@ -3979,12 +4002,12 @@ var NotarizationPlugin = class {
|
|
|
3979
4002
|
C: (f, a) => f(...a)
|
|
3980
4003
|
});
|
|
3981
4004
|
void ctx.dispose();
|
|
3982
|
-
errors.throw(new
|
|
4005
|
+
errors.throw(new import_async16.TimeoutError(timeout, "Notarization timed out"));
|
|
3983
4006
|
}, timeout);
|
|
3984
4007
|
}
|
|
3985
4008
|
const allNotarized = Promise.all(credentials.map((credential) => this._waitUntilProcessed(credential.id)));
|
|
3986
4009
|
const peersTried = /* @__PURE__ */ new Set();
|
|
3987
|
-
const notarizeTask = new
|
|
4010
|
+
const notarizeTask = new import_async16.DeferredTask(ctx, async () => {
|
|
3988
4011
|
try {
|
|
3989
4012
|
if (this._extensions.size === 0) {
|
|
3990
4013
|
return;
|
|
@@ -3993,7 +4016,7 @@ var NotarizationPlugin = class {
|
|
|
3993
4016
|
...this._extensions
|
|
3994
4017
|
].find((peer2) => !peersTried.has(peer2));
|
|
3995
4018
|
if (!peer) {
|
|
3996
|
-
|
|
4019
|
+
import_log14.log.info("Exhausted all peers to notarize with", {
|
|
3997
4020
|
retryIn: retryTimeout
|
|
3998
4021
|
}, {
|
|
3999
4022
|
F: __dxlog_file15,
|
|
@@ -4002,11 +4025,11 @@ var NotarizationPlugin = class {
|
|
|
4002
4025
|
C: (f, a) => f(...a)
|
|
4003
4026
|
});
|
|
4004
4027
|
peersTried.clear();
|
|
4005
|
-
(0,
|
|
4028
|
+
(0, import_async16.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
|
|
4006
4029
|
return;
|
|
4007
4030
|
}
|
|
4008
4031
|
peersTried.add(peer);
|
|
4009
|
-
(0,
|
|
4032
|
+
(0, import_log14.log)("try notarizing", {
|
|
4010
4033
|
peer: peer.localPeerId,
|
|
4011
4034
|
credentialId: credentials.map((credential) => credential.id)
|
|
4012
4035
|
}, {
|
|
@@ -4018,16 +4041,16 @@ var NotarizationPlugin = class {
|
|
|
4018
4041
|
await peer.rpc.NotarizationService.notarize({
|
|
4019
4042
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
4020
4043
|
});
|
|
4021
|
-
(0,
|
|
4044
|
+
(0, import_log14.log)("success", void 0, {
|
|
4022
4045
|
F: __dxlog_file15,
|
|
4023
4046
|
L: 147,
|
|
4024
4047
|
S: this,
|
|
4025
4048
|
C: (f, a) => f(...a)
|
|
4026
4049
|
});
|
|
4027
|
-
await (0,
|
|
4050
|
+
await (0, import_async16.sleep)(successDelay);
|
|
4028
4051
|
} catch (err) {
|
|
4029
4052
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
4030
|
-
|
|
4053
|
+
import_log14.log.info("error notarizing (recoverable)", err, {
|
|
4031
4054
|
F: __dxlog_file15,
|
|
4032
4055
|
L: 151,
|
|
4033
4056
|
S: this,
|
|
@@ -4045,7 +4068,7 @@ var NotarizationPlugin = class {
|
|
|
4045
4068
|
allNotarized,
|
|
4046
4069
|
errors.wait()
|
|
4047
4070
|
]);
|
|
4048
|
-
(0,
|
|
4071
|
+
(0, import_log14.log)("done", void 0, {
|
|
4049
4072
|
F: __dxlog_file15,
|
|
4050
4073
|
L: 162,
|
|
4051
4074
|
S: this,
|
|
@@ -4082,7 +4105,7 @@ var NotarizationPlugin = class {
|
|
|
4082
4105
|
if (this._processedCredentials.has(id)) {
|
|
4083
4106
|
return;
|
|
4084
4107
|
}
|
|
4085
|
-
await (0,
|
|
4108
|
+
await (0, import_util9.entry)(this._processCredentialsTriggers, id).orInsert(new import_async16.Trigger()).value.wait();
|
|
4086
4109
|
}
|
|
4087
4110
|
/**
|
|
4088
4111
|
* Requests from other peers to notarize credentials.
|
|
@@ -4110,7 +4133,7 @@ var NotarizationPlugin = class {
|
|
|
4110
4133
|
createExtension() {
|
|
4111
4134
|
const extension = new NotarizationTeleportExtension({
|
|
4112
4135
|
onOpen: async () => {
|
|
4113
|
-
(0,
|
|
4136
|
+
(0, import_log14.log)("extension opened", {
|
|
4114
4137
|
peer: extension.localPeerId
|
|
4115
4138
|
}, {
|
|
4116
4139
|
F: __dxlog_file15,
|
|
@@ -4122,7 +4145,7 @@ var NotarizationPlugin = class {
|
|
|
4122
4145
|
this._extensionOpened.emit();
|
|
4123
4146
|
},
|
|
4124
4147
|
onClose: async () => {
|
|
4125
|
-
(0,
|
|
4148
|
+
(0, import_log14.log)("extension closed", {
|
|
4126
4149
|
peer: extension.localPeerId
|
|
4127
4150
|
}, {
|
|
4128
4151
|
F: __dxlog_file15,
|
|
@@ -4247,11 +4270,11 @@ var DataSpace = class {
|
|
|
4247
4270
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
4248
4271
|
this._cache = void 0;
|
|
4249
4272
|
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
4250
|
-
this._epochProcessingMutex = new
|
|
4273
|
+
this._epochProcessingMutex = new import_async13.Mutex();
|
|
4251
4274
|
this._state = import_services12.SpaceState.CLOSED;
|
|
4252
4275
|
this._databaseRoot = null;
|
|
4253
4276
|
this.error = void 0;
|
|
4254
|
-
this.stateUpdate = new
|
|
4277
|
+
this.stateUpdate = new import_async13.Event();
|
|
4255
4278
|
this.metrics = {};
|
|
4256
4279
|
this._inner = params.inner;
|
|
4257
4280
|
this._inner.stateUpdate.on(this._ctx, () => this.stateUpdate.emit());
|
|
@@ -4264,13 +4287,13 @@ var DataSpace = class {
|
|
|
4264
4287
|
this._callbacks = params.callbacks ?? {};
|
|
4265
4288
|
this._echoHost = params.echoHost;
|
|
4266
4289
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
4267
|
-
trustedKeysProvider: () => new
|
|
4290
|
+
trustedKeysProvider: () => new import_util7.ComplexSet(import_keys10.PublicKey.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => member.role !== import_credentials13.SpaceMember.Role.REMOVED).map((member) => member.key)),
|
|
4268
4291
|
update: this._inner.stateUpdate,
|
|
4269
4292
|
authTimeout: import_client_protocol4.AUTH_TIMEOUT
|
|
4270
4293
|
});
|
|
4271
4294
|
this._cache = params.cache;
|
|
4272
4295
|
this._state = params.initialState;
|
|
4273
|
-
(0,
|
|
4296
|
+
(0, import_log12.log)("new state", {
|
|
4274
4297
|
state: import_services12.SpaceState[this._state]
|
|
4275
4298
|
}, {
|
|
4276
4299
|
F: __dxlog_file16,
|
|
@@ -4330,7 +4353,7 @@ var DataSpace = class {
|
|
|
4330
4353
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
4331
4354
|
await this._inner.open(new import_context10.Context());
|
|
4332
4355
|
this._state = import_services12.SpaceState.CONTROL_ONLY;
|
|
4333
|
-
(0,
|
|
4356
|
+
(0, import_log12.log)("new state", {
|
|
4334
4357
|
state: import_services12.SpaceState[this._state]
|
|
4335
4358
|
}, {
|
|
4336
4359
|
F: __dxlog_file16,
|
|
@@ -4348,7 +4371,7 @@ var DataSpace = class {
|
|
|
4348
4371
|
async _close() {
|
|
4349
4372
|
await this._callbacks.beforeClose?.();
|
|
4350
4373
|
this._state = import_services12.SpaceState.CLOSED;
|
|
4351
|
-
(0,
|
|
4374
|
+
(0, import_log12.log)("new state", {
|
|
4352
4375
|
state: import_services12.SpaceState[this._state]
|
|
4353
4376
|
}, {
|
|
4354
4377
|
F: __dxlog_file16,
|
|
@@ -4377,13 +4400,13 @@ var DataSpace = class {
|
|
|
4377
4400
|
* Initialize the data pipeline in a separate task.
|
|
4378
4401
|
*/
|
|
4379
4402
|
initializeDataPipelineAsync() {
|
|
4380
|
-
(0,
|
|
4403
|
+
(0, import_async13.scheduleTask)(this._ctx, async () => {
|
|
4381
4404
|
try {
|
|
4382
4405
|
this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
|
|
4383
4406
|
await this.initializeDataPipeline();
|
|
4384
4407
|
} catch (err) {
|
|
4385
4408
|
if (err instanceof import_protocols9.CancelledError || err instanceof import_context10.ContextDisposedError) {
|
|
4386
|
-
(0,
|
|
4409
|
+
(0, import_log12.log)("data pipeline initialization cancelled", err, {
|
|
4387
4410
|
F: __dxlog_file16,
|
|
4388
4411
|
L: 265,
|
|
4389
4412
|
S: this,
|
|
@@ -4391,14 +4414,14 @@ var DataSpace = class {
|
|
|
4391
4414
|
});
|
|
4392
4415
|
return;
|
|
4393
4416
|
}
|
|
4394
|
-
|
|
4417
|
+
import_log12.log.error("Error initializing data pipeline", err, {
|
|
4395
4418
|
F: __dxlog_file16,
|
|
4396
4419
|
L: 269,
|
|
4397
4420
|
S: this,
|
|
4398
4421
|
C: (f, a) => f(...a)
|
|
4399
4422
|
});
|
|
4400
4423
|
this._state = import_services12.SpaceState.ERROR;
|
|
4401
|
-
(0,
|
|
4424
|
+
(0, import_log12.log)("new state", {
|
|
4402
4425
|
state: import_services12.SpaceState[this._state]
|
|
4403
4426
|
}, {
|
|
4404
4427
|
F: __dxlog_file16,
|
|
@@ -4418,7 +4441,7 @@ var DataSpace = class {
|
|
|
4418
4441
|
throw new import_protocols9.SystemError("Invalid operation");
|
|
4419
4442
|
}
|
|
4420
4443
|
this._state = import_services12.SpaceState.INITIALIZING;
|
|
4421
|
-
(0,
|
|
4444
|
+
(0, import_log12.log)("new state", {
|
|
4422
4445
|
state: import_services12.SpaceState[this._state]
|
|
4423
4446
|
}, {
|
|
4424
4447
|
F: __dxlog_file16,
|
|
@@ -4427,7 +4450,7 @@ var DataSpace = class {
|
|
|
4427
4450
|
C: (f, a) => f(...a)
|
|
4428
4451
|
});
|
|
4429
4452
|
await this._initializeAndReadControlPipeline();
|
|
4430
|
-
await (0,
|
|
4453
|
+
await (0, import_async13.sleep)(1);
|
|
4431
4454
|
const ready = this.stateUpdate.waitForCondition(() => this._state === import_services12.SpaceState.READY);
|
|
4432
4455
|
this._automergeSpaceState.startProcessingRootDocs();
|
|
4433
4456
|
await ready;
|
|
@@ -4435,7 +4458,7 @@ var DataSpace = class {
|
|
|
4435
4458
|
async _enterReadyState() {
|
|
4436
4459
|
await this._callbacks.beforeReady?.();
|
|
4437
4460
|
this._state = import_services12.SpaceState.READY;
|
|
4438
|
-
(0,
|
|
4461
|
+
(0, import_log12.log)("new state", {
|
|
4439
4462
|
state: import_services12.SpaceState[this._state]
|
|
4440
4463
|
}, {
|
|
4441
4464
|
F: __dxlog_file16,
|
|
@@ -4453,7 +4476,7 @@ var DataSpace = class {
|
|
|
4453
4476
|
});
|
|
4454
4477
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
4455
4478
|
await this._createWritableFeeds();
|
|
4456
|
-
(0,
|
|
4479
|
+
(0, import_log12.log)("writable feeds created", void 0, {
|
|
4457
4480
|
F: __dxlog_file16,
|
|
4458
4481
|
L: 322,
|
|
4459
4482
|
S: this,
|
|
@@ -4513,7 +4536,7 @@ var DataSpace = class {
|
|
|
4513
4536
|
}
|
|
4514
4537
|
}
|
|
4515
4538
|
_onNewAutomergeRoot(rootUrl) {
|
|
4516
|
-
(0,
|
|
4539
|
+
(0, import_log12.log)("loading automerge root doc for space", {
|
|
4517
4540
|
space: this.key,
|
|
4518
4541
|
rootUrl
|
|
4519
4542
|
}, {
|
|
@@ -4565,7 +4588,7 @@ var DataSpace = class {
|
|
|
4565
4588
|
if (err instanceof import_context10.ContextDisposedError) {
|
|
4566
4589
|
return;
|
|
4567
4590
|
}
|
|
4568
|
-
|
|
4591
|
+
import_log12.log.warn("error loading automerge root doc", {
|
|
4569
4592
|
space: this.key,
|
|
4570
4593
|
rootUrl,
|
|
4571
4594
|
err
|
|
@@ -4653,7 +4676,7 @@ var DataSpace = class {
|
|
|
4653
4676
|
await this._close();
|
|
4654
4677
|
}
|
|
4655
4678
|
this._state = import_services12.SpaceState.INACTIVE;
|
|
4656
|
-
(0,
|
|
4679
|
+
(0, import_log12.log)("new state", {
|
|
4657
4680
|
state: import_services12.SpaceState[this._state]
|
|
4658
4681
|
}, {
|
|
4659
4682
|
F: __dxlog_file16,
|
|
@@ -4684,10 +4707,10 @@ _ts_decorate4([
|
|
|
4684
4707
|
})
|
|
4685
4708
|
], DataSpace.prototype, "_automergeInfo", null);
|
|
4686
4709
|
_ts_decorate4([
|
|
4687
|
-
|
|
4710
|
+
import_async13.synchronized
|
|
4688
4711
|
], DataSpace.prototype, "open", null);
|
|
4689
4712
|
_ts_decorate4([
|
|
4690
|
-
|
|
4713
|
+
import_async13.synchronized
|
|
4691
4714
|
], DataSpace.prototype, "close", null);
|
|
4692
4715
|
_ts_decorate4([
|
|
4693
4716
|
import_tracing5.trace.span({
|
|
@@ -4703,13 +4726,13 @@ _ts_decorate4([
|
|
|
4703
4726
|
(0, import_debug3.timed)(1e4)
|
|
4704
4727
|
], DataSpace.prototype, "_createWritableFeeds", null);
|
|
4705
4728
|
_ts_decorate4([
|
|
4706
|
-
|
|
4729
|
+
import_async13.synchronized
|
|
4707
4730
|
], DataSpace.prototype, "activate", null);
|
|
4708
4731
|
_ts_decorate4([
|
|
4709
|
-
|
|
4732
|
+
import_async13.synchronized
|
|
4710
4733
|
], DataSpace.prototype, "deactivate", null);
|
|
4711
4734
|
DataSpace = _ts_decorate4([
|
|
4712
|
-
(0,
|
|
4735
|
+
(0, import_async13.trackLeaks)("open", "close"),
|
|
4713
4736
|
import_tracing5.trace.resource()
|
|
4714
4737
|
], DataSpace);
|
|
4715
4738
|
var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
@@ -4801,8 +4824,8 @@ var DataSpaceManager = class {
|
|
|
4801
4824
|
this._invitationsManager = _invitationsManager;
|
|
4802
4825
|
this._params = _params;
|
|
4803
4826
|
this._ctx = new import_context14.Context();
|
|
4804
|
-
this.updated = new
|
|
4805
|
-
this._spaces = new
|
|
4827
|
+
this.updated = new import_async17.Event();
|
|
4828
|
+
this._spaces = new import_util10.ComplexMap(import_keys12.PublicKey.hash);
|
|
4806
4829
|
this._isOpen = false;
|
|
4807
4830
|
this._instanceId = import_keys12.PublicKey.random().toHex();
|
|
4808
4831
|
import_tracing6.trace.diagnostic({
|
|
@@ -4833,13 +4856,13 @@ var DataSpaceManager = class {
|
|
|
4833
4856
|
return this._spaces;
|
|
4834
4857
|
}
|
|
4835
4858
|
async open() {
|
|
4836
|
-
(0,
|
|
4859
|
+
(0, import_log15.log)("open", void 0, {
|
|
4837
4860
|
F: __dxlog_file17,
|
|
4838
4861
|
L: 146,
|
|
4839
4862
|
S: this,
|
|
4840
4863
|
C: (f, a) => f(...a)
|
|
4841
4864
|
});
|
|
4842
|
-
|
|
4865
|
+
import_log15.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.begin({
|
|
4843
4866
|
id: this._instanceId
|
|
4844
4867
|
}), {
|
|
4845
4868
|
F: __dxlog_file17,
|
|
@@ -4847,7 +4870,7 @@ var DataSpaceManager = class {
|
|
|
4847
4870
|
S: this,
|
|
4848
4871
|
C: (f, a) => f(...a)
|
|
4849
4872
|
});
|
|
4850
|
-
(0,
|
|
4873
|
+
(0, import_log15.log)("metadata loaded", {
|
|
4851
4874
|
spaces: this._metadataStore.spaces.length
|
|
4852
4875
|
}, {
|
|
4853
4876
|
F: __dxlog_file17,
|
|
@@ -4855,9 +4878,9 @@ var DataSpaceManager = class {
|
|
|
4855
4878
|
S: this,
|
|
4856
4879
|
C: (f, a) => f(...a)
|
|
4857
4880
|
});
|
|
4858
|
-
await (0,
|
|
4881
|
+
await (0, import_util10.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
|
|
4859
4882
|
try {
|
|
4860
|
-
(0,
|
|
4883
|
+
(0, import_log15.log)("load space", {
|
|
4861
4884
|
spaceMetadata
|
|
4862
4885
|
}, {
|
|
4863
4886
|
F: __dxlog_file17,
|
|
@@ -4867,7 +4890,7 @@ var DataSpaceManager = class {
|
|
|
4867
4890
|
});
|
|
4868
4891
|
await this._constructSpace(spaceMetadata);
|
|
4869
4892
|
} catch (err) {
|
|
4870
|
-
|
|
4893
|
+
import_log15.log.error("Error loading space", {
|
|
4871
4894
|
spaceMetadata,
|
|
4872
4895
|
err
|
|
4873
4896
|
}, {
|
|
@@ -4880,7 +4903,7 @@ var DataSpaceManager = class {
|
|
|
4880
4903
|
});
|
|
4881
4904
|
this._isOpen = true;
|
|
4882
4905
|
this.updated.emit();
|
|
4883
|
-
|
|
4906
|
+
import_log15.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.end({
|
|
4884
4907
|
id: this._instanceId
|
|
4885
4908
|
}), {
|
|
4886
4909
|
F: __dxlog_file17,
|
|
@@ -4890,7 +4913,7 @@ var DataSpaceManager = class {
|
|
|
4890
4913
|
});
|
|
4891
4914
|
}
|
|
4892
4915
|
async close() {
|
|
4893
|
-
(0,
|
|
4916
|
+
(0, import_log15.log)("close", void 0, {
|
|
4894
4917
|
F: __dxlog_file17,
|
|
4895
4918
|
L: 167,
|
|
4896
4919
|
S: this,
|
|
@@ -4926,7 +4949,7 @@ var DataSpaceManager = class {
|
|
|
4926
4949
|
dataFeedKey,
|
|
4927
4950
|
state: import_services14.SpaceState.ACTIVE
|
|
4928
4951
|
};
|
|
4929
|
-
(0,
|
|
4952
|
+
(0, import_log15.log)("creating space...", {
|
|
4930
4953
|
spaceKey
|
|
4931
4954
|
}, {
|
|
4932
4955
|
F: __dxlog_file17,
|
|
@@ -4969,7 +4992,7 @@ var DataSpaceManager = class {
|
|
|
4969
4992
|
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
4970
4993
|
}
|
|
4971
4994
|
default:
|
|
4972
|
-
|
|
4995
|
+
import_log15.log.warn("unknown space version", {
|
|
4973
4996
|
version: space.databaseRoot.getVersion(),
|
|
4974
4997
|
spaceId: space.id
|
|
4975
4998
|
}, {
|
|
@@ -4997,7 +5020,7 @@ var DataSpaceManager = class {
|
|
|
4997
5020
|
};
|
|
4998
5021
|
const propertiesId = (0, import_echo_schema2.generateEchoId)();
|
|
4999
5022
|
document.change((doc) => {
|
|
5000
|
-
(0,
|
|
5023
|
+
(0, import_util10.assignDeep)(doc, [
|
|
5001
5024
|
"objects",
|
|
5002
5025
|
propertiesId
|
|
5003
5026
|
], properties);
|
|
@@ -5022,7 +5045,7 @@ var DataSpaceManager = class {
|
|
|
5022
5045
|
}
|
|
5023
5046
|
// TODO(burdon): Rename join space.
|
|
5024
5047
|
async acceptSpace(opts) {
|
|
5025
|
-
(0,
|
|
5048
|
+
(0, import_log15.log)("accept space", {
|
|
5026
5049
|
opts
|
|
5027
5050
|
}, {
|
|
5028
5051
|
F: __dxlog_file17,
|
|
@@ -5073,7 +5096,7 @@ var DataSpaceManager = class {
|
|
|
5073
5096
|
}));
|
|
5074
5097
|
}
|
|
5075
5098
|
async _constructSpace(metadata) {
|
|
5076
|
-
(0,
|
|
5099
|
+
(0, import_log15.log)("construct space", {
|
|
5077
5100
|
metadata
|
|
5078
5101
|
}, {
|
|
5079
5102
|
F: __dxlog_file17,
|
|
@@ -5102,7 +5125,7 @@ var DataSpaceManager = class {
|
|
|
5102
5125
|
swarmIdentity: {
|
|
5103
5126
|
peerKey: this._signingContext.deviceKey,
|
|
5104
5127
|
credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
|
|
5105
|
-
credentialAuthenticator: (0,
|
|
5128
|
+
credentialAuthenticator: (0, import_util10.deferFunction)(() => dataSpace.authVerifier.verifier)
|
|
5106
5129
|
},
|
|
5107
5130
|
onAuthorizedConnection: (session) => {
|
|
5108
5131
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
@@ -5113,7 +5136,7 @@ var DataSpaceManager = class {
|
|
|
5113
5136
|
session.addExtension("dxos.mesh.teleport.automerge", this._echoHost.createReplicationExtension());
|
|
5114
5137
|
},
|
|
5115
5138
|
onAuthFailure: () => {
|
|
5116
|
-
|
|
5139
|
+
import_log15.log.warn("auth failure", void 0, {
|
|
5117
5140
|
F: __dxlog_file17,
|
|
5118
5141
|
L: 343,
|
|
5119
5142
|
S: this,
|
|
@@ -5144,7 +5167,7 @@ var DataSpaceManager = class {
|
|
|
5144
5167
|
signingContext: this._signingContext,
|
|
5145
5168
|
callbacks: {
|
|
5146
5169
|
beforeReady: async () => {
|
|
5147
|
-
(0,
|
|
5170
|
+
(0, import_log15.log)("before space ready", {
|
|
5148
5171
|
space: space.key
|
|
5149
5172
|
}, {
|
|
5150
5173
|
F: __dxlog_file17,
|
|
@@ -5154,7 +5177,7 @@ var DataSpaceManager = class {
|
|
|
5154
5177
|
});
|
|
5155
5178
|
},
|
|
5156
5179
|
afterReady: async () => {
|
|
5157
|
-
(0,
|
|
5180
|
+
(0, import_log15.log)("after space ready", {
|
|
5158
5181
|
space: space.key,
|
|
5159
5182
|
open: this._isOpen
|
|
5160
5183
|
}, {
|
|
@@ -5174,7 +5197,7 @@ var DataSpaceManager = class {
|
|
|
5174
5197
|
}
|
|
5175
5198
|
},
|
|
5176
5199
|
beforeClose: async () => {
|
|
5177
|
-
(0,
|
|
5200
|
+
(0, import_log15.log)("before space close", {
|
|
5178
5201
|
space: space.key
|
|
5179
5202
|
}, {
|
|
5180
5203
|
F: __dxlog_file17,
|
|
@@ -5209,11 +5232,11 @@ var DataSpaceManager = class {
|
|
|
5209
5232
|
return (s && member.role === import_credentials16.SpaceMember.Role.REMOVED !== (s.authStatus === import_echo_pipeline4.AuthStatus.FAILURE)) ?? false;
|
|
5210
5233
|
});
|
|
5211
5234
|
sessionsToClose.forEach((session) => {
|
|
5212
|
-
void session.close().catch(
|
|
5235
|
+
void session.close().catch(import_log15.log.error);
|
|
5213
5236
|
});
|
|
5214
5237
|
closedSessions += sessionsToClose.length;
|
|
5215
5238
|
}
|
|
5216
|
-
(0,
|
|
5239
|
+
(0, import_log15.log)("processed member role changes", {
|
|
5217
5240
|
roleChangeCount: memberInfo.length,
|
|
5218
5241
|
peersOnline: presence.getPeersOnline().length,
|
|
5219
5242
|
closedSessions
|
|
@@ -5230,7 +5253,7 @@ var DataSpaceManager = class {
|
|
|
5230
5253
|
if (role === import_credentials16.SpaceMember.Role.REMOVED) {
|
|
5231
5254
|
const session = peerState.peerId && space.protocol.sessions.get(peerState.peerId);
|
|
5232
5255
|
if (session != null) {
|
|
5233
|
-
(0,
|
|
5256
|
+
(0, import_log15.log)("closing a session with a removed peer", {
|
|
5234
5257
|
peerId: peerState.peerId
|
|
5235
5258
|
}, {
|
|
5236
5259
|
F: __dxlog_file17,
|
|
@@ -5238,7 +5261,7 @@ var DataSpaceManager = class {
|
|
|
5238
5261
|
S: this,
|
|
5239
5262
|
C: (f, a) => f(...a)
|
|
5240
5263
|
});
|
|
5241
|
-
void session.close().catch(
|
|
5264
|
+
void session.close().catch(import_log15.log.error);
|
|
5242
5265
|
}
|
|
5243
5266
|
}
|
|
5244
5267
|
}
|
|
@@ -5279,19 +5302,19 @@ var DataSpaceManager = class {
|
|
|
5279
5302
|
}
|
|
5280
5303
|
};
|
|
5281
5304
|
_ts_decorate5([
|
|
5282
|
-
|
|
5305
|
+
import_async17.synchronized
|
|
5283
5306
|
], DataSpaceManager.prototype, "open", null);
|
|
5284
5307
|
_ts_decorate5([
|
|
5285
|
-
|
|
5308
|
+
import_async17.synchronized
|
|
5286
5309
|
], DataSpaceManager.prototype, "close", null);
|
|
5287
5310
|
_ts_decorate5([
|
|
5288
|
-
|
|
5311
|
+
import_async17.synchronized
|
|
5289
5312
|
], DataSpaceManager.prototype, "createSpace", null);
|
|
5290
5313
|
_ts_decorate5([
|
|
5291
|
-
|
|
5314
|
+
import_async17.synchronized
|
|
5292
5315
|
], DataSpaceManager.prototype, "acceptSpace", null);
|
|
5293
5316
|
DataSpaceManager = _ts_decorate5([
|
|
5294
|
-
(0,
|
|
5317
|
+
(0, import_async17.trackLeaks)("open", "close")
|
|
5295
5318
|
], DataSpaceManager);
|
|
5296
5319
|
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
5297
5320
|
var SpacesServiceImpl = class {
|
|
@@ -5359,10 +5382,10 @@ var SpacesServiceImpl = class {
|
|
|
5359
5382
|
}
|
|
5360
5383
|
querySpaces() {
|
|
5361
5384
|
return new import_codec_protobuf11.Stream(({ next, ctx }) => {
|
|
5362
|
-
const scheduler = new
|
|
5385
|
+
const scheduler = new import_async18.UpdateScheduler(ctx, async () => {
|
|
5363
5386
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5364
5387
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
5365
|
-
(0,
|
|
5388
|
+
(0, import_log16.log)("update", {
|
|
5366
5389
|
spaces
|
|
5367
5390
|
}, {
|
|
5368
5391
|
F: __dxlog_file18,
|
|
@@ -5377,9 +5400,9 @@ var SpacesServiceImpl = class {
|
|
|
5377
5400
|
}, {
|
|
5378
5401
|
maxFrequency: process.env.NODE_ENV === "test" ? void 0 : 2
|
|
5379
5402
|
});
|
|
5380
|
-
(0,
|
|
5403
|
+
(0, import_async18.scheduleTask)(ctx, async () => {
|
|
5381
5404
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5382
|
-
const subscriptions = new
|
|
5405
|
+
const subscriptions = new import_async18.EventSubscriptions();
|
|
5383
5406
|
ctx.onDispose(() => subscriptions.clear());
|
|
5384
5407
|
const subscribeSpaces = () => {
|
|
5385
5408
|
subscriptions.clear();
|
|
@@ -5411,7 +5434,7 @@ var SpacesServiceImpl = class {
|
|
|
5411
5434
|
}
|
|
5412
5435
|
subscribeMessages({ spaceKey, channel }) {
|
|
5413
5436
|
return new import_codec_protobuf11.Stream(({ ctx, next }) => {
|
|
5414
|
-
(0,
|
|
5437
|
+
(0, import_async18.scheduleTask)(ctx, async () => {
|
|
5415
5438
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5416
5439
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols12.SpaceNotFoundError(spaceKey));
|
|
5417
5440
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
@@ -5430,7 +5453,7 @@ var SpacesServiceImpl = class {
|
|
|
5430
5453
|
}
|
|
5431
5454
|
};
|
|
5432
5455
|
ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
|
|
5433
|
-
(0,
|
|
5456
|
+
(0, import_async18.scheduleTask)(ctx, async () => {
|
|
5434
5457
|
await space.spaceState.addCredentialProcessor(processor);
|
|
5435
5458
|
if (noTail) {
|
|
5436
5459
|
close();
|
|
@@ -5577,7 +5600,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5577
5600
|
this.networkManager = networkManager;
|
|
5578
5601
|
this.signalManager = signalManager;
|
|
5579
5602
|
this._runtimeParams = _runtimeParams;
|
|
5580
|
-
this.initialized = new
|
|
5603
|
+
this.initialized = new import_async19.Trigger();
|
|
5581
5604
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
5582
5605
|
this._instanceId = import_keys13.PublicKey.random().toHex();
|
|
5583
5606
|
this.metadataStore = new import_echo_pipeline5.MetadataStore(storage.createDirectory("metadata"));
|
|
@@ -5611,13 +5634,13 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5611
5634
|
}
|
|
5612
5635
|
async _open(ctx) {
|
|
5613
5636
|
await this._checkStorageVersion();
|
|
5614
|
-
(0,
|
|
5637
|
+
(0, import_log17.log)("opening...", void 0, {
|
|
5615
5638
|
F: __dxlog_file19,
|
|
5616
5639
|
L: 149,
|
|
5617
5640
|
S: this,
|
|
5618
5641
|
C: (f, a) => f(...a)
|
|
5619
5642
|
});
|
|
5620
|
-
|
|
5643
|
+
import_log17.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.begin({
|
|
5621
5644
|
id: this._instanceId
|
|
5622
5645
|
}), {
|
|
5623
5646
|
F: __dxlog_file19,
|
|
@@ -5635,7 +5658,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5635
5658
|
await this._initialize(ctx);
|
|
5636
5659
|
}
|
|
5637
5660
|
const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
|
|
5638
|
-
(0,
|
|
5661
|
+
(0, import_log17.log)("loaded persistent invitations", {
|
|
5639
5662
|
count: loadedInvitations.invitations?.length
|
|
5640
5663
|
}, {
|
|
5641
5664
|
F: __dxlog_file19,
|
|
@@ -5643,7 +5666,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5643
5666
|
S: this,
|
|
5644
5667
|
C: (f, a) => f(...a)
|
|
5645
5668
|
});
|
|
5646
|
-
|
|
5669
|
+
import_log17.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.end({
|
|
5647
5670
|
id: this._instanceId
|
|
5648
5671
|
}), {
|
|
5649
5672
|
F: __dxlog_file19,
|
|
@@ -5651,7 +5674,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5651
5674
|
S: this,
|
|
5652
5675
|
C: (f, a) => f(...a)
|
|
5653
5676
|
});
|
|
5654
|
-
(0,
|
|
5677
|
+
(0, import_log17.log)("opened", void 0, {
|
|
5655
5678
|
F: __dxlog_file19,
|
|
5656
5679
|
L: 166,
|
|
5657
5680
|
S: this,
|
|
@@ -5659,7 +5682,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5659
5682
|
});
|
|
5660
5683
|
}
|
|
5661
5684
|
async _close(ctx) {
|
|
5662
|
-
(0,
|
|
5685
|
+
(0, import_log17.log)("closing...", void 0, {
|
|
5663
5686
|
F: __dxlog_file19,
|
|
5664
5687
|
L: 170,
|
|
5665
5688
|
S: this,
|
|
@@ -5676,7 +5699,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5676
5699
|
await this.echoHost.close(ctx);
|
|
5677
5700
|
await this.networkManager.close();
|
|
5678
5701
|
await this.signalManager.close();
|
|
5679
|
-
(0,
|
|
5702
|
+
(0, import_log17.log)("closed", void 0, {
|
|
5680
5703
|
F: __dxlog_file19,
|
|
5681
5704
|
L: 182,
|
|
5682
5705
|
S: this,
|
|
@@ -5722,7 +5745,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5722
5745
|
}
|
|
5723
5746
|
// Called when identity is created.
|
|
5724
5747
|
async _initialize(ctx) {
|
|
5725
|
-
(0,
|
|
5748
|
+
(0, import_log17.log)("initializing spaces...", void 0, {
|
|
5726
5749
|
F: __dxlog_file19,
|
|
5727
5750
|
L: 224,
|
|
5728
5751
|
S: this,
|
|
@@ -5767,7 +5790,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5767
5790
|
return;
|
|
5768
5791
|
}
|
|
5769
5792
|
if (!this.dataSpaceManager) {
|
|
5770
|
-
(0,
|
|
5793
|
+
(0, import_log17.log)("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
5771
5794
|
details: assertion
|
|
5772
5795
|
}, {
|
|
5773
5796
|
F: __dxlog_file19,
|
|
@@ -5778,7 +5801,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5778
5801
|
return;
|
|
5779
5802
|
}
|
|
5780
5803
|
if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
|
|
5781
|
-
(0,
|
|
5804
|
+
(0, import_log17.log)("space already exists, ignoring space admission", {
|
|
5782
5805
|
details: assertion
|
|
5783
5806
|
}, {
|
|
5784
5807
|
F: __dxlog_file19,
|
|
@@ -5789,7 +5812,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5789
5812
|
return;
|
|
5790
5813
|
}
|
|
5791
5814
|
try {
|
|
5792
|
-
(0,
|
|
5815
|
+
(0, import_log17.log)("accepting space recorded in halo", {
|
|
5793
5816
|
details: assertion
|
|
5794
5817
|
}, {
|
|
5795
5818
|
F: __dxlog_file19,
|
|
@@ -5802,7 +5825,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5802
5825
|
genesisFeedKey: assertion.genesisFeedKey
|
|
5803
5826
|
});
|
|
5804
5827
|
} catch (err) {
|
|
5805
|
-
|
|
5828
|
+
import_log17.log.catch(err, void 0, {
|
|
5806
5829
|
F: __dxlog_file19,
|
|
5807
5830
|
L: 280,
|
|
5808
5831
|
S: this,
|
|
@@ -5821,7 +5844,7 @@ _ts_decorate6([
|
|
|
5821
5844
|
import_tracing8.trace.span()
|
|
5822
5845
|
], ServiceContext.prototype, "_initialize", null);
|
|
5823
5846
|
ServiceContext = _ts_decorate6([
|
|
5824
|
-
(0,
|
|
5847
|
+
(0, import_util11.safeInstanceof)("dxos.client-services.ServiceContext"),
|
|
5825
5848
|
import_tracing8.trace.resource()
|
|
5826
5849
|
], ServiceContext);
|
|
5827
5850
|
var ServiceRegistry = class {
|
|
@@ -5867,7 +5890,7 @@ var Lock = class {
|
|
|
5867
5890
|
return this._lockPath;
|
|
5868
5891
|
}
|
|
5869
5892
|
async acquire() {
|
|
5870
|
-
(0,
|
|
5893
|
+
(0, import_log18.log)("acquiring lock...", void 0, {
|
|
5871
5894
|
F: __dxlog_file20,
|
|
5872
5895
|
L: 32,
|
|
5873
5896
|
S: this,
|
|
@@ -5875,7 +5898,7 @@ var Lock = class {
|
|
|
5875
5898
|
});
|
|
5876
5899
|
this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
|
|
5877
5900
|
await this._onAcquire?.();
|
|
5878
|
-
(0,
|
|
5901
|
+
(0, import_log18.log)("acquired lock", void 0, {
|
|
5879
5902
|
F: __dxlog_file20,
|
|
5880
5903
|
L: 37,
|
|
5881
5904
|
S: this,
|
|
@@ -5897,11 +5920,11 @@ var Lock = class {
|
|
|
5897
5920
|
}
|
|
5898
5921
|
};
|
|
5899
5922
|
_ts_decorate7([
|
|
5900
|
-
|
|
5923
|
+
import_log18.logInfo
|
|
5901
5924
|
], Lock.prototype, "lockKey", null);
|
|
5902
5925
|
var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
|
|
5903
5926
|
var getRootPath = (config) => {
|
|
5904
|
-
const { dataRoot = (0,
|
|
5927
|
+
const { dataRoot = (0, import_util12.isNode)() ? import_client_protocol6.DX_DATA : "dxos/storage" } = config ?? {};
|
|
5905
5928
|
return `${dataRoot}/`;
|
|
5906
5929
|
};
|
|
5907
5930
|
var isPersistent = (config) => {
|
|
@@ -6016,7 +6039,7 @@ var DevicesServiceImpl = class {
|
|
|
6016
6039
|
presenceSubscribed = true;
|
|
6017
6040
|
}
|
|
6018
6041
|
};
|
|
6019
|
-
const subscriptions = new
|
|
6042
|
+
const subscriptions = new import_async21.EventSubscriptions();
|
|
6020
6043
|
if (this._identityManager.identity) {
|
|
6021
6044
|
subscribeIdentity();
|
|
6022
6045
|
subscribePresence();
|
|
@@ -6056,7 +6079,7 @@ var DiagnosticsCollector = class {
|
|
|
6056
6079
|
client: clientDiagnostics,
|
|
6057
6080
|
broadcast: await this.broadcastSender.broadcastDiagnosticsRequest()
|
|
6058
6081
|
};
|
|
6059
|
-
return JSON.parse(JSON.stringify(diagnostics, (0,
|
|
6082
|
+
return JSON.parse(JSON.stringify(diagnostics, (0, import_util13.jsonKeyReplacer)(options)));
|
|
6060
6083
|
}
|
|
6061
6084
|
};
|
|
6062
6085
|
var findSystemServiceProvider = () => {
|
|
@@ -6066,11 +6089,11 @@ var findSystemServiceProvider = () => {
|
|
|
6066
6089
|
};
|
|
6067
6090
|
var findConfigs = () => {
|
|
6068
6091
|
const configs = import_tracing10.TRACE_PROCESSOR.findResourcesByAnnotation(import_config3.ConfigResource);
|
|
6069
|
-
return configs.map((r) => r.instance.deref()).filter(
|
|
6092
|
+
return configs.map((r) => r.instance.deref()).filter(import_util13.nonNullable);
|
|
6070
6093
|
};
|
|
6071
6094
|
var LoggingServiceImpl = class {
|
|
6072
6095
|
constructor() {
|
|
6073
|
-
this._logs = new
|
|
6096
|
+
this._logs = new import_async22.Event();
|
|
6074
6097
|
this._started = Date.now();
|
|
6075
6098
|
this._sessionId = import_keys17.PublicKey.random().toHex();
|
|
6076
6099
|
this._logProcessor = (_config, entry2) => {
|
|
@@ -6078,23 +6101,23 @@ var LoggingServiceImpl = class {
|
|
|
6078
6101
|
};
|
|
6079
6102
|
}
|
|
6080
6103
|
async open() {
|
|
6081
|
-
|
|
6104
|
+
import_log20.log.runtimeConfig.processors.push(this._logProcessor);
|
|
6082
6105
|
}
|
|
6083
6106
|
async close() {
|
|
6084
|
-
const index =
|
|
6085
|
-
|
|
6107
|
+
const index = import_log20.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
6108
|
+
import_log20.log.runtimeConfig.processors.splice(index, 1);
|
|
6086
6109
|
}
|
|
6087
6110
|
async controlMetrics({ reset, record }) {
|
|
6088
6111
|
if (reset) {
|
|
6089
|
-
|
|
6112
|
+
import_util15.tracer.clear();
|
|
6090
6113
|
}
|
|
6091
6114
|
if (record === true) {
|
|
6092
|
-
|
|
6115
|
+
import_util15.tracer.start();
|
|
6093
6116
|
} else if (record === false) {
|
|
6094
|
-
|
|
6117
|
+
import_util15.tracer.stop();
|
|
6095
6118
|
}
|
|
6096
6119
|
return {
|
|
6097
|
-
recording:
|
|
6120
|
+
recording: import_util15.tracer.recording
|
|
6098
6121
|
};
|
|
6099
6122
|
}
|
|
6100
6123
|
/**
|
|
@@ -6102,10 +6125,10 @@ var LoggingServiceImpl = class {
|
|
|
6102
6125
|
*/
|
|
6103
6126
|
queryMetrics({ interval = 5e3 }) {
|
|
6104
6127
|
const getNumericalValues = (key) => {
|
|
6105
|
-
const events =
|
|
6128
|
+
const events = import_util15.tracer.get(key) ?? [];
|
|
6106
6129
|
return {
|
|
6107
6130
|
key,
|
|
6108
|
-
stats: (0,
|
|
6131
|
+
stats: (0, import_util15.numericalValues)(events, "duration")
|
|
6109
6132
|
};
|
|
6110
6133
|
};
|
|
6111
6134
|
return new import_codec_protobuf13.Stream(({ next }) => {
|
|
@@ -6143,7 +6166,7 @@ var LoggingServiceImpl = class {
|
|
|
6143
6166
|
}
|
|
6144
6167
|
const record = {
|
|
6145
6168
|
...entry2,
|
|
6146
|
-
context: (0,
|
|
6169
|
+
context: (0, import_util15.jsonify)((0, import_log20.getContextFromEntry)(entry2)),
|
|
6147
6170
|
timestamp: /* @__PURE__ */ new Date(),
|
|
6148
6171
|
meta: {
|
|
6149
6172
|
// TODO(dmaretskyi): Fix proto.
|
|
@@ -6152,7 +6175,7 @@ var LoggingServiceImpl = class {
|
|
|
6152
6175
|
scope: {
|
|
6153
6176
|
hostSessionId: this._sessionId,
|
|
6154
6177
|
uptimeSeconds: (Date.now() - this._started) / 1e3,
|
|
6155
|
-
name: (0,
|
|
6178
|
+
name: (0, import_util15.getDebugName)(entry2.meta?.S)
|
|
6156
6179
|
}
|
|
6157
6180
|
}
|
|
6158
6181
|
};
|
|
@@ -6233,7 +6256,7 @@ var SystemServiceImpl = class {
|
|
|
6233
6256
|
const diagnostics = await this._getDiagnostics();
|
|
6234
6257
|
return {
|
|
6235
6258
|
timestamp: /* @__PURE__ */ new Date(),
|
|
6236
|
-
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0,
|
|
6259
|
+
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util16.jsonKeyReplacer)({
|
|
6237
6260
|
truncate: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
|
|
6238
6261
|
humanize: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
|
|
6239
6262
|
})))
|
|
@@ -6290,7 +6313,7 @@ var ClientServicesHost = class {
|
|
|
6290
6313
|
runtimeParams
|
|
6291
6314
|
} = {}) {
|
|
6292
6315
|
this._tracingService = import_tracing9.TRACE_PROCESSOR.createTraceSender();
|
|
6293
|
-
this._statusUpdate = new
|
|
6316
|
+
this._statusUpdate = new import_async20.Event();
|
|
6294
6317
|
this._opening = false;
|
|
6295
6318
|
this._open = false;
|
|
6296
6319
|
this._storage = storage;
|
|
@@ -6373,7 +6396,7 @@ var ClientServicesHost = class {
|
|
|
6373
6396
|
"'service host is open'"
|
|
6374
6397
|
]
|
|
6375
6398
|
});
|
|
6376
|
-
(0,
|
|
6399
|
+
(0, import_log19.log)("initializing...", void 0, {
|
|
6377
6400
|
F: __dxlog_file22,
|
|
6378
6401
|
L: 187,
|
|
6379
6402
|
S: this,
|
|
@@ -6395,7 +6418,7 @@ var ClientServicesHost = class {
|
|
|
6395
6418
|
}
|
|
6396
6419
|
}
|
|
6397
6420
|
if (!options.signalManager) {
|
|
6398
|
-
|
|
6421
|
+
import_log19.log.warn("running signaling without telemetry metadata.", void 0, {
|
|
6399
6422
|
F: __dxlog_file22,
|
|
6400
6423
|
L: 198,
|
|
6401
6424
|
S: this,
|
|
@@ -6420,7 +6443,7 @@ var ClientServicesHost = class {
|
|
|
6420
6443
|
transportFactory,
|
|
6421
6444
|
signalManager
|
|
6422
6445
|
});
|
|
6423
|
-
(0,
|
|
6446
|
+
(0, import_log19.log)("initialized", void 0, {
|
|
6424
6447
|
F: __dxlog_file22,
|
|
6425
6448
|
L: 216,
|
|
6426
6449
|
S: this,
|
|
@@ -6432,7 +6455,7 @@ var ClientServicesHost = class {
|
|
|
6432
6455
|
return;
|
|
6433
6456
|
}
|
|
6434
6457
|
const traceId = import_keys15.PublicKey.random().toHex();
|
|
6435
|
-
|
|
6458
|
+
import_log19.log.trace("dxos.client-services.host.open", import_protocols15.trace.begin({
|
|
6436
6459
|
id: traceId
|
|
6437
6460
|
}), {
|
|
6438
6461
|
F: __dxlog_file22,
|
|
@@ -6477,7 +6500,7 @@ var ClientServicesHost = class {
|
|
|
6477
6500
|
]
|
|
6478
6501
|
});
|
|
6479
6502
|
this._opening = true;
|
|
6480
|
-
(0,
|
|
6503
|
+
(0, import_log19.log)("opening...", {
|
|
6481
6504
|
lockKey: this._resourceLock?.lockKey
|
|
6482
6505
|
}, {
|
|
6483
6506
|
F: __dxlog_file22,
|
|
@@ -6531,7 +6554,7 @@ var ClientServicesHost = class {
|
|
|
6531
6554
|
this._open = true;
|
|
6532
6555
|
this._statusUpdate.emit();
|
|
6533
6556
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6534
|
-
(0,
|
|
6557
|
+
(0, import_log19.log)("opened", {
|
|
6535
6558
|
deviceKey
|
|
6536
6559
|
}, {
|
|
6537
6560
|
F: __dxlog_file22,
|
|
@@ -6539,7 +6562,7 @@ var ClientServicesHost = class {
|
|
|
6539
6562
|
S: this,
|
|
6540
6563
|
C: (f, a) => f(...a)
|
|
6541
6564
|
});
|
|
6542
|
-
|
|
6565
|
+
import_log19.log.trace("dxos.client-services.host.open", import_protocols15.trace.end({
|
|
6543
6566
|
id: traceId
|
|
6544
6567
|
}), {
|
|
6545
6568
|
F: __dxlog_file22,
|
|
@@ -6553,7 +6576,7 @@ var ClientServicesHost = class {
|
|
|
6553
6576
|
return;
|
|
6554
6577
|
}
|
|
6555
6578
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6556
|
-
(0,
|
|
6579
|
+
(0, import_log19.log)("closing...", {
|
|
6557
6580
|
deviceKey
|
|
6558
6581
|
}, {
|
|
6559
6582
|
F: __dxlog_file22,
|
|
@@ -6571,7 +6594,7 @@ var ClientServicesHost = class {
|
|
|
6571
6594
|
await this._level?.close();
|
|
6572
6595
|
this._open = false;
|
|
6573
6596
|
this._statusUpdate.emit();
|
|
6574
|
-
(0,
|
|
6597
|
+
(0, import_log19.log)("closed", {
|
|
6575
6598
|
deviceKey
|
|
6576
6599
|
}, {
|
|
6577
6600
|
F: __dxlog_file22,
|
|
@@ -6582,7 +6605,7 @@ var ClientServicesHost = class {
|
|
|
6582
6605
|
}
|
|
6583
6606
|
async reset() {
|
|
6584
6607
|
const traceId = import_keys15.PublicKey.random().toHex();
|
|
6585
|
-
|
|
6608
|
+
import_log19.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.begin({
|
|
6586
6609
|
id: traceId
|
|
6587
6610
|
}), {
|
|
6588
6611
|
F: __dxlog_file22,
|
|
@@ -6590,7 +6613,7 @@ var ClientServicesHost = class {
|
|
|
6590
6613
|
S: this,
|
|
6591
6614
|
C: (f, a) => f(...a)
|
|
6592
6615
|
});
|
|
6593
|
-
|
|
6616
|
+
import_log19.log.info("resetting...", void 0, {
|
|
6594
6617
|
F: __dxlog_file22,
|
|
6595
6618
|
L: 342,
|
|
6596
6619
|
S: this,
|
|
@@ -6598,13 +6621,13 @@ var ClientServicesHost = class {
|
|
|
6598
6621
|
});
|
|
6599
6622
|
await this._serviceContext?.close();
|
|
6600
6623
|
await this._storage.reset();
|
|
6601
|
-
|
|
6624
|
+
import_log19.log.info("reset", void 0, {
|
|
6602
6625
|
F: __dxlog_file22,
|
|
6603
6626
|
L: 345,
|
|
6604
6627
|
S: this,
|
|
6605
6628
|
C: (f, a) => f(...a)
|
|
6606
6629
|
});
|
|
6607
|
-
|
|
6630
|
+
import_log19.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.end({
|
|
6608
6631
|
id: traceId
|
|
6609
6632
|
}), {
|
|
6610
6633
|
F: __dxlog_file22,
|
|
@@ -6627,11 +6650,11 @@ _ts_decorate8([
|
|
|
6627
6650
|
import_tracing9.trace.info()
|
|
6628
6651
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
6629
6652
|
_ts_decorate8([
|
|
6630
|
-
|
|
6653
|
+
import_async20.synchronized,
|
|
6631
6654
|
import_tracing9.trace.span()
|
|
6632
6655
|
], ClientServicesHost.prototype, "open", null);
|
|
6633
6656
|
_ts_decorate8([
|
|
6634
|
-
|
|
6657
|
+
import_async20.synchronized,
|
|
6635
6658
|
import_tracing9.trace.span()
|
|
6636
6659
|
], ClientServicesHost.prototype, "close", null);
|
|
6637
6660
|
ClientServicesHost = _ts_decorate8([
|
|
@@ -6677,4 +6700,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
6677
6700
|
subscribeToSpaces,
|
|
6678
6701
|
subscribeToSwarmInfo
|
|
6679
6702
|
});
|
|
6680
|
-
//# sourceMappingURL=chunk-
|
|
6703
|
+
//# sourceMappingURL=chunk-F2EIFQZH.cjs.map
|