@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,
@@ -124,77 +120,83 @@ function _ts_generator(thisArg, body) {
124
120
  }
125
121
  import { AbortFetch } from './abort.fetch';
126
122
  describe('Abort Plugin', function() {
127
- it('should trigger the callback', /*#__PURE__*/ _async_to_generator(function() {
128
- var fn, plugin, runner;
129
- return _ts_generator(this, function(_state) {
130
- switch(_state.label){
131
- case 0:
132
- fn = jest.fn();
133
- plugin = new AbortFetch(fn);
134
- runner = plugin.load({});
135
- return [
136
- 4,
137
- runner.transform(Promise.resolve())
138
- ];
139
- case 1:
140
- _state.sent();
141
- expect(fn).toHaveBeenCalled();
142
- return [
143
- 2
144
- ];
145
- }
146
- });
147
- }));
148
- it('should trigger abort signal if true', /*#__PURE__*/ _async_to_generator(function() {
149
- var defaultContext, fn, plugin, runner;
150
- return _ts_generator(this, function(_state) {
151
- switch(_state.label){
152
- case 0:
153
- defaultContext = {
154
- controller: {
155
- abort: jest.fn()
156
- }
157
- };
158
- fn = jest.fn().mockResolvedValue(true);
159
- plugin = new AbortFetch(fn);
160
- runner = plugin.load(defaultContext);
161
- return [
162
- 4,
163
- runner.transform(Promise.resolve())
164
- ];
165
- case 1:
166
- _state.sent();
167
- expect(defaultContext.controller.abort).toHaveBeenCalled();
168
- return [
169
- 2
170
- ];
171
- }
172
- });
173
- }));
174
- it('should not trigger abort signal if false', /*#__PURE__*/ _async_to_generator(function() {
175
- var defaultContext, fn, plugin, runner;
176
- return _ts_generator(this, function(_state) {
177
- switch(_state.label){
178
- case 0:
179
- defaultContext = {
180
- controller: {
181
- abort: jest.fn()
182
- }
183
- };
184
- fn = jest.fn().mockResolvedValue(false);
185
- plugin = new AbortFetch(fn);
186
- runner = plugin.load(defaultContext);
187
- return [
188
- 4,
189
- runner.transform(Promise.resolve())
190
- ];
191
- case 1:
192
- _state.sent();
193
- expect(defaultContext.controller.abort).not.toHaveBeenCalled();
194
- return [
195
- 2
196
- ];
197
- }
198
- });
199
- }));
123
+ it('should trigger the callback', function() {
124
+ return _async_to_generator(function() {
125
+ var fn, plugin, runner;
126
+ return _ts_generator(this, function(_state) {
127
+ switch(_state.label){
128
+ case 0:
129
+ fn = jest.fn();
130
+ plugin = new AbortFetch(fn);
131
+ runner = plugin.load({});
132
+ return [
133
+ 4,
134
+ runner.transform(Promise.resolve())
135
+ ];
136
+ case 1:
137
+ _state.sent();
138
+ expect(fn).toHaveBeenCalled();
139
+ return [
140
+ 2
141
+ ];
142
+ }
143
+ });
144
+ })();
145
+ });
146
+ it('should trigger abort signal if true', function() {
147
+ return _async_to_generator(function() {
148
+ var defaultContext, fn, plugin, runner;
149
+ return _ts_generator(this, function(_state) {
150
+ switch(_state.label){
151
+ case 0:
152
+ defaultContext = {
153
+ controller: {
154
+ abort: jest.fn()
155
+ }
156
+ };
157
+ fn = jest.fn().mockResolvedValue(true);
158
+ plugin = new AbortFetch(fn);
159
+ runner = plugin.load(defaultContext);
160
+ return [
161
+ 4,
162
+ runner.transform(Promise.resolve())
163
+ ];
164
+ case 1:
165
+ _state.sent();
166
+ expect(defaultContext.controller.abort).toHaveBeenCalled();
167
+ return [
168
+ 2
169
+ ];
170
+ }
171
+ });
172
+ })();
173
+ });
174
+ it('should not trigger abort signal if false', function() {
175
+ return _async_to_generator(function() {
176
+ var defaultContext, fn, plugin, runner;
177
+ return _ts_generator(this, function(_state) {
178
+ switch(_state.label){
179
+ case 0:
180
+ defaultContext = {
181
+ controller: {
182
+ abort: jest.fn()
183
+ }
184
+ };
185
+ fn = jest.fn().mockResolvedValue(false);
186
+ plugin = new AbortFetch(fn);
187
+ runner = plugin.load(defaultContext);
188
+ return [
189
+ 4,
190
+ runner.transform(Promise.resolve())
191
+ ];
192
+ case 1:
193
+ _state.sent();
194
+ expect(defaultContext.controller.abort).not.toHaveBeenCalled();
195
+ return [
196
+ 2
197
+ ];
198
+ }
199
+ });
200
+ })();
201
+ });
200
202
  });
