@busy-app/busy-lib 0.14.2 → 0.15.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/index.d.ts CHANGED
@@ -170,9 +170,14 @@ export declare enum AuthStatus {
170
170
  UNAUTHENTICATED = "UNAUTHENTICATED",
171
171
  AUTHENTICATING = "AUTHENTICATING",
172
172
  AUTHENTICATED = "AUTHENTICATED",
173
+ REAUTHENTICATING = "REAUTHENTICATING",
173
174
  FAILED = "FAILED"
174
175
  }
175
176
 
177
+ export declare interface AuthStatusComponent extends StatusComponent<AuthStatus> {
178
+ attempts?: number;
179
+ }
180
+
176
181
  declare interface AutoUpdateParams extends TimeoutOptions, AutoUpdateSettings {
177
182
  }
178
183
 
@@ -188,6 +193,8 @@ declare abstract class BaseStateStream {
188
193
  protected isBinary: boolean;
189
194
  protected connectTimeout: number;
190
195
  protected dataTimeout: number;
196
+ protected maxReconnectAttempts: number;
197
+ protected maxAuthAttempts: number;
191
198
  protected abstract streamMode: StreamMode;
192
199
  private worker;
193
200
  private connectionTimer;
@@ -1722,6 +1729,10 @@ export declare enum ConnectionStatus {
1722
1729
  RECONNECTING = "RECONNECTING"
1723
1730
  }
1724
1731
 
1732
+ export declare interface ConnectionStatusComponent extends StatusComponent<ConnectionStatus> {
1733
+ attempts?: number;
1734
+ }
1735
+
1725
1736
  declare type ConnectParams = RequireKeys<Omit<WifiConnectRequestConfig, 'ip_config'> & {
1726
1737
  ip_config: RequiredIpConfig;
1727
1738
  }, 'ssid' | 'security' | 'ip_config'> & TimeoutOptions;
@@ -5170,7 +5181,8 @@ export declare type RemoteState = Prettify<{
5170
5181
  export declare class RemoteStateStream extends BaseStateStream {
5171
5182
  protected streamMode: StreamMode;
5172
5183
  private tokenProvider?;
5173
- constructor(options: RemoteStreamOptions, config?: StreamConfig);
5184
+ protected maxAuthAttempts: number;
5185
+ constructor(options: RemoteStreamOptions, config?: RemoteStreamConfig);
5174
5186
  /**
5175
5187
  * Subscribes to updates for a specific device GUID.
5176
5188
  */
@@ -5190,6 +5202,10 @@ export declare class RemoteStateStream extends BaseStateStream {
5190
5202
  protected onTokenExpired(): Promise<string> | void;
5191
5203
  }
5192
5204
 
5205
+ export declare interface RemoteStreamConfig extends StreamConfig {
5206
+ maxAuthAttempts?: number;
5207
+ }
5208
+
5193
5209
  /**
5194
5210
  * Options for remote connections
5195
5211
  */
@@ -5486,6 +5502,7 @@ export declare interface StreamConfig {
5486
5502
  timeout?: number;
5487
5503
  /** Data inactivity timeout in milliseconds. Default: 15000ms */
5488
5504
  dataTimeout?: number;
5505
+ maxReconnectAttempts?: number;
5489
5506
  }
5490
5507
 
5491
5508
  /**
@@ -5518,8 +5535,8 @@ declare interface StreamOptions {
5518
5535
  */
5519
5536
  export declare interface StreamStatus {
5520
5537
  main: StatusComponent<StreamLifecycle>;
5521
- connection: StatusComponent<ConnectionStatus>;
5522
- auth: StatusComponent<AuthStatus>;
5538
+ connection: ConnectionStatusComponent;
5539
+ auth: AuthStatusComponent;
5523
5540
  data: StatusComponent<DataStatus> & {
5524
5541
  lastActivity?: number;
5525
5542
  };
@@ -5817,6 +5834,8 @@ declare type WorkerCommand = {
5817
5834
  token?: string;
5818
5835
  isBinary: boolean;
5819
5836
  mode: StreamMode;
5837
+ maxReconnectAttempts: number;
5838
+ maxAuthAttempts: number;
5820
5839
  } | {
5821
5840
  type: 'STOP';
5822
5841
  } | {
@@ -5853,7 +5872,9 @@ declare type WorkerEvent = {
5853
5872
  } | {
5854
5873
  type: 'STATUS_UPDATE';
5855
5874
  connection?: ConnectionStatus;
5875
+ connectionAttempts?: number;
5856
5876
  auth?: AuthStatus;
5877
+ authAttempts?: number;
5857
5878
  worker?: WorkerStatus;
5858
5879
  };
5859
5880