@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,
|
|
@@ -147,187 +143,199 @@ describe('Api Key Request Plugin', function() {
|
|
|
147
143
|
method: 'get'
|
|
148
144
|
};
|
|
149
145
|
});
|
|
150
|
-
it('Static API key should be added to the default header.',
|
|
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
|
-
runner.
|
|
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
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
146
|
+
it('Static API key should be added to the default header.', function() {
|
|
147
|
+
return _async_to_generator(function() {
|
|
148
|
+
var plugin, runner;
|
|
149
|
+
return _ts_generator(this, function(_state) {
|
|
150
|
+
switch(_state.label){
|
|
151
|
+
case 0:
|
|
152
|
+
plugin = new SimpleApiKeyAuthenticationRequest('key');
|
|
153
|
+
runner = plugin.load();
|
|
154
|
+
return [
|
|
155
|
+
4,
|
|
156
|
+
runner.transform(options)
|
|
157
|
+
];
|
|
158
|
+
case 1:
|
|
159
|
+
_state.sent();
|
|
160
|
+
expect(options.headers.get('x-api-key')).toBe('key');
|
|
161
|
+
return [
|
|
162
|
+
2
|
|
163
|
+
];
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
})();
|
|
167
|
+
});
|
|
168
|
+
it('Static API key should be added to the specified header.', function() {
|
|
169
|
+
return _async_to_generator(function() {
|
|
170
|
+
var plugin, runner;
|
|
171
|
+
return _ts_generator(this, function(_state) {
|
|
172
|
+
switch(_state.label){
|
|
173
|
+
case 0:
|
|
174
|
+
plugin = new SimpleApiKeyAuthenticationRequest('key', {
|
|
175
|
+
apiKeyHeader: 'custom-header'
|
|
176
|
+
});
|
|
177
|
+
runner = plugin.load();
|
|
178
|
+
return [
|
|
179
|
+
4,
|
|
180
|
+
runner.transform(options)
|
|
181
|
+
];
|
|
182
|
+
case 1:
|
|
183
|
+
_state.sent();
|
|
184
|
+
expect(options.headers.get('custom-header')).toBe('key');
|
|
185
|
+
expect(options.headers.get('x-api-key')).toBeNull();
|
|
186
|
+
return [
|
|
187
|
+
2
|
|
188
|
+
];
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
})();
|
|
192
|
+
});
|
|
193
|
+
it('Static OID override should compute the right ama-ctx', function() {
|
|
194
|
+
return _async_to_generator(function() {
|
|
195
|
+
var plugin, runner, amaCtx;
|
|
196
|
+
return _ts_generator(this, function(_state) {
|
|
197
|
+
switch(_state.label){
|
|
198
|
+
case 0:
|
|
199
|
+
plugin = new SimpleApiKeyAuthenticationRequest('key', {
|
|
200
|
+
officeId: 'TESTOID'
|
|
201
|
+
});
|
|
202
|
+
runner = plugin.load();
|
|
203
|
+
return [
|
|
204
|
+
4,
|
|
205
|
+
runner.transform(options)
|
|
206
|
+
];
|
|
207
|
+
case 1:
|
|
208
|
+
_state.sent();
|
|
209
|
+
amaCtx = options.headers.get('ama-ctx');
|
|
210
|
+
expect(amaCtx).toBeDefined();
|
|
211
|
+
expect(getJWTPayload(amaCtx)).toEqual(expect.objectContaining({
|
|
212
|
+
oid: 'TESTOID'
|
|
213
|
+
}));
|
|
214
|
+
return [
|
|
215
|
+
2
|
|
216
|
+
];
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
})();
|
|
220
|
+
});
|
|
221
|
+
it('API key and OID as functions that return strings should result in the right headers', function() {
|
|
222
|
+
return _async_to_generator(function() {
|
|
223
|
+
var plugin, runner, amaCtx;
|
|
224
|
+
return _ts_generator(this, function(_state) {
|
|
225
|
+
switch(_state.label){
|
|
226
|
+
case 0:
|
|
227
|
+
plugin = new SimpleApiKeyAuthenticationRequest(returnInSequence('key', 'secondKey'), {
|
|
228
|
+
officeId: returnInSequence('TESTOID', 'SECONDOID')
|
|
229
|
+
});
|
|
230
|
+
runner = plugin.load();
|
|
231
|
+
return [
|
|
232
|
+
4,
|
|
233
|
+
runner.transform(options)
|
|
234
|
+
];
|
|
235
|
+
case 1:
|
|
236
|
+
_state.sent();
|
|
237
|
+
amaCtx = options.headers.get('ama-ctx');
|
|
238
|
+
expect(options.headers.get('x-api-key')).toBe('key');
|
|
239
|
+
expect(amaCtx).toBeDefined();
|
|
240
|
+
expect(getJWTPayload(amaCtx)).toEqual(expect.objectContaining({
|
|
241
|
+
oid: 'TESTOID'
|
|
242
|
+
}));
|
|
243
|
+
return [
|
|
244
|
+
4,
|
|
245
|
+
runner.transform(options)
|
|
246
|
+
];
|
|
247
|
+
case 2:
|
|
248
|
+
_state.sent();
|
|
249
|
+
amaCtx = options.headers.get('ama-ctx');
|
|
250
|
+
expect(options.headers.get('x-api-key')).toBe('secondKey');
|
|
251
|
+
expect(amaCtx).toBeDefined();
|
|
252
|
+
expect(getJWTPayload(amaCtx)).toEqual(expect.objectContaining({
|
|
253
|
+
oid: 'SECONDOID'
|
|
254
|
+
}));
|
|
255
|
+
return [
|
|
256
|
+
2
|
|
257
|
+
];
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
})();
|
|
261
|
+
});
|
|
262
|
+
it('API key and OID as functions that return promises should result in the right headers', function() {
|
|
263
|
+
return _async_to_generator(function() {
|
|
264
|
+
var plugin, runner, amaCtx;
|
|
265
|
+
return _ts_generator(this, function(_state) {
|
|
266
|
+
switch(_state.label){
|
|
267
|
+
case 0:
|
|
268
|
+
plugin = new SimpleApiKeyAuthenticationRequest(returnInSequence(Promise.resolve('key'), Promise.resolve('secondKey')), {
|
|
269
|
+
officeId: returnInSequence(Promise.resolve('TESTOID'), Promise.resolve('SECONDOID'))
|
|
270
|
+
});
|
|
271
|
+
runner = plugin.load();
|
|
272
|
+
return [
|
|
273
|
+
4,
|
|
274
|
+
runner.transform(options)
|
|
275
|
+
];
|
|
276
|
+
case 1:
|
|
277
|
+
_state.sent();
|
|
278
|
+
amaCtx = options.headers.get('ama-ctx');
|
|
279
|
+
expect(options.headers.get('x-api-key')).toBe('key');
|
|
280
|
+
expect(amaCtx).toBeDefined();
|
|
281
|
+
expect(getJWTPayload(amaCtx)).toEqual(expect.objectContaining({
|
|
282
|
+
oid: 'TESTOID'
|
|
283
|
+
}));
|
|
284
|
+
return [
|
|
285
|
+
4,
|
|
286
|
+
runner.transform(options)
|
|
287
|
+
];
|
|
288
|
+
case 2:
|
|
289
|
+
_state.sent();
|
|
290
|
+
amaCtx = options.headers.get('ama-ctx');
|
|
291
|
+
expect(options.headers.get('x-api-key')).toBe('secondKey');
|
|
292
|
+
expect(amaCtx).toBeDefined();
|
|
293
|
+
expect(getJWTPayload(amaCtx)).toEqual(expect.objectContaining({
|
|
294
|
+
oid: 'SECONDOID'
|
|
295
|
+
}));
|
|
296
|
+
return [
|
|
297
|
+
2
|
|
298
|
+
];
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
})();
|
|
302
|
+
});
|
|
303
|
+
it('Setting API key and OID using the setters should result in the right headers', function() {
|
|
304
|
+
return _async_to_generator(function() {
|
|
305
|
+
var plugin, runner, amaCtx;
|
|
306
|
+
return _ts_generator(this, function(_state) {
|
|
307
|
+
switch(_state.label){
|
|
308
|
+
case 0:
|
|
309
|
+
plugin = new SimpleApiKeyAuthenticationRequest('key');
|
|
310
|
+
runner = plugin.load();
|
|
311
|
+
return [
|
|
312
|
+
4,
|
|
313
|
+
runner.transform(options)
|
|
314
|
+
];
|
|
315
|
+
case 1:
|
|
316
|
+
_state.sent();
|
|
317
|
+
amaCtx = options.headers.get('ama-ctx');
|
|
318
|
+
expect(options.headers.get('x-api-key')).toBe('key');
|
|
319
|
+
expect(amaCtx).toBeNull();
|
|
320
|
+
plugin.setApiKey('secondApiKey');
|
|
321
|
+
plugin.setOfficeId('OID');
|
|
322
|
+
return [
|
|
323
|
+
4,
|
|
324
|
+
runner.transform(options)
|
|
325
|
+
];
|
|
326
|
+
case 2:
|
|
327
|
+
_state.sent();
|
|
328
|
+
amaCtx = options.headers.get('ama-ctx');
|
|
329
|
+
expect(options.headers.get('x-api-key')).toBe('secondApiKey');
|
|
330
|
+
expect(amaCtx).toBeDefined();
|
|
331
|
+
expect(getJWTPayload(amaCtx)).toEqual(expect.objectContaining({
|
|
332
|
+
oid: 'OID'
|
|
333
|
+
}));
|
|
334
|
+
return [
|
|
335
|
+
2
|
|
336
|
+
];
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
})();
|
|
340
|
+
});
|
|
333
341
|
});
|
|
@@ -71,7 +71,7 @@ function _type_of(obj) {
|
|
|
71
71
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
72
72
|
}
|
|
73
73
|
function _ts_generator(thisArg, body) {
|
|
74
|
-
var f, y, t,
|
|
74
|
+
var f, y, t, _ = {
|
|
75
75
|
label: 0,
|
|
76
76
|
sent: function() {
|
|
77
77
|
if (t[0] & 1) throw t[1];
|
|
@@ -79,12 +79,8 @@ function _ts_generator(thisArg, body) {
|
|
|
79
79
|
},
|
|
80
80
|
trys: [],
|
|
81
81
|
ops: []
|
|
82
|
-
};
|
|
83
|
-
return g = {
|
|
84
|
-
next: verb(0),
|
|
85
|
-
"throw": verb(1),
|
|
86
|
-
"return": verb(2)
|
|
87
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
82
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
83
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
88
84
|
return this;
|
|
89
85
|
}), g;
|
|
90
86
|
function verb(n) {
|
|
@@ -97,7 +93,7 @@ function _ts_generator(thisArg, body) {
|
|
|
97
93
|
}
|
|
98
94
|
function step(op) {
|
|
99
95
|
if (f) throw new TypeError("Generator is already executing.");
|
|
100
|
-
while(_)try {
|
|
96
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
101
97
|
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;
|
|
102
98
|
if (y = 0, t) op = [
|
|
103
99
|
op[0] & 2,
|
|
@@ -236,19 +232,20 @@ import { ResponseTimeoutError } from '../../fwk/errors';
|
|
|
236
232
|
return {
|
|
237
233
|
transform: function(fetchCall) {
|
|
238
234
|
return(// eslint-disable-next-line no-async-promise-executor -- all await are handled with a try-catch block
|
|
239
|
-
new Promise(
|
|
240
|
-
|
|
241
|
-
var timeoutCallback, timer, timerCallback, _context_controller, response, ex;
|
|
235
|
+
new Promise(function(resolve, reject) {
|
|
236
|
+
return _async_to_generator(function() {
|
|
237
|
+
var _this, timeoutCallback, timer, timerCallback, _context_controller, response, ex;
|
|
242
238
|
return _ts_generator(this, function(_state) {
|
|
243
239
|
switch(_state.label){
|
|
244
240
|
case 0:
|
|
241
|
+
_this = this;
|
|
245
242
|
timeoutCallback = function() {
|
|
246
243
|
var // Fetch abort controller is now supported by all modern browser and node 15+. It should always be defined
|
|
247
244
|
_context_controller;
|
|
248
245
|
reject(new ResponseTimeoutError("in ".concat(_this.timeout, "ms")));
|
|
249
246
|
(_context_controller = context.controller) === null || _context_controller === void 0 ? void 0 : _context_controller.abort();
|
|
250
247
|
};
|
|
251
|
-
timer =
|
|
248
|
+
timer = this.timerPauseState === 'timeoutStopped' ? undefined : setTimeout(timeoutCallback, this.timeout);
|
|
252
249
|
timerCallback = function(pauseStatus) {
|
|
253
250
|
if (timer && pauseStatus === 'timeoutStopped') {
|
|
254
251
|
clearTimeout(timer);
|
|
@@ -259,7 +256,7 @@ import { ResponseTimeoutError } from '../../fwk/errors';
|
|
|
259
256
|
(context.logger || console).log('[SDK Plugins] Timeout restarted.');
|
|
260
257
|
}
|
|
261
258
|
};
|
|
262
|
-
|
|
259
|
+
this.timerSubscription.push(timerCallback);
|
|
263
260
|
_state.label = 1;
|
|
264
261
|
case 1:
|
|
265
262
|
_state.trys.push([
|
|
@@ -292,7 +289,7 @@ import { ResponseTimeoutError } from '../../fwk/errors';
|
|
|
292
289
|
if (timer) {
|
|
293
290
|
clearTimeout(timer);
|
|
294
291
|
}
|
|
295
|
-
|
|
292
|
+
this.timerSubscription = this.timerSubscription.filter(function(callback) {
|
|
296
293
|
return timerCallback !== callback;
|
|
297
294
|
});
|
|
298
295
|
return [
|
|
@@ -304,11 +301,8 @@ import { ResponseTimeoutError } from '../../fwk/errors';
|
|
|
304
301
|
];
|
|
305
302
|
}
|
|
306
303
|
});
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
return _ref.apply(this, arguments);
|
|
310
|
-
};
|
|
311
|
-
}()));
|
|
304
|
+
}).call(_this);
|
|
305
|
+
}));
|
|
312
306
|
}
|
|
313
307
|
};
|
|
314
308
|
}
|