@topgunbuild/client 0.10.1 → 0.11.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.mts +202 -1
- package/dist/index.d.ts +202 -1
- package/dist/index.js +462 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +458 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -2692,6 +2692,207 @@ declare class SingleServerProvider implements IConnectionProvider {
|
|
|
2692
2692
|
resetReconnectAttempts(): void;
|
|
2693
2693
|
}
|
|
2694
2694
|
|
|
2695
|
+
/**
|
|
2696
|
+
* Configuration for HttpSyncProvider.
|
|
2697
|
+
*/
|
|
2698
|
+
interface HttpSyncProviderConfig {
|
|
2699
|
+
/** HTTP URL of the TopGun server (e.g., 'http://localhost:8080') */
|
|
2700
|
+
url: string;
|
|
2701
|
+
/** Client identifier for the server to track HLC state */
|
|
2702
|
+
clientId: string;
|
|
2703
|
+
/** Hybrid Logical Clock instance for causality tracking */
|
|
2704
|
+
hlc: HLC;
|
|
2705
|
+
/** JWT auth token for Authorization header */
|
|
2706
|
+
authToken?: string;
|
|
2707
|
+
/** Polling interval in milliseconds (default: 5000) */
|
|
2708
|
+
pollIntervalMs?: number;
|
|
2709
|
+
/** HTTP request timeout in milliseconds (default: 30000) */
|
|
2710
|
+
requestTimeoutMs?: number;
|
|
2711
|
+
/** Map names to sync deltas for on each poll */
|
|
2712
|
+
syncMaps?: string[];
|
|
2713
|
+
/** Custom fetch implementation for testing or platform compatibility */
|
|
2714
|
+
fetchImpl?: typeof fetch;
|
|
2715
|
+
}
|
|
2716
|
+
/**
|
|
2717
|
+
* HTTP-based connection provider for serverless environments.
|
|
2718
|
+
*
|
|
2719
|
+
* Implements IConnectionProvider by translating WebSocket-style send() calls
|
|
2720
|
+
* into queued operations that are flushed via HTTP POST /sync at regular
|
|
2721
|
+
* polling intervals. Responses are translated back into synthetic message
|
|
2722
|
+
* events that SyncEngine understands.
|
|
2723
|
+
*
|
|
2724
|
+
* This provider is completely stateless on the server side -- each request
|
|
2725
|
+
* carries the client's HLC state and the server computes deltas without
|
|
2726
|
+
* maintaining per-client state.
|
|
2727
|
+
*/
|
|
2728
|
+
declare class HttpSyncProvider implements IConnectionProvider {
|
|
2729
|
+
private readonly url;
|
|
2730
|
+
private readonly clientId;
|
|
2731
|
+
private readonly hlc;
|
|
2732
|
+
private readonly pollIntervalMs;
|
|
2733
|
+
private readonly requestTimeoutMs;
|
|
2734
|
+
private readonly syncMaps;
|
|
2735
|
+
private readonly fetchImpl;
|
|
2736
|
+
private authToken;
|
|
2737
|
+
private listeners;
|
|
2738
|
+
private pollTimer;
|
|
2739
|
+
/** Queued operations to send on next poll */
|
|
2740
|
+
private pendingOperations;
|
|
2741
|
+
/** Queued one-shot queries to send on next poll */
|
|
2742
|
+
private pendingQueries;
|
|
2743
|
+
/** Per-map last sync timestamps for delta tracking */
|
|
2744
|
+
private lastSyncTimestamps;
|
|
2745
|
+
/** Whether the last HTTP request succeeded */
|
|
2746
|
+
private connected;
|
|
2747
|
+
/** Whether we were previously connected (for reconnected event) */
|
|
2748
|
+
private wasConnected;
|
|
2749
|
+
constructor(config: HttpSyncProviderConfig);
|
|
2750
|
+
/**
|
|
2751
|
+
* Connect by sending an initial sync request to verify auth and get state.
|
|
2752
|
+
*/
|
|
2753
|
+
connect(): Promise<void>;
|
|
2754
|
+
/**
|
|
2755
|
+
* Get connection for a specific key.
|
|
2756
|
+
* HTTP mode does not expose raw WebSocket connections.
|
|
2757
|
+
*/
|
|
2758
|
+
getConnection(_key: string): WebSocket;
|
|
2759
|
+
/**
|
|
2760
|
+
* Get any available connection.
|
|
2761
|
+
* HTTP mode does not expose raw WebSocket connections.
|
|
2762
|
+
*/
|
|
2763
|
+
getAnyConnection(): WebSocket;
|
|
2764
|
+
/**
|
|
2765
|
+
* Check if connected (last HTTP request succeeded).
|
|
2766
|
+
*/
|
|
2767
|
+
isConnected(): boolean;
|
|
2768
|
+
/**
|
|
2769
|
+
* Get connected node IDs.
|
|
2770
|
+
* Returns ['http'] when connected, [] when not.
|
|
2771
|
+
*/
|
|
2772
|
+
getConnectedNodes(): string[];
|
|
2773
|
+
/**
|
|
2774
|
+
* Subscribe to connection events.
|
|
2775
|
+
*/
|
|
2776
|
+
on(event: ConnectionProviderEvent, handler: ConnectionEventHandler): void;
|
|
2777
|
+
/**
|
|
2778
|
+
* Unsubscribe from connection events.
|
|
2779
|
+
*/
|
|
2780
|
+
off(event: ConnectionProviderEvent, handler: ConnectionEventHandler): void;
|
|
2781
|
+
/**
|
|
2782
|
+
* Send data via the HTTP sync provider.
|
|
2783
|
+
*
|
|
2784
|
+
* Deserializes the msgpackr binary to extract the message type and routes:
|
|
2785
|
+
* - OP_BATCH / CLIENT_OP: queued as operations for next poll
|
|
2786
|
+
* - AUTH: silently ignored (auth via HTTP header)
|
|
2787
|
+
* - SYNC_INIT: silently ignored (HTTP uses timestamp-based deltas)
|
|
2788
|
+
* - QUERY_SUB: queued as one-shot query for next poll
|
|
2789
|
+
* - All other types: silently dropped with debug log
|
|
2790
|
+
*/
|
|
2791
|
+
send(data: ArrayBuffer | Uint8Array, _key?: string): void;
|
|
2792
|
+
/**
|
|
2793
|
+
* Close the HTTP sync provider.
|
|
2794
|
+
* Stops the polling loop, clears queued operations, and sets disconnected state.
|
|
2795
|
+
*/
|
|
2796
|
+
close(): Promise<void>;
|
|
2797
|
+
/**
|
|
2798
|
+
* Update the auth token (e.g., after token refresh).
|
|
2799
|
+
*/
|
|
2800
|
+
setAuthToken(token: string): void;
|
|
2801
|
+
/**
|
|
2802
|
+
* Send an HTTP sync request with queued operations and receive deltas.
|
|
2803
|
+
*/
|
|
2804
|
+
private doSyncRequest;
|
|
2805
|
+
/**
|
|
2806
|
+
* Start the polling loop.
|
|
2807
|
+
*/
|
|
2808
|
+
private startPolling;
|
|
2809
|
+
/**
|
|
2810
|
+
* Stop the polling loop.
|
|
2811
|
+
*/
|
|
2812
|
+
private stopPolling;
|
|
2813
|
+
/**
|
|
2814
|
+
* Emit an event to all listeners.
|
|
2815
|
+
*/
|
|
2816
|
+
private emit;
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2819
|
+
/**
|
|
2820
|
+
* Configuration for AutoConnectionProvider.
|
|
2821
|
+
*/
|
|
2822
|
+
interface AutoConnectionProviderConfig {
|
|
2823
|
+
/** Server URL (ws:// or http://) */
|
|
2824
|
+
url: string;
|
|
2825
|
+
/** Client identifier */
|
|
2826
|
+
clientId: string;
|
|
2827
|
+
/** Hybrid Logical Clock instance */
|
|
2828
|
+
hlc: HLC;
|
|
2829
|
+
/** Max WebSocket connection attempts before falling back to HTTP (default: 3) */
|
|
2830
|
+
maxWsAttempts?: number;
|
|
2831
|
+
/** JWT auth token */
|
|
2832
|
+
authToken?: string;
|
|
2833
|
+
/** Skip WebSocket and go HTTP-only */
|
|
2834
|
+
httpOnly?: boolean;
|
|
2835
|
+
/** HTTP polling interval in ms (default: 5000) */
|
|
2836
|
+
httpPollIntervalMs?: number;
|
|
2837
|
+
/** Map names to sync via HTTP */
|
|
2838
|
+
syncMaps?: string[];
|
|
2839
|
+
/** Custom fetch implementation for HTTP mode */
|
|
2840
|
+
fetchImpl?: typeof fetch;
|
|
2841
|
+
}
|
|
2842
|
+
/**
|
|
2843
|
+
* AutoConnectionProvider implements protocol negotiation by trying WebSocket
|
|
2844
|
+
* first and falling back to HTTP sync when WebSocket connection fails.
|
|
2845
|
+
*
|
|
2846
|
+
* This enables seamless deployment in both traditional server environments
|
|
2847
|
+
* (using WebSockets) and serverless environments (using HTTP polling).
|
|
2848
|
+
*/
|
|
2849
|
+
declare class AutoConnectionProvider implements IConnectionProvider {
|
|
2850
|
+
private readonly config;
|
|
2851
|
+
private readonly maxWsAttempts;
|
|
2852
|
+
/** The active underlying provider */
|
|
2853
|
+
private activeProvider;
|
|
2854
|
+
/** Whether we're using HTTP mode */
|
|
2855
|
+
private isHttpMode;
|
|
2856
|
+
private listeners;
|
|
2857
|
+
constructor(config: AutoConnectionProviderConfig);
|
|
2858
|
+
/**
|
|
2859
|
+
* Connect using WebSocket first, falling back to HTTP after maxWsAttempts failures.
|
|
2860
|
+
* If httpOnly is true, skips WebSocket entirely.
|
|
2861
|
+
*/
|
|
2862
|
+
connect(): Promise<void>;
|
|
2863
|
+
/**
|
|
2864
|
+
* Connect using HTTP sync provider.
|
|
2865
|
+
*/
|
|
2866
|
+
private connectHttp;
|
|
2867
|
+
getConnection(key: string): WebSocket;
|
|
2868
|
+
getAnyConnection(): WebSocket;
|
|
2869
|
+
isConnected(): boolean;
|
|
2870
|
+
getConnectedNodes(): string[];
|
|
2871
|
+
on(event: ConnectionProviderEvent, handler: ConnectionEventHandler): void;
|
|
2872
|
+
off(event: ConnectionProviderEvent, handler: ConnectionEventHandler): void;
|
|
2873
|
+
send(data: ArrayBuffer | Uint8Array, key?: string): void;
|
|
2874
|
+
/**
|
|
2875
|
+
* Close the active underlying provider.
|
|
2876
|
+
*/
|
|
2877
|
+
close(): Promise<void>;
|
|
2878
|
+
/**
|
|
2879
|
+
* Whether currently using HTTP mode.
|
|
2880
|
+
*/
|
|
2881
|
+
isUsingHttp(): boolean;
|
|
2882
|
+
/**
|
|
2883
|
+
* Proxy events from the underlying provider to our listeners.
|
|
2884
|
+
*/
|
|
2885
|
+
private proxyEvents;
|
|
2886
|
+
/**
|
|
2887
|
+
* Convert a URL to WebSocket URL format.
|
|
2888
|
+
*/
|
|
2889
|
+
private toWsUrl;
|
|
2890
|
+
/**
|
|
2891
|
+
* Convert a URL to HTTP URL format.
|
|
2892
|
+
*/
|
|
2893
|
+
private toHttpUrl;
|
|
2894
|
+
}
|
|
2895
|
+
|
|
2695
2896
|
declare const logger: pino.Logger<never, boolean>;
|
|
2696
2897
|
|
|
2697
|
-
export { type BackoffConfig, type BackpressureConfig, BackpressureError, type BackpressureStatus, type BackpressureStrategy, type BackpressureThresholdEvent, type ChangeEvent, ChangeTracker, type CircuitState, ClusterClient, type ClusterClientEvents, type ClusterRoutingMode, ConflictResolverClient, type ConnectionEventHandler, ConnectionPool, type ConnectionPoolEvents, type ConnectionProviderEvent, type CursorStatus, DEFAULT_BACKPRESSURE_CONFIG, DEFAULT_CLUSTER_CONFIG, EncryptedStorageAdapter, EventJournalReader, type HeartbeatConfig, type HybridQueryFilter, HybridQueryHandle, type HybridResultItem, type HybridResultSource, type IConnectionProvider, IDBAdapter, type IStorageAdapter, type JournalEventData, type JournalSubscribeOptions, type OpLogEntry, type OperationDroppedEvent, PNCounterHandle, type PaginationInfo, PartitionRouter, type PartitionRouterEvents, type QueryFilter, QueryHandle, type QueryResultItem, type QueryResultSource, type RegisterResult, type ResolverInfo, type RoutingMetrics, type RoutingResult, SearchHandle, type SearchResult, type SearchResultsCallback, SingleServerProvider, type SingleServerProviderConfig, type StateChangeEvent, type StateChangeListener, SyncEngine, type SyncEngineConfig, SyncState, SyncStateMachine, type SyncStateMachineConfig, TopGun, TopGunClient, type TopGunClientConfig, type TopGunClusterConfig, type TopicCallback, TopicHandle, VALID_TRANSITIONS, isValidTransition, logger };
|
|
2898
|
+
export { AutoConnectionProvider, type AutoConnectionProviderConfig, type BackoffConfig, type BackpressureConfig, BackpressureError, type BackpressureStatus, type BackpressureStrategy, type BackpressureThresholdEvent, type ChangeEvent, ChangeTracker, type CircuitState, ClusterClient, type ClusterClientEvents, type ClusterRoutingMode, ConflictResolverClient, type ConnectionEventHandler, ConnectionPool, type ConnectionPoolEvents, type ConnectionProviderEvent, type CursorStatus, DEFAULT_BACKPRESSURE_CONFIG, DEFAULT_CLUSTER_CONFIG, EncryptedStorageAdapter, EventJournalReader, type HeartbeatConfig, HttpSyncProvider, type HttpSyncProviderConfig, type HybridQueryFilter, HybridQueryHandle, type HybridResultItem, type HybridResultSource, type IConnectionProvider, IDBAdapter, type IStorageAdapter, type JournalEventData, type JournalSubscribeOptions, type OpLogEntry, type OperationDroppedEvent, PNCounterHandle, type PaginationInfo, PartitionRouter, type PartitionRouterEvents, type QueryFilter, QueryHandle, type QueryResultItem, type QueryResultSource, type RegisterResult, type ResolverInfo, type RoutingMetrics, type RoutingResult, SearchHandle, type SearchResult, type SearchResultsCallback, SingleServerProvider, type SingleServerProviderConfig, type StateChangeEvent, type StateChangeListener, SyncEngine, type SyncEngineConfig, SyncState, SyncStateMachine, type SyncStateMachineConfig, TopGun, TopGunClient, type TopGunClientConfig, type TopGunClusterConfig, type TopicCallback, TopicHandle, VALID_TRANSITIONS, isValidTransition, logger };
|
package/dist/index.d.ts
CHANGED
|
@@ -2692,6 +2692,207 @@ declare class SingleServerProvider implements IConnectionProvider {
|
|
|
2692
2692
|
resetReconnectAttempts(): void;
|
|
2693
2693
|
}
|
|
2694
2694
|
|
|
2695
|
+
/**
|
|
2696
|
+
* Configuration for HttpSyncProvider.
|
|
2697
|
+
*/
|
|
2698
|
+
interface HttpSyncProviderConfig {
|
|
2699
|
+
/** HTTP URL of the TopGun server (e.g., 'http://localhost:8080') */
|
|
2700
|
+
url: string;
|
|
2701
|
+
/** Client identifier for the server to track HLC state */
|
|
2702
|
+
clientId: string;
|
|
2703
|
+
/** Hybrid Logical Clock instance for causality tracking */
|
|
2704
|
+
hlc: HLC;
|
|
2705
|
+
/** JWT auth token for Authorization header */
|
|
2706
|
+
authToken?: string;
|
|
2707
|
+
/** Polling interval in milliseconds (default: 5000) */
|
|
2708
|
+
pollIntervalMs?: number;
|
|
2709
|
+
/** HTTP request timeout in milliseconds (default: 30000) */
|
|
2710
|
+
requestTimeoutMs?: number;
|
|
2711
|
+
/** Map names to sync deltas for on each poll */
|
|
2712
|
+
syncMaps?: string[];
|
|
2713
|
+
/** Custom fetch implementation for testing or platform compatibility */
|
|
2714
|
+
fetchImpl?: typeof fetch;
|
|
2715
|
+
}
|
|
2716
|
+
/**
|
|
2717
|
+
* HTTP-based connection provider for serverless environments.
|
|
2718
|
+
*
|
|
2719
|
+
* Implements IConnectionProvider by translating WebSocket-style send() calls
|
|
2720
|
+
* into queued operations that are flushed via HTTP POST /sync at regular
|
|
2721
|
+
* polling intervals. Responses are translated back into synthetic message
|
|
2722
|
+
* events that SyncEngine understands.
|
|
2723
|
+
*
|
|
2724
|
+
* This provider is completely stateless on the server side -- each request
|
|
2725
|
+
* carries the client's HLC state and the server computes deltas without
|
|
2726
|
+
* maintaining per-client state.
|
|
2727
|
+
*/
|
|
2728
|
+
declare class HttpSyncProvider implements IConnectionProvider {
|
|
2729
|
+
private readonly url;
|
|
2730
|
+
private readonly clientId;
|
|
2731
|
+
private readonly hlc;
|
|
2732
|
+
private readonly pollIntervalMs;
|
|
2733
|
+
private readonly requestTimeoutMs;
|
|
2734
|
+
private readonly syncMaps;
|
|
2735
|
+
private readonly fetchImpl;
|
|
2736
|
+
private authToken;
|
|
2737
|
+
private listeners;
|
|
2738
|
+
private pollTimer;
|
|
2739
|
+
/** Queued operations to send on next poll */
|
|
2740
|
+
private pendingOperations;
|
|
2741
|
+
/** Queued one-shot queries to send on next poll */
|
|
2742
|
+
private pendingQueries;
|
|
2743
|
+
/** Per-map last sync timestamps for delta tracking */
|
|
2744
|
+
private lastSyncTimestamps;
|
|
2745
|
+
/** Whether the last HTTP request succeeded */
|
|
2746
|
+
private connected;
|
|
2747
|
+
/** Whether we were previously connected (for reconnected event) */
|
|
2748
|
+
private wasConnected;
|
|
2749
|
+
constructor(config: HttpSyncProviderConfig);
|
|
2750
|
+
/**
|
|
2751
|
+
* Connect by sending an initial sync request to verify auth and get state.
|
|
2752
|
+
*/
|
|
2753
|
+
connect(): Promise<void>;
|
|
2754
|
+
/**
|
|
2755
|
+
* Get connection for a specific key.
|
|
2756
|
+
* HTTP mode does not expose raw WebSocket connections.
|
|
2757
|
+
*/
|
|
2758
|
+
getConnection(_key: string): WebSocket;
|
|
2759
|
+
/**
|
|
2760
|
+
* Get any available connection.
|
|
2761
|
+
* HTTP mode does not expose raw WebSocket connections.
|
|
2762
|
+
*/
|
|
2763
|
+
getAnyConnection(): WebSocket;
|
|
2764
|
+
/**
|
|
2765
|
+
* Check if connected (last HTTP request succeeded).
|
|
2766
|
+
*/
|
|
2767
|
+
isConnected(): boolean;
|
|
2768
|
+
/**
|
|
2769
|
+
* Get connected node IDs.
|
|
2770
|
+
* Returns ['http'] when connected, [] when not.
|
|
2771
|
+
*/
|
|
2772
|
+
getConnectedNodes(): string[];
|
|
2773
|
+
/**
|
|
2774
|
+
* Subscribe to connection events.
|
|
2775
|
+
*/
|
|
2776
|
+
on(event: ConnectionProviderEvent, handler: ConnectionEventHandler): void;
|
|
2777
|
+
/**
|
|
2778
|
+
* Unsubscribe from connection events.
|
|
2779
|
+
*/
|
|
2780
|
+
off(event: ConnectionProviderEvent, handler: ConnectionEventHandler): void;
|
|
2781
|
+
/**
|
|
2782
|
+
* Send data via the HTTP sync provider.
|
|
2783
|
+
*
|
|
2784
|
+
* Deserializes the msgpackr binary to extract the message type and routes:
|
|
2785
|
+
* - OP_BATCH / CLIENT_OP: queued as operations for next poll
|
|
2786
|
+
* - AUTH: silently ignored (auth via HTTP header)
|
|
2787
|
+
* - SYNC_INIT: silently ignored (HTTP uses timestamp-based deltas)
|
|
2788
|
+
* - QUERY_SUB: queued as one-shot query for next poll
|
|
2789
|
+
* - All other types: silently dropped with debug log
|
|
2790
|
+
*/
|
|
2791
|
+
send(data: ArrayBuffer | Uint8Array, _key?: string): void;
|
|
2792
|
+
/**
|
|
2793
|
+
* Close the HTTP sync provider.
|
|
2794
|
+
* Stops the polling loop, clears queued operations, and sets disconnected state.
|
|
2795
|
+
*/
|
|
2796
|
+
close(): Promise<void>;
|
|
2797
|
+
/**
|
|
2798
|
+
* Update the auth token (e.g., after token refresh).
|
|
2799
|
+
*/
|
|
2800
|
+
setAuthToken(token: string): void;
|
|
2801
|
+
/**
|
|
2802
|
+
* Send an HTTP sync request with queued operations and receive deltas.
|
|
2803
|
+
*/
|
|
2804
|
+
private doSyncRequest;
|
|
2805
|
+
/**
|
|
2806
|
+
* Start the polling loop.
|
|
2807
|
+
*/
|
|
2808
|
+
private startPolling;
|
|
2809
|
+
/**
|
|
2810
|
+
* Stop the polling loop.
|
|
2811
|
+
*/
|
|
2812
|
+
private stopPolling;
|
|
2813
|
+
/**
|
|
2814
|
+
* Emit an event to all listeners.
|
|
2815
|
+
*/
|
|
2816
|
+
private emit;
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2819
|
+
/**
|
|
2820
|
+
* Configuration for AutoConnectionProvider.
|
|
2821
|
+
*/
|
|
2822
|
+
interface AutoConnectionProviderConfig {
|
|
2823
|
+
/** Server URL (ws:// or http://) */
|
|
2824
|
+
url: string;
|
|
2825
|
+
/** Client identifier */
|
|
2826
|
+
clientId: string;
|
|
2827
|
+
/** Hybrid Logical Clock instance */
|
|
2828
|
+
hlc: HLC;
|
|
2829
|
+
/** Max WebSocket connection attempts before falling back to HTTP (default: 3) */
|
|
2830
|
+
maxWsAttempts?: number;
|
|
2831
|
+
/** JWT auth token */
|
|
2832
|
+
authToken?: string;
|
|
2833
|
+
/** Skip WebSocket and go HTTP-only */
|
|
2834
|
+
httpOnly?: boolean;
|
|
2835
|
+
/** HTTP polling interval in ms (default: 5000) */
|
|
2836
|
+
httpPollIntervalMs?: number;
|
|
2837
|
+
/** Map names to sync via HTTP */
|
|
2838
|
+
syncMaps?: string[];
|
|
2839
|
+
/** Custom fetch implementation for HTTP mode */
|
|
2840
|
+
fetchImpl?: typeof fetch;
|
|
2841
|
+
}
|
|
2842
|
+
/**
|
|
2843
|
+
* AutoConnectionProvider implements protocol negotiation by trying WebSocket
|
|
2844
|
+
* first and falling back to HTTP sync when WebSocket connection fails.
|
|
2845
|
+
*
|
|
2846
|
+
* This enables seamless deployment in both traditional server environments
|
|
2847
|
+
* (using WebSockets) and serverless environments (using HTTP polling).
|
|
2848
|
+
*/
|
|
2849
|
+
declare class AutoConnectionProvider implements IConnectionProvider {
|
|
2850
|
+
private readonly config;
|
|
2851
|
+
private readonly maxWsAttempts;
|
|
2852
|
+
/** The active underlying provider */
|
|
2853
|
+
private activeProvider;
|
|
2854
|
+
/** Whether we're using HTTP mode */
|
|
2855
|
+
private isHttpMode;
|
|
2856
|
+
private listeners;
|
|
2857
|
+
constructor(config: AutoConnectionProviderConfig);
|
|
2858
|
+
/**
|
|
2859
|
+
* Connect using WebSocket first, falling back to HTTP after maxWsAttempts failures.
|
|
2860
|
+
* If httpOnly is true, skips WebSocket entirely.
|
|
2861
|
+
*/
|
|
2862
|
+
connect(): Promise<void>;
|
|
2863
|
+
/**
|
|
2864
|
+
* Connect using HTTP sync provider.
|
|
2865
|
+
*/
|
|
2866
|
+
private connectHttp;
|
|
2867
|
+
getConnection(key: string): WebSocket;
|
|
2868
|
+
getAnyConnection(): WebSocket;
|
|
2869
|
+
isConnected(): boolean;
|
|
2870
|
+
getConnectedNodes(): string[];
|
|
2871
|
+
on(event: ConnectionProviderEvent, handler: ConnectionEventHandler): void;
|
|
2872
|
+
off(event: ConnectionProviderEvent, handler: ConnectionEventHandler): void;
|
|
2873
|
+
send(data: ArrayBuffer | Uint8Array, key?: string): void;
|
|
2874
|
+
/**
|
|
2875
|
+
* Close the active underlying provider.
|
|
2876
|
+
*/
|
|
2877
|
+
close(): Promise<void>;
|
|
2878
|
+
/**
|
|
2879
|
+
* Whether currently using HTTP mode.
|
|
2880
|
+
*/
|
|
2881
|
+
isUsingHttp(): boolean;
|
|
2882
|
+
/**
|
|
2883
|
+
* Proxy events from the underlying provider to our listeners.
|
|
2884
|
+
*/
|
|
2885
|
+
private proxyEvents;
|
|
2886
|
+
/**
|
|
2887
|
+
* Convert a URL to WebSocket URL format.
|
|
2888
|
+
*/
|
|
2889
|
+
private toWsUrl;
|
|
2890
|
+
/**
|
|
2891
|
+
* Convert a URL to HTTP URL format.
|
|
2892
|
+
*/
|
|
2893
|
+
private toHttpUrl;
|
|
2894
|
+
}
|
|
2895
|
+
|
|
2695
2896
|
declare const logger: pino.Logger<never, boolean>;
|
|
2696
2897
|
|
|
2697
|
-
export { type BackoffConfig, type BackpressureConfig, BackpressureError, type BackpressureStatus, type BackpressureStrategy, type BackpressureThresholdEvent, type ChangeEvent, ChangeTracker, type CircuitState, ClusterClient, type ClusterClientEvents, type ClusterRoutingMode, ConflictResolverClient, type ConnectionEventHandler, ConnectionPool, type ConnectionPoolEvents, type ConnectionProviderEvent, type CursorStatus, DEFAULT_BACKPRESSURE_CONFIG, DEFAULT_CLUSTER_CONFIG, EncryptedStorageAdapter, EventJournalReader, type HeartbeatConfig, type HybridQueryFilter, HybridQueryHandle, type HybridResultItem, type HybridResultSource, type IConnectionProvider, IDBAdapter, type IStorageAdapter, type JournalEventData, type JournalSubscribeOptions, type OpLogEntry, type OperationDroppedEvent, PNCounterHandle, type PaginationInfo, PartitionRouter, type PartitionRouterEvents, type QueryFilter, QueryHandle, type QueryResultItem, type QueryResultSource, type RegisterResult, type ResolverInfo, type RoutingMetrics, type RoutingResult, SearchHandle, type SearchResult, type SearchResultsCallback, SingleServerProvider, type SingleServerProviderConfig, type StateChangeEvent, type StateChangeListener, SyncEngine, type SyncEngineConfig, SyncState, SyncStateMachine, type SyncStateMachineConfig, TopGun, TopGunClient, type TopGunClientConfig, type TopGunClusterConfig, type TopicCallback, TopicHandle, VALID_TRANSITIONS, isValidTransition, logger };
|
|
2898
|
+
export { AutoConnectionProvider, type AutoConnectionProviderConfig, type BackoffConfig, type BackpressureConfig, BackpressureError, type BackpressureStatus, type BackpressureStrategy, type BackpressureThresholdEvent, type ChangeEvent, ChangeTracker, type CircuitState, ClusterClient, type ClusterClientEvents, type ClusterRoutingMode, ConflictResolverClient, type ConnectionEventHandler, ConnectionPool, type ConnectionPoolEvents, type ConnectionProviderEvent, type CursorStatus, DEFAULT_BACKPRESSURE_CONFIG, DEFAULT_CLUSTER_CONFIG, EncryptedStorageAdapter, EventJournalReader, type HeartbeatConfig, HttpSyncProvider, type HttpSyncProviderConfig, type HybridQueryFilter, HybridQueryHandle, type HybridResultItem, type HybridResultSource, type IConnectionProvider, IDBAdapter, type IStorageAdapter, type JournalEventData, type JournalSubscribeOptions, type OpLogEntry, type OperationDroppedEvent, PNCounterHandle, type PaginationInfo, PartitionRouter, type PartitionRouterEvents, type QueryFilter, QueryHandle, type QueryResultItem, type QueryResultSource, type RegisterResult, type ResolverInfo, type RoutingMetrics, type RoutingResult, SearchHandle, type SearchResult, type SearchResultsCallback, SingleServerProvider, type SingleServerProviderConfig, type StateChangeEvent, type StateChangeListener, SyncEngine, type SyncEngineConfig, SyncState, SyncStateMachine, type SyncStateMachineConfig, TopGun, TopGunClient, type TopGunClientConfig, type TopGunClusterConfig, type TopicCallback, TopicHandle, VALID_TRANSITIONS, isValidTransition, logger };
|