@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.d.ts CHANGED
@@ -629,7 +629,7 @@ declare class FirebaseDevice {
629
629
  changeSettings(settings: any): Promise<void>;
630
630
  getSkill(bundleId: any): Promise<any>;
631
631
  createBluetoothToken(): Promise<string>;
632
- disconnect(): void;
632
+ disconnect(): Promise<void>;
633
633
  }
634
634
 
635
635
  declare enum STATUS {
package/dist/index.js CHANGED
@@ -31162,19 +31162,21 @@ const createDeviceStore = (app, deviceId, subscriptionManager) => {
31162
31162
  : `metrics/${metric}/${labels[0]}`;
31163
31163
  offData(child, "value", listener);
31164
31164
  },
31165
- disconnect() {
31166
- remove(clientRef);
31165
+ async disconnect() {
31167
31166
  listenersToRemove.forEach((removeListener) => {
31168
31167
  removeListener();
31169
31168
  });
31170
- subscriptionManager
31171
- .toList()
31172
- .filter((subscription) => subscription.clientId === clientId)
31173
- .forEach((subscription) => {
31174
- const childPath = `subscriptions/${subscription.id}`;
31175
- const subscriptionRef = child(deviceRef, childPath);
31176
- remove(subscriptionRef);
31177
- });
31169
+ return await Promise.all([
31170
+ remove(clientRef),
31171
+ ...subscriptionManager
31172
+ .toList()
31173
+ .filter((subscription) => subscription.clientId === clientId)
31174
+ .map((subscription) => {
31175
+ const childPath = `subscriptions/${subscription.id}`;
31176
+ const subscriptionRef = child(deviceRef, childPath);
31177
+ return remove(subscriptionRef);
31178
+ })
31179
+ ]);
31178
31180
  }
31179
31181
  };
31180
31182
  };
@@ -31257,8 +31259,8 @@ class FirebaseDevice {
31257
31259
  }
31258
31260
  return token;
31259
31261
  }
31260
- disconnect() {
31261
- this.deviceStore.disconnect();
31262
+ async disconnect() {
31263
+ await this.deviceStore.disconnect();
31262
31264
  }
31263
31265
  }
31264
31266
  FirebaseDevice.serverType = "firebase";
@@ -31541,9 +31543,14 @@ class CloudClient {
31541
31543
  this.firebaseUser.onUserClaimsChange().subscribe((userClaims) => {
31542
31544
  this.userClaims = userClaims;
31543
31545
  });
31544
- this.onDeviceChange().subscribe((device) => {
31546
+ this.onDeviceChange().subscribe(async (device) => {
31545
31547
  if (this.firebaseDevice) {
31546
- this.firebaseDevice.disconnect();
31548
+ try {
31549
+ await this.firebaseDevice.disconnect();
31550
+ }
31551
+ catch (error) {
31552
+ console.error("Error disconnecting from device", error);
31553
+ }
31547
31554
  }
31548
31555
  if (!device) {
31549
31556
  return;
@@ -31595,6 +31602,14 @@ class CloudClient {
31595
31602
  return await this.firebaseDevice.dispatchAction(action);
31596
31603
  }
31597
31604
  async disconnect() {
31605
+ if (this.firebaseDevice) {
31606
+ try {
31607
+ await this.firebaseDevice.disconnect();
31608
+ }
31609
+ catch (error) {
31610
+ console.error("Error disconnecting from device", error);
31611
+ }
31612
+ }
31598
31613
  return this.firebaseApp.disconnect();
31599
31614
  }
31600
31615
  async getInfo() {
@@ -31617,7 +31632,12 @@ class CloudClient {
31617
31632
  }
31618
31633
  async logout() {
31619
31634
  if (this.firebaseDevice) {
31620
- this.firebaseDevice.disconnect();
31635
+ try {
31636
+ await this.firebaseDevice.disconnect();
31637
+ }
31638
+ catch (error) {
31639
+ console.error("Error disconnecting from device", error);
31640
+ }
31621
31641
  }
31622
31642
  return await this.firebaseUser.logout();
31623
31643
  }