@aws-amplify/api-rest 2.0.48 → 2.0.49-next.20

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.
@@ -3206,6 +3206,292 @@ exports.decode = exports.parse = __webpack_require__(/*! ./decode */ "../../node
3206
3206
  exports.encode = exports.stringify = __webpack_require__(/*! ./encode */ "../../node_modules/querystring-es3/encode.js");
3207
3207
 
3208
3208
 
3209
+ /***/ }),
3210
+
3211
+ /***/ "../../node_modules/tslib/tslib.es6.js":
3212
+ /*!********************************************************!*\
3213
+ !*** /root/amplify-js/node_modules/tslib/tslib.es6.js ***!
3214
+ \********************************************************/
3215
+ /*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn */
3216
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
3217
+
3218
+ "use strict";
3219
+ __webpack_require__.r(__webpack_exports__);
3220
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__extends", function() { return __extends; });
3221
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; });
3222
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__rest", function() { return __rest; });
3223
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__decorate", function() { return __decorate; });
3224
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__param", function() { return __param; });
3225
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__metadata", function() { return __metadata; });
3226
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__awaiter", function() { return __awaiter; });
3227
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__generator", function() { return __generator; });
3228
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__createBinding", function() { return __createBinding; });
3229
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__exportStar", function() { return __exportStar; });
3230
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__values", function() { return __values; });
3231
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; });
3232
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spread", function() { return __spread; });
3233
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArrays", function() { return __spreadArrays; });
3234
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArray", function() { return __spreadArray; });
3235
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__await", function() { return __await; });
3236
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncGenerator", function() { return __asyncGenerator; });
3237
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncDelegator", function() { return __asyncDelegator; });
3238
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncValues", function() { return __asyncValues; });
3239
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__makeTemplateObject", function() { return __makeTemplateObject; });
3240
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importStar", function() { return __importStar; });
3241
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importDefault", function() { return __importDefault; });
3242
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldGet", function() { return __classPrivateFieldGet; });
3243
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldSet", function() { return __classPrivateFieldSet; });
3244
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldIn", function() { return __classPrivateFieldIn; });
3245
+ /******************************************************************************
3246
+ Copyright (c) Microsoft Corporation.
3247
+
3248
+ Permission to use, copy, modify, and/or distribute this software for any
3249
+ purpose with or without fee is hereby granted.
3250
+
3251
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
3252
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
3253
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
3254
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
3255
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
3256
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
3257
+ PERFORMANCE OF THIS SOFTWARE.
3258
+ ***************************************************************************** */
3259
+ /* global Reflect, Promise */
3260
+
3261
+ var extendStatics = function(d, b) {
3262
+ extendStatics = Object.setPrototypeOf ||
3263
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
3264
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
3265
+ return extendStatics(d, b);
3266
+ };
3267
+
3268
+ function __extends(d, b) {
3269
+ if (typeof b !== "function" && b !== null)
3270
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
3271
+ extendStatics(d, b);
3272
+ function __() { this.constructor = d; }
3273
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3274
+ }
3275
+
3276
+ var __assign = function() {
3277
+ __assign = Object.assign || function __assign(t) {
3278
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
3279
+ s = arguments[i];
3280
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
3281
+ }
3282
+ return t;
3283
+ }
3284
+ return __assign.apply(this, arguments);
3285
+ }
3286
+
3287
+ function __rest(s, e) {
3288
+ var t = {};
3289
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
3290
+ t[p] = s[p];
3291
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
3292
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
3293
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
3294
+ t[p[i]] = s[p[i]];
3295
+ }
3296
+ return t;
3297
+ }
3298
+
3299
+ function __decorate(decorators, target, key, desc) {
3300
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3301
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3302
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3303
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
3304
+ }
3305
+
3306
+ function __param(paramIndex, decorator) {
3307
+ return function (target, key) { decorator(target, key, paramIndex); }
3308
+ }
3309
+
3310
+ function __metadata(metadataKey, metadataValue) {
3311
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
3312
+ }
3313
+
3314
+ function __awaiter(thisArg, _arguments, P, generator) {
3315
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3316
+ return new (P || (P = Promise))(function (resolve, reject) {
3317
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
3318
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
3319
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
3320
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
3321
+ });
3322
+ }
3323
+
3324
+ function __generator(thisArg, body) {
3325
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
3326
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
3327
+ function verb(n) { return function (v) { return step([n, v]); }; }
3328
+ function step(op) {
3329
+ if (f) throw new TypeError("Generator is already executing.");
3330
+ while (_) try {
3331
+ 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;
3332
+ if (y = 0, t) op = [op[0] & 2, t.value];
3333
+ switch (op[0]) {
3334
+ case 0: case 1: t = op; break;
3335
+ case 4: _.label++; return { value: op[1], done: false };
3336
+ case 5: _.label++; y = op[1]; op = [0]; continue;
3337
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
3338
+ default:
3339
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
3340
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
3341
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
3342
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
3343
+ if (t[2]) _.ops.pop();
3344
+ _.trys.pop(); continue;
3345
+ }
3346
+ op = body.call(thisArg, _);
3347
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
3348
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
3349
+ }
3350
+ }
3351
+
3352
+ var __createBinding = Object.create ? (function(o, m, k, k2) {
3353
+ if (k2 === undefined) k2 = k;
3354
+ var desc = Object.getOwnPropertyDescriptor(m, k);
3355
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3356
+ desc = { enumerable: true, get: function() { return m[k]; } };
3357
+ }
3358
+ Object.defineProperty(o, k2, desc);
3359
+ }) : (function(o, m, k, k2) {
3360
+ if (k2 === undefined) k2 = k;
3361
+ o[k2] = m[k];
3362
+ });
3363
+
3364
+ function __exportStar(m, o) {
3365
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
3366
+ }
3367
+
3368
+ function __values(o) {
3369
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3370
+ if (m) return m.call(o);
3371
+ if (o && typeof o.length === "number") return {
3372
+ next: function () {
3373
+ if (o && i >= o.length) o = void 0;
3374
+ return { value: o && o[i++], done: !o };
3375
+ }
3376
+ };
3377
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
3378
+ }
3379
+
3380
+ function __read(o, n) {
3381
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
3382
+ if (!m) return o;
3383
+ var i = m.call(o), r, ar = [], e;
3384
+ try {
3385
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
3386
+ }
3387
+ catch (error) { e = { error: error }; }
3388
+ finally {
3389
+ try {
3390
+ if (r && !r.done && (m = i["return"])) m.call(i);
3391
+ }
3392
+ finally { if (e) throw e.error; }
3393
+ }
3394
+ return ar;
3395
+ }
3396
+
3397
+ /** @deprecated */
3398
+ function __spread() {
3399
+ for (var ar = [], i = 0; i < arguments.length; i++)
3400
+ ar = ar.concat(__read(arguments[i]));
3401
+ return ar;
3402
+ }
3403
+
3404
+ /** @deprecated */
3405
+ function __spreadArrays() {
3406
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
3407
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
3408
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
3409
+ r[k] = a[j];
3410
+ return r;
3411
+ }
3412
+
3413
+ function __spreadArray(to, from, pack) {
3414
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3415
+ if (ar || !(i in from)) {
3416
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
3417
+ ar[i] = from[i];
3418
+ }
3419
+ }
3420
+ return to.concat(ar || Array.prototype.slice.call(from));
3421
+ }
3422
+
3423
+ function __await(v) {
3424
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
3425
+ }
3426
+
3427
+ function __asyncGenerator(thisArg, _arguments, generator) {
3428
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
3429
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
3430
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
3431
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
3432
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
3433
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
3434
+ function fulfill(value) { resume("next", value); }
3435
+ function reject(value) { resume("throw", value); }
3436
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
3437
+ }
3438
+
3439
+ function __asyncDelegator(o) {
3440
+ var i, p;
3441
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
3442
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
3443
+ }
3444
+
3445
+ function __asyncValues(o) {
3446
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
3447
+ var m = o[Symbol.asyncIterator], i;
3448
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
3449
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
3450
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
3451
+ }
3452
+
3453
+ function __makeTemplateObject(cooked, raw) {
3454
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3455
+ return cooked;
3456
+ };
3457
+
3458
+ var __setModuleDefault = Object.create ? (function(o, v) {
3459
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
3460
+ }) : function(o, v) {
3461
+ o["default"] = v;
3462
+ };
3463
+
3464
+ function __importStar(mod) {
3465
+ if (mod && mod.__esModule) return mod;
3466
+ var result = {};
3467
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
3468
+ __setModuleDefault(result, mod);
3469
+ return result;
3470
+ }
3471
+
3472
+ function __importDefault(mod) {
3473
+ return (mod && mod.__esModule) ? mod : { default: mod };
3474
+ }
3475
+
3476
+ function __classPrivateFieldGet(receiver, state, kind, f) {
3477
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3478
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
3479
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
3480
+ }
3481
+
3482
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
3483
+ if (kind === "m") throw new TypeError("Private method is not writable");
3484
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
3485
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
3486
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
3487
+ }
3488
+
3489
+ function __classPrivateFieldIn(state, receiver) {
3490
+ if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
3491
+ return typeof state === "function" ? receiver === state : state.has(receiver);
3492
+ }
3493
+
3494
+
3209
3495
  /***/ }),
