@aws-amplify/pubsub 4.5.8-unstable.2 → 4.5.8

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.5.8](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/pubsub@4.5.7...@aws-amplify/pubsub@4.5.8) (2022-10-25)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **@aws-amplify/datastore:** introduce "settlement" guarantees to stop() and clear() ([#10450](https://github.com/aws-amplify/amplify-js/issues/10450)) ([16c535b](https://github.com/aws-amplify/amplify-js/commit/16c535beda9386a027c2805f29a359fbeb8bac15)), closes [#10449](https://github.com/aws-amplify/amplify-js/issues/10449)
12
+
13
+
14
+
15
+
16
+
6
17
  ## [4.5.7](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/pubsub@4.5.6...@aws-amplify/pubsub@4.5.7) (2022-10-14)
7
18
 
8
19
  **Note:** Version bump only for package @aws-amplify/pubsub
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/pubsub",
3
- "version": "4.5.8-unstable.2+89bdeb1e4",
3
+ "version": "4.5.8",
4
4
  "description": "Pubsub category of aws-amplify",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib-esm/index.js",
@@ -45,9 +45,9 @@
45
45
  "cpx": "^1.5.0"
46
46
  },
47
47
  "dependencies": {
48
- "@aws-amplify/auth": "4.6.11-unstable.2+89bdeb1e4",
49
- "@aws-amplify/cache": "4.0.60-unstable.2+89bdeb1e4",
50
- "@aws-amplify/core": "4.7.9-unstable.2+89bdeb1e4",
48
+ "@aws-amplify/auth": "4.6.11",
49
+ "@aws-amplify/cache": "4.0.60",
50
+ "@aws-amplify/core": "4.7.9",
51
51
  "graphql": "15.8.0",
52
52
  "paho-mqtt": "^1.1.0",
53
53
  "uuid": "^3.2.1",
@@ -103,5 +103,5 @@
103
103
  "lib-esm"
104
104
  ]
105
105
  },
106
- "gitHead": "89bdeb1e4ec45c1a34e7dfe960b341de99906ed3"
106
+ "gitHead": "be5bf2dc68c9c011c3876f003c14bc98b392c82d"
107
107
  }
