@inditextech/weave-store-azure-web-pubsub 3.9.0-SNAPSHOT.186.1 → 3.9.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.
package/dist/client.js CHANGED
@@ -3993,6 +3993,7 @@ var WeaveStoreAzureWebPubSubSyncClient = class extends Emittery {
3993
3993
  if (length(encoder) > 1) sendToControlGroup(this, this.topic, MessageDataType.Sync, toUint8Array(encoder));
3994
3994
  };
3995
3995
  websocket.onclose = (e) => {
3996
+ console.log(e);
3996
3997
  console.log(`🚫 [Azure Web PubSub] closed, code: ${e.code}`);
3997
3998
  this.destroyCheckHeartbeat();
3998
3999
  if ((this._ws?.retryCount ?? 0) > 0) this.setAndEmitStatusInfo(WEAVE_STORE_AZURE_WEB_PUBSUB_CONNECTION_STATUS.CONNECTING);
@@ -4004,6 +4005,7 @@ var WeaveStoreAzureWebPubSubSyncClient = class extends Emittery {
4004
4005
  }
4005
4006
  };
4006
4007
  websocket.onopen = () => {
4008
+ this._lastHeartbeatTime = Date.now();
4007
4009
  this.setAndEmitStatusInfo(WEAVE_STORE_AZURE_WEB_PUBSUB_CONNECTION_STATUS.CONNECTED);
4008
4010
  this._wsConnected = true;
4009
4011
  this._initialized = true;
package/dist/server.d.ts CHANGED
@@ -1033,7 +1033,7 @@ declare class WebPubSubEventHandler {
1033
1033
  declare class WeaveStoreAzureWebPubSubSyncHost {
1034
1034
  private readonly server;
1035
1035
  private readonly syncHandler;
1036
- doc: Y.Doc;
1036
+ doc: Y.Doc | undefined;
1037
1037
  topic: string;
1038
1038
  topicAwarenessChannel: string;
1039
1039
  private _client;
@@ -1050,7 +1050,7 @@ declare class WeaveStoreAzureWebPubSubSyncHost {
1050
1050
  private _updateHandler;
1051
1051
  private _awarenessUpdateHandler;
1052
1052
  constructor(server: WeaveAzureWebPubsubServer, syncHandler: WeaveAzureWebPubsubSyncHandler, client: WebPubSubServiceClient, topic: string, doc: Y.Doc, syncHostOptions?: DeepPartial<WeaveStoreAzureWebPubsubSyncHostOptions>);
1053
- get awareness(): awarenessProtocol.Awareness;
1053
+ get awareness(): awarenessProtocol.Awareness | undefined;
1054
1054
  sendInitAwarenessInfo(origin: string): void;
1055
1055
  private setupHeartbeat;
1056
1056
  createWebSocket(): Promise<void>;
package/dist/server.js CHANGED
@@ -30545,6 +30545,7 @@ var WeaveStoreAzureWebPubSubSyncHost = class {
30545
30545
  this._conn = null;
30546
30546
  this._awareness = new Awareness(this.doc);
30547
30547
  this._awarenessUpdateHandler = ({ added, updated, removed }, origin) => {
30548
+ if (!this._awareness) return;
30548
30549
  try {
30549
30550
  const changedClients = added.concat(added, updated, removed);
30550
30551
  const encoder = createEncoder();
@@ -30705,6 +30706,13 @@ var WeaveStoreAzureWebPubSubSyncHost = class {
30705
30706
  return this._reconnectionTimeoutId !== null;
30706
30707
  }
30707
30708
  async stop() {
30709
+ if (this._heartbeatIntervalId) clearInterval(this._heartbeatIntervalId);
30710
+ if (this._reconnectionTimeoutId) clearTimeout(this._reconnectionTimeoutId);
30711
+ if (this._resyncIntervalId) clearInterval(this._resyncIntervalId);
30712
+ this.doc?.destroy();
30713
+ this._awareness?.destroy();
30714
+ this.doc = void 0;
30715
+ this._awareness = void 0;
30708
30716
  this._reconnectAttempts = 0;
30709
30717
  this._forceClose = true;
30710
30718
  if (this._conn?.readyState === WebSocket.OPEN) {
@@ -30833,6 +30841,7 @@ var WeaveStoreAzureWebPubSubSyncHost = class {
30833
30841
  }
30834
30842
  }
30835
30843
  onClientInit(group, data) {
30844
+ if (!this.doc) return;
30836
30845
  const encoder = createEncoder();
30837
30846
  writeVarUint(encoder, messageYjsSyncStep1);
30838
30847
  writeSyncStep1(encoder, this.doc);
@@ -30841,6 +30850,7 @@ var WeaveStoreAzureWebPubSubSyncHost = class {
30841
30850
  }
30842
30851
  onClientSync(group, from$1, data) {
30843
30852
  try {
30853
+ if (!this.doc) return;
30844
30854
  const buf = Buffer.from(data, "base64");
30845
30855
  const encoder = createEncoder();
30846
30856
  const decoder = createDecoder(buf);
@@ -31000,6 +31010,7 @@ var WeaveAzureWebPubsubSyncHandler = class extends WebPubSubEventHandler {
31000
31010
  await syncHost.stop();
31001
31011
  this._roomsSyncHost.delete(roomId);
31002
31012
  }
31013
+ this._rooms.get(roomId)?.destroy();
31003
31014
  this._rooms.delete(roomId);
31004
31015
  return WEAVE_STORE_AZURE_WEB_PUBSUB_DESTROY_ROOM_STATUS.DESTROYED;
31005
31016
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inditextech/weave-store-azure-web-pubsub",
3
- "version": "3.9.0-SNAPSHOT.186.1",
3
+ "version": "3.9.0",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Jesus Manuel Piñeiro Cid <jesusmpc@inditex.com>",
@@ -57,8 +57,8 @@
57
57
  "dependencies": {
58
58
  "@azure/identity": "4.10.2",
59
59
  "@azure/web-pubsub": "1.2.0",
60
- "@inditextech/weave-types": "3.9.0-SNAPSHOT.186.1",
61
- "@inditextech/weave-sdk": "3.9.0-SNAPSHOT.186.1",
60
+ "@inditextech/weave-types": "3.9.0",
61
+ "@inditextech/weave-sdk": "3.9.0",
62
62
  "@syncedstore/core": "0.6.0",
63
63
  "buffer": "6.0.3",
64
64
  "reconnecting-websocket": "4.4.0",