1 | import { Observable, Observer } from 'rxjs';
|
2 | export interface SubscriptionObserver<T> {
|
3 | closed: boolean;
|
4 | next(value: T): void;
|
5 | error(errorValue: any): void;
|
6 | complete(): void;
|
7 | }
|
8 | export declare enum CONTROL_MSG {
|
9 | CONNECTION_CLOSED = "Connection closed",
|
10 | CONNECTION_FAILED = "Connection failed",
|
11 | REALTIME_SUBSCRIPTION_INIT_ERROR = "AppSync Realtime subscription init error",
|
12 | SUBSCRIPTION_ACK = "Subscription ack",
|
13 | TIMEOUT_DISCONNECT = "Timeout disconnect"
|
14 | }
|
15 |
|
16 | export declare enum ConnectionState {
|
17 | Connected = "Connected",
|
18 | ConnectedPendingNetwork = "ConnectedPendingNetwork",
|
19 | ConnectionDisrupted = "ConnectionDisrupted",
|
20 | ConnectionDisruptedPendingNetwork = "ConnectionDisruptedPendingNetwork",
|
21 | Connecting = "Connecting",
|
22 | ConnectedPendingDisconnect = "ConnectedPendingDisconnect",
|
23 | Disconnected = "Disconnected",
|
24 | ConnectedPendingKeepAlive = "ConnectedPendingKeepAlive"
|
25 | }
|
26 | export type PubSubContent = Record<string | symbol, unknown>;
|
27 | export type PubSubContentObserver = Observer<PubSubContent>;
|
28 | export interface PubSubOptions {
|
29 | [key: string]: any;
|
30 | provider?: string | symbol;
|
31 | }
|
32 | export interface PubSubBase {
|
33 | configure(config: Record<string, unknown>): Record<string, unknown>;
|
34 | publish(input: PublishInput): void;
|
35 | subscribe(input: SubscribeInput): Observable<PubSubContent>;
|
36 | }
|
37 | export interface PublishInput {
|
38 | topics: string[] | string;
|
39 | message: PubSubContent;
|
40 | options?: PubSubOptions;
|
41 | }
|
42 | export interface SubscribeInput {
|
43 | topics: string[] | string;
|
44 | options?: PubSubOptions;
|
45 | }
|