@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
|
@@ -34,7 +34,7 @@ function _async_to_generator(fn) {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
function _ts_generator(thisArg, body) {
|
|
37
|
-
var f, y, t,
|
|
37
|
+
var f, y, t, _ = {
|
|
38
38
|
label: 0,
|
|
39
39
|
sent: function() {
|
|
40
40
|
if (t[0] & 1) throw t[1];
|
|
@@ -42,12 +42,8 @@ function _ts_generator(thisArg, body) {
|
|
|
42
42
|
},
|
|
43
43
|
trys: [],
|
|
44
44
|
ops: []
|
|
45
|
-
};
|
|
46
|
-
return g = {
|
|
47
|
-
next: verb(0),
|
|
48
|
-
"throw": verb(1),
|
|
49
|
-
"return": verb(2)
|
|
50
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
45
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
46
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
51
47
|
return this;
|
|
52
48
|
}), g;
|
|
53
49
|
function verb(n) {
|
|
@@ -60,7 +56,7 @@ function _ts_generator(thisArg, body) {
|
|
|
60
56
|
}
|
|
61
57
|
function step(op) {
|
|
62
58
|
if (f) throw new TypeError("Generator is already executing.");
|
|
63
|
-
while(_)try {
|
|
59
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
64
60
|
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;
|
|
65
61
|
if (y = 0, t) op = [
|
|
66
62
|
op[0] & 2,
|
|
@@ -130,82 +126,88 @@ function _ts_generator(thisArg, body) {
|
|
|
130
126
|
}
|
|
131
127
|
describe('Reviver Reply Plugin', function() {
|
|
132
128
|
var reviver = jest.fn();
|
|
133
|
-
it('should revive a specific data',
|
|
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
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
dictionaries
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
129
|
+
it('should revive a specific data', function() {
|
|
130
|
+
return _async_to_generator(function() {
|
|
131
|
+
var plugin, runner, data;
|
|
132
|
+
return _ts_generator(this, function(_state) {
|
|
133
|
+
switch(_state.label){
|
|
134
|
+
case 0:
|
|
135
|
+
plugin = new _reviverreply.ReviverReply();
|
|
136
|
+
runner = plugin.load({
|
|
137
|
+
reviver: reviver,
|
|
138
|
+
apiType: _api.ApiTypes.DEFAULT,
|
|
139
|
+
response: {}
|
|
140
|
+
});
|
|
141
|
+
data = {};
|
|
142
|
+
return [
|
|
143
|
+
4,
|
|
144
|
+
runner.transform(data)
|
|
145
|
+
];
|
|
146
|
+
case 1:
|
|
147
|
+
_state.sent();
|
|
148
|
+
expect(reviver).toHaveBeenCalledWith(data, undefined, expect.any(Object));
|
|
149
|
+
return [
|
|
150
|
+
2
|
|
151
|
+
];
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
})();
|
|
155
|
+
});
|
|
156
|
+
it('should revive a specific data and dictionary', function() {
|
|
157
|
+
return _async_to_generator(function() {
|
|
158
|
+
var dictionaries, plugin, runner, data;
|
|
159
|
+
return _ts_generator(this, function(_state) {
|
|
160
|
+
switch(_state.label){
|
|
161
|
+
case 0:
|
|
162
|
+
dictionaries = {};
|
|
163
|
+
plugin = new _reviverreply.ReviverReply();
|
|
164
|
+
runner = plugin.load({
|
|
165
|
+
reviver: reviver,
|
|
166
|
+
apiType: _api.ApiTypes.DEFAULT,
|
|
167
|
+
dictionaries: dictionaries,
|
|
168
|
+
response: {}
|
|
169
|
+
});
|
|
170
|
+
data = {};
|
|
171
|
+
return [
|
|
172
|
+
4,
|
|
173
|
+
runner.transform(data)
|
|
174
|
+
];
|
|
175
|
+
case 1:
|
|
176
|
+
_state.sent();
|
|
177
|
+
expect(reviver).toHaveBeenCalledWith(data, dictionaries, expect.any(Object));
|
|
178
|
+
return [
|
|
179
|
+
2
|
|
180
|
+
];
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
})();
|
|
184
|
+
});
|
|
185
|
+
it('should revive empty object in case of undefined data', function() {
|
|
186
|
+
return _async_to_generator(function() {
|
|
187
|
+
var dictionaries, plugin, runner, transformedData;
|
|
188
|
+
return _ts_generator(this, function(_state) {
|
|
189
|
+
switch(_state.label){
|
|
190
|
+
case 0:
|
|
191
|
+
dictionaries = {};
|
|
192
|
+
plugin = new _reviverreply.ReviverReply();
|
|
193
|
+
runner = plugin.load({
|
|
194
|
+
reviver: reviver,
|
|
195
|
+
apiType: _api.ApiTypes.DEFAULT,
|
|
196
|
+
dictionaries: dictionaries,
|
|
197
|
+
response: {}
|
|
198
|
+
});
|
|
199
|
+
return [
|
|
200
|
+
4,
|
|
201
|
+
runner.transform(undefined)
|
|
202
|
+
];
|
|
203
|
+
case 1:
|
|
204
|
+
transformedData = _state.sent();
|
|
205
|
+
expect(transformedData).toEqual({});
|
|
206
|
+
return [
|
|
207
|
+
2
|
|
208
|
+
];
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
})();
|
|
212
|
+
});
|
|
211
213
|
});
|
|
@@ -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,
|
|
@@ -138,48 +134,52 @@ describe('Session ID Request Plugin', function() {
|
|
|
138
134
|
method: 'get'
|
|
139
135
|
};
|
|
140
136
|
});
|
|
141
|
-
it('should have the default id to Ama-Client-Ref',
|
|
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
|
-
|
|
137
|
+
it('should have the default id to Ama-Client-Ref', function() {
|
|
138
|
+
return _async_to_generator(function() {
|
|
139
|
+
var plugin, runner, sessionId;
|
|
140
|
+
return _ts_generator(this, function(_state) {
|
|
141
|
+
switch(_state.label){
|
|
142
|
+
case 0:
|
|
143
|
+
plugin = new _sessionidrequest.SessionIdRequest();
|
|
144
|
+
runner = plugin.load();
|
|
145
|
+
sessionId = plugin.sessionId;
|
|
146
|
+
return [
|
|
147
|
+
4,
|
|
148
|
+
runner.transform(options)
|
|
149
|
+
];
|
|
150
|
+
case 1:
|
|
151
|
+
_state.sent();
|
|
152
|
+
expect(options.headers.get('Ama-Client-Ref')).toContain(sessionId);
|
|
153
|
+
return [
|
|
154
|
+
2
|
|
155
|
+
];
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
})();
|
|
159
|
+
});
|
|
160
|
+
it('should add the session ID to the headers', function() {
|
|
161
|
+
return _async_to_generator(function() {
|
|
162
|
+
var plugin, runner, sessionId;
|
|
163
|
+
return _ts_generator(this, function(_state) {
|
|
164
|
+
switch(_state.label){
|
|
165
|
+
case 0:
|
|
166
|
+
plugin = new _sessionidrequest.SessionIdRequest(TEST_KEY);
|
|
167
|
+
runner = plugin.load();
|
|
168
|
+
sessionId = plugin.sessionId;
|
|
169
|
+
return [
|
|
170
|
+
4,
|
|
171
|
+
runner.transform(options)
|
|
172
|
+
];
|
|
173
|
+
case 1:
|
|
174
|
+
_state.sent();
|
|
175
|
+
expect(options.headers.get(TEST_KEY)).toContain(sessionId);
|
|
176
|
+
return [
|
|
177
|
+
2
|
|
178
|
+
];
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
})();
|
|
182
|
+
});
|
|
183
183
|
it('second plugin with same header should use the ID that\'s already in memory', function() {
|
|
184
184
|
var plugin = new _sessionidrequest.SessionIdRequest(TEST_KEY);
|
|
185
185
|
var plugin2 = new _sessionidrequest.SessionIdRequest(TEST_KEY);
|
|
@@ -194,48 +194,52 @@ describe('Session ID Request Plugin', function() {
|
|
|
194
194
|
plugin2.load();
|
|
195
195
|
expect(plugin.sessionId).not.toBe(plugin2.sessionId);
|
|
196
196
|
});
|
|
197
|
-
it('should generate a correctly formatted ID',
|
|
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
|
-
|
|
197
|
+
it('should generate a correctly formatted ID', function() {
|
|
198
|
+
return _async_to_generator(function() {
|
|
199
|
+
var plugin, runner, sessionId;
|
|
200
|
+
return _ts_generator(this, function(_state) {
|
|
201
|
+
switch(_state.label){
|
|
202
|
+
case 0:
|
|
203
|
+
plugin = new _sessionidrequest.SessionIdRequest();
|
|
204
|
+
runner = plugin.load();
|
|
205
|
+
sessionId = plugin.sessionId;
|
|
206
|
+
return [
|
|
207
|
+
4,
|
|
208
|
+
runner.transform(options)
|
|
209
|
+
];
|
|
210
|
+
case 1:
|
|
211
|
+
_state.sent();
|
|
212
|
+
expect(sessionId).toMatch(/[\dA-Za-z-]{10,48}/);
|
|
213
|
+
expect(options.headers.get('Ama-Client-Ref')).toMatch(new RegExp(sessionId + ':[0-9a-zA-Z]{1,10}'));
|
|
214
|
+
return [
|
|
215
|
+
2
|
|
216
|
+
];
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
})();
|
|
220
|
+
});
|
|
221
|
+
it('should be possible to deactivate the request ID part', function() {
|
|
222
|
+
return _async_to_generator(function() {
|
|
223
|
+
var plugin, runner, sessionId;
|
|
224
|
+
return _ts_generator(this, function(_state) {
|
|
225
|
+
switch(_state.label){
|
|
226
|
+
case 0:
|
|
227
|
+
plugin = new _sessionidrequest.SessionIdRequest(TEST_KEY, false);
|
|
228
|
+
runner = plugin.load();
|
|
229
|
+
sessionId = plugin.sessionId;
|
|
230
|
+
return [
|
|
231
|
+
4,
|
|
232
|
+
runner.transform(options)
|
|
233
|
+
];
|
|
234
|
+
case 1:
|
|
235
|
+
_state.sent();
|
|
236
|
+
expect(sessionId).toMatch(/[\dA-Za-z-]{10,48}/);
|
|
237
|
+
expect(options.headers.get(TEST_KEY)).toEqual(sessionId);
|
|
238
|
+
return [
|
|
239
|
+
2
|
|
240
|
+
];
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
})();
|
|
244
|
+
});
|
|
241
245
|
});
|
|
@@ -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,
|
|
@@ -142,25 +138,27 @@ describe('SI Token Request Plugin', function() {
|
|
|
142
138
|
basePath: 'http://test.com/truc'
|
|
143
139
|
};
|
|
144
140
|
});
|
|
145
|
-
it('should add a specified SI Tokens in query params',
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
141
|
+
it('should add a specified SI Tokens in query params', function() {
|
|
142
|
+
return _async_to_generator(function() {
|
|
143
|
+
var plugin, runner, result;
|
|
144
|
+
return _ts_generator(this, function(_state) {
|
|
145
|
+
switch(_state.label){
|
|
146
|
+
case 0:
|
|
147
|
+
plugin = new _sitokenrequest.SiTokenRequest('SIToken1', 'SIToken2');
|
|
148
|
+
runner = plugin.load();
|
|
149
|
+
return [
|
|
150
|
+
4,
|
|
151
|
+
runner.transform(options)
|
|
152
|
+
];
|
|
153
|
+
case 1:
|
|
154
|
+
result = _state.sent();
|
|
155
|
+
expect(result.queryParams.SITK).toBe('SIToken1');
|
|
156
|
+
expect(result.queryParams.SITK2).toBe('SIToken2');
|
|
157
|
+
return [
|
|
158
|
+
2
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
})();
|
|
163
|
+
});
|
|
166
164
|
});
|
|
@@ -86,7 +86,7 @@ function _object_spread(target) {
|
|
|
86
86
|
return target;
|
|
87
87
|
}
|
|
88
88
|
function _ts_generator(thisArg, body) {
|
|
89
|
-
var f, y, t,
|
|
89
|
+
var f, y, t, _ = {
|
|
90
90
|
label: 0,
|
|
91
91
|
sent: function() {
|
|
92
92
|
if (t[0] & 1) throw t[1];
|
|
@@ -94,12 +94,8 @@ function _ts_generator(thisArg, body) {
|
|
|
94
94
|
},
|
|
95
95
|
trys: [],
|
|
96
96
|
ops: []
|
|
97
|
-
};
|
|
98
|
-
return g = {
|
|
99
|
-
next: verb(0),
|
|
100
|
-
"throw": verb(1),
|
|
101
|
-
"return": verb(2)
|
|
102
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
97
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
98
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
103
99
|
return this;
|
|
104
100
|
}), g;
|
|
105
101
|
function verb(n) {
|
|
@@ -112,7 +108,7 @@ function _ts_generator(thisArg, body) {
|
|
|
112
108
|
}
|
|
113
109
|
function step(op) {
|
|
114
110
|
if (f) throw new TypeError("Generator is already executing.");
|
|
115
|
-
while(_)try {
|
|
111
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
116
112
|
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;
|
|
117
113
|
if (y = 0, t) op = [
|
|
118
114
|
op[0] & 2,
|
|
@@ -221,21 +217,21 @@ var SimpleApiKeyAuthenticationRequest = /*#__PURE__*/ function() {
|
|
|
221
217
|
value: function load() {
|
|
222
218
|
var _this = this;
|
|
223
219
|
return {
|
|
224
|
-
transform:
|
|
225
|
-
|
|
220
|
+
transform: function(data) {
|
|
221
|
+
return _async_to_generator(function() {
|
|
226
222
|
var _, _1, _tmp, _tmp1, officeId, _tmp2;
|
|
227
223
|
return _ts_generator(this, function(_state) {
|
|
228
224
|
switch(_state.label){
|
|
229
225
|
case 0:
|
|
230
226
|
_1 = (_ = data.headers).set;
|
|
231
227
|
_tmp = [
|
|
232
|
-
|
|
228
|
+
this.options.apiKeyHeader
|
|
233
229
|
];
|
|
234
|
-
if (!(typeof
|
|
230
|
+
if (!(typeof this.apiKey === 'string')) return [
|
|
235
231
|
3,
|
|
236
232
|
1
|
|
237
233
|
];
|
|
238
|
-
_tmp1 =
|
|
234
|
+
_tmp1 = this.apiKey;
|
|
239
235
|
return [
|
|
240
236
|
3,
|
|
241
237
|
3
|
|
@@ -243,7 +239,7 @@ var SimpleApiKeyAuthenticationRequest = /*#__PURE__*/ function() {
|
|
|
243
239
|
case 1:
|
|
244
240
|
return [
|
|
245
241
|
4,
|
|
246
|
-
|
|
242
|
+
this.apiKey()
|
|
247
243
|
];
|
|
248
244
|
case 2:
|
|
249
245
|
_tmp1 = _state.sent();
|
|
@@ -252,15 +248,15 @@ var SimpleApiKeyAuthenticationRequest = /*#__PURE__*/ function() {
|
|
|
252
248
|
_1.apply(_, _tmp.concat([
|
|
253
249
|
_tmp1
|
|
254
250
|
]));
|
|
255
|
-
if (!
|
|
251
|
+
if (!this.options.officeId) return [
|
|
256
252
|
3,
|
|
257
253
|
7
|
|
258
254
|
];
|
|
259
|
-
if (!(typeof
|
|
255
|
+
if (!(typeof this.options.officeId === 'string')) return [
|
|
260
256
|
3,
|
|
261
257
|
4
|
|
262
258
|
];
|
|
263
|
-
_tmp2 =
|
|
259
|
+
_tmp2 = this.options.officeId;
|
|
264
260
|
return [
|
|
265
261
|
3,
|
|
266
262
|
6
|
|
@@ -268,14 +264,14 @@ var SimpleApiKeyAuthenticationRequest = /*#__PURE__*/ function() {
|
|
|
268
264
|
case 4:
|
|
269
265
|
return [
|
|
270
266
|
4,
|
|
271
|
-
|
|
267
|
+
this.options.officeId()
|
|
272
268
|
];
|
|
273
269
|
case 5:
|
|
274
270
|
_tmp2 = _state.sent();
|
|
275
271
|
_state.label = 6;
|
|
276
272
|
case 6:
|
|
277
273
|
officeId = _tmp2;
|
|
278
|
-
data.headers.set(
|
|
274
|
+
data.headers.set(this.options.contextHeader, this.jwtEncoder({
|
|
279
275
|
oid: officeId
|
|
280
276
|
}));
|
|
281
277
|
_state.label = 7;
|
|
@@ -286,11 +282,8 @@ var SimpleApiKeyAuthenticationRequest = /*#__PURE__*/ function() {
|
|
|
286
282
|
];
|
|
287
283
|
}
|
|
288
284
|
});
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
return _ref.apply(this, arguments);
|
|
292
|
-
};
|
|
293
|
-
}()
|
|
285
|
+
}).call(_this);
|
|
286
|
+
}
|
|
294
287
|
};
|
|
295
288
|
}
|
|
296
289
|
}
|