@dxos/client-services 0.6.12-main.ed7cda7 → 0.6.12-main.f9d0246

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.
@@ -7,7 +7,7 @@ import {
7
7
  InvitationsManager,
8
8
  ServiceContext,
9
9
  SpaceInvitationProtocol
10
- } from "../chunk-VENIOUQ4.mjs";
10
+ } from "../chunk-7ONARHVD.mjs";
11
11
 
12
12
  // packages/sdk/client-services/src/packlets/testing/credential-utils.ts
13
13
  import { createCredential } from "@dxos/credentials";
@@ -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_US3NPCS5_exports = {};
30
- __export(chunk_US3NPCS5_exports, {
29
+ var chunk_UPLMIG6W_exports = {};
30
+ __export(chunk_UPLMIG6W_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  DataSpace: () => DataSpace,
@@ -70,7 +70,7 @@ __export(chunk_US3NPCS5_exports, {
70
70
  subscribeToSpaces: () => subscribeToSpaces,
71
71
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
72
72
  });
73
- module.exports = __toCommonJS(chunk_US3NPCS5_exports);
73
+ module.exports = __toCommonJS(chunk_UPLMIG6W_exports);
74
74
  var import_async = require("@dxos/async");
75
75
  var import_codec_protobuf = require("@dxos/codec-protobuf");
76
76
  var import_feed_store = require("@dxos/feed-store");
@@ -703,7 +703,7 @@ var DevtoolsServiceImpl = class {
703
703
  });
704
704
  }
705
705
  };
706
- var DXOS_VERSION = "0.6.12-main.ed7cda7";
706
+ var DXOS_VERSION = "0.6.12-main.f9d0246";
707
707
  var getPlatform = () => {
708
708
  if (process.browser) {
709
709
  if (typeof window !== "undefined") {
@@ -1118,45 +1118,31 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1118
1118
  }));
1119
1119
  this._messenger.connected.on(this._ctx, async () => {
1120
1120
  await this._resetConnection();
1121
- this._connected = true;
1122
- const connectionCtx = new import_context3.Context({
1123
- onError: async (err) => {
1124
- if (connectionCtx !== this._connectionCtx) {
1125
- return;
1126
- }
1127
- if (err instanceof import_edge_client.EdgeIdentityChangedError || err instanceof import_edge_client.EdgeConnectionClosedError) {
1128
- (0, import_log3.log)("resetting on reconnect", void 0, {
1129
- F: __dxlog_file5,
1130
- L: 86,
1131
- S: this,
1132
- C: (f, a) => f(...a)
1133
- });
1134
- await this._resetConnection();
1135
- } else {
1136
- this._ctx.raise(err);
1137
- }
1138
- }
1139
- }, {
1140
- F: __dxlog_file5,
1141
- L: 80
1142
- });
1143
- this._connectionCtx = connectionCtx;
1144
- (0, import_log3.log)("connection context created", void 0, {
1145
- F: __dxlog_file5,
1146
- L: 94,
1147
- S: this,
1148
- C: (f, a) => f(...a)
1149
- });
1150
- (0, import_async6.scheduleMicroTask)(connectionCtx, async () => {
1151
- for (const feed of this._feeds.values()) {
1152
- await this._replicateFeed(connectionCtx, feed);
1153
- }
1154
- });
1121
+ this._startReplication();
1155
1122
  });
1123
+ if (this._messenger.isConnected) {
1124
+ this._startReplication();
1125
+ }
1156
1126
  }
1157
1127
  async _close() {
1158
1128
  await this._resetConnection();
1159
1129
  }
1130
+ _startReplication() {
1131
+ this._connected = true;
1132
+ const connectionCtx = this._createConnectionContext();
1133
+ this._connectionCtx = connectionCtx;
1134
+ (0, import_log3.log)("connection context created", void 0, {
1135
+ F: __dxlog_file5,
1136
+ L: 94,
1137
+ S: this,
1138
+ C: (f, a) => f(...a)
1139
+ });
1140
+ (0, import_async6.scheduleMicroTask)(connectionCtx, async () => {
1141
+ for (const feed of this._feeds.values()) {
1142
+ await this._replicateFeed(connectionCtx, feed);
1143
+ }
1144
+ });
1145
+ }
1160
1146
  async _resetConnection() {
1161
1147
  this._connected = false;
1162
1148
  await this._connectionCtx?.dispose();
@@ -1168,7 +1154,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1168
1154
  key: feed.key
1169
1155
  }, {
1170
1156
  F: __dxlog_file5,
1171
- L: 115,
1157
+ L: 110,
1172
1158
  S: this,
1173
1159
  C: (f, a) => f(...a)
1174
1160
  });
@@ -1193,7 +1179,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1193
1179
  if (!this._connectionCtx) {
1194
1180
  import_log3.log.info("message dropped because connection was disposed", void 0, {
1195
1181
  F: __dxlog_file5,
1196
- L: 140,
1182
+ L: 135,
1197
1183
  S: this,
1198
1184
  C: (f, a) => f(...a)
1199
1185
  });
@@ -1207,13 +1193,13 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1207
1193
  };
1208
1194
  import_log3.log.info("sending message", logPayload, {
1209
1195
  F: __dxlog_file5,
1210
- L: 146,
1196
+ L: 141,
1211
1197
  S: this,
1212
1198
  C: (f, a) => f(...a)
1213
1199
  });
