@dxos/client-services 0.4.10-main.fe71b4c → 0.4.10-next.71cec10

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.
Files changed (39) hide show
  1. package/dist/lib/browser/{chunk-7S34JE6M.mjs → chunk-5U7G5S73.mjs} +379 -330
  2. package/dist/lib/browser/chunk-5U7G5S73.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +3 -1
  4. package/dist/lib/browser/index.mjs.map +1 -1
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/packlets/testing/index.mjs +1 -1
  7. package/dist/lib/node/{chunk-DQMGKBOV.cjs → chunk-Y3ADPF24.cjs} +377 -329
  8. package/dist/lib/node/chunk-Y3ADPF24.cjs.map +7 -0
  9. package/dist/lib/node/index.cjs +44 -42
  10. package/dist/lib/node/index.cjs.map +1 -1
  11. package/dist/lib/node/meta.json +1 -1
  12. package/dist/lib/node/packlets/testing/index.cjs +6 -6
  13. package/dist/types/src/packlets/indexing/util.d.ts.map +1 -1
  14. package/dist/types/src/packlets/invitations/index.d.ts +1 -0
  15. package/dist/types/src/packlets/invitations/index.d.ts.map +1 -1
  16. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  17. package/dist/types/src/packlets/invitations/invitations-manager.d.ts +42 -0
  18. package/dist/types/src/packlets/invitations/invitations-manager.d.ts.map +1 -0
  19. package/dist/types/src/packlets/invitations/invitations-service.d.ts +7 -23
  20. package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
  21. package/dist/types/src/packlets/services/service-context.d.ts +2 -0
  22. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  23. package/dist/types/src/packlets/services/service-host.d.ts +1 -0
  24. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  25. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  26. package/dist/types/src/version.d.ts +1 -1
  27. package/package.json +34 -34
  28. package/src/packlets/indexing/util.ts +13 -6
  29. package/src/packlets/invitations/index.ts +1 -0
  30. package/src/packlets/invitations/invitations-handler.ts +1 -2
  31. package/src/packlets/invitations/invitations-manager.ts +197 -0
  32. package/src/packlets/invitations/invitations-service.ts +21 -168
  33. package/src/packlets/services/automerge-host.test.ts +1 -1
  34. package/src/packlets/services/service-context.ts +11 -0
  35. package/src/packlets/services/service-host.ts +11 -15
  36. package/src/packlets/spaces/data-space.ts +1 -1
  37. package/src/version.ts +1 -1
  38. package/dist/lib/browser/chunk-7S34JE6M.mjs.map +0 -7
  39. package/dist/lib/node/chunk-DQMGKBOV.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 chunk_DQMGKBOV_exports = {};
