@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,
|
|
@@ -126,82 +122,88 @@ import { ApiTypes } from '../../fwk/api';
|
|
|
126
122
|
import { ReviverReply } from './reviver.reply';
|
|
127
123
|
describe('Reviver Reply Plugin', function() {
|
|
128
124
|
var reviver = jest.fn();
|
|
129
|
-
it('should revive a specific data',
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
dictionaries
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
125
|
+
it('should revive a specific data', function() {
|
|
126
|
+
return _async_to_generator(function() {
|
|
127
|
+
var plugin, runner, data;
|
|
128
|
+
return _ts_generator(this, function(_state) {
|
|
129
|
+
switch(_state.label){
|
|
130
|
+
case 0:
|
|
131
|
+
plugin = new ReviverReply();
|
|
132
|
+
runner = plugin.load({
|
|
133
|
+
reviver: reviver,
|
|
134
|
+
apiType: ApiTypes.DEFAULT,
|
|
135
|
+
response: {}
|
|
136
|
+
});
|
|
137
|
+
data = {};
|
|
138
|
+
return [
|
|
139
|
+
4,
|
|
140
|
+
runner.transform(data)
|
|
141
|
+
];
|
|
142
|
+
case 1:
|
|
143
|
+
_state.sent();
|
|
144
|
+
expect(reviver).toHaveBeenCalledWith(data, undefined, expect.any(Object));
|
|
145
|
+
return [
|
|
146
|
+
2
|
|
147
|
+
];
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
})();
|
|
151
|
+
});
|
|
152
|
+
it('should revive a specific data and dictionary', function() {
|
|
153
|
+
return _async_to_generator(function() {
|
|
154
|
+
var dictionaries, plugin, runner, data;
|
|
155
|
+
return _ts_generator(this, function(_state) {
|
|
156
|
+
switch(_state.label){
|
|
157
|
+
case 0:
|
|
158
|
+
dictionaries = {};
|
|
159
|
+
plugin = new ReviverReply();
|
|
160
|
+
runner = plugin.load({
|
|
161
|
+
reviver: reviver,
|
|
162
|
+
apiType: ApiTypes.DEFAULT,
|
|
163
|
+
dictionaries: dictionaries,
|
|
164
|
+
response: {}
|
|
165
|
+
});
|
|
166
|
+
data = {};
|
|
167
|
+
return [
|
|
168
|
+
4,
|
|
169
|
+
runner.transform(data)
|
|
170
|
+
];
|
|
171
|
+
case 1:
|
|
172
|
+
_state.sent();
|
|
173
|
+
expect(reviver).toHaveBeenCalledWith(data, dictionaries, expect.any(Object));
|
|
174
|
+
return [
|
|
175
|
+
2
|
|
176
|
+
];
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
})();
|
|
180
|
+
});
|
|
181
|
+
it('should revive empty object in case of undefined data', function() {
|
|
182
|
+
return _async_to_generator(function() {
|
|
183
|
+
var dictionaries, plugin, runner, transformedData;
|
|
184
|
+
return _ts_generator(this, function(_state) {
|
|
185
|
+
switch(_state.label){
|
|
186
|
+
case 0:
|
|
187
|
+
dictionaries = {};
|
|
188
|
+
plugin = new ReviverReply();
|
|
189
|
+
runner = plugin.load({
|
|
190
|
+
reviver: reviver,
|
|
191
|
+
apiType: ApiTypes.DEFAULT,
|
|
192
|
+
dictionaries: dictionaries,
|
|
193
|
+
response: {}
|
|
194
|
+
});
|
|
195
|
+
return [
|
|
196
|
+
4,
|
|
197
|
+
runner.transform(undefined)
|
|
198
|
+
];
|
|
199
|
+
case 1:
|
|
200
|
+
transformedData = _state.sent();
|
|
201
|
+
expect(transformedData).toEqual({});
|
|
202
|
+
return [
|
|
203
|
+
2
|
|
204
|
+
];
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
})();
|
|
208
|
+
});
|
|
207
209
|
});
|
|
@@ -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,48 +130,52 @@ describe('Session ID Request Plugin', function() {
|
|
|
134
130
|
method: 'get'
|
|
135
131
|
};
|
|
136
132
|
});
|
|
137
|
-
it('should have the default id to Ama-Client-Ref',
|
|
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
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
133
|
+
it('should have the default id to Ama-Client-Ref', function() {
|
|
134
|
+
return _async_to_generator(function() {
|
|
135
|
+
var plugin, runner, sessionId;
|
|
136
|
+
return _ts_generator(this, function(_state) {
|
|
137
|
+
switch(_state.label){
|
|
138
|
+
case 0:
|
|
139
|
+
plugin = new SessionIdRequest();
|
|
140
|
+
runner = plugin.load();
|
|
141
|
+
sessionId = plugin.sessionId;
|
|
142
|
+
return [
|
|
143
|
+
4,
|
|
144
|
+
runner.transform(options)
|
|
145
|
+
];
|
|
146
|
+
case 1:
|
|
147
|
+
_state.sent();
|
|
148
|
+
expect(options.headers.get('Ama-Client-Ref')).toContain(sessionId);
|
|
149
|
+
return [
|
|
150
|
+
2
|
|
151
|
+
];
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
})();
|
|
155
|
+
});
|
|
156
|
+
it('should add the session ID to the headers', function() {
|
|
157
|
+
return _async_to_generator(function() {
|
|
158
|
+
var plugin, runner, sessionId;
|
|
159
|
+
return _ts_generator(this, function(_state) {
|
|
160
|
+
switch(_state.label){
|
|
161
|
+
case 0:
|
|
162
|
+
plugin = new SessionIdRequest(TEST_KEY);
|
|
163
|
+
runner = plugin.load();
|
|
164
|
+
sessionId = plugin.sessionId;
|
|
165
|
+
return [
|
|
166
|
+
4,
|
|
167
|
+
runner.transform(options)
|
|
168
|
+
];
|
|
169
|
+
case 1:
|
|
170
|
+
_state.sent();
|
|
171
|
+
expect(options.headers.get(TEST_KEY)).toContain(sessionId);
|
|
172
|
+
return [
|
|
173
|
+
2
|
|
174
|
+
];
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
})();
|
|
178
|
+
});
|
|
179
179
|
it('second plugin with same header should use the ID that\'s already in memory', function() {
|
|
180
180
|
var plugin = new SessionIdRequest(TEST_KEY);
|
|
181
181
|
var plugin2 = new SessionIdRequest(TEST_KEY);
|
|
@@ -190,48 +190,52 @@ describe('Session ID Request Plugin', function() {
|
|
|
190
190
|
plugin2.load();
|
|
191
191
|
expect(plugin.sessionId).not.toBe(plugin2.sessionId);
|
|
192
192
|
});
|
|
193
|
-
it('should generate a correctly formatted ID',
|
|
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
|
-
|
|
193
|
+
it('should generate a correctly formatted ID', function() {
|
|
194
|
+
return _async_to_generator(function() {
|
|
195
|
+
var plugin, runner, sessionId;
|
|
196
|
+
return _ts_generator(this, function(_state) {
|
|
197
|
+
switch(_state.label){
|
|
198
|
+
case 0:
|
|
199
|
+
plugin = new SessionIdRequest();
|
|
200
|
+
runner = plugin.load();
|
|
201
|
+
sessionId = plugin.sessionId;
|
|
202
|
+
return [
|
|
203
|
+
4,
|
|
204
|
+
runner.transform(options)
|
|
205
|
+
];
|
|
206
|
+
case 1:
|
|
207
|
+
_state.sent();
|
|
208
|
+
expect(sessionId).toMatch(/[\dA-Za-z-]{10,48}/);
|
|
209
|
+
expect(options.headers.get('Ama-Client-Ref')).toMatch(new RegExp(sessionId + ':[0-9a-zA-Z]{1,10}'));
|
|
210
|
+
return [
|
|
211
|
+
2
|
|
212
|
+
];
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
})();
|
|
216
|
+
});
|
|
217
|
+
it('should be possible to deactivate the request ID part', function() {
|
|
218
|
+
return _async_to_generator(function() {
|
|
219
|
+
var plugin, runner, sessionId;
|
|
220
|
+
return _ts_generator(this, function(_state) {
|
|
221
|
+
switch(_state.label){
|
|
222
|
+
case 0:
|
|
223
|
+
plugin = new SessionIdRequest(TEST_KEY, false);
|
|
224
|
+
runner = plugin.load();
|
|
225
|
+
sessionId = plugin.sessionId;
|
|
226
|
+
return [
|
|
227
|
+
4,
|
|
228
|
+
runner.transform(options)
|
|
229
|
+
];
|
|
230
|
+
case 1:
|
|
231
|
+
_state.sent();
|
|
232
|
+
expect(sessionId).toMatch(/[\dA-Za-z-]{10,48}/);
|
|
233
|
+
expect(options.headers.get(TEST_KEY)).toEqual(sessionId);
|
|
234
|
+
return [
|
|
235
|
+
2
|
|
236
|
+
];
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
})();
|
|
240
|
+
});
|
|
237
241
|
});
|
|
@@ -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,
|
|
@@ -138,25 +134,27 @@ describe('SI Token Request Plugin', function() {
|
|
|
138
134
|
basePath: 'http://test.com/truc'
|
|
139
135
|
};
|
|
140
136
|
});
|
|
141
|
-
it('should add a specified SI Tokens in query params',
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
137
|
+
it('should add a specified SI Tokens in query params', function() {
|
|
138
|
+
return _async_to_generator(function() {
|
|
139
|
+
var plugin, runner, result;
|
|
140
|
+
return _ts_generator(this, function(_state) {
|
|
141
|
+
switch(_state.label){
|
|
142
|
+
case 0:
|
|
143
|
+
plugin = new SiTokenRequest('SIToken1', 'SIToken2');
|
|
144
|
+
runner = plugin.load();
|
|
145
|
+
return [
|
|
146
|
+
4,
|
|
147
|
+
runner.transform(options)
|
|
148
|
+
];
|
|
149
|
+
case 1:
|
|
150
|
+
result = _state.sent();
|
|
151
|
+
expect(result.queryParams.SITK).toBe('SIToken1');
|
|
152
|
+
expect(result.queryParams.SITK2).toBe('SIToken2');
|
|
153
|
+
return [
|
|
154
|
+
2
|
|
155
|
+
];
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
})();
|
|
159
|
+
});
|
|
162
160
|
});
|
package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js
CHANGED
|
@@ -75,7 +75,7 @@ function _object_spread(target) {
|
|
|
75
75
|
return target;
|
|
76
76
|
}
|
|
77
77
|
function _ts_generator(thisArg, body) {
|
|
78
|
-
var f, y, t,
|
|
78
|
+
var f, y, t, _ = {
|
|
79
79
|
label: 0,
|
|
80
80
|
sent: function() {
|
|
81
81
|
if (t[0] & 1) throw t[1];
|
|
@@ -83,12 +83,8 @@ function _ts_generator(thisArg, body) {
|
|
|
83
83
|
},
|
|
84
84
|
trys: [],
|
|
85
85
|
ops: []
|
|
86
|
-
};
|
|
87
|
-
return g = {
|
|
88
|
-
next: verb(0),
|
|
89
|
-
"throw": verb(1),
|
|
90
|
-
"return": verb(2)
|
|
91
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
86
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
87
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
92
88
|
return this;
|
|
93
89
|
}), g;
|
|
94
90
|
function verb(n) {
|
|
@@ -101,7 +97,7 @@ function _ts_generator(thisArg, body) {
|
|
|
101
97
|
}
|
|
102
98
|
function step(op) {
|
|
103
99
|
if (f) throw new TypeError("Generator is already executing.");
|
|
104
|
-
while(_)try {
|
|
100
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
105
101
|
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;
|
|
106
102
|
if (y = 0, t) op = [
|
|
107
103
|
op[0] & 2,
|
|
@@ -256,21 +252,21 @@ import { createJwtEncoder } from '../../utils/json-token';
|
|
|
256
252
|
value: function load() {
|
|
257
253
|
var _this = this;
|
|
258
254
|
return {
|
|
259
|
-
transform:
|
|
260
|
-
|
|
255
|
+
transform: function(data) {
|
|
256
|
+
return _async_to_generator(function() {
|
|
261
257
|
var _, _1, _tmp, _tmp1, officeId, _tmp2;
|
|
262
258
|
return _ts_generator(this, function(_state) {
|
|
263
259
|
switch(_state.label){
|
|
264
260
|
case 0:
|
|
265
261
|
_1 = (_ = data.headers).set;
|
|
266
262
|
_tmp = [
|
|
267
|
-
|
|
263
|
+
this.options.apiKeyHeader
|
|
268
264
|
];
|
|
269
|
-
if (!(typeof
|
|
265
|
+
if (!(typeof this.apiKey === 'string')) return [
|
|
270
266
|
3,
|
|
271
267
|
1
|
|
272
268
|
];
|
|
273
|
-
_tmp1 =
|
|
269
|
+
_tmp1 = this.apiKey;
|
|
274
270
|
return [
|
|
275
271
|
3,
|
|
276
272
|
3
|
|
@@ -278,7 +274,7 @@ import { createJwtEncoder } from '../../utils/json-token';
|
|
|
278
274
|
case 1:
|
|
279
275
|
return [
|
|
280
276
|
4,
|
|
281
|
-
|
|
277
|
+
this.apiKey()
|
|
282
278
|
];
|
|
283
279
|
case 2:
|
|
284
280
|
_tmp1 = _state.sent();
|
|
@@ -287,15 +283,15 @@ import { createJwtEncoder } from '../../utils/json-token';
|
|
|
287
283
|
_1.apply(_, _tmp.concat([
|
|
288
284
|
_tmp1
|
|
289
285
|
]));
|
|
290
|
-
if (!
|
|
286
|
+
if (!this.options.officeId) return [
|
|
291
287
|
3,
|
|
292
288
|
7
|
|
293
289
|
];
|
|
294
|
-
if (!(typeof
|
|
290
|
+
if (!(typeof this.options.officeId === 'string')) return [
|
|
295
291
|
3,
|
|
296
292
|
4
|
|
297
293
|
];
|
|
298
|
-
_tmp2 =
|
|
294
|
+
_tmp2 = this.options.officeId;
|
|
299
295
|
return [
|
|
300
296
|
3,
|
|
301
297
|
6
|
|
@@ -303,14 +299,14 @@ import { createJwtEncoder } from '../../utils/json-token';
|
|
|
303
299
|
case 4:
|
|
304
300
|
return [
|
|
305
301
|
4,
|
|
306
|
-
|
|
302
|
+
this.options.officeId()
|
|
307
303
|
];
|
|
308
304
|
case 5:
|
|
309
305
|
_tmp2 = _state.sent();
|
|
310
306
|
_state.label = 6;
|
|
311
307
|
case 6:
|
|
312
308
|
officeId = _tmp2;
|
|
313
|
-
data.headers.set(
|
|
309
|
+
data.headers.set(this.options.contextHeader, this.jwtEncoder({
|
|
314
310
|
oid: officeId
|
|
315
311
|
}));
|
|
316
312
|
_state.label = 7;
|
|
@@ -321,11 +317,8 @@ import { createJwtEncoder } from '../../utils/json-token';
|
|
|
321
317
|
];
|
|
322
318
|
}
|
|
323
319
|
});
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
return _ref.apply(this, arguments);
|
|
327
|
-
};
|
|
328
|
-
}()
|
|
320
|
+
}).call(_this);
|
|
321
|
+
}
|
|
329
322
|
};
|
|
330
323
|
}
|
|
331
324
|
}
|