@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.
@@ -2771,8 +2771,8 @@ var AbracadabraBaseProvider = class extends EventEmitter {
2771
2771
  this.configuration.websocketProvider.on("destroy", this.configuration.onDestroy);
2772
2772
  this.configuration.websocketProvider.on("destroy", this.forwardDestroy);
2773
2773
  this.configuration.websocketProvider.on("rateLimited", this.forwardRateLimited);
2774
- this.configuration.websocketProvider.attach(this);
2775
2774
  this._isAttached = true;
2775
+ this.configuration.websocketProvider.attach(this);
2776
2776
  }
2777
2777
  permissionDeniedHandler(reason) {
2778
2778
  this.emit("authenticationFailed", { reason });
@@ -2824,9 +2824,12 @@ function txPromise$2(store, request) {
2824
2824
  var OfflineStore = class {
2825
2825
  /**
2826
2826
  * @param docId The document UUID.
2827
- * @param serverOrigin Hostname of the server (e.g. "abra.cou.sh").
2828
- * When provided the IndexedDB database is namespaced
2829
- * per-server, preventing cross-server data contamination.
2827
+ * @param serverOrigin Host of the server, including a non-default port
2828
+ * (e.g. "abra.cou.sh", "localhost:3001"). When provided
2829
+ * the IndexedDB database is namespaced per-server,
2830
+ * preventing cross-server data contamination — the port
2831
+ * matters because two same-host servers sharing the
2832
+ * default root_doc_id would otherwise collide.
2830
2833
  */
2831
2834
  constructor(docId, serverOrigin) {
2832
2835
  this.db = null;
@@ -3064,7 +3067,7 @@ var AbracadabraProvider = class AbracadabraProvider extends AbracadabraBaseProvi
3064
3067
  static deriveServerOrigin(config, client) {
3065
3068
  try {
3066
3069
  const url = config.url ?? config.websocketProvider?.url ?? client?.wsUrl;
3067
- if (url) return new URL(url).hostname;
3070
+ if (url) return new URL(url).host;
3068
3071
  } catch {}
3069
3072
  }
3070
3073
  /**
@@ -16093,7 +16096,7 @@ var BackgroundSyncManager = class extends EventEmitter {
16093
16096
  };
16094
16097
  let serverOrigin = "default";
16095
16098
  try {
16096
- serverOrigin = new URL(client.baseUrl ?? "").hostname;
16099
+ serverOrigin = new URL(client.baseUrl ?? "").host;
16097
16100
  } catch {}
16098
16101
  this.persistence = new BackgroundSyncPersistence(serverOrigin);
16099
16102
  this.semaphore = new Semaphore(this.opts.concurrency);
@@ -16240,7 +16243,7 @@ var BackgroundSyncManager = class extends EventEmitter {
16240
16243
  for (const docId of treeMap.keys()) docIds.add(docId);
16241
16244
  let serverOrigin;
16242
16245
  try {
16243
- serverOrigin = new URL(this.client.baseUrl ?? "").hostname;
16246
+ serverOrigin = new URL(this.client.baseUrl ?? "").host;
16244
16247
  } catch {}
16245
16248
  const clearPromises = Array.from(docIds).map(async (docId) => {
16246
16249
  try {