@ama-sdk/core 11.3.0-prerelease.9 → 11.4.0-prerelease.0

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 (122) hide show
  1. package/README.md +13 -25
  2. package/cjs/clients/api-angular-client.js +63 -3
  3. package/cjs/clients/api-beacon-client.js +1 -0
  4. package/cjs/clients/api-fetch-client.js +2 -1
  5. package/cjs/fwk/date.js +12 -33
  6. package/cjs/fwk/errors.js +39 -43
  7. package/cjs/fwk/mocks/random-mock-adapter.js +10 -24
  8. package/cjs/fwk/mocks/sequential-mock-adapter.js +10 -24
  9. package/cjs/plugins/additional-params/additional-params.request.js +1 -1
  10. package/cjs/plugins/api-configuration-override/api-configuration-override.request.js +1 -1
  11. package/cjs/plugins/api-key/api-key.request.js +1 -1
  12. package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +2 -2
  13. package/cjs/plugins/client-facts/client-facts.request.js +1 -1
  14. package/cjs/plugins/concurrent/concurrent.fetch.js +1 -1
  15. package/cjs/plugins/core/angular-plugin.js +4 -0
  16. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +1 -1
  17. package/cjs/plugins/mock-intercept/index.js +1 -0
  18. package/cjs/plugins/mock-intercept/mock-intercept.angular.js +347 -0
  19. package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +1 -1
  20. package/cjs/plugins/mock-intercept/mock-intercept.request.js +1 -1
  21. package/cjs/plugins/perf-metric/perf-metric.fetch.js +1 -1
  22. package/cjs/plugins/pii-tokenizer/pii-tokenizer.request.js +1 -1
  23. package/cjs/plugins/retry/retry.fetch.js +2 -2
  24. package/cjs/plugins/si-token/si-token.request.js +21 -34
  25. package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +1 -1
  26. package/cjs/plugins/timeout/timeout.fetch.js +1 -1
  27. package/cjs/plugins/url-rewrite/url-rewrite.request.js +1 -1
  28. package/cjs/plugins/wait-for/wait-for.fetch.js +2 -2
  29. package/cjs/utils/json-token.js +1 -1
  30. package/esm2015/clients/api-angular-client.js +67 -4
  31. package/esm2015/clients/api-beacon-client.js +1 -0
  32. package/esm2015/clients/api-fetch-client.js +6 -2
  33. package/esm2015/fwk/date.js +12 -33
  34. package/esm2015/fwk/errors.js +39 -43
  35. package/esm2015/fwk/mocks/random-mock-adapter.js +10 -24
  36. package/esm2015/fwk/mocks/sequential-mock-adapter.js +10 -24
  37. package/esm2015/plugins/additional-params/additional-params.request.js +1 -1
  38. package/esm2015/plugins/api-configuration-override/api-configuration-override.request.js +1 -1
  39. package/esm2015/plugins/api-key/api-key.request.js +1 -1
  40. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +2 -2
  41. package/esm2015/plugins/client-facts/client-facts.request.js +1 -1
  42. package/esm2015/plugins/concurrent/concurrent.fetch.js +2 -1
  43. package/esm2015/plugins/core/angular-plugin.js +4 -0
  44. package/esm2015/plugins/core/fetch-plugin.js +1 -0
  45. package/esm2015/plugins/keepalive/keepalive.request.js +1 -0
  46. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +1 -1
  47. package/esm2015/plugins/mock-intercept/index.js +1 -0
  48. package/esm2015/plugins/mock-intercept/mock-intercept.angular.js +343 -0
  49. package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +2 -1
  50. package/esm2015/plugins/mock-intercept/mock-intercept.request.js +1 -1
  51. package/esm2015/plugins/perf-metric/perf-metric.fetch.js +2 -1
  52. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.request.js +1 -1
  53. package/esm2015/plugins/retry/retry.fetch.js +3 -2
  54. package/esm2015/plugins/si-token/si-token.request.js +21 -34
  55. package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +1 -1
  56. package/esm2015/plugins/timeout/timeout.fetch.js +1 -1
  57. package/esm2015/plugins/url-rewrite/url-rewrite.request.js +1 -1
  58. package/esm2015/plugins/wait-for/wait-for.fetch.js +3 -2
  59. package/esm2015/utils/json-token.js +1 -1
  60. package/package.json +16 -6
  61. package/src/clients/api-angular-client.d.ts +19 -3
  62. package/src/clients/api-angular-client.d.ts.map +1 -1
  63. package/src/clients/api-angular-client.js +22 -4
  64. package/src/clients/api-angular-client.js.map +1 -1
  65. package/src/clients/api-beacon-client.d.ts +8 -2
  66. package/src/clients/api-beacon-client.d.ts.map +1 -1
  67. package/src/clients/api-beacon-client.js +1 -0
  68. package/src/clients/api-beacon-client.js.map +1 -1
  69. package/src/clients/api-fetch-client.d.ts +12 -3
  70. package/src/clients/api-fetch-client.d.ts.map +1 -1
  71. package/src/clients/api-fetch-client.js +13 -2
  72. package/src/clients/api-fetch-client.js.map +1 -1
  73. package/src/fwk/core/api-client.d.ts +1 -0
  74. package/src/fwk/core/api-client.d.ts.map +1 -1
  75. package/src/fwk/core/api-client.js.map +1 -1
  76. package/src/plugins/abort/abort.fetch.d.ts +1 -0
  77. package/src/plugins/abort/abort.fetch.d.ts.map +1 -1
  78. package/src/plugins/abort/abort.fetch.js.map +1 -1
  79. package/src/plugins/concurrent/concurrent.fetch.d.ts +1 -0
  80. package/src/plugins/concurrent/concurrent.fetch.d.ts.map +1 -1
  81. package/src/plugins/concurrent/concurrent.fetch.js +1 -0
  82. package/src/plugins/concurrent/concurrent.fetch.js.map +1 -1
  83. package/src/plugins/core/angular-plugin.d.ts +40 -0
  84. package/src/plugins/core/angular-plugin.d.ts.map +1 -0
  85. package/src/plugins/core/angular-plugin.js +2 -0
  86. package/src/plugins/core/angular-plugin.js.map +1 -0
  87. package/src/plugins/core/fetch-plugin.d.ts +7 -0
  88. package/src/plugins/core/fetch-plugin.d.ts.map +1 -1
  89. package/src/plugins/keepalive/keepalive.request.d.ts +1 -0
  90. package/src/plugins/keepalive/keepalive.request.d.ts.map +1 -1
  91. package/src/plugins/keepalive/keepalive.request.js +1 -0
  92. package/src/plugins/keepalive/keepalive.request.js.map +1 -1
  93. package/src/plugins/mock-intercept/index.d.ts +1 -0
  94. package/src/plugins/mock-intercept/index.d.ts.map +1 -1
  95. package/src/plugins/mock-intercept/index.js +1 -0
  96. package/src/plugins/mock-intercept/index.js.map +1 -1
  97. package/src/plugins/mock-intercept/mock-intercept.angular.d.ts +16 -0
  98. package/src/plugins/mock-intercept/mock-intercept.angular.d.ts.map +1 -0
  99. package/src/plugins/mock-intercept/mock-intercept.angular.js +64 -0
  100. package/src/plugins/mock-intercept/mock-intercept.angular.js.map +1 -0
  101. package/src/plugins/mock-intercept/mock-intercept.fetch.d.ts +1 -0
  102. package/src/plugins/mock-intercept/mock-intercept.fetch.d.ts.map +1 -1
  103. package/src/plugins/mock-intercept/mock-intercept.fetch.js +1 -0
  104. package/src/plugins/mock-intercept/mock-intercept.fetch.js.map +1 -1
  105. package/src/plugins/mock-intercept/mock-intercept.interface.d.ts +4 -1
  106. package/src/plugins/mock-intercept/mock-intercept.interface.d.ts.map +1 -1
  107. package/src/plugins/mock-intercept/mock-intercept.interface.js.map +1 -1
  108. package/src/plugins/perf-metric/perf-metric.fetch.d.ts +3 -0
  109. package/src/plugins/perf-metric/perf-metric.fetch.d.ts.map +1 -1
  110. package/src/plugins/perf-metric/perf-metric.fetch.js +1 -0
  111. package/src/plugins/perf-metric/perf-metric.fetch.js.map +1 -1
  112. package/src/plugins/retry/retry.fetch.d.ts +2 -0
  113. package/src/plugins/retry/retry.fetch.d.ts.map +1 -1
  114. package/src/plugins/retry/retry.fetch.js +1 -0
  115. package/src/plugins/retry/retry.fetch.js.map +1 -1
  116. package/src/plugins/timeout/timeout.fetch.d.ts +1 -0
  117. package/src/plugins/timeout/timeout.fetch.d.ts.map +1 -1
  118. package/src/plugins/timeout/timeout.fetch.js.map +1 -1
  119. package/src/plugins/wait-for/wait-for.fetch.d.ts +10 -2
  120. package/src/plugins/wait-for/wait-for.fetch.d.ts.map +1 -1
  121. package/src/plugins/wait-for/wait-for.fetch.js +1 -0
  122. package/src/plugins/wait-for/wait-for.fetch.js.map +1 -1
