@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.
Files changed (111) hide show
  1. package/cjs/clients/api-angular-client.js +13 -18
  2. package/cjs/clients/api-fetch-client.js +16 -21
  3. package/cjs/fwk/api.helpers.js +11 -11
  4. package/cjs/fwk/date.js +5 -5
  5. package/cjs/fwk/errors.js +7 -7
  6. package/cjs/fwk/mocks/alf-mock-adapter.js +58 -60
  7. package/cjs/fwk/mocks/base-mock-adapter.js +15 -19
  8. package/cjs/fwk/mocks/helpers.js +3 -3
  9. package/cjs/fwk/param-serialization.js +6 -6
  10. package/cjs/fwk/reviver.js +4 -4
  11. package/cjs/plugins/abort/abort.spec.js +83 -81
  12. package/cjs/plugins/additional-params/additional-params.request.js +18 -25
  13. package/cjs/plugins/additional-params/additional-params.spec.js +194 -186
  14. package/cjs/plugins/api-configuration-override/api-configuration-override.request.js +10 -17
  15. package/cjs/plugins/api-configuration-override/api-configuration-override.spec.js +83 -81
  16. package/cjs/plugins/api-key/api-key.request.js +12 -19
  17. package/cjs/plugins/api-key/api-key.spec.js +50 -50
  18. package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +25 -36
  19. package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +343 -327
  20. package/cjs/plugins/client-facts/client-facts.request.js +18 -25
  21. package/cjs/plugins/client-facts/client-facts.spec.js +218 -208
  22. package/cjs/plugins/concurrent/concurrent.fetch.js +12 -20
  23. package/cjs/plugins/concurrent/concurrent.spec.js +99 -99
  24. package/cjs/plugins/custom-info/custom-info.spec.js +90 -90
  25. package/cjs/plugins/fetch-cache/fetch-cache.spec.js +100 -98
  26. package/cjs/plugins/fetch-credentials/fetch-credentials.spec.js +60 -60
  27. package/cjs/plugins/json-token/json-token.spec.js +109 -107
  28. package/cjs/plugins/keepalive/keepalive.request.js +7 -12
  29. package/cjs/plugins/keepalive/keepalive.spec.js +32 -34
  30. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.helpers.js +11 -23
  31. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +18 -28
  32. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +212 -204
  33. package/cjs/plugins/mock-intercept/mock-intercept.angular.js +94 -100
  34. package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +15 -22
  35. package/cjs/plugins/mock-intercept/mock-intercept.interface.js +3 -3
  36. package/cjs/plugins/mock-intercept/mock-intercept.request.js +12 -19
  37. package/cjs/plugins/mock-intercept/mock-intercept.spec.js +245 -237
  38. package/cjs/plugins/perf-metric/perf-metric.fetch.js +11 -18
  39. package/cjs/plugins/pii-tokenizer/pii-tokenizer.request.js +19 -27
  40. package/cjs/plugins/pii-tokenizer/pii-tokenizer.spec.js +404 -386
  41. package/cjs/plugins/raw-response-info/raw-response-info.spec.js +67 -67
  42. package/cjs/plugins/retry/retry.fetch.js +18 -27
  43. package/cjs/plugins/retry/retry.spec.js +233 -225
  44. package/cjs/plugins/reviver/reviver.spec.js +88 -86
  45. package/cjs/plugins/session-id/session-id.spec.js +98 -94
  46. package/cjs/plugins/si-token/si-token.spec.js +27 -29
  47. package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +17 -24
  48. package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +199 -191
  49. package/cjs/plugins/timeout/timeout.fetch.js +16 -22
  50. package/cjs/plugins/timeout/timeout.spec.js +211 -205
  51. package/cjs/plugins/url-rewrite/url-rewrite.request.js +9 -16
  52. package/cjs/plugins/url-rewrite/url-rewrite.spec.js +48 -48
  53. package/cjs/plugins/wait-for/wait-for.fetch.js +19 -29
  54. package/cjs/plugins/wait-for/wait-for.spec.js +211 -203
  55. package/cjs/utils/crypto.js +15 -27
  56. package/cjs/utils/generic-api.js +9 -14
  57. package/cjs/utils/json-token.js +19 -26
  58. package/cjs/utils/json-token.spec.js +495 -497
  59. package/cjs/utils/mime-types.js +3 -3
  60. package/esm2015/clients/api-angular-client.js +13 -18
  61. package/esm2015/clients/api-fetch-client.js +16 -21
  62. package/esm2015/fwk/mocks/alf-mock-adapter.js +58 -60
  63. package/esm2015/fwk/mocks/base-mock-adapter.js +15 -19
  64. package/esm2015/plugins/abort/abort.spec.js +83 -81
  65. package/esm2015/plugins/additional-params/additional-params.request.js +15 -22
  66. package/esm2015/plugins/additional-params/additional-params.spec.js +194 -186
  67. package/esm2015/plugins/api-configuration-override/api-configuration-override.request.js +10 -17
  68. package/esm2015/plugins/api-configuration-override/api-configuration-override.spec.js +83 -81
  69. package/esm2015/plugins/api-key/api-key.request.js +12 -19
  70. package/esm2015/plugins/api-key/api-key.spec.js +50 -50
  71. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +21 -32
  72. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +343 -327
  73. package/esm2015/plugins/client-facts/client-facts.request.js +15 -22
  74. package/esm2015/plugins/client-facts/client-facts.spec.js +218 -208
  75. package/esm2015/plugins/concurrent/concurrent.fetch.js +12 -20
  76. package/esm2015/plugins/concurrent/concurrent.spec.js +99 -99
  77. package/esm2015/plugins/custom-info/custom-info.spec.js +90 -90
  78. package/esm2015/plugins/fetch-cache/fetch-cache.spec.js +100 -98
  79. package/esm2015/plugins/fetch-credentials/fetch-credentials.spec.js +60 -60
  80. package/esm2015/plugins/json-token/json-token.spec.js +109 -107
  81. package/esm2015/plugins/keepalive/keepalive.request.js +7 -12
  82. package/esm2015/plugins/keepalive/keepalive.spec.js +32 -34
  83. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.helpers.js +8 -20
  84. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +18 -28
  85. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +212 -204
  86. package/esm2015/plugins/mock-intercept/mock-intercept.angular.js +94 -100
  87. package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +15 -22
  88. package/esm2015/plugins/mock-intercept/mock-intercept.request.js +12 -19
  89. package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +245 -237
  90. package/esm2015/plugins/perf-metric/perf-metric.fetch.js +11 -18
  91. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.request.js +15 -23
  92. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.spec.js +404 -386
  93. package/esm2015/plugins/raw-response-info/raw-response-info.spec.js +67 -67
  94. package/esm2015/plugins/retry/retry.fetch.js +18 -27
  95. package/esm2015/plugins/retry/retry.spec.js +233 -225
  96. package/esm2015/plugins/reviver/reviver.spec.js +88 -86
  97. package/esm2015/plugins/session-id/session-id.spec.js +98 -94
  98. package/esm2015/plugins/si-token/si-token.spec.js +27 -29
  99. package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +17 -24
  100. package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +199 -191
  101. package/esm2015/plugins/timeout/timeout.fetch.js +13 -19
  102. package/esm2015/plugins/timeout/timeout.spec.js +211 -205
  103. package/esm2015/plugins/url-rewrite/url-rewrite.request.js +9 -16
  104. package/esm2015/plugins/url-rewrite/url-rewrite.spec.js +48 -48
  105. package/esm2015/plugins/wait-for/wait-for.fetch.js +19 -29
  106. package/esm2015/plugins/wait-for/wait-for.spec.js +211 -203
  107. package/esm2015/utils/crypto.js +8 -20
  108. package/esm2015/utils/generic-api.js +9 -14
  109. package/esm2015/utils/json-token.js +10 -17
  110. package/esm2015/utils/json-token.spec.js +495 -497
  111. 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, g, _ = {
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', /*#__PURE__*/ _async_to_generator(function() {
130
- var plugin, runner, data;
131
- return _ts_generator(this, function(_state) {
132
- switch(_state.label){
133
- case 0:
134
- plugin = new ReviverReply();
135
- runner = plugin.load({
136
- reviver: reviver,
137
- apiType: ApiTypes.DEFAULT,
138
- response: {}
139
- });
140
- data = {};
141
- return [
142
- 4,
143
- runner.transform(data)
144
- ];
145
- case 1:
146
- _state.sent();
147
- expect(reviver).toHaveBeenCalledWith(data, undefined, expect.any(Object));
148
- return [
149
- 2
150
- ];
151
- }
152
- });
153
- }));
154
- it('should revive a specific data and dictionary', /*#__PURE__*/ _async_to_generator(function() {
155
- var dictionaries, plugin, runner, data;
156
- return _ts_generator(this, function(_state) {
157
- switch(_state.label){
158
- case 0:
159
- dictionaries = {};
160
- plugin = new ReviverReply();
161
- runner = plugin.load({
162
- reviver: reviver,
163
- apiType: ApiTypes.DEFAULT,
164
- dictionaries: dictionaries,
165
- response: {}
166
- });
167
- data = {};
168
- return [
169
- 4,
170
- runner.transform(data)
171
- ];
172
- case 1:
173
- _state.sent();
174
- expect(reviver).toHaveBeenCalledWith(data, dictionaries, expect.any(Object));
175
- return [
176
- 2
177
- ];
178
- }
179
- });
180
- }));
181
- it('should revive empty object in case of undefined data', /*#__PURE__*/ _async_to_generator(function() {
182
- var dictionaries, plugin, runner, transformedData;
183
- return _ts_generator(this, function(_state) {
184
- switch(_state.label){
185
- case 0:
186
- dictionaries = {};
187
- plugin = new ReviverReply();
188
- runner = plugin.load({
189
- reviver: reviver,
190
- apiType: ApiTypes.DEFAULT,
191
- dictionaries: dictionaries,
192
- response: {}
193
- });
194
- return [
195
- 4,
196
- runner.transform(undefined)
197
- ];
198
- case 1:
199
- transformedData = _state.sent();
200
- expect(transformedData).toEqual({});
201
- return [
202
- 2
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, g, _ = {
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', /*#__PURE__*/ _async_to_generator(function() {
138
- var plugin, runner, sessionId;
139
- return _ts_generator(this, function(_state) {
140
- switch(_state.label){
141
- case 0:
142
- plugin = new SessionIdRequest();
143
- runner = plugin.load();
144
- sessionId = plugin.sessionId;
145
- return [
146
- 4,
147
- runner.transform(options)
148
- ];
149
- case 1:
150
- _state.sent();
151
- expect(options.headers.get('Ama-Client-Ref')).toContain(sessionId);
152
- return [
153
- 2
154
- ];
155
- }
156
- });
157
- }));
158
- it('should add the session ID to the headers', /*#__PURE__*/ _async_to_generator(function() {
159
- var plugin, runner, sessionId;
160
- return _ts_generator(this, function(_state) {
161
- switch(_state.label){
162
- case 0:
163
- plugin = new SessionIdRequest(TEST_KEY);
164
- runner = plugin.load();
165
- sessionId = plugin.sessionId;
166
- return [
167
- 4,
168
- runner.transform(options)
169
- ];
170
- case 1:
171
- _state.sent();
172
- expect(options.headers.get(TEST_KEY)).toContain(sessionId);
173
- return [
174
- 2
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', /*#__PURE__*/ _async_to_generator(function() {
194
- var plugin, runner, sessionId;
195
- return _ts_generator(this, function(_state) {
196
- switch(_state.label){
197
- case 0:
198
- plugin = new SessionIdRequest();
199
- runner = plugin.load();
200
- sessionId = plugin.sessionId;
201
- return [
202
- 4,
203
- runner.transform(options)
204
- ];
205
- case 1:
206
- _state.sent();
207
- expect(sessionId).toMatch(/[\dA-Za-z-]{10,48}/);
208
- expect(options.headers.get('Ama-Client-Ref')).toMatch(new RegExp(sessionId + ':[0-9a-zA-Z]{1,10}'));
209
- return [
210
- 2
211
- ];
212
- }
213
- });
214
- }));
215
- it('should be possible to deactivate the request ID part', /*#__PURE__*/ _async_to_generator(function() {
216
- var plugin, runner, sessionId;
217
- return _ts_generator(this, function(_state) {
218
- switch(_state.label){
219
- case 0:
220
- plugin = new SessionIdRequest(TEST_KEY, false);
221
- runner = plugin.load();
222
- sessionId = plugin.sessionId;
223
- return [
224
- 4,
225
- runner.transform(options)
226
- ];
227
- case 1:
228
- _state.sent();
229
- expect(sessionId).toMatch(/[\dA-Za-z-]{10,48}/);
230
- expect(options.headers.get(TEST_KEY)).toEqual(sessionId);
231
- return [
232
- 2
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, g, _ = {
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', /*#__PURE__*/ _async_to_generator(function() {
142
- var plugin, runner, result;
143
- return _ts_generator(this, function(_state) {
144
- switch(_state.label){
145
- case 0:
146
- plugin = new SiTokenRequest('SIToken1', 'SIToken2');
147
- runner = plugin.load();
148
- return [
149
- 4,
150
- runner.transform(options)
151
- ];
152
- case 1:
153
- result = _state.sent();
154
- expect(result.queryParams.SITK).toBe('SIToken1');
155
- expect(result.queryParams.SITK2).toBe('SIToken2');
156
- return [
157
- 2
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
  });
@@ -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, g, _ = {
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: /*#__PURE__*/ function() {
260
- var _ref = _async_to_generator(function(data) {
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
- _this.options.apiKeyHeader
263
+ this.options.apiKeyHeader
268
264
  ];
269
- if (!(typeof _this.apiKey === 'string')) return [
265
+ if (!(typeof this.apiKey === 'string')) return [
270
266
  3,
271
267
  1
272
268
  ];
273
- _tmp1 = _this.apiKey;
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
- _this.apiKey()
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 (!_this.options.officeId) return [
286
+ if (!this.options.officeId) return [
291
287
  3,
292
288
  7
293
289
  ];
294
- if (!(typeof _this.options.officeId === 'string')) return [
290
+ if (!(typeof this.options.officeId === 'string')) return [
295
291
  3,
296
292
  4
297
293
  ];
298
- _tmp2 = _this.options.officeId;
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
- _this.options.officeId()
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(_this.options.contextHeader, _this.jwtEncoder({
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
- return function(data) {
326
- return _ref.apply(this, arguments);
327
- };
328
- }()
320
+ }).call(_this);
321
+ }
329
322
  };
330
323
  }
331
324
  }