@ama-sdk/core 12.3.0-prerelease.9 → 12.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/cjs/clients/api-angular-client.js +15 -19
- package/cjs/clients/api-beacon-client.js +2 -1
- package/cjs/clients/api-fetch-client.js +18 -22
- package/cjs/fwk/api.helpers.js +2 -1
- package/cjs/fwk/mocks/alf-mock-adapter.js +58 -60
- package/cjs/fwk/mocks/base-mock-adapter.js +15 -19
- package/cjs/fwk/param-deserialization.js +261 -0
- package/cjs/fwk/param-deserialization.spec.js +466 -0
- package/cjs/fwk/param-serialization.js +55 -12
- package/cjs/fwk/param-serialization.spec.js +200 -174
- package/cjs/plugins/abort/abort.spec.js +83 -81
- package/cjs/plugins/additional-params/additional-params-sync.request.js +71 -2
- package/cjs/plugins/additional-params/additional-params.request.js +87 -25
- package/cjs/plugins/additional-params/additional-params.spec.js +267 -81
- package/cjs/plugins/api-configuration-override/api-configuration-override.request.js +10 -17
- package/cjs/plugins/api-configuration-override/api-configuration-override.spec.js +83 -81
- package/cjs/plugins/api-key/api-key.request.js +12 -19
- package/cjs/plugins/api-key/api-key.spec.js +50 -50
- package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +21 -32
- package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +343 -327
- package/cjs/plugins/client-facts/client-facts.request.js +15 -22
- package/cjs/plugins/client-facts/client-facts.spec.js +218 -208
- package/cjs/plugins/concurrent/concurrent.fetch.js +12 -20
- package/cjs/plugins/concurrent/concurrent.spec.js +99 -99
- package/cjs/plugins/custom-info/custom-info.spec.js +90 -90
- package/cjs/plugins/fetch-cache/fetch-cache.spec.js +100 -98
- package/cjs/plugins/fetch-credentials/fetch-credentials.spec.js +60 -60
- package/cjs/plugins/json-token/json-token.spec.js +109 -107
- package/cjs/plugins/keepalive/keepalive.request.js +7 -12
- package/cjs/plugins/keepalive/keepalive.spec.js +32 -34
- package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.helpers.js +8 -20
- package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +18 -28
- package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +212 -204
- package/cjs/plugins/mock-intercept/mock-intercept.angular.js +94 -100
- package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +15 -22
- package/cjs/plugins/mock-intercept/mock-intercept.request.js +12 -19
- package/cjs/plugins/mock-intercept/mock-intercept.spec.js +245 -237
- package/cjs/plugins/perf-metric/perf-metric.fetch.js +11 -18
- package/cjs/plugins/pii-tokenizer/pii-tokenizer.request.js +15 -23
- package/cjs/plugins/pii-tokenizer/pii-tokenizer.spec.js +404 -386
- package/cjs/plugins/raw-response-info/raw-response-info.spec.js +67 -67
- package/cjs/plugins/retry/retry.fetch.js +18 -27
- package/cjs/plugins/retry/retry.spec.js +233 -225
- package/cjs/plugins/reviver/reviver.spec.js +88 -86
- package/cjs/plugins/session-id/session-id.spec.js +98 -94
- package/cjs/plugins/si-token/si-token.spec.js +27 -29
- package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +17 -24
- package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +199 -191
- package/cjs/plugins/timeout/timeout.fetch.js +13 -19
- package/cjs/plugins/timeout/timeout.spec.js +211 -205
- package/cjs/plugins/url-rewrite/url-rewrite.request.js +9 -16
- package/cjs/plugins/url-rewrite/url-rewrite.spec.js +48 -48
- package/cjs/plugins/wait-for/wait-for.fetch.js +19 -29
- package/cjs/plugins/wait-for/wait-for.spec.js +211 -203
- package/cjs/utils/crypto.js +8 -20
- package/cjs/utils/generic-api.js +9 -14
- package/cjs/utils/json-token.js +10 -17
- package/cjs/utils/json-token.spec.js +495 -497
- package/esm2015/clients/api-angular-client.js +15 -19
- package/esm2015/clients/api-beacon-client.js +2 -1
- package/esm2015/clients/api-fetch-client.js +18 -22
- package/esm2015/fwk/api.helpers.js +2 -2
- package/esm2015/fwk/mocks/alf-mock-adapter.js +58 -60
- package/esm2015/fwk/mocks/base-mock-adapter.js +15 -19
- package/esm2015/fwk/param-deserialization.js +253 -0
- package/esm2015/fwk/param-deserialization.spec.js +462 -0
- package/esm2015/fwk/param-serialization.js +43 -12
- package/esm2015/fwk/param-serialization.spec.js +200 -174
- package/esm2015/plugins/abort/abort.spec.js +83 -81
- package/esm2015/plugins/additional-params/additional-params-sync.request.js +71 -2
- package/esm2015/plugins/additional-params/additional-params.request.js +87 -25
- package/esm2015/plugins/additional-params/additional-params.spec.js +267 -81
- package/esm2015/plugins/api-configuration-override/api-configuration-override.request.js +10 -17
- package/esm2015/plugins/api-configuration-override/api-configuration-override.spec.js +83 -81
- package/esm2015/plugins/api-key/api-key.request.js +12 -19
- package/esm2015/plugins/api-key/api-key.spec.js +50 -50
- package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +21 -32
- package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +343 -327
- package/esm2015/plugins/client-facts/client-facts.request.js +15 -22
- package/esm2015/plugins/client-facts/client-facts.spec.js +218 -208
- package/esm2015/plugins/concurrent/concurrent.fetch.js +12 -20
- package/esm2015/plugins/concurrent/concurrent.spec.js +99 -99
- package/esm2015/plugins/custom-info/custom-info.spec.js +90 -90
- package/esm2015/plugins/fetch-cache/fetch-cache.spec.js +100 -98
- package/esm2015/plugins/fetch-credentials/fetch-credentials.spec.js +60 -60
- package/esm2015/plugins/json-token/json-token.spec.js +109 -107
- package/esm2015/plugins/keepalive/keepalive.request.js +7 -12
- package/esm2015/plugins/keepalive/keepalive.spec.js +32 -34
- package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.helpers.js +8 -20
- package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +18 -28
- package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +212 -204
- package/esm2015/plugins/mock-intercept/mock-intercept.angular.js +94 -100
- package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +15 -22
- package/esm2015/plugins/mock-intercept/mock-intercept.request.js +12 -19
- package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +245 -237
- package/esm2015/plugins/perf-metric/perf-metric.fetch.js +11 -18
- package/esm2015/plugins/pii-tokenizer/pii-tokenizer.request.js +15 -23
- package/esm2015/plugins/pii-tokenizer/pii-tokenizer.spec.js +404 -386
- package/esm2015/plugins/raw-response-info/raw-response-info.spec.js +67 -67
- package/esm2015/plugins/retry/retry.fetch.js +18 -27
- package/esm2015/plugins/retry/retry.spec.js +233 -225
- package/esm2015/plugins/reviver/reviver.spec.js +88 -86
- package/esm2015/plugins/session-id/session-id.spec.js +98 -94
- package/esm2015/plugins/si-token/si-token.spec.js +27 -29
- package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +17 -24
- package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +199 -191
- package/esm2015/plugins/timeout/timeout.fetch.js +13 -19
- package/esm2015/plugins/timeout/timeout.spec.js +211 -205
- package/esm2015/plugins/url-rewrite/url-rewrite.request.js +9 -16
- package/esm2015/plugins/url-rewrite/url-rewrite.spec.js +48 -48
- package/esm2015/plugins/wait-for/wait-for.fetch.js +19 -29
- package/esm2015/plugins/wait-for/wait-for.spec.js +211 -203
- package/esm2015/utils/crypto.js +8 -20
- package/esm2015/utils/generic-api.js +9 -14
- package/esm2015/utils/json-token.js +10 -17
- package/esm2015/utils/json-token.spec.js +495 -497
- package/package.json +13 -13
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +8 -21
- 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 +1 -1
- package/src/clients/api-angular-client.d.ts.map +1 -1
- package/src/clients/api-angular-client.js +2 -1
- package/src/clients/api-angular-client.js.map +1 -1
- package/src/clients/api-beacon-client.d.ts +1 -1
- package/src/clients/api-beacon-client.d.ts.map +1 -1
- package/src/clients/api-beacon-client.js +2 -1
- package/src/clients/api-beacon-client.js.map +1 -1
- package/src/clients/api-fetch-client.d.ts +1 -1
- package/src/clients/api-fetch-client.d.ts.map +1 -1
- package/src/clients/api-fetch-client.js +2 -1
- package/src/clients/api-fetch-client.js.map +1 -1
- package/src/fwk/api.helpers.d.ts +1 -2
- package/src/fwk/api.helpers.d.ts.map +1 -1
- package/src/fwk/api.helpers.js +1 -2
- package/src/fwk/api.helpers.js.map +1 -1
- package/src/fwk/core/api-client.d.ts +4 -2
- package/src/fwk/core/api-client.d.ts.map +1 -1
- package/src/fwk/core/api-client.js.map +1 -1
- package/src/fwk/core/base-api-constructor.d.ts +2 -0
- package/src/fwk/core/base-api-constructor.d.ts.map +1 -1
- package/src/fwk/core/base-api-constructor.js.map +1 -1
- package/src/fwk/param-deserialization.d.ts +34 -0
- package/src/fwk/param-deserialization.d.ts.map +1 -0
- package/src/fwk/param-deserialization.js +198 -0
- package/src/fwk/param-deserialization.js.map +1 -0
- package/src/fwk/param-serialization.d.ts +28 -0
- package/src/fwk/param-serialization.d.ts.map +1 -1
- package/src/fwk/param-serialization.js +44 -10
- package/src/fwk/param-serialization.js.map +1 -1
- package/src/plugins/additional-params/additional-params-sync.request.d.ts +9 -2
- package/src/plugins/additional-params/additional-params-sync.request.d.ts.map +1 -1
- package/src/plugins/additional-params/additional-params-sync.request.js +21 -2
- package/src/plugins/additional-params/additional-params-sync.request.js.map +1 -1
- package/src/plugins/additional-params/additional-params.request.d.ts +11 -2
- package/src/plugins/additional-params/additional-params.request.d.ts.map +1 -1
- package/src/plugins/additional-params/additional-params.request.js +21 -2
- package/src/plugins/additional-params/additional-params.request.js.map +1 -1
- package/src/plugins/core/request-plugin.d.ts +14 -1
- package/src/plugins/core/request-plugin.d.ts.map +1 -1
- package/src/plugins/si-token/si-token.request.d.ts.map +1 -1
- package/src/plugins/si-token/si-token.request.js.map +1 -1
|
@@ -146,7 +146,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
146
146
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
147
147
|
}
|
|
148
148
|
function _ts_generator(thisArg, body) {
|
|
149
|
-
var f, y, t,
|
|
149
|
+
var f, y, t, _ = {
|
|
150
150
|
label: 0,
|
|
151
151
|
sent: function() {
|
|
152
152
|
if (t[0] & 1) throw t[1];
|
|
@@ -154,12 +154,8 @@ function _ts_generator(thisArg, body) {
|
|
|
154
154
|
},
|
|
155
155
|
trys: [],
|
|
156
156
|
ops: []
|
|
157
|
-
};
|
|
158
|
-
return g = {
|
|
159
|
-
next: verb(0),
|
|
160
|
-
"throw": verb(1),
|
|
161
|
-
"return": verb(2)
|
|
162
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
157
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
158
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
163
159
|
return this;
|
|
164
160
|
}), g;
|
|
165
161
|
function verb(n) {
|
|
@@ -172,7 +168,7 @@ function _ts_generator(thisArg, body) {
|
|
|
172
168
|
}
|
|
173
169
|
function step(op) {
|
|
174
170
|
if (f) throw new TypeError("Generator is already executing.");
|
|
175
|
-
while(_)try {
|
|
171
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
176
172
|
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;
|
|
177
173
|
if (y = 0, t) op = [
|
|
178
174
|
op[0] & 2,
|
|
@@ -248,7 +244,8 @@ var DEFAULT_OPTIONS = {
|
|
|
248
244
|
angularPlugins: [],
|
|
249
245
|
requestPlugins: [],
|
|
250
246
|
enableTokenization: false,
|
|
251
|
-
disableFallback: false
|
|
247
|
+
disableFallback: false,
|
|
248
|
+
enableParameterSerialization: false
|
|
252
249
|
};
|
|
253
250
|
var ApiAngularClient = /*#__PURE__*/ function() {
|
|
254
251
|
"use strict";
|
|
@@ -279,7 +276,6 @@ var ApiAngularClient = /*#__PURE__*/ function() {
|
|
|
279
276
|
{
|
|
280
277
|
key: "getRequestOptions",
|
|
281
278
|
value: /** @inheritdoc */ function getRequestOptions(requestOptionsParameters) {
|
|
282
|
-
var _this = this;
|
|
283
279
|
return _async_to_generator(function() {
|
|
284
280
|
var opts, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, plugin, _requestOptionsParameters_api, err;
|
|
285
281
|
return _ts_generator(this, function(_state) {
|
|
@@ -289,7 +285,7 @@ var ApiAngularClient = /*#__PURE__*/ function() {
|
|
|
289
285
|
headers: new Headers((0, _apihelpers.filterUndefinedValues)(requestOptionsParameters.headers)),
|
|
290
286
|
queryParams: (0, _apihelpers.filterUndefinedValues)(requestOptionsParameters.queryParams)
|
|
291
287
|
});
|
|
292
|
-
if (!
|
|
288
|
+
if (!this.options.requestPlugins) return [
|
|
293
289
|
3,
|
|
294
290
|
8
|
|
295
291
|
];
|
|
@@ -302,7 +298,7 @@ var ApiAngularClient = /*#__PURE__*/ function() {
|
|
|
302
298
|
7,
|
|
303
299
|
8
|
|
304
300
|
]);
|
|
305
|
-
_iterator =
|
|
301
|
+
_iterator = this.options.requestPlugins[Symbol.iterator]();
|
|
306
302
|
_state.label = 2;
|
|
307
303
|
case 2:
|
|
308
304
|
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
|
|
@@ -313,7 +309,7 @@ var ApiAngularClient = /*#__PURE__*/ function() {
|
|
|
313
309
|
return [
|
|
314
310
|
4,
|
|
315
311
|
plugin.load({
|
|
316
|
-
logger:
|
|
312
|
+
logger: this.options.logger,
|
|
317
313
|
apiName: (_requestOptionsParameters_api = requestOptionsParameters.api) === null || _requestOptionsParameters_api === void 0 ? void 0 : _requestOptionsParameters_api.apiName
|
|
318
314
|
}).transform(opts)
|
|
319
315
|
];
|
|
@@ -359,7 +355,7 @@ var ApiAngularClient = /*#__PURE__*/ function() {
|
|
|
359
355
|
];
|
|
360
356
|
}
|
|
361
357
|
});
|
|
362
|
-
})();
|
|
358
|
+
}).call(this);
|
|
363
359
|
}
|
|
364
360
|
},
|
|
365
361
|
{
|
|
@@ -408,12 +404,12 @@ var ApiAngularClient = /*#__PURE__*/ function() {
|
|
|
408
404
|
{
|
|
409
405
|
key: "processCall",
|
|
410
406
|
value: function processCall(url, options, apiType, apiName, revivers, operationId) {
|
|
411
|
-
var _this = this;
|
|
412
407
|
return _async_to_generator(function() {
|
|
413
|
-
var response, root, exception, origin, headers, asyncResponse, e, reviver, replyPlugins, parsedData, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, pluginRunner, err;
|
|
408
|
+
var _this, response, root, exception, origin, headers, asyncResponse, e, reviver, replyPlugins, parsedData, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, pluginRunner, err;
|
|
414
409
|
return _ts_generator(this, function(_state) {
|
|
415
410
|
switch(_state.label){
|
|
416
411
|
case 0:
|
|
412
|
+
_this = this;
|
|
417
413
|
origin = options.headers.get('Origin');
|
|
418
414
|
_state.label = 1;
|
|
419
415
|
case 1:
|
|
@@ -521,9 +517,9 @@ var ApiAngularClient = /*#__PURE__*/ function() {
|
|
|
521
517
|
];
|
|
522
518
|
case 4:
|
|
523
519
|
reviver = (0, _apihelpers.getResponseReviver)(revivers, response, operationId, {
|
|
524
|
-
disableFallback:
|
|
520
|
+
disableFallback: this.options.disableFallback
|
|
525
521
|
});
|
|
526
|
-
replyPlugins =
|
|
522
|
+
replyPlugins = this.options.replyPlugins ? this.options.replyPlugins.map(function(plugin) {
|
|
527
523
|
return plugin.load({
|
|
528
524
|
dictionaries: root && root.dictionaries,
|
|
529
525
|
response: response && _object_spread_props(_object_spread({}, response), {
|
|
@@ -611,7 +607,7 @@ var ApiAngularClient = /*#__PURE__*/ function() {
|
|
|
611
607
|
];
|
|
612
608
|
}
|
|
613
609
|
});
|
|
614
|
-
})();
|
|
610
|
+
}).call(this);
|
|
615
611
|
}
|
|
616
612
|
}
|
|
617
613
|
]);
|
|
@@ -91,7 +91,8 @@ function _object_spread_props(target, source) {
|
|
|
91
91
|
var DEFAULT_OPTIONS = {
|
|
92
92
|
replyPlugins: [],
|
|
93
93
|
requestPlugins: [],
|
|
94
|
-
enableTokenization: false
|
|
94
|
+
enableTokenization: false,
|
|
95
|
+
enableParameterSerialization: false
|
|
95
96
|
};
|
|
96
97
|
/**
|
|
97
98
|
* Determine if the given value is a promise
|
|
@@ -146,7 +146,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
146
146
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
147
147
|
}
|
|
148
148
|
function _ts_generator(thisArg, body) {
|
|
149
|
-
var f, y, t,
|
|
149
|
+
var f, y, t, _ = {
|
|
150
150
|
label: 0,
|
|
151
151
|
sent: function() {
|
|
152
152
|
if (t[0] & 1) throw t[1];
|
|
@@ -154,12 +154,8 @@ function _ts_generator(thisArg, body) {
|
|
|
154
154
|
},
|
|
155
155
|
trys: [],
|
|
156
156
|
ops: []
|
|
157
|
-
};
|
|
158
|
-
return g = {
|
|
159
|
-
next: verb(0),
|
|
160
|
-
"throw": verb(1),
|
|
161
|
-
"return": verb(2)
|
|
162
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
157
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
158
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
163
159
|
return this;
|
|
164
160
|
}), g;
|
|
165
161
|
function verb(n) {
|
|
@@ -172,7 +168,7 @@ function _ts_generator(thisArg, body) {
|
|
|
172
168
|
}
|
|
173
169
|
function step(op) {
|
|
174
170
|
if (f) throw new TypeError("Generator is already executing.");
|
|
175
|
-
while(_)try {
|
|
171
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
176
172
|
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;
|
|
177
173
|
if (y = 0, t) op = [
|
|
178
174
|
op[0] & 2,
|
|
@@ -248,7 +244,8 @@ var DEFAULT_OPTIONS = {
|
|
|
248
244
|
fetchPlugins: [],
|
|
249
245
|
requestPlugins: [],
|
|
250
246
|
enableTokenization: false,
|
|
251
|
-
disableFallback: false
|
|
247
|
+
disableFallback: false,
|
|
248
|
+
enableParameterSerialization: false
|
|
252
249
|
};
|
|
253
250
|
var ApiFetchClient = /*#__PURE__*/ function() {
|
|
254
251
|
"use strict";
|
|
@@ -285,7 +282,6 @@ var ApiFetchClient = /*#__PURE__*/ function() {
|
|
|
285
282
|
{
|
|
286
283
|
key: "getRequestOptions",
|
|
287
284
|
value: /** @inheritdoc */ function getRequestOptions(requestOptionsParameters) {
|
|
288
|
-
var _this = this;
|
|
289
285
|
return _async_to_generator(function() {
|
|
290
286
|
var opts, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, plugin, _requestOptionsParameters_api, err;
|
|
291
287
|
return _ts_generator(this, function(_state) {
|
|
@@ -295,7 +291,7 @@ var ApiFetchClient = /*#__PURE__*/ function() {
|
|
|
295
291
|
headers: new Headers((0, _apihelpers.filterUndefinedValues)(requestOptionsParameters.headers)),
|
|
296
292
|
queryParams: (0, _apihelpers.filterUndefinedValues)(requestOptionsParameters.queryParams)
|
|
297
293
|
});
|
|
298
|
-
if (!
|
|
294
|
+
if (!this.options.requestPlugins) return [
|
|
299
295
|
3,
|
|
300
296
|
8
|
|
301
297
|
];
|
|
@@ -308,7 +304,7 @@ var ApiFetchClient = /*#__PURE__*/ function() {
|
|
|
308
304
|
7,
|
|
309
305
|
8
|
|
310
306
|
]);
|
|
311
|
-
_iterator =
|
|
307
|
+
_iterator = this.options.requestPlugins[Symbol.iterator]();
|
|
312
308
|
_state.label = 2;
|
|
313
309
|
case 2:
|
|
314
310
|
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
|
|
@@ -319,7 +315,7 @@ var ApiFetchClient = /*#__PURE__*/ function() {
|
|
|
319
315
|
return [
|
|
320
316
|
4,
|
|
321
317
|
plugin.load({
|
|
322
|
-
logger:
|
|
318
|
+
logger: this.options.logger,
|
|
323
319
|
apiName: (_requestOptionsParameters_api = requestOptionsParameters.api) === null || _requestOptionsParameters_api === void 0 ? void 0 : _requestOptionsParameters_api.apiName
|
|
324
320
|
}).transform(opts)
|
|
325
321
|
];
|
|
@@ -365,7 +361,7 @@ var ApiFetchClient = /*#__PURE__*/ function() {
|
|
|
365
361
|
];
|
|
366
362
|
}
|
|
367
363
|
});
|
|
368
|
-
})();
|
|
364
|
+
}).call(this);
|
|
369
365
|
}
|
|
370
366
|
},
|
|
371
367
|
{
|
|
@@ -408,12 +404,12 @@ var ApiFetchClient = /*#__PURE__*/ function() {
|
|
|
408
404
|
{
|
|
409
405
|
key: "processCall",
|
|
410
406
|
value: function processCall(url, options, apiType, apiName, revivers, operationId) {
|
|
411
|
-
var _this = this;
|
|
412
407
|
return _async_to_generator(function() {
|
|
413
|
-
var response, asyncResponse, root, body, exception, origin, _options_metadata, metadataSignal, controller, loadedPlugins, _loadedPlugins, canStart, isCanceledBy, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, plugin, e, reviver, replyPlugins, parsedData, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, pluginRunner, err;
|
|
408
|
+
var _this, response, asyncResponse, root, body, exception, origin, _options_metadata, metadataSignal, controller, loadedPlugins, _loadedPlugins, canStart, isCanceledBy, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, plugin, e, reviver, replyPlugins, parsedData, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, pluginRunner, err;
|
|
414
409
|
return _ts_generator(this, function(_state) {
|
|
415
410
|
switch(_state.label){
|
|
416
411
|
case 0:
|
|
412
|
+
_this = this;
|
|
417
413
|
origin = options.headers.get('Origin');
|
|
418
414
|
_state.label = 1;
|
|
419
415
|
case 1:
|
|
@@ -431,9 +427,9 @@ var ApiFetchClient = /*#__PURE__*/ function() {
|
|
|
431
427
|
return controller.abort();
|
|
432
428
|
});
|
|
433
429
|
loadedPlugins = [];
|
|
434
|
-
if (
|
|
430
|
+
if (this.options.fetchPlugins) {
|
|
435
431
|
;
|
|
436
|
-
(_loadedPlugins = loadedPlugins).push.apply(_loadedPlugins, _to_consumable_array(
|
|
432
|
+
(_loadedPlugins = loadedPlugins).push.apply(_loadedPlugins, _to_consumable_array(this.options.fetchPlugins.map(function(plugin) {
|
|
437
433
|
return plugin.load({
|
|
438
434
|
url: url,
|
|
439
435
|
options: options,
|
|
@@ -454,7 +450,7 @@ var ApiFetchClient = /*#__PURE__*/ function() {
|
|
|
454
450
|
case 2:
|
|
455
451
|
canStart = _state.sent();
|
|
456
452
|
isCanceledBy = canStart.indexOf(false);
|
|
457
|
-
asyncResponse = isCanceledBy === -1 ? fetch(url, options) : Promise.reject(new _errors.CanceledCallError("Is canceled by the plugin ".concat(isCanceledBy), isCanceledBy,
|
|
453
|
+
asyncResponse = isCanceledBy === -1 ? fetch(url, options) : Promise.reject(new _errors.CanceledCallError("Is canceled by the plugin ".concat(isCanceledBy), isCanceledBy, this.options.fetchPlugins[isCanceledBy], {
|
|
458
454
|
apiName: apiName,
|
|
459
455
|
operationId: operationId,
|
|
460
456
|
url: url,
|
|
@@ -531,9 +527,9 @@ var ApiFetchClient = /*#__PURE__*/ function() {
|
|
|
531
527
|
});
|
|
532
528
|
}
|
|
533
529
|
reviver = (0, _apihelpers.getResponseReviver)(revivers, response, operationId, {
|
|
534
|
-
disableFallback:
|
|
530
|
+
disableFallback: this.options.disableFallback
|
|
535
531
|
});
|
|
536
|
-
replyPlugins =
|
|
532
|
+
replyPlugins = this.options.replyPlugins ? this.options.replyPlugins.map(function(plugin) {
|
|
537
533
|
return plugin.load({
|
|
538
534
|
dictionaries: root && root.dictionaries,
|
|
539
535
|
response: response,
|
|
@@ -614,7 +610,7 @@ var ApiFetchClient = /*#__PURE__*/ function() {
|
|
|
614
610
|
];
|
|
615
611
|
}
|
|
616
612
|
});
|
|
617
|
-
})();
|
|
613
|
+
}).call(this);
|
|
618
614
|
}
|
|
619
615
|
}
|
|
620
616
|
]);
|
package/cjs/fwk/api.helpers.js
CHANGED
|
@@ -129,7 +129,8 @@ function prepareUrl(url) {
|
|
|
129
129
|
var paramsPrefix = url.includes('?') ? '&' : '?';
|
|
130
130
|
return url + (queryPart ? paramsPrefix + queryPart : '');
|
|
131
131
|
}
|
|
132
|
-
function prepareUrlWithQueryParams(url
|
|
132
|
+
function prepareUrlWithQueryParams(url) {
|
|
133
|
+
var serializedQueryParams = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
133
134
|
var paramsPrefix = url.includes('?') ? '&' : '?';
|
|
134
135
|
var queryPart = Object.values(serializedQueryParams).join('&');
|
|
135
136
|
return url + (queryPart ? paramsPrefix + queryPart : '');
|
|
@@ -92,7 +92,7 @@ function _object_spread_props(target, source) {
|
|
|
92
92
|
return target;
|
|
93
93
|
}
|
|
94
94
|
function _ts_generator(thisArg, body) {
|
|
95
|
-
var f, y, t,
|
|
95
|
+
var f, y, t, _ = {
|
|
96
96
|
label: 0,
|
|
97
97
|
sent: function() {
|
|
98
98
|
if (t[0] & 1) throw t[1];
|
|
@@ -100,12 +100,8 @@ function _ts_generator(thisArg, body) {
|
|
|
100
100
|
},
|
|
101
101
|
trys: [],
|
|
102
102
|
ops: []
|
|
103
|
-
};
|
|
104
|
-
return g = {
|
|
105
|
-
next: verb(0),
|
|
106
|
-
"throw": verb(1),
|
|
107
|
-
"return": verb(2)
|
|
108
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
103
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
104
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
109
105
|
return this;
|
|
110
106
|
}), g;
|
|
111
107
|
function verb(n) {
|
|
@@ -118,7 +114,7 @@ function _ts_generator(thisArg, body) {
|
|
|
118
114
|
}
|
|
119
115
|
function step(op) {
|
|
120
116
|
if (f) throw new TypeError("Generator is already executing.");
|
|
121
|
-
while(_)try {
|
|
117
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
122
118
|
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;
|
|
123
119
|
if (y = 0, t) op = [
|
|
124
120
|
op[0] & 2,
|
|
@@ -335,56 +331,58 @@ function _ts_generator(thisArg, body) {
|
|
|
335
331
|
return mock;
|
|
336
332
|
}
|
|
337
333
|
function getAlfMockAdapter(binFilePath, operationAdapter) {
|
|
338
|
-
return new _sequentialmockadapter.SequentialMockAdapter(operationAdapter,
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
334
|
+
return new _sequentialmockadapter.SequentialMockAdapter(operationAdapter, function() {
|
|
335
|
+
return _async_to_generator(function() {
|
|
336
|
+
var response, content, adapter, _tmp;
|
|
337
|
+
return _ts_generator(this, function(_state) {
|
|
338
|
+
switch(_state.label){
|
|
339
|
+
case 0:
|
|
340
|
+
return [
|
|
341
|
+
4,
|
|
342
|
+
fetch(binFilePath)
|
|
343
|
+
];
|
|
344
|
+
case 1:
|
|
345
|
+
response = _state.sent();
|
|
346
|
+
if (!response.ok) return [
|
|
347
|
+
3,
|
|
348
|
+
6
|
|
349
|
+
];
|
|
350
|
+
return [
|
|
351
|
+
4,
|
|
352
|
+
response.text()
|
|
353
|
+
];
|
|
354
|
+
case 2:
|
|
355
|
+
content = _state.sent();
|
|
356
|
+
if (!(typeof operationAdapter === 'function')) return [
|
|
357
|
+
3,
|
|
358
|
+
4
|
|
359
|
+
];
|
|
360
|
+
return [
|
|
361
|
+
4,
|
|
362
|
+
operationAdapter()
|
|
363
|
+
];
|
|
364
|
+
case 3:
|
|
365
|
+
_tmp = _state.sent();
|
|
366
|
+
return [
|
|
367
|
+
3,
|
|
368
|
+
5
|
|
369
|
+
];
|
|
370
|
+
case 4:
|
|
371
|
+
_tmp = operationAdapter;
|
|
372
|
+
_state.label = 5;
|
|
373
|
+
case 5:
|
|
374
|
+
adapter = _tmp;
|
|
375
|
+
return [
|
|
376
|
+
2,
|
|
377
|
+
buildMockMap(content, adapter)
|
|
378
|
+
];
|
|
379
|
+
case 6:
|
|
380
|
+
return [
|
|
381
|
+
2,
|
|
382
|
+
{}
|
|
383
|
+
];
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
})();
|
|
387
|
+
});
|
|
390
388
|
}
|
|
@@ -71,7 +71,7 @@ function _define_property(obj, key, value) {
|
|
|
71
71
|
return obj;
|
|
72
72
|
}
|
|
73
73
|
function _ts_generator(thisArg, body) {
|
|
74
|
-
var f, y, t,
|
|
74
|
+
var f, y, t, _ = {
|
|
75
75
|
label: 0,
|
|
76
76
|
sent: function() {
|
|
77
77
|
if (t[0] & 1) throw t[1];
|
|
@@ -79,12 +79,8 @@ function _ts_generator(thisArg, body) {
|
|
|
79
79
|
},
|
|
80
80
|
trys: [],
|
|
81
81
|
ops: []
|
|
82
|
-
};
|
|
83
|
-
return g = {
|
|
84
|
-
next: verb(0),
|
|
85
|
-
"throw": verb(1),
|
|
86
|
-
"return": verb(2)
|
|
87
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
82
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
83
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
88
84
|
return this;
|
|
89
85
|
}), g;
|
|
90
86
|
function verb(n) {
|
|
@@ -97,7 +93,7 @@ function _ts_generator(thisArg, body) {
|
|
|
97
93
|
}
|
|
98
94
|
function step(op) {
|
|
99
95
|
if (f) throw new TypeError("Generator is already executing.");
|
|
100
|
-
while(_)try {
|
|
96
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
101
97
|
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;
|
|
102
98
|
if (y = 0, t) op = [
|
|
103
99
|
op[0] & 2,
|
|
@@ -199,19 +195,18 @@ var BaseMockAdapter = /*#__PURE__*/ function() {
|
|
|
199
195
|
value: /**
|
|
200
196
|
* @inheritDoc
|
|
201
197
|
*/ function retrieveOperationId(request) {
|
|
202
|
-
var _this = this;
|
|
203
198
|
return _async_to_generator(function() {
|
|
204
199
|
var pathObjects, _tmp, object;
|
|
205
200
|
return _ts_generator(this, function(_state) {
|
|
206
201
|
switch(_state.label){
|
|
207
202
|
case 0:
|
|
208
|
-
if (!(typeof
|
|
203
|
+
if (!(typeof this.pathObjects === 'function')) return [
|
|
209
204
|
3,
|
|
210
205
|
2
|
|
211
206
|
];
|
|
212
207
|
return [
|
|
213
208
|
4,
|
|
214
|
-
|
|
209
|
+
this.pathObjects()
|
|
215
210
|
];
|
|
216
211
|
case 1:
|
|
217
212
|
_tmp = _state.sent();
|
|
@@ -220,18 +215,18 @@ var BaseMockAdapter = /*#__PURE__*/ function() {
|
|
|
220
215
|
3
|
|
221
216
|
];
|
|
222
217
|
case 2:
|
|
223
|
-
_tmp =
|
|
218
|
+
_tmp = this.pathObjects;
|
|
224
219
|
_state.label = 3;
|
|
225
220
|
case 3:
|
|
226
221
|
pathObjects = _tmp;
|
|
227
222
|
object = (0, _helpers.getPath)(request.basePath, pathObjects, request.method);
|
|
228
223
|
return [
|
|
229
224
|
2,
|
|
230
|
-
|
|
225
|
+
this.extractOperationIdFromPath(request, object)
|
|
231
226
|
];
|
|
232
227
|
}
|
|
233
228
|
});
|
|
234
|
-
})();
|
|
229
|
+
}).call(this);
|
|
235
230
|
}
|
|
236
231
|
},
|
|
237
232
|
{
|
|
@@ -239,28 +234,29 @@ var BaseMockAdapter = /*#__PURE__*/ function() {
|
|
|
239
234
|
value: /**
|
|
240
235
|
* @inheritDoc
|
|
241
236
|
*/ function initialize() {
|
|
242
|
-
var _this = this;
|
|
243
237
|
return _async_to_generator(function() {
|
|
238
|
+
var _;
|
|
244
239
|
return _ts_generator(this, function(_state) {
|
|
245
240
|
switch(_state.label){
|
|
246
241
|
case 0:
|
|
247
|
-
if (!
|
|
242
|
+
if (!this.mockFactory || Object.keys(this.mocks).length > 0) {
|
|
248
243
|
return [
|
|
249
244
|
2
|
|
250
245
|
];
|
|
251
246
|
}
|
|
247
|
+
_ = this;
|
|
252
248
|
return [
|
|
253
249
|
4,
|
|
254
|
-
|
|
250
|
+
this.mockFactory()
|
|
255
251
|
];
|
|
256
252
|
case 1:
|
|
257
|
-
|
|
253
|
+
_.mocks = _state.sent();
|
|
258
254
|
return [
|
|
259
255
|
2
|
|
260
256
|
];
|
|
261
257
|
}
|
|
262
258
|
});
|
|
263
|
-
})();
|
|
259
|
+
}).call(this);
|
|
264
260
|
}
|
|
265
261
|
}
|
|
266
262
|
]);
|