@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,
|
|
@@ -124,77 +120,83 @@ function _ts_generator(thisArg, body) {
|
|
|
124
120
|
}
|
|
125
121
|
import { AbortFetch } from './abort.fetch';
|
|
126
122
|
describe('Abort Plugin', function() {
|
|
127
|
-
it('should trigger the callback',
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
runner.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
123
|
+
it('should trigger the callback', function() {
|
|
124
|
+
return _async_to_generator(function() {
|
|
125
|
+
var fn, plugin, runner;
|
|
126
|
+
return _ts_generator(this, function(_state) {
|
|
127
|
+
switch(_state.label){
|
|
128
|
+
case 0:
|
|
129
|
+
fn = jest.fn();
|
|
130
|
+
plugin = new AbortFetch(fn);
|
|
131
|
+
runner = plugin.load({});
|
|
132
|
+
return [
|
|
133
|
+
4,
|
|
134
|
+
runner.transform(Promise.resolve())
|
|
135
|
+
];
|
|
136
|
+
case 1:
|
|
137
|
+
_state.sent();
|
|
138
|
+
expect(fn).toHaveBeenCalled();
|
|
139
|
+
return [
|
|
140
|
+
2
|
|
141
|
+
];
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
})();
|
|
145
|
+
});
|
|
146
|
+
it('should trigger abort signal if true', function() {
|
|
147
|
+
return _async_to_generator(function() {
|
|
148
|
+
var defaultContext, fn, plugin, runner;
|
|
149
|
+
return _ts_generator(this, function(_state) {
|
|
150
|
+
switch(_state.label){
|
|
151
|
+
case 0:
|
|
152
|
+
defaultContext = {
|
|
153
|
+
controller: {
|
|
154
|
+
abort: jest.fn()
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
fn = jest.fn().mockResolvedValue(true);
|
|
158
|
+
plugin = new AbortFetch(fn);
|
|
159
|
+
runner = plugin.load(defaultContext);
|
|
160
|
+
return [
|
|
161
|
+
4,
|
|
162
|
+
runner.transform(Promise.resolve())
|
|
163
|
+
];
|
|
164
|
+
case 1:
|
|
165
|
+
_state.sent();
|
|
166
|
+
expect(defaultContext.controller.abort).toHaveBeenCalled();
|
|
167
|
+
return [
|
|
168
|
+
2
|
|
169
|
+
];
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
})();
|
|
173
|
+
});
|
|
174
|
+
it('should not trigger abort signal if false', function() {
|
|
175
|
+
return _async_to_generator(function() {
|
|
176
|
+
var defaultContext, fn, plugin, runner;
|
|
177
|
+
return _ts_generator(this, function(_state) {
|
|
178
|
+
switch(_state.label){
|
|
179
|
+
case 0:
|
|
180
|
+
defaultContext = {
|
|
181
|
+
controller: {
|
|
182
|
+
abort: jest.fn()
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
fn = jest.fn().mockResolvedValue(false);
|
|
186
|
+
plugin = new AbortFetch(fn);
|
|
187
|
+
runner = plugin.load(defaultContext);
|
|
188
|
+
return [
|
|
189
|
+
4,
|
|
190
|
+
runner.transform(Promise.resolve())
|
|
191
|
+
];
|
|
192
|
+
case 1:
|
|
193
|
+
_state.sent();
|
|
194
|
+
expect(defaultContext.controller.abort).not.toHaveBeenCalled();
|
|
195
|
+
return [
|
|
196
|
+
2
|
|
197
|
+
];
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
})();
|
|
201
|
+
});
|
|
200
202
|
});
|
|
@@ -125,7 +125,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
125
125
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
126
126
|
}
|
|
127
127
|
function _ts_generator(thisArg, body) {
|
|
128
|
-
var f, y, t,
|
|
128
|
+
var f, y, t, _ = {
|
|
129
129
|
label: 0,
|
|
130
130
|
sent: function() {
|
|
131
131
|
if (t[0] & 1) throw t[1];
|
|
@@ -133,12 +133,8 @@ function _ts_generator(thisArg, body) {
|
|
|
133
133
|
},
|
|
134
134
|
trys: [],
|
|
135
135
|
ops: []
|
|
136
|
-
};
|
|
137
|
-
return g = {
|
|
138
|
-
next: verb(0),
|
|
139
|
-
"throw": verb(1),
|
|
140
|
-
"return": verb(2)
|
|
141
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
136
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
137
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
142
138
|
return this;
|
|
143
139
|
}), g;
|
|
144
140
|
function verb(n) {
|
|
@@ -151,7 +147,7 @@ function _ts_generator(thisArg, body) {
|
|
|
151
147
|
}
|
|
152
148
|
function step(op) {
|
|
153
149
|
if (f) throw new TypeError("Generator is already executing.");
|
|
154
|
-
while(_)try {
|
|
150
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
155
151
|
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;
|
|
156
152
|
if (y = 0, t) op = [
|
|
157
153
|
op[0] & 2,
|
|
@@ -244,19 +240,19 @@ import { isParamValueRecord, serializeRequestPluginQueryParams } from '../../fwk
|
|
|
244
240
|
value: function load(context) {
|
|
245
241
|
var _this = this;
|
|
246
242
|
return {
|
|
247
|
-
transform:
|
|
248
|
-
|
|
243
|
+
transform: function(data) {
|
|
244
|
+
return _async_to_generator(function() {
|
|
249
245
|
var queryParams, _tmp, headers, _tmp1, body, _data_paramSerializationOptions, queryParamsValues, _tmp2;
|
|
250
246
|
return _ts_generator(this, function(_state) {
|
|
251
247
|
switch(_state.label){
|
|
252
248
|
case 0:
|
|
253
|
-
if (!(typeof
|
|
249
|
+
if (!(typeof this.additionalParams.queryParams === 'function')) return [
|
|
254
250
|
3,
|
|
255
251
|
2
|
|
256
252
|
];
|
|
257
253
|
return [
|
|
258
254
|
4,
|
|
259
|
-
|
|
255
|
+
this.additionalParams.queryParams(data.queryParams)
|
|
260
256
|
];
|
|
261
257
|
case 1:
|
|
262
258
|
_tmp = _state.sent();
|
|
@@ -265,17 +261,17 @@ import { isParamValueRecord, serializeRequestPluginQueryParams } from '../../fwk
|
|
|
265
261
|
3
|
|
266
262
|
];
|
|
267
263
|
case 2:
|
|
268
|
-
_tmp =
|
|
264
|
+
_tmp = this.additionalParams.queryParams;
|
|
269
265
|
_state.label = 3;
|
|
270
266
|
case 3:
|
|
271
267
|
queryParams = _tmp;
|
|
272
|
-
if (!(typeof
|
|
268
|
+
if (!(typeof this.additionalParams.headers === 'function')) return [
|
|
273
269
|
3,
|
|
274
270
|
5
|
|
275
271
|
];
|
|
276
272
|
return [
|
|
277
273
|
4,
|
|
278
|
-
|
|
274
|
+
this.additionalParams.headers(data.headers)
|
|
279
275
|
];
|
|
280
276
|
case 4:
|
|
281
277
|
_tmp1 = _state.sent();
|
|
@@ -284,11 +280,11 @@ import { isParamValueRecord, serializeRequestPluginQueryParams } from '../../fwk
|
|
|
284
280
|
6
|
|
285
281
|
];
|
|
286
282
|
case 5:
|
|
287
|
-
_tmp1 =
|
|
283
|
+
_tmp1 = this.additionalParams.headers;
|
|
288
284
|
_state.label = 6;
|
|
289
285
|
case 6:
|
|
290
286
|
headers = _tmp1;
|
|
291
|
-
body =
|
|
287
|
+
body = this.additionalParams.body && isStringOrUndefined(data.body) ? this.additionalParams.body(data.body) : undefined;
|
|
292
288
|
if (queryParams) {
|
|
293
289
|
;
|
|
294
290
|
if ((_data_paramSerializationOptions = data.paramSerializationOptions) === null || _data_paramSerializationOptions === void 0 ? void 0 : _data_paramSerializationOptions.enableParameterSerialization) {
|
|
@@ -349,11 +345,8 @@ import { isParamValueRecord, serializeRequestPluginQueryParams } from '../../fwk
|
|
|
349
345
|
];
|
|
350
346
|
}
|
|
351
347
|
});
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
return _ref.apply(this, arguments);
|
|
355
|
-
};
|
|
356
|
-
}()
|
|
348
|
+
}).call(_this);
|
|
349
|
+
}
|
|
357
350
|
};
|
|
358
351
|
}
|
|
359
352
|
}
|