@@ -1,21 +0,0 @@
1
- import Observable from 'zen-observable-ts';
2
- import { MqttOverWSProvider } from './MqttOverWSProvider';
3
- /**
4
- * @deprecated Unused, all usecases have migrated to AWSAppSyncRealtimeProvider
5
- */
6
- export declare class AWSAppSyncProvider extends MqttOverWSProvider {
7
- protected get endpoint(): void;
8
- getProviderName(): string;
9
- publish(topics: string[] | string, msg: any, options?: any): Promise<void>;
10
- private _cleanUp;
11
- private _cleanUpForTopic;
12
- onDisconnect({ clientId, errorCode, ...args }: {
13
- [x: string]: any;
14
- clientId: any;
15
- errorCode: any;
16
- }): void;
17
- private _topicClient;
18
- private _topicAlias;
19
- protected disconnect(clientId: string): Promise<void>;
20
- subscribe(topics: string[] | string, options?: any): Observable<any>;
21
- }
@@ -1,67 +0,0 @@
1
- import Observable, { ZenObservable } from 'zen-observable-ts';
2
- import { ProviderOptions } from '../../types/Provider';
3
- import { GRAPHQL_AUTH_MODE } from '@aws-amplify/auth';
4
- import { AbstractPubSubProvider } from '../PubSubProvider';
5
- import { SUBSCRIPTION_STATUS } from '../constants';
6
- export declare type ObserverQuery = {
7
- observer: ZenObservable.SubscriptionObserver<any>;
8
- query: string;
9
- variables: object;
10
- subscriptionState: SUBSCRIPTION_STATUS;
11
- subscriptionReadyCallback?: Function;
12
- subscriptionFailedCallback?: Function;
13
- startAckTimeoutId?: ReturnType<typeof setTimeout>;
14
- };
15
- declare type GraphqlAuthModes = keyof typeof GRAPHQL_AUTH_MODE;
16
- export interface AWSAppSyncRealTimeProviderOptions extends ProviderOptions {
17
- appSyncGraphqlEndpoint?: string;
18
- authenticationType?: GraphqlAuthModes;
19
- query?: string;
20
- variables?: object;
21
- apiKey?: string;
22
- region?: string;
23
- graphql_headers?: () => {} | (() => Promise<{}>);
24
- additionalHeaders?: {
25
- [key: string]: string;
26
- };
27
- }
28
- export declare class AWSAppSyncRealTimeProvider extends AbstractPubSubProvider {
29
- private awsRealTimeSocket?;
30
- private socketStatus;
31
- private keepAliveTimeoutId?;
32
- private keepAliveTimeout;
33
- private keepAliveAlertTimeoutId?;
34
- private subscriptionObserverMap;
35
- private promiseArray;
36
- private readonly connectionStateMonitor;
37
- constructor(options?: ProviderOptions);
38
- getNewWebSocket(url: any, protocol: any): WebSocket;
39
- getProviderName(): string;
40
- newClient(): Promise<any>;
41
- publish(_topics: string[] | string, _msg: any, _options?: any): Promise<void>;
42
- private isCustomDomain;
43
- subscribe(_topics: string[] | string, options?: AWSAppSyncRealTimeProviderOptions): Observable<any>;
44
- protected get isSSLEnabled(): boolean;
45
- private _startSubscriptionWithAWSAppSyncRealTime;
46
- private _waitForSubscriptionToBeConnected;
47
- private _sendUnsubscriptionMessage;
48
- private _removeSubscriptionObserver;
49
- private _closeSocketIfRequired;
50
- private _handleIncomingSubscriptionMessage;
51
- private _errorDisconnect;
52
- private _timeoutStartSubscriptionAck;
53
- private _initializeWebSocketConnection;
54
- private _initializeRetryableHandshake;
55
- private _initializeHandshake;
56
- private _awsRealTimeHeaderBasedAuth;
57
- private _awsRealTimeCUPHeader;
58
- private _awsRealTimeOPENIDHeader;
59
- private _awsRealTimeApiKeyHeader;
60
- private _awsRealTimeIAMHeader;
61
- private _customAuthHeader;
62
- /**
63
- * @private
64
- */
65
- _ensureCredentials(): any;
66
- }
67
- export {};
@@ -1,11 +0,0 @@
1
- import { MqttOverWSProvider, MqttProviderOptions } from './MqttOverWSProvider';
2
- export interface AWSIoTProviderOptions extends MqttProviderOptions {
3
- aws_pubsub_region?: string;
4
- aws_pubsub_endpoint?: string;
5
- }
6
- export declare class AWSIoTProvider extends MqttOverWSProvider {
7
- constructor(options?: AWSIoTProviderOptions);
8
- protected get region(): any;
9
- getProviderName(): string;
10
- protected get endpoint(): Promise<string>;
11
- }
@@ -1,43 +0,0 @@
1
- import Observable from 'zen-observable-ts';
2
- import { AbstractPubSubProvider } from './PubSubProvider';
3
- import { SubscriptionObserver } from '../types/PubSub';
4
- import { ProviderOptions } from '../types/Provider';
5
- export declare function mqttTopicMatch(filter: string, topic: string): boolean;
6
- export interface MqttProviderOptions extends ProviderOptions {
7
- clientId?: string;
8
- url?: string;
9
- }
10
- /**
11
- * @deprecated Migrated to MqttProviderOptions
12
- */
13
- export declare type MqttProvidertOptions = MqttProviderOptions;
14
- declare class ClientsQueue {
15
- private promises;
16
- get(clientId: string, clientFactory?: (input: string) => Promise<any>): Promise<any>;
17
- get allClients(): string[];
18
- remove(clientId: string): void;
19
- }
20
- export declare class MqttOverWSProvider extends AbstractPubSubProvider {
21
- private _clientsQueue;
22
- private readonly connectionStateMonitor;
23
- constructor(options?: MqttProviderOptions);
24
- protected get clientId(): any;
25
- protected get endpoint(): any;
26
- protected get clientsQueue(): ClientsQueue;
27
- protected get isSSLEnabled(): boolean;
28
- protected getTopicForValue(value: any): any;
29
- getProviderName(): string;
30
- onDisconnect({ clientId, errorCode, ...args }: {
31
- clientId?: string;
32
- errorCode?: number;
33
- }): void;
34
- newClient({ url, clientId }: MqttProviderOptions): Promise<any>;
35
- protected connect(clientId: string, options?: MqttProviderOptions): Promise<any>;
36
- protected disconnect(clientId: string): Promise<void>;
37
- publish(topics: string[] | string, msg: any): Promise<void>;
38
- protected _topicObservers: Map<string, Set<SubscriptionObserver<any>>>;
39
- protected _clientIdObservers: Map<string, Set<SubscriptionObserver<any>>>;
40
- private _onMessage;
41
- subscribe(topics: string[] | string, options?: MqttProviderOptions): Observable<any>;
42
- }
43
- export {};
@@ -1,13 +0,0 @@
1
- import Observable from 'zen-observable-ts';
2
- import { PubSubProvider, ProviderOptions } from '../types/Provider';
3
- export declare abstract class AbstractPubSubProvider implements PubSubProvider {
4
- private _config;
5
- constructor(options?: ProviderOptions);
6
- configure(config?: ProviderOptions): ProviderOptions;
7
- getCategory(): string;
8
- abstract getProviderName(): string;
9
- protected get options(): ProviderOptions;
10
- abstract newClient(clientOptions: ProviderOptions): Promise<any>;
11
- abstract publish(topics: string[] | string, msg: any, options?: ProviderOptions): void;
12
- abstract subscribe(topics: string[] | string, options?: ProviderOptions): Observable<any>;
13
- }
@@ -1,87 +0,0 @@
1
- export declare const MAX_DELAY_MS = 5000;
2
- export declare const NON_RETRYABLE_CODES: number[];
3
- export declare const CONNECTION_STATE_CHANGE = "ConnectionStateChange";
4
- export declare enum MESSAGE_TYPES {
5
- /**
6
- * Client -> Server message.
7
- * This message type is the first message after handshake and this will initialize AWS AppSync RealTime communication
8
- */
9
- GQL_CONNECTION_INIT = "connection_init",
10
- /**
11
- * Server -> Client message
12
- * This message type is in case there is an issue with AWS AppSync RealTime when establishing connection
13
- */
14
- GQL_CONNECTION_ERROR = "connection_error",
15
- /**
16
- * Server -> Client message.
17
- * This message type is for the ack response from AWS AppSync RealTime for GQL_CONNECTION_INIT message
18
- */
19
- GQL_CONNECTION_ACK = "connection_ack",
20
- /**
21
- * Client -> Server message.
22
- * This message type is for register subscriptions with AWS AppSync RealTime
23
- */
24
- GQL_START = "start",
25
- /**
26
- * Server -> Client message.
27
- * This message type is for the ack response from AWS AppSync RealTime for GQL_START message
28
- */
29
- GQL_START_ACK = "start_ack",
30
- /**
31
- * Server -> Client message.
32
- * This message type is for subscription message from AWS AppSync RealTime
33
- */
34
- GQL_DATA = "data",
35
- /**
36
- * Server -> Client message.
37
- * This message type helps the client to know is still receiving messages from AWS AppSync RealTime
38
- */
39
- GQL_CONNECTION_KEEP_ALIVE = "ka",
40
- /**
41
- * Client -> Server message.
42
- * This message type is for unregister subscriptions with AWS AppSync RealTime
43
- */
44
- GQL_STOP = "stop",
45
- /**
46
- * Server -> Client message.
47
- * This message type is for the ack response from AWS AppSync RealTime for GQL_STOP message
48
- */
49
- GQL_COMPLETE = "complete",
50
- /**
51
- * Server -> Client message.
52
- * This message type is for sending error messages from AWS AppSync RealTime to the client
53
- */
54
- GQL_ERROR = "error"
55
- }
56
- export declare enum SUBSCRIPTION_STATUS {
57
- PENDING = 0,
58
- CONNECTED = 1,
59
- FAILED = 2
60
- }
61
- export declare enum SOCKET_STATUS {
62
- CLOSED = 0,
63
- READY = 1,
64
- CONNECTING = 2
65
- }
66
- export declare const AMPLIFY_SYMBOL: Symbol;
67
- export declare const AWS_APPSYNC_REALTIME_HEADERS: {
68
- accept: string;
69
- 'content-encoding': string;
70
- 'content-type': string;
71
- };
72
- /**
73
- * Time in milleseconds to wait for GQL_CONNECTION_INIT message
74
- */
75
- export declare const CONNECTION_INIT_TIMEOUT = 15000;
76
- /**
77
- * Time in milleseconds to wait for GQL_START_ACK message
78
- */
79
- export declare const START_ACK_TIMEOUT = 15000;
80
- /**
81
- * Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message
82
- */
83
- export declare const DEFAULT_KEEP_ALIVE_TIMEOUT: number;
84
- /**
85
- * Default Time in milleseconds to alert for missed GQL_CONNECTION_KEEP_ALIVE message
86
- */
87
- export declare const DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT: number;
@@ -1,5 +0,0 @@
1
- export * from './PubSubProvider';
2
- export * from './AWSAppSyncProvider';
3
- export * from './AWSAppSyncRealTimeProvider';
4
- export * from './AWSIotProvider';
5
- export * from './MqttOverWSProvider';
package/lib/PubSub.d.ts DELETED
@@ -1,51 +0,0 @@
1
- import Observable from 'zen-observable-ts';
2
- import { PubSubProvider, PubSubOptions, ProviderOptions } from './types';
3
- export 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
- }
51
- export declare const PubSub: PubSubClass;
package/lib/index.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { PubSub } from './PubSub';
2
- export * from './Providers';
3
- export { CONNECTION_STATE_CHANGE } from './Providers/constants';
4
- export { ConnectionState, CONTROL_MSG } from './types';
5
- export { PubSub };
6
- /**
7
- * @deprecated use named import
8
- */
9
- export default PubSub;
@@ -1,18 +0,0 @@
1
- import Observable from 'zen-observable-ts';
2
- export interface PubSubOptions {
3
- [key: string]: any;
4
- }
5
- export interface ProviderOptions {
6
- [key: string]: any;
7
- }
8
- /**
9
- * @deprecated Migrated to ProviderOptions
10
- */
11
- export declare type ProvidertOptions = ProviderOptions;
12
- export interface PubSubProvider {
13
- configure(config: object): object;
14
- getCategory(): string;
15
- getProviderName(): string;
16
- publish(topics: string[] | string, msg: any, options?: ProviderOptions): void;
17
- subscribe(topics: string[] | string, options?: ProviderOptions): Observable<any>;
18
- }
@@ -1,24 +0,0 @@
1
- export interface SubscriptionObserver<T> {
2
- closed: boolean;
3
- next(value: T): void;
4
- error(errorValue: any): void;
5
- complete(): void;
6
- }
7
- export declare enum CONTROL_MSG {
8
- CONNECTION_CLOSED = "Connection closed",
9
- CONNECTION_FAILED = "Connection failed",
10
- REALTIME_SUBSCRIPTION_INIT_ERROR = "AppSync Realtime subscription init error",
11
- SUBSCRIPTION_ACK = "Subscription ack",
12
- TIMEOUT_DISCONNECT = "Timeout disconnect"
13
- }
14
- /** @enum {string} */
15
- export declare enum ConnectionState {
16
- Connected = "Connected",
17
- ConnectedPendingNetwork = "ConnectedPendingNetwork",
18
- ConnectionDisrupted = "ConnectionDisrupted",
19
- ConnectionDisruptedPendingNetwork = "ConnectionDisruptedPendingNetwork",
20
- Connecting = "Connecting",
21
- ConnectedPendingDisconnect = "ConnectedPendingDisconnect",
22
- Disconnected = "Disconnected",
23
- ConnectedPendingKeepAlive = "ConnectedPendingKeepAlive"
24
- }
@@ -1,2 +0,0 @@
1
- export * from './Provider';
2
- export * from './PubSub';
@@ -1,40 +0,0 @@
1
- import Observable from 'zen-observable-ts';
2
- import { ConnectionState } from '../types/PubSub';
3
- declare type LinkedConnectionState = 'connected' | 'disconnected';
4
- declare type LinkedHealthState = 'healthy' | 'unhealthy';
5
- declare type LinkedConnectionStates = {
6
- networkState: LinkedConnectionState;
7
- connectionState: LinkedConnectionState | 'connecting';
8
- intendedConnectionState: LinkedConnectionState;
9
- keepAliveState: LinkedHealthState;
10
- };
11
- export declare const CONNECTION_CHANGE: {
12
- [key in 'KEEP_ALIVE_MISSED' | 'KEEP_ALIVE' | 'CONNECTION_ESTABLISHED' | 'CONNECTION_FAILED' | 'CLOSING_CONNECTION' | 'OPENING_CONNECTION' | 'CLOSED' | 'ONLINE' | 'OFFLINE']: Partial<LinkedConnectionStates>;
13
- };
14
- export declare class ConnectionStateMonitor {
15
- /**
16
- * @private
17
- */
18
- private _linkedConnectionState;
19
- private _linkedConnectionStateObservable;
20
- private _linkedConnectionStateObserver;
21
- private _networkMonitoringSubscription?;
22
- constructor();
23
- /**
24
- * Turn network state monitoring on if it isn't on already
25
- */
26
- private enableNetworkMonitoring;
27
- /**
28
- * Turn network state monitoring off if it isn't off already
29
- */
30
- private disableNetworkMonitoring;
31
- /**
32
- * Get the observable that allows us to monitor the connection state
33
- *
34
- * @returns {Observable<ConnectionState>} - The observable that emits ConnectionState updates
35
- */
36
- get connectionStateObservable(): Observable<ConnectionState>;
37
- record(statusUpdates: Partial<LinkedConnectionStates>): void;
38
- private connectionStatesTranslator;
39
- }
40
- export {};
@@ -1,3 +0,0 @@
1
- export declare const ReachabilityMonitor: () => import("zen-observable-ts").default<{
2
- online: boolean;
3
- }>;
@@ -1,3 +0,0 @@
1
- export declare const ReachabilityMonitor: () => import("zen-observable-ts").default<{
2
- online: boolean;
3
- }>;