@aws-amplify/api-graphql 4.0.1-console-preview.67f944e.0 → 4.0.1-console-preview.0bbe168.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/lib/Providers/AWSAppSyncRealTimeProvider/index.d.ts +1 -1
- package/lib/Providers/AWSAppSyncRealTimeProvider/index.js +3 -3
- package/lib/tsconfig.tsbuildinfo +447 -221
- package/lib/types/PubSub.d.ts +2 -2
- package/lib/utils/ConnectionStateMonitor.d.ts +1 -1
- package/lib/utils/ConnectionStateMonitor.js +8 -7
- package/lib/utils/ReachabilityMonitor/index.d.ts +1 -3
- package/lib/utils/ReachabilityMonitor/index.native.d.ts +1 -3
- package/lib/utils/ReconnectionMonitor.d.ts +1 -1
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +1 -1
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js +1 -1
- package/lib-esm/tsconfig.tsbuildinfo +447 -221
- package/lib-esm/types/PubSub.d.ts +2 -2
- package/lib-esm/utils/ConnectionStateMonitor.d.ts +1 -1
- package/lib-esm/utils/ConnectionStateMonitor.js +7 -6
- package/lib-esm/utils/ReachabilityMonitor/index.d.ts +1 -3
- package/lib-esm/utils/ReachabilityMonitor/index.native.d.ts +1 -3
- package/lib-esm/utils/ReconnectionMonitor.d.ts +1 -1
- package/package.json +6 -10
- package/src/Providers/AWSAppSyncRealTimeProvider/index.ts +3 -3
- package/src/types/PubSub.ts +2 -4
- package/src/utils/ConnectionStateMonitor.ts +17 -13
- package/src/utils/ReconnectionMonitor.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Observer } from 'rxjs';
|
|
2
2
|
export interface SubscriptionObserver<T> {
|
|
3
3
|
closed: boolean;
|
|
4
4
|
next(value: T): void;
|
|
@@ -24,4 +24,4 @@ export declare enum ConnectionState {
|
|
|
24
24
|
ConnectedPendingKeepAlive = "ConnectedPendingKeepAlive"
|
|
25
25
|
}
|
|
26
26
|
export declare type PubSubContent = Record<string, unknown> | string;
|
|
27
|
-
export declare type PubSubContentObserver =
|
|
27
|
+
export declare type PubSubContentObserver = Observer<PubSubContent>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { __assign } from "tslib";
|
|
4
|
-
import Observable from '
|
|
4
|
+
import { Observable, map, filter } from 'rxjs';
|
|
5
5
|
import { ConnectionState } from '../types/PubSub';
|
|
6
6
|
import { ReachabilityMonitor } from './ReachabilityMonitor';
|
|
7
7
|
export var CONNECTION_CHANGE = {
|
|
@@ -82,14 +82,14 @@ var ConnectionStateMonitor = /** @class */ (function () {
|
|
|
82
82
|
// states without changing the overall connection state.
|
|
83
83
|
// After translating from linked states to ConnectionState, then remove any duplicates
|
|
84
84
|
return this._linkedConnectionStateObservable
|
|
85
|
-
.map(function (value) {
|
|
85
|
+
.pipe(map(function (value) {
|
|
86
86
|
return _this.connectionStatesTranslator(value);
|
|
87
|
-
})
|
|
88
|
-
.filter(function (current) {
|
|
87
|
+
}))
|
|
88
|
+
.pipe(filter(function (current) {
|
|
89
89
|
var toInclude = current !== previous;
|
|
90
90
|
previous = current;
|
|
91
91
|
return toInclude;
|
|
92
|
-
});
|
|
92
|
+
}));
|
|
93
93
|
},
|
|
94
94
|
enumerable: true,
|
|
95
95
|
configurable: true
|
|
@@ -98,6 +98,7 @@ var ConnectionStateMonitor = /** @class */ (function () {
|
|
|
98
98
|
* Updates local connection state and emits the full state to the observer.
|
|
99
99
|
*/
|
|
100
100
|
ConnectionStateMonitor.prototype.record = function (statusUpdates) {
|
|
101
|
+
var _a;
|
|
101
102
|
// Maintain the network monitor
|
|
102
103
|
if (statusUpdates.intendedConnectionState === 'connected') {
|
|
103
104
|
this.enableNetworkMonitoring();
|
|
@@ -108,7 +109,7 @@ var ConnectionStateMonitor = /** @class */ (function () {
|
|
|
108
109
|
// Maintain the socket state
|
|
109
110
|
var newSocketStatus = __assign(__assign({}, this._linkedConnectionState), statusUpdates);
|
|
110
111
|
this._linkedConnectionState = __assign({}, newSocketStatus);
|
|
111
|
-
this._linkedConnectionStateObserver.next(this._linkedConnectionState);
|
|
112
|
+
(_a = this._linkedConnectionStateObserver) === null || _a === void 0 ? void 0 : _a.next(this._linkedConnectionState);
|
|
112
113
|
};
|
|
113
114
|
/*
|
|
114
115
|
* Translate the ConnectionState structure into a specific ConnectionState string literal union
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/api-graphql",
|
|
3
|
-
"version": "4.0.1-console-preview.
|
|
3
|
+
"version": "4.0.1-console-preview.0bbe168.0+0bbe168",
|
|
4
4
|
"description": "Api-graphql category of aws-amplify",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib-esm/index.js",
|
|
@@ -40,9 +40,6 @@
|
|
|
40
40
|
"url": "https://github.com/aws/aws-amplify/issues"
|
|
41
41
|
},
|
|
42
42
|
"homepage": "https://aws-amplify.github.io/",
|
|
43
|
-
"devDependencies": {
|
|
44
|
-
"@types/zen-observable": "^0.8.0"
|
|
45
|
-
},
|
|
46
43
|
"files": [
|
|
47
44
|
"lib",
|
|
48
45
|
"lib-esm",
|
|
@@ -50,15 +47,14 @@
|
|
|
50
47
|
"internals"
|
|
51
48
|
],
|
|
52
49
|
"dependencies": {
|
|
53
|
-
"@aws-amplify/api-rest": "4.0.1-console-preview.
|
|
54
|
-
"@aws-amplify/auth": "6.0.1-console-preview.
|
|
55
|
-
"@aws-amplify/core": "6.0.1-console-preview.
|
|
50
|
+
"@aws-amplify/api-rest": "4.0.1-console-preview.0bbe168.0+0bbe168",
|
|
51
|
+
"@aws-amplify/auth": "6.0.1-console-preview.0bbe168.0+0bbe168",
|
|
52
|
+
"@aws-amplify/core": "6.0.1-console-preview.0bbe168.0+0bbe168",
|
|
56
53
|
"@aws-sdk/types": "3.387.0",
|
|
57
54
|
"graphql": "15.8.0",
|
|
58
55
|
"rxjs": "^7.8.1",
|
|
59
56
|
"tslib": "^1.8.0",
|
|
60
|
-
"uuid": "^3.2.1"
|
|
61
|
-
"zen-observable-ts": "0.8.19"
|
|
57
|
+
"uuid": "^3.2.1"
|
|
62
58
|
},
|
|
63
59
|
"size-limit": [
|
|
64
60
|
{
|
|
@@ -113,5 +109,5 @@
|
|
|
113
109
|
"lib-esm"
|
|
114
110
|
]
|
|
115
111
|
},
|
|
116
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "0bbe168c66929877174b331c71f7666bb16529d6"
|
|
117
113
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import Observable,
|
|
3
|
+
import { Observable, SubscriptionLike } from 'rxjs';
|
|
4
4
|
import { GraphQLError } from 'graphql';
|
|
5
5
|
import * as url from 'url';
|
|
6
6
|
import { v4 as uuid } from 'uuid';
|
|
@@ -119,7 +119,7 @@ export class AWSAppSyncRealTimeProvider {
|
|
|
119
119
|
private connectionState: ConnectionState;
|
|
120
120
|
private readonly connectionStateMonitor = new ConnectionStateMonitor();
|
|
121
121
|
private readonly reconnectionMonitor = new ReconnectionMonitor();
|
|
122
|
-
private connectionStateMonitorSubscription:
|
|
122
|
+
private connectionStateMonitorSubscription: SubscriptionLike;
|
|
123
123
|
|
|
124
124
|
constructor(options: AWSAppSyncRealTimeProviderOptions = {}) {
|
|
125
125
|
// Monitor the connection state and pass changes along to Hub
|
|
@@ -242,7 +242,7 @@ export class AWSAppSyncRealTimeProvider {
|
|
|
242
242
|
}
|
|
243
243
|
};
|
|
244
244
|
|
|
245
|
-
let reconnectSubscription:
|
|
245
|
+
let reconnectSubscription: SubscriptionLike;
|
|
246
246
|
|
|
247
247
|
// Add an observable to the reconnection list to manage reconnection for this subscription
|
|
248
248
|
reconnectSubscription = new Observable(observer => {
|
package/src/types/PubSub.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { Observer } from 'rxjs';
|
|
5
4
|
export interface SubscriptionObserver<T> {
|
|
6
5
|
closed: boolean;
|
|
7
6
|
next(value: T): void;
|
|
@@ -54,5 +53,4 @@ export enum ConnectionState {
|
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
export type PubSubContent = Record<string, unknown> | string;
|
|
57
|
-
export type PubSubContentObserver =
|
|
58
|
-
ZenObservable.SubscriptionObserver<PubSubContent>;
|
|
56
|
+
export type PubSubContentObserver = Observer<PubSubContent>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import Observable,
|
|
4
|
+
import { Observable, Observer, SubscriptionLike, map, filter } from 'rxjs';
|
|
5
5
|
import { ConnectionState } from '../types/PubSub';
|
|
6
6
|
import { ReachabilityMonitor } from './ReachabilityMonitor';
|
|
7
7
|
|
|
@@ -50,9 +50,9 @@ export class ConnectionStateMonitor {
|
|
|
50
50
|
*/
|
|
51
51
|
private _linkedConnectionState: LinkedConnectionStates;
|
|
52
52
|
private _linkedConnectionStateObservable: Observable<LinkedConnectionStates>;
|
|
53
|
-
private _linkedConnectionStateObserver:
|
|
54
|
-
private _networkMonitoringSubscription?:
|
|
55
|
-
private _initialNetworkStateSubscription?:
|
|
53
|
+
private _linkedConnectionStateObserver: Observer<LinkedConnectionStates>;
|
|
54
|
+
private _networkMonitoringSubscription?: SubscriptionLike;
|
|
55
|
+
private _initialNetworkStateSubscription?: SubscriptionLike;
|
|
56
56
|
|
|
57
57
|
constructor() {
|
|
58
58
|
this._networkMonitoringSubscription = undefined;
|
|
@@ -121,14 +121,18 @@ export class ConnectionStateMonitor {
|
|
|
121
121
|
|
|
122
122
|
// After translating from linked states to ConnectionState, then remove any duplicates
|
|
123
123
|
return this._linkedConnectionStateObservable
|
|
124
|
-
.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
124
|
+
.pipe(
|
|
125
|
+
map(value => {
|
|
126
|
+
return this.connectionStatesTranslator(value);
|
|
127
|
+
})
|
|
128
|
+
)
|
|
129
|
+
.pipe(
|
|
130
|
+
filter(current => {
|
|
131
|
+
const toInclude = current !== previous;
|
|
132
|
+
previous = current;
|
|
133
|
+
return toInclude;
|
|
134
|
+
})
|
|
135
|
+
);
|
|
132
136
|
}
|
|
133
137
|
|
|
134
138
|
/*
|
|
@@ -150,7 +154,7 @@ export class ConnectionStateMonitor {
|
|
|
150
154
|
|
|
151
155
|
this._linkedConnectionState = { ...newSocketStatus };
|
|
152
156
|
|
|
153
|
-
this._linkedConnectionStateObserver
|
|
157
|
+
this._linkedConnectionStateObserver?.next(this._linkedConnectionState);
|
|
154
158
|
}
|
|
155
159
|
|
|
156
160
|
/*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { Observer } from '
|
|
3
|
+
import { Observer } from 'rxjs';
|
|
4
4
|
import { RECONNECT_DELAY, RECONNECT_INTERVAL } from '../Providers/constants';
|
|
5
5
|
|
|
6
6
|
export enum ReconnectEvent {
|