package/README.md CHANGED
@@ -3,18 +3,18 @@
3
3
  [![Stable Version](https://img.shields.io/npm/v/@ama-sdk/core?style=for-the-badge)](https://www.npmjs.com/package/@ama-sdk/core)
4
4
  [![Bundle Size](https://img.shields.io/bundlephobia/min/@ama-sdk/core?color=green&style=for-the-badge)](https://www.npmjs.com/package/@ama-sdk/core)
5
5
 
6
- This package contains all the [plugins](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins), helpers and object definitions to dialog with an API following the `ama-sdk` architecture.
6
+ This package contains a set of [plugins](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins), helpers and object definitions to dialog with an API following the `ama-sdk` architecture.
7
7
 
8
8
  Please refer to the [ama-sdk-schematics](../schematics/README.md) package for getting started with an API based on `ama-sdk`.
9
9
 
10
10
  ## Available plugins
11
11
 
12
- - [abort](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/abort)
12
+ - [abort](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/abort) *(deprecated, now available [here](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/client-fetch/src/plugins/abort))*
13
13
  - [additional-params](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/additional-params)
14
14
  - [api-configuration-override](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/api-configuration-override)
15
15
  - [api-key](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/api-key)
16
16
  - [bot-protection-fingerprint](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/bot-protection-fingerprint)
17
- - [concurrent](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/concurrent)
17
+ - [concurrent](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/concurrent) *(deprecated, now available [here](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/client-fetch/src/plugins/concurrent))*
18
18
  - [core](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/core)
19
19
  - [client-facts](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/client-facts)
20
20
  - [custom-info](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/custom-info)
@@ -22,30 +22,30 @@ Please refer to the [ama-sdk-schematics](../schematics/README.md) package for ge
22
22
  - [fetch-cache](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/fetch-cache)
23
23
  - [fetch-credentials](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/fetch-credentials)
24
24
  - [json-token](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/json-token)
25
- - [keepalive](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/keepalive)
25
+ - [keepalive](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/keepalive) *(deprecated, now available [here](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/client-fetch/src/plugins/keepalive))*
26
26
  - [mock-intercept](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/mock-intercept)
27
- - [perf-metric](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/perf-metric)
27
+ - [perf-metric](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/perf-metric) *(deprecated, now available [here](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/client-fetch/src/plugins/perf-metric))*
28
28
  - [pii-tokenizer](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/pii-tokenizer)
29
29
  - [raw-response-info](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/raw-response-info)
30
- - [retry](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/retry)
30
+ - [retry](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/retry) *(deprecated, now available [here](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/client-fetch/src/plugins/retry))*
31
31
  - [reviver](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/reviver)
32
32
  - [session-id](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/session-id)
33
33
  - [si-token](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/si-token)
34
34
  - [simple-api-key-authentication](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/simple-api-key-authentication)
35
35
  - [url-rewrite](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/url-rewrite)
36
- - [wait-for](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/wait-for)
37
- - [timeout](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/timeout)
36
+ - [timeout](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/timeout) *(deprecated, now available [here](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/client-fetch/src/plugins/timeout))*
37
+ - [wait-for](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins/wait-for) *(deprecated, now available [here](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/client-fetch/src/plugins/wait-for))*
38
38
 
39
39
  ## Available API Client
40
40
 
41
41
  The **API Clients** are mandatory to the SDK to indicate the service that should be used by the SDK to process the calls.
42
42
  A list of API Clients are provided by this package:
43
43
 
44
- | API Client | Import | Description |
45
- |------------------|------------------------------------------|--------------------------------------------------------------------------------|
46
- | ApiFetchClient | @ama-sdk/core | Default API Client based on the browser FetchApi |
47
- | ApiBeaconClient | @ama-sdk/core | API Client based on the browser BeaconApi, it is processing synchronous call |
48
- | ApiAngularClient | @ama-sdk/core/clients/api-angular-client | API Client using the HttpClient exposed by the `@angular/common` package |
44
+ | API Client | Import | Description |
45
+ | ---------------- | ------------------------------------------------------------------------ | ---------------------------------------------------------------------------- |
46
+ | ApiFetchClient | [@ama-sdk/client-fetch](https://npmjs.com/package/@ama-sdk/client-fetch) | Default API Client based on the browser FetchApi |
47
+ | ApiBeaconClient | @ama-sdk/core | API Client based on the browser BeaconApi, it is processing synchronous call |
48
+ | ApiAngularClient | @ama-sdk/core/clients/api-angular-client | API Client using the HttpClient exposed by the `@angular/common` package |
49
49
 
50
50
  ### Logs
51
51
 
@@ -70,15 +70,3 @@ function petApiFactory() {
70
70
  ```
71
71
 
72
72
  > *Note*: Adding a third-party logging service is optional. If undefined, the fallback is the console logger.
73
-
74
- ### CLI
75
-
76
- This package also comes with CLI scripts that can facilitate the upgrade and publication of an SDK.
77
- Use --help on each command for more information
78
-
79
- | Script | Description |
80
- |-----------------------------|------------------------------------------------------------------------------------------------|
81
- | amasdk-clear-index | Remove the index files that are no longer necessary after the deletion of the associated model |
82
- | amasdk-files-pack | Prepare the dist folder for publication |
83
- | amasdk-update-spec-from-npm | Update the OpenAPI spec from an NPM package |
84
-
@@ -12,6 +12,14 @@ var _exception = require("../plugins/exception");
12
12
  var _reviver = require("../plugins/reviver");
13
13
  var _apihelpers = require("../fwk/api.helpers");
14
14
  var _errors = require("../fwk/errors");
15
+ function _array_like_to_array(arr, len) {
16
+ if (len == null || len > arr.length) len = arr.length;
17
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
18
+ return arr2;
19
+ }
20
+ function _array_without_holes(arr) {
21
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
22
+ }
15
23
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
16
24
  try {
17
25
  var info = gen[key](arg);
@@ -73,6 +81,12 @@ function _define_property(obj, key, value) {
73
81
  }
74
82
  return obj;
75
83
  }
84
+ function _iterable_to_array(iter) {
85
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
86
+ }
87
+ function _non_iterable_spread() {
88
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
89
+ }
76
90
  function _object_spread(target) {
77
91
  for(var i = 1; i < arguments.length; i++){
78
92
  var source = arguments[i] != null ? arguments[i] : {};
@@ -112,6 +126,17 @@ function _object_spread_props(target, source) {
112
126
  }
113
127
  return target;
114
128
  }
129
+ function _to_consumable_array(arr) {
130
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
131
+ }
132
+ function _unsupported_iterable_to_array(o, minLen) {
133
+ if (!o) return;
134
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
135
+ var n = Object.prototype.toString.call(o).slice(8, -1);
136
+ if (n === "Object" && o.constructor) n = o.constructor.name;
137
+ if (n === "Map" || n === "Set") return Array.from(n);
138
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
139
+ }
115
140
  function _ts_generator(thisArg, body) {
116
141
  var f, y, t, g, _ = {
117
142
  label: 0,
@@ -212,7 +237,7 @@ var DEFAULT_OPTIONS = {
212
237
  new _reviver.ReviverReply(),
213
238
  new _exception.ExceptionReply()
214
239
  ],
215
- // AngularPlugins: [],
240
+ angularPlugins: [],
216
241
  requestPlugins: [],
217
242
  enableTokenization: false,
218
243
  disableFallback: false
@@ -360,10 +385,45 @@ var ApiAngularClient = /*#__PURE__*/ function() {
360
385
  var data;
361
386
  var metadataSignal = (_options_metadata = options.metadata) === null || _options_metadata === void 0 ? void 0 : _options_metadata.signal;
362
387
  metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.throwIfAborted();
363
- var subscription = _this.options.httpClient.request(options.method, url, _object_spread_props(_object_spread({}, options), {
388
+ var loadedPlugins = [];
389
+ if (_this.options.angularPlugins) {
390
+ var _loadedPlugins;
391
+ (_loadedPlugins = loadedPlugins).push.apply(_loadedPlugins, _to_consumable_array(_this.options.angularPlugins.map(function(plugin) {
392
+ return plugin.load({
393
+ angularPlugins: loadedPlugins,
394
+ apiClient: _this,
395
+ url: url,
396
+ apiName: apiName,
397
+ requestOptions: options,
398
+ logger: _this.options.logger
399
+ });
400
+ })));
401
+ }
402
+ var httpRequest = _this.options.httpClient.request(options.method, url, _object_spread_props(_object_spread({}, options), {
364
403
  observe: 'response',
365
404
  headers: headers
366
- })).subscribe({
405
+ }));
406
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
407
+ try {
408
+ for(var _iterator = loadedPlugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
409
+ var plugin = _step.value;
410
+ httpRequest = plugin.transform(httpRequest);
411
+ }
412
+ } catch (err) {
413
+ _didIteratorError = true;
414
+ _iteratorError = err;
415
+ } finally{
416
+ try {
417
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
418
+ _iterator.return();
419
+ }
420
+ } finally{
421
+ if (_didIteratorError) {
422
+ throw _iteratorError;
423
+ }
424
+ }
425
+ }
426
+ var subscription = httpRequest.subscribe({
367
427
  next: function(res) {
368
428
  return data = res;
369
429
  },
@@ -94,6 +94,7 @@ var DEFAULT_OPTIONS = {
94
94
  };
95
95
  /**
96
96
  * Determine if the given value is a promise
97
+ * @deprecated Use the one exposed by {@link @ama-sdk/client-beacon}, will be removed in v13
97
98
  * @param value The value to test
98
99
  */ // NOTE: the `extends unknown` is required for ESM build with TSC
99
100
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
@@ -403,7 +403,8 @@ var ApiFetchClient = /*#__PURE__*/ function() {
403
403
  fetchPlugins: loadedPlugins,
404
404
  controller: controller,
405
405
  apiClient: _this,
406
- logger: _this.options.logger
406
+ logger: _this.options.logger,
407
+ apiName: apiName
407
408
  });
408
409
  })));
409
410
  }
package/cjs/fwk/date.js CHANGED
@@ -36,6 +36,10 @@ function _assert_this_initialized(self) {
36
36
  }
37
37
  return self;
38
38
  }
39
+ function _call_super(_this, derived, args) {
40
+ derived = _get_prototype_of(derived);
41
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
42
+ }
39
43
  function _class_call_check(instance, Constructor) {
40
44
  if (!(instance instanceof Constructor)) {
41
45
  throw new TypeError("Cannot call a class as a function");
@@ -162,28 +166,12 @@ function _wrap_native_super(Class) {
162
166
  return _wrap_native_super(Class);
163
167
  }
164
168
  function _is_native_reflect_construct() {
165
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
166
- if (Reflect.construct.sham) return false;
167
- if (typeof Proxy === "function") return true;
168
169
  try {
169
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
170
- return true;
171
- } catch (e) {
172
- return false;
173
- }
174
- }
175
- function _create_super(Derived) {
176
- var hasNativeReflectConstruct = _is_native_reflect_construct();
177
- return function _createSuperInternal() {
178
- var Super = _get_prototype_of(Derived), result;
179
- if (hasNativeReflectConstruct) {
180
- var NewTarget = _get_prototype_of(this).constructor;
181
- result = Reflect.construct(Super, arguments, NewTarget);
182
- } else {
183
- result = Super.apply(this, arguments);
184
- }
185
- return _possible_constructor_return(this, result);
186
- };
170
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
171
+ } catch (_) {}
172
+ return (_is_native_reflect_construct = function() {
173
+ return !!result;
174
+ })();
187
175
  }
188
176
  var _NativeDateClass = Date;
189
177
  function pad(val) {
@@ -194,7 +182,6 @@ function pad(val) {
194
182
  var CommonDate = /*#__PURE__*/ function(Date1) {
195
183
  "use strict";
196
184
  _inherits(CommonDate, Date1);
197
- var _super = _create_super(CommonDate);
198
185
  function CommonDate() {
199
186
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
200
187
  args[_key] = arguments[_key];
@@ -223,9 +210,7 @@ var CommonDate = /*#__PURE__*/ function(Date1) {
223
210
  args[0] = args[0];
224
211
  }
225
212
  }
226
- return _super.call.apply(_super, [
227
- this
228
- ].concat(_to_consumable_array(args)));
213
+ return _call_super(this, CommonDate, _to_consumable_array(args));
229
214
  }
230
215
  _create_class(CommonDate, [
231
216
  {
@@ -244,7 +229,6 @@ var utils;
244
229
  'use strict';
245
230
  var _$Date = /*#__PURE__*/ function(CommonDate) {
246
231
  _inherits(Date1, CommonDate);
247
- var _super = _create_super(Date1);
248
232
  function Date1() {
249
233
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
250
234
  args[_key] = arguments[_key];
@@ -255,9 +239,7 @@ var utils;
255
239
  } else if (_instanceof(args[0], _NativeDateClass)) {
256
240
  args[0] = "".concat(args[0].getFullYear(), "-").concat(pad(args[0].getMonth() + 1), "-").concat(pad(args[0].getDate()), "T00:00:00Z");
257
241
  }
258
- return _super.call.apply(_super, [
259
- this
260
- ].concat(_to_consumable_array(args)));
242
+ return _call_super(this, Date1, _to_consumable_array(args));
261
243
  }
262
244
  _create_class(Date1, [
263
245
  {
@@ -294,15 +276,12 @@ var utils;
294
276
  utils.Date = _$Date;
295
277
  var DateTime = /*#__PURE__*/ function(CommonDate) {
296
278
  _inherits(DateTime, CommonDate);
297
- var _super = _create_super(DateTime);
298
279
  function DateTime() {
299
280
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
300
281
  args[_key] = arguments[_key];
301
282
  }
302
283
  _class_call_check(this, DateTime);
303
- return _super.call.apply(_super, [
304
- this
305
- ].concat(_to_consumable_array(args)));
284
+ return _call_super(this, DateTime, _to_consumable_array(args));
306
285
  }
307
286
  _create_class(DateTime, [
308
287
  {
package/cjs/fwk/errors.js CHANGED
@@ -36,6 +36,10 @@ function _assert_this_initialized(self) {
36
36
  }
37
37
  return self;
38
38
  }
39
+ function _call_super(_this, derived, args) {
40
+ derived = _get_prototype_of(derived);
41
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
42
+ }
39
43
  function _class_call_check(instance, Constructor) {
40
44
  if (!(instance instanceof Constructor)) {
41
45
  throw new TypeError("Cannot call a class as a function");
@@ -137,56 +141,41 @@ function _wrap_native_super(Class) {
137
141
  return _wrap_native_super(Class);
138
142
  }
139
143
  function _is_native_reflect_construct() {
140
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
141
- if (Reflect.construct.sham) return false;
142
- if (typeof Proxy === "function") return true;
143
144
  try {
144
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
145
- return true;
146
- } catch (e) {
147
- return false;
148
- }
149
- }
150
- function _create_super(Derived) {
151
- var hasNativeReflectConstruct = _is_native_reflect_construct();
152
- return function _createSuperInternal() {
153
- var Super = _get_prototype_of(Derived), result;
154
- if (hasNativeReflectConstruct) {
155
- var NewTarget = _get_prototype_of(this).constructor;
156
- result = Reflect.construct(Super, arguments, NewTarget);
157
- } else {
158
- result = Super.apply(this, arguments);
159
- }
160
- return _possible_constructor_return(this, result);
161
- };
145
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
146
+ } catch (_) {}
147
+ return (_is_native_reflect_construct = function() {
148
+ return !!result;
149
+ })();
162
150
  }
163
151
  var GenericError = /*#__PURE__*/ function(Error1) {
164
152
  "use strict";
165
153
  _inherits(GenericError, Error1);
166
- var _super = _create_super(GenericError);
167
154
  function GenericError(message, context) {
168
155
  _class_call_check(this, GenericError);
169
156
  var httpRegexp = /^https?:\/\//;
170
157
  var baseUrl = (context === null || context === void 0 ? void 0 : context.url) ? context.url.replace(httpRegexp, '') : 'unknown';
171
158
  var origin = (context === null || context === void 0 ? void 0 : context.origin) ? context.origin.replace(httpRegexp, '') : 'unknown';
172
- return _super.call(this, context ? "[SDK] [apiName: ".concat(context.apiName || 'unknown', "] [operationId: ").concat(context.operationId || 'unknown', "] [baseUrl: ").concat(baseUrl, "] [origin: ").concat(origin, "] [errorType: SDK] ").concat(message) : "[SDK] ".concat(message));
159
+ return _call_super(this, GenericError, [
160
+ context ? "[SDK] [apiName: ".concat(context.apiName || 'unknown', "] [operationId: ").concat(context.operationId || 'unknown', "] [baseUrl: ").concat(baseUrl, "] [origin: ").concat(origin, "] [errorType: SDK] ").concat(message) : "[SDK] ".concat(message)
161
+ ]);
173
162
  }
174
163
  return GenericError;
175
164
  }(_wrap_native_super(Error));
176
165
  var RequestFailedError = /*#__PURE__*/ function(GenericError) {
177
166
  "use strict";
178
167
  _inherits(RequestFailedError, GenericError);
179
- var _super = _create_super(RequestFailedError);
180
168
  function RequestFailedError(message, statusCode, data, context) {
181
169
  _class_call_check(this, RequestFailedError);
182
170
  var _this;
183
- _this = _super.call(this, "[status: ".concat(statusCode, "] ").concat(message), context);
184
- /**
171
+ _this = _call_super(this, RequestFailedError, [
172
+ "[status: ".concat(statusCode, "] ").concat(message),
173
+ context
174
+ ]), /**
185
175
  * Request status code
186
- */ _define_property(_assert_this_initialized(_this), "statusCode", void 0);
187
- /**
176
+ */ _define_property(_this, "statusCode", void 0), /**
188
177
  * Data decoded from the response body
189
- */ _define_property(_assert_this_initialized(_this), "data", void 0);
178
+ */ _define_property(_this, "data", void 0);
190
179
  _this.statusCode = statusCode;
191
180
  _this.data = data;
192
181
  return _this;
@@ -196,14 +185,15 @@ var RequestFailedError = /*#__PURE__*/ function(GenericError) {
196
185
  var EmptyResponseError = /*#__PURE__*/ function(GenericError) {
197
186
  "use strict";
198
187
  _inherits(EmptyResponseError, GenericError);
199
- var _super = _create_super(EmptyResponseError);
200
188
  function EmptyResponseError(message, data, context) {
201
189
  _class_call_check(this, EmptyResponseError);
202
190
  var _this;
203
- _this = _super.call(this, "[Empty response] ".concat(message), context);
204
- /**
191
+ _this = _call_super(this, EmptyResponseError, [
192
+ "[Empty response] ".concat(message),
193
+ context
194
+ ]), /**
205
195
  * Data decoded from the response body
206
- */ _define_property(_assert_this_initialized(_this), "data", void 0);
196
+ */ _define_property(_this, "data", void 0);
207
197
  _this.data = data;
208
198
  return _this;
209
199
  }
@@ -212,37 +202,43 @@ var EmptyResponseError = /*#__PURE__*/ function(GenericError) {
212
202
  var ResponseTimeoutError = /*#__PURE__*/ function(GenericError) {
213
203
  "use strict";
214
204
  _inherits(ResponseTimeoutError, GenericError);
215
- var _super = _create_super(ResponseTimeoutError);
216
205
  function ResponseTimeoutError(message, context) {
217
206
  _class_call_check(this, ResponseTimeoutError);
218
- return _super.call(this, "[Response timeout] ".concat(message), context);
207
+ return _call_super(this, ResponseTimeoutError, [
208
+ "[Response timeout] ".concat(message),
209
+ context
210
+ ]);
219
211
  }
220
212
  return ResponseTimeoutError;
221
213
  }(GenericError);
222
214
  var ResponseJSONParseError = /*#__PURE__*/ function(RequestFailedError) {
223
215
  "use strict";
224
216
  _inherits(ResponseJSONParseError, RequestFailedError);
225
- var _super = _create_super(ResponseJSONParseError);
226
217
  function ResponseJSONParseError(message, httpStatus, bodyContent, context) {
227
218
  _class_call_check(this, ResponseJSONParseError);
228
- return _super.call(this, "[Response JSON parse error] ".concat(message), httpStatus, bodyContent, context);
219
+ return _call_super(this, ResponseJSONParseError, [
220
+ "[Response JSON parse error] ".concat(message),
221
+ httpStatus,
222
+ bodyContent,
223
+ context
224
+ ]);
229
225
  }
230
226
  return ResponseJSONParseError;
231
227
  }(RequestFailedError);
232
228
  var CanceledCallError = /*#__PURE__*/ function(GenericError) {
233
229
  "use strict";
234
230
  _inherits(CanceledCallError, GenericError);
235
- var _super = _create_super(CanceledCallError);
236
231
  function CanceledCallError(message, pluginIndex, pluginCanceling, context) {
237
232
  _class_call_check(this, CanceledCallError);
238
233
  var _this;
239
- _this = _super.call(this, "[Canceled call] ".concat(message), context);
240
- /**
234
+ _this = _call_super(this, CanceledCallError, [
235
+ "[Canceled call] ".concat(message),
236
+ context
237
+ ]), /**
241
238
  * First plugin canceling the call
242
- */ _define_property(_assert_this_initialized(_this), "pluginCanceling", void 0);
243
- /**
239
+ */ _define_property(_this, "pluginCanceling", void 0), /**
244
240
  * Index of the first plugin canceling the call
245
- */ _define_property(_assert_this_initialized(_this), "pluginIndex", void 0);
241
+ */ _define_property(_this, "pluginIndex", void 0);
246
242
  _this.pluginIndex = pluginIndex;
247
243
  _this.pluginCanceling = pluginCanceling;
248
244
  return _this;
@@ -15,6 +15,10 @@ function _assert_this_initialized(self) {
15
15
  }
16
16
  return self;
17
17
  }
18
+ function _call_super(_this, derived, args) {
19
+ derived = _get_prototype_of(derived);
20
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
21
+ }
18
22
  function _class_call_check(instance, Constructor) {
19
23
  if (!(instance instanceof Constructor)) {
20
24
  throw new TypeError("Cannot call a class as a function");
@@ -84,38 +88,20 @@ function _type_of(obj) {
84
88
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
85
89
  }
86
90
  function _is_native_reflect_construct() {
87
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
88
- if (Reflect.construct.sham) return false;
89
- if (typeof Proxy === "function") return true;
90
91
  try {
91
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
92
- return true;
93
- } catch (e) {
94
- return false;
95
- }
96
- }
97
- function _create_super(Derived) {
98
- var hasNativeReflectConstruct = _is_native_reflect_construct();
99
- return function _createSuperInternal() {
100
- var Super = _get_prototype_of(Derived), result;
101
- if (hasNativeReflectConstruct) {
102
- var NewTarget = _get_prototype_of(this).constructor;
103
- result = Reflect.construct(Super, arguments, NewTarget);
104
- } else {
105
- result = Super.apply(this, arguments);
106
- }
107
- return _possible_constructor_return(this, result);
108
- };
92
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
93
+ } catch (_) {}
94
+ return (_is_native_reflect_construct = function() {
95
+ return !!result;
96
+ })();
109
97
  }
110
98
  var RandomMockAdapter = /*#__PURE__*/ function(BaseMockAdapter) {
111
99
  "use strict";
112
100
  _inherits(RandomMockAdapter, BaseMockAdapter);
113
- var _super = _create_super(RandomMockAdapter);
114
101
  function RandomMockAdapter() {
115
102
  _class_call_check(this, RandomMockAdapter);
116
103
  var _this;
117
- _this = _super.apply(this, arguments);
118
- _define_property(_assert_this_initialized(_this), "cache", {});
104
+ _this = _call_super(this, RandomMockAdapter, arguments), _define_property(_this, "cache", {});
119
105
  return _this;
120
106
  }
121
107
  _create_class(RandomMockAdapter, [
@@ -15,6 +15,10 @@ function _assert_this_initialized(self) {
15
15
  }
16
16
  return self;
17
17
  }
18
+ function _call_super(_this, derived, args) {
19
+ derived = _get_prototype_of(derived);
20
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
21
+ }
18
22
  function _class_call_check(instance, Constructor) {
19
23
  if (!(instance instanceof Constructor)) {
20
24
  throw new TypeError("Cannot call a class as a function");
@@ -84,38 +88,20 @@ function _type_of(obj) {
84
88
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
85
89
  }
86
90
  function _is_native_reflect_construct() {
87
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
88
- if (Reflect.construct.sham) return false;
89
- if (typeof Proxy === "function") return true;
90
91
  try {
91
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
92
- return true;
93
- } catch (e) {
94
- return false;
95
- }
96
- }
97
- function _create_super(Derived) {
98
- var hasNativeReflectConstruct = _is_native_reflect_construct();
99
- return function _createSuperInternal() {
100
- var Super = _get_prototype_of(Derived), result;
101
- if (hasNativeReflectConstruct) {
102
- var NewTarget = _get_prototype_of(this).constructor;
103
- result = Reflect.construct(Super, arguments, NewTarget);
104
- } else {
105
- result = Super.apply(this, arguments);
106
- }
107
- return _possible_constructor_return(this, result);
108
- };
92
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
93
+ } catch (_) {}
94
+ return (_is_native_reflect_construct = function() {
95
+ return !!result;
96
+ })();
109
97
  }
110
98
  var SequentialMockAdapter = /*#__PURE__*/ function(BaseMockAdapter) {
111
99
  "use strict";
112
100
  _inherits(SequentialMockAdapter, BaseMockAdapter);
113
- var _super = _create_super(SequentialMockAdapter);
114
101
  function SequentialMockAdapter() {
115
102
  _class_call_check(this, SequentialMockAdapter);
116
103
  var _this;
117
- _this = _super.apply(this, arguments);
118
- _define_property(_assert_this_initialized(_this), "operationCounter", {});
104
+ _this = _call_super(this, SequentialMockAdapter, arguments), _define_property(_this, "operationCounter", {});
119
105
  return _this;
120
106
  }
121
107
  _create_class(SequentialMockAdapter, [
@@ -208,7 +208,7 @@ var AdditionalParamsRequest = /*#__PURE__*/ function() {
208
208
  value: function load() {
209
209
  var _this = this;
210
210
  return {
211
- transform: function() {
211
+ transform: /*#__PURE__*/ function() {
212
212
  var _ref = _async_to_generator(function(data) {
213
213
  var queryParams, _tmp, headers, _tmp1, body, _tmp2;
214
214
  return _ts_generator(this, function(_state) {
@@ -180,7 +180,7 @@ var ApiConfigurationOverride = /*#__PURE__*/ function() {
180
180
  value: function load() {
181
181
  var _this = this;
182
182
  return {
183
- transform: function() {
183
+ transform: /*#__PURE__*/ function() {
184
184
  var _ref = _async_to_generator(function(data) {
185
185
  var jws;
186
186
  return _ts_generator(this, function(_state) {
@@ -180,7 +180,7 @@ var ApiKeyRequest = /*#__PURE__*/ function() {
180
180
  value: function load() {
181
181
  var _this = this;
182
182
  return {
183
- transform: function() {
183
+ transform: /*#__PURE__*/ function() {
184
184
  var _ref = _async_to_generator(function(data) {
185
185
  var apiKey, _tmp;
186
186
  return _ts_generator(this, function(_state) {
@@ -192,7 +192,7 @@ function impervaProtectionRetrieverFactory(protectionTimeout, tokenTimeout) {
192
192
  };
193
193
  });
194
194
  };
195
- return function() {
195
+ return /*#__PURE__*/ function() {
196
196
  var _ref = _async_to_generator(function(logger) {
197
197
  var e, e1;
198
198
  return _ts_generator(this, function(_state) {
@@ -358,7 +358,7 @@ var BotProtectionFingerprintRequest = /*#__PURE__*/ function() {
358
358
  value: /** @inheritdoc */ function load(context) {
359
359
  var _this = this;
360
360
  return {
361
- transform: function() {
361
+ transform: /*#__PURE__*/ function() {
362
362
  var _ref = _async_to_generator(function(requestOptions) {
363
363
  var fingerprint;
364
364
  return _ts_generator(this, function(_state) {
@@ -237,7 +237,7 @@ var ClientFactsRequestPlugin = /*#__PURE__*/ function() {
237
237
  value: function load() {
238
238
  var _this = this;
239
239
  return {
240
- transform: function() {
240
+ transform: /*#__PURE__*/ function() {
241
241
  var _ref = _async_to_generator(function(data) {
242
242
  var publicFacts, _tmp, _tmp1;
243
243
  return _ts_generator(this, function(_state) {
@@ -206,7 +206,7 @@ var ConcurrentFetch = /*#__PURE__*/ function() {
206
206
  return _this.canStart() ? resolve(true) : _this.waitingResolvers.push(resolve);
207
207
  });
208
208
  },
209
- transform: function() {
209
+ transform: /*#__PURE__*/ function() {
210
210
  var _ref = _async_to_generator(function(fetchCall) {
211
211
  var fetchResponse, e;
212
212
  return _ts_generator(this, function(_state) {