UNPKG

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