UNPKG

1.88 kBTypeScriptView Raw
1import Observable from 'zen-observable-ts';
2import { PubSubProvider, PubSubOptions, ProviderOptions } from './types';
3export declare class PubSubClass {
4 private _options;
5 private _pluggables;
6 /**
7 * Internal instance of AWSAppSyncProvider used by the API category to subscribe to AppSync
8 */
9 private _awsAppSyncProvider?;
10 /**
11 * Internal instance of AWSAppSyncRealTimeProvider used by the API category to subscribe to AppSync
12 */
13 private _awsAppSyncRealTimeProvider?;
14 /**
15 * Lazy instantiate AWSAppSyncProvider when it is required by the API category
16 */
17 private get awsAppSyncProvider();
18 /**
19 * Lazy instantiate AWSAppSyncRealTimeProvider when it is required by the API category
20 */
21 private get awsAppSyncRealTimeProvider();
22 /**
23 * Initialize PubSub with AWS configurations
24 *
25 * @param {PubSubOptions} options - Configuration object for PubSub
26 */
27 constructor(options?: PubSubOptions);
28 getModuleName(): string;
29 /**
30 * Configure PubSub part with configurations
31 *
32 * @param {PubSubOptions} config - Configuration for PubSub
33 * @return {Object} - The current configuration
34 */
35 configure(options: PubSubOptions): PubSubOptions;
36 /**
37 * add plugin into Analytics category
38 * @param {Object} pluggable - an instance of the plugin
39 */
40 addPluggable(pluggable: PubSubProvider): Promise<object>;
41 /**
42 * remove plugin from PubSub category
43 * @param providerName - the name of the plugin
44 */
45 removePluggable(providerName: string): void;
46 private getProviderByName;
47 private getProviders;
48 publish(topics: string[] | string, msg: any, options?: ProviderOptions): Promise<void[]>;
49 subscribe(topics: string[] | string, options?: ProviderOptions): Observable<any>;
50}
51export declare const PubSub: PubSubClass;