@abraca/dabra 2.20.0 → 2.21.0

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.
@@ -2801,8 +2801,8 @@ var AbracadabraBaseProvider = class extends EventEmitter {
2801
2801
  this.configuration.websocketProvider.on("destroy", this.configuration.onDestroy);
2802
2802
  this.configuration.websocketProvider.on("destroy", this.forwardDestroy);
2803
2803
  this.configuration.websocketProvider.on("rateLimited", this.forwardRateLimited);
2804
- this.configuration.websocketProvider.attach(this);
2805
2804
  this._isAttached = true;
2805
+ this.configuration.websocketProvider.attach(this);
2806
2806
  }
2807
2807
  permissionDeniedHandler(reason) {
2808
2808
  this.emit("authenticationFailed", { reason });
@@ -2854,9 +2854,12 @@ function txPromise$2(store, request) {
2854
2854
  var OfflineStore = class {
2855
2855
  /**
2856
2856
  * @param docId The document UUID.
2857
- * @param serverOrigin Hostname of the server (e.g. "abra.cou.sh").
2858
- * When provided the IndexedDB database is namespaced
2859
- * per-server, preventing cross-server data contamination.
2857
+ * @param serverOrigin Host of the server, including a non-default port
2858
+ * (e.g. "abra.cou.sh", "localhost:3001"). When provided
2859
+ * the IndexedDB database is namespaced per-server,
2860
+ * preventing cross-server data contamination — the port
2861
+ * matters because two same-host servers sharing the
2862
+ * default root_doc_id would otherwise collide.
2860
2863
  */
2861
2864
  constructor(docId, serverOrigin) {
2862
2865
  this.db = null;
@@ -3094,7 +3097,7 @@ var AbracadabraProvider = class AbracadabraProvider extends AbracadabraBaseProvi
3094
3097
  static deriveServerOrigin(config, client) {
3095
3098
  try {
3096
3099
  const url = config.url ?? config.websocketProvider?.url ?? client?.wsUrl;
3097
- if (url) return new URL(url).hostname;
3100
+ if (url) return new URL(url).host;
3098
3101
  } catch {}
3099
3102
  }
3100
3103
  /**
@@ -16146,7 +16149,7 @@ var BackgroundSyncManager = class extends EventEmitter {
16146
16149
  };
16147
16150
  let serverOrigin = "default";
16148
16151
  try {
16149
- serverOrigin = new URL(client.baseUrl ?? "").hostname;
16152
+ serverOrigin = new URL(client.baseUrl ?? "").host;
16150
16153
  } catch {}
16151
16154
  this.persistence = new BackgroundSyncPersistence(serverOrigin);
16152
16155
  this.semaphore = new Semaphore(this.opts.concurrency);
@@ -16293,7 +16296,7 @@ var BackgroundSyncManager = class extends EventEmitter {
16293
16296
  for (const docId of treeMap.keys()) docIds.add(docId);
16294
16297
  let serverOrigin;
16295
16298
  try {
16296
- serverOrigin = new URL(this.client.baseUrl ?? "").hostname;
16299
+ serverOrigin = new URL(this.client.baseUrl ?? "").host;
16297
16300
  } catch {}
16298
16301
  const clearPromises = Array.from(docIds).map(async (docId) => {
16299
16302
  try {