@aws-amplify/pubsub 4.4.10-next.13 → 4.4.10-next.32
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 +35 -0
- package/lib/.tsbuildinfo +3 -0
- package/lib/Providers/AWSAppSyncProvider.js +20 -102
- package/lib/Providers/AWSAppSyncProvider.js.map +1 -1
- package/lib/Providers/AWSAppSyncRealTimeProvider/index.js +41 -126
- package/lib/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -1
- package/lib/Providers/AWSIotProvider.js +4 -52
- package/lib/Providers/AWSIotProvider.js.map +1 -1
- package/lib/Providers/MqttOverWSProvider.js +28 -108
- package/lib/Providers/MqttOverWSProvider.js.map +1 -1
- package/lib/Providers/PubSubProvider.js +3 -13
- package/lib/Providers/PubSubProvider.js.map +1 -1
- package/lib/Providers/index.js +6 -8
- package/lib/Providers/index.js.map +1 -1
- package/lib/PubSub.js +6 -44
- package/lib/PubSub.js.map +1 -1
- package/lib/index.js +3 -9
- package/lib/index.js.map +1 -1
- package/lib/types/index.js +2 -4
- package/lib/types/index.js.map +1 -1
- package/lib/utils/ConnectionStateMonitor.js +4 -17
- package/lib/utils/ConnectionStateMonitor.js.map +1 -1
- package/lib/utils/ReachabilityMonitor/index.native.js +2 -4
- package/lib/utils/ReachabilityMonitor/index.native.js.map +1 -1
- package/lib-esm/.tsbuildinfo +3 -0
- package/lib-esm/Providers/AWSAppSyncProvider.js +1 -80
- package/lib-esm/Providers/AWSAppSyncProvider.js.map +1 -1
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js +3 -78
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -1
- package/lib-esm/Providers/AWSIotProvider.js +1 -49
- package/lib-esm/Providers/AWSIotProvider.js.map +1 -1
- package/lib-esm/Providers/MqttOverWSProvider.js +1 -71
- package/lib-esm/Providers/MqttOverWSProvider.js.map +1 -1
- package/lib-esm/Providers/PubSubProvider.js +1 -11
- package/lib-esm/Providers/PubSubProvider.js.map +1 -1
- package/lib-esm/PubSub.js +1 -36
- package/lib-esm/PubSub.js.map +1 -1
- package/lib-esm/index.d.ts +1 -6
- package/lib-esm/index.js +1 -6
- package/lib-esm/index.js.map +1 -1
- package/lib-esm/utils/ConnectionStateMonitor.js +1 -11
- package/lib-esm/utils/ConnectionStateMonitor.js.map +1 -1
- package/package.json +11 -5
- package/src/Providers/AWSAppSyncRealTimeProvider/index.ts +2 -2
- package/src/index.ts +1 -10
- package/build.js +0 -5
- package/dist/aws-amplify-pubsub.js +0 -11304
- package/dist/aws-amplify-pubsub.js.map +0 -1
- package/dist/aws-amplify-pubsub.min.js +0 -11
- package/dist/aws-amplify-pubsub.min.js.map +0 -1
- package/index.js +0 -7
- package/lib/Providers/AWSAppSyncProvider.d.ts +0 -21
- package/lib/Providers/AWSAppSyncRealTimeProvider/index.d.ts +0 -75
- package/lib/Providers/AWSIotProvider.d.ts +0 -11
- package/lib/Providers/MqttOverWSProvider.d.ts +0 -45
- package/lib/Providers/PubSubProvider.d.ts +0 -13
- package/lib/Providers/constants.d.ts +0 -95
- package/lib/Providers/index.d.ts +0 -5
- package/lib/PubSub.d.ts +0 -51
- package/lib/index.d.ts +0 -9
- package/lib/types/Provider.d.ts +0 -18
- package/lib/types/PubSub.d.ts +0 -24
- package/lib/types/index.d.ts +0 -2
- package/lib/utils/ConnectionStateMonitor.d.ts +0 -41
- package/lib/utils/ReachabilityMonitor/index.d.ts +0 -3
- package/lib/utils/ReachabilityMonitor/index.native.d.ts +0 -3
- package/lib/utils/ReconnectionMonitor.d.ts +0 -29
- package/webpack.config.dev.js +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,41 @@
|
|
|
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.9](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/pubsub@4.5.8...@aws-amplify/pubsub@4.5.9) (2022-10-26)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @aws-amplify/pubsub
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [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)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **@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)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [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)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @aws-amplify/pubsub
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## [4.5.6](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/pubsub@4.5.5...@aws-amplify/pubsub@4.5.6) (2022-10-14)
|
|
34
|
+
|
|
35
|
+
**Note:** Version bump only for package @aws-amplify/pubsub
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
6
41
|
## [4.5.5](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/pubsub@4.5.3...@aws-amplify/pubsub@4.5.5) (2022-09-30)
|
|
7
42
|
|
|
8
43
|
|
package/lib/.tsbuildinfo
ADDED
|
@@ -1,89 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
16
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
17
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
18
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
19
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
20
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
21
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
25
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
26
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
27
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
28
|
-
function step(op) {
|
|
29
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
30
|
-
while (_) try {
|
|
31
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
32
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
33
|
-
switch (op[0]) {
|
|
34
|
-
case 0: case 1: t = op; break;
|
|
35
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
36
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
37
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
38
|
-
default:
|
|
39
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
40
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
41
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
42
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
43
|
-
if (t[2]) _.ops.pop();
|
|
44
|
-
_.trys.pop(); continue;
|
|
45
|
-
}
|
|
46
|
-
op = body.call(thisArg, _);
|
|
47
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
48
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
52
|
-
var t = {};
|
|
53
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
54
|
-
t[p] = s[p];
|
|
55
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
56
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
57
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
58
|
-
t[p[i]] = s[p[i]];
|
|
59
|
-
}
|
|
60
|
-
return t;
|
|
61
|
-
};
|
|
62
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
63
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
64
|
-
if (!m) return o;
|
|
65
|
-
var i = m.call(o), r, ar = [], e;
|
|
66
|
-
try {
|
|
67
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
68
|
-
}
|
|
69
|
-
catch (error) { e = { error: error }; }
|
|
70
|
-
finally {
|
|
71
|
-
try {
|
|
72
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
73
|
-
}
|
|
74
|
-
finally { if (e) throw e.error; }
|
|
75
|
-
}
|
|
76
|
-
return ar;
|
|
77
|
-
};
|
|
78
|
-
var __spread = (this && this.__spread) || function () {
|
|
79
|
-
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
80
|
-
return ar;
|
|
81
|
-
};
|
|
82
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
83
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
84
|
-
};
|
|
85
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
86
|
-
var
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var zen_observable_ts_1 = tslib_1.__importDefault(require("zen-observable-ts"));
|
|
87
5
|
var core_1 = require("@aws-amplify/core");
|
|
88
6
|
var MqttOverWSProvider_1 = require("./MqttOverWSProvider");
|
|
89
7
|
var logger = new core_1.ConsoleLogger('AWSAppSyncProvider');
|
|
@@ -91,7 +9,7 @@ var logger = new core_1.ConsoleLogger('AWSAppSyncProvider');
|
|
|
91
9
|
* @deprecated Unused, all usecases have migrated to AWSAppSyncRealtimeProvider
|
|
92
10
|
*/
|
|
93
11
|
var AWSAppSyncProvider = /** @class */ (function (_super) {
|
|
94
|
-
__extends(AWSAppSyncProvider, _super);
|
|
12
|
+
tslib_1.__extends(AWSAppSyncProvider, _super);
|
|
95
13
|
function AWSAppSyncProvider() {
|
|
96
14
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
97
15
|
_this._topicClient = new Map();
|
|
@@ -109,8 +27,8 @@ var AWSAppSyncProvider = /** @class */ (function (_super) {
|
|
|
109
27
|
return 'AWSAppSyncProvider';
|
|
110
28
|
};
|
|
111
29
|
AWSAppSyncProvider.prototype.publish = function (topics, msg, options) {
|
|
112
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
113
|
-
return __generator(this, function (_a) {
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
31
|
+
return tslib_1.__generator(this, function (_a) {
|
|
114
32
|
throw new Error('Operation not supported');
|
|
115
33
|
});
|
|
116
34
|
});
|
|
@@ -119,11 +37,11 @@ var AWSAppSyncProvider = /** @class */ (function (_super) {
|
|
|
119
37
|
var _this = this;
|
|
120
38
|
var topicsForClient = Array.from(this._topicClient.entries())
|
|
121
39
|
.filter(function (_a) {
|
|
122
|
-
var _b = __read(_a, 2), c = _b[1];
|
|
40
|
+
var _b = tslib_1.__read(_a, 2), c = _b[1];
|
|
123
41
|
return c.clientId === clientId;
|
|
124
42
|
})
|
|
125
43
|
.map(function (_a) {
|
|
126
|
-
var _b = __read(_a, 1), t = _b[0];
|
|
44
|
+
var _b = tslib_1.__read(_a, 1), t = _b[0];
|
|
127
45
|
return t;
|
|
128
46
|
});
|
|
129
47
|
topicsForClient.forEach(function (t) { return _this._cleanUpForTopic(t); });
|
|
@@ -134,15 +52,15 @@ var AWSAppSyncProvider = /** @class */ (function (_super) {
|
|
|
134
52
|
};
|
|
135
53
|
AWSAppSyncProvider.prototype.onDisconnect = function (_a) {
|
|
136
54
|
var _this = this;
|
|
137
|
-
var clientId = _a.clientId, errorCode = _a.errorCode, args = __rest(_a, ["clientId", "errorCode"]);
|
|
55
|
+
var clientId = _a.clientId, errorCode = _a.errorCode, args = tslib_1.__rest(_a, ["clientId", "errorCode"]);
|
|
138
56
|
if (errorCode !== 0) {
|
|
139
57
|
var topicsForClient = Array.from(this._topicClient.entries())
|
|
140
58
|
.filter(function (_a) {
|
|
141
|
-
var _b = __read(_a, 2), c = _b[1];
|
|
59
|
+
var _b = tslib_1.__read(_a, 2), c = _b[1];
|
|
142
60
|
return c.clientId === clientId;
|
|
143
61
|
})
|
|
144
62
|
.map(function (_a) {
|
|
145
|
-
var _b = __read(_a, 1), t = _b[0];
|
|
63
|
+
var _b = tslib_1.__read(_a, 1), t = _b[0];
|
|
146
64
|
return t;
|
|
147
65
|
});
|
|
148
66
|
topicsForClient.forEach(function (topic) {
|
|
@@ -159,9 +77,9 @@ var AWSAppSyncProvider = /** @class */ (function (_super) {
|
|
|
159
77
|
}
|
|
160
78
|
};
|
|
161
79
|
AWSAppSyncProvider.prototype.disconnect = function (clientId) {
|
|
162
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
163
81
|
var client;
|
|
164
|
-
return __generator(this, function (_a) {
|
|
82
|
+
return tslib_1.__generator(this, function (_a) {
|
|
165
83
|
switch (_a.label) {
|
|
166
84
|
case 0: return [4 /*yield*/, this.clientsQueue.get(clientId, function () { return null; })];
|
|
167
85
|
case 1:
|
|
@@ -181,10 +99,10 @@ var AWSAppSyncProvider = /** @class */ (function (_super) {
|
|
|
181
99
|
var result = new zen_observable_ts_1.default(function (observer) {
|
|
182
100
|
var targetTopics = [].concat(topics);
|
|
183
101
|
logger.debug('Subscribing to topic(s)', targetTopics.join(','));
|
|
184
|
-
(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
102
|
+
(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
185
103
|
var _a, mqttConnections, newSubscriptions, newAliases, map;
|
|
186
104
|
var _this = this;
|
|
187
|
-
return __generator(this, function (_b) {
|
|
105
|
+
return tslib_1.__generator(this, function (_b) {
|
|
188
106
|
switch (_b.label) {
|
|
189
107
|
case 0:
|
|
190
108
|
// Add these topics to map
|
|
@@ -196,11 +114,11 @@ var AWSAppSyncProvider = /** @class */ (function (_super) {
|
|
|
196
114
|
});
|
|
197
115
|
_a = options.mqttConnections, mqttConnections = _a === void 0 ? [] : _a, newSubscriptions = options.newSubscriptions;
|
|
198
116
|
newAliases = Object.entries(newSubscriptions).map(function (_a) {
|
|
199
|
-
var _b = __read(_a, 2), alias = _b[0], v = _b[1];
|
|
117
|
+
var _b = tslib_1.__read(_a, 2), alias = _b[0], v = _b[1];
|
|
200
118
|
return [v.topic, alias];
|
|
201
119
|
});
|
|
202
120
|
// Merge new aliases with old ones
|
|
203
|
-
this._topicAlias = new Map(__spread(Array.from(this._topicAlias.entries()), newAliases));
|
|
121
|
+
this._topicAlias = new Map(tslib_1.__spread(Array.from(this._topicAlias.entries()), newAliases));
|
|
204
122
|
map = Object.entries(targetTopics.reduce(function (acc, elem) {
|
|
205
123
|
var connectionInfoForTopic = mqttConnections.find(function (c) { return c.topics.indexOf(elem) > -1; });
|
|
206
124
|
if (connectionInfoForTopic) {
|
|
@@ -217,11 +135,11 @@ var AWSAppSyncProvider = /** @class */ (function (_super) {
|
|
|
217
135
|
}, {}));
|
|
218
136
|
// reconnect everything we have in the map
|
|
219
137
|
return [4 /*yield*/, Promise.all(map.map(function (_a) {
|
|
220
|
-
var _b = __read(_a, 2), clientId = _b[0], _c = _b[1], url = _c.url, topics = _c.topics;
|
|
221
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
138
|
+
var _b = tslib_1.__read(_a, 2), clientId = _b[0], _c = _b[1], url = _c.url, topics = _c.topics;
|
|
139
|
+
return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
222
140
|
var client, err_1;
|
|
223
141
|
var _this = this;
|
|
224
|
-
return __generator(this, function (_d) {
|
|
142
|
+
return tslib_1.__generator(this, function (_d) {
|
|
225
143
|
switch (_d.label) {
|
|
226
144
|
case 0:
|
|
227
145
|
client = null;
|
|
@@ -280,7 +198,7 @@ var AWSAppSyncProvider = /** @class */ (function (_super) {
|
|
|
280
198
|
var topic = _this.getTopicForValue(value);
|
|
281
199
|
var alias = _this._topicAlias.get(topic);
|
|
282
200
|
value.data = Object.entries(value.data).reduce(function (obj, _a) {
|
|
283
|
-
var _b = __read(_a, 2), origKey = _b[0], val = _b[1];
|
|
201
|
+
var _b = tslib_1.__read(_a, 2), origKey = _b[0], val = _b[1];
|
|
284
202
|
return ((obj[(alias || origKey)] = val), obj);
|
|
285
203
|
}, {});
|
|
286
204
|
return value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AWSAppSyncProvider.js","sourceRoot":"","sources":["../../src/Providers/AWSAppSyncProvider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AWSAppSyncProvider.js","sourceRoot":"","sources":["../../src/Providers/AWSAppSyncProvider.ts"],"names":[],"mappings":";;;AAaA,gFAA2C;AAC3C,0CAA4D;AAE5D,2DAA0D;AAE1D,IAAM,MAAM,GAAG,IAAI,oBAAM,CAAC,oBAAoB,CAAC,CAAC;AAEhD;;GAEG;AACH;IAAwC,8CAAkB;IAA1D;QAAA,qEAoLC;QApIQ,kBAAY,GAAwB,IAAI,GAAG,EAAE,CAAC;QAE9C,iBAAW,GAAwB,IAAI,GAAG,EAAE,CAAC;;IAkItD,CAAC;IAnLA,sBAAc,wCAAQ;aAAtB;YACC,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;QAClC,CAAC;;;OAAA;IAED,4CAAe,GAAf;QACC,OAAO,oBAAoB,CAAC;IAC7B,CAAC;IAEY,oCAAO,GAApB,UAAqB,MAAyB,EAAE,GAAQ,EAAE,OAAa;;;gBACtE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;;;KAC3C;IAEO,qCAAQ,GAAhB,UAAiB,QAAgB;QAAjC,iBAMC;QALA,IAAM,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;aAC7D,MAAM,CAAC,UAAC,EAAK;gBAAL,0BAAK,EAAF,SAAC;YAAM,OAAA,CAAC,CAAC,QAAQ,KAAK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CAAY,CAAC,EAC9D;4BACD,KAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;yBACjC;qBACD;oBAED,KAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBAChC,CAAC,CAAC,CAAC;YACJ,CAAC,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,2BAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,UAAA,KAAK;YACvC,IAAM,KAAK,GAAG,KAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;YAC3C,IAAM,KAAK,GAAG,KAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAE1C,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAC7C,UAAC,GAAG,EAAE,EAAc;oBAAd,0BAAc,EAAb,eAAO,EAAE,WAAG;gBAAM,OAAA,CACxB,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,OAAO,CAAW,CAAC,GAAG,GAAG,CAAC,EAAE,GAAG,CAC9C;YAFwB,CAExB,EACD,EAAE,CACF,CAAC;YAEF,OAAO,KAAK,CAAC;QACd,CAAC,CAAC,CAAC;IACJ,CAAC;IACF,yBAAC;AAAD,CAAC,AApLD,CAAwC,uCAAkB,GAoLzD;AApLY,gDAAkB"}
|
|
@@ -1,91 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
var __assign = (this && this.__assign) || function () {
|
|
16
|
-
__assign = Object.assign || function(t) {
|
|
17
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
18
|
-
s = arguments[i];
|
|
19
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
20
|
-
t[p] = s[p];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
return __assign.apply(this, arguments);
|
|
25
|
-
};
|
|
26
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
29
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
30
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
31
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
32
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
36
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
37
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
38
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
39
|
-
function step(op) {
|
|
40
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
41
|
-
while (_) try {
|
|
42
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
43
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
44
|
-
switch (op[0]) {
|
|
45
|
-
case 0: case 1: t = op; break;
|
|
46
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
47
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
48
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
49
|
-
default:
|
|
50
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
51
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
52
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
53
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
54
|
-
if (t[2]) _.ops.pop();
|
|
55
|
-
_.trys.pop(); continue;
|
|
56
|
-
}
|
|
57
|
-
op = body.call(thisArg, _);
|
|
58
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
59
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
63
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
64
|
-
if (!m) return o;
|
|
65
|
-
var i = m.call(o), r, ar = [], e;
|
|
66
|
-
try {
|
|
67
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
68
|
-
}
|
|
69
|
-
catch (error) { e = { error: error }; }
|
|
70
|
-
finally {
|
|
71
|
-
try {
|
|
72
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
73
|
-
}
|
|
74
|
-
finally { if (e) throw e.error; }
|
|
75
|
-
}
|
|
76
|
-
return ar;
|
|
77
|
-
};
|
|
78
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
79
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
80
|
-
};
|
|
81
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
82
|
-
if (mod && mod.__esModule) return mod;
|
|
83
|
-
var result = {};
|
|
84
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
85
|
-
result["default"] = mod;
|
|
86
|
-
return result;
|
|
87
|
-
};
|
|
88
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
89
4
|
/*
|
|
90
5
|
* Copyright 2017-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
91
6
|
*
|
|
@@ -98,14 +13,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
98
13
|
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
|
|
99
14
|
* and limitations under the License.
|
|
100
15
|
*/
|
|
101
|
-
var zen_observable_ts_1 = __importDefault(require("zen-observable-ts"));
|
|
16
|
+
var zen_observable_ts_1 = tslib_1.__importDefault(require("zen-observable-ts"));
|
|
102
17
|
var graphql_1 = require("graphql");
|
|
103
|
-
var url = __importStar(require("url"));
|
|
18
|
+
var url = tslib_1.__importStar(require("url"));
|
|
104
19
|
var uuid_1 = require("uuid");
|
|
105
20
|
var buffer_1 = require("buffer");
|
|
106
21
|
var core_1 = require("@aws-amplify/core");
|
|
107
|
-
var cache_1 =
|
|
108
|
-
var auth_1 =
|
|
22
|
+
var cache_1 = require("@aws-amplify/cache");
|
|
23
|
+
var auth_1 = require("@aws-amplify/auth");
|
|
109
24
|
var PubSubProvider_1 = require("../PubSubProvider");
|
|
110
25
|
var PubSub_1 = require("../../types/PubSub");
|
|
111
26
|
var constants_1 = require("../constants");
|
|
@@ -118,7 +33,7 @@ var dispatchApiEvent = function (event, data, message) {
|
|
|
118
33
|
var standardDomainPattern = /^https:\/\/\w{26}\.appsync\-api\.\w{2}(?:(?:\-\w{2,})+)\-\d\.amazonaws.com\/graphql$/i;
|
|
119
34
|
var customDomainPath = '/realtime';
|
|
120
35
|
var AWSAppSyncRealTimeProvider = /** @class */ (function (_super) {
|
|
121
|
-
__extends(AWSAppSyncRealTimeProvider, _super);
|
|
36
|
+
tslib_1.__extends(AWSAppSyncRealTimeProvider, _super);
|
|
122
37
|
function AWSAppSyncRealTimeProvider(options) {
|
|
123
38
|
if (options === void 0) { options = {}; }
|
|
124
39
|
var _this = _super.call(this, options) || this;
|
|
@@ -178,8 +93,8 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function (_super) {
|
|
|
178
93
|
throw new Error('Not used here');
|
|
179
94
|
};
|
|
180
95
|
AWSAppSyncRealTimeProvider.prototype.publish = function (_topics, _msg, _options) {
|
|
181
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
182
|
-
return __generator(this, function (_a) {
|
|
96
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
97
|
+
return tslib_1.__generator(this, function (_a) {
|
|
183
98
|
throw new Error('Operation not supported');
|
|
184
99
|
});
|
|
185
100
|
});
|
|
@@ -195,7 +110,7 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function (_super) {
|
|
|
195
110
|
if (!options || !appSyncGraphqlEndpoint) {
|
|
196
111
|
observer.error({
|
|
197
112
|
errors: [
|
|
198
|
-
__assign({}, new graphql_1.GraphQLError("Subscribe only available for AWS AppSync endpoint")),
|
|
113
|
+
tslib_1.__assign({}, new graphql_1.GraphQLError("Subscribe only available for AWS AppSync endpoint")),
|
|
199
114
|
],
|
|
200
115
|
});
|
|
201
116
|
observer.complete();
|
|
@@ -227,9 +142,9 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function (_super) {
|
|
|
227
142
|
startSubscription_1();
|
|
228
143
|
});
|
|
229
144
|
startSubscription_1();
|
|
230
|
-
return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
145
|
+
return function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
231
146
|
var subscriptionState, err_1;
|
|
232
|
-
return __generator(this, function (_a) {
|
|
147
|
+
return tslib_1.__generator(this, function (_a) {
|
|
233
148
|
switch (_a.label) {
|
|
234
149
|
case 0:
|
|
235
150
|
// Cleanup reconnection subscription
|
|
@@ -279,11 +194,11 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function (_super) {
|
|
|
279
194
|
AWSAppSyncRealTimeProvider.prototype._startSubscriptionWithAWSAppSyncRealTime = function (_a) {
|
|
280
195
|
var options = _a.options, observer = _a.observer, subscriptionId = _a.subscriptionId;
|
|
281
196
|
var _b;
|
|
282
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
197
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
283
198
|
var appSyncGraphqlEndpoint, authenticationType, query, variables, apiKey, region, _c, graphql_headers, _d, additionalHeaders, subscriptionState, data, dataString, headerObj, _e, _f, subscriptionMessage, stringToAWSRealTime, err_2, _g, subscriptionFailedCallback, subscriptionReadyCallback;
|
|
284
199
|
var _h;
|
|
285
200
|
var _this = this;
|
|
286
|
-
return __generator(this, function (_j) {
|
|
201
|
+
return tslib_1.__generator(this, function (_j) {
|
|
287
202
|
switch (_j.label) {
|
|
288
203
|
case 0:
|
|
289
204
|
appSyncGraphqlEndpoint = options.appSyncGraphqlEndpoint, authenticationType = options.authenticationType, query = options.query, variables = options.variables, apiKey = options.apiKey, region = options.region, _c = options.graphql_headers, graphql_headers = _c === void 0 ? function () { return ({}); } : _c, _d = options.additionalHeaders, additionalHeaders = _d === void 0 ? {} : _d;
|
|
@@ -312,16 +227,16 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function (_super) {
|
|
|
312
227
|
additionalHeaders: additionalHeaders,
|
|
313
228
|
})];
|
|
314
229
|
case 1:
|
|
315
|
-
_f = [__assign.apply(void 0, _e.concat([(_j.sent())]))];
|
|
230
|
+
_f = [tslib_1.__assign.apply(void 0, _e.concat([(_j.sent())]))];
|
|
316
231
|
return [4 /*yield*/, graphql_headers()];
|
|
317
232
|
case 2:
|
|
318
|
-
headerObj = __assign.apply(void 0, [__assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_j.sent())])), additionalHeaders]), (_h = {}, _h[core_1.USER_AGENT_HEADER] = core_1.Constants.userAgent, _h)]);
|
|
233
|
+
headerObj = tslib_1.__assign.apply(void 0, [tslib_1.__assign.apply(void 0, [tslib_1.__assign.apply(void 0, _f.concat([(_j.sent())])), additionalHeaders]), (_h = {}, _h[core_1.USER_AGENT_HEADER] = core_1.Constants.userAgent, _h)]);
|
|
319
234
|
subscriptionMessage = {
|
|
320
235
|
id: subscriptionId,
|
|
321
236
|
payload: {
|
|
322
237
|
data: dataString,
|
|
323
238
|
extensions: {
|
|
324
|
-
authorization: __assign({}, headerObj),
|
|
239
|
+
authorization: tslib_1.__assign({}, headerObj),
|
|
325
240
|
},
|
|
326
241
|
},
|
|
327
242
|
type: constants_1.MESSAGE_TYPES.GQL_START,
|
|
@@ -380,7 +295,7 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function (_super) {
|
|
|
380
295
|
if (core_1.isNonRetryableError(err)) {
|
|
381
296
|
observer.error({
|
|
382
297
|
errors: [
|
|
383
|
-
__assign({}, new graphql_1.GraphQLError(PubSub_1.CONTROL_MSG.CONNECTION_FAILED + ": " + message)),
|
|
298
|
+
tslib_1.__assign({}, new graphql_1.GraphQLError(PubSub_1.CONTROL_MSG.CONNECTION_FAILED + ": " + message)),
|
|
384
299
|
],
|
|
385
300
|
});
|
|
386
301
|
}
|
|
@@ -396,10 +311,10 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function (_super) {
|
|
|
396
311
|
};
|
|
397
312
|
// Waiting that subscription has been connected before trying to unsubscribe
|
|
398
313
|
AWSAppSyncRealTimeProvider.prototype._waitForSubscriptionToBeConnected = function (subscriptionId) {
|
|
399
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
314
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
400
315
|
var subscriptionObserver, subscriptionState;
|
|
401
316
|
var _this = this;
|
|
402
|
-
return __generator(this, function (_a) {
|
|
317
|
+
return tslib_1.__generator(this, function (_a) {
|
|
403
318
|
subscriptionObserver = this.subscriptionObserverMap.get(subscriptionId);
|
|
404
319
|
if (subscriptionObserver) {
|
|
405
320
|
subscriptionState = subscriptionObserver.subscriptionState;
|
|
@@ -543,7 +458,7 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function (_super) {
|
|
|
543
458
|
logger.debug(PubSub_1.CONTROL_MSG.CONNECTION_FAILED + ": " + JSON.stringify(payload));
|
|
544
459
|
observer.error({
|
|
545
460
|
errors: [
|
|
546
|
-
__assign({}, new graphql_1.GraphQLError(PubSub_1.CONTROL_MSG.CONNECTION_FAILED + ": " + JSON.stringify(payload))),
|
|
461
|
+
tslib_1.__assign({}, new graphql_1.GraphQLError(PubSub_1.CONTROL_MSG.CONNECTION_FAILED + ": " + JSON.stringify(payload))),
|
|
547
462
|
],
|
|
548
463
|
});
|
|
549
464
|
if (startAckTimeoutId)
|
|
@@ -585,9 +500,9 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function (_super) {
|
|
|
585
500
|
if (this.socketStatus === constants_1.SOCKET_STATUS.READY) {
|
|
586
501
|
return;
|
|
587
502
|
}
|
|
588
|
-
return new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
|
|
503
|
+
return new Promise(function (res, rej) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
589
504
|
var payloadString, headerString, _a, _b, headerQs, payloadQs, discoverableEndpoint, protocol, awsRealTimeUrl, err_3;
|
|
590
|
-
return __generator(this, function (_c) {
|
|
505
|
+
return tslib_1.__generator(this, function (_c) {
|
|
591
506
|
switch (_c.label) {
|
|
592
507
|
case 0:
|
|
593
508
|
this.promiseArray.push({ res: res, rej: rej });
|
|
@@ -658,8 +573,8 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function (_super) {
|
|
|
658
573
|
}); });
|
|
659
574
|
};
|
|
660
575
|
AWSAppSyncRealTimeProvider.prototype._initializeRetryableHandshake = function (awsRealTimeUrl) {
|
|
661
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
662
|
-
return __generator(this, function (_a) {
|
|
576
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
577
|
+
return tslib_1.__generator(this, function (_a) {
|
|
663
578
|
switch (_a.label) {
|
|
664
579
|
case 0:
|
|
665
580
|
logger.debug("Initializaling retryable Handshake");
|
|
@@ -672,10 +587,10 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function (_super) {
|
|
|
672
587
|
});
|
|
673
588
|
};
|
|
674
589
|
AWSAppSyncRealTimeProvider.prototype._initializeHandshake = function (awsRealTimeUrl) {
|
|
675
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
590
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
676
591
|
var err_4, _a, errorType, errorCode;
|
|
677
592
|
var _this = this;
|
|
678
|
-
return __generator(this, function (_b) {
|
|
593
|
+
return tslib_1.__generator(this, function (_b) {
|
|
679
594
|
switch (_b.label) {
|
|
680
595
|
case 0:
|
|
681
596
|
logger.debug("Initializing handshake " + awsRealTimeUrl);
|
|
@@ -734,7 +649,7 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function (_super) {
|
|
|
734
649
|
return;
|
|
735
650
|
}
|
|
736
651
|
if (type === constants_1.MESSAGE_TYPES.GQL_CONNECTION_ERROR) {
|
|
737
|
-
var _c = data.payload, _d = (_c === void 0 ? {} : _c).errors, _e = __read(_d === void 0 ? [] : _d, 1), _f = _e[0], _g = _f === void 0 ? {} : _f, _h = _g.errorType, errorType = _h === void 0 ? '' : _h, _j = _g.errorCode, errorCode = _j === void 0 ? 0 : _j;
|
|
652
|
+
var _c = data.payload, _d = (_c === void 0 ? {} : _c).errors, _e = tslib_1.__read(_d === void 0 ? [] : _d, 1), _f = _e[0], _g = _f === void 0 ? {} : _f, _h = _g.errorType, errorType = _h === void 0 ? '' : _h, _j = _g.errorCode, errorCode = _j === void 0 ? 0 : _j;
|
|
738
653
|
rej({ errorType: errorType, errorCode: errorCode });
|
|
739
654
|
}
|
|
740
655
|
};
|
|
@@ -776,9 +691,9 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function (_super) {
|
|
|
776
691
|
};
|
|
777
692
|
AWSAppSyncRealTimeProvider.prototype._awsRealTimeHeaderBasedAuth = function (_a) {
|
|
778
693
|
var authenticationType = _a.authenticationType, payload = _a.payload, canonicalUri = _a.canonicalUri, appSyncGraphqlEndpoint = _a.appSyncGraphqlEndpoint, apiKey = _a.apiKey, region = _a.region, additionalHeaders = _a.additionalHeaders;
|
|
779
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
694
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
780
695
|
var headerHandler, handler, host, result;
|
|
781
|
-
return __generator(this, function (_b) {
|
|
696
|
+
return tslib_1.__generator(this, function (_b) {
|
|
782
697
|
switch (_b.label) {
|
|
783
698
|
case 0:
|
|
784
699
|
headerHandler = {
|
|
@@ -813,11 +728,11 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function (_super) {
|
|
|
813
728
|
};
|
|
814
729
|
AWSAppSyncRealTimeProvider.prototype._awsRealTimeCUPHeader = function (_a) {
|
|
815
730
|
var host = _a.host;
|
|
816
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
731
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
817
732
|
var session;
|
|
818
|
-
return __generator(this, function (_b) {
|
|
733
|
+
return tslib_1.__generator(this, function (_b) {
|
|
819
734
|
switch (_b.label) {
|
|
820
|
-
case 0: return [4 /*yield*/, auth_1.
|
|
735
|
+
case 0: return [4 /*yield*/, auth_1.Auth.currentSession()];
|
|
821
736
|
case 1:
|
|
822
737
|
session = _b.sent();
|
|
823
738
|
return [2 /*return*/, {
|
|
@@ -830,17 +745,17 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function (_super) {
|
|
|
830
745
|
};
|
|
831
746
|
AWSAppSyncRealTimeProvider.prototype._awsRealTimeOPENIDHeader = function (_a) {
|
|
832
747
|
var host = _a.host;
|
|
833
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
748
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
834
749
|
var token, federatedInfo, currentUser;
|
|
835
|
-
return __generator(this, function (_b) {
|
|
750
|
+
return tslib_1.__generator(this, function (_b) {
|
|
836
751
|
switch (_b.label) {
|
|
837
|
-
case 0: return [4 /*yield*/, cache_1.
|
|
752
|
+
case 0: return [4 /*yield*/, cache_1.BrowserStorageCache.getItem('federatedInfo')];
|
|
838
753
|
case 1:
|
|
839
754
|
federatedInfo = _b.sent();
|
|
840
755
|
if (!federatedInfo) return [3 /*break*/, 2];
|
|
841
756
|
token = federatedInfo.token;
|
|
842
757
|
return [3 /*break*/, 4];
|
|
843
|
-
case 2: return [4 /*yield*/, auth_1.
|
|
758
|
+
case 2: return [4 /*yield*/, auth_1.Auth.currentAuthenticatedUser()];
|
|
844
759
|
case 3:
|
|
845
760
|
currentUser = _b.sent();
|
|
846
761
|
if (currentUser) {
|
|
@@ -861,9 +776,9 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function (_super) {
|
|
|
861
776
|
};
|
|
862
777
|
AWSAppSyncRealTimeProvider.prototype._awsRealTimeApiKeyHeader = function (_a) {
|
|
863
778
|
var apiKey = _a.apiKey, host = _a.host;
|
|
864
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
779
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
865
780
|
var dt, dtStr;
|
|
866
|
-
return __generator(this, function (_b) {
|
|
781
|
+
return tslib_1.__generator(this, function (_b) {
|
|
867
782
|
dt = new Date();
|
|
868
783
|
dtStr = dt.toISOString().replace(/[:\-]|\.\d{3}/g, '');
|
|
869
784
|
return [2 /*return*/, {
|
|
@@ -876,9 +791,9 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function (_super) {
|
|
|
876
791
|
};
|
|
877
792
|
AWSAppSyncRealTimeProvider.prototype._awsRealTimeIAMHeader = function (_a) {
|
|
878
793
|
var payload = _a.payload, canonicalUri = _a.canonicalUri, appSyncGraphqlEndpoint = _a.appSyncGraphqlEndpoint, region = _a.region;
|
|
879
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
794
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
880
795
|
var endpointInfo, credentialsOK, creds, request, signed_params;
|
|
881
|
-
return __generator(this, function (_b) {
|
|
796
|
+
return tslib_1.__generator(this, function (_b) {
|
|
882
797
|
switch (_b.label) {
|
|
883
798
|
case 0:
|
|
884
799
|
endpointInfo = {
|
|
@@ -905,7 +820,7 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function (_super) {
|
|
|
905
820
|
url: "" + appSyncGraphqlEndpoint + canonicalUri,
|
|
906
821
|
data: payload,
|
|
907
822
|
method: 'POST',
|
|
908
|
-
headers: __assign({}, constants_1.AWS_APPSYNC_REALTIME_HEADERS),
|
|
823
|
+
headers: tslib_1.__assign({}, constants_1.AWS_APPSYNC_REALTIME_HEADERS),
|
|
909
824
|
};
|
|
910
825
|
signed_params = core_1.Signer.sign(request, creds, endpointInfo);
|
|
911
826
|
return [2 /*return*/, signed_params.headers];
|