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