30
- __export(chunk_DQMGKBOV_exports, {
29
+ var chunk_Y3ADPF24_exports = {};
30
+ __export(chunk_Y3ADPF24_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  ClientServicesProviderResource: () => ClientServicesProviderResource,
@@ -41,6 +41,7 @@ __export(chunk_DQMGKBOV_exports, {
41
41
  IdentityManager: () => IdentityManager,
42
42
  IdentityServiceImpl: () => IdentityServiceImpl,
43
43
  InvitationsHandler: () => InvitationsHandler,
44
+ InvitationsManager: () => InvitationsManager,
44
45
  InvitationsServiceImpl: () => InvitationsServiceImpl,
45
46
  Lock: () => Lock,
46
47
  ServiceContext: () => ServiceContext,
@@ -65,7 +66,7 @@ __export(chunk_DQMGKBOV_exports, {
65
66
  subscribeToSpaces: () => subscribeToSpaces,
66
67
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
67
68
  });
68
- module.exports = __toCommonJS(chunk_DQMGKBOV_exports);
69
+ module.exports = __toCommonJS(chunk_Y3ADPF24_exports);
69
70
  var import_async = require("@dxos/async");
70
71
  var import_codec_protobuf = require("@dxos/codec-protobuf");
71
72
  var import_feed_store = require("@dxos/feed-store");
@@ -138,30 +139,29 @@ var import_protocols5 = require("@dxos/protocols");
138
139
  var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
139
140
  var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
140
141
  var import_teleport = require("@dxos/teleport");
141
- var import_async9 = require("@dxos/async");
142
142
  var import_codec_protobuf8 = require("@dxos/codec-protobuf");
143
- var import_context6 = require("@dxos/context");
144
- var import_echo_pipeline = require("@dxos/echo-pipeline");
145
- var import_invariant7 = require("@dxos/invariant");
146
- var import_log6 = require("@dxos/log");
147
143
  var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
148
144
  var import_credentials8 = require("@dxos/credentials");
149
145
  var import_feed_store3 = require("@dxos/feed-store");
150
- var import_invariant8 = require("@dxos/invariant");
151
- var import_log7 = require("@dxos/log");
146
+ var import_invariant7 = require("@dxos/invariant");
147
+ var import_log6 = require("@dxos/log");
152
148
  var import_protocols6 = require("@dxos/protocols");
153
149
  var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
150
+ var import_async9 = require("@dxos/async");
151
+ var import_echo_pipeline = require("@dxos/echo-pipeline");
152
+ var import_invariant8 = require("@dxos/invariant");
153
+ var import_log7 = require("@dxos/log");
154
154
  var import_codec_protobuf9 = require("@dxos/codec-protobuf");
155
155
  var import_debug2 = require("@dxos/debug");
156
156
  var import_rpc = require("@dxos/rpc");
157
157
  var import_tracing3 = require("@dxos/tracing");
158
158
  var import_async10 = require("@dxos/async");
159
159
  var import_client_protocol3 = require("@dxos/client-protocol");
160
- var import_context7 = require("@dxos/context");
160
+ var import_context6 = require("@dxos/context");
161
161
  var import_debug3 = require("@dxos/debug");
162
- var import_echo_db = require("@dxos/echo-db");
163
162
  var import_echo_pipeline2 = require("@dxos/echo-pipeline");
164
163
  var import_echo_pipeline3 = require("@dxos/echo-pipeline");
164
+ var import_echo_schema = require("@dxos/echo-schema");
165
165
  var import_invariant9 = require("@dxos/invariant");
166
166
  var import_keys7 = require("@dxos/keys");
167
167
  var import_log8 = require("@dxos/log");
@@ -174,7 +174,7 @@ var import_util4 = require("@dxos/util");
174
174
  var import_async11 = require("@dxos/async");
175
175
  var import_credentials10 = require("@dxos/credentials");
176
176
  var import_async12 = require("@dxos/async");
177
- var import_context8 = require("@dxos/context");
177
+ var import_context7 = require("@dxos/context");
178
178
  var import_invariant10 = require("@dxos/invariant");
179
179
  var import_keys8 = require("@dxos/keys");
180
180
  var import_log9 = require("@dxos/log");
@@ -182,7 +182,7 @@ var import_protocols8 = require("@dxos/protocols");
182
182
  var import_teleport2 = require("@dxos/teleport");
183
183
  var import_util5 = require("@dxos/util");
184
184
  var import_async13 = require("@dxos/async");
185
- var import_context9 = require("@dxos/context");
185
+ var import_context8 = require("@dxos/context");
186
186
  var import_credentials11 = require("@dxos/credentials");
187
187
  var import_invariant11 = require("@dxos/invariant");
188
188
  var import_keys9 = require("@dxos/keys");
@@ -203,7 +203,7 @@ var import_log11 = require("@dxos/log");
203
203
  var import_protocols10 = require("@dxos/protocols");
204
204
  var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
205
205
  var import_async15 = require("@dxos/async");
206
- var import_context10 = require("@dxos/context");
206
+ var import_context9 = require("@dxos/context");
207
207
  var import_credentials14 = require("@dxos/credentials");
208
208
  var import_debug6 = require("@dxos/debug");
209
209
  var import_echo_pipeline4 = require("@dxos/echo-pipeline");
@@ -219,7 +219,6 @@ var import_teleport_extension_object_sync = require("@dxos/teleport-extension-ob
219
219
  var import_tracing5 = require("@dxos/tracing");
220
220
  var import_util7 = require("@dxos/util");
221
221
  var import_automerge = require("@dxos/automerge/automerge");
222
- var import_debug7 = require("@dxos/debug");
223
222
  var import_protocols12 = require("@dxos/protocols");
224
223
  var import_codec_protobuf11 = require("@dxos/codec-protobuf");
225
224
  var import_credentials15 = require("@dxos/credentials");
@@ -234,9 +233,9 @@ var import_tracing7 = require("@dxos/tracing");
234
233
  var import_util8 = require("@dxos/util");
235
234
  var import_async16 = require("@dxos/async");
236
235
  var import_client_protocol4 = require("@dxos/client-protocol");
237
- var import_context11 = require("@dxos/context");
236
+ var import_context10 = require("@dxos/context");
238
237
  var import_echo_pipeline5 = require("@dxos/echo-pipeline");
239
- var import_echo_schema = require("@dxos/echo-schema");
238
+ var import_echo_schema2 = require("@dxos/echo-schema");
240
239
  var import_indexing2 = require("@dxos/indexing");
241
240
  var import_invariant15 = require("@dxos/invariant");
242
241
  var import_keys11 = require("@dxos/keys");
@@ -2021,7 +2020,7 @@ var InvitationsHandler = class {
2021
2020
  });
2022
2021
  return extension;
2023
2022
  };
2024
- if (invitation.lifetime && invitation.created && invitation.lifetime !== 0) {
2023
+ if (invitation.lifetime && invitation.created) {
2025
2024
  if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
2026
2025
  import_log4.log.warn("invitation has already expired", void 0, {
2027
2026
  F: __dxlog_file7,
@@ -2086,7 +2085,7 @@ var InvitationsHandler = class {
2086
2085
  if (deviceProfile) {
2087
2086
  (0, import_invariant5.invariant)(invitation.kind === import_services3.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
2088
2087
  F: __dxlog_file7,
2089
- L: 256,
2088
+ L: 255,
2090
2089
  S: this,
2091
2090
  A: [
2092
2091
  "invitation.kind === Invitation.Kind.DEVICE",
@@ -2101,7 +2100,7 @@ var InvitationsHandler = class {
2101
2100
  const setState = (newData) => {
2102
2101
  (0, import_invariant5.invariant)(newData.state !== void 0, void 0, {
2103
2102
  F: __dxlog_file7,
2104
- L: 267,
2103
+ L: 266,
2105
2104
  S: this,
2106
2105
  A: [
2107
2106
  "newData.state !== undefined",
@@ -2121,7 +2120,7 @@ var InvitationsHandler = class {
2121
2120
  ...protocol.toJSON()
2122
2121
  }, {
2123
2122
  F: __dxlog_file7,
2124
- L: 275,
2123
+ L: 274,
2125
2124
  S: this,
2126
2125
  C: (f, a) => f(...a)
2127
2126
  });
@@ -2131,7 +2130,7 @@ var InvitationsHandler = class {
2131
2130
  } else {
2132
2131
  import_log4.log.warn("auth failed", err, {
2133
2132
  F: __dxlog_file7,
2134
- L: 278,
2133
+ L: 277,
2135
2134
  S: this,
2136
2135
  C: (f, a) => f(...a)
2137
2136
  });
@@ -2145,7 +2144,7 @@ var InvitationsHandler = class {
2145
2144
  ...protocol.toJSON()
2146
2145
  }, {
2147
2146
  F: __dxlog_file7,
2148
- L: 286,
2147
+ L: 285,
2149
2148
  S: this,
2150
2149
  C: (f, a) => f(...a)
2151
2150
  });
@@ -2160,7 +2159,7 @@ var InvitationsHandler = class {
2160
2159
  currentState
2161
2160
  }, {
2162
2161
  F: __dxlog_file7,
2163
- L: 296,
2162
+ L: 295,
2164
2163
  S: this,
2165
2164
  C: (f, a) => f(...a)
2166
2165
  });
@@ -2175,7 +2174,7 @@ var InvitationsHandler = class {
2175
2174
  id: traceId
2176
2175
  }), {
2177
2176
  F: __dxlog_file7,
2178
- L: 305,
2177
+ L: 304,
2179
2178
  S: this,
2180
2179
  C: (f, a) => f(...a)
2181
2180
  });
@@ -2187,7 +2186,7 @@ var InvitationsHandler = class {
2187
2186
  ...protocol.toJSON()
2188
2187
  }, {
2189
2188
  F: __dxlog_file7,
2190
- L: 313,
2189
+ L: 312,
2191
2190
  S: this,
2192
2191
  C: (f, a) => f(...a)
2193
2192
  });
@@ -2198,7 +2197,7 @@ var InvitationsHandler = class {
2198
2197
  ...protocol.toJSON()
2199
2198
  }, {
2200
2199
  F: __dxlog_file7,
2201
- L: 317,
2200
+ L: 316,
2202
2201
  S: this,
2203
2202
  C: (f, a) => f(...a)
2204
2203
  });
@@ -2208,7 +2207,7 @@ var InvitationsHandler = class {
2208
2207
  response: introductionResponse
2209
2208
  }, {
2210
2209
  F: __dxlog_file7,
2211
- L: 321,
2210
+ L: 320,
2212
2211
  S: this,
2213
2212
  C: (f, a) => f(...a)
2214
2213
  });
@@ -2229,7 +2228,7 @@ var InvitationsHandler = class {
2229
2228
  ...protocol.toJSON()
2230
2229
  }, {
2231
2230
  F: __dxlog_file7,
2232
- L: 337,
2231
+ L: 336,
2233
2232
  S: this,
2234
2233
  C: (f, a) => f(...a)
2235
2234
  });
@@ -2241,7 +2240,7 @@ var InvitationsHandler = class {
2241
2240
  ...protocol.toJSON()
2242
2241
  }, {
2243
2242
  F: __dxlog_file7,
2244
- L: 348,
2243
+ L: 347,
2245
2244
  S: this,
2246
2245
  C: (f, a) => f(...a)
2247
2246
  });
@@ -2254,7 +2253,7 @@ var InvitationsHandler = class {
2254
2253
  id: traceId
2255
2254
  }), {
2256
2255
  F: __dxlog_file7,
2257
- L: 350,
2256
+ L: 349,
2258
2257
  S: this,
2259
2258
  C: (f, a) => f(...a)
2260
2259
  });
@@ -2264,7 +2263,7 @@ var InvitationsHandler = class {
2264
2263
  ...protocol.toJSON()
2265
2264
  }, {
2266
2265
  F: __dxlog_file7,
2267
- L: 353,
2266
+ L: 352,
2268
2267
  S: this,
2269
2268
  C: (f, a) => f(...a)
2270
2269
  });
@@ -2274,7 +2273,7 @@ var InvitationsHandler = class {
2274
2273
  } else {
2275
2274
  (0, import_log4.log)("auth failed", err, {
2276
2275
  F: __dxlog_file7,
2277
- L: 356,
2276
+ L: 355,
2278
2277
  S: this,
2279
2278
  C: (f, a) => f(...a)
2280
2279
  });
@@ -2285,7 +2284,7 @@ var InvitationsHandler = class {
2285
2284
  error: err
2286
2285
  }), {
2287
2286
  F: __dxlog_file7,
2288
- L: 359,
2287
+ L: 358,
2289
2288
  S: this,
2290
2289
  C: (f, a) => f(...a)
2291
2290
  });
@@ -2303,7 +2302,7 @@ var InvitationsHandler = class {
2303
2302
  ...protocol.toJSON()
2304
2303
  }, {
2305
2304
  F: __dxlog_file7,
2306
- L: 370,
2305
+ L: 369,
2307
2306
  S: this,
2308
2307
  C: (f, a) => f(...a)
2309
2308
  });
@@ -2313,7 +2312,7 @@ var InvitationsHandler = class {
2313
2312
  } else {
2314
2313
  (0, import_log4.log)("auth failed", err, {
2315
2314
  F: __dxlog_file7,
2316
- L: 373,
2315
+ L: 372,
2317
2316
  S: this,
2318
2317
  C: (f, a) => f(...a)
2319
2318
  });
@@ -2330,7 +2329,7 @@ var InvitationsHandler = class {
2330
2329
  } else {
2331
2330
  (0, import_invariant5.invariant)(invitation.swarmKey, void 0, {
2332
2331
  F: __dxlog_file7,
2333
- L: 387,
2332
+ L: 386,
2334
2333
  S: this,
2335
2334
  A: [
2336
2335
  "invitation.swarmKey",
@@ -2372,7 +2371,7 @@ var InvitationsHandler = class {
2372
2371
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
2373
2372
  (0, import_log4.log)("guest waiting for authentication code...", void 0, {
2374
2373
  F: __dxlog_file7,
2375
- L: 427,
2374
+ L: 426,
2376
2375
  S: this,
2377
2376
  C: (f, a) => f(...a)
2378
2377
  });
@@ -2382,7 +2381,7 @@ var InvitationsHandler = class {
2382
2381
  const authCode = await authenticated.wait(options);
2383
2382
  (0, import_log4.log)("sending authentication request", void 0, {
2384
2383
  F: __dxlog_file7,
2385
- L: 431,
2384
+ L: 430,
2386
2385
  S: this,
2387
2386
  C: (f, a) => f(...a)
2388
2387
  });
@@ -2403,7 +2402,7 @@ var InvitationsHandler = class {
2403
2402
  attempt
2404
2403
  }, {
2405
2404
  F: __dxlog_file7,
2406
- L: 442,
2405
+ L: 441,
2407
2406
  S: this,
2408
2407
  C: (f, a) => f(...a)
2409
2408
  });
@@ -2421,7 +2420,7 @@ var InvitationsHandler = class {
2421
2420
  }
2422
2421
  (0, import_log4.log)("sending authentication request", void 0, {
2423
2422
  F: __dxlog_file7,
2424
- L: 461,
2423
+ L: 460,
2425
2424
  S: this,
2426
2425
  C: (f, a) => f(...a)
2427
2426
  });
@@ -2444,194 +2443,35 @@ var createAdmissionKeypair = () => {
2444
2443
  privateKey: keypair.secretKey
2445
2444
  };
2446
2445
  };
2447
- var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
2448
2446
  var InvitationsServiceImpl = class {
2449
- constructor(_invitationsHandler, _getHandler, _metadataStore) {
2450
- this._invitationsHandler = _invitationsHandler;
2451
- this._getHandler = _getHandler;
2452
- this._metadataStore = _metadataStore;
2453
- this._createInvitations = /* @__PURE__ */ new Map();
2454
- this._acceptInvitations = /* @__PURE__ */ new Map();
2455
- this._invitationCreated = new import_async9.Event();
2456
- this._invitationAccepted = new import_async9.Event();
2457
- this._removedCreated = new import_async9.Event();
2458
- this._removedAccepted = new import_async9.Event();
2459
- this._saved = new import_async9.Event();
2460
- this._persistentInvitationsLoadedEvent = new import_async9.Event();
2461
- this._persistentInvitationsLoaded = false;
2447
+ constructor(_invitationsManager) {
2448
+ this._invitationsManager = _invitationsManager;
2462
2449
  }
2463
2450
  // TODO(burdon): Guest/host label.
2464
2451
  getLoggingContext() {
2465
2452
  return {};
2466
2453
  }
2467
2454
  createInvitation(options) {
2468
- let invitation;
2469
- const savePersistentInvitationCtx = new import_context6.Context();
2470
- const existingInvitation = this._createInvitations.get(options.invitationId);
2471
- if (existingInvitation) {
2472
- invitation = existingInvitation;
2473
- } else {
2474
- const handler = this._getHandler(options);
2475
- invitation = this._invitationsHandler.createInvitation(handler, options);
2476
- this._createInvitations.set(invitation.get().invitationId, invitation);
2477
- this._invitationCreated.emit(invitation.get());
2478
- }
2455
+ const invitation = this._invitationsManager.createInvitation(options);
2479
2456
  return new import_codec_protobuf8.Stream(({ next, close }) => {
2480
- if (invitation.get().persistent) {
2481
- (0, import_async9.scheduleTask)(savePersistentInvitationCtx, async () => {
2482
- try {
2483
- await this._metadataStore.addInvitation(invitation.get());
2484
- this._saved.emit(invitation.get());
2485
- } catch (err) {
2486
- close(err);
2487
- }
2488
- });
2489
- }
2490
- invitation.subscribe((invitation2) => {
2491
- next(invitation2);
2492
- }, async (err) => {
2493
- await savePersistentInvitationCtx.dispose();
2494
- close(err);
2495
- }, async () => {
2496
- close();
2497
- if (invitation.get().persistent) {
2498
- await savePersistentInvitationCtx.dispose();
2499
- await this._metadataStore.removeInvitation(invitation.get().invitationId);
2500
- }
2501
- this._createInvitations.delete(invitation.get().invitationId);
2502
- if (!invitation.get().multiUse) {
2503
- this._removedCreated.emit(invitation.get());
2504
- }
2505
- });
2457
+ invitation.subscribe(next, close, close);
2506
2458
  });
2507
2459
  }
2508
- async loadPersistentInvitations() {
2509
- const persistentInvitations = this._metadataStore.getInvitations();
2510
- const freshInvitations = persistentInvitations.filter(async (invitation) => !(0, import_echo_pipeline.hasInvitationExpired)(invitation));
2511
- const cInvitations = freshInvitations.map((persistentInvitation) => {
2512
- (0, import_invariant7.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
2513
- F: __dxlog_file8,
2514
- L: 109,
2515
- S: this,
2516
- A: [
2517
- "!this._createInvitations.get(persistentInvitation.invitationId)",
2518
- "'invitation already exists'"
2519
- ]
2520
- });
2521
- const handler = this._getHandler(persistentInvitation);
2522
- const invitation = this._invitationsHandler.createInvitation(handler, persistentInvitation);
2523
- this._createInvitations.set(invitation.get().invitationId, invitation);
2524
- this._invitationCreated.emit(invitation.get());
2525
- return persistentInvitation;
2526
- });
2527
- this._persistentInvitationsLoadedEvent.emit();
2528
- this._persistentInvitationsLoaded = true;
2529
- return {
2530
- invitations: cInvitations
2531
- };
2532
- }
2533
- acceptInvitation({ invitation: options, deviceProfile }) {
2534
- let invitation;
2535
- if (deviceProfile) {
2536
- (0, import_invariant7.invariant)(options.kind === import_services5.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
2537
- F: __dxlog_file8,
2538
- L: 127,
2539
- S: this,
2540
- A: [
2541
- "options.kind === Invitation.Kind.DEVICE",
2542
- "'deviceProfile provided for non-device invitation'"
2543
- ]
2544
- });
2545
- }
2546
- const existingInvitation = this._acceptInvitations.get(options.invitationId);
2547
- if (existingInvitation) {
2548
- invitation = existingInvitation;
2549
- } else {
2550
- const handler = this._getHandler(options);
2551
- invitation = this._invitationsHandler.acceptInvitation(handler, options, deviceProfile);
2552
- this._acceptInvitations.set(invitation.get().invitationId, invitation);
2553
- this._invitationAccepted.emit(invitation.get());
2554
- }
2460
+ acceptInvitation(request) {
2461
+ const invitation = this._invitationsManager.acceptInvitation(request);
2555
2462
  return new import_codec_protobuf8.Stream(({ next, close }) => {
2556
- invitation.subscribe((invitation2) => {
2557
- next(invitation2);
2558
- }, (err) => {
2559
- close(err);
2560
- }, () => {
2561
- close();
2562
- this._acceptInvitations.delete(invitation.get().invitationId);
2563
- if (!invitation.get().multiUse) {
2564
- this._removedAccepted.emit(invitation.get());
2565
- }
2566
- });
2463
+ invitation.subscribe(next, close, close);
2567
2464
  });
2568
2465
  }
2569
- async authenticate({ invitationId, authCode }) {
2570
- (0, import_log6.log)("authenticating...", void 0, {
2571
- F: __dxlog_file8,
2572
- L: 160,
2573
- S: this,
2574
- C: (f, a) => f(...a)
2575
- });
2576
- (0, import_invariant7.invariant)(invitationId, void 0, {
2577
- F: __dxlog_file8,
2578
- L: 161,
2579
- S: this,
2580
- A: [
2581
- "invitationId",
2582
- ""
2583
- ]
2584
- });
2585
- const observable = this._acceptInvitations.get(invitationId);
2586
- if (!observable) {
2587
- import_log6.log.warn("invalid invitation", {
2588
- invitationId
2589
- }, {
2590
- F: __dxlog_file8,
2591
- L: 164,
2592
- S: this,
2593
- C: (f, a) => f(...a)
2594
- });
2595
- } else {
2596
- await observable.authenticate(authCode);
2597
- }
2466
+ async authenticate(request) {
2467
+ return this._invitationsManager.authenticate(request);
2598
2468
  }
2599
- async cancelInvitation({ invitationId }) {
2600
- (0, import_log6.log)("cancelInvitation...", {
2601
- invitationId
2602
- }, {
2603
- F: __dxlog_file8,
2604
- L: 171,
2605
- S: this,
2606
- C: (f, a) => f(...a)
2607
- });
2608
- (0, import_invariant7.invariant)(invitationId, void 0, {
2609
- F: __dxlog_file8,
2610
- L: 172,
2611
- S: this,
2612
- A: [
2613
- "invitationId",
2614
- ""
2615
- ]
2616
- });
2617
- const created = this._createInvitations.get(invitationId);
2618
- const accepted = this._acceptInvitations.get(invitationId);
2619
- if (created) {
2620
- await created.cancel();
2621
- this._createInvitations.delete(invitationId);
2622
- this._removedCreated.emit(created.get());
2623
- if (created.get().persistent) {
2624
- await this._metadataStore.removeInvitation(created.get().invitationId);
2625
- }
2626
- } else if (accepted) {
2627
- await accepted.cancel();
2628
- this._acceptInvitations.delete(invitationId);
2629
- this._removedAccepted.emit(accepted.get());
2630
- }
2469
+ async cancelInvitation(request) {
2470
+ return this._invitationsManager.cancelInvitation(request);
2631
2471
  }
2632
2472
  queryInvitations() {
2633
2473
  return new import_codec_protobuf8.Stream(({ next, ctx }) => {
2634
- this._invitationCreated.on(ctx, (invitation) => {
2474
+ this._invitationsManager.invitationCreated.on(ctx, (invitation) => {
2635
2475
  next({
2636
2476
  action: import_services5.QueryInvitationsResponse.Action.ADDED,
2637
2477
  type: import_services5.QueryInvitationsResponse.Type.CREATED,
@@ -2640,7 +2480,7 @@ var InvitationsServiceImpl = class {
2640
2480
  ]
2641
2481
  });
2642
2482
  });
2643
- this._invitationAccepted.on(ctx, (invitation) => {
2483
+ this._invitationsManager.invitationAccepted.on(ctx, (invitation) => {
2644
2484
  next({
2645
2485
  action: import_services5.QueryInvitationsResponse.Action.ADDED,
2646
2486
  type: import_services5.QueryInvitationsResponse.Type.ACCEPTED,
@@ -2649,7 +2489,7 @@ var InvitationsServiceImpl = class {
2649
2489
  ]
2650
2490
  });
2651
2491
  });
2652
- this._removedCreated.on(ctx, (invitation) => {
2492
+ this._invitationsManager.removedCreated.on(ctx, (invitation) => {
2653
2493
  next({
2654
2494
  action: import_services5.QueryInvitationsResponse.Action.REMOVED,
2655
2495
  type: import_services5.QueryInvitationsResponse.Type.CREATED,
@@ -2658,7 +2498,7 @@ var InvitationsServiceImpl = class {
2658
2498
  ]
2659
2499
  });
2660
2500
  });
2661
- this._removedAccepted.on(ctx, (invitation) => {
2501
+ this._invitationsManager.removedAccepted.on(ctx, (invitation) => {
2662
2502
  next({
2663
2503
  action: import_services5.QueryInvitationsResponse.Action.REMOVED,
2664
2504
  type: import_services5.QueryInvitationsResponse.Type.ACCEPTED,
@@ -2667,7 +2507,7 @@ var InvitationsServiceImpl = class {
2667
2507
  ]
2668
2508
  });
2669
2509
  });
2670
- this._saved.on(ctx, (invitation) => {
2510
+ this._invitationsManager.saved.on(ctx, (invitation) => {
2671
2511
  next({
2672
2512
  action: import_services5.QueryInvitationsResponse.Action.SAVED,
2673
2513
  type: import_services5.QueryInvitationsResponse.Type.CREATED,
@@ -2679,32 +2519,25 @@ var InvitationsServiceImpl = class {
2679
2519
  next({
2680
2520
  action: import_services5.QueryInvitationsResponse.Action.ADDED,
2681
2521
  type: import_services5.QueryInvitationsResponse.Type.CREATED,
2682
- invitations: Array.from(this._createInvitations.values()).map((invitation) => invitation.get()),
2522
+ invitations: this._invitationsManager.getCreatedInvitations(),
2683
2523
  existing: true
2684
2524
  });
2685
2525
  next({
2686
2526
  action: import_services5.QueryInvitationsResponse.Action.ADDED,
2687
2527
  type: import_services5.QueryInvitationsResponse.Type.ACCEPTED,
2688
- invitations: Array.from(this._acceptInvitations.values()).map((invitation) => invitation.get()),
2528
+ invitations: this._invitationsManager.getAcceptedInvitations(),
2689
2529
  existing: true
2690
2530
  });
2691
- if (this._persistentInvitationsLoaded) {
2531
+ this._invitationsManager.onPersistentInvitationsLoaded(ctx, () => {
2692
2532
  next({
2693
2533
  action: import_services5.QueryInvitationsResponse.Action.LOAD_COMPLETE,
2694
2534
  type: import_services5.QueryInvitationsResponse.Type.CREATED
2695
2535
  });
2696
- } else {
2697
- this._persistentInvitationsLoadedEvent.on(ctx, () => {
2698
- next({
2699
- action: import_services5.QueryInvitationsResponse.Action.LOAD_COMPLETE,
2700
- type: import_services5.QueryInvitationsResponse.Type.CREATED
2701
- });
2702
- });
2703
- }
2536
+ });
2704
2537
  });
2705
2538
  }
2706
2539
  };
2707
- var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
2540
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
2708
2541
  var SpaceInvitationProtocol = class {
2709
2542
  constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
2710
2543
  this._spaceManager = _spaceManager;
@@ -2725,8 +2558,8 @@ var SpaceInvitationProtocol = class {
2725
2558
  };
2726
2559
  }
2727
2560
  async admit(request, guestProfile) {
2728
- (0, import_invariant8.invariant)(this._spaceKey, void 0, {
2729
- F: __dxlog_file9,
2561
+ (0, import_invariant7.invariant)(this._spaceKey, void 0, {
2562
+ F: __dxlog_file8,
2730
2563
  L: 47,
2731
2564
  S: this,
2732
2565
  A: [
@@ -2735,8 +2568,8 @@ var SpaceInvitationProtocol = class {
2735
2568
  ]
2736
2569
  });
2737
2570
  const space = await this._spaceManager.spaces.get(this._spaceKey);
2738
- (0, import_invariant8.invariant)(space, void 0, {
2739
- F: __dxlog_file9,
2571
+ (0, import_invariant7.invariant)(space, void 0, {
2572
+ F: __dxlog_file8,
2740
2573
  L: 49,
2741
2574
  S: this,
2742
2575
  A: [
@@ -2744,8 +2577,8 @@ var SpaceInvitationProtocol = class {
2744
2577
  ""
2745
2578
  ]
2746
2579
  });
2747
- (0, import_invariant8.invariant)(request.space, void 0, {
2748
- F: __dxlog_file9,
2580
+ (0, import_invariant7.invariant)(request.space, void 0, {
2581
+ F: __dxlog_file8,
2749
2582
  L: 51,
2750
2583
  S: this,
2751
2584
  A: [
@@ -2754,18 +2587,18 @@ var SpaceInvitationProtocol = class {
2754
2587
  ]
2755
2588
  });
2756
2589
  const { identityKey, deviceKey } = request.space;
2757
- (0, import_log7.log)("writing guest credentials", {
2590
+ (0, import_log6.log)("writing guest credentials", {
2758
2591
  host: this._signingContext.deviceKey,
2759
2592
  guest: deviceKey
2760
2593
  }, {
2761
- F: __dxlog_file9,
2594
+ F: __dxlog_file8,
2762
2595
  L: 54,
2763
2596
  S: this,
2764
2597
  C: (f, a) => f(...a)
2765
2598
  });
2766
2599
  const credentials = await (0, import_credentials8.createAdmissionCredentials)(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, guestProfile);
2767
- (0, import_invariant8.invariant)(credentials[0].credential, void 0, {
2768
- F: __dxlog_file9,
2600
+ (0, import_invariant7.invariant)(credentials[0].credential, void 0, {
2601
+ F: __dxlog_file8,
2769
2602
  L: 65,
2770
2603
  S: this,
2771
2604
  A: [
@@ -2774,8 +2607,8 @@ var SpaceInvitationProtocol = class {
2774
2607
  ]
2775
2608
  });
2776
2609
  const spaceMemberCredential = credentials[0].credential.credential;
2777
- (0, import_invariant8.invariant)((0, import_credentials8.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2778
- F: __dxlog_file9,
2610
+ (0, import_invariant7.invariant)((0, import_credentials8.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2611
+ F: __dxlog_file8,
2779
2612
  L: 67,
2780
2613
  S: this,
2781
2614
  A: [
@@ -2814,8 +2647,8 @@ var SpaceInvitationProtocol = class {
2814
2647
  };
2815
2648
  }
2816
2649
  async accept(response) {
2817
- (0, import_invariant8.invariant)(response.space, void 0, {
2818
- F: __dxlog_file9,
2650
+ (0, import_invariant7.invariant)(response.space, void 0, {
2651
+ F: __dxlog_file8,
2819
2652
  L: 107,
2820
2653
  S: this,
2821
2654
  A: [
@@ -2825,8 +2658,8 @@ var SpaceInvitationProtocol = class {
2825
2658
  });
2826
2659
  const { credential, controlTimeframe, dataTimeframe } = response.space;
2827
2660
  const assertion = (0, import_credentials8.getCredentialAssertion)(credential);
2828
- (0, import_invariant8.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
2829
- F: __dxlog_file9,
2661
+ (0, import_invariant7.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
2662
+ F: __dxlog_file8,
2830
2663
  L: 110,
2831
2664
  S: this,
2832
2665
  A: [
@@ -2834,8 +2667,8 @@ var SpaceInvitationProtocol = class {
2834
2667
  "'Invalid credential'"
2835
2668
  ]
2836
2669
  });
2837
- (0, import_invariant8.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
2838
- F: __dxlog_file9,
2670
+ (0, import_invariant7.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
2671
+ F: __dxlog_file8,
2839
2672
  L: 111,
2840
2673
  S: this,
2841
2674
  A: [
@@ -2858,6 +2691,221 @@ var SpaceInvitationProtocol = class {
2858
2691
  };
2859
2692
  }
2860
2693
  };
2694
+ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
2695
+ var InvitationsManager = class {
2696
+ constructor(_invitationsHandler, _getHandler, _metadataStore) {
2697
+ this._invitationsHandler = _invitationsHandler;
2698
+ this._getHandler = _getHandler;
2699
+ this._metadataStore = _metadataStore;
2700
+ this._createInvitations = /* @__PURE__ */ new Map();
2701
+ this._acceptInvitations = /* @__PURE__ */ new Map();
2702
+ this.invitationCreated = new import_async9.Event();
2703
+ this.invitationAccepted = new import_async9.Event();
2704
+ this.removedCreated = new import_async9.Event();
2705
+ this.removedAccepted = new import_async9.Event();
2706
+ this.saved = new import_async9.Event();
2707
+ this._persistentInvitationsLoadedEvent = new import_async9.Event();
2708
+ this._persistentInvitationsLoaded = false;
2709
+ }
2710
+ createInvitation(options) {
2711
+ const existingInvitation = this._createInvitations.get(options.invitationId);
2712
+ if (existingInvitation) {
2713
+ return existingInvitation;
2714
+ }
2715
+ const handler = this._getHandler(options);
2716
+ const invitation = this._invitationsHandler.createInvitation(handler, options);
2717
+ this._createInvitations.set(invitation.get().invitationId, invitation);
2718
+ this.invitationCreated.emit(invitation.get());
2719
+ const saveInvitationTask = invitation.get().persistent ? this._safePersistInBackground(invitation) : Promise.resolve();
2720
+ this._onInvitationComplete(invitation, async () => {
2721
+ this._createInvitations.delete(invitation.get().invitationId);
2722
+ this.removedCreated.emit(invitation.get());
2723
+ if (invitation.get().persistent) {
2724
+ await saveInvitationTask;
2725
+ await this._safeDeleteInvitation(invitation.get());
2726
+ }
2727
+ });
2728
+ return invitation;
2729
+ }
2730
+ async loadPersistentInvitations() {
2731
+ if (this._persistentInvitationsLoaded) {
2732
+ const invitations = this.getCreatedInvitations().filter((i) => i.persistent);
2733
+ return {
2734
+ invitations
2735
+ };
2736
+ }
2737
+ try {
2738
+ const persistentInvitations = this._metadataStore.getInvitations();
2739
+ const freshInvitations = persistentInvitations.filter((invitation) => !(0, import_echo_pipeline.hasInvitationExpired)(invitation));
2740
+ const cInvitations = freshInvitations.map((persistentInvitation) => {
2741
+ (0, import_invariant8.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
2742
+ F: __dxlog_file9,
2743
+ L: 82,
2744
+ S: this,
2745
+ A: [
2746
+ "!this._createInvitations.get(persistentInvitation.invitationId)",
2747
+ "'invitation already exists'"
2748
+ ]
2749
+ });
2750
+ return this.createInvitation({
2751
+ ...persistentInvitation,
2752
+ persistent: false
2753
+ }).get();
2754
+ });
2755
+ return {
2756
+ invitations: cInvitations
2757
+ };
2758
+ } catch (err) {
2759
+ import_log7.log.catch(err, void 0, {
2760
+ F: __dxlog_file9,
2761
+ L: 88,
2762
+ S: this,
2763
+ C: (f, a) => f(...a)
2764
+ });
2765
+ return {
2766
+ invitations: []
2767
+ };
2768
+ } finally {
2769
+ this._persistentInvitationsLoadedEvent.emit();
2770
+ this._persistentInvitationsLoaded = true;
2771
+ }
2772
+ }
2773
+ acceptInvitation(request) {
2774
+ const options = request.invitation;
2775
+ const existingInvitation = this._acceptInvitations.get(options.invitationId);
2776
+ if (existingInvitation) {
2777
+ return existingInvitation;
2778
+ }
2779
+ const handler = this._getHandler(options);
2780
+ const invitation = this._invitationsHandler.acceptInvitation(handler, options, request.deviceProfile);
2781
+ this._acceptInvitations.set(invitation.get().invitationId, invitation);
2782
+ this.invitationAccepted.emit(invitation.get());
2783
+ this._onInvitationComplete(invitation, () => {
2784
+ this._acceptInvitations.delete(invitation.get().invitationId);
2785
+ this.removedAccepted.emit(invitation.get());
2786
+ });
2787
+ return invitation;
2788
+ }
2789
+ async authenticate({ invitationId, authCode }) {
2790
+ (0, import_log7.log)("authenticating...", void 0, {
2791
+ F: __dxlog_file9,
2792
+ L: 117,
2793
+ S: this,
2794
+ C: (f, a) => f(...a)
2795
+ });
2796
+ (0, import_invariant8.invariant)(invitationId, void 0, {
2797
+ F: __dxlog_file9,
2798
+ L: 118,
2799
+ S: this,
2800
+ A: [
2801
+ "invitationId",
2802
+ ""
2803
+ ]
2804
+ });
2805
+ const observable = this._acceptInvitations.get(invitationId);
2806
+ if (!observable) {
2807
+ import_log7.log.warn("invalid invitation", {
2808
+ invitationId
2809
+ }, {
2810
+ F: __dxlog_file9,
2811
+ L: 121,
2812
+ S: this,
2813
+ C: (f, a) => f(...a)
2814
+ });
2815
+ } else {
2816
+ await observable.authenticate(authCode);
2817
+ }
2818
+ }
2819
+ async cancelInvitation({ invitationId }) {
2820
+ (0, import_log7.log)("cancelInvitation...", {
2821
+ invitationId
2822
+ }, {
2823
+ F: __dxlog_file9,
2824
+ L: 128,
2825
+ S: this,
2826
+ C: (f, a) => f(...a)
2827
+ });
2828
+ (0, import_invariant8.invariant)(invitationId, void 0, {
2829
+ F: __dxlog_file9,
2830
+ L: 129,
2831
+ S: this,
2832
+ A: [
2833
+ "invitationId",
2834
+ ""
2835
+ ]
2836
+ });
2837
+ const created = this._createInvitations.get(invitationId);
2838
+ if (created) {
2839
+ if (created.get().persistent) {
2840
+ await this._metadataStore.removeInvitation(invitationId);
2841
+ }
2842
+ await created.cancel();
2843
+ this._createInvitations.delete(invitationId);
2844
+ this.removedCreated.emit(created.get());
2845
+ return;
2846
+ }
2847
+ const accepted = this._acceptInvitations.get(invitationId);
2848
+ if (accepted) {
2849
+ await accepted.cancel();
2850
+ this._acceptInvitations.delete(invitationId);
2851
+ this.removedAccepted.emit(accepted.get());
2852
+ }
2853
+ }
2854
+ getCreatedInvitations() {
2855
+ return [
2856
+ ...this._createInvitations.values()
2857
+ ].map((i) => i.get());
2858
+ }
2859
+ getAcceptedInvitations() {
2860
+ return [
2861
+ ...this._acceptInvitations.values()
2862
+ ].map((i) => i.get());
2863
+ }
2864
+ onPersistentInvitationsLoaded(ctx, callback) {
2865
+ if (this._persistentInvitationsLoaded) {
2866
+ callback();
2867
+ } else {
2868
+ this._persistentInvitationsLoadedEvent.once(ctx, () => callback());
2869
+ }
2870
+ }
2871
+ _safePersistInBackground(invitation) {
2872
+ return new Promise((resolve) => {
2873
+ setTimeout(async () => {
2874
+ try {
2875
+ await this._metadataStore.addInvitation(invitation.get());
2876
+ this.saved.emit(invitation.get());
2877
+ } catch (err) {
2878
+ import_log7.log.catch(err, void 0, {
2879
+ F: __dxlog_file9,
2880
+ L: 173,
2881
+ S: this,
2882
+ C: (f, a) => f(...a)
2883
+ });
2884
+ await invitation.cancel();
2885
+ } finally {
2886
+ resolve();
2887
+ }
2888
+ });
2889
+ });
2890
+ }
2891
+ async _safeDeleteInvitation(invitation) {
2892
+ try {
2893
+ await this._metadataStore.removeInvitation(invitation.invitationId);
2894
+ } catch (err) {
2895
+ import_log7.log.catch(err, void 0, {
2896
+ F: __dxlog_file9,
2897
+ L: 186,
2898
+ S: this,
2899
+ C: (f, a) => f(...a)
2900
+ });
2901
+ }
2902
+ }
2903
+ _onInvitationComplete(invitation, callback) {
2904
+ invitation.subscribe(() => {
2905
+ }, () => {
2906
+ }, callback);
2907
+ }
2908
+ };
2861
2909
  function _ts_decorate3(decorators, target, key, desc) {
2862
2910
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2863
2911
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -2974,7 +3022,7 @@ var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
2974
3022
  var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
2975
3023
  var NotarizationPlugin = class {
2976
3024
  constructor() {
2977
- this._ctx = new import_context8.Context();
3025
+ this._ctx = new import_context7.Context();
2978
3026
  this._extensionOpened = new import_async12.Event();
2979
3027
  this._extensions = /* @__PURE__ */ new Set();
2980
3028
  this._processedCredentials = new import_util5.ComplexSet(import_keys8.PublicKey.hash);
@@ -3099,7 +3147,7 @@ var NotarizationPlugin = class {
3099
3147
  this._extensionOpened.on(ctx, () => notarizeTask.schedule());
3100
3148
  try {
3101
3149
  await Promise.race([
3102
- (0, import_context8.rejectOnDispose)(ctx),
3150
+ (0, import_context7.rejectOnDispose)(ctx),
3103
3151
  allNotarized,
3104
3152
  errors.wait()
3105
3153
  ]);
@@ -3238,7 +3286,7 @@ function _ts_decorate4(decorators, target, key, desc) {
3238
3286
  var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
3239
3287
  var DataSpace = class {
3240
3288
  constructor(params) {
3241
- this._ctx = new import_context7.Context();
3289
+ this._ctx = new import_context6.Context();
3242
3290
  this._notarizationPlugin = new NotarizationPlugin();
3243
3291
  this._cache = void 0;
3244
3292
  this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
@@ -3311,7 +3359,7 @@ var DataSpace = class {
3311
3359
  await this._notarizationPlugin.open();
3312
3360
  await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
3313
3361
  await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
3314
- await this._inner.open(new import_context7.Context());
3362
+ await this._inner.open(new import_context6.Context());
3315
3363
  this._state = import_services7.SpaceState.CONTROL_ONLY;
3316
3364
  (0, import_log8.log)("new state", {
3317
3365
  state: import_services7.SpaceState[this._state]
@@ -3340,7 +3388,7 @@ var DataSpace = class {
3340
3388
  C: (f, a) => f(...a)
3341
3389
  });
3342
3390
  await this._ctx.dispose();
3343
- this._ctx = new import_context7.Context();
3391
+ this._ctx = new import_context6.Context();
3344
3392
  await this.authVerifier.close();
3345
3393
  await this._inner.close();
3346
3394
  await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
@@ -3364,7 +3412,7 @@ var DataSpace = class {
3364
3412
  this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
3365
3413
  await this.initializeDataPipeline();
3366
3414
  } catch (err) {
3367
- if (err instanceof import_protocols7.CancelledError || err instanceof import_context7.ContextDisposedError) {
3415
+ if (err instanceof import_protocols7.CancelledError || err instanceof import_context6.ContextDisposedError) {
3368
3416
  (0, import_log8.log)("data pipeline initialization cancelled", err, {
3369
3417
  F: __dxlog_file11,
3370
3418
  L: 245,
@@ -3411,7 +3459,7 @@ var DataSpace = class {
3411
3459
  await this._initializeAndReadControlPipeline();
3412
3460
  await (0, import_async10.sleep)(1);
3413
3461
  this._automergeSpaceState.startProcessingRootDocs();
3414
- await (0, import_context7.cancelWithContext)(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
3462
+ await (0, import_context6.cancelWithContext)(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
3415
3463
  (0, import_log8.log)("data pipeline ready", void 0, {
3416
3464
  F: __dxlog_file11,
3417
3465
  L: 279,
@@ -3512,7 +3560,7 @@ var DataSpace = class {
3512
3560
  queueMicrotask(async () => {
3513
3561
  try {
3514
3562
  await (0, import_debug3.warnAfterTimeout)(5e3, "Automerge root doc load timeout (DataSpace)", async () => {
3515
- await (0, import_context7.cancelWithContext)(this._ctx, handle.whenReady());
3563
+ await (0, import_context6.cancelWithContext)(this._ctx, handle.whenReady());
3516
3564
  });
3517
3565
  if (this._ctx.disposed) {
3518
3566
  return;
@@ -3526,7 +3574,7 @@ var DataSpace = class {
3526
3574
  });
3527
3575
  }
3528
3576
  } catch (err) {
3529
- if (err instanceof import_context7.ContextDisposedError) {
3577
+ if (err instanceof import_context6.ContextDisposedError) {
3530
3578
  return;
3531
3579
  }
3532
3580
  import_log8.log.warn("error loading automerge root doc", {
@@ -3586,7 +3634,7 @@ var DataSpace = class {
3586
3634
  {
3587
3635
  const currentRootUrl = this._automergeSpaceState.rootUrl;
3588
3636
  const rootHandle = this._automergeHost.repo.find(currentRootUrl);
3589
- await (0, import_context7.cancelWithContext)(this._ctx, (0, import_async10.asyncTimeout)(rootHandle.whenReady(), 1e4));
3637
+ await (0, import_context6.cancelWithContext)(this._ctx, (0, import_async10.asyncTimeout)(rootHandle.whenReady(), 1e4));
3590
3638
  const newRoot = this._automergeHost.repo.create(rootHandle.docSync());
3591
3639
  (0, import_invariant9.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
3592
3640
  F: __dxlog_file11,
@@ -3615,9 +3663,9 @@ var DataSpace = class {
3615
3663
  });
3616
3664
  const currentRootUrl = this._automergeSpaceState.rootUrl;
3617
3665
  const rootHandle = this._automergeHost.repo.find(currentRootUrl);
3618
- await (0, import_context7.cancelWithContext)(this._ctx, (0, import_async10.asyncTimeout)(rootHandle.whenReady(), 1e4));
3666
+ await (0, import_context6.cancelWithContext)(this._ctx, (0, import_async10.asyncTimeout)(rootHandle.whenReady(), 1e4));
3619
3667
  const objects = Object.entries(rootHandle.docSync().objects);
3620
- const properties = objects.find(([_, value]) => value.system.type?.itemId === import_echo_db.TYPE_PROPERTIES);
3668
+ const properties = objects.find(([_, value]) => value.system.type?.itemId === import_echo_schema.TYPE_PROPERTIES);
3621
3669
  const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
3622
3670
  (0, import_invariant9.invariant)(properties, "Properties not found", {
3623
3671
  F: __dxlog_file11,
@@ -3843,7 +3891,7 @@ var DataSpaceManager = class {
3843
3891
  this._signingContext = _signingContext;
3844
3892
  this._feedStore = _feedStore;
3845
3893
  this._automergeHost = _automergeHost;
3846
- this._ctx = new import_context9.Context();
3894
+ this._ctx = new import_context8.Context();
3847
3895
  this.updated = new import_async13.Event();
3848
3896
  this._spaces = new import_util6.ComplexMap(import_keys9.PublicKey.hash);
3849
3897
  this._isOpen = false;
@@ -4032,7 +4080,7 @@ var DataSpaceManager = class {
4032
4080
  * TODO(dmaretskyi): Consider removing.
4033
4081
  */
4034
4082
  async waitUntilSpaceReady(spaceKey) {
4035
- await (0, import_context9.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
4083
+ await (0, import_context8.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
4036
4084
  const space = this._spaces.get(spaceKey);
4037
4085
  return !!space && space.state === import_services8.SpaceState.READY;
4038
4086
  }));
@@ -4379,8 +4427,10 @@ var createSelectedDocumentsIterator = (automergeHost) => (
4379
4427
  async function* loadDocuments(ids) {
4380
4428
  for (const id of ids) {
4381
4429
  const { documentId, objectId } = import_protocols12.idCodec.decode(id);
4382
- const handle = automergeHost.repo.find(documentId);
4383
- await (0, import_debug7.warnAfterTimeout)(5e3, "to long to load doc", () => handle.whenReady());
4430
+ const handle = automergeHost.repo.handles[documentId] ?? automergeHost.repo.find(documentId);
4431
+ if (!handle.isReady()) {
4432
+ await handle.whenReady();
4433
+ }
4384
4434
  const doc = handle.docSync();
4385
4435
  const hash = (0, import_automerge.getHeads)(doc).join("");
4386
4436
  yield doc.objects?.[objectId] ? [
@@ -4405,7 +4455,9 @@ var createDocumentsIterator = (automergeHost) => (
4405
4455
  if (visited.has(handle.documentId)) {
4406
4456
  return;
4407
4457
  }
4408
- await (0, import_debug7.warnAfterTimeout)(5e3, "to long to load doc", () => handle.whenReady());
4458
+ if (!handle.isReady()) {
4459
+ await handle.whenReady();
4460
+ }
4409
4461
  const doc = handle.docSync();
4410
4462
  const heads = (0, import_automerge.getHeads)(doc);
4411
4463
  if (doc.objects) {
@@ -4425,7 +4477,7 @@ var createDocumentsIterator = (automergeHost) => (
4425
4477
  if (visited.has(id)) {
4426
4478
  continue;
4427
4479
  }
4428
- const linkHandle = automergeHost.repo.find(id);
4480
+ const linkHandle = automergeHost.repo.handles[id] ?? automergeHost.repo.find(id);
4429
4481
  for await (const result of getObjectsFromHandle(linkHandle)) {
4430
4482
  yield result;
4431
4483
  }
@@ -4455,7 +4507,7 @@ function _ts_decorate6(decorators, target, key, desc) {
4455
4507
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4456
4508
  }
4457
4509
  var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
4458
- var ServiceContext = class extends import_context10.Resource {
4510
+ var ServiceContext = class extends import_context9.Resource {
4459
4511
  constructor(storage, level, networkManager, signalManager, _runtimeParams) {
4460
4512
  super();
4461
4513
  this.storage = storage;
@@ -4508,13 +4560,14 @@ var ServiceContext = class extends import_context10.Resource {
4508
4560
  getAllDocuments: createDocumentsIterator(this.automergeHost)
4509
4561
  });
4510
4562
  this.invitations = new InvitationsHandler(this.networkManager);
4563
+ this.invitationsManager = new InvitationsManager(this.invitations, (invitation) => this.getInvitationHandler(invitation), this.metadataStore);
4511
4564
  this._handlerFactories.set(import_services10.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
4512
4565
  }
4513
4566
  async _open(ctx) {
4514
4567
  await this._checkStorageVersion();
4515
4568
  (0, import_log12.log)("opening...", void 0, {
4516
4569
  F: __dxlog_file14,
4517
- L: 157,
4570
+ L: 164,
4518
4571
  S: this,
4519
4572
  C: (f, a) => f(...a)
4520
4573
  });
@@ -4522,7 +4575,7 @@ var ServiceContext = class extends import_context10.Resource {
4522
4575
  id: this._instanceId
4523
4576
  }), {
4524
4577
  F: __dxlog_file14,
4525
- L: 158,
4578
+ L: 165,
4526
4579
  S: this,
4527
4580
  C: (f, a) => f(...a)
4528
4581
  });
@@ -4535,17 +4588,26 @@ var ServiceContext = class extends import_context10.Resource {
4535
4588
  if (this.identityManager.identity) {
4536
4589
  await this._initialize(ctx);
4537
4590
  }
4591
+ const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
4592
+ (0, import_log12.log)("loaded persistent invitations", {
4593
+ count: loadedInvitations.invitations?.length
4594
+ }, {
4595
+ F: __dxlog_file14,
4596
+ L: 178,
4597
+ S: this,
4598
+ C: (f, a) => f(...a)
4599
+ });
4538
4600
  import_log12.log.trace("dxos.sdk.service-context.open", import_protocols11.trace.end({
4539
4601
  id: this._instanceId
4540
4602
  }), {
4541
4603
  F: __dxlog_file14,
4542
- L: 169,
4604
+ L: 180,
4543
4605
  S: this,
4544
4606
  C: (f, a) => f(...a)
4545
4607
  });
4546
4608
  (0, import_log12.log)("opened", void 0, {
4547
4609
  F: __dxlog_file14,
4548
- L: 170,
4610
+ L: 181,
4549
4611
  S: this,
4550
4612
  C: (f, a) => f(...a)
4551
4613
  });
@@ -4553,7 +4615,7 @@ var ServiceContext = class extends import_context10.Resource {
4553
4615
  async _close() {
4554
4616
  (0, import_log12.log)("closing...", void 0, {
4555
4617
  F: __dxlog_file14,
4556
- L: 174,
4618
+ L: 185,
4557
4619
  S: this,
4558
4620
  C: (f, a) => f(...a)
4559
4621
  });
@@ -4571,21 +4633,21 @@ var ServiceContext = class extends import_context10.Resource {
4571
4633
  await this.indexer.destroy();
4572
4634
  (0, import_log12.log)("closed", void 0, {
4573
4635
  F: __dxlog_file14,
4574
- L: 187,
4636
+ L: 198,
4575
4637
  S: this,
4576
4638
  C: (f, a) => f(...a)
4577
4639
  });
4578
4640
  }
4579
4641
  async createIdentity(params = {}) {
4580
4642
  const identity = await this.identityManager.createIdentity(params);
4581
- await this._initialize(new import_context10.Context());
4643
+ await this._initialize(new import_context9.Context());
4582
4644
  return identity;
4583
4645
  }
4584
4646
  getInvitationHandler(invitation) {
4585
4647
  const factory = this._handlerFactories.get(invitation.kind);
4586
4648
  (0, import_invariant13.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
4587
4649
  F: __dxlog_file14,
4588
- L: 198,
4650
+ L: 209,
4589
4651
  S: this,
4590
4652
  A: [
4591
4653
  "factory",
@@ -4604,7 +4666,7 @@ var ServiceContext = class extends import_context10.Resource {
4604
4666
  }
4605
4667
  async _acceptIdentity(params) {
4606
4668
  const identity = await this.identityManager.acceptIdentity(params);
4607
- await this._initialize(new import_context10.Context());
4669
+ await this._initialize(new import_context9.Context());
4608
4670
  return identity;
4609
4671
  }
4610
4672
  async _checkStorageVersion() {
@@ -4617,7 +4679,7 @@ var ServiceContext = class extends import_context10.Resource {
4617
4679
  async _initialize(ctx) {
4618
4680
  (0, import_log12.log)("initializing spaces...", void 0, {
4619
4681
  F: __dxlog_file14,
4620
- L: 229,
4682
+ L: 240,
4621
4683
  S: this,
4622
4684
  C: (f, a) => f(...a)
4623
4685
  });
@@ -4640,7 +4702,7 @@ var ServiceContext = class extends import_context10.Resource {
4640
4702
  this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
4641
4703
  (0, import_invariant13.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4642
4704
  F: __dxlog_file14,
4643
- L: 253,
4705
+ L: 264,
4644
4706
  S: this,
4645
4707
  A: [
4646
4708
  "this.dataSpaceManager",
@@ -4664,7 +4726,7 @@ var ServiceContext = class extends import_context10.Resource {
4664
4726
  details: assertion
4665
4727
  }, {
4666
4728
  F: __dxlog_file14,
4667
- L: 269,
4729
+ L: 280,
4668
4730
  S: this,
4669
4731
  C: (f, a) => f(...a)
4670
4732
  });
@@ -4675,7 +4737,7 @@ var ServiceContext = class extends import_context10.Resource {
4675
4737
  details: assertion
4676
4738
  }, {
4677
4739
  F: __dxlog_file14,
4678
- L: 273,
4740
+ L: 284,
4679
4741
  S: this,
4680
4742
  C: (f, a) => f(...a)
4681
4743
  });
@@ -4686,7 +4748,7 @@ var ServiceContext = class extends import_context10.Resource {
4686
4748
  details: assertion
4687
4749
  }, {
4688
4750
  F: __dxlog_file14,
4689
- L: 278,
4751
+ L: 289,
4690
4752
  S: this,
4691
4753
  C: (f, a) => f(...a)
4692
4754
  });
@@ -4697,7 +4759,7 @@ var ServiceContext = class extends import_context10.Resource {
4697
4759
  } catch (err) {
4698
4760
  import_log12.log.catch(err, void 0, {
4699
4761
  F: __dxlog_file14,
4700
- L: 284,
4762
+ L: 295,
4701
4763
  S: this,
4702
4764
  C: (f, a) => f(...a)
4703
4765
  });
@@ -4739,7 +4801,7 @@ var ServiceRegistry = class {
4739
4801
  delete this._handlers[name];
4740
4802
  }
4741
4803
  };
4742
- var DXOS_VERSION = "0.4.10-main.fe71b4c";
4804
+ var DXOS_VERSION = "0.4.10-next.71cec10";
4743
4805
  var getPlatform = () => {
4744
4806
  if (process.browser) {
4745
4807
  if (typeof window !== "undefined") {
@@ -5315,7 +5377,7 @@ var ClientServicesHost = class {
5315
5377
  lockKey,
5316
5378
  onAcquire: () => {
5317
5379
  if (!this._opening) {
5318
- void this.open(new import_context11.Context());
5380
+ void this.open(new import_context10.Context());
5319
5381
  }
5320
5382
  },
5321
5383
  onRelease: () => this.close()
@@ -5372,7 +5434,7 @@ var ClientServicesHost = class {
5372
5434
  initialize({ config, ...options }) {
5373
5435
  (0, import_invariant15.invariant)(!this._open, "service host is open", {
5374
5436
  F: __dxlog_file18,
5375
- L: 197,
5437
+ L: 198,
5376
5438
  S: this,
5377
5439
  A: [
5378
5440
  "!this._open",
@@ -5381,14 +5443,14 @@ var ClientServicesHost = class {
5381
5443
  });
5382
5444
  (0, import_log13.log)("initializing...", void 0, {
5383
5445
  F: __dxlog_file18,
5384
- L: 198,
5446
+ L: 199,
5385
5447
  S: this,
5386
5448
  C: (f, a) => f(...a)
5387
5449
  });
5388
5450
  if (config) {
5389
5451
  (0, import_invariant15.invariant)(!this._config, "config already set", {
5390
5452
  F: __dxlog_file18,
5391
- L: 201,
5453
+ L: 202,
5392
5454
  S: this,
5393
5455
  A: [
5394
5456
  "!this._config",
@@ -5403,7 +5465,7 @@ var ClientServicesHost = class {
5403
5465
  if (!options.signalManager) {
5404
5466
  import_log13.log.warn("running signaling without telemetry metadata.", void 0, {
5405
5467
  F: __dxlog_file18,
5406
- L: 209,
5468
+ L: 210,
5407
5469
  S: this,
5408
5470
  C: (f, a) => f(...a)
5409
5471
  });
@@ -5414,7 +5476,7 @@ var ClientServicesHost = class {
5414
5476
  this._signalManager = signalManager;
5415
5477
  (0, import_invariant15.invariant)(!this._networkManager, "network manager already set", {
5416
5478
  F: __dxlog_file18,
5417
- L: 220,
5479
+ L: 221,
5418
5480
  S: this,
5419
5481
  A: [
5420
5482
  "!this._networkManager",
@@ -5428,7 +5490,7 @@ var ClientServicesHost = class {
5428
5490
  });
5429
5491
  (0, import_log13.log)("initialized", void 0, {
5430
5492
  F: __dxlog_file18,
5431
- L: 227,
5493
+ L: 228,
5432
5494
  S: this,
5433
5495
  C: (f, a) => f(...a)
5434
5496
  });
@@ -5442,13 +5504,13 @@ var ClientServicesHost = class {
5442
5504
  id: traceId
5443
5505
  }), {
5444
5506
  F: __dxlog_file18,
5445
- L: 238,
5507
+ L: 239,
5446
5508
  S: this,
5447
5509
  C: (f, a) => f(...a)
5448
5510
  });
5449
5511
  (0, import_invariant15.invariant)(this._config, "config not set", {
5450
5512
  F: __dxlog_file18,
5451
- L: 240,
5513
+ L: 241,
5452
5514
  S: this,
5453
5515
  A: [
5454
5516
  "this._config",
@@ -5457,7 +5519,7 @@ var ClientServicesHost = class {
5457
5519
  });
5458
5520
  (0, import_invariant15.invariant)(this._storage, "storage not set", {
5459
5521
  F: __dxlog_file18,
5460
- L: 241,
5522
+ L: 242,
5461
5523
  S: this,
5462
5524
  A: [
5463
5525
  "this._storage",
@@ -5466,7 +5528,7 @@ var ClientServicesHost = class {
5466
5528
  });
5467
5529
  (0, import_invariant15.invariant)(this._signalManager, "signal manager not set", {
5468
5530
  F: __dxlog_file18,
5469
- L: 242,
5531
+ L: 243,
5470
5532
  S: this,
5471
5533
  A: [
5472
5534
  "this._signalManager",
@@ -5475,7 +5537,7 @@ var ClientServicesHost = class {
5475
5537
  });
5476
5538
  (0, import_invariant15.invariant)(this._networkManager, "network manager not set", {
5477
5539
  F: __dxlog_file18,
5478
- L: 243,
5540
+ L: 244,
5479
5541
  S: this,
5480
5542
  A: [
5481
5543
  "this._networkManager",
@@ -5487,7 +5549,7 @@ var ClientServicesHost = class {
5487
5549
  lockKey: this._resourceLock?.lockKey
5488
5550
  }, {
5489
5551
  F: __dxlog_file18,
5490
- L: 246,
5552
+ L: 247,
5491
5553
  S: this,
5492
5554
  C: (f, a) => f(...a)
5493
5555
  });
@@ -5498,20 +5560,22 @@ var ClientServicesHost = class {
5498
5560
  await this._resourceLock?.acquire();
5499
5561
  await this._loggingService.open();
5500
5562
  this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
5563
+ this._queryService = new import_indexing2.QueryServiceImpl({
5564
+ indexer: this._serviceContext.indexer,
5565
+ automergeHost: this._serviceContext.automergeHost
5566
+ });
5567
+ await this._queryService.open(ctx);
5501
5568
  this._serviceRegistry.setServices({
5502
5569
  SystemService: this._systemService,
5503
5570
  IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
5504
- InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation), this._serviceContext.metadataStore),
5571
+ InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
5505
5572
  DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
5506
5573
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, async () => {
5507
5574
  await this._serviceContext.initialized.wait();
5508
5575
  return this._serviceContext.dataSpaceManager;
5509
5576
  }),
5510
5577
  DataService: new import_echo_pipeline5.DataServiceImpl(this._serviceContext.automergeHost),
5511
- IndexService: new import_indexing2.IndexServiceImpl({
5512
- indexer: this._serviceContext.indexer,
5513
- automergeHost: this._serviceContext.automergeHost
5514
- }),
5578
+ QueryService: this._queryService,
5515
5579
  NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
5516
5580
  LoggingService: this._loggingService,
5517
5581
  TracingService: this._tracingService,
@@ -5523,24 +5587,6 @@ var ClientServicesHost = class {
5523
5587
  })
5524
5588
  });
5525
5589
  await this._serviceContext.open(ctx);
5526
- (0, import_invariant15.invariant)(this.serviceRegistry.services.InvitationsService, void 0, {
5527
- F: __dxlog_file18,
5528
- L: 314,
5529
- S: this,
5530
- A: [
5531
- "this.serviceRegistry.services.InvitationsService",
5532
- ""
5533
- ]
5534
- });
5535
- const loadedInvitations = await this.serviceRegistry.services.InvitationsService.loadPersistentInvitations();
5536
- (0, import_log13.log)("loaded persistent invitations", {
5537
- count: loadedInvitations.invitations?.length
5538
- }, {
5539
- F: __dxlog_file18,
5540
- L: 317,
5541
- S: this,
5542
- C: (f, a) => f(...a)
5543
- });
5544
5590
  const devtoolsProxy = this._config?.get("runtime.client.devtoolsProxy");
5545
5591
  if (devtoolsProxy) {
5546
5592
  this._devtoolsProxy = new import_websocket_rpc.WebsocketRpcClient({
@@ -5560,7 +5606,7 @@ var ClientServicesHost = class {
5560
5606
  deviceKey
5561
5607
  }, {
5562
5608
  F: __dxlog_file18,
5563
- L: 335,
5609
+ L: 330,
5564
5610
  S: this,
5565
5611
  C: (f, a) => f(...a)
5566
5612
  });
@@ -5568,7 +5614,7 @@ var ClientServicesHost = class {
5568
5614
  id: traceId
5569
5615
  }), {
5570
5616
  F: __dxlog_file18,
5571
- L: 336,
5617
+ L: 331,
5572
5618
  S: this,
5573
5619
  C: (f, a) => f(...a)
5574
5620
  });
@@ -5582,7 +5628,7 @@ var ClientServicesHost = class {
5582
5628
  deviceKey
5583
5629
  }, {
5584
5630
  F: __dxlog_file18,
5585
- L: 347,
5631
+ L: 342,
5586
5632
  S: this,
5587
5633
  C: (f, a) => f(...a)
5588
5634
  });
@@ -5592,6 +5638,7 @@ var ClientServicesHost = class {
5592
5638
  SystemService: this._systemService
5593
5639
  });
5594
5640
  await this._loggingService.close();
5641
+ await this._queryService.close();
5595
5642
  await this._serviceContext.close();
5596
5643
  await this._level?.close();
5597
5644
  this._open = false;
@@ -5600,7 +5647,7 @@ var ClientServicesHost = class {
5600
5647
  deviceKey
5601
5648
  }, {
5602
5649
  F: __dxlog_file18,
5603
- L: 356,
5650
+ L: 352,
5604
5651
  S: this,
5605
5652
  C: (f, a) => f(...a)
5606
5653
  });
@@ -5611,13 +5658,13 @@ var ClientServicesHost = class {
5611
5658
  id: traceId
5612
5659
  }), {
5613
5660
  F: __dxlog_file18,
5614
- L: 361,
5661
+ L: 357,
5615
5662
  S: this,
5616
5663
  C: (f, a) => f(...a)
5617
5664
  });
5618
5665
  (0, import_log13.log)("resetting...", void 0, {
5619
5666
  F: __dxlog_file18,
5620
- L: 363,
5667
+ L: 359,
5621
5668
  S: this,
5622
5669
  C: (f, a) => f(...a)
5623
5670
  });
@@ -5625,7 +5672,7 @@ var ClientServicesHost = class {
5625
5672
  await this._storage.reset();
5626
5673
  (0, import_log13.log)("reset", void 0, {
5627
5674
  F: __dxlog_file18,
5628
- L: 366,
5675
+ L: 362,
5629
5676
  S: this,
5630
5677
  C: (f, a) => f(...a)
5631
5678
  });
@@ -5633,7 +5680,7 @@ var ClientServicesHost = class {
5633
5680
  id: traceId
5634
5681
  }), {
5635
5682
  F: __dxlog_file18,
5636
- L: 367,
5683
+ L: 363,
5637
5684
  S: this,
5638
5685
  C: (f, a) => f(...a)
5639
5686
  });
@@ -5646,7 +5693,7 @@ var ClientServicesHost = class {
5646
5693
  const automergeIndex = space.automergeSpaceState.rootUrl;
5647
5694
  (0, import_invariant15.invariant)(automergeIndex, void 0, {
5648
5695
  F: __dxlog_file18,
5649
- L: 379,
5696
+ L: 375,
5650
5697
  S: this,
5651
5698
  A: [
5652
5699
  "automergeIndex",
@@ -5657,7 +5704,7 @@ var ClientServicesHost = class {
5657
5704
  await document.whenReady();
5658
5705
  const properties = {
5659
5706
  system: {
5660
- type: (0, import_echo_pipeline5.encodeReference)((0, import_echo_schema.getTypeReference)(import_client_protocol4.Properties))
5707
+ type: (0, import_echo_pipeline5.encodeReference)((0, import_echo_schema2.getTypeReference)(import_client_protocol4.Properties))
5661
5708
  },
5662
5709
  data: {
5663
5710
  [import_client_protocol4.defaultKey]: identity.identityKey.toHex()
@@ -5741,6 +5788,7 @@ var findConfigs = () => {
5741
5788
  IdentityManager,
5742
5789
  IdentityServiceImpl,
5743
5790
  InvitationsHandler,
5791
+ InvitationsManager,
5744
5792
  InvitationsServiceImpl,
5745
5793
  Lock,
5746
5794
  ServiceContext,
@@ -5765,4 +5813,4 @@ var findConfigs = () => {
5765
5813
  subscribeToSpaces,
5766
5814
  subscribeToSwarmInfo
5767
5815
  });
5768
- //# sourceMappingURL=chunk-DQMGKBOV.cjs.map
5816
+ //# sourceMappingURL=chunk-Y3ADPF24.cjs.map