@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
|
@@ -32,7 +32,7 @@ function _type_of(obj) {
|
|
|
32
32
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
33
33
|
}
|
|
34
34
|
function _ts_generator(thisArg, body) {
|
|
35
|
-
var f, y, t,
|
|
35
|
+
var f, y, t, _ = {
|
|
36
36
|
label: 0,
|
|
37
37
|
sent: function() {
|
|
38
38
|
if (t[0] & 1) throw t[1];
|
|
@@ -40,12 +40,8 @@ function _ts_generator(thisArg, body) {
|
|
|
40
40
|
},
|
|
41
41
|
trys: [],
|
|
42
42
|
ops: []
|
|
43
|
-
};
|
|
44
|
-
return g = {
|
|
45
|
-
next: verb(0),
|
|
46
|
-
"throw": verb(1),
|
|
47
|
-
"return": verb(2)
|
|
48
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
43
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
44
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
49
45
|
return this;
|
|
50
46
|
}), g;
|
|
51
47
|
function verb(n) {
|
|
@@ -58,7 +54,7 @@ function _ts_generator(thisArg, body) {
|
|
|
58
54
|
}
|
|
59
55
|
function step(op) {
|
|
60
56
|
if (f) throw new TypeError("Generator is already executing.");
|
|
61
|
-
while(_)try {
|
|
57
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
62
58
|
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;
|
|
63
59
|
if (y = 0, t) op = [
|
|
64
60
|
op[0] & 2,
|
|
@@ -130,203 +126,213 @@ var _this = this;
|
|
|
130
126
|
import { EmptyResponseError, ResponseTimeoutError } from '../../fwk/errors';
|
|
131
127
|
import { impervaCaptchaEventHandlerFactory, TimeoutFetch } from './timeout.fetch';
|
|
132
128
|
describe('Timeout Fetch Plugin', function() {
|
|
133
|
-
it('should reject on timeout',
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return
|
|
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
|
-
|
|
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
|
-
promise
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
129
|
+
it('should reject on timeout', function() {
|
|
130
|
+
return _async_to_generator(function() {
|
|
131
|
+
var plugin, runner, call, callback;
|
|
132
|
+
return _ts_generator(this, function(_state) {
|
|
133
|
+
switch(_state.label){
|
|
134
|
+
case 0:
|
|
135
|
+
plugin = new TimeoutFetch(100);
|
|
136
|
+
runner = plugin.load({
|
|
137
|
+
controller: new AbortController()
|
|
138
|
+
});
|
|
139
|
+
call = new Promise(function(resolve) {
|
|
140
|
+
return setTimeout(function() {
|
|
141
|
+
return resolve(undefined);
|
|
142
|
+
}, 1000);
|
|
143
|
+
});
|
|
144
|
+
callback = jest.fn();
|
|
145
|
+
runner.transform(call).catch(callback);
|
|
146
|
+
return [
|
|
147
|
+
4,
|
|
148
|
+
jest.advanceTimersByTimeAsync(99)
|
|
149
|
+
];
|
|
150
|
+
case 1:
|
|
151
|
+
_state.sent();
|
|
152
|
+
expect(callback).not.toHaveBeenCalled();
|
|
153
|
+
return [
|
|
154
|
+
4,
|
|
155
|
+
jest.advanceTimersByTimeAsync(1)
|
|
156
|
+
];
|
|
157
|
+
case 2:
|
|
158
|
+
_state.sent();
|
|
159
|
+
expect(callback).toHaveBeenCalledWith(new ResponseTimeoutError('in 100ms'));
|
|
160
|
+
return [
|
|
161
|
+
2
|
|
162
|
+
];
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
})();
|
|
166
|
+
});
|
|
167
|
+
it('should not reject on fetch rejection', function() {
|
|
168
|
+
return _async_to_generator(function() {
|
|
169
|
+
var plugin, runner, call, callback;
|
|
170
|
+
return _ts_generator(this, function(_state) {
|
|
171
|
+
switch(_state.label){
|
|
172
|
+
case 0:
|
|
173
|
+
plugin = new TimeoutFetch(6000);
|
|
174
|
+
runner = plugin.load({
|
|
175
|
+
controller: new AbortController()
|
|
176
|
+
});
|
|
177
|
+
call = new Promise(function(_resolve, reject) {
|
|
178
|
+
return setTimeout(function() {
|
|
179
|
+
return reject(new EmptyResponseError(''));
|
|
180
|
+
}, 100);
|
|
181
|
+
});
|
|
182
|
+
callback = jest.fn();
|
|
183
|
+
runner.transform(call).catch(callback);
|
|
184
|
+
return [
|
|
185
|
+
4,
|
|
186
|
+
jest.advanceTimersByTimeAsync(6000)
|
|
187
|
+
];
|
|
188
|
+
case 1:
|
|
189
|
+
_state.sent();
|
|
190
|
+
expect(callback).toHaveBeenCalledWith(new EmptyResponseError(''));
|
|
191
|
+
return [
|
|
192
|
+
2
|
|
193
|
+
];
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
})();
|
|
197
|
+
});
|
|
198
|
+
it('should forward the fetch response', function() {
|
|
199
|
+
return _async_to_generator(function() {
|
|
200
|
+
var plugin, runner, call, promise;
|
|
201
|
+
return _ts_generator(this, function(_state) {
|
|
202
|
+
switch(_state.label){
|
|
203
|
+
case 0:
|
|
204
|
+
plugin = new TimeoutFetch(2000);
|
|
205
|
+
runner = plugin.load({
|
|
206
|
+
controller: new AbortController()
|
|
207
|
+
});
|
|
208
|
+
call = new Promise(function(resolve) {
|
|
209
|
+
return setTimeout(function() {
|
|
210
|
+
return resolve({
|
|
211
|
+
test: true
|
|
212
|
+
});
|
|
213
|
+
}, 100);
|
|
214
|
+
});
|
|
215
|
+
promise = runner.transform(call);
|
|
216
|
+
return [
|
|
217
|
+
4,
|
|
218
|
+
jest.runAllTimersAsync()
|
|
219
|
+
];
|
|
220
|
+
case 1:
|
|
221
|
+
_state.sent();
|
|
222
|
+
return [
|
|
223
|
+
4,
|
|
224
|
+
promise
|
|
225
|
+
];
|
|
226
|
+
case 2:
|
|
227
|
+
expect.apply(void 0, [
|
|
228
|
+
_state.sent()
|
|
229
|
+
]).toEqual({
|
|
230
|
+
test: true
|
|
231
|
+
});
|
|
232
|
+
return [
|
|
233
|
+
2
|
|
234
|
+
];
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
})();
|
|
238
|
+
});
|
|
239
|
+
it('should not reject if the timeout has been paused and reject if restarted', function() {
|
|
240
|
+
return _async_to_generator(function() {
|
|
241
|
+
var timeoutPauseEvent, plugin, runner, call, callback;
|
|
242
|
+
return _ts_generator(this, function(_state) {
|
|
243
|
+
switch(_state.label){
|
|
244
|
+
case 0:
|
|
245
|
+
timeoutPauseEvent = {
|
|
246
|
+
emitEvent: function(_status) {},
|
|
247
|
+
handler: function(timeoutPauseCallback) {
|
|
248
|
+
timeoutPauseEvent.emitEvent = timeoutPauseCallback;
|
|
249
|
+
return function() {};
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
plugin = new TimeoutFetch(100, timeoutPauseEvent.handler);
|
|
253
|
+
runner = plugin.load({
|
|
254
|
+
controller: new AbortController()
|
|
255
|
+
});
|
|
256
|
+
call = new Promise(function(resolve) {
|
|
257
|
+
return setTimeout(function() {
|
|
258
|
+
return resolve({
|
|
259
|
+
test: true
|
|
260
|
+
});
|
|
261
|
+
}, 500);
|
|
262
|
+
});
|
|
263
|
+
callback = jest.fn();
|
|
264
|
+
runner.transform(call).catch(callback);
|
|
265
|
+
timeoutPauseEvent.emitEvent('timeoutStopped');
|
|
266
|
+
return [
|
|
267
|
+
4,
|
|
268
|
+
jest.advanceTimersByTimeAsync(200)
|
|
269
|
+
];
|
|
270
|
+
case 1:
|
|
271
|
+
_state.sent();
|
|
272
|
+
timeoutPauseEvent.emitEvent('timeoutStarted');
|
|
273
|
+
return [
|
|
274
|
+
4,
|
|
275
|
+
jest.advanceTimersByTimeAsync(200)
|
|
276
|
+
];
|
|
277
|
+
case 2:
|
|
278
|
+
_state.sent();
|
|
279
|
+
expect(callback).toHaveBeenCalledWith(new ResponseTimeoutError('in 100ms'));
|
|
280
|
+
return [
|
|
281
|
+
2
|
|
282
|
+
];
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
})();
|
|
286
|
+
});
|
|
287
|
+
it('should take into account pause events triggered before the call', function() {
|
|
288
|
+
return _async_to_generator(function() {
|
|
289
|
+
var timeoutPauseEvent, plugin, runner, call, promise;
|
|
290
|
+
return _ts_generator(this, function(_state) {
|
|
291
|
+
switch(_state.label){
|
|
292
|
+
case 0:
|
|
293
|
+
timeoutPauseEvent = {
|
|
294
|
+
emitEvent: function(_status) {},
|
|
295
|
+
handler: function(timeoutPauseCallback) {
|
|
296
|
+
timeoutPauseEvent.emitEvent = timeoutPauseCallback;
|
|
297
|
+
return function() {};
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
plugin = new TimeoutFetch(250, timeoutPauseEvent.handler);
|
|
301
|
+
runner = plugin.load({
|
|
302
|
+
controller: new AbortController()
|
|
303
|
+
});
|
|
304
|
+
call = new Promise(function(resolve) {
|
|
305
|
+
return setTimeout(function() {
|
|
306
|
+
return resolve({
|
|
307
|
+
test: true
|
|
308
|
+
});
|
|
309
|
+
}, 500);
|
|
310
|
+
});
|
|
311
|
+
timeoutPauseEvent.emitEvent('timeoutStopped');
|
|
312
|
+
promise = runner.transform(call);
|
|
313
|
+
return [
|
|
314
|
+
4,
|
|
315
|
+
jest.runAllTimersAsync()
|
|
316
|
+
];
|
|
317
|
+
case 1:
|
|
318
|
+
_state.sent();
|
|
319
|
+
return [
|
|
320
|
+
4,
|
|
321
|
+
promise
|
|
322
|
+
];
|
|
323
|
+
case 2:
|
|
324
|
+
expect.apply(void 0, [
|
|
325
|
+
_state.sent()
|
|
326
|
+
]).toEqual({
|
|
327
|
+
test: true
|
|
328
|
+
});
|
|
329
|
+
return [
|
|
330
|
+
2
|
|
331
|
+
];
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
})();
|
|
335
|
+
});
|
|
330
336
|
});
|
|
331
337
|
describe('impervaCaptchaEventHandlerFactory', function() {
|
|
332
338
|
var postMessageTemp;
|
|
@@ -60,7 +60,7 @@ function _define_property(obj, key, value) {
|
|
|
60
60
|
return obj;
|
|
61
61
|
}
|
|
62
62
|
function _ts_generator(thisArg, body) {
|
|
63
|
-
var f, y, t,
|
|
63
|
+
var f, y, t, _ = {
|
|
64
64
|
label: 0,
|
|
65
65
|
sent: function() {
|
|
66
66
|
if (t[0] & 1) throw t[1];
|
|
@@ -68,12 +68,8 @@ function _ts_generator(thisArg, body) {
|
|
|
68
68
|
},
|
|
69
69
|
trys: [],
|
|
70
70
|
ops: []
|
|
71
|
-
};
|
|
72
|
-
return g = {
|
|
73
|
-
next: verb(0),
|
|
74
|
-
"throw": verb(1),
|
|
75
|
-
"return": verb(2)
|
|
76
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
71
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
72
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
77
73
|
return this;
|
|
78
74
|
}), g;
|
|
79
75
|
function verb(n) {
|
|
@@ -86,7 +82,7 @@ function _ts_generator(thisArg, body) {
|
|
|
86
82
|
}
|
|
87
83
|
function step(op) {
|
|
88
84
|
if (f) throw new TypeError("Generator is already executing.");
|
|
89
|
-
while(_)try {
|
|
85
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
90
86
|
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;
|
|
91
87
|
if (y = 0, t) op = [
|
|
92
88
|
op[0] & 2,
|
|
@@ -169,14 +165,14 @@ function _ts_generator(thisArg, body) {
|
|
|
169
165
|
value: function load() {
|
|
170
166
|
var _this = this;
|
|
171
167
|
return {
|
|
172
|
-
transform:
|
|
173
|
-
|
|
168
|
+
transform: function(data) {
|
|
169
|
+
return _async_to_generator(function() {
|
|
174
170
|
return _ts_generator(this, function(_state) {
|
|
175
171
|
switch(_state.label){
|
|
176
172
|
case 0:
|
|
177
173
|
return [
|
|
178
174
|
4,
|
|
179
|
-
|
|
175
|
+
this.urlRewriter(data.basePath)
|
|
180
176
|
];
|
|
181
177
|
case 1:
|
|
182
178
|
data.basePath = _state.sent();
|
|
@@ -186,11 +182,8 @@ function _ts_generator(thisArg, body) {
|
|
|
186
182
|
];
|
|
187
183
|
}
|
|
188
184
|
});
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
return _ref.apply(this, arguments);
|
|
192
|
-
};
|
|
193
|
-
}()
|
|
185
|
+
}).call(_this);
|
|
186
|
+
}
|
|
194
187
|
};
|
|
195
188
|
}
|
|
196
189
|
}
|
|
@@ -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,
|
|
@@ -140,44 +136,48 @@ describe('URL Rewrite Request Plugin', function() {
|
|
|
140
136
|
basePath: defaultUrl
|
|
141
137
|
};
|
|
142
138
|
});
|
|
143
|
-
it('should call the URL rewriter',
|
|
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
|
-
runner.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
139
|
+
it('should call the URL rewriter', function() {
|
|
140
|
+
return _async_to_generator(function() {
|
|
141
|
+
var plugin, runner;
|
|
142
|
+
return _ts_generator(this, function(_state) {
|
|
143
|
+
switch(_state.label){
|
|
144
|
+
case 0:
|
|
145
|
+
plugin = new UrlRewriteRequest(urlRewriter);
|
|
146
|
+
runner = plugin.load();
|
|
147
|
+
return [
|
|
148
|
+
4,
|
|
149
|
+
runner.transform(options)
|
|
150
|
+
];
|
|
151
|
+
case 1:
|
|
152
|
+
_state.sent();
|
|
153
|
+
expect(urlRewriter).toHaveBeenCalledWith(defaultUrl);
|
|
154
|
+
return [
|
|
155
|
+
2
|
|
156
|
+
];
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
})();
|
|
160
|
+
});
|
|
161
|
+
it('should have updated the url', function() {
|
|
162
|
+
return _async_to_generator(function() {
|
|
163
|
+
var plugin, runner, result;
|
|
164
|
+
return _ts_generator(this, function(_state) {
|
|
165
|
+
switch(_state.label){
|
|
166
|
+
case 0:
|
|
167
|
+
plugin = new UrlRewriteRequest(urlRewriter);
|
|
168
|
+
runner = plugin.load();
|
|
169
|
+
return [
|
|
170
|
+
4,
|
|
171
|
+
runner.transform(options)
|
|
172
|
+
];
|
|
173
|
+
case 1:
|
|
174
|
+
result = _state.sent();
|
|
175
|
+
expect(result.basePath).toBe('http://ok');
|
|
176
|
+
return [
|
|
177
|
+
2
|
|
178
|
+
];
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
})();
|
|
182
|
+
});
|
|
183
183
|
});
|