@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
|
@@ -46,7 +46,7 @@ function _define_property(obj, key, value) {
|
|
|
46
46
|
return obj;
|
|
47
47
|
}
|
|
48
48
|
function _ts_generator(thisArg, body) {
|
|
49
|
-
var f, y, t,
|
|
49
|
+
var f, y, t, _ = {
|
|
50
50
|
label: 0,
|
|
51
51
|
sent: function() {
|
|
52
52
|
if (t[0] & 1) throw t[1];
|
|
@@ -54,12 +54,8 @@ function _ts_generator(thisArg, body) {
|
|
|
54
54
|
},
|
|
55
55
|
trys: [],
|
|
56
56
|
ops: []
|
|
57
|
-
};
|
|
58
|
-
return g = {
|
|
59
|
-
next: verb(0),
|
|
60
|
-
"throw": verb(1),
|
|
61
|
-
"return": verb(2)
|
|
62
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
57
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
58
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
63
59
|
return this;
|
|
64
60
|
}), g;
|
|
65
61
|
function verb(n) {
|
|
@@ -72,7 +68,7 @@ function _ts_generator(thisArg, body) {
|
|
|
72
68
|
}
|
|
73
69
|
function step(op) {
|
|
74
70
|
if (f) throw new TypeError("Generator is already executing.");
|
|
75
|
-
while(_)try {
|
|
71
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
76
72
|
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;
|
|
77
73
|
if (y = 0, t) op = [
|
|
78
74
|
op[0] & 2,
|
|
@@ -165,77 +161,83 @@ describe('ApiConfigurationOverride Plugin', function() {
|
|
|
165
161
|
basePath: 'http://test.com/api'
|
|
166
162
|
};
|
|
167
163
|
});
|
|
168
|
-
it('should add a specified string JWS',
|
|
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
|
-
runner.
|
|
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
|
-
|
|
164
|
+
it('should add a specified string JWS', function() {
|
|
165
|
+
return _async_to_generator(function() {
|
|
166
|
+
var plugin, runner, result;
|
|
167
|
+
return _ts_generator(this, function(_state) {
|
|
168
|
+
switch(_state.label){
|
|
169
|
+
case 0:
|
|
170
|
+
plugin = new ApiConfigurationOverride('fakeJWS');
|
|
171
|
+
runner = plugin.load();
|
|
172
|
+
return [
|
|
173
|
+
4,
|
|
174
|
+
runner.transform(options)
|
|
175
|
+
];
|
|
176
|
+
case 1:
|
|
177
|
+
result = _state.sent();
|
|
178
|
+
expect(result.headers.get('ama-client-facts')).toBe('fakeJWS');
|
|
179
|
+
return [
|
|
180
|
+
2
|
|
181
|
+
];
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
})();
|
|
185
|
+
});
|
|
186
|
+
it('should add a specified string JWS with a custom header name', function() {
|
|
187
|
+
return _async_to_generator(function() {
|
|
188
|
+
var plugin, runner, result;
|
|
189
|
+
return _ts_generator(this, function(_state) {
|
|
190
|
+
switch(_state.label){
|
|
191
|
+
case 0:
|
|
192
|
+
plugin = new ApiConfigurationOverride('fakeJWS', 'my-header');
|
|
193
|
+
runner = plugin.load();
|
|
194
|
+
return [
|
|
195
|
+
4,
|
|
196
|
+
runner.transform(options)
|
|
197
|
+
];
|
|
198
|
+
case 1:
|
|
199
|
+
result = _state.sent();
|
|
200
|
+
expect(result.headers.get('my-header')).toBe('fakeJWS');
|
|
201
|
+
return [
|
|
202
|
+
2
|
|
203
|
+
];
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
})();
|
|
207
|
+
});
|
|
208
|
+
it('should add a specified dynamic JWS', function() {
|
|
209
|
+
return _async_to_generator(function() {
|
|
210
|
+
var counter, dynamicJws, plugin, runner, result;
|
|
211
|
+
return _ts_generator(this, function(_state) {
|
|
212
|
+
switch(_state.label){
|
|
213
|
+
case 0:
|
|
214
|
+
counter = 0;
|
|
215
|
+
dynamicJws = function() {
|
|
216
|
+
return Promise.resolve('dynamicJWS' + counter.toString());
|
|
217
|
+
};
|
|
218
|
+
plugin = new ApiConfigurationOverride(dynamicJws);
|
|
219
|
+
runner = plugin.load();
|
|
220
|
+
return [
|
|
221
|
+
4,
|
|
222
|
+
runner.transform(options)
|
|
223
|
+
];
|
|
224
|
+
case 1:
|
|
225
|
+
result = _state.sent();
|
|
226
|
+
expect(result.headers.get('ama-client-facts')).toBe('dynamicJWS0');
|
|
227
|
+
counter++;
|
|
228
|
+
runner = plugin.load();
|
|
229
|
+
return [
|
|
230
|
+
4,
|
|
231
|
+
runner.transform(options)
|
|
232
|
+
];
|
|
233
|
+
case 2:
|
|
234
|
+
result = _state.sent();
|
|
235
|
+
expect(result.headers.get('ama-client-facts')).toContain('dynamicJWS1');
|
|
236
|
+
return [
|
|
237
|
+
2
|
|
238
|
+
];
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
})();
|
|
242
|
+
});
|
|
241
243
|
});
|
|
@@ -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,
|
|
@@ -172,17 +168,17 @@ function _ts_generator(thisArg, body) {
|
|
|
172
168
|
value: function load() {
|
|
173
169
|
var _this = this;
|
|
174
170
|
return {
|
|
175
|
-
transform:
|
|
176
|
-
|
|
171
|
+
transform: function(data) {
|
|
172
|
+
return _async_to_generator(function() {
|
|
177
173
|
var apiKey, _tmp;
|
|
178
174
|
return _ts_generator(this, function(_state) {
|
|
179
175
|
switch(_state.label){
|
|
180
176
|
case 0:
|
|
181
|
-
if (!(typeof
|
|
177
|
+
if (!(typeof this.apiKey === 'string')) return [
|
|
182
178
|
3,
|
|
183
179
|
1
|
|
184
180
|
];
|
|
185
|
-
_tmp =
|
|
181
|
+
_tmp = this.apiKey;
|
|
186
182
|
return [
|
|
187
183
|
3,
|
|
188
184
|
3
|
|
@@ -190,25 +186,22 @@ function _ts_generator(thisArg, body) {
|
|
|
190
186
|
case 1:
|
|
191
187
|
return [
|
|
192
188
|
4,
|
|
193
|
-
|
|
189
|
+
this.apiKey()
|
|
194
190
|
];
|
|
195
191
|
case 2:
|
|
196
192
|
_tmp = _state.sent();
|
|
197
193
|
_state.label = 3;
|
|
198
194
|
case 3:
|
|
199
195
|
apiKey = _tmp;
|
|
200
|
-
data.headers.append(
|
|
196
|
+
data.headers.append(this.apiKeyHeader, apiKey);
|
|
201
197
|
return [
|
|
202
198
|
2,
|
|
203
199
|
data
|
|
204
200
|
];
|
|
205
201
|
}
|
|
206
202
|
});
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
return _ref.apply(this, arguments);
|
|
210
|
-
};
|
|
211
|
-
}()
|
|
203
|
+
}).call(_this);
|
|
204
|
+
}
|
|
212
205
|
};
|
|
213
206
|
}
|
|
214
207
|
}
|
|
@@ -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,
|
|
@@ -134,46 +130,50 @@ describe('Api Key Request Plugin', function() {
|
|
|
134
130
|
method: 'get'
|
|
135
131
|
};
|
|
136
132
|
});
|
|
137
|
-
it('should add the API Key to the headers',
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
runner.
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
133
|
+
it('should add the API Key to the headers', function() {
|
|
134
|
+
return _async_to_generator(function() {
|
|
135
|
+
var plugin, runner;
|
|
136
|
+
return _ts_generator(this, function(_state) {
|
|
137
|
+
switch(_state.label){
|
|
138
|
+
case 0:
|
|
139
|
+
plugin = new ApiKeyRequest('test', 'testKey');
|
|
140
|
+
runner = plugin.load();
|
|
141
|
+
return [
|
|
142
|
+
4,
|
|
143
|
+
runner.transform(options)
|
|
144
|
+
];
|
|
145
|
+
case 1:
|
|
146
|
+
_state.sent();
|
|
147
|
+
expect(options.headers.append).toHaveBeenCalledWith('testKey', 'test');
|
|
148
|
+
return [
|
|
149
|
+
2
|
|
150
|
+
];
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
})();
|
|
154
|
+
});
|
|
155
|
+
it('should execute the function to add the API Key to the headers', function() {
|
|
156
|
+
return _async_to_generator(function() {
|
|
157
|
+
var plugin, runner;
|
|
158
|
+
return _ts_generator(this, function(_state) {
|
|
159
|
+
switch(_state.label){
|
|
160
|
+
case 0:
|
|
161
|
+
plugin = new ApiKeyRequest(function() {
|
|
162
|
+
return Promise.resolve('test');
|
|
163
|
+
}, 'testKey');
|
|
164
|
+
runner = plugin.load();
|
|
165
|
+
return [
|
|
166
|
+
4,
|
|
167
|
+
runner.transform(options)
|
|
168
|
+
];
|
|
169
|
+
case 1:
|
|
170
|
+
_state.sent();
|
|
171
|
+
expect(options.headers.append).toHaveBeenCalledWith('testKey', 'test');
|
|
172
|
+
return [
|
|
173
|
+
2
|
|
174
|
+
];
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
})();
|
|
178
|
+
});
|
|
179
179
|
});
|
|
@@ -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,
|
|
@@ -177,8 +173,8 @@ function _ts_generator(thisArg, body) {
|
|
|
177
173
|
};
|
|
178
174
|
});
|
|
179
175
|
};
|
|
180
|
-
return
|
|
181
|
-
|
|
176
|
+
return function(logger) {
|
|
177
|
+
return _async_to_generator(function() {
|
|
182
178
|
var e, e1;
|
|
183
179
|
return _ts_generator(this, function(_state) {
|
|
184
180
|
switch(_state.label){
|
|
@@ -239,11 +235,8 @@ function _ts_generator(thisArg, body) {
|
|
|
239
235
|
];
|
|
240
236
|
}
|
|
241
237
|
});
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
return _ref.apply(this, arguments);
|
|
245
|
-
};
|
|
246
|
-
}();
|
|
238
|
+
})();
|
|
239
|
+
};
|
|
247
240
|
}
|
|
248
241
|
/**
|
|
249
242
|
* Implementation of a retriever for Akamai based on bmak object from window or as parameter.
|
|
@@ -342,17 +335,16 @@ function _ts_generator(thisArg, body) {
|
|
|
342
335
|
* If pollOnlyOnce is set to true, the poller won't be executed again after it has been fully executed once.
|
|
343
336
|
* @param logger
|
|
344
337
|
*/ function waitForFingerprint(logger) {
|
|
345
|
-
var _this = this;
|
|
346
338
|
return _async_to_generator(function() {
|
|
347
339
|
var pollerOptions, i, fingerprint;
|
|
348
340
|
return _ts_generator(this, function(_state) {
|
|
349
341
|
switch(_state.label){
|
|
350
342
|
case 0:
|
|
351
|
-
pollerOptions =
|
|
352
|
-
if (pollerOptions === undefined ||
|
|
343
|
+
pollerOptions = this.options.pollerOptions;
|
|
344
|
+
if (pollerOptions === undefined || this.options.pollOnlyOnce !== false && this.hasPolled) {
|
|
353
345
|
return [
|
|
354
346
|
2,
|
|
355
|
-
|
|
347
|
+
this.options.fingerprintRetriever(logger)
|
|
356
348
|
];
|
|
357
349
|
}
|
|
358
350
|
i = pollerOptions.maximumTries - 1;
|
|
@@ -364,12 +356,12 @@ function _ts_generator(thisArg, body) {
|
|
|
364
356
|
];
|
|
365
357
|
return [
|
|
366
358
|
4,
|
|
367
|
-
|
|
359
|
+
this.options.fingerprintRetriever(logger)
|
|
368
360
|
];
|
|
369
361
|
case 2:
|
|
370
362
|
fingerprint = _state.sent();
|
|
371
363
|
if (fingerprint) {
|
|
372
|
-
|
|
364
|
+
this.hasPolled = true;
|
|
373
365
|
return [
|
|
374
366
|
2,
|
|
375
367
|
fingerprint
|
|
@@ -395,13 +387,13 @@ function _ts_generator(thisArg, body) {
|
|
|
395
387
|
1
|
|
396
388
|
];
|
|
397
389
|
case 5:
|
|
398
|
-
|
|
390
|
+
this.hasPolled = true;
|
|
399
391
|
return [
|
|
400
392
|
2
|
|
401
393
|
];
|
|
402
394
|
}
|
|
403
395
|
});
|
|
404
|
-
})();
|
|
396
|
+
}).call(this);
|
|
405
397
|
}
|
|
406
398
|
},
|
|
407
399
|
{
|
|
@@ -409,20 +401,20 @@ function _ts_generator(thisArg, body) {
|
|
|
409
401
|
value: /** @inheritdoc */ function load(context) {
|
|
410
402
|
var _this = this;
|
|
411
403
|
return {
|
|
412
|
-
transform:
|
|
413
|
-
|
|
404
|
+
transform: function(requestOptions) {
|
|
405
|
+
return _async_to_generator(function() {
|
|
414
406
|
var fingerprint;
|
|
415
407
|
return _ts_generator(this, function(_state) {
|
|
416
408
|
switch(_state.label){
|
|
417
409
|
case 0:
|
|
418
410
|
return [
|
|
419
411
|
4,
|
|
420
|
-
|
|
412
|
+
this.waitForFingerprint(context === null || context === void 0 ? void 0 : context.logger)
|
|
421
413
|
];
|
|
422
414
|
case 1:
|
|
423
415
|
fingerprint = _state.sent();
|
|
424
416
|
if (fingerprint) {
|
|
425
|
-
requestOptions.headers.set(
|
|
417
|
+
requestOptions.headers.set(this.options.destinationHeaderName, fingerprint);
|
|
426
418
|
}
|
|
427
419
|
return [
|
|
428
420
|
2,
|
|
@@ -430,11 +422,8 @@ function _ts_generator(thisArg, body) {
|
|
|
430
422
|
];
|
|
431
423
|
}
|
|
432
424
|
});
|
|
433
|
-
});
|
|
434
|
-
|
|
435
|
-
return _ref.apply(this, arguments);
|
|
436
|
-
};
|
|
437
|
-
}()
|
|
425
|
+
}).call(_this);
|
|
426
|
+
}
|
|
438
427
|
};
|
|
439
428
|
}
|
|
440
429
|
}
|