@@ -125,7 +125,7 @@ function _unsupported_iterable_to_array(o, minLen) {
125
125
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
126
126
  }
127
127
  function _ts_generator(thisArg, body) {
128
- var f, y, t, g, _ = {
128
+ var f, y, t, _ = {
129
129
  label: 0,
130
130
  sent: function() {
131
131
  if (t[0] & 1) throw t[1];
@@ -133,12 +133,8 @@ function _ts_generator(thisArg, body) {
133
133
  },
134
134
  trys: [],
135
135
  ops: []
136
- };
137
- return g = {
138
- next: verb(0),
139
- "throw": verb(1),
140
- "return": verb(2)
141
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
136
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
137
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
142
138
  return this;
143
139
  }), g;
144
140
  function verb(n) {
@@ -151,7 +147,7 @@ function _ts_generator(thisArg, body) {
151
147
  }
152
148
  function step(op) {
153
149
  if (f) throw new TypeError("Generator is already executing.");
154
- while(_)try {
150
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
155
151
  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;
156
152
  if (y = 0, t) op = [
157
153
  op[0] & 2,
@@ -244,19 +240,19 @@ import { isParamValueRecord, serializeRequestPluginQueryParams } from '../../fwk
244
240
  value: function load(context) {
245
241
  var _this = this;
246
242
  return {
247
- transform: /*#__PURE__*/ function() {
248
- var _ref = _async_to_generator(function(data) {
243
+ transform: function(data) {
244
+ return _async_to_generator(function() {
249
245
  var queryParams, _tmp, headers, _tmp1, body, _data_paramSerializationOptions, queryParamsValues, _tmp2;
250
246
  return _ts_generator(this, function(_state) {
251
247
  switch(_state.label){
252
248
  case 0:
253
- if (!(typeof _this.additionalParams.queryParams === 'function')) return [
249
+ if (!(typeof this.additionalParams.queryParams === 'function')) return [
254
250
  3,
255
251
  2
256
252
  ];
257
253
  return [
258
254
  4,
259
- _this.additionalParams.queryParams(data.queryParams)
255
+ this.additionalParams.queryParams(data.queryParams)
260
256
  ];
261
257
  case 1:
262
258
  _tmp = _state.sent();
@@ -265,17 +261,17 @@ import { isParamValueRecord, serializeRequestPluginQueryParams } from '../../fwk
265
261
  3
266
262
  ];
267
263
  case 2:
268
- _tmp = _this.additionalParams.queryParams;
264
+ _tmp = this.additionalParams.queryParams;
269
265
  _state.label = 3;
270
266
  case 3:
271
267
  queryParams = _tmp;
272
- if (!(typeof _this.additionalParams.headers === 'function')) return [
268
+ if (!(typeof this.additionalParams.headers === 'function')) return [
273
269
  3,
274
270
  5
275
271
  ];
276
272
  return [
277
273
  4,
278
- _this.additionalParams.headers(data.headers)
274
+ this.additionalParams.headers(data.headers)
279
275
  ];
280
276
  case 4:
281
277
  _tmp1 = _state.sent();
@@ -284,11 +280,11 @@ import { isParamValueRecord, serializeRequestPluginQueryParams } from '../../fwk
284
280
  6
285
281
  ];
286
282
  case 5:
287
- _tmp1 = _this.additionalParams.headers;
283
+ _tmp1 = this.additionalParams.headers;
288
284
  _state.label = 6;
289
285
  case 6:
290
286
  headers = _tmp1;
291
- body = _this.additionalParams.body && isStringOrUndefined(data.body) ? _this.additionalParams.body(data.body) : undefined;
287
+ body = this.additionalParams.body && isStringOrUndefined(data.body) ? this.additionalParams.body(data.body) : undefined;
292
288
  if (queryParams) {
293
289
  ;
294
290
  if ((_data_paramSerializationOptions = data.paramSerializationOptions) === null || _data_paramSerializationOptions === void 0 ? void 0 : _data_paramSerializationOptions.enableParameterSerialization) {
@@ -349,11 +345,8 @@ import { isParamValueRecord, serializeRequestPluginQueryParams } from '../../fwk
349
345
  ];
350
346
  }
351
347
  });
352
- });
353
- return function(data) {
354
- return _ref.apply(this, arguments);
355
- };
356
- }()
348
+ }).call(_this);
349
+ }
357
350
  };
358
351
  }
359
352
  }