@ama-sdk/core 12.1.8 → 12.1.11
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 +13 -18
- package/cjs/clients/api-fetch-client.js +16 -21
- package/cjs/fwk/api.helpers.js +11 -11
- package/cjs/fwk/date.js +5 -5
- package/cjs/fwk/errors.js +7 -7
- package/cjs/fwk/mocks/alf-mock-adapter.js +58 -60
- package/cjs/fwk/mocks/base-mock-adapter.js +15 -19
- package/cjs/fwk/mocks/helpers.js +3 -3
- package/cjs/fwk/param-serialization.js +6 -6
- package/cjs/fwk/reviver.js +4 -4
- package/cjs/plugins/abort/abort.spec.js +83 -81
- package/cjs/plugins/additional-params/additional-params.request.js +18 -25
- package/cjs/plugins/additional-params/additional-params.spec.js +194 -186
- 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 +25 -36
- package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +343 -327
- package/cjs/plugins/client-facts/client-facts.request.js +18 -25
- 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 +11 -23
- 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.interface.js +3 -3
- 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 +19 -27
- 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 +16 -22
- 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 +15 -27
- package/cjs/utils/generic-api.js +9 -14
- package/cjs/utils/json-token.js +19 -26
- package/cjs/utils/json-token.spec.js +495 -497
- package/cjs/utils/mime-types.js +3 -3
- package/esm2015/clients/api-angular-client.js +13 -18
- package/esm2015/clients/api-fetch-client.js +16 -21
- package/esm2015/fwk/mocks/alf-mock-adapter.js +58 -60
- package/esm2015/fwk/mocks/base-mock-adapter.js +15 -19
- package/esm2015/plugins/abort/abort.spec.js +83 -81
- package/esm2015/plugins/additional-params/additional-params.request.js +15 -22
- package/esm2015/plugins/additional-params/additional-params.spec.js +194 -186
- 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 +6 -6
|
@@ -28,7 +28,7 @@ function _async_to_generator(fn) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
function _ts_generator(thisArg, body) {
|
|
31
|
-
var f, y, t,
|
|
31
|
+
var f, y, t, _ = {
|
|
32
32
|
label: 0,
|
|
33
33
|
sent: function() {
|
|
34
34
|
if (t[0] & 1) throw t[1];
|
|
@@ -36,12 +36,8 @@ function _ts_generator(thisArg, body) {
|
|
|
36
36
|
},
|
|
37
37
|
trys: [],
|
|
38
38
|
ops: []
|
|
39
|
-
};
|
|
40
|
-
return g = {
|
|
41
|
-
next: verb(0),
|
|
42
|
-
"throw": verb(1),
|
|
43
|
-
"return": verb(2)
|
|
44
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
39
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
40
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
45
41
|
return this;
|
|
46
42
|
}), g;
|
|
47
43
|
function verb(n) {
|
|
@@ -54,7 +50,7 @@ function _ts_generator(thisArg, body) {
|
|
|
54
50
|
}
|
|
55
51
|
function step(op) {
|
|
56
52
|
if (f) throw new TypeError("Generator is already executing.");
|
|
57
|
-
while(_)try {
|
|
53
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
58
54
|
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;
|
|
59
55
|
if (y = 0, t) op = [
|
|
60
56
|
op[0] & 2,
|
|
@@ -126,65 +122,69 @@ import { ApiTypes } from '../../fwk/api';
|
|
|
126
122
|
import { RawResponseInfoReply } from './raw-response-info.reply';
|
|
127
123
|
describe('Raw response info Reply plugin', function() {
|
|
128
124
|
var reviver = jest.fn();
|
|
129
|
-
it('should add response object',
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
125
|
+
it('should add response object', function() {
|
|
126
|
+
return _async_to_generator(function() {
|
|
127
|
+
var plugin, runner, data, newData;
|
|
128
|
+
return _ts_generator(this, function(_state) {
|
|
129
|
+
switch(_state.label){
|
|
130
|
+
case 0:
|
|
131
|
+
plugin = new RawResponseInfoReply();
|
|
132
|
+
runner = plugin.load({
|
|
133
|
+
reviver: reviver,
|
|
134
|
+
apiType: ApiTypes.DEFAULT,
|
|
135
|
+
response: {
|
|
136
|
+
headers: new Headers(),
|
|
137
|
+
test: 'OK'
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
data = {};
|
|
141
|
+
return [
|
|
142
|
+
4,
|
|
143
|
+
runner.transform(data)
|
|
144
|
+
];
|
|
145
|
+
case 1:
|
|
146
|
+
newData = _state.sent();
|
|
147
|
+
expect(newData.responseInfo).toBeDefined();
|
|
148
|
+
expect(newData.responseInfo.test).toBe('OK');
|
|
149
|
+
return [
|
|
150
|
+
2
|
|
151
|
+
];
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
})();
|
|
155
|
+
});
|
|
156
|
+
it('should keep original data', function() {
|
|
157
|
+
return _async_to_generator(function() {
|
|
158
|
+
var plugin, runner, data, newData;
|
|
159
|
+
return _ts_generator(this, function(_state) {
|
|
160
|
+
switch(_state.label){
|
|
161
|
+
case 0:
|
|
162
|
+
plugin = new RawResponseInfoReply();
|
|
163
|
+
runner = plugin.load({
|
|
164
|
+
reviver: reviver,
|
|
165
|
+
apiType: ApiTypes.DEFAULT,
|
|
166
|
+
response: {
|
|
167
|
+
headers: new Headers(),
|
|
168
|
+
test: 'OK'
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
data = {
|
|
172
|
+
originalData: 'OK'
|
|
173
|
+
};
|
|
174
|
+
return [
|
|
175
|
+
4,
|
|
176
|
+
runner.transform(data)
|
|
177
|
+
];
|
|
178
|
+
case 1:
|
|
179
|
+
newData = _state.sent();
|
|
180
|
+
expect(newData.originalData).toBe('OK');
|
|
181
|
+
return [
|
|
182
|
+
2
|
|
183
|
+
];
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
})();
|
|
187
|
+
});
|
|
188
188
|
it('should invalidate response info', function() {
|
|
189
189
|
var data = {
|
|
190
190
|
originalData: 'OK'
|
|
@@ -67,7 +67,7 @@ function _instanceof(left, right) {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
function _ts_generator(thisArg, body) {
|
|
70
|
-
var f, y, t,
|
|
70
|
+
var f, y, t, _ = {
|
|
71
71
|
label: 0,
|
|
72
72
|
sent: function() {
|
|
73
73
|
if (t[0] & 1) throw t[1];
|
|
@@ -75,12 +75,8 @@ function _ts_generator(thisArg, body) {
|
|
|
75
75
|
},
|
|
76
76
|
trys: [],
|
|
77
77
|
ops: []
|
|
78
|
-
};
|
|
79
|
-
return g = {
|
|
80
|
-
next: verb(0),
|
|
81
|
-
"throw": verb(1),
|
|
82
|
-
"return": verb(2)
|
|
83
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
78
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
79
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
84
80
|
return this;
|
|
85
81
|
}), g;
|
|
86
82
|
function verb(n) {
|
|
@@ -93,7 +89,7 @@ function _ts_generator(thisArg, body) {
|
|
|
93
89
|
}
|
|
94
90
|
function step(op) {
|
|
95
91
|
if (f) throw new TypeError("Generator is already executing.");
|
|
96
|
-
while(_)try {
|
|
92
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
97
93
|
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;
|
|
98
94
|
if (y = 0, t) op = [
|
|
99
95
|
op[0] & 2,
|
|
@@ -215,7 +211,6 @@ import { CanceledCallError } from '../../fwk/errors';
|
|
|
215
211
|
{
|
|
216
212
|
key: "delay",
|
|
217
213
|
value: function delay(countDown) {
|
|
218
|
-
var _this = this;
|
|
219
214
|
return _async_to_generator(function() {
|
|
220
215
|
var time;
|
|
221
216
|
return _ts_generator(this, function(_state) {
|
|
@@ -223,7 +218,7 @@ import { CanceledCallError } from '../../fwk/errors';
|
|
|
223
218
|
case 0:
|
|
224
219
|
return [
|
|
225
220
|
4,
|
|
226
|
-
|
|
221
|
+
this.sleepBetweenRetry(countDown)
|
|
227
222
|
];
|
|
228
223
|
case 1:
|
|
229
224
|
time = _state.sent();
|
|
@@ -235,40 +230,39 @@ import { CanceledCallError } from '../../fwk/errors';
|
|
|
235
230
|
];
|
|
236
231
|
}
|
|
237
232
|
});
|
|
238
|
-
})();
|
|
233
|
+
}).call(this);
|
|
239
234
|
}
|
|
240
235
|
},
|
|
241
236
|
{
|
|
242
237
|
key: "waitAndRetry",
|
|
243
238
|
value: function waitAndRetry(context, countDown) {
|
|
244
|
-
var _this = this;
|
|
245
239
|
return _async_to_generator(function() {
|
|
246
240
|
return _ts_generator(this, function(_state) {
|
|
247
241
|
switch(_state.label){
|
|
248
242
|
case 0:
|
|
249
243
|
return [
|
|
250
244
|
4,
|
|
251
|
-
|
|
245
|
+
this.delay(countDown)
|
|
252
246
|
];
|
|
253
247
|
case 1:
|
|
254
248
|
_state.sent();
|
|
255
249
|
return [
|
|
256
250
|
2,
|
|
257
|
-
|
|
251
|
+
this.retry(context)
|
|
258
252
|
];
|
|
259
253
|
}
|
|
260
254
|
});
|
|
261
|
-
})();
|
|
255
|
+
}).call(this);
|
|
262
256
|
}
|
|
263
257
|
},
|
|
264
258
|
{
|
|
265
259
|
key: "load",
|
|
266
260
|
value: /** @inheritDoc */ function load(context) {
|
|
267
|
-
var countDown = this.numberOfRetry;
|
|
268
261
|
var _this = this;
|
|
262
|
+
var countDown = this.numberOfRetry;
|
|
269
263
|
return {
|
|
270
|
-
transform:
|
|
271
|
-
|
|
264
|
+
transform: function(fetchCall) {
|
|
265
|
+
return _async_to_generator(function() {
|
|
272
266
|
var result, conditionResult, e, conditionResult1;
|
|
273
267
|
return _ts_generator(this, function(_state) {
|
|
274
268
|
switch(_state.label){
|
|
@@ -291,7 +285,7 @@ import { CanceledCallError } from '../../fwk/errors';
|
|
|
291
285
|
];
|
|
292
286
|
return [
|
|
293
287
|
4,
|
|
294
|
-
|
|
288
|
+
this.condition(context, result.clone())
|
|
295
289
|
];
|
|
296
290
|
case 2:
|
|
297
291
|
conditionResult = _state.sent();
|
|
@@ -299,7 +293,7 @@ import { CanceledCallError } from '../../fwk/errors';
|
|
|
299
293
|
countDown--;
|
|
300
294
|
return [
|
|
301
295
|
2,
|
|
302
|
-
|
|
296
|
+
this.waitAndRetry(context, countDown)
|
|
303
297
|
];
|
|
304
298
|
}
|
|
305
299
|
_state.label = 3;
|
|
@@ -316,7 +310,7 @@ import { CanceledCallError } from '../../fwk/errors';
|
|
|
316
310
|
];
|
|
317
311
|
return [
|
|
318
312
|
4,
|
|
319
|
-
|
|
313
|
+
this.condition(context, undefined, _instanceof(e, Error) ? e : new Error(e.toString()))
|
|
320
314
|
];
|
|
321
315
|
case 5:
|
|
322
316
|
conditionResult1 = _state.sent();
|
|
@@ -324,7 +318,7 @@ import { CanceledCallError } from '../../fwk/errors';
|
|
|
324
318
|
countDown--;
|
|
325
319
|
return [
|
|
326
320
|
2,
|
|
327
|
-
|
|
321
|
+
this.waitAndRetry(context, countDown)
|
|
328
322
|
];
|
|
329
323
|
}
|
|
330
324
|
_state.label = 6;
|
|
@@ -336,11 +330,8 @@ import { CanceledCallError } from '../../fwk/errors';
|
|
|
336
330
|
];
|
|
337
331
|
}
|
|
338
332
|
});
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
return _ref.apply(this, arguments);
|
|
342
|
-
};
|
|
343
|
-
}()
|
|
333
|
+
}).call(_this);
|
|
334
|
+
}
|
|
344
335
|
};
|
|
345
336
|
}
|
|
346
337
|
}
|