3210
3496
 
3211
3497
  /***/ "../../node_modules/url/url.js":
@@ -4055,180 +4341,11 @@ module.exports = function(module) {
4055
4341
  __webpack_require__.r(__webpack_exports__);
4056
4342
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RestAPIClass", function() { return RestAPIClass; });
4057
4343
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RestAPI", function() { return RestAPI; });
4058
- /* harmony import */ var _RestClient__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./RestClient */ "./lib-esm/RestClient.js");
4059
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
4060
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__);
4061
- var __assign = undefined && undefined.__assign || function () {
4062
- __assign = Object.assign || function (t) {
4063
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4064
- s = arguments[i];
4065
-
4066
- for (var p in s) {
4067
- if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
4068
- }
4069
- }
4070
-
4071
- return t;
4072
- };
4073
-
4074
- return __assign.apply(this, arguments);
4075
- };
4076
-
4077
- var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
4078
- function adopt(value) {
4079
- return value instanceof P ? value : new P(function (resolve) {
4080
- resolve(value);
4081
- });
4082
- }
4083
-
4084
- return new (P || (P = Promise))(function (resolve, reject) {
4085
- function fulfilled(value) {
4086
- try {
4087
- step(generator.next(value));
4088
- } catch (e) {
4089
- reject(e);
4090
- }
4091
- }
4092
-
4093
- function rejected(value) {
4094
- try {
4095
- step(generator["throw"](value));
4096
- } catch (e) {
4097
- reject(e);
4098
- }
4099
- }
4100
-
4101
- function step(result) {
4102
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
4103
- }
4104
-
4105
- step((generator = generator.apply(thisArg, _arguments || [])).next());
4106
- });
4107
- };
4108
-
4109
- var __generator = undefined && undefined.__generator || function (thisArg, body) {
4110
- var _ = {
4111
- label: 0,
4112
- sent: function sent() {
4113
- if (t[0] & 1) throw t[1];
4114
- return t[1];
4115
- },
4116
- trys: [],
4117
- ops: []
4118
- },
4119
- f,
4120
- y,
4121
- t,
4122
- g;
4123
- return g = {
4124
- next: verb(0),
4125
- "throw": verb(1),
4126
- "return": verb(2)
4127
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
4128
- return this;
4129
- }), g;
4130
-
4131
- function verb(n) {
4132
- return function (v) {
4133
- return step([n, v]);
4134
- };
4135
- }
4136
-
4137
- function step(op) {
4138
- if (f) throw new TypeError("Generator is already executing.");
4139
-
4140
- while (_) {
4141
- try {
4142
- 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;
4143
- if (y = 0, t) op = [op[0] & 2, t.value];
4144
-
4145
- switch (op[0]) {
4146
- case 0:
4147
- case 1:
4148
- t = op;
4149
- break;
4150
-
4151
- case 4:
4152
- _.label++;
4153
- return {
4154
- value: op[1],
4155
- done: false
4156
- };
4157
-
4158
- case 5:
4159
- _.label++;
4160
- y = op[1];
4161
- op = [0];
4162
- continue;
4163
-
4164
- case 7:
4165
- op = _.ops.pop();
4166
-
4167
- _.trys.pop();
4168
-
4169
- continue;
4170
-
4171
- default:
4172
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
4173
- _ = 0;
4174
- continue;
4175
- }
4176
-
4177
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
4178
- _.label = op[1];
4179
- break;
4180
- }
4181
-
4182
- if (op[0] === 6 && _.label < t[1]) {
4183
- _.label = t[1];
4184
- t = op;
4185
- break;
4186
- }
4187
-
4188
- if (t && _.label < t[2]) {
4189
- _.label = t[2];
4190
-
4191
- _.ops.push(op);
4192
-
4193
- break;
4194
- }
4195
-
4196
- if (t[2]) _.ops.pop();
4197
-
4198
- _.trys.pop();
4199
-
4200
- continue;
4201
- }
4202
-
4203
- op = body.call(thisArg, _);
4204
- } catch (e) {
4205
- op = [6, e];
4206
- y = 0;
4207
- } finally {
4208
- f = t = 0;
4209
- }
4210
- }
4211
-
4212
- if (op[0] & 5) throw op[1];
4213
- return {
4214
- value: op[0] ? op[1] : void 0,
4215
- done: true
4216
- };
4217
- }
4218
- };
4219
-
4220
- var __rest = undefined && undefined.__rest || function (s, e) {
4221
- var t = {};
4222
-
4223
- for (var p in s) {
4224
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
4225
- }
4344
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
4345
+ /* harmony import */ var _RestClient__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./RestClient */ "./lib-esm/RestClient.js");
4346
+ /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
4347
+ /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_2__);
4226
4348
 
