@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.
@@ -31166,19 +31166,21 @@
31166
31166
  : `metrics/${metric}/${labels[0]}`;
31167
31167
  offData(child, "value", listener);
31168
31168
  },
31169
- disconnect() {
31170
- remove(clientRef);
31169
+ async disconnect() {
31171
31170
  listenersToRemove.forEach((removeListener) => {
31172
31171
  removeListener();
31173
31172
  });
31174
- subscriptionManager
31175
- .toList()
31176
- .filter((subscription) => subscription.clientId === clientId)
31177
- .forEach((subscription) => {
31178
- const childPath = `subscriptions/${subscription.id}`;
31179
- const subscriptionRef = child(deviceRef, childPath);
31180
- remove(subscriptionRef);
31181
- });
31173
+ return await Promise.all([
31174
+ remove(clientRef),
31175
+ ...subscriptionManager
31176
+ .toList()
31177
+ .filter((subscription) => subscription.clientId === clientId)
31178
+ .map((subscription) => {
31179
+ const childPath = `subscriptions/${subscription.id}`;
31180
+ const subscriptionRef = child(deviceRef, childPath);
31181
+ return remove(subscriptionRef);
31182
+ })
31183
+ ]);
31182
31184
  }
31183
31185
  };
31184
31186
  };
@@ -31261,8 +31263,8 @@
31261
31263
  }
31262
31264
  return token;
31263
31265
  }
31264
- disconnect() {
31265
- this.deviceStore.disconnect();
31266
+ async disconnect() {
31267
+ await this.deviceStore.disconnect();
31266
31268
  }
31267
31269
  }
31268
31270
  FirebaseDevice.serverType = "firebase";
@@ -31545,9 +31547,14 @@
31545
31547
  this.firebaseUser.onUserClaimsChange().subscribe((userClaims) => {
31546
31548
  this.userClaims = userClaims;
31547
31549
  });
31548
- this.onDeviceChange().subscribe((device) => {
31550
+ this.onDeviceChange().subscribe(async (device) => {
31549
31551
  if (this.firebaseDevice) {
31550
- this.firebaseDevice.disconnect();
31552
+ try {
31553
+ await this.firebaseDevice.disconnect();
31554
+ }
31555
+ catch (error) {
31556
+ console.error("Error disconnecting from device", error);
31557
+ }
31551
31558
  }
31552
31559
  if (!device) {
31553
31560
  return;
@@ -31599,6 +31606,14 @@
31599
31606
  return await this.firebaseDevice.dispatchAction(action);
31600
31607
  }
31601
31608
  async disconnect() {
31609
+ if (this.firebaseDevice) {
31610
+ try {
31611
+ await this.firebaseDevice.disconnect();
31612
+ }
31613
+ catch (error) {
31614
+ console.error("Error disconnecting from device", error);
31615
+ }
31616
+ }
31602
31617
  return this.firebaseApp.disconnect();
31603
31618
  }
31604
31619
  async getInfo() {
@@ -31621,7 +31636,12 @@
31621
31636
  }
31622
31637
  async logout() {
31623
31638
  if (this.firebaseDevice) {
31624
- this.firebaseDevice.disconnect();
31639
+ try {
31640
+ await this.firebaseDevice.disconnect();
31641
+ }
31642
+ catch (error) {
31643
+ console.error("Error disconnecting from device", error);
31644
+ }
31625
31645
  }
31626
31646
  return await this.firebaseUser.logout();
31627
31647
  }