@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
|
@@ -34,7 +34,7 @@ function _async_to_generator(fn) {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
function _ts_generator(thisArg, body) {
|
|
37
|
-
var f, y, t,
|
|
37
|
+
var f, y, t, _ = {
|
|
38
38
|
label: 0,
|
|
39
39
|
sent: function() {
|
|
40
40
|
if (t[0] & 1) throw t[1];
|
|
@@ -42,12 +42,8 @@ function _ts_generator(thisArg, body) {
|
|
|
42
42
|
},
|
|
43
43
|
trys: [],
|
|
44
44
|
ops: []
|
|
45
|
-
};
|
|
46
|
-
return g = {
|
|
47
|
-
next: verb(0),
|
|
48
|
-
"throw": verb(1),
|
|
49
|
-
"return": verb(2)
|
|
50
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
45
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
46
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
51
47
|
return this;
|
|
52
48
|
}), g;
|
|
53
49
|
function verb(n) {
|
|
@@ -60,7 +56,7 @@ function _ts_generator(thisArg, body) {
|
|
|
60
56
|
}
|
|
61
57
|
function step(op) {
|
|
62
58
|
if (f) throw new TypeError("Generator is already executing.");
|
|
63
|
-
while(_)try {
|
|
59
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
64
60
|
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;
|
|
65
61
|
if (y = 0, t) op = [
|
|
66
62
|
op[0] & 2,
|
|
@@ -151,187 +147,199 @@ describe('Api Key Request Plugin', function() {
|
|
|
151
147
|
method: 'get'
|
|
152
148
|
};
|
|
153
149
|
});
|
|
154
|
-
it('Static API key should be added to the default header.',
|
|
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
|
-
runner.
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
150
|
+
it('Static API key should be added to the default header.', function() {
|
|
151
|
+
return _async_to_generator(function() {
|
|
152
|
+
var plugin, runner;
|
|
153
|
+
return _ts_generator(this, function(_state) {
|
|
154
|
+
switch(_state.label){
|
|
155
|
+
case 0:
|
|
156
|
+
plugin = new _simpleapikeyauthenticationrequest.SimpleApiKeyAuthenticationRequest('key');
|
|
157
|
+
runner = plugin.load();
|
|
158
|
+
return [
|
|
159
|
+
4,
|
|
160
|
+
runner.transform(options)
|
|
161
|
+
];
|
|
162
|
+
case 1:
|
|
163
|
+
_state.sent();
|
|
164
|
+
expect(options.headers.get('x-api-key')).toBe('key');
|
|
165
|
+
return [
|
|
166
|
+
2
|
|
167
|
+
];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
})();
|
|
171
|
+
});
|
|
172
|
+
it('Static API key should be added to the specified header.', function() {
|
|
173
|
+
return _async_to_generator(function() {
|
|
174
|
+
var plugin, runner;
|
|
175
|
+
return _ts_generator(this, function(_state) {
|
|
176
|
+
switch(_state.label){
|
|
177
|
+
case 0:
|
|
178
|
+
plugin = new _simpleapikeyauthenticationrequest.SimpleApiKeyAuthenticationRequest('key', {
|
|
179
|
+
apiKeyHeader: 'custom-header'
|
|
180
|
+
});
|
|
181
|
+
runner = plugin.load();
|
|
182
|
+
return [
|
|
183
|
+
4,
|
|
184
|
+
runner.transform(options)
|
|
185
|
+
];
|
|
186
|
+
case 1:
|
|
187
|
+
_state.sent();
|
|
188
|
+
expect(options.headers.get('custom-header')).toBe('key');
|
|
189
|
+
expect(options.headers.get('x-api-key')).toBeNull();
|
|
190
|
+
return [
|
|
191
|
+
2
|
|
192
|
+
];
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
})();
|
|
196
|
+
});
|
|
197
|
+
it('Static OID override should compute the right ama-ctx', function() {
|
|
198
|
+
return _async_to_generator(function() {
|
|
199
|
+
var plugin, runner, amaCtx;
|
|
200
|
+
return _ts_generator(this, function(_state) {
|
|
201
|
+
switch(_state.label){
|
|
202
|
+
case 0:
|
|
203
|
+
plugin = new _simpleapikeyauthenticationrequest.SimpleApiKeyAuthenticationRequest('key', {
|
|
204
|
+
officeId: 'TESTOID'
|
|
205
|
+
});
|
|
206
|
+
runner = plugin.load();
|
|
207
|
+
return [
|
|
208
|
+
4,
|
|
209
|
+
runner.transform(options)
|
|
210
|
+
];
|
|
211
|
+
case 1:
|
|
212
|
+
_state.sent();
|
|
213
|
+
amaCtx = options.headers.get('ama-ctx');
|
|
214
|
+
expect(amaCtx).toBeDefined();
|
|
215
|
+
expect(getJWTPayload(amaCtx)).toEqual(expect.objectContaining({
|
|
216
|
+
oid: 'TESTOID'
|
|
217
|
+
}));
|
|
218
|
+
return [
|
|
219
|
+
2
|
|
220
|
+
];
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
})();
|
|
224
|
+
});
|
|
225
|
+
it('API key and OID as functions that return strings should result in the right headers', function() {
|
|
226
|
+
return _async_to_generator(function() {
|
|
227
|
+
var plugin, runner, amaCtx;
|
|
228
|
+
return _ts_generator(this, function(_state) {
|
|
229
|
+
switch(_state.label){
|
|
230
|
+
case 0:
|
|
231
|
+
plugin = new _simpleapikeyauthenticationrequest.SimpleApiKeyAuthenticationRequest(returnInSequence('key', 'secondKey'), {
|
|
232
|
+
officeId: returnInSequence('TESTOID', 'SECONDOID')
|
|
233
|
+
});
|
|
234
|
+
runner = plugin.load();
|
|
235
|
+
return [
|
|
236
|
+
4,
|
|
237
|
+
runner.transform(options)
|
|
238
|
+
];
|
|
239
|
+
case 1:
|
|
240
|
+
_state.sent();
|
|
241
|
+
amaCtx = options.headers.get('ama-ctx');
|
|
242
|
+
expect(options.headers.get('x-api-key')).toBe('key');
|
|
243
|
+
expect(amaCtx).toBeDefined();
|
|
244
|
+
expect(getJWTPayload(amaCtx)).toEqual(expect.objectContaining({
|
|
245
|
+
oid: 'TESTOID'
|
|
246
|
+
}));
|
|
247
|
+
return [
|
|
248
|
+
4,
|
|
249
|
+
runner.transform(options)
|
|
250
|
+
];
|
|
251
|
+
case 2:
|
|
252
|
+
_state.sent();
|
|
253
|
+
amaCtx = options.headers.get('ama-ctx');
|
|
254
|
+
expect(options.headers.get('x-api-key')).toBe('secondKey');
|
|
255
|
+
expect(amaCtx).toBeDefined();
|
|
256
|
+
expect(getJWTPayload(amaCtx)).toEqual(expect.objectContaining({
|
|
257
|
+
oid: 'SECONDOID'
|
|
258
|
+
}));
|
|
259
|
+
return [
|
|
260
|
+
2
|
|
261
|
+
];
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
})();
|
|
265
|
+
});
|
|
266
|
+
it('API key and OID as functions that return promises should result in the right headers', function() {
|
|
267
|
+
return _async_to_generator(function() {
|
|
268
|
+
var plugin, runner, amaCtx;
|
|
269
|
+
return _ts_generator(this, function(_state) {
|
|
270
|
+
switch(_state.label){
|
|
271
|
+
case 0:
|
|
272
|
+
plugin = new _simpleapikeyauthenticationrequest.SimpleApiKeyAuthenticationRequest(returnInSequence(Promise.resolve('key'), Promise.resolve('secondKey')), {
|
|
273
|
+
officeId: returnInSequence(Promise.resolve('TESTOID'), Promise.resolve('SECONDOID'))
|
|
274
|
+
});
|
|
275
|
+
runner = plugin.load();
|
|
276
|
+
return [
|
|
277
|
+
4,
|
|
278
|
+
runner.transform(options)
|
|
279
|
+
];
|
|
280
|
+
case 1:
|
|
281
|
+
_state.sent();
|
|
282
|
+
amaCtx = options.headers.get('ama-ctx');
|
|
283
|
+
expect(options.headers.get('x-api-key')).toBe('key');
|
|
284
|
+
expect(amaCtx).toBeDefined();
|
|
285
|
+
expect(getJWTPayload(amaCtx)).toEqual(expect.objectContaining({
|
|
286
|
+
oid: 'TESTOID'
|
|
287
|
+
}));
|
|
288
|
+
return [
|
|
289
|
+
4,
|
|
290
|
+
runner.transform(options)
|
|
291
|
+
];
|
|
292
|
+
case 2:
|
|
293
|
+
_state.sent();
|
|
294
|
+
amaCtx = options.headers.get('ama-ctx');
|
|
295
|
+
expect(options.headers.get('x-api-key')).toBe('secondKey');
|
|
296
|
+
expect(amaCtx).toBeDefined();
|
|
297
|
+
expect(getJWTPayload(amaCtx)).toEqual(expect.objectContaining({
|
|
298
|
+
oid: 'SECONDOID'
|
|
299
|
+
}));
|
|
300
|
+
return [
|
|
301
|
+
2
|
|
302
|
+
];
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
})();
|
|
306
|
+
});
|
|
307
|
+
it('Setting API key and OID using the setters should result in the right headers', function() {
|
|
308
|
+
return _async_to_generator(function() {
|
|
309
|
+
var plugin, runner, amaCtx;
|
|
310
|
+
return _ts_generator(this, function(_state) {
|
|
311
|
+
switch(_state.label){
|
|
312
|
+
case 0:
|
|
313
|
+
plugin = new _simpleapikeyauthenticationrequest.SimpleApiKeyAuthenticationRequest('key');
|
|
314
|
+
runner = plugin.load();
|
|
315
|
+
return [
|
|
316
|
+
4,
|
|
317
|
+
runner.transform(options)
|
|
318
|
+
];
|
|
319
|
+
case 1:
|
|
320
|
+
_state.sent();
|
|
321
|
+
amaCtx = options.headers.get('ama-ctx');
|
|
322
|
+
expect(options.headers.get('x-api-key')).toBe('key');
|
|
323
|
+
expect(amaCtx).toBeNull();
|
|
324
|
+
plugin.setApiKey('secondApiKey');
|
|
325
|
+
plugin.setOfficeId('OID');
|
|
326
|
+
return [
|
|
327
|
+
4,
|
|
328
|
+
runner.transform(options)
|
|
329
|
+
];
|
|
330
|
+
case 2:
|
|
331
|
+
_state.sent();
|
|
332
|
+
amaCtx = options.headers.get('ama-ctx');
|
|
333
|
+
expect(options.headers.get('x-api-key')).toBe('secondApiKey');
|
|
334
|
+
expect(amaCtx).toBeDefined();
|
|
335
|
+
expect(getJWTPayload(amaCtx)).toEqual(expect.objectContaining({
|
|
336
|
+
oid: 'OID'
|
|
337
|
+
}));
|
|
338
|
+
return [
|
|
339
|
+
2
|
|
340
|
+
];
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
})();
|
|
344
|
+
});
|
|
337
345
|
});
|
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
TimeoutFetch
|
|
12
|
+
get TimeoutFetch () {
|
|
13
13
|
return TimeoutFetch;
|
|
14
14
|
},
|
|
15
|
-
impervaCaptchaEventHandlerFactory
|
|
15
|
+
get impervaCaptchaEventHandlerFactory () {
|
|
16
16
|
return impervaCaptchaEventHandlerFactory;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -90,7 +90,7 @@ function _type_of(obj) {
|
|
|
90
90
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
91
91
|
}
|
|
92
92
|
function _ts_generator(thisArg, body) {
|
|
93
|
-
var f, y, t,
|
|
93
|
+
var f, y, t, _ = {
|
|
94
94
|
label: 0,
|
|
95
95
|
sent: function() {
|
|
96
96
|
if (t[0] & 1) throw t[1];
|
|
@@ -98,12 +98,8 @@ function _ts_generator(thisArg, body) {
|
|
|
98
98
|
},
|
|
99
99
|
trys: [],
|
|
100
100
|
ops: []
|
|
101
|
-
};
|
|
102
|
-
return g = {
|
|
103
|
-
next: verb(0),
|
|
104
|
-
"throw": verb(1),
|
|
105
|
-
"return": verb(2)
|
|
106
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
101
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
102
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
107
103
|
return this;
|
|
108
104
|
}), g;
|
|
109
105
|
function verb(n) {
|
|
@@ -116,7 +112,7 @@ function _ts_generator(thisArg, body) {
|
|
|
116
112
|
}
|
|
117
113
|
function step(op) {
|
|
118
114
|
if (f) throw new TypeError("Generator is already executing.");
|
|
119
|
-
while(_)try {
|
|
115
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
120
116
|
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;
|
|
121
117
|
if (y = 0, t) op = [
|
|
122
118
|
op[0] & 2,
|
|
@@ -247,19 +243,20 @@ var TimeoutFetch = /*#__PURE__*/ function() {
|
|
|
247
243
|
return {
|
|
248
244
|
transform: function(fetchCall) {
|
|
249
245
|
return(// eslint-disable-next-line no-async-promise-executor -- all await are handled with a try-catch block
|
|
250
|
-
new Promise(
|
|
251
|
-
|
|
252
|
-
var timeoutCallback, timer, timerCallback, _context_controller, response, ex;
|
|
246
|
+
new Promise(function(resolve, reject) {
|
|
247
|
+
return _async_to_generator(function() {
|
|
248
|
+
var _this, timeoutCallback, timer, timerCallback, _context_controller, response, ex;
|
|
253
249
|
return _ts_generator(this, function(_state) {
|
|
254
250
|
switch(_state.label){
|
|
255
251
|
case 0:
|
|
252
|
+
_this = this;
|
|
256
253
|
timeoutCallback = function() {
|
|
257
254
|
var // Fetch abort controller is now supported by all modern browser and node 15+. It should always be defined
|
|
258
255
|
_context_controller;
|
|
259
256
|
reject(new _errors.ResponseTimeoutError("in ".concat(_this.timeout, "ms")));
|
|
260
257
|
(_context_controller = context.controller) === null || _context_controller === void 0 ? void 0 : _context_controller.abort();
|
|
261
258
|
};
|
|
262
|
-
timer =
|
|
259
|
+
timer = this.timerPauseState === 'timeoutStopped' ? undefined : setTimeout(timeoutCallback, this.timeout);
|
|
263
260
|
timerCallback = function(pauseStatus) {
|
|
264
261
|
if (timer && pauseStatus === 'timeoutStopped') {
|
|
265
262
|
clearTimeout(timer);
|
|
@@ -270,7 +267,7 @@ var TimeoutFetch = /*#__PURE__*/ function() {
|
|
|
270
267
|
(context.logger || console).log('[SDK Plugins] Timeout restarted.');
|
|
271
268
|
}
|
|
272
269
|
};
|
|
273
|
-
|
|
270
|
+
this.timerSubscription.push(timerCallback);
|
|
274
271
|
_state.label = 1;
|
|
275
272
|
case 1:
|
|
276
273
|
_state.trys.push([
|
|
@@ -303,7 +300,7 @@ var TimeoutFetch = /*#__PURE__*/ function() {
|
|
|
303
300
|
if (timer) {
|
|
304
301
|
clearTimeout(timer);
|
|
305
302
|
}
|
|
306
|
-
|
|
303
|
+
this.timerSubscription = this.timerSubscription.filter(function(callback) {
|
|
307
304
|
return timerCallback !== callback;
|
|
308
305
|
});
|
|
309
306
|
return [
|
|
@@ -315,11 +312,8 @@ var TimeoutFetch = /*#__PURE__*/ function() {
|
|
|
315
312
|
];
|
|
316
313
|
}
|
|
317
314
|
});
|
|
318
|
-
});
|
|
319
|
-
|
|
320
|
-
return _ref.apply(this, arguments);
|
|
321
|
-
};
|
|
322
|
-
}()));
|
|
315
|
+
}).call(_this);
|
|
316
|
+
}));
|
|
323
317
|
}
|
|
324
318
|
};
|
|
325
319
|
}
|