@aws-amplify/core 4.6.2-next.13 → 4.6.2-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 +38 -0
- package/lib/.tsbuildinfo +3 -0
- package/lib/Amplify.js +3 -21
- package/lib/Amplify.js.map +1 -1
- package/lib/ClientDevice/index.js +0 -4
- package/lib/ClientDevice/index.js.map +1 -1
- package/lib/ClientDevice/reactnative.js +0 -4
- package/lib/ClientDevice/reactnative.js.map +1 -1
- package/lib/Credentials.js +31 -81
- package/lib/Credentials.js.map +1 -1
- package/lib/Hub.js +39 -45
- package/lib/Hub.js.map +1 -1
- package/lib/I18n/index.js +0 -4
- package/lib/I18n/index.js.map +1 -1
- package/lib/JS.js +2 -27
- package/lib/JS.js.map +1 -1
- package/lib/Logger/ConsoleLogger.js +8 -38
- package/lib/Logger/ConsoleLogger.js.map +1 -1
- package/lib/Logger/index.js +2 -4
- package/lib/Logger/index.js.map +1 -1
- package/lib/OAuthHelper/FacebookOAuth.js +3 -42
- package/lib/OAuthHelper/FacebookOAuth.js.map +1 -1
- package/lib/OAuthHelper/GoogleOAuth.js +3 -42
- package/lib/OAuthHelper/GoogleOAuth.js.map +1 -1
- package/lib/Platform/index.js +0 -4
- package/lib/Platform/index.js.map +1 -1
- package/lib/Platform/version.js +1 -1
- package/lib/Platform/version.js.map +1 -1
- package/lib/Providers/AWSCloudWatchProvider.js +30 -85
- package/lib/Providers/AWSCloudWatchProvider.js.map +1 -1
- package/lib/Providers/index.js +2 -4
- package/lib/Providers/index.js.map +1 -1
- package/lib/RNComponents/reactnative.js +2 -4
- package/lib/RNComponents/reactnative.js.map +1 -1
- package/lib/ServiceWorker/ServiceWorker.js +0 -4
- package/lib/ServiceWorker/ServiceWorker.js.map +1 -1
- package/lib/Signer.js +6 -31
- package/lib/Signer.js.map +1 -1
- package/lib/StorageHelper/index.js +0 -4
- package/lib/StorageHelper/index.js.map +1 -1
- package/lib/StorageHelper/reactnative.js +2 -8
- package/lib/StorageHelper/reactnative.js.map +1 -1
- package/lib/UniversalStorage/index.js +2 -4
- package/lib/UniversalStorage/index.js.map +1 -1
- package/lib/Util/BackgroundProcessManager.js +385 -0
- package/lib/Util/BackgroundProcessManager.js.map +1 -0
- package/lib/Util/DateUtils.js +2 -17
- package/lib/Util/DateUtils.js.map +1 -1
- package/lib/Util/Reachability.js +3 -16
- package/lib/Util/Reachability.js.map +1 -1
- package/lib/Util/Reachability.native.js +2 -4
- package/lib/Util/Reachability.native.js.map +1 -1
- package/lib/Util/Retry.js +80 -106
- package/lib/Util/Retry.js.map +1 -1
- package/lib/Util/index.js +6 -7
- package/lib/Util/index.js.map +1 -1
- package/lib/index.js +12 -13
- package/lib/index.js.map +1 -1
- package/lib/{Parser.js → parseAWSExports.js} +4 -28
- package/lib/parseAWSExports.js.map +1 -0
- package/lib-esm/.tsbuildinfo +3 -0
- package/lib-esm/Amplify.d.ts +1 -4
- package/lib-esm/Amplify.js +2 -20
- package/lib-esm/Amplify.js.map +1 -1
- package/lib-esm/ClientDevice/index.d.ts +0 -4
- package/lib-esm/ClientDevice/index.js +0 -4
- package/lib-esm/ClientDevice/index.js.map +1 -1
- package/lib-esm/ClientDevice/reactnative.d.ts +0 -7
- package/lib-esm/ClientDevice/reactnative.js +0 -4
- package/lib-esm/ClientDevice/reactnative.js.map +1 -1
- package/lib-esm/Credentials.d.ts +1 -5
- package/lib-esm/Credentials.js +2 -52
- package/lib-esm/Credentials.js.map +1 -1
- package/lib-esm/Hub.d.ts +28 -4
- package/lib-esm/Hub.js +34 -40
- package/lib-esm/Hub.js.map +1 -1
- package/lib-esm/I18n/index.d.ts +0 -4
- package/lib-esm/I18n/index.js +0 -4
- package/lib-esm/I18n/index.js.map +1 -1
- package/lib-esm/JS.d.ts +0 -24
- package/lib-esm/JS.js +2 -27
- package/lib-esm/JS.js.map +1 -1
- package/lib-esm/Logger/ConsoleLogger.js +1 -31
- package/lib-esm/Logger/ConsoleLogger.js.map +1 -1
- package/lib-esm/Logger/logger-interface.d.ts +0 -4
- package/lib-esm/OAuthHelper/FacebookOAuth.d.ts +0 -4
- package/lib-esm/OAuthHelper/FacebookOAuth.js +1 -40
- package/lib-esm/OAuthHelper/FacebookOAuth.js.map +1 -1
- package/lib-esm/OAuthHelper/GoogleOAuth.d.ts +0 -4
- package/lib-esm/OAuthHelper/GoogleOAuth.js +1 -40
- package/lib-esm/OAuthHelper/GoogleOAuth.js.map +1 -1
- package/lib-esm/Platform/index.d.ts +0 -4
- package/lib-esm/Platform/index.js +0 -4
- package/lib-esm/Platform/index.js.map +1 -1
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -1
- package/lib-esm/Platform/version.js.map +1 -1
- package/lib-esm/Providers/AWSCloudWatchProvider.js +3 -58
- package/lib-esm/Providers/AWSCloudWatchProvider.js.map +1 -1
- package/lib-esm/ServiceWorker/ServiceWorker.d.ts +0 -4
- package/lib-esm/ServiceWorker/ServiceWorker.js +0 -4
- package/lib-esm/ServiceWorker/ServiceWorker.js.map +1 -1
- package/lib-esm/Signer.d.ts +0 -4
- package/lib-esm/Signer.js +1 -26
- package/lib-esm/Signer.js.map +1 -1
- package/lib-esm/StorageHelper/index.d.ts +0 -4
- package/lib-esm/StorageHelper/index.js +0 -4
- package/lib-esm/StorageHelper/index.js.map +1 -1
- package/lib-esm/StorageHelper/reactnative.d.ts +0 -4
- package/lib-esm/StorageHelper/reactnative.js +0 -4
- package/lib-esm/StorageHelper/reactnative.js.map +1 -1
- package/lib-esm/Util/BackgroundProcessManager.d.ts +204 -0
- package/lib-esm/Util/BackgroundProcessManager.js +383 -0
- package/lib-esm/Util/BackgroundProcessManager.js.map +1 -0
- package/lib-esm/Util/DateUtils.js +1 -16
- package/lib-esm/Util/DateUtils.js.map +1 -1
- package/lib-esm/Util/Reachability.js +1 -11
- package/lib-esm/Util/Reachability.js.map +1 -1
- package/lib-esm/Util/Retry.d.ts +2 -2
- package/lib-esm/Util/Retry.js +77 -103
- package/lib-esm/Util/Retry.js.map +1 -1
- package/lib-esm/Util/index.d.ts +1 -0
- package/lib-esm/Util/index.js +1 -0
- package/lib-esm/Util/index.js.map +1 -1
- package/lib-esm/index.d.ts +2 -2
- package/lib-esm/index.js +2 -2
- package/lib-esm/index.js.map +1 -1
- package/lib-esm/parseAWSExports.d.ts +2 -0
- package/lib-esm/{Parser.js → parseAWSExports.js} +3 -27
- package/lib-esm/parseAWSExports.js.map +1 -0
- package/lib-esm/types/types.d.ts +3 -0
- package/package.json +10 -3
- package/src/Amplify.ts +1 -5
- package/src/ClientDevice/index.ts +0 -5
- package/src/ClientDevice/reactnative.ts +0 -5
- package/src/Credentials.ts +13 -19
- package/src/Hub.ts +38 -11
- package/src/I18n/index.ts +0 -5
- package/src/JS.ts +4 -25
- package/src/Logger/logger-interface.ts +0 -5
- package/src/OAuthHelper/FacebookOAuth.ts +0 -5
- package/src/OAuthHelper/GoogleOAuth.ts +0 -5
- package/src/Platform/index.ts +0 -5
- package/src/Platform/version.ts +1 -1
- package/src/Providers/AWSCloudWatchProvider.ts +2 -2
- package/src/ServiceWorker/ServiceWorker.ts +1 -6
- package/src/Signer.ts +0 -5
- package/src/StorageHelper/index.ts +0 -5
- package/src/StorageHelper/reactnative.ts +0 -5
- package/src/Util/BackgroundProcessManager.ts +449 -0
- package/src/Util/Retry.ts +66 -31
- package/src/Util/index.ts +1 -0
- package/src/index.ts +2 -2
- package/src/{Parser.ts → parseAWSExports.ts} +1 -13
- package/src/types/types.ts +3 -0
- package/build.js +0 -5
- package/dist/aws-amplify-core.js +0 -43156
- package/dist/aws-amplify-core.js.map +0 -1
- package/dist/aws-amplify-core.min.js +0 -32
- package/dist/aws-amplify-core.min.js.map +0 -1
- package/index.js +0 -7
- package/lib/Amplify.d.ts +0 -31
- package/lib/ClientDevice/android.d.ts +0 -5
- package/lib/ClientDevice/browser.d.ts +0 -25
- package/lib/ClientDevice/index.d.ts +0 -27
- package/lib/ClientDevice/ios.d.ts +0 -7
- package/lib/ClientDevice/reactnative.d.ts +0 -14
- package/lib/Credentials.d.ts +0 -51
- package/lib/Errors.d.ts +0 -2
- package/lib/Hub.d.ts +0 -31
- package/lib/I18n/I18n.d.ts +0 -59
- package/lib/I18n/index.d.ts +0 -53
- package/lib/I18n/types.d.ts +0 -3
- package/lib/JS.d.ts +0 -56
- package/lib/Logger/ConsoleLogger.d.ts +0 -80
- package/lib/Logger/index.d.ts +0 -1
- package/lib/Logger/logger-interface.d.ts +0 -12
- package/lib/OAuthHelper/FacebookOAuth.d.ts +0 -10
- package/lib/OAuthHelper/GoogleOAuth.d.ts +0 -10
- package/lib/OAuthHelper/index.d.ts +0 -4
- package/lib/Parser.d.ts +0 -12
- package/lib/Parser.js.map +0 -1
- package/lib/Platform/index.d.ts +0 -11
- package/lib/Platform/version.d.ts +0 -1
- package/lib/Providers/AWSCloudWatchProvider.d.ts +0 -34
- package/lib/Providers/index.d.ts +0 -1
- package/lib/RNComponents/index.d.ts +0 -5
- package/lib/RNComponents/reactnative.d.ts +0 -3
- package/lib/ServiceWorker/ServiceWorker.d.ts +0 -72
- package/lib/ServiceWorker/index.d.ts +0 -13
- package/lib/Signer.d.ts +0 -45
- package/lib/StorageHelper/index.d.ts +0 -45
- package/lib/StorageHelper/reactnative.d.ts +0 -17
- package/lib/UniversalStorage/index.d.ts +0 -23
- package/lib/Util/Constants.d.ts +0 -8
- package/lib/Util/DateUtils.d.ts +0 -7
- package/lib/Util/Mutex.d.ts +0 -45
- package/lib/Util/Reachability.d.ts +0 -13
- package/lib/Util/Reachability.native.d.ts +0 -11
- package/lib/Util/Retry.d.ts +0 -21
- package/lib/Util/StringUtils.d.ts +0 -2
- package/lib/Util/index.d.ts +0 -6
- package/lib/constants.d.ts +0 -6
- package/lib/index.d.ts +0 -30
- package/lib/types/index.d.ts +0 -1
- package/lib/types/types.d.ts +0 -43
- package/lib-esm/Parser.d.ts +0 -12
- package/lib-esm/Parser.js.map +0 -1
- package/webpack.config.dev.js +0 -6
package/lib-esm/Util/Retry.js
CHANGED
|
@@ -1,72 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
extendStatics(d, b);
|
|
10
|
-
function __() { this.constructor = d; }
|
|
11
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
-
};
|
|
13
|
-
})();
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
24
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
25
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
26
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
27
|
-
function step(op) {
|
|
28
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
29
|
-
while (_) try {
|
|
30
|
-
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;
|
|
31
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
32
|
-
switch (op[0]) {
|
|
33
|
-
case 0: case 1: t = op; break;
|
|
34
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
35
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
36
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
37
|
-
default:
|
|
38
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
39
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
40
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
41
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
42
|
-
if (t[2]) _.ops.pop();
|
|
43
|
-
_.trys.pop(); continue;
|
|
44
|
-
}
|
|
45
|
-
op = body.call(thisArg, _);
|
|
46
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
47
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
51
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
52
|
-
if (!m) return o;
|
|
53
|
-
var i = m.call(o), r, ar = [], e;
|
|
54
|
-
try {
|
|
55
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
56
|
-
}
|
|
57
|
-
catch (error) { e = { error: error }; }
|
|
58
|
-
finally {
|
|
59
|
-
try {
|
|
60
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
61
|
-
}
|
|
62
|
-
finally { if (e) throw e.error; }
|
|
63
|
-
}
|
|
64
|
-
return ar;
|
|
65
|
-
};
|
|
66
|
-
var __spread = (this && this.__spread) || function () {
|
|
67
|
-
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
68
|
-
return ar;
|
|
69
|
-
};
|
|
1
|
+
import { __awaiter, __extends, __generator, __read, __spread } from "tslib";
|
|
70
2
|
import { ConsoleLogger as Logger } from '../Logger/ConsoleLogger';
|
|
71
3
|
var logger = new Logger('Util');
|
|
72
4
|
var NonRetryableError = /** @class */ (function (_super) {
|
|
@@ -87,41 +19,83 @@ export var isNonRetryableError = function (obj) {
|
|
|
87
19
|
* @private
|
|
88
20
|
* Internal use of Amplify only
|
|
89
21
|
*/
|
|
90
|
-
export function retry(functionToRetry, args, delayFn,
|
|
91
|
-
if (attempt === void 0) { attempt = 1; }
|
|
22
|
+
export function retry(functionToRetry, args, delayFn, onTerminate) {
|
|
92
23
|
return __awaiter(this, void 0, void 0, function () {
|
|
93
|
-
var
|
|
24
|
+
var _this = this;
|
|
94
25
|
return __generator(this, function (_a) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (typeof functionToRetry !== 'function') {
|
|
98
|
-
throw Error('functionToRetry must be a function');
|
|
99
|
-
}
|
|
100
|
-
logger.debug(functionToRetry.name + " attempt #" + attempt + " with this vars: " + JSON.stringify(args));
|
|
101
|
-
_a.label = 1;
|
|
102
|
-
case 1:
|
|
103
|
-
_a.trys.push([1, 3, , 8]);
|
|
104
|
-
return [4 /*yield*/, functionToRetry.apply(void 0, __spread(args))];
|
|
105
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
106
|
-
case 3:
|
|
107
|
-
err_1 = _a.sent();
|
|
108
|
-
logger.debug("error on " + functionToRetry.name, err_1);
|
|
109
|
-
if (isNonRetryableError(err_1)) {
|
|
110
|
-
logger.debug(functionToRetry.name + " non retryable error", err_1);
|
|
111
|
-
throw err_1;
|
|
112
|
-
}
|
|
113
|
-
retryIn_1 = delayFn(attempt, args, err_1);
|
|
114
|
-
logger.debug(functionToRetry.name + " retrying in " + retryIn_1 + " ms");
|
|
115
|
-
if (!(retryIn_1 !== false)) return [3 /*break*/, 6];
|
|
116
|
-
return [4 /*yield*/, new Promise(function (res) { return setTimeout(res, retryIn_1); })];
|
|
117
|
-
case 4:
|
|
118
|
-
_a.sent();
|
|
119
|
-
return [4 /*yield*/, retry(functionToRetry, args, delayFn, attempt + 1)];
|
|
120
|
-
case 5: return [2 /*return*/, _a.sent()];
|
|
121
|
-
case 6: throw err_1;
|
|
122
|
-
case 7: return [3 /*break*/, 8];
|
|
123
|
-
case 8: return [2 /*return*/];
|
|
26
|
+
if (typeof functionToRetry !== 'function') {
|
|
27
|
+
throw Error('functionToRetry must be a function');
|
|
124
28
|
}
|
|
29
|
+
return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
30
|
+
var attempt, terminated, timeout, wakeUp, lastError, _loop_1, state_1;
|
|
31
|
+
return __generator(this, function (_a) {
|
|
32
|
+
switch (_a.label) {
|
|
33
|
+
case 0:
|
|
34
|
+
attempt = 0;
|
|
35
|
+
terminated = false;
|
|
36
|
+
wakeUp = function () { };
|
|
37
|
+
onTerminate &&
|
|
38
|
+
onTerminate.then(function () {
|
|
39
|
+
// signal not to try anymore.
|
|
40
|
+
terminated = true;
|
|
41
|
+
// stop sleeping if we're sleeping.
|
|
42
|
+
clearTimeout(timeout);
|
|
43
|
+
wakeUp();
|
|
44
|
+
});
|
|
45
|
+
_loop_1 = function () {
|
|
46
|
+
var _a, _b, err_1, retryIn_1;
|
|
47
|
+
return __generator(this, function (_c) {
|
|
48
|
+
switch (_c.label) {
|
|
49
|
+
case 0:
|
|
50
|
+
attempt++;
|
|
51
|
+
logger.debug(functionToRetry.name + " attempt #" + attempt + " with this vars: " + JSON.stringify(args));
|
|
52
|
+
_c.label = 1;
|
|
53
|
+
case 1:
|
|
54
|
+
_c.trys.push([1, 3, , 7]);
|
|
55
|
+
_a = {};
|
|
56
|
+
_b = resolve;
|
|
57
|
+
return [4 /*yield*/, functionToRetry.apply(void 0, __spread(args))];
|
|
58
|
+
case 2: return [2 /*return*/, (_a.value = _b.apply(void 0, [_c.sent()]), _a)];
|
|
59
|
+
case 3:
|
|
60
|
+
err_1 = _c.sent();
|
|
61
|
+
lastError = err_1;
|
|
62
|
+
logger.debug("error on " + functionToRetry.name, err_1);
|
|
63
|
+
if (isNonRetryableError(err_1)) {
|
|
64
|
+
logger.debug(functionToRetry.name + " non retryable error", err_1);
|
|
65
|
+
return [2 /*return*/, { value: reject(err_1) }];
|
|
66
|
+
}
|
|
67
|
+
retryIn_1 = delayFn(attempt, args, err_1);
|
|
68
|
+
logger.debug(functionToRetry.name + " retrying in " + retryIn_1 + " ms");
|
|
69
|
+
if (!(retryIn_1 === false || terminated)) return [3 /*break*/, 4];
|
|
70
|
+
return [2 /*return*/, { value: reject(err_1) }];
|
|
71
|
+
case 4: return [4 /*yield*/, new Promise(function (r) {
|
|
72
|
+
wakeUp = r; // export wakeUp for onTerminate handling
|
|
73
|
+
timeout = setTimeout(wakeUp, retryIn_1);
|
|
74
|
+
})];
|
|
75
|
+
case 5:
|
|
76
|
+
_c.sent();
|
|
77
|
+
_c.label = 6;
|
|
78
|
+
case 6: return [3 /*break*/, 7];
|
|
79
|
+
case 7: return [2 /*return*/];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
_a.label = 1;
|
|
84
|
+
case 1:
|
|
85
|
+
if (!!terminated) return [3 /*break*/, 3];
|
|
86
|
+
return [5 /*yield**/, _loop_1()];
|
|
87
|
+
case 2:
|
|
88
|
+
state_1 = _a.sent();
|
|
89
|
+
if (typeof state_1 === "object")
|
|
90
|
+
return [2 /*return*/, state_1.value];
|
|
91
|
+
return [3 /*break*/, 1];
|
|
92
|
+
case 3:
|
|
93
|
+
// reached if terminated while waiting for a timer.
|
|
94
|
+
reject(lastError);
|
|
95
|
+
return [2 /*return*/];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}); })];
|
|
125
99
|
});
|
|
126
100
|
});
|
|
127
101
|
}
|
|
@@ -143,8 +117,8 @@ export function jitteredBackoff(maxDelayMs) {
|
|
|
143
117
|
* @private
|
|
144
118
|
* Internal use of Amplify only
|
|
145
119
|
*/
|
|
146
|
-
export var jitteredExponentialRetry = function (functionToRetry, args, maxDelayMs) {
|
|
120
|
+
export var jitteredExponentialRetry = function (functionToRetry, args, maxDelayMs, onTerminate) {
|
|
147
121
|
if (maxDelayMs === void 0) { maxDelayMs = MAX_DELAY_MS; }
|
|
148
|
-
return retry(functionToRetry, args, jitteredBackoff(maxDelayMs));
|
|
122
|
+
return retry(functionToRetry, args, jitteredBackoff(maxDelayMs), onTerminate);
|
|
149
123
|
};
|
|
150
124
|
//# sourceMappingURL=Retry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Retry.js","sourceRoot":"","sources":["../../src/Util/Retry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Retry.js","sourceRoot":"","sources":["../../src/Util/Retry.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,IAAI,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAClE,IAAM,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;AAElC;IAAuC,qCAAK;IAE3C,2BAAY,OAAe;QAA3B,YACC,kBAAM,OAAO,CAAC,SACd;QAHe,kBAAY,GAAG,IAAI,CAAC;;IAGpC,CAAC;IACF,wBAAC;AAAD,CAAC,AALD,CAAuC,KAAK,GAK3C;;AAED,MAAM,CAAC,IAAM,mBAAmB,GAAG,UAAC,GAAQ;IAC3C,IAAM,GAAG,GAA4B,cAAc,CAAC;IACpD,OAAO,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;AACxB,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAgB,KAAK,CAC1B,eAAsC,EACtC,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AA+B;+EAC3B,MAAM,CAAC,KAAG,CAAC;oDAElB,qBAAM,IAAI,OAAO,CAAC,UAAA,CAAC;oDAClB,MAAM,GAAG,CAAC,CAAC,CAAC,yCAAyC;oDACrD,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,SAAO,CAAC,CAAC;gDACvC,CAAC,CAAC,EAAA;;gDAHF,SAGE,CAAC;;;;;;;;;qCA/BC,CAAC,UAAU;;;;;;;;gCAoClB,mDAAmD;gCACnD,MAAM,CAAC,SAAS,CAAC,CAAC;;;;qBAClB,CAAC,EAAC;;;CACH;AAED,IAAM,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnC;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC9B,UAAiC;IAAjC,2BAAA,EAAA,yBAAiC;IAEjC,IAAM,YAAY,GAAG,GAAG,CAAC;IACzB,IAAM,aAAa,GAAG,GAAG,CAAC;IAE1B,OAAO,UAAA,OAAO;QACb,IAAM,KAAK,GAAG,SAAA,CAAC,EAAI,OAAO,CAAA,GAAG,YAAY,GAAG,aAAa,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1E,OAAO,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAC3C,CAAC,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,IAAM,wBAAwB,GAAG,UACvC,eAAsC,EACtC,IAAW,EACX,UAAiC,EACjC,WAA2B;IAD3B,2BAAA,EAAA,yBAAiC;IAGjC,OAAA,KAAK,CAAC,eAAe,EAAE,IAAI,EAAE,eAAe,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC;AAAtE,CAAsE,CAAC"}
|
package/lib-esm/Util/index.d.ts
CHANGED
package/lib-esm/Util/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Util/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Util/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC"}
|
package/lib-esm/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Amplify } from './Amplify';
|
|
2
|
+
export { Amplify } from './Amplify';
|
|
2
3
|
export { AmplifyClass } from './Amplify';
|
|
3
4
|
export { ClientDevice } from './ClientDevice';
|
|
4
5
|
export { ConsoleLogger, ConsoleLogger as Logger } from './Logger';
|
|
@@ -7,7 +8,7 @@ export { Hub, HubCapsule, HubCallback, HubPayload } from './Hub';
|
|
|
7
8
|
export { I18n } from './I18n';
|
|
8
9
|
export * from './JS';
|
|
9
10
|
export { Signer } from './Signer';
|
|
10
|
-
export * from './
|
|
11
|
+
export * from './parseAWSExports';
|
|
11
12
|
export * from './Providers';
|
|
12
13
|
export { FacebookOAuth, GoogleOAuth } from './OAuthHelper';
|
|
13
14
|
export * from './RNComponents';
|
|
@@ -23,7 +24,6 @@ export declare const Constants: {
|
|
|
23
24
|
};
|
|
24
25
|
export * from './constants';
|
|
25
26
|
export * from './Util';
|
|
26
|
-
export { Amplify };
|
|
27
27
|
/**
|
|
28
28
|
* @deprecated use named import
|
|
29
29
|
*/
|
package/lib-esm/index.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { Amplify } from './Amplify';
|
|
14
14
|
import { Platform } from './Platform';
|
|
15
|
+
export { Amplify } from './Amplify';
|
|
15
16
|
export { AmplifyClass } from './Amplify';
|
|
16
17
|
export { ClientDevice } from './ClientDevice';
|
|
17
18
|
export { ConsoleLogger, ConsoleLogger as Logger } from './Logger';
|
|
@@ -20,7 +21,7 @@ export { Hub } from './Hub';
|
|
|
20
21
|
export { I18n } from './I18n';
|
|
21
22
|
export * from './JS';
|
|
22
23
|
export { Signer } from './Signer';
|
|
23
|
-
export * from './
|
|
24
|
+
export * from './parseAWSExports';
|
|
24
25
|
export * from './Providers';
|
|
25
26
|
export { FacebookOAuth, GoogleOAuth } from './OAuthHelper';
|
|
26
27
|
export * from './RNComponents';
|
|
@@ -35,7 +36,6 @@ export var Constants = {
|
|
|
35
36
|
};
|
|
36
37
|
export * from './constants';
|
|
37
38
|
export * from './Util';
|
|
38
|
-
export { Amplify };
|
|
39
39
|
/**
|
|
40
40
|
* @deprecated use named import
|
|
41
41
|
*/
|
package/lib-esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,aAAa,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAClE,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,GAAG,EAAuC,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AA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7B,CAAC;AAEF,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AAEvB;;GAEG;AACH,eAAe,OAAO,CAAC"}
|
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
1
|
+
import { __assign } from "tslib";
|
|
12
2
|
import { ConsoleLogger as Logger } from './Logger';
|
|
13
3
|
var logger = new Logger('Parser');
|
|
14
|
-
export var
|
|
4
|
+
export var parseAWSExports = function (config) {
|
|
15
5
|
var amplifyConfig = {};
|
|
16
6
|
// Analytics
|
|
17
7
|
if (config['aws_mobile_analytics_app_id']) {
|
|
@@ -69,18 +59,4 @@ export var parseMobileHubConfig = function (config) {
|
|
|
69
59
|
logger.debug('parse config', config, 'to amplifyconfig', amplifyConfig);
|
|
70
60
|
return amplifyConfig;
|
|
71
61
|
};
|
|
72
|
-
|
|
73
|
-
* @deprecated use per-function export
|
|
74
|
-
*/
|
|
75
|
-
var Parser = /** @class */ (function () {
|
|
76
|
-
function Parser() {
|
|
77
|
-
}
|
|
78
|
-
Parser.parseMobilehubConfig = parseMobileHubConfig;
|
|
79
|
-
return Parser;
|
|
80
|
-
}());
|
|
81
|
-
export { Parser };
|
|
82
|
-
/**
|
|
83
|
-
* @deprecated use per-function export
|
|
84
|
-
*/
|
|
85
|
-
export default Parser;
|
|
86
|
-
//# sourceMappingURL=Parser.js.map
|
|
62
|
+
//# sourceMappingURL=parseAWSExports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseAWSExports.js","sourceRoot":"","sources":["../src/parseAWSExports.ts"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 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/core",
|
|
3
|
-
"version": "4.6.2-next.
|
|
3
|
+
"version": "4.6.2-next.32+4137aa79c",
|
|
4
4
|
"description": "Core category of aws-amplify",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib-esm/index.js",
|
|
@@ -54,13 +54,20 @@
|
|
|
54
54
|
"prepend-file": "^1.3.1",
|
|
55
55
|
"react-native": "^0.64.1"
|
|
56
56
|
},
|
|
57
|
+
"files": [
|
|
58
|
+
"lib",
|
|
59
|
+
"lib-esm",
|
|
60
|
+
"src",
|
|
61
|
+
"typings.d.ts"
|
|
62
|
+
],
|
|
57
63
|
"dependencies": {
|
|
58
|
-
"@aws-crypto/sha256-js": "1.
|
|
64
|
+
"@aws-crypto/sha256-js": "1.2.2",
|
|
59
65
|
"@aws-sdk/client-cloudwatch-logs": "3.6.1",
|
|
60
66
|
"@aws-sdk/client-cognito-identity": "3.6.1",
|
|
61
67
|
"@aws-sdk/credential-provider-cognito-identity": "3.6.1",
|
|
62
68
|
"@aws-sdk/types": "3.6.1",
|
|
63
69
|
"@aws-sdk/util-hex-encoding": "3.6.1",
|
|
70
|
+
"tslib": "^2.0.0",
|
|
64
71
|
"universal-cookie": "^4.0.4",
|
|
65
72
|
"zen-observable-ts": "0.8.19"
|
|
66
73
|
},
|
|
@@ -108,5 +115,5 @@
|
|
|
108
115
|
"lib-esm"
|
|
109
116
|
]
|
|
110
117
|
},
|
|
111
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "4137aa79c6c2362afc581d3915d77f5067ea6700"
|
|
112
119
|
}
|
package/src/Amplify.ts
CHANGED
|
@@ -27,6 +27,7 @@ export class AmplifyClass {
|
|
|
27
27
|
Predictions = null;
|
|
28
28
|
DataStore = null;
|
|
29
29
|
Geo = null;
|
|
30
|
+
Notifications = null;
|
|
30
31
|
|
|
31
32
|
Logger = LoggerClass;
|
|
32
33
|
ServiceWorker = null;
|
|
@@ -95,8 +96,3 @@ export class AmplifyClass {
|
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
export const Amplify = new AmplifyClass();
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* @deprecated use named import
|
|
101
|
-
*/
|
|
102
|
-
export default Amplify;
|
package/src/Credentials.ts
CHANGED
|
@@ -187,7 +187,7 @@ export class CredentialsClass {
|
|
|
187
187
|
const MAX_DELAY_MS = 10 * 1000;
|
|
188
188
|
// refreshHandler will retry network errors, otherwise it will
|
|
189
189
|
// return NonRetryableError to break out of jitteredExponentialRetry
|
|
190
|
-
return jitteredExponentialRetry(refreshHandler, [], MAX_DELAY_MS)
|
|
190
|
+
return jitteredExponentialRetry<any>(refreshHandler, [], MAX_DELAY_MS)
|
|
191
191
|
.then(data => {
|
|
192
192
|
logger.debug('refresh federated token sucessfully', data);
|
|
193
193
|
return this._setCredentialsFromFederation({
|
|
@@ -256,7 +256,7 @@ export class CredentialsClass {
|
|
|
256
256
|
);
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
const identityId = this._identityId = await this._getGuestIdentityId();
|
|
259
|
+
const identityId = (this._identityId = await this._getGuestIdentityId());
|
|
260
260
|
|
|
261
261
|
const cognitoClient = new CognitoIdentityClient({
|
|
262
262
|
region,
|
|
@@ -446,19 +446,14 @@ export class CredentialsClass {
|
|
|
446
446
|
}
|
|
447
447
|
|
|
448
448
|
const {
|
|
449
|
-
Credentials: {
|
|
450
|
-
AccessKeyId,
|
|
451
|
-
Expiration,
|
|
452
|
-
SecretKey,
|
|
453
|
-
SessionToken,
|
|
454
|
-
},
|
|
449
|
+
Credentials: { AccessKeyId, Expiration, SecretKey, SessionToken },
|
|
455
450
|
// single source of truth for the primary identity associated with the logins
|
|
456
451
|
// only if a guest identity is used for a first-time user, that guest identity will become its primary identity
|
|
457
452
|
IdentityId: primaryIdentityId,
|
|
458
453
|
} = await cognitoClient.send(
|
|
459
454
|
new GetCredentialsForIdentityCommand({
|
|
460
|
-
|
|
461
|
-
|
|
455
|
+
IdentityId: guestIdentityId || generatedOrRetrievedIdentityId,
|
|
456
|
+
Logins: logins,
|
|
462
457
|
})
|
|
463
458
|
);
|
|
464
459
|
|
|
@@ -466,9 +461,13 @@ export class CredentialsClass {
|
|
|
466
461
|
if (guestIdentityId) {
|
|
467
462
|
// if guestIdentity is found and used by GetCredentialsForIdentity
|
|
468
463
|
// it will be linked to the logins provided, and disqualified as an unauth identity
|
|
469
|
-
logger.debug(
|
|
464
|
+
logger.debug(
|
|
465
|
+
`The guest identity ${guestIdentityId} has been successfully linked to the logins`
|
|
466
|
+
);
|
|
470
467
|
if (guestIdentityId === primaryIdentityId) {
|
|
471
|
-
logger.debug(
|
|
468
|
+
logger.debug(
|
|
469
|
+
`The guest identity ${guestIdentityId} has become the primary identity`
|
|
470
|
+
);
|
|
472
471
|
}
|
|
473
472
|
// remove it from local storage to avoid being used as a guest Identity by _setCredentialsForGuest
|
|
474
473
|
await this._removeGuestIdentityId();
|
|
@@ -481,7 +480,7 @@ export class CredentialsClass {
|
|
|
481
480
|
sessionToken: SessionToken,
|
|
482
481
|
expiration: Expiration,
|
|
483
482
|
identityId: primaryIdentityId,
|
|
484
|
-
|
|
483
|
+
};
|
|
485
484
|
};
|
|
486
485
|
|
|
487
486
|
const credentials = credentialsProvider().catch(async err => {
|
|
@@ -587,7 +586,7 @@ export class CredentialsClass {
|
|
|
587
586
|
await this._storageSync;
|
|
588
587
|
this._storage.setItem(
|
|
589
588
|
this._getCognitoIdentityIdStorageKey(identityPoolId),
|
|
590
|
-
identityId
|
|
589
|
+
identityId
|
|
591
590
|
);
|
|
592
591
|
} catch (e) {
|
|
593
592
|
logger.debug('Failed to cache guest identityId', e);
|
|
@@ -625,8 +624,3 @@ export class CredentialsClass {
|
|
|
625
624
|
export const Credentials = new CredentialsClass(null);
|
|
626
625
|
|
|
627
626
|
Amplify.register(Credentials);
|
|
628
|
-
|
|
629
|
-
/**
|
|
630
|
-
* @deprecated use named import
|
|
631
|
-
*/
|
|
632
|
-
export default Credentials;
|
package/src/Hub.ts
CHANGED
|
@@ -15,10 +15,11 @@ import { ConsoleLogger as Logger } from './Logger';
|
|
|
15
15
|
|
|
16
16
|
const logger = new Logger('Hub');
|
|
17
17
|
|
|
18
|
-
const AMPLIFY_SYMBOL = (
|
|
19
|
-
typeof Symbol.for === 'function'
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const AMPLIFY_SYMBOL = (
|
|
19
|
+
typeof Symbol !== 'undefined' && typeof Symbol.for === 'function'
|
|
20
|
+
? Symbol.for('amplify_default')
|
|
21
|
+
: '@@amplify_default'
|
|
22
|
+
) as Symbol;
|
|
22
23
|
interface IPattern {
|
|
23
24
|
pattern: RegExp;
|
|
24
25
|
callback: HubCallback;
|
|
@@ -71,8 +72,13 @@ export class HubClass {
|
|
|
71
72
|
this.name = name;
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Used internally to remove a Hub listener.
|
|
77
|
+
*
|
|
78
|
+
* @remarks
|
|
79
|
+
* This private method is for internal use only. Instead of calling Hub.remove, call the result of Hub.listen.
|
|
80
|
+
*/
|
|
81
|
+
private _remove(channel: string | RegExp, listener: HubCallback) {
|
|
76
82
|
if (channel instanceof RegExp) {
|
|
77
83
|
const pattern = this.patterns.find(
|
|
78
84
|
({ pattern }) => pattern.source === channel.source
|
|
@@ -94,6 +100,22 @@ export class HubClass {
|
|
|
94
100
|
}
|
|
95
101
|
}
|
|
96
102
|
|
|
103
|
+
/**
|
|
104
|
+
* @deprecated Instead of calling Hub.remove, call the result of Hub.listen.
|
|
105
|
+
*/
|
|
106
|
+
remove(channel: string | RegExp, listener: HubCallback) {
|
|
107
|
+
this._remove(channel, listener);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Used to send a Hub event.
|
|
112
|
+
*
|
|
113
|
+
* @param channel - The channel on which the event will be broadcast
|
|
114
|
+
* @param payload - The HubPayload
|
|
115
|
+
* @param source - The source of the event; defaults to ''
|
|
116
|
+
* @param ampSymbol - Symbol used to determine if the event is dispatched internally on a protected channel
|
|
117
|
+
*
|
|
118
|
+
*/
|
|
97
119
|
dispatch(
|
|
98
120
|
channel: string,
|
|
99
121
|
payload: HubPayload,
|
|
@@ -124,6 +146,15 @@ export class HubClass {
|
|
|
124
146
|
}
|
|
125
147
|
}
|
|
126
148
|
|
|
149
|
+
/**
|
|
150
|
+
* Used to listen for Hub events.
|
|
151
|
+
*
|
|
152
|
+
* @param channel - The channel on which to listen
|
|
153
|
+
* @param callback - The callback to execute when an event is received on the specified channel
|
|
154
|
+
* @param listenerName - The name of the listener; defaults to 'noname'
|
|
155
|
+
* @returns A function which can be called to cancel the listener.
|
|
156
|
+
*
|
|
157
|
+
*/
|
|
127
158
|
listen(
|
|
128
159
|
channel: string | RegExp,
|
|
129
160
|
callback?: HubCallback | LegacyCallback,
|
|
@@ -162,7 +193,7 @@ export class HubClass {
|
|
|
162
193
|
}
|
|
163
194
|
|
|
164
195
|
return () => {
|
|
165
|
-
this.
|
|
196
|
+
this._remove(channel, cb);
|
|
166
197
|
};
|
|
167
198
|
}
|
|
168
199
|
|
|
@@ -212,7 +243,3 @@ export class HubClass {
|
|
|
212
243
|
pseudo Singleton for the main messaging bus, however you can still create
|
|
213
244
|
your own instance of HubClass() for a separate "private bus" of events.*/
|
|
214
245
|
export const Hub = new HubClass('__default__');
|
|
215
|
-
/**
|
|
216
|
-
* @deprecated use named import
|
|
217
|
-
*/
|
|
218
|
-
export default Hub;
|
package/src/I18n/index.ts
CHANGED
package/src/JS.ts
CHANGED
|
@@ -167,8 +167,10 @@ export const isWebWorker = () => {
|
|
|
167
167
|
return false;
|
|
168
168
|
}
|
|
169
169
|
const selfContext = self as { WorkerGlobalScope? };
|
|
170
|
-
return
|
|
171
|
-
|
|
170
|
+
return (
|
|
171
|
+
typeof selfContext.WorkerGlobalScope !== 'undefined' &&
|
|
172
|
+
self instanceof selfContext.WorkerGlobalScope
|
|
173
|
+
);
|
|
172
174
|
};
|
|
173
175
|
|
|
174
176
|
export const browserOrNode = () => {
|
|
@@ -265,26 +267,3 @@ export const isStrictObject = obj => {
|
|
|
265
267
|
!(obj instanceof Boolean)
|
|
266
268
|
);
|
|
267
269
|
};
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* @deprecated use per-function imports
|
|
271
|
-
*/
|
|
272
|
-
export class JS {
|
|
273
|
-
static isEmpty = isEmpty;
|
|
274
|
-
static sortByField = sortByField;
|
|
275
|
-
static objectLessAttributes = objectLessAttributes;
|
|
276
|
-
static filenameToContentType = filenameToContentType;
|
|
277
|
-
static isTextFile = isTextFile;
|
|
278
|
-
static generateRandomString = generateRandomString;
|
|
279
|
-
static makeQuerablePromise = makeQuerablePromise;
|
|
280
|
-
static isWebWorker = isWebWorker;
|
|
281
|
-
static browserOrNode = browserOrNode;
|
|
282
|
-
static transferKeyToLowerCase = transferKeyToLowerCase;
|
|
283
|
-
static transferKeyToUpperCase = transferKeyToUpperCase;
|
|
284
|
-
static isStrictObject = isStrictObject;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* @deprecated use per-function imports
|
|
289
|
-
*/
|
|
290
|
-
export default JS;
|