1214
1200
  (0, import_invariant2.invariant)(message.feedKey, void 0, {
1215
1201
  F: __dxlog_file5,
1216
- L: 148,
1202
+ L: 143,
1217
1203
  S: this,
1218
1204
  A: [
1219
1205
  "message.feedKey",
@@ -1236,7 +1222,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1236
1222
  if (!this._connectionCtx) {
1237
1223
  import_log3.log.warn("received message after connection context was disposed", void 0, {
1238
1224
  F: __dxlog_file5,
1239
- L: 165,
1225
+ L: 160,
1240
1226
  S: this,
1241
1227
  C: (f, a) => f(...a)
1242
1228
  });
@@ -1251,7 +1237,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1251
1237
  message
1252
1238
  }, {
1253
1239
  F: __dxlog_file5,
1254
- L: 171,
1240
+ L: 166,
1255
1241
  S: this,
1256
1242
  C: (f, a) => f(...a)
1257
1243
  });
@@ -1262,7 +1248,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1262
1248
  feedKey
1263
1249
  }, {
1264
1250
  F: __dxlog_file5,
1265
- L: 176,
1251
+ L: 171,
1266
1252
  S: this,
1267
1253
  C: (f, a) => f(...a)
1268
1254
  });
@@ -1295,7 +1281,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1295
1281
  blocks: message.blocks.map((b) => b.index)
1296
1282
  }, {
1297
1283
  F: __dxlog_file5,
1298
- L: 198,
1284
+ L: 193,
1299
1285
  S: this,
1300
1286
  C: (f, a) => f(...a)
1301
1287
  });
@@ -1306,7 +1292,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1306
1292
  feedKey
1307
1293
  }, {
1308
1294
  F: __dxlog_file5,
1309
- L: 203,
1295
+ L: 198,
1310
1296
  S: this,
1311
1297
  C: (f, a) => f(...a)
1312
1298
  });
@@ -1320,7 +1306,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1320
1306
  ...message
1321
1307
  }, {
1322
1308
  F: __dxlog_file5,
1323
- L: 212,
1309
+ L: 207,
1324
1310
  S: this,
1325
1311
  C: (f, a) => f(...a)
1326
1312
  });
@@ -1335,7 +1321,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1335
1321
  to
1336
1322
  }, {
1337
1323
  F: __dxlog_file5,
1338
- L: 219,
1324
+ L: 214,
1339
1325
  S: this,
1340
1326
  C: (f, a) => f(...a)
1341
1327
  });
@@ -1345,7 +1331,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1345
1331
  });
1346
1332
  (0, import_invariant2.invariant)(data instanceof Uint8Array, void 0, {
1347
1333
  F: __dxlog_file5,
1348
- L: 224,
1334
+ L: 219,
1349
1335
  S: this,
1350
1336
  A: [
1351
1337
  "data instanceof Uint8Array",
@@ -1373,7 +1359,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1373
1359
  blocks: blocks.length
1374
1360
  }, {
1375
1361
  F: __dxlog_file5,
1376
- L: 245,
1362
+ L: 240,
1377
1363
  S: this,
1378
1364
  C: (f, a) => f(...a)
1379
1365
  });
@@ -1395,7 +1381,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1395
1381
  if (!this._remoteLength.has(feed.key)) {
1396
1382
  (0, import_log3.log)("blocks not pushed because remote length is unknown", void 0, {
1397
1383
  F: __dxlog_file5,
1398
- L: 266,
1384
+ L: 261,
1399
1385
  S: this,
1400
1386
  C: (f, a) => f(...a)
1401
1387
  });
@@ -1411,6 +1397,30 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1411
1397
  _usingCtx.d();
1412
1398
  }
1413
1399
  }
1400
+ _createConnectionContext() {
1401
+ const connectionCtx = new import_context3.Context({
1402
+ onError: async (err) => {
1403
+ if (connectionCtx !== this._connectionCtx) {
1404
+ return;
1405
+ }
1406
+ if (err instanceof import_edge_client.EdgeIdentityChangedError || err instanceof import_edge_client.EdgeConnectionClosedError) {
1407
+ (0, import_log3.log)("resetting on reconnect", void 0, {
1408
+ F: __dxlog_file5,
1409
+ L: 278,
1410
+ S: this,
1411
+ C: (f, a) => f(...a)
1412
+ });
1413
+ await this._resetConnection();
1414
+ } else {
1415
+ this._ctx.raise(err);
1416
+ }
1417
+ }
1418
+ }, {
1419
+ F: __dxlog_file5,
1420
+ L: 272
1421
+ });
1422
+ return connectionCtx;
1423
+ }
1414
1424
  };
1415
1425
  var bufferizeBlock = (block) => ({
1416
1426
  index: block.index,
@@ -7756,4 +7766,4 @@ ClientServicesHost = _ts_decorate8([
7756
7766
  subscribeToSpaces,
7757
7767
  subscribeToSwarmInfo
7758
7768
  });
7759
- //# sourceMappingURL=chunk-US3NPCS5.cjs.map
7769
+ //# sourceMappingURL=chunk-UPLMIG6W.cjs.map