4227
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
4228
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
4229
- }
4230
- return t;
4231
- };
4232
4349
  /*
4233
4350
  * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4234
4351
  *
@@ -4243,27 +4360,21 @@ var __rest = undefined && undefined.__rest || function (s, e) {
4243
4360
  */
4244
4361
 
4245
4362
 
4246
-
4247
-
4248
- var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('RestAPI');
4363
+ var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_2__["ConsoleLogger"]('RestAPI');
4249
4364
  /**
4250
4365
  * Export Cloud Logic APIs
4251
4366
  */
4252
-
4253
- var RestAPIClass =
4254
- /** @class */
4255
- function () {
4367
+ var RestAPIClass = /** @class */function () {
4256
4368
  /**
4257
4369
  * Initialize Rest API with AWS configuration
4258
4370
  * @param {Object} options - Configuration object for API
4259
4371
  */
4260
4372
  function RestAPIClass(options) {
4261
4373
  this._api = null;
4262
- this.Credentials = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Credentials"];
4374
+ this.Credentials = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_2__["Credentials"];
4263
4375
  this._options = options;
4264
4376
  logger.debug('API Options', this._options);
4265
4377
  }
4266
-
4267
4378
  RestAPIClass.prototype.getModuleName = function () {
4268
4379
  return 'RestAPI';
4269
4380
  };
@@ -4272,32 +4383,25 @@ function () {
4272
4383
  * @param {Object} config - Configuration of the API
4273
4384
  * @return {Object} - The current configuration
4274
4385
  */
4275
-
4276
-
4277
4386
  RestAPIClass.prototype.configure = function (options) {
4278
4387
  var _a = options || {},
4279
- _b = _a.API,
4280
- API = _b === void 0 ? {} : _b,
4281
- otherOptions = __rest(_a, ["API"]);
4282
-
4283
- var opt = __assign(__assign({}, otherOptions), API);
4284
-
4388
+ _b = _a.API,
4389
+ API = _b === void 0 ? {} : _b,
4390
+ otherOptions = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__rest"])(_a, ["API"]);
4391
+ var opt = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, otherOptions), API);
4285
4392
  logger.debug('configure Rest API', {
4286
4393
  opt: opt
4287
4394
  });
4288
-
4289
4395
  if (opt['aws_project_region']) {
4290
4396
  if (opt['aws_cloud_logic_custom']) {
4291
4397
  var custom = opt['aws_cloud_logic_custom'];
4292
4398
  opt.endpoints = typeof custom === 'string' ? JSON.parse(custom) : custom;
4293
4399
  }
4294
-
4295
4400
  opt = Object.assign({}, opt, {
4296
4401
  region: opt['aws_project_region'],
4297
4402
  header: {}
4298
4403
  });
4299
4404
  }
4300
-
4301
4405
  if (Array.isArray(opt.endpoints)) {
4302
4406
  // Check if endpoints has custom_headers and validate if is a function
4303
4407
  opt.endpoints.forEach(function (endpoint) {
@@ -4311,7 +4415,6 @@ function () {
4311
4415
  } else {
4312
4416
  opt.endpoints = [];
4313
4417
  }
4314
-
4315
4418
  this._options = Object.assign({}, this._options, opt);
4316
4419
  this.createInstance();
4317
4420
  return this._options;
@@ -4320,12 +4423,10 @@ function () {
4320
4423
  * Create an instance of API for the library
4321
4424
  * @return - A promise of true if Success
4322
4425
  */
4323
-
4324
-
4325
4426
  RestAPIClass.prototype.createInstance = function () {
4326
4427
  logger.debug('create Rest API instance');
4327
- this._api = new _RestClient__WEBPACK_IMPORTED_MODULE_0__["RestClient"](this._options); // Share Amplify instance with client for SSR
4328
-
4428
+ this._api = new _RestClient__WEBPACK_IMPORTED_MODULE_1__["RestClient"](this._options);
4429
+ // Share Amplify instance with client for SSR
4329
4430
  this._api.Credentials = this.Credentials;
4330
4431
  return true;
4331
4432
  };
@@ -4336,21 +4437,14 @@ function () {
4336
4437
  * @param {json} [init] - Request extra params
4337
4438
  * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
4338
4439
  */
4339
-
4340
-
4341
4440
  RestAPIClass.prototype.get = function (apiName, path, init) {
4342
4441
  try {
4343
4442
  var apiInfo = this.getEndpointInfo(apiName, path);
4344
-
4345
4443
  var cancellableToken = this._api.getCancellableToken();
4346
-
4347
4444
  var initParams = Object.assign({}, init);
4348
4445
  initParams.cancellableToken = cancellableToken;
4349
-
4350
4446
  var responsePromise = this._api.get(apiInfo, initParams);
4351
-
4352
4447
  this._api.updateRequestToBeCancellable(responsePromise, cancellableToken);
4353
-
4354
4448
  return responsePromise;
4355
4449
  } catch (err) {
4356
4450
  return Promise.reject(err.message);
@@ -4363,21 +4457,14 @@ function () {
4363
4457
  * @param {json} [init] - Request extra params
4364
4458
  * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
4365
4459
  */
4366
-
4367
-
4368
4460
  RestAPIClass.prototype.post = function (apiName, path, init) {
4369
4461
  try {
4370
4462
  var apiInfo = this.getEndpointInfo(apiName, path);
4371
-
4372
4463
  var cancellableToken = this._api.getCancellableToken();
4373
-
4374
4464
  var initParams = Object.assign({}, init);
4375
4465
  initParams.cancellableToken = cancellableToken;
4376
-
4377
4466
  var responsePromise = this._api.post(apiInfo, initParams);
4378
-
4379
4467
  this._api.updateRequestToBeCancellable(responsePromise, cancellableToken);
4380
-
4381
4468
  return responsePromise;
4382
4469
  } catch (err) {
4383
4470
  return Promise.reject(err.message);
@@ -4390,21 +4477,14 @@ function () {
4390
4477
  * @param {json} [init] - Request extra params
4391
4478
  * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
4392
4479
  */
4393
-
4394
-
4395
4480
  RestAPIClass.prototype.put = function (apiName, path, init) {
4396
4481
  try {
4397
4482
  var apiInfo = this.getEndpointInfo(apiName, path);
4398
-
4399
4483
  var cancellableToken = this._api.getCancellableToken();
4400
-
4401
4484
  var initParams = Object.assign({}, init);
4402
4485
  initParams.cancellableToken = cancellableToken;
4403
-
4404
4486
  var responsePromise = this._api.put(apiInfo, initParams);
4405
-
4406
4487
  this._api.updateRequestToBeCancellable(responsePromise, cancellableToken);
4407
-
4408
4488
  return responsePromise;
4409
4489
  } catch (err) {
4410
4490
  return Promise.reject(err.message);
@@ -4417,21 +4497,14 @@ function () {
4417
4497
  * @param {json} [init] - Request extra params
4418
4498
  * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
4419
4499
  */
4420
-
4421
-
4422
4500
  RestAPIClass.prototype.patch = function (apiName, path, init) {
4423
4501
  try {
4424
4502
  var apiInfo = this.getEndpointInfo(apiName, path);
4425
-
4426
4503
  var cancellableToken = this._api.getCancellableToken();
4427
-
4428
4504
  var initParams = Object.assign({}, init);
4429
4505
  initParams.cancellableToken = cancellableToken;
4430
-
4431
4506
  var responsePromise = this._api.patch(apiInfo, initParams);
4432
-
4433
4507
  this._api.updateRequestToBeCancellable(responsePromise, cancellableToken);
4434
-
4435
4508
  return responsePromise;
4436
4509
  } catch (err) {
4437
4510
  return Promise.reject(err.message);
@@ -4444,21 +4517,14 @@ function () {
4444
4517
  * @param {json} [init] - Request extra params
4445
4518
  * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
4446
4519
  */
4447
-
4448
-
4449
4520
  RestAPIClass.prototype.del = function (apiName, path, init) {
4450
4521
  try {
4451
4522
  var apiInfo = this.getEndpointInfo(apiName, path);
4452
-
4453
4523
  var cancellableToken = this._api.getCancellableToken();
4454
-
4455
4524
  var initParams = Object.assign({}, init);
4456
4525
  initParams.cancellableToken = cancellableToken;
4457
-
4458
4526
  var responsePromise = this._api.del(apiInfo, initParams);
4459
-
4460
4527
  this._api.updateRequestToBeCancellable(responsePromise, cancellableToken);
4461
-
4462
4528
  return responsePromise;
4463
4529
  } catch (err) {
4464
4530
  return Promise.reject(err.message);
@@ -4471,21 +4537,14 @@ function () {
4471
4537
  * @param {json} [init] - Request extra params
4472
4538
  * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
4473
4539
  */
4474
-
4475
-
4476
4540
  RestAPIClass.prototype.head = function (apiName, path, init) {
4477
4541
  try {
4478
4542
  var apiInfo = this.getEndpointInfo(apiName, path);
4479
-
4480
4543
  var cancellableToken = this._api.getCancellableToken();
4481
-
4482
4544
  var initParams = Object.assign({}, init);
4483
4545
  initParams.cancellableToken = cancellableToken;
4484
-
4485
4546
  var responsePromise = this._api.head(apiInfo, initParams);
4486
-
4487
4547
  this._api.updateRequestToBeCancellable(responsePromise, cancellableToken);
4488
-
4489
4548
  return responsePromise;
4490
4549
  } catch (err) {
4491
4550
  return Promise.reject(err.message);
@@ -4496,8 +4555,6 @@ function () {
4496
4555
  * @param {any} error - Any error
4497
4556
  * @return {boolean} - A boolean indicating if the error was from an api request cancellation
4498
4557
  */
4499
-
4500
-
4501
4558
  RestAPIClass.prototype.isCancel = function (error) {
4502
4559
  return this._api.isCancel(error);
4503
4560
  };
@@ -4506,8 +4563,6 @@ function () {
4506
4563
  * @param {any} request - request to cancel
4507
4564
  * @return {boolean} - A boolean indicating if the request was cancelled
4508
4565
  */
4509
-
4510
-
4511
4566
  RestAPIClass.prototype.cancel = function (request, message) {
4512
4567
  return this._api.cancel(request, message);
4513
4568
  };
@@ -4516,8 +4571,6 @@ function () {
4516
4571
  * @params request - The request promise
4517
4572
  * @return if the request has a corresponding cancel token.
4518
4573
  */
4519
-
4520
-
4521
4574
  RestAPIClass.prototype.hasCancelToken = function (request) {
4522
4575
  return this._api.hasCancelToken(request);
4523
4576
  };
@@ -4526,14 +4579,10 @@ function () {
4526
4579
  * @param {string} apiName - The name of the api
4527
4580
  * @return {string} - The endpoint of the api
4528
4581
  */
4529
-
4530
-
4531
4582
  RestAPIClass.prototype.endpoint = function (apiName) {
4532
- return __awaiter(this, void 0, void 0, function () {
4533
- return __generator(this, function (_a) {
4534
- return [2
4535
- /*return*/
4536
- , this._api.endpoint(apiName)];
4583
+ return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () {
4584
+ return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_a) {
4585
+ return [2 /*return*/, this._api.endpoint(apiName)];
4537
4586
  });
4538
4587
  });
4539
4588
  };
@@ -4543,54 +4592,42 @@ function () {
4543
4592
  * @param {string} path - The path of the api that is going to accessed
4544
4593
  * @return {ApiInfo} - The endpoint information for that api-name
4545
4594
  */
4546
-
4547
-
4548
4595
  RestAPIClass.prototype.getEndpointInfo = function (apiName, path) {
4549
4596
  var cloud_logic_array = this._options.endpoints;
4550
-
4551
4597
  if (!Array.isArray(cloud_logic_array)) {
4552
4598
  throw new Error("API category not configured");
4553
4599
  }
4554
-
4555
4600
  var apiConfig = cloud_logic_array.find(function (api) {
4556
4601
  return api.name === apiName;
4557
4602
  });
4558
-
4559
4603
  if (!apiConfig) {
4560
4604
  throw new Error("API " + apiName + " does not exist");
4561
4605
  }
4562
-
4563
4606
  var response = {
4564
4607
  endpoint: apiConfig.endpoint + path
4565
4608
  };
4566
-
4567
4609
  if (typeof apiConfig.region === 'string') {
4568
4610
  response.region = apiConfig.region;
4569
4611
  } else if (typeof this._options.region === 'string') {
4570
4612
  response.region = this._options.region;
4571
4613
  }
4572
-
4573
4614
  if (typeof apiConfig.service === 'string') {
4574
4615
  response.service = apiConfig.service || 'execute-api';
4575
4616
  } else {
4576
4617
  response.service = 'execute-api';
4577
4618
  }
4578
-
4579
4619
  if (typeof apiConfig.custom_header === 'function') {
4580
4620
  response.custom_header = apiConfig.custom_header;
4581
4621
  } else {
4582
4622
  response.custom_header = undefined;
4583
4623
  }
4584
-
4585
4624
  return response;
4586
4625
  };
4587
-
4588
4626
  return RestAPIClass;
4589
4627
  }();
4590
4628
 
4591
-
4592
4629
  var RestAPI = new RestAPIClass(null);
4593
- _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Amplify"].register(RestAPI);
4630
+ _aws_amplify_core__WEBPACK_IMPORTED_MODULE_2__["Amplify"].register(RestAPI);
4594
4631
 
4595
4632
  /***/ }),
4596
4633
 
@@ -4604,12 +4641,13 @@ _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Amplify"].register(RestAPI);
4604
4641
  "use strict";
4605
4642
  __webpack_require__.r(__webpack_exports__);
4606
4643
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RestClient", function() { return RestClient; });
4607
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
4608
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__);
4609
- /* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! axios */ "../../node_modules/axios/index.js");
4610
- /* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_1__);
4611
- /* harmony import */ var url__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! url */ "../../node_modules/url/url.js");
4612
- /* harmony import */ var url__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(url__WEBPACK_IMPORTED_MODULE_2__);
4644
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
4645
+ /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
4646
+ /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__);
4647
+ /* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! axios */ "../../node_modules/axios/index.js");
4648
+ /* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_2__);
4649
+ /* harmony import */ var url__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! url */ "../../node_modules/url/url.js");
4650
+ /* harmony import */ var url__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(url__WEBPACK_IMPORTED_MODULE_3__);
4613
4651
  /*
4614
4652
  * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4615
4653
  *
@@ -4622,182 +4660,11 @@ __webpack_require__.r(__webpack_exports__);
4622
4660
  * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
4623
4661
  * and limitations under the License.
4624
4662
  */
4625
- var __assign = undefined && undefined.__assign || function () {
4626
- __assign = Object.assign || function (t) {
4627
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4628
- s = arguments[i];
4629
-
4630
- for (var p in s) {
4631
- if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
4632
- }
4633
- }
4634
-
4635
- return t;
4636
- };
4637
-
4638
- return __assign.apply(this, arguments);
4639
- };
4640
-
4641
- var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
4642
- function adopt(value) {
4643
- return value instanceof P ? value : new P(function (resolve) {
4644
- resolve(value);
4645
- });
4646
- }
4647
-
4648
- return new (P || (P = Promise))(function (resolve, reject) {
4649
- function fulfilled(value) {
4650
- try {
4651
- step(generator.next(value));
4652
- } catch (e) {
4653
- reject(e);
4654
- }
4655
- }
4656
-
4657
- function rejected(value) {
4658
- try {
4659
- step(generator["throw"](value));
4660
- } catch (e) {
4661
- reject(e);
4662
- }
4663
- }
4664
-
4665
- function step(result) {
4666
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
4667
- }
4668
-
4669
- step((generator = generator.apply(thisArg, _arguments || [])).next());
4670
- });
4671
- };
4672
-
4673
- var __generator = undefined && undefined.__generator || function (thisArg, body) {
4674
- var _ = {
4675
- label: 0,
4676
- sent: function sent() {
4677
- if (t[0] & 1) throw t[1];
4678
- return t[1];
4679
- },
4680
- trys: [],
4681
- ops: []
4682
- },
4683
- f,
4684
- y,
4685
- t,
4686
- g;
4687
- return g = {
4688
- next: verb(0),
4689
- "throw": verb(1),
4690
- "return": verb(2)
4691
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
4692
- return this;
4693
- }), g;
4694
-
4695
- function verb(n) {
4696
- return function (v) {
4697
- return step([n, v]);
4698
- };
4699
- }
4700
-
4701
- function step(op) {
4702
- if (f) throw new TypeError("Generator is already executing.");
4703
4663
 
4704
- while (_) {
4705
- try {
4706
- 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;
4707
- if (y = 0, t) op = [op[0] & 2, t.value];
4708
-
4709
- switch (op[0]) {
4710
- case 0:
4711
- case 1:
4712
- t = op;
4713
- break;
4714
-
4715
- case 4:
4716
- _.label++;
4717
- return {
4718
- value: op[1],
4719
- done: false
4720
- };
4721
-
4722
- case 5:
4723
- _.label++;
4724
- y = op[1];
4725
- op = [0];
4726
- continue;
4727
-
4728
- case 7:
4729
- op = _.ops.pop();
4730
-
4731
- _.trys.pop();
4732
4664
 
4733
- continue;
4734
-
4735
- default:
4736
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
4737
- _ = 0;
4738
- continue;
4739
- }
4740
-
4741
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
4742
- _.label = op[1];
4743
- break;
4744
- }
4745
-
4746
- if (op[0] === 6 && _.label < t[1]) {
4747
- _.label = t[1];
4748
- t = op;
4749
- break;
4750
- }
4751
-
4752
- if (t && _.label < t[2]) {
4753
- _.label = t[2];
4754
-
4755
- _.ops.push(op);
4756
-
4757
- break;
4758
- }
4759
-
4760
- if (t[2]) _.ops.pop();
4761
-
4762
- _.trys.pop();
4763
-
4764
- continue;
4765
- }
4766
-
4767
- op = body.call(thisArg, _);
4768
- } catch (e) {
4769
- op = [6, e];
4770
- y = 0;
4771
- } finally {
4772
- f = t = 0;
4773
- }
4774
- }
4775
-
4776
- if (op[0] & 5) throw op[1];
4777
- return {
4778
- value: op[0] ? op[1] : void 0,
4779
- done: true
4780
- };
4781
- }
4782
- };
4783
-
4784
- var __rest = undefined && undefined.__rest || function (s, e) {
4785
- var t = {};
4786
-
4787
- for (var p in s) {
4788
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
4789
- }
4790
-
4791
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
4792
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
4793
- }
4794
- return t;
4795
- };
4796
4665
 
4797
4666
 
4798
-
4799
-
4800
- var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('RestClient');
4667
+ var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('RestClient');
4801
4668
  /**
4802
4669
  * HTTP Client for REST requests. Send and receive JSON data.
4803
4670
  * Sign request with AWS credentials if available
@@ -4811,20 +4678,14 @@ restClient.get('...')
4811
4678
  .catch(err => console.log(err));
4812
4679
  </pre>
4813
4680
  */
4814
-
4815
- var RestClient =
4816
- /** @class */
4817
- function () {
4681
+ var RestClient = /** @class */function () {
4818
4682
  /**
4819
4683
  * @param {RestClientOptions} [options] - Instance options
4820
4684
  */
4821
4685
  function RestClient(options) {
4822
4686
  this._region = 'us-east-1'; // this will be updated by endpoint function
4823
-
4824
4687
  this._service = 'execute-api'; // this can be updated by endpoint function
4825
-
4826
4688
  this._custom_header = undefined; // this can be updated by endpoint function
4827
-
4828
4689
  /**
4829
4690
  * This weak map provides functionality to let clients cancel
4830
4691
  * in-flight axios requests. https://github.com/axios/axios#cancellation
@@ -4839,12 +4700,10 @@ function () {
4839
4700
  *
4840
4701
  * For more details, see https://github.com/aws-amplify/amplify-js/pull/3769#issuecomment-552660025
4841
4702
  */
4842
-
4843
4703
  this._cancelTokenMap = null;
4844
- this.Credentials = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Credentials"];
4704
+ this.Credentials = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Credentials"];
4845
4705
  this._options = options;
4846
4706
  logger.debug('API Options', this._options);
4847
-
4848
4707
  if (this._cancelTokenMap == null) {
4849
4708
  this._cancelTokenMap = new WeakMap();
4850
4709
  }
@@ -4857,7 +4716,6 @@ function () {
4857
4716
  this.options.credentials = credentials;
4858
4717
  }
4859
4718
  */
4860
-
4861
4719
  /**
4862
4720
  * Basic HTTP request. Customizable
4863
4721
  * @param {string | ApiInfo } urlOrApiInfo - Full request URL or Api information
@@ -4865,22 +4723,17 @@ function () {
4865
4723
  * @param {json} [init] - Request extra params
4866
4724
  * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
4867
4725
  */
4868
-
4869
-
4870
4726
  RestClient.prototype.ajax = function (urlOrApiInfo, method, init) {
4871
- return __awaiter(this, void 0, void 0, function () {
4727
+ return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () {
4872
4728
  var parsed_url, url, region, service, custom_header, params, libraryHeaders, userAgent, initParams, isAllResponse, custom_header_obj, _a, _b, search, parsedUrl;
4873
-
4874
4729
  var _this = this;
4875
-
4876
- return __generator(this, function (_c) {
4730
+ return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_c) {
4877
4731
  switch (_c.label) {
4878
4732
  case 0:
4879
4733
  logger.debug(method, urlOrApiInfo);
4880
4734
  region = 'us-east-1';
4881
4735
  service = 'execute-api';
4882
4736
  custom_header = undefined;
4883
-
4884
4737
  if (typeof urlOrApiInfo === 'string') {
4885
4738
  parsed_url = this._parseUrl(urlOrApiInfo);
4886
4739
  url = urlOrApiInfo;
@@ -4888,7 +4741,6 @@ function () {
4888
4741
  url = urlOrApiInfo.endpoint, custom_header = urlOrApiInfo.custom_header, region = urlOrApiInfo.region, service = urlOrApiInfo.service;
4889
4742
  parsed_url = this._parseUrl(urlOrApiInfo.endpoint);
4890
4743
  }
4891
-
4892
4744
  params = {
4893
4745
  method: method,
4894
4746
  url: url,
@@ -4901,17 +4753,14 @@ function () {
4901
4753
  cancelToken: null
4902
4754
  };
4903
4755
  libraryHeaders = {};
4904
-
4905
- if (_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Platform"].isReactNative) {
4906
- userAgent = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Platform"].userAgent || 'aws-amplify/0.1.x';
4756
+ if (_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Platform"].isReactNative) {
4757
+ userAgent = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Platform"].userAgent || 'aws-amplify/0.1.x';
4907
4758
  libraryHeaders = {
4908
4759
  'User-Agent': userAgent
4909
4760
  };
4910
4761
  }
4911
-
4912
4762
  initParams = Object.assign({}, init);
4913
4763
  isAllResponse = initParams.response;
4914
-
4915
4764
  if (initParams.body) {
4916
4765
  if (typeof FormData === 'function' && initParams.body instanceof FormData) {
4917
4766
  libraryHeaders['Content-Type'] = 'multipart/form-data';
@@ -4921,83 +4770,63 @@ function () {
4921
4770
  params.data = JSON.stringify(initParams.body);
4922
4771
  }
4923
4772
  }
4924
-
4925
4773
  if (initParams.responseType) {
4926
4774
  params.responseType = initParams.responseType;
4927
4775
  }
4928
-
4929
4776
  if (initParams.withCredentials) {
4930
4777
  params['withCredentials'] = initParams.withCredentials;
4931
4778
  }
4932
-
4933
4779
  if (initParams.timeout) {
4934
4780
  params.timeout = initParams.timeout;
4935
4781
  }
4936
-
4937
4782
  if (initParams.cancellableToken) {
4938
4783
  params.cancelToken = initParams.cancellableToken.token;
4939
4784
  }
4940
-
4941
4785
  params['signerServiceInfo'] = initParams.signerServiceInfo;
4942
- if (!(typeof custom_header === 'function')) return [3
4943
- /*break*/
4944
- , 2];
4945
- return [4
4946
- /*yield*/
4947
- , custom_header()];
4948
-
4786
+ if (!(typeof custom_header === 'function')) return [3 /*break*/, 2];
4787
+ return [4 /*yield*/, custom_header()];
4949
4788
  case 1:
4950
4789
  _a = _c.sent();
4951
- return [3
4952
- /*break*/
4953
- , 3];
4954
-
4790
+ return [3 /*break*/, 3];
4955
4791
  case 2:
4956
4792
  _a = undefined;
4957
4793
  _c.label = 3;
4958
-
4959
4794
  case 3:
4960
4795
  custom_header_obj = _a;
4961
- params.headers = __assign(__assign(__assign({}, libraryHeaders), custom_header_obj), initParams.headers);
4962
- _b = Object(url__WEBPACK_IMPORTED_MODULE_2__["parse"])(url, true, true), search = _b.search, parsedUrl = __rest(_b, ["search"]);
4963
- params.url = Object(url__WEBPACK_IMPORTED_MODULE_2__["format"])(__assign(__assign({}, parsedUrl), {
4964
- query: __assign(__assign({}, parsedUrl.query), initParams.queryStringParameters || {})
4965
- })); // Do not sign the request if client has added 'Authorization' header,
4796
+ params.headers = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, libraryHeaders), custom_header_obj), initParams.headers);
4797
+ _b = Object(url__WEBPACK_IMPORTED_MODULE_3__["parse"])(url, true, true), search = _b.search, parsedUrl = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__rest"])(_b, ["search"]);
4798
+ params.url = Object(url__WEBPACK_IMPORTED_MODULE_3__["format"])(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, parsedUrl), {
4799
+ query: Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, parsedUrl.query), initParams.queryStringParameters || {})
4800
+ }));
4801
+ // Do not sign the request if client has added 'Authorization' header,
4966
4802
  // which means custom authorizer.
4967
-
4968
4803
  if (typeof params.headers['Authorization'] !== 'undefined') {
4969
4804
  params.headers = Object.keys(params.headers).reduce(function (acc, k) {
4970
4805
  if (params.headers[k]) {
4971
4806
  acc[k] = params.headers[k];
4972
4807
  }
4973
-
4974
- return acc; // tslint:disable-next-line:align
4808
+ return acc;
4809
+ // tslint:disable-next-line:align
4975
4810
  }, {});
4976
- return [2
4977
- /*return*/
4978
- , this._request(params, isAllResponse)];
4979
- } // Signing the request in case there credentials are available
4980
-
4981
-
4982
- return [2
4983
- /*return*/
4984
- , this.Credentials.get().then(function (credentials) {
4985
- return _this._signed(__assign({}, params), credentials, isAllResponse, {
4811
+ return [2 /*return*/, this._request(params, isAllResponse)];
4812
+ }
4813
+ // Signing the request in case there credentials are available
4814
+ return [2 /*return*/, this.Credentials.get().then(function (credentials) {
4815
+ return _this._signed(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, params), credentials, isAllResponse, {
4986
4816
  region: region,
4987
4817
  service: service
4988
4818
  })["catch"](function (error) {
4989
- if (_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["DateUtils"].isClockSkewError(error)) {
4819
+ if (_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["DateUtils"].isClockSkewError(error)) {
4990
4820
  var headers = error.response.headers;
4991
4821
  var dateHeader = headers && (headers.date || headers.Date);
4992
4822
  var responseDate = new Date(dateHeader);
4993
- var requestDate = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["DateUtils"].getDateFromHeaderString(params.headers['x-amz-date']); // Compare local clock to the server clock
4994
-
4995
- if (_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["DateUtils"].isClockSkewed(responseDate)) {
4996
- _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["DateUtils"].setClockOffset(responseDate.getTime() - requestDate.getTime());
4823
+ var requestDate = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["DateUtils"].getDateFromHeaderString(params.headers['x-amz-date']);
4824
+ // Compare local clock to the server clock
4825
+ if (_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["DateUtils"].isClockSkewed(responseDate)) {
4826
+ _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["DateUtils"].setClockOffset(responseDate.getTime() - requestDate.getTime());
4997
4827
  return _this.ajax(urlOrApiInfo, method, init);
4998
4828
  }
4999
4829
  }
5000
-
5001
4830
  throw error;
5002
4831
  });
5003
4832
  }, function (err) {
@@ -5014,8 +4843,6 @@ function () {
5014
4843
  * @param {JSON} init - Request extra params
5015
4844
  * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
5016
4845
  */
5017
-
5018
-
5019
4846
  RestClient.prototype.get = function (urlOrApiInfo, init) {
5020
4847
  return this.ajax(urlOrApiInfo, 'GET', init);
5021
4848
  };
@@ -5025,8 +4852,6 @@ function () {
5025
4852
  * @param {json} init - Request extra params
5026
4853
  * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
5027
4854
  */
5028
-
5029
-
5030
4855
  RestClient.prototype.put = function (urlOrApiInfo, init) {
5031
4856
  return this.ajax(urlOrApiInfo, 'PUT', init);
5032
4857
  };
@@ -5036,8 +4861,6 @@ function () {
5036
4861
  * @param {json} init - Request extra params
5037
4862
  * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
5038
4863
  */
5039
-
5040
-
5041
4864
  RestClient.prototype.patch = function (urlOrApiInfo, init) {
5042
4865
  return this.ajax(urlOrApiInfo, 'PATCH', init);
5043
4866
  };
@@ -5047,8 +4870,6 @@ function () {
5047
4870
  * @param {json} init - Request extra params
5048
4871
  * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
5049
4872
  */
5050
-
5051
-
5052
4873
  RestClient.prototype.post = function (urlOrApiInfo, init) {
5053
4874
  return this.ajax(urlOrApiInfo, 'POST', init);
5054
4875
  };
@@ -5058,8 +4879,6 @@ function () {
5058
4879
  * @param {json} init - Request extra params
5059
4880
  * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
5060
4881
  */
5061
-
5062
-
5063
4882
  RestClient.prototype.del = function (urlOrApiInfo, init) {
5064
4883
  return this.ajax(urlOrApiInfo, 'DELETE', init);
5065
4884
  };
@@ -5069,8 +4888,6 @@ function () {
5069
4888
  * @param {json} init - Request extra params
5070
4889
  * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
5071
4890
  */
5072
-
5073
-
5074
4891
  RestClient.prototype.head = function (urlOrApiInfo, init) {
5075
4892
  return this.ajax(urlOrApiInfo, 'HEAD', init);
5076
4893
  };
@@ -5079,16 +4896,12 @@ function () {
5079
4896
  * @param {Promise<any>} request - The request promise to cancel
5080
4897
  * @param {string} [message] - A message to include in the cancelation exception
5081
4898
  */
5082
-
5083
-
5084
4899
  RestClient.prototype.cancel = function (request, message) {
5085
4900
  var source = this._cancelTokenMap.get(request);
5086
-
5087
4901
  if (source) {
5088
4902
  source.cancel(message);
5089
4903
  return true;
5090
4904
  }
5091
-
5092
4905
  return false;
5093
4906
  };
5094
4907
  /**
@@ -5096,8 +4909,6 @@ function () {
5096
4909
  * @params request - The request promise
5097
4910
  * @return if the request has a corresponding cancel token.
5098
4911
  */
5099
-
5100
-
5101
4912
  RestClient.prototype.hasCancelToken = function (request) {
5102
4913
  return this._cancelTokenMap.has(request);
5103
4914
  };
@@ -5106,27 +4917,21 @@ function () {
5106
4917
  * @param {any} error - Any error
5107
4918
  * @return {boolean} - A boolean indicating if the error was from an api request cancellation
5108
4919
  */
5109
-
5110
-
5111
4920
  RestClient.prototype.isCancel = function (error) {
5112
- return axios__WEBPACK_IMPORTED_MODULE_1___default.a.isCancel(error);
4921
+ return axios__WEBPACK_IMPORTED_MODULE_2___default.a.isCancel(error);
5113
4922
  };
5114
4923
  /**
5115
4924
  * Retrieves a new and unique cancel token which can be
5116
4925
  * provided in an axios request to be cancelled later.
5117
4926
  */
5118
-
5119
-
5120
4927
  RestClient.prototype.getCancellableToken = function () {
5121
- return axios__WEBPACK_IMPORTED_MODULE_1___default.a.CancelToken.source();
4928
+ return axios__WEBPACK_IMPORTED_MODULE_2___default.a.CancelToken.source();
5122
4929
  };
5123
4930
  /**
5124
4931
  * Updates the weakmap with a response promise and its
5125
4932
  * cancel token such that the cancel token can be easily
5126
4933
  * retrieved (and used for cancelling the request)
5127
4934
  */
5128
-
5129
-
5130
4935
  RestClient.prototype.updateRequestToBeCancellable = function (promise, cancelTokenSource) {
5131
4936
  this._cancelTokenMap.set(promise, cancelTokenSource);
5132
4937
  };
@@ -5135,34 +4940,26 @@ function () {
5135
4940
  * @param {string} apiName - The name of the api
5136
4941
  * @return {string} - The endpoint of the api
5137
4942
  */
5138
-
5139
-
5140
4943
  RestClient.prototype.endpoint = function (apiName) {
5141
4944
  var _this = this;
5142
-
5143
4945
  var cloud_logic_array = this._options.endpoints;
5144
4946
  var response = '';
5145
-
5146
4947
  if (!Array.isArray(cloud_logic_array)) {
5147
4948
  return response;
5148
4949
  }
5149
-
5150
4950
  cloud_logic_array.forEach(function (v) {
5151
4951
  if (v.name === apiName) {
5152
4952
  response = v.endpoint;
5153
-
5154
4953
  if (typeof v.region === 'string') {
5155
4954
  _this._region = v.region;
5156
4955
  } else if (typeof _this._options.region === 'string') {
5157
4956
  _this._region = _this._options.region;
5158
4957
  }
5159
-
5160
4958
  if (typeof v.service === 'string') {
5161
4959
  _this._service = v.service || 'execute-api';
5162
4960
  } else {
5163
4961
  _this._service = 'execute-api';
5164
4962
  }
5165
-
5166
4963
  if (typeof v.custom_header === 'function') {
5167
4964
  _this._custom_header = v.custom_header;
5168
4965
  } else {
@@ -5173,15 +4970,11 @@ function () {
5173
4970
  return response;
5174
4971
  };
5175
4972
  /** private methods **/
5176
-
5177
-
5178
4973
  RestClient.prototype._signed = function (params, credentials, isAllResponse, _a) {
5179
4974
  var service = _a.service,
5180
- region = _a.region;
5181
-
4975
+ region = _a.region;
5182
4976
  var signerServiceInfoParams = params.signerServiceInfo,
5183
- otherParams = __rest(params, ["signerServiceInfo"]);
5184
-
4977
+ otherParams = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__rest"])(params, ["signerServiceInfo"]);
5185
4978
  var endpoint_region = region || this._region || this._options.region;
5186
4979
  var endpoint_service = service || this._service || this._options.service;
5187
4980
  var creds = {
@@ -5194,35 +4987,30 @@ function () {
5194
4987
  service: endpoint_service
5195
4988
  };
5196
4989
  var signerServiceInfo = Object.assign(endpointInfo, signerServiceInfoParams);
5197
- var signed_params = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Signer"].sign(otherParams, creds, signerServiceInfo);
5198
-
4990
+ var signed_params = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Signer"].sign(otherParams, creds, signerServiceInfo);
5199
4991
  if (signed_params.data) {
5200
4992
  signed_params.body = signed_params.data;
5201
4993
  }
5202
-
5203
4994
  logger.debug('Signed Request: ', signed_params);
5204
4995
  delete signed_params.headers['host'];
5205
- return axios__WEBPACK_IMPORTED_MODULE_1___default()(signed_params).then(function (response) {
4996
+ return axios__WEBPACK_IMPORTED_MODULE_2___default()(signed_params).then(function (response) {
5206
4997
  return isAllResponse ? response : response.data;
5207
4998
  })["catch"](function (error) {
5208
4999
  logger.debug(error);
5209
5000
  throw error;
5210
5001
  });
5211
5002
  };
5212
-
5213
5003
  RestClient.prototype._request = function (params, isAllResponse) {
5214
5004
  if (isAllResponse === void 0) {
5215
5005
  isAllResponse = false;
5216
5006
  }
5217
-
5218
- return axios__WEBPACK_IMPORTED_MODULE_1___default()(params).then(function (response) {
5007
+ return axios__WEBPACK_IMPORTED_MODULE_2___default()(params).then(function (response) {
5219
5008
  return isAllResponse ? response : response.data;
5220
5009
  })["catch"](function (error) {
5221
5010
  logger.debug(error);
5222
5011
  throw error;
5223
5012
  });
5224
5013
  };
5225
-
5226
5014
  RestClient.prototype._parseUrl = function (url) {
5227
5015
  var parts = url.split('/');
5228
5016
  return {
@@ -5230,12 +5018,10 @@ function () {
5230
5018
  path: '/' + parts.slice(3).join('/')
5231
5019
  };
5232
5020
  };
5233
-
5234
5021
  return RestClient;
5235
5022
  }();
5236
5023
 
5237
5024
 
5238
-
5239
5025
  /***/ }),
5240
5026
 
5241
5027
  /***/ "./lib-esm/index.js":