@ama-sdk/core 11.3.0-prerelease.8 → 11.3.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -25
- package/cjs/clients/api-angular-client.js +63 -3
- package/cjs/clients/api-beacon-client.js +1 -0
- package/cjs/clients/api-fetch-client.js +2 -1
- package/cjs/fwk/date.js +12 -33
- package/cjs/fwk/errors.js +39 -43
- package/cjs/fwk/mocks/random-mock-adapter.js +10 -24
- package/cjs/fwk/mocks/sequential-mock-adapter.js +10 -24
- package/cjs/plugins/additional-params/additional-params.request.js +1 -1
- package/cjs/plugins/api-configuration-override/api-configuration-override.request.js +1 -1
- package/cjs/plugins/api-key/api-key.request.js +1 -1
- package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +2 -2
- package/cjs/plugins/client-facts/client-facts.request.js +1 -1
- package/cjs/plugins/concurrent/concurrent.fetch.js +1 -1
- package/cjs/plugins/core/angular-plugin.js +4 -0
- package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +1 -1
- package/cjs/plugins/mock-intercept/index.js +1 -0
- package/cjs/plugins/mock-intercept/mock-intercept.angular.js +347 -0
- package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +1 -1
- package/cjs/plugins/mock-intercept/mock-intercept.request.js +1 -1
- package/cjs/plugins/perf-metric/perf-metric.fetch.js +1 -1
- package/cjs/plugins/pii-tokenizer/pii-tokenizer.request.js +1 -1
- package/cjs/plugins/retry/retry.fetch.js +2 -2
- package/cjs/plugins/si-token/si-token.request.js +21 -34
- package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +1 -1
- package/cjs/plugins/timeout/timeout.fetch.js +1 -1
- package/cjs/plugins/url-rewrite/url-rewrite.request.js +1 -1
- package/cjs/plugins/wait-for/wait-for.fetch.js +2 -2
- package/cjs/utils/json-token.js +1 -1
- package/esm2015/clients/api-angular-client.js +67 -4
- package/esm2015/clients/api-beacon-client.js +1 -0
- package/esm2015/clients/api-fetch-client.js +6 -2
- package/esm2015/fwk/date.js +12 -33
- package/esm2015/fwk/errors.js +39 -43
- package/esm2015/fwk/mocks/random-mock-adapter.js +10 -24
- package/esm2015/fwk/mocks/sequential-mock-adapter.js +10 -24
- package/esm2015/plugins/additional-params/additional-params.request.js +1 -1
- package/esm2015/plugins/api-configuration-override/api-configuration-override.request.js +1 -1
- package/esm2015/plugins/api-key/api-key.request.js +1 -1
- package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +2 -2
- package/esm2015/plugins/client-facts/client-facts.request.js +1 -1
- package/esm2015/plugins/concurrent/concurrent.fetch.js +2 -1
- package/esm2015/plugins/core/angular-plugin.js +4 -0
- package/esm2015/plugins/core/fetch-plugin.js +1 -0
- package/esm2015/plugins/keepalive/keepalive.request.js +1 -0
- package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +1 -1
- package/esm2015/plugins/mock-intercept/index.js +1 -0
- package/esm2015/plugins/mock-intercept/mock-intercept.angular.js +343 -0
- package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +2 -1
- package/esm2015/plugins/mock-intercept/mock-intercept.request.js +1 -1
- package/esm2015/plugins/perf-metric/perf-metric.fetch.js +2 -1
- package/esm2015/plugins/pii-tokenizer/pii-tokenizer.request.js +1 -1
- package/esm2015/plugins/retry/retry.fetch.js +3 -2
- package/esm2015/plugins/si-token/si-token.request.js +21 -34
- package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +1 -1
- package/esm2015/plugins/timeout/timeout.fetch.js +1 -1
- package/esm2015/plugins/url-rewrite/url-rewrite.request.js +1 -1
- package/esm2015/plugins/wait-for/wait-for.fetch.js +3 -2
- package/esm2015/utils/json-token.js +1 -1
- package/package.json +16 -6
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/ng-add/schema.js.map +1 -0
- package/src/clients/api-angular-client.d.ts +19 -3
- package/src/clients/api-angular-client.d.ts.map +1 -1
- package/src/clients/api-angular-client.js +22 -4
- package/src/clients/api-angular-client.js.map +1 -1
- package/src/clients/api-beacon-client.d.ts +8 -2
- package/src/clients/api-beacon-client.d.ts.map +1 -1
- package/src/clients/api-beacon-client.js +1 -0
- package/src/clients/api-beacon-client.js.map +1 -1
- package/src/clients/api-fetch-client.d.ts +12 -3
- package/src/clients/api-fetch-client.d.ts.map +1 -1
- package/src/clients/api-fetch-client.js +13 -2
- package/src/clients/api-fetch-client.js.map +1 -1
- package/src/fwk/core/api-client.d.ts +1 -0
- package/src/fwk/core/api-client.d.ts.map +1 -1
- package/src/fwk/core/api-client.js.map +1 -1
- package/src/plugins/abort/abort.fetch.d.ts +1 -0
- package/src/plugins/abort/abort.fetch.d.ts.map +1 -1
- package/src/plugins/abort/abort.fetch.js.map +1 -1
- package/src/plugins/concurrent/concurrent.fetch.d.ts +1 -0
- package/src/plugins/concurrent/concurrent.fetch.d.ts.map +1 -1
- package/src/plugins/concurrent/concurrent.fetch.js +1 -0
- package/src/plugins/concurrent/concurrent.fetch.js.map +1 -1
- package/src/plugins/core/angular-plugin.d.ts +40 -0
- package/src/plugins/core/angular-plugin.d.ts.map +1 -0
- package/src/plugins/core/angular-plugin.js +2 -0
- package/src/plugins/core/angular-plugin.js.map +1 -0
- package/src/plugins/core/fetch-plugin.d.ts +7 -0
- package/src/plugins/core/fetch-plugin.d.ts.map +1 -1
- package/src/plugins/keepalive/keepalive.request.d.ts +1 -0
- package/src/plugins/keepalive/keepalive.request.d.ts.map +1 -1
- package/src/plugins/keepalive/keepalive.request.js +1 -0
- package/src/plugins/keepalive/keepalive.request.js.map +1 -1
- package/src/plugins/mock-intercept/index.d.ts +1 -0
- package/src/plugins/mock-intercept/index.d.ts.map +1 -1
- package/src/plugins/mock-intercept/index.js +1 -0
- package/src/plugins/mock-intercept/index.js.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.angular.d.ts +16 -0
- package/src/plugins/mock-intercept/mock-intercept.angular.d.ts.map +1 -0
- package/src/plugins/mock-intercept/mock-intercept.angular.js +64 -0
- package/src/plugins/mock-intercept/mock-intercept.angular.js.map +1 -0
- package/src/plugins/mock-intercept/mock-intercept.fetch.d.ts +1 -0
- package/src/plugins/mock-intercept/mock-intercept.fetch.d.ts.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.fetch.js +1 -0
- package/src/plugins/mock-intercept/mock-intercept.fetch.js.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.interface.d.ts +4 -1
- package/src/plugins/mock-intercept/mock-intercept.interface.d.ts.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.interface.js.map +1 -1
- package/src/plugins/perf-metric/perf-metric.fetch.d.ts +3 -0
- package/src/plugins/perf-metric/perf-metric.fetch.d.ts.map +1 -1
- package/src/plugins/perf-metric/perf-metric.fetch.js +1 -0
- package/src/plugins/perf-metric/perf-metric.fetch.js.map +1 -1
- package/src/plugins/retry/retry.fetch.d.ts +2 -0
- package/src/plugins/retry/retry.fetch.d.ts.map +1 -1
- package/src/plugins/retry/retry.fetch.js +1 -0
- package/src/plugins/retry/retry.fetch.js.map +1 -1
- package/src/plugins/timeout/timeout.fetch.d.ts +1 -0
- package/src/plugins/timeout/timeout.fetch.d.ts.map +1 -1
- package/src/plugins/timeout/timeout.fetch.js.map +1 -1
- package/src/plugins/wait-for/wait-for.fetch.d.ts +10 -2
- package/src/plugins/wait-for/wait-for.fetch.d.ts.map +1 -1
- package/src/plugins/wait-for/wait-for.fetch.js +1 -0
- package/src/plugins/wait-for/wait-for.fetch.js.map +1 -1
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _array_without_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
8
|
+
}
|
|
1
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
10
|
try {
|
|
3
11
|
var info = gen[key](arg);
|
|
@@ -59,6 +67,12 @@ function _define_property(obj, key, value) {
|
|
|
59
67
|
}
|
|
60
68
|
return obj;
|
|
61
69
|
}
|
|
70
|
+
function _iterable_to_array(iter) {
|
|
71
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
72
|
+
}
|
|
73
|
+
function _non_iterable_spread() {
|
|
74
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
75
|
+
}
|
|
62
76
|
function _object_spread(target) {
|
|
63
77
|
for(var i = 1; i < arguments.length; i++){
|
|
64
78
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -98,6 +112,17 @@ function _object_spread_props(target, source) {
|
|
|
98
112
|
}
|
|
99
113
|
return target;
|
|
100
114
|
}
|
|
115
|
+
function _to_consumable_array(arr) {
|
|
116
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
117
|
+
}
|
|
118
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
119
|
+
if (!o) return;
|
|
120
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
121
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
122
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
123
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
124
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
125
|
+
}
|
|
101
126
|
function _ts_generator(thisArg, body) {
|
|
102
127
|
var f, y, t, g, _ = {
|
|
103
128
|
label: 0,
|
|
@@ -202,12 +227,15 @@ var DEFAULT_OPTIONS = {
|
|
|
202
227
|
new ReviverReply(),
|
|
203
228
|
new ExceptionReply()
|
|
204
229
|
],
|
|
205
|
-
|
|
230
|
+
angularPlugins: [],
|
|
206
231
|
requestPlugins: [],
|
|
207
232
|
enableTokenization: false,
|
|
208
233
|
disableFallback: false
|
|
209
234
|
};
|
|
210
|
-
/**
|
|
235
|
+
/**
|
|
236
|
+
* Client to process the call to the API using Angular API
|
|
237
|
+
* @deprecated Use the one exposed by {@link @ama-sdk/client-angular}, will be removed in v13
|
|
238
|
+
*/ export var ApiAngularClient = /*#__PURE__*/ function() {
|
|
211
239
|
"use strict";
|
|
212
240
|
function ApiAngularClient(options) {
|
|
213
241
|
_class_call_check(this, ApiAngularClient);
|
|
@@ -350,10 +378,45 @@ var DEFAULT_OPTIONS = {
|
|
|
350
378
|
var data;
|
|
351
379
|
var metadataSignal = (_options_metadata = options.metadata) === null || _options_metadata === void 0 ? void 0 : _options_metadata.signal;
|
|
352
380
|
metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.throwIfAborted();
|
|
353
|
-
var
|
|
381
|
+
var loadedPlugins = [];
|
|
382
|
+
if (_this.options.angularPlugins) {
|
|
383
|
+
var _loadedPlugins;
|
|
384
|
+
(_loadedPlugins = loadedPlugins).push.apply(_loadedPlugins, _to_consumable_array(_this.options.angularPlugins.map(function(plugin) {
|
|
385
|
+
return plugin.load({
|
|
386
|
+
angularPlugins: loadedPlugins,
|
|
387
|
+
apiClient: _this,
|
|
388
|
+
url: url,
|
|
389
|
+
apiName: apiName,
|
|
390
|
+
requestOptions: options,
|
|
391
|
+
logger: _this.options.logger
|
|
392
|
+
});
|
|
393
|
+
})));
|
|
394
|
+
}
|
|
395
|
+
var httpRequest = _this.options.httpClient.request(options.method, url, _object_spread_props(_object_spread({}, options), {
|
|
354
396
|
observe: 'response',
|
|
355
397
|
headers: headers
|
|
356
|
-
}))
|
|
398
|
+
}));
|
|
399
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
400
|
+
try {
|
|
401
|
+
for(var _iterator = loadedPlugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
402
|
+
var plugin = _step.value;
|
|
403
|
+
httpRequest = plugin.transform(httpRequest);
|
|
404
|
+
}
|
|
405
|
+
} catch (err) {
|
|
406
|
+
_didIteratorError = true;
|
|
407
|
+
_iteratorError = err;
|
|
408
|
+
} finally{
|
|
409
|
+
try {
|
|
410
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
411
|
+
_iterator.return();
|
|
412
|
+
}
|
|
413
|
+
} finally{
|
|
414
|
+
if (_didIteratorError) {
|
|
415
|
+
throw _iteratorError;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
var subscription = httpRequest.subscribe({
|
|
357
420
|
next: function(res) {
|
|
358
421
|
return data = res;
|
|
359
422
|
},
|
|
@@ -84,6 +84,7 @@ var DEFAULT_OPTIONS = {
|
|
|
84
84
|
};
|
|
85
85
|
/**
|
|
86
86
|
* Determine if the given value is a promise
|
|
87
|
+
* @deprecated Use the one exposed by {@link @ama-sdk/client-beacon}, will be removed in v13
|
|
87
88
|
* @param value The value to test
|
|
88
89
|
*/ // NOTE: the `extends unknown` is required for ESM build with TSC
|
|
89
90
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
@@ -239,7 +239,10 @@ var DEFAULT_OPTIONS = {
|
|
|
239
239
|
enableTokenization: false,
|
|
240
240
|
disableFallback: false
|
|
241
241
|
};
|
|
242
|
-
/**
|
|
242
|
+
/**
|
|
243
|
+
* Client to process the call to the API using Fetch API
|
|
244
|
+
* @deprecated Use the one exposed by {@link @ama-sdk/client-fetch}, will be removed in v13
|
|
245
|
+
*/ export var ApiFetchClient = /*#__PURE__*/ function() {
|
|
243
246
|
"use strict";
|
|
244
247
|
function ApiFetchClient(options) {
|
|
245
248
|
_class_call_check(this, ApiFetchClient);
|
|
@@ -393,7 +396,8 @@ var DEFAULT_OPTIONS = {
|
|
|
393
396
|
fetchPlugins: loadedPlugins,
|
|
394
397
|
controller: controller,
|
|
395
398
|
apiClient: _this,
|
|
396
|
-
logger: _this.options.logger
|
|
399
|
+
logger: _this.options.logger,
|
|
400
|
+
apiName: apiName
|
|
397
401
|
});
|
|
398
402
|
})));
|
|
399
403
|
}
|
package/esm2015/fwk/date.js
CHANGED
|
@@ -12,6 +12,10 @@ function _assert_this_initialized(self) {
|
|
|
12
12
|
}
|
|
13
13
|
return self;
|
|
14
14
|
}
|
|
15
|
+
function _call_super(_this, derived, args) {
|
|
16
|
+
derived = _get_prototype_of(derived);
|
|
17
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
18
|
+
}
|
|
15
19
|
function _class_call_check(instance, Constructor) {
|
|
16
20
|
if (!(instance instanceof Constructor)) {
|
|
17
21
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -138,28 +142,12 @@ function _wrap_native_super(Class) {
|
|
|
138
142
|
return _wrap_native_super(Class);
|
|
139
143
|
}
|
|
140
144
|
function _is_native_reflect_construct() {
|
|
141
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
142
|
-
if (Reflect.construct.sham) return false;
|
|
143
|
-
if (typeof Proxy === "function") return true;
|
|
144
145
|
try {
|
|
145
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
function _create_super(Derived) {
|
|
152
|
-
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
153
|
-
return function _createSuperInternal() {
|
|
154
|
-
var Super = _get_prototype_of(Derived), result;
|
|
155
|
-
if (hasNativeReflectConstruct) {
|
|
156
|
-
var NewTarget = _get_prototype_of(this).constructor;
|
|
157
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
158
|
-
} else {
|
|
159
|
-
result = Super.apply(this, arguments);
|
|
160
|
-
}
|
|
161
|
-
return _possible_constructor_return(this, result);
|
|
162
|
-
};
|
|
146
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
147
|
+
} catch (_) {}
|
|
148
|
+
return (_is_native_reflect_construct = function() {
|
|
149
|
+
return !!result;
|
|
150
|
+
})();
|
|
163
151
|
}
|
|
164
152
|
export var _NativeDateClass = Date;
|
|
165
153
|
/**
|
|
@@ -175,7 +163,6 @@ export var _NativeDateClass = Date;
|
|
|
175
163
|
export var CommonDate = /*#__PURE__*/ function(Date1) {
|
|
176
164
|
"use strict";
|
|
177
165
|
_inherits(CommonDate, Date1);
|
|
178
|
-
var _super = _create_super(CommonDate);
|
|
179
166
|
function CommonDate() {
|
|
180
167
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
181
168
|
args[_key] = arguments[_key];
|
|
@@ -204,9 +191,7 @@ export var CommonDate = /*#__PURE__*/ function(Date1) {
|
|
|
204
191
|
args[0] = args[0];
|
|
205
192
|
}
|
|
206
193
|
}
|
|
207
|
-
return
|
|
208
|
-
this
|
|
209
|
-
].concat(_to_consumable_array(args)));
|
|
194
|
+
return _call_super(this, CommonDate, _to_consumable_array(args));
|
|
210
195
|
}
|
|
211
196
|
_create_class(CommonDate, [
|
|
212
197
|
{
|
|
@@ -225,7 +210,6 @@ export var utils;
|
|
|
225
210
|
'use strict';
|
|
226
211
|
var _$Date = /*#__PURE__*/ function(CommonDate) {
|
|
227
212
|
_inherits(Date1, CommonDate);
|
|
228
|
-
var _super = _create_super(Date1);
|
|
229
213
|
function Date1() {
|
|
230
214
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
231
215
|
args[_key] = arguments[_key];
|
|
@@ -236,9 +220,7 @@ export var utils;
|
|
|
236
220
|
} else if (_instanceof(args[0], _NativeDateClass)) {
|
|
237
221
|
args[0] = "".concat(args[0].getFullYear(), "-").concat(pad(args[0].getMonth() + 1), "-").concat(pad(args[0].getDate()), "T00:00:00Z");
|
|
238
222
|
}
|
|
239
|
-
return
|
|
240
|
-
this
|
|
241
|
-
].concat(_to_consumable_array(args)));
|
|
223
|
+
return _call_super(this, Date1, _to_consumable_array(args));
|
|
242
224
|
}
|
|
243
225
|
_create_class(Date1, [
|
|
244
226
|
{
|
|
@@ -275,15 +257,12 @@ export var utils;
|
|
|
275
257
|
utils.Date = _$Date;
|
|
276
258
|
var DateTime = /*#__PURE__*/ function(CommonDate) {
|
|
277
259
|
_inherits(DateTime, CommonDate);
|
|
278
|
-
var _super = _create_super(DateTime);
|
|
279
260
|
function DateTime() {
|
|
280
261
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
281
262
|
args[_key] = arguments[_key];
|
|
282
263
|
}
|
|
283
264
|
_class_call_check(this, DateTime);
|
|
284
|
-
return
|
|
285
|
-
this
|
|
286
|
-
].concat(_to_consumable_array(args)));
|
|
265
|
+
return _call_super(this, DateTime, _to_consumable_array(args));
|
|
287
266
|
}
|
|
288
267
|
_create_class(DateTime, [
|
|
289
268
|
{
|
package/esm2015/fwk/errors.js
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
}
|
|
7
7
|
return self;
|
|
8
8
|
}
|
|
9
|
+
function _call_super(_this, derived, args) {
|
|
10
|
+
derived = _get_prototype_of(derived);
|
|
11
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
12
|
+
}
|
|
9
13
|
function _class_call_check(instance, Constructor) {
|
|
10
14
|
if (!(instance instanceof Constructor)) {
|
|
11
15
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -107,41 +111,26 @@ function _wrap_native_super(Class) {
|
|
|
107
111
|
return _wrap_native_super(Class);
|
|
108
112
|
}
|
|
109
113
|
function _is_native_reflect_construct() {
|
|
110
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
111
|
-
if (Reflect.construct.sham) return false;
|
|
112
|
-
if (typeof Proxy === "function") return true;
|
|
113
114
|
try {
|
|
114
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
function _create_super(Derived) {
|
|
121
|
-
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
122
|
-
return function _createSuperInternal() {
|
|
123
|
-
var Super = _get_prototype_of(Derived), result;
|
|
124
|
-
if (hasNativeReflectConstruct) {
|
|
125
|
-
var NewTarget = _get_prototype_of(this).constructor;
|
|
126
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
127
|
-
} else {
|
|
128
|
-
result = Super.apply(this, arguments);
|
|
129
|
-
}
|
|
130
|
-
return _possible_constructor_return(this, result);
|
|
131
|
-
};
|
|
115
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
116
|
+
} catch (_) {}
|
|
117
|
+
return (_is_native_reflect_construct = function() {
|
|
118
|
+
return !!result;
|
|
119
|
+
})();
|
|
132
120
|
}
|
|
133
121
|
/**
|
|
134
122
|
* Generic error class
|
|
135
123
|
*/ export var GenericError = /*#__PURE__*/ function(Error1) {
|
|
136
124
|
"use strict";
|
|
137
125
|
_inherits(GenericError, Error1);
|
|
138
|
-
var _super = _create_super(GenericError);
|
|
139
126
|
function GenericError(message, context) {
|
|
140
127
|
_class_call_check(this, GenericError);
|
|
141
128
|
var httpRegexp = /^https?:\/\//;
|
|
142
129
|
var baseUrl = (context === null || context === void 0 ? void 0 : context.url) ? context.url.replace(httpRegexp, '') : 'unknown';
|
|
143
130
|
var origin = (context === null || context === void 0 ? void 0 : context.origin) ? context.origin.replace(httpRegexp, '') : 'unknown';
|
|
144
|
-
return
|
|
131
|
+
return _call_super(this, GenericError, [
|
|
132
|
+
context ? "[SDK] [apiName: ".concat(context.apiName || 'unknown', "] [operationId: ").concat(context.operationId || 'unknown', "] [baseUrl: ").concat(baseUrl, "] [origin: ").concat(origin, "] [errorType: SDK] ").concat(message) : "[SDK] ".concat(message)
|
|
133
|
+
]);
|
|
145
134
|
}
|
|
146
135
|
return GenericError;
|
|
147
136
|
}(_wrap_native_super(Error));
|
|
@@ -150,17 +139,17 @@ function _create_super(Derived) {
|
|
|
150
139
|
*/ export var RequestFailedError = /*#__PURE__*/ function(GenericError) {
|
|
151
140
|
"use strict";
|
|
152
141
|
_inherits(RequestFailedError, GenericError);
|
|
153
|
-
var _super = _create_super(RequestFailedError);
|
|
154
142
|
function RequestFailedError(message, statusCode, data, context) {
|
|
155
143
|
_class_call_check(this, RequestFailedError);
|
|
156
144
|
var _this;
|
|
157
|
-
_this =
|
|
158
|
-
|
|
145
|
+
_this = _call_super(this, RequestFailedError, [
|
|
146
|
+
"[status: ".concat(statusCode, "] ").concat(message),
|
|
147
|
+
context
|
|
148
|
+
]), /**
|
|
159
149
|
* Request status code
|
|
160
|
-
*/ _define_property(
|
|
161
|
-
/**
|
|
150
|
+
*/ _define_property(_this, "statusCode", void 0), /**
|
|
162
151
|
* Data decoded from the response body
|
|
163
|
-
*/ _define_property(
|
|
152
|
+
*/ _define_property(_this, "data", void 0);
|
|
164
153
|
_this.statusCode = statusCode;
|
|
165
154
|
_this.data = data;
|
|
166
155
|
return _this;
|
|
@@ -172,14 +161,15 @@ function _create_super(Derived) {
|
|
|
172
161
|
*/ export var EmptyResponseError = /*#__PURE__*/ function(GenericError) {
|
|
173
162
|
"use strict";
|
|
174
163
|
_inherits(EmptyResponseError, GenericError);
|
|
175
|
-
var _super = _create_super(EmptyResponseError);
|
|
176
164
|
function EmptyResponseError(message, data, context) {
|
|
177
165
|
_class_call_check(this, EmptyResponseError);
|
|
178
166
|
var _this;
|
|
179
|
-
_this =
|
|
180
|
-
|
|
167
|
+
_this = _call_super(this, EmptyResponseError, [
|
|
168
|
+
"[Empty response] ".concat(message),
|
|
169
|
+
context
|
|
170
|
+
]), /**
|
|
181
171
|
* Data decoded from the response body
|
|
182
|
-
*/ _define_property(
|
|
172
|
+
*/ _define_property(_this, "data", void 0);
|
|
183
173
|
_this.data = data;
|
|
184
174
|
return _this;
|
|
185
175
|
}
|
|
@@ -190,10 +180,12 @@ function _create_super(Derived) {
|
|
|
190
180
|
*/ export var ResponseTimeoutError = /*#__PURE__*/ function(GenericError) {
|
|
191
181
|
"use strict";
|
|
192
182
|
_inherits(ResponseTimeoutError, GenericError);
|
|
193
|
-
var _super = _create_super(ResponseTimeoutError);
|
|
194
183
|
function ResponseTimeoutError(message, context) {
|
|
195
184
|
_class_call_check(this, ResponseTimeoutError);
|
|
196
|
-
return
|
|
185
|
+
return _call_super(this, ResponseTimeoutError, [
|
|
186
|
+
"[Response timeout] ".concat(message),
|
|
187
|
+
context
|
|
188
|
+
]);
|
|
197
189
|
}
|
|
198
190
|
return ResponseTimeoutError;
|
|
199
191
|
}(GenericError);
|
|
@@ -202,10 +194,14 @@ function _create_super(Derived) {
|
|
|
202
194
|
*/ export var ResponseJSONParseError = /*#__PURE__*/ function(RequestFailedError) {
|
|
203
195
|
"use strict";
|
|
204
196
|
_inherits(ResponseJSONParseError, RequestFailedError);
|
|
205
|
-
var _super = _create_super(ResponseJSONParseError);
|
|
206
197
|
function ResponseJSONParseError(message, httpStatus, bodyContent, context) {
|
|
207
198
|
_class_call_check(this, ResponseJSONParseError);
|
|
208
|
-
return
|
|
199
|
+
return _call_super(this, ResponseJSONParseError, [
|
|
200
|
+
"[Response JSON parse error] ".concat(message),
|
|
201
|
+
httpStatus,
|
|
202
|
+
bodyContent,
|
|
203
|
+
context
|
|
204
|
+
]);
|
|
209
205
|
}
|
|
210
206
|
return ResponseJSONParseError;
|
|
211
207
|
}(RequestFailedError);
|
|
@@ -214,17 +210,17 @@ function _create_super(Derived) {
|
|
|
214
210
|
*/ export var CanceledCallError = /*#__PURE__*/ function(GenericError) {
|
|
215
211
|
"use strict";
|
|
216
212
|
_inherits(CanceledCallError, GenericError);
|
|
217
|
-
var _super = _create_super(CanceledCallError);
|
|
218
213
|
function CanceledCallError(message, pluginIndex, pluginCanceling, context) {
|
|
219
214
|
_class_call_check(this, CanceledCallError);
|
|
220
215
|
var _this;
|
|
221
|
-
_this =
|
|
222
|
-
|
|
216
|
+
_this = _call_super(this, CanceledCallError, [
|
|
217
|
+
"[Canceled call] ".concat(message),
|
|
218
|
+
context
|
|
219
|
+
]), /**
|
|
223
220
|
* First plugin canceling the call
|
|
224
|
-
*/ _define_property(
|
|
225
|
-
/**
|
|
221
|
+
*/ _define_property(_this, "pluginCanceling", void 0), /**
|
|
226
222
|
* Index of the first plugin canceling the call
|
|
227
|
-
*/ _define_property(
|
|
223
|
+
*/ _define_property(_this, "pluginIndex", void 0);
|
|
228
224
|
_this.pluginIndex = pluginIndex;
|
|
229
225
|
_this.pluginCanceling = pluginCanceling;
|
|
230
226
|
return _this;
|
|
@@ -4,6 +4,10 @@ function _assert_this_initialized(self) {
|
|
|
4
4
|
}
|
|
5
5
|
return self;
|
|
6
6
|
}
|
|
7
|
+
function _call_super(_this, derived, args) {
|
|
8
|
+
derived = _get_prototype_of(derived);
|
|
9
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
10
|
+
}
|
|
7
11
|
function _class_call_check(instance, Constructor) {
|
|
8
12
|
if (!(instance instanceof Constructor)) {
|
|
9
13
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -73,28 +77,12 @@ function _type_of(obj) {
|
|
|
73
77
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
74
78
|
}
|
|
75
79
|
function _is_native_reflect_construct() {
|
|
76
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
77
|
-
if (Reflect.construct.sham) return false;
|
|
78
|
-
if (typeof Proxy === "function") return true;
|
|
79
80
|
try {
|
|
80
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
function _create_super(Derived) {
|
|
87
|
-
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
88
|
-
return function _createSuperInternal() {
|
|
89
|
-
var Super = _get_prototype_of(Derived), result;
|
|
90
|
-
if (hasNativeReflectConstruct) {
|
|
91
|
-
var NewTarget = _get_prototype_of(this).constructor;
|
|
92
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
93
|
-
} else {
|
|
94
|
-
result = Super.apply(this, arguments);
|
|
95
|
-
}
|
|
96
|
-
return _possible_constructor_return(this, result);
|
|
97
|
-
};
|
|
81
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
82
|
+
} catch (_) {}
|
|
83
|
+
return (_is_native_reflect_construct = function() {
|
|
84
|
+
return !!result;
|
|
85
|
+
})();
|
|
98
86
|
}
|
|
99
87
|
import { BaseMockAdapter } from './base-mock-adapter';
|
|
100
88
|
/**
|
|
@@ -102,12 +90,10 @@ import { BaseMockAdapter } from './base-mock-adapter';
|
|
|
102
90
|
*/ export var RandomMockAdapter = /*#__PURE__*/ function(BaseMockAdapter) {
|
|
103
91
|
"use strict";
|
|
104
92
|
_inherits(RandomMockAdapter, BaseMockAdapter);
|
|
105
|
-
var _super = _create_super(RandomMockAdapter);
|
|
106
93
|
function RandomMockAdapter() {
|
|
107
94
|
_class_call_check(this, RandomMockAdapter);
|
|
108
95
|
var _this;
|
|
109
|
-
_this =
|
|
110
|
-
_define_property(_assert_this_initialized(_this), "cache", {});
|
|
96
|
+
_this = _call_super(this, RandomMockAdapter, arguments), _define_property(_this, "cache", {});
|
|
111
97
|
return _this;
|
|
112
98
|
}
|
|
113
99
|
_create_class(RandomMockAdapter, [
|
|
@@ -4,6 +4,10 @@ function _assert_this_initialized(self) {
|
|
|
4
4
|
}
|
|
5
5
|
return self;
|
|
6
6
|
}
|
|
7
|
+
function _call_super(_this, derived, args) {
|
|
8
|
+
derived = _get_prototype_of(derived);
|
|
9
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
10
|
+
}
|
|
7
11
|
function _class_call_check(instance, Constructor) {
|
|
8
12
|
if (!(instance instanceof Constructor)) {
|
|
9
13
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -73,28 +77,12 @@ function _type_of(obj) {
|
|
|
73
77
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
74
78
|
}
|
|
75
79
|
function _is_native_reflect_construct() {
|
|
76
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
77
|
-
if (Reflect.construct.sham) return false;
|
|
78
|
-
if (typeof Proxy === "function") return true;
|
|
79
80
|
try {
|
|
80
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
function _create_super(Derived) {
|
|
87
|
-
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
88
|
-
return function _createSuperInternal() {
|
|
89
|
-
var Super = _get_prototype_of(Derived), result;
|
|
90
|
-
if (hasNativeReflectConstruct) {
|
|
91
|
-
var NewTarget = _get_prototype_of(this).constructor;
|
|
92
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
93
|
-
} else {
|
|
94
|
-
result = Super.apply(this, arguments);
|
|
95
|
-
}
|
|
96
|
-
return _possible_constructor_return(this, result);
|
|
97
|
-
};
|
|
81
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
82
|
+
} catch (_) {}
|
|
83
|
+
return (_is_native_reflect_construct = function() {
|
|
84
|
+
return !!result;
|
|
85
|
+
})();
|
|
98
86
|
}
|
|
99
87
|
import { BaseMockAdapter } from './base-mock-adapter';
|
|
100
88
|
/**
|
|
@@ -103,12 +91,10 @@ import { BaseMockAdapter } from './base-mock-adapter';
|
|
|
103
91
|
*/ export var SequentialMockAdapter = /*#__PURE__*/ function(BaseMockAdapter) {
|
|
104
92
|
"use strict";
|
|
105
93
|
_inherits(SequentialMockAdapter, BaseMockAdapter);
|
|
106
|
-
var _super = _create_super(SequentialMockAdapter);
|
|
107
94
|
function SequentialMockAdapter() {
|
|
108
95
|
_class_call_check(this, SequentialMockAdapter);
|
|
109
96
|
var _this;
|
|
110
|
-
_this =
|
|
111
|
-
_define_property(_assert_this_initialized(_this), "operationCounter", {});
|
|
97
|
+
_this = _call_super(this, SequentialMockAdapter, arguments), _define_property(_this, "operationCounter", {});
|
|
112
98
|
return _this;
|
|
113
99
|
}
|
|
114
100
|
_create_class(SequentialMockAdapter, [
|
|
@@ -196,7 +196,7 @@ function _ts_generator(thisArg, body) {
|
|
|
196
196
|
value: function load() {
|
|
197
197
|
var _this = this;
|
|
198
198
|
return {
|
|
199
|
-
transform: function() {
|
|
199
|
+
transform: /*#__PURE__*/ function() {
|
|
200
200
|
var _ref = _async_to_generator(function(data) {
|
|
201
201
|
var queryParams, _tmp, headers, _tmp1, body, _tmp2;
|
|
202
202
|
return _ts_generator(this, function(_state) {
|
|
@@ -174,7 +174,7 @@ function _ts_generator(thisArg, body) {
|
|
|
174
174
|
value: function load() {
|
|
175
175
|
var _this = this;
|
|
176
176
|
return {
|
|
177
|
-
transform: function() {
|
|
177
|
+
transform: /*#__PURE__*/ function() {
|
|
178
178
|
var _ref = _async_to_generator(function(data) {
|
|
179
179
|
var jws;
|
|
180
180
|
return _ts_generator(this, function(_state) {
|
|
@@ -172,7 +172,7 @@ function _ts_generator(thisArg, body) {
|
|
|
172
172
|
value: function load() {
|
|
173
173
|
var _this = this;
|
|
174
174
|
return {
|
|
175
|
-
transform: function() {
|
|
175
|
+
transform: /*#__PURE__*/ function() {
|
|
176
176
|
var _ref = _async_to_generator(function(data) {
|
|
177
177
|
var apiKey, _tmp;
|
|
178
178
|
return _ts_generator(this, function(_state) {
|
|
@@ -177,7 +177,7 @@ function _ts_generator(thisArg, body) {
|
|
|
177
177
|
};
|
|
178
178
|
});
|
|
179
179
|
};
|
|
180
|
-
return function() {
|
|
180
|
+
return /*#__PURE__*/ function() {
|
|
181
181
|
var _ref = _async_to_generator(function(logger) {
|
|
182
182
|
var e, e1;
|
|
183
183
|
return _ts_generator(this, function(_state) {
|
|
@@ -409,7 +409,7 @@ function _ts_generator(thisArg, body) {
|
|
|
409
409
|
value: /** @inheritdoc */ function load(context) {
|
|
410
410
|
var _this = this;
|
|
411
411
|
return {
|
|
412
|
-
transform: function() {
|
|
412
|
+
transform: /*#__PURE__*/ function() {
|
|
413
413
|
var _ref = _async_to_generator(function(requestOptions) {
|
|
414
414
|
var fingerprint;
|
|
415
415
|
return _ts_generator(this, function(_state) {
|
|
@@ -286,7 +286,7 @@ import { createJwtEncoder } from '../../utils/json-token';
|
|
|
286
286
|
value: function load() {
|
|
287
287
|
var _this = this;
|
|
288
288
|
return {
|
|
289
|
-
transform: function() {
|
|
289
|
+
transform: /*#__PURE__*/ function() {
|
|
290
290
|
var _ref = _async_to_generator(function(data) {
|
|
291
291
|
var publicFacts, _tmp, _tmp1;
|
|
292
292
|
return _ts_generator(this, function(_state) {
|
|
@@ -156,6 +156,7 @@ function _ts_generator(thisArg, body) {
|
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
158
|
* Plugin to limit the number of concurrent call
|
|
159
|
+
* @deprecated Use the one exposed by {@link @ama-sdk/client-fetch}, will be removed in v13
|
|
159
160
|
*/ export var ConcurrentFetch = /*#__PURE__*/ function() {
|
|
160
161
|
"use strict";
|
|
161
162
|
function ConcurrentFetch() {
|
|
@@ -198,7 +199,7 @@ function _ts_generator(thisArg, body) {
|
|
|
198
199
|
return _this.canStart() ? resolve(true) : _this.waitingResolvers.push(resolve);
|
|
199
200
|
});
|
|
200
201
|
},
|
|
201
|
-
transform: function() {
|
|
202
|
+
transform: /*#__PURE__*/ function() {
|
|
202
203
|
var _ref = _async_to_generator(function(fetchCall) {
|
|
203
204
|
var fetchResponse, e;
|
|
204
205
|
return _ts_generator(this, function(_state) {
|
|
@@ -195,6 +195,7 @@ function _ts_generator(thisArg, body) {
|
|
|
195
195
|
}
|
|
196
196
|
/**
|
|
197
197
|
* Plugin to add the keepalive flag to the request
|
|
198
|
+
* @deprecated Use the one exposed by {@link @ama-sdk/client-fetch}, will be removed in v13
|
|
198
199
|
*/ export var KeepaliveRequest = /*#__PURE__*/ function() {
|
|
199
200
|
"use strict";
|
|
200
201
|
function KeepaliveRequest() {
|
|
@@ -322,7 +322,7 @@ import { hmacSHA256, sha256 } from './mgw-mdw-auth.helpers';
|
|
|
322
322
|
value: function load() {
|
|
323
323
|
var _this = this;
|
|
324
324
|
return {
|
|
325
|
-
transform: function() {
|
|
325
|
+
transform: /*#__PURE__*/ function() {
|
|
326
326
|
var _ref = _async_to_generator(function(data) {
|
|
327
327
|
var url, token;
|
|
328
328
|
return _ts_generator(this, function(_state) {
|