@busy-app/busy-lib 0.14.1 → 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;
@@ -1901,6 +1912,7 @@ export declare class LocalStateStream extends BaseStateStream {
1901
1912
  constructor(options?: LocalStreamOptions, config?: StreamConfig);
1902
1913
  /**
1903
1914
  * Normalizes the address to use ws:// protocol and adds default path if missing.
1915
+ * Adds x-api-token query parameter if token is provided.
1904
1916
  */
1905
1917
  protected normalizeUrl(addr: string): string;
1906
1918
  }
@@ -5169,7 +5181,8 @@ export declare type RemoteState = Prettify<{
5169
5181
  export declare class RemoteStateStream extends BaseStateStream {
5170
5182
  protected streamMode: StreamMode;
5171
5183
  private tokenProvider?;
5172
- constructor(options: RemoteStreamOptions, config?: StreamConfig);
5184
+ protected maxAuthAttempts: number;
5185
+ constructor(options: RemoteStreamOptions, config?: RemoteStreamConfig);
5173
5186
  /**
5174
5187
  * Subscribes to updates for a specific device GUID.
5175
5188
  */
@@ -5189,6 +5202,10 @@ export declare class RemoteStateStream extends BaseStateStream {
5189
5202
  protected onTokenExpired(): Promise<string> | void;
5190
5203
  }
5191
5204
 
5205
+ export declare interface RemoteStreamConfig extends StreamConfig {
5206
+ maxAuthAttempts?: number;
5207
+ }
5208
+
5192
5209
  /**
5193
5210
  * Options for remote connections
5194
5211
  */
@@ -5485,6 +5502,7 @@ export declare interface StreamConfig {
5485
5502
  timeout?: number;
5486
5503
  /** Data inactivity timeout in milliseconds. Default: 15000ms */
5487
5504
  dataTimeout?: number;
5505
+ maxReconnectAttempts?: number;
5488
5506
  }
5489
5507
 
5490
5508
  /**
@@ -5517,8 +5535,8 @@ declare interface StreamOptions {
5517
5535
  */
5518
5536
  export declare interface StreamStatus {
5519
5537
  main: StatusComponent<StreamLifecycle>;
5520
- connection: StatusComponent<ConnectionStatus>;
5521
- auth: StatusComponent<AuthStatus>;
5538
+ connection: ConnectionStatusComponent;
5539
+ auth: AuthStatusComponent;
5522
5540
  data: StatusComponent<DataStatus> & {
5523
5541
  lastActivity?: number;
5524
5542
  };
@@ -5816,6 +5834,8 @@ declare type WorkerCommand = {
5816
5834
  token?: string;
5817
5835
  isBinary: boolean;
5818
5836
  mode: StreamMode;
5837
+ maxReconnectAttempts: number;
5838
+ maxAuthAttempts: number;
5819
5839
  } | {
5820
5840
  type: 'STOP';
5821
5841
  } | {
@@ -5852,7 +5872,9 @@ declare type WorkerEvent = {
5852
5872
  } | {
5853
5873
  type: 'STATUS_UPDATE';
5854
5874
  connection?: ConnectionStatus;
5875
+ connectionAttempts?: number;
5855
5876
  auth?: AuthStatus;
5877
+ authAttempts?: number;
5856
5878
  worker?: WorkerStatus;
5857
5879
  };
5858
5880