@neurosity/sdk 7.0.0 → 7.0.1

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/index.mjs CHANGED
@@ -31160,19 +31160,21 @@ const createDeviceStore = (app, deviceId, subscriptionManager) => {
31160
31160
  : `metrics/${metric}/${labels[0]}`;
31161
31161
  offData(child, "value", listener);
31162
31162
  },
31163
- disconnect() {
31164
- remove(clientRef);
31163
+ async disconnect() {
31165
31164
  listenersToRemove.forEach((removeListener) => {
31166
31165
  removeListener();
31167
31166
  });
31168
- subscriptionManager
31169
- .toList()
31170
- .filter((subscription) => subscription.clientId === clientId)
31171
- .forEach((subscription) => {
31172
- const childPath = `subscriptions/${subscription.id}`;
31173
- const subscriptionRef = child(deviceRef, childPath);
31174
- remove(subscriptionRef);
31175
- });
31167
+ return await Promise.all([
31168
+ remove(clientRef),
31169
+ ...subscriptionManager
31170
+ .toList()
31171
+ .filter((subscription) => subscription.clientId === clientId)
31172
+ .map((subscription) => {
31173
+ const childPath = `subscriptions/${subscription.id}`;
31174
+ const subscriptionRef = child(deviceRef, childPath);
31175
+ return remove(subscriptionRef);
31176
+ })
31177
+ ]);
31176
31178
  }
31177
31179
  };
31178
31180
  };
@@ -31255,8 +31257,8 @@ class FirebaseDevice {
31255
31257
  }
31256
31258
  return token;
31257
31259
  }
31258
- disconnect() {
31259
- this.deviceStore.disconnect();
31260
+ async disconnect() {
31261
+ await this.deviceStore.disconnect();
31260
31262
  }
31261
31263
  }
31262
31264
  FirebaseDevice.serverType = "firebase";
@@ -31539,9 +31541,14 @@ class CloudClient {
31539
31541
  this.firebaseUser.onUserClaimsChange().subscribe((userClaims) => {
31540
31542
  this.userClaims = userClaims;
31541
31543
  });
31542
- this.onDeviceChange().subscribe((device) => {
31544
+ this.onDeviceChange().subscribe(async (device) => {
31543
31545
  if (this.firebaseDevice) {
31544
- this.firebaseDevice.disconnect();
31546
+ try {
31547
+ await this.firebaseDevice.disconnect();
31548
+ }
31549
+ catch (error) {
31550
+ console.error("Error disconnecting from device", error);
31551
+ }
31545
31552
  }
31546
31553
  if (!device) {
31547
31554
  return;
@@ -31593,6 +31600,14 @@ class CloudClient {
31593
31600
  return await this.firebaseDevice.dispatchAction(action);
31594
31601
  }
31595
31602
  async disconnect() {
31603
+ if (this.firebaseDevice) {
31604
+ try {
31605
+ await this.firebaseDevice.disconnect();
31606
+ }
31607
+ catch (error) {
31608
+ console.error("Error disconnecting from device", error);
31609
+ }
31610
+ }
31596
31611
  return this.firebaseApp.disconnect();
31597
31612
  }
31598
31613
  async getInfo() {
@@ -31615,7 +31630,12 @@ class CloudClient {
31615
31630
  }
31616
31631
  async logout() {
31617
31632
  if (this.firebaseDevice) {
31618
- this.firebaseDevice.disconnect();
31633
+ try {
31634
+ await this.firebaseDevice.disconnect();
31635
+ }
31636
+ catch (error) {
31637
+ console.error("Error disconnecting from device", error);
31638
+ }
31619
31639
  }
31620
31640
  return await this.firebaseUser.logout();
31621
31641
  }