@ama-sdk/core 11.6.0-prerelease.2 → 11.6.0-prerelease.21
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 +12 -4
- package/cjs/clients/api-beacon-client.js +1 -2
- package/cjs/clients/api-fetch-client.js +15 -24
- package/cjs/fwk/api.helper.spec.js +1 -1
- package/cjs/fwk/api.helpers.js +20 -24
- package/cjs/fwk/core/api-client.js +2 -1
- package/cjs/fwk/core/index.js +1 -1
- package/cjs/fwk/date.js +26 -27
- package/cjs/fwk/date.spec.js +4 -2
- package/cjs/fwk/ignore-enum.type.js +1 -2
- package/cjs/fwk/index.js +1 -1
- package/cjs/fwk/mocks/alf-mock-adapter.js +7 -6
- package/cjs/fwk/mocks/base-mock-adapter.js +3 -3
- package/cjs/fwk/mocks/helpers.js +15 -7
- package/cjs/fwk/mocks/index.js +3 -3
- package/cjs/fwk/{Reviver.js → reviver.js} +1 -2
- package/cjs/fwk/reviver.spec.js +9 -9
- package/cjs/plugins/additional-params/index.js +1 -1
- package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +3 -3
- package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +7 -10
- package/cjs/plugins/client-facts/client-facts.request.js +5 -5
- package/cjs/plugins/concurrent/concurrent.fetch.js +5 -9
- package/cjs/plugins/core/index.js +2 -2
- package/cjs/plugins/custom-info/custom-info.reply.js +2 -2
- package/cjs/plugins/exception/exception.spec.js +1 -1
- package/cjs/plugins/fetch-cache/fetch-cache.request.js +1 -1
- package/cjs/plugins/fetch-credentials/fetch-credentials.spec.js +4 -4
- package/cjs/plugins/json-token/json-token.reply.js +6 -6
- package/cjs/plugins/json-token/json-token.request.js +1 -1
- package/cjs/plugins/json-token/json-token.spec.js +7 -9
- package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +0 -2
- package/cjs/plugins/mock-intercept/index.js +1 -1
- package/cjs/plugins/mock-intercept/mock-intercept.angular.js +4 -4
- package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +0 -2
- package/cjs/plugins/mock-intercept/mock-intercept.spec.js +5 -4
- package/cjs/plugins/perf-metric/perf-metric.fetch.js +10 -2
- package/cjs/plugins/pii-tokenizer/pii-tokenizer.request.js +5 -11
- package/cjs/plugins/pii-tokenizer/pii-tokenizer.spec.js +5 -6
- package/cjs/plugins/retry/retry.fetch.js +17 -32
- package/cjs/plugins/retry/retry.spec.js +4 -4
- package/cjs/plugins/session-id/session-id.request.js +4 -4
- package/cjs/plugins/session-id/session-id.spec.js +2 -2
- package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +1 -1
- package/cjs/plugins/timeout/timeout.fetch.js +14 -6
- package/cjs/plugins/wait-for/wait-for.fetch.js +3 -3
- package/cjs/plugins/wait-for/wait-for.spec.js +1 -1
- package/cjs/utils/crypto.js +7 -7
- package/cjs/utils/encoder.js +9 -17
- package/cjs/utils/generic-api.js +1 -2
- package/cjs/utils/ie11.js +1 -0
- package/cjs/utils/index.js +1 -1
- package/cjs/utils/json-token.js +7 -7
- package/cjs/utils/json-token.spec.js +14 -11
- package/cjs/utils/mime-types.js +1 -1
- package/esm2015/clients/api-angular-client.js +12 -4
- package/esm2015/clients/api-beacon-client.js +1 -2
- package/esm2015/clients/api-fetch-client.js +15 -24
- package/esm2015/fwk/api.helper.spec.js +1 -1
- package/esm2015/fwk/api.helpers.js +24 -30
- package/esm2015/fwk/core/api-client.js +2 -1
- package/esm2015/fwk/core/index.js +1 -1
- package/esm2015/fwk/date.js +30 -29
- package/esm2015/fwk/date.spec.js +4 -2
- package/esm2015/fwk/ignore-enum.type.js +1 -2
- package/esm2015/fwk/index.js +1 -1
- package/esm2015/fwk/mocks/alf-mock-adapter.js +7 -6
- package/esm2015/fwk/mocks/base-mock-adapter.js +3 -3
- package/esm2015/fwk/mocks/helpers.js +15 -7
- package/esm2015/fwk/mocks/index.js +3 -3
- package/esm2015/fwk/{Reviver.js → reviver.js} +2 -2
- package/esm2015/fwk/reviver.spec.js +1 -1
- package/esm2015/plugins/additional-params/index.js +1 -1
- package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +3 -3
- package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +7 -10
- package/esm2015/plugins/client-facts/client-facts.request.js +5 -5
- package/esm2015/plugins/concurrent/concurrent.fetch.js +5 -9
- package/esm2015/plugins/core/index.js +2 -2
- package/esm2015/plugins/custom-info/custom-info.reply.js +2 -2
- package/esm2015/plugins/exception/exception.spec.js +1 -1
- package/esm2015/plugins/fetch-cache/fetch-cache.request.js +1 -1
- package/esm2015/plugins/fetch-credentials/fetch-credentials.spec.js +4 -4
- package/esm2015/plugins/json-token/json-token.reply.js +6 -6
- package/esm2015/plugins/json-token/json-token.request.js +1 -1
- package/esm2015/plugins/json-token/json-token.spec.js +7 -9
- package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +0 -2
- package/esm2015/plugins/mock-intercept/index.js +1 -1
- package/esm2015/plugins/mock-intercept/mock-intercept.angular.js +4 -4
- package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +0 -2
- package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +5 -4
- package/esm2015/plugins/perf-metric/perf-metric.fetch.js +10 -2
- package/esm2015/plugins/pii-tokenizer/pii-tokenizer.request.js +5 -11
- package/esm2015/plugins/pii-tokenizer/pii-tokenizer.spec.js +5 -6
- package/esm2015/plugins/retry/retry.fetch.js +17 -32
- package/esm2015/plugins/retry/retry.spec.js +4 -4
- package/esm2015/plugins/session-id/session-id.request.js +4 -4
- package/esm2015/plugins/session-id/session-id.spec.js +2 -2
- package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +1 -1
- package/esm2015/plugins/timeout/timeout.fetch.js +15 -8
- package/esm2015/plugins/wait-for/wait-for.fetch.js +3 -3
- package/esm2015/plugins/wait-for/wait-for.spec.js +1 -1
- package/esm2015/utils/crypto.js +7 -7
- package/esm2015/utils/encoder.js +9 -17
- package/esm2015/utils/generic-api.js +1 -2
- package/esm2015/utils/ie11.js +1 -0
- package/esm2015/utils/index.js +1 -1
- package/esm2015/utils/json-token.js +7 -7
- package/esm2015/utils/json-token.spec.js +8 -10
- package/esm2015/utils/mime-types.js +1 -1
- package/package.json +19 -13
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +24 -26
- package/schematics/ng-add/schema.d.ts.map +1 -1
- package/src/clients/api-angular-client.d.ts +2 -2
- package/src/clients/api-angular-client.d.ts.map +1 -1
- package/src/clients/api-angular-client.js +11 -9
- package/src/clients/api-angular-client.js.map +1 -1
- package/src/clients/api-beacon-client.d.ts +1 -1
- package/src/clients/api-beacon-client.d.ts.map +1 -1
- package/src/clients/api-beacon-client.js +2 -3
- package/src/clients/api-beacon-client.js.map +1 -1
- package/src/clients/api-fetch-client.d.ts +2 -2
- package/src/clients/api-fetch-client.d.ts.map +1 -1
- package/src/clients/api-fetch-client.js +14 -21
- package/src/clients/api-fetch-client.js.map +1 -1
- package/src/fwk/api.helpers.d.ts +6 -8
- package/src/fwk/api.helpers.d.ts.map +1 -1
- package/src/fwk/api.helpers.js +22 -31
- package/src/fwk/api.helpers.js.map +1 -1
- package/src/fwk/api.interface.d.ts.map +1 -1
- package/src/fwk/core/api-client.d.ts +3 -3
- package/src/fwk/core/api-client.d.ts.map +1 -1
- package/src/fwk/core/api-client.js +8 -7
- package/src/fwk/core/api-client.js.map +1 -1
- package/src/fwk/core/base-api-constructor.d.ts +1 -1
- package/src/fwk/core/base-api-constructor.d.ts.map +1 -1
- package/src/fwk/core/base-api-constructor.js.map +1 -1
- package/src/fwk/core/index.d.ts +1 -1
- package/src/fwk/core/index.d.ts.map +1 -1
- package/src/fwk/core/index.js +1 -1
- package/src/fwk/core/index.js.map +1 -1
- package/src/fwk/date.d.ts +6 -18
- package/src/fwk/date.d.ts.map +1 -1
- package/src/fwk/date.js +25 -28
- package/src/fwk/date.js.map +1 -1
- package/src/fwk/errors.d.ts.map +1 -1
- package/src/fwk/errors.js.map +1 -1
- package/src/fwk/ignore-enum.type.d.ts.map +1 -1
- package/src/fwk/index.d.ts +1 -1
- package/src/fwk/index.js +1 -1
- package/src/fwk/mocks/alf-mock-adapter.d.ts.map +1 -1
- package/src/fwk/mocks/alf-mock-adapter.js +11 -10
- package/src/fwk/mocks/alf-mock-adapter.js.map +1 -1
- package/src/fwk/mocks/base-mock-adapter.d.ts.map +1 -1
- package/src/fwk/mocks/base-mock-adapter.js +4 -4
- package/src/fwk/mocks/base-mock-adapter.js.map +1 -1
- package/src/fwk/mocks/encoded-api-request.d.ts +1 -1
- package/src/fwk/mocks/encoded-api-request.d.ts.map +1 -1
- package/src/fwk/mocks/helpers.d.ts.map +1 -1
- package/src/fwk/mocks/helpers.js +8 -7
- package/src/fwk/mocks/helpers.js.map +1 -1
- package/src/fwk/mocks/index.d.ts +3 -3
- package/src/fwk/mocks/index.d.ts.map +1 -1
- package/src/fwk/mocks/index.js +3 -3
- package/src/fwk/mocks/index.js.map +1 -1
- package/src/fwk/mocks/mock-adapter.d.ts +1 -1
- package/src/fwk/mocks/mock-adapter.d.ts.map +1 -1
- package/src/fwk/mocks/path-object.d.ts.map +1 -1
- package/src/fwk/mocks/random-mock-adapter.d.ts.map +1 -1
- package/src/fwk/mocks/random-mock-adapter.js +1 -1
- package/src/fwk/mocks/random-mock-adapter.js.map +1 -1
- package/src/fwk/mocks/sequential-mock-adapter.d.ts.map +1 -1
- package/src/fwk/mocks/sequential-mock-adapter.js +1 -1
- package/src/fwk/mocks/sequential-mock-adapter.js.map +1 -1
- package/src/fwk/{Reviver.d.ts → reviver.d.ts} +2 -1
- package/src/fwk/reviver.d.ts.map +1 -0
- package/src/fwk/{Reviver.js → reviver.js} +3 -3
- package/src/fwk/reviver.js.map +1 -0
- package/src/plugins/abort/abort.fetch.d.ts.map +1 -1
- package/src/plugins/abort/abort.fetch.js.map +1 -1
- package/src/plugins/additional-params/additional-params-sync.request.d.ts.map +1 -1
- package/src/plugins/additional-params/additional-params-sync.request.js +1 -1
- package/src/plugins/additional-params/additional-params-sync.request.js.map +1 -1
- package/src/plugins/additional-params/additional-params.request.d.ts.map +1 -1
- package/src/plugins/additional-params/additional-params.request.js.map +1 -1
- package/src/plugins/additional-params/index.d.ts +1 -1
- package/src/plugins/additional-params/index.d.ts.map +1 -1
- package/src/plugins/additional-params/index.js +1 -1
- package/src/plugins/additional-params/index.js.map +1 -1
- package/src/plugins/api-configuration-override/api-configuration-override.request.d.ts.map +1 -1
- package/src/plugins/api-configuration-override/api-configuration-override.request.js.map +1 -1
- package/src/plugins/api-key/api-key.request.d.ts.map +1 -1
- package/src/plugins/api-key/api-key.request.js.map +1 -1
- package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.d.ts +10 -10
- package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.d.ts.map +1 -1
- package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +5 -5
- package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js.map +1 -1
- package/src/plugins/client-facts/client-facts.request.d.ts +1 -1
- package/src/plugins/client-facts/client-facts.request.d.ts.map +1 -1
- package/src/plugins/client-facts/client-facts.request.js +5 -5
- package/src/plugins/client-facts/client-facts.request.js.map +1 -1
- package/src/plugins/concurrent/concurrent.fetch.d.ts.map +1 -1
- package/src/plugins/concurrent/concurrent.fetch.js +1 -6
- package/src/plugins/concurrent/concurrent.fetch.js.map +1 -1
- package/src/plugins/core/angular-plugin.d.ts +1 -1
- package/src/plugins/core/angular-plugin.d.ts.map +1 -1
- package/src/plugins/core/fetch-plugin.d.ts.map +1 -1
- package/src/plugins/core/index.d.ts +2 -2
- package/src/plugins/core/index.d.ts.map +1 -1
- package/src/plugins/core/index.js +2 -2
- package/src/plugins/core/index.js.map +1 -1
- package/src/plugins/core/plugin.d.ts.map +1 -1
- package/src/plugins/core/reply-plugin.d.ts +1 -1
- package/src/plugins/core/reply-plugin.d.ts.map +1 -1
- package/src/plugins/core/request-plugin.d.ts.map +1 -1
- package/src/plugins/custom-info/custom-info.reply.d.ts.map +1 -1
- package/src/plugins/custom-info/custom-info.reply.js +1 -1
- package/src/plugins/custom-info/custom-info.reply.js.map +1 -1
- package/src/plugins/exception/exception.reply.d.ts +1 -0
- package/src/plugins/exception/exception.reply.d.ts.map +1 -1
- package/src/plugins/exception/exception.reply.js +6 -5
- package/src/plugins/exception/exception.reply.js.map +1 -1
- package/src/plugins/fetch-cache/fetch-cache.request.d.ts.map +1 -1
- package/src/plugins/fetch-cache/fetch-cache.request.js +3 -3
- package/src/plugins/fetch-cache/fetch-cache.request.js.map +1 -1
- package/src/plugins/fetch-credentials/fetch-credentials.request.d.ts.map +1 -1
- package/src/plugins/fetch-credentials/fetch-credentials.request.js.map +1 -1
- package/src/plugins/json-token/json-token.reply.d.ts.map +1 -1
- package/src/plugins/json-token/json-token.reply.js +6 -6
- package/src/plugins/json-token/json-token.reply.js.map +1 -1
- package/src/plugins/json-token/json-token.request.d.ts.map +1 -1
- package/src/plugins/json-token/json-token.request.js +1 -1
- package/src/plugins/json-token/json-token.request.js.map +1 -1
- package/src/plugins/keepalive/keepalive.request.d.ts.map +1 -1
- package/src/plugins/keepalive/keepalive.request.js +1 -1
- package/src/plugins/keepalive/keepalive.request.js.map +1 -1
- package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.d.ts.map +1 -1
- package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +3 -3
- package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js.map +1 -1
- package/src/plugins/mock-intercept/index.d.ts +1 -1
- package/src/plugins/mock-intercept/index.d.ts.map +1 -1
- package/src/plugins/mock-intercept/index.js +1 -1
- package/src/plugins/mock-intercept/index.js.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.angular.d.ts +1 -1
- package/src/plugins/mock-intercept/mock-intercept.angular.d.ts.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.angular.js +15 -11
- package/src/plugins/mock-intercept/mock-intercept.angular.js.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.fetch.d.ts.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.fetch.js +4 -6
- package/src/plugins/mock-intercept/mock-intercept.fetch.js.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.interface.d.ts +1 -1
- package/src/plugins/mock-intercept/mock-intercept.interface.d.ts.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.interface.js.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.request.d.ts.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.request.js +4 -3
- package/src/plugins/mock-intercept/mock-intercept.request.js.map +1 -1
- package/src/plugins/perf-metric/perf-metric.fetch.d.ts.map +1 -1
- package/src/plugins/perf-metric/perf-metric.fetch.js +4 -3
- package/src/plugins/perf-metric/perf-metric.fetch.js.map +1 -1
- package/src/plugins/pii-tokenizer/pii-tokenizer.request.d.ts.map +1 -1
- package/src/plugins/pii-tokenizer/pii-tokenizer.request.js +5 -10
- package/src/plugins/pii-tokenizer/pii-tokenizer.request.js.map +1 -1
- package/src/plugins/raw-response-info/raw-response-info.reply.d.ts +0 -1
- package/src/plugins/raw-response-info/raw-response-info.reply.d.ts.map +1 -1
- package/src/plugins/raw-response-info/raw-response-info.reply.js +0 -1
- package/src/plugins/raw-response-info/raw-response-info.reply.js.map +1 -1
- package/src/plugins/retry/retry.fetch.d.ts.map +1 -1
- package/src/plugins/retry/retry.fetch.js +5 -4
- package/src/plugins/retry/retry.fetch.js.map +1 -1
- package/src/plugins/reviver/reviver.reply.d.ts +1 -1
- package/src/plugins/reviver/reviver.reply.d.ts.map +1 -1
- package/src/plugins/reviver/reviver.reply.js.map +1 -1
- package/src/plugins/session-id/session-id.request.d.ts +1 -1
- package/src/plugins/session-id/session-id.request.d.ts.map +1 -1
- package/src/plugins/session-id/session-id.request.js +5 -3
- package/src/plugins/session-id/session-id.request.js.map +1 -1
- package/src/plugins/si-token/si-token.request.d.ts.map +1 -1
- package/src/plugins/si-token/si-token.request.js +1 -1
- package/src/plugins/si-token/si-token.request.js.map +1 -1
- package/src/plugins/simple-api-key-authentication/simple-api-key-authentication.request.d.ts.map +1 -1
- package/src/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +1 -1
- package/src/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js.map +1 -1
- package/src/plugins/timeout/timeout.fetch.d.ts +1 -2
- package/src/plugins/timeout/timeout.fetch.d.ts.map +1 -1
- package/src/plugins/timeout/timeout.fetch.js +14 -12
- package/src/plugins/timeout/timeout.fetch.js.map +1 -1
- package/src/plugins/url-rewrite/url-rewrite.request.d.ts.map +1 -1
- package/src/plugins/url-rewrite/url-rewrite.request.js.map +1 -1
- package/src/plugins/wait-for/wait-for.fetch.d.ts.map +1 -1
- package/src/plugins/wait-for/wait-for.fetch.js +2 -2
- package/src/plugins/wait-for/wait-for.fetch.js.map +1 -1
- package/src/utils/crypto.d.ts.map +1 -1
- package/src/utils/crypto.js +7 -7
- package/src/utils/crypto.js.map +1 -1
- package/src/utils/encoder.d.ts +1 -1
- package/src/utils/encoder.d.ts.map +1 -1
- package/src/utils/encoder.js +22 -28
- package/src/utils/encoder.js.map +1 -1
- package/src/utils/generic-api.d.ts +1 -2
- package/src/utils/generic-api.d.ts.map +1 -1
- package/src/utils/generic-api.js +3 -6
- package/src/utils/generic-api.js.map +1 -1
- package/src/utils/ie11.d.ts.map +1 -1
- package/src/utils/ie11.js +1 -0
- package/src/utils/ie11.js.map +1 -1
- package/src/utils/index.d.ts +1 -1
- package/src/utils/index.d.ts.map +1 -1
- package/src/utils/index.js +1 -1
- package/src/utils/index.js.map +1 -1
- package/src/utils/json-token.d.ts.map +1 -1
- package/src/utils/json-token.js +12 -12
- package/src/utils/json-token.js.map +1 -1
- package/src/utils/mime-types.d.ts.map +1 -1
- package/src/utils/mime-types.js +1 -1
- package/src/utils/mime-types.js.map +1 -1
- package/src/fwk/Reviver.d.ts.map +0 -1
- package/src/fwk/Reviver.js.map +0 -1
|
@@ -224,38 +224,23 @@ var RetryFetch = /*#__PURE__*/ function() {
|
|
|
224
224
|
value: function delay(countDown) {
|
|
225
225
|
var _this = this;
|
|
226
226
|
return _async_to_generator(function() {
|
|
227
|
+
var time;
|
|
227
228
|
return _ts_generator(this, function(_state) {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
];
|
|
244
|
-
case 1:
|
|
245
|
-
return [
|
|
246
|
-
2,
|
|
247
|
-
setTimeout.apply(void 0, _tmp.concat([
|
|
248
|
-
_state.sent()
|
|
249
|
-
]))
|
|
250
|
-
];
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
return function(resolve) {
|
|
255
|
-
return _ref.apply(this, arguments);
|
|
256
|
-
};
|
|
257
|
-
}())
|
|
258
|
-
];
|
|
229
|
+
switch(_state.label){
|
|
230
|
+
case 0:
|
|
231
|
+
return [
|
|
232
|
+
4,
|
|
233
|
+
_this.sleepBetweenRetry(countDown)
|
|
234
|
+
];
|
|
235
|
+
case 1:
|
|
236
|
+
time = _state.sent();
|
|
237
|
+
return [
|
|
238
|
+
2,
|
|
239
|
+
new Promise(function(resolve) {
|
|
240
|
+
return setTimeout(resolve, time);
|
|
241
|
+
})
|
|
242
|
+
];
|
|
243
|
+
}
|
|
259
244
|
});
|
|
260
245
|
})();
|
|
261
246
|
}
|
|
@@ -338,7 +323,7 @@ var RetryFetch = /*#__PURE__*/ function() {
|
|
|
338
323
|
];
|
|
339
324
|
return [
|
|
340
325
|
4,
|
|
341
|
-
_this.condition(context, undefined, e)
|
|
326
|
+
_this.condition(context, undefined, _instanceof(e, Error) ? e : new Error(e.toString()))
|
|
342
327
|
];
|
|
343
328
|
case 5:
|
|
344
329
|
conditionResult1 = _state.sent();
|
|
@@ -206,10 +206,10 @@ describe('Retry Fetch Plugin', function() {
|
|
|
206
206
|
fetchPlugins: runners
|
|
207
207
|
});
|
|
208
208
|
runners.push(runner);
|
|
209
|
-
call = Promise.reject({
|
|
209
|
+
call = Promise.reject(new Error(JSON.stringify({
|
|
210
210
|
text: 'test',
|
|
211
211
|
ok: true
|
|
212
|
-
});
|
|
212
|
+
})));
|
|
213
213
|
callback = jest.fn();
|
|
214
214
|
runner.transform(call).catch(callback);
|
|
215
215
|
return [
|
|
@@ -242,10 +242,10 @@ describe('Retry Fetch Plugin', function() {
|
|
|
242
242
|
fetchPlugins: runners
|
|
243
243
|
});
|
|
244
244
|
runners.push(runner);
|
|
245
|
-
call = Promise.reject({
|
|
245
|
+
call = Promise.reject(new Error(JSON.stringify({
|
|
246
246
|
text: 'test',
|
|
247
247
|
ok: true
|
|
248
|
-
});
|
|
248
|
+
})));
|
|
249
249
|
callback = jest.fn();
|
|
250
250
|
runner.transform(call).catch(callback);
|
|
251
251
|
return [
|
|
@@ -65,9 +65,9 @@ var SessionIdRequest = /*#__PURE__*/ function() {
|
|
|
65
65
|
{
|
|
66
66
|
key: "logSessionId",
|
|
67
67
|
value: function logSessionId(sessionId, date, logger) {
|
|
68
|
-
((logger === null || logger === void 0 ? void 0 : logger.info) || (logger === null || logger === void 0 ? void 0 : logger.log) || console.info).bind(logger || console)('Your debug ID associated to the header "'.concat(this.sessionIdHeader, '" is: ').concat(sessionId, "."));
|
|
68
|
+
/* eslint-disable no-console -- console are default value */ ((logger === null || logger === void 0 ? void 0 : logger.info) || (logger === null || logger === void 0 ? void 0 : logger.log) || console.info).bind(logger || console)('Your debug ID associated to the header "'.concat(this.sessionIdHeader, '" is: ').concat(sessionId, "."));
|
|
69
69
|
((logger === null || logger === void 0 ? void 0 : logger.info) || (logger === null || logger === void 0 ? void 0 : logger.log) || console.info).bind(logger || console)("Generated at: ".concat(date));
|
|
70
|
-
}
|
|
70
|
+
/* eslint-enable no-console */ }
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
73
|
key: "load",
|
|
@@ -127,12 +127,12 @@ var SessionIdRequest = /*#__PURE__*/ function() {
|
|
|
127
127
|
* Generates a request ID.
|
|
128
128
|
*/ function generateRequestId() {
|
|
129
129
|
var requestCountKey = this.sessionIdHeader + '-Request-Count';
|
|
130
|
-
var requestCount = NaN;
|
|
130
|
+
var requestCount = Number.NaN;
|
|
131
131
|
// Check if we already have a request count in the shared memory or session storage
|
|
132
132
|
if (SessionIdRequest.sharedMemory[requestCountKey] !== undefined) {
|
|
133
133
|
requestCount = SessionIdRequest.sharedMemory[requestCountKey];
|
|
134
134
|
} else if (typeof sessionStorage !== 'undefined') {
|
|
135
|
-
requestCount = +(sessionStorage.getItem(requestCountKey) || NaN);
|
|
135
|
+
requestCount = +(sessionStorage.getItem(requestCountKey) || Number.NaN);
|
|
136
136
|
}
|
|
137
137
|
// If the request count is not defined yet or if it has been corrupted somehow, we start at 0.
|
|
138
138
|
requestCount = requestCount + 1 || 0;
|
|
@@ -208,7 +208,7 @@ describe('Session ID Request Plugin', function() {
|
|
|
208
208
|
];
|
|
209
209
|
case 1:
|
|
210
210
|
_state.sent();
|
|
211
|
-
expect(sessionId).toMatch(/[
|
|
211
|
+
expect(sessionId).toMatch(/[\dA-Za-z-]{10,48}/);
|
|
212
212
|
expect(options.headers.get('Ama-Client-Ref')).toMatch(new RegExp(sessionId + ':[0-9a-zA-Z]{1,10}'));
|
|
213
213
|
return [
|
|
214
214
|
2
|
|
@@ -230,7 +230,7 @@ describe('Session ID Request Plugin', function() {
|
|
|
230
230
|
];
|
|
231
231
|
case 1:
|
|
232
232
|
_state.sent();
|
|
233
|
-
expect(sessionId).toMatch(/[
|
|
233
|
+
expect(sessionId).toMatch(/[\dA-Za-z-]{10,48}/);
|
|
234
234
|
expect(options.headers.get(TEST_KEY)).toEqual(sessionId);
|
|
235
235
|
return [
|
|
236
236
|
2
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
var _simpleapikeyauthenticationrequest = require("./simple-api-key-authentication.request");
|
|
6
5
|
var _jsontoken = require("../../utils/json-token");
|
|
6
|
+
var _simpleapikeyauthenticationrequest = require("./simple-api-key-authentication.request");
|
|
7
7
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
8
8
|
try {
|
|
9
9
|
var info = gen[key](arg);
|
|
@@ -78,6 +78,13 @@ function _define_property(obj, key, value) {
|
|
|
78
78
|
}
|
|
79
79
|
return obj;
|
|
80
80
|
}
|
|
81
|
+
function _instanceof(left, right) {
|
|
82
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
83
|
+
return !!right[Symbol.hasInstance](left);
|
|
84
|
+
} else {
|
|
85
|
+
return left instanceof right;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
81
88
|
function _type_of(obj) {
|
|
82
89
|
"@swc/helpers - typeof";
|
|
83
90
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
@@ -181,16 +188,17 @@ function _ts_generator(thisArg, body) {
|
|
|
181
188
|
* Check if a message can be cast as an {@link ImpervaCaptchaMessage}
|
|
182
189
|
* @param message
|
|
183
190
|
*/ function isImpervaCaptchaMessage(message) {
|
|
184
|
-
|
|
191
|
+
var impervaCaptchaMessage = message;
|
|
192
|
+
return !!impervaCaptchaMessage && Object.prototype.hasOwnProperty.call(impervaCaptchaMessage, 'impervaChallenge') && Object.prototype.hasOwnProperty.call(impervaCaptchaMessage.impervaChallenge, 'status') && Object.prototype.hasOwnProperty.call(impervaCaptchaMessage.impervaChallenge, 'type') && impervaCaptchaMessage.impervaChallenge.type === 'captcha';
|
|
185
193
|
}
|
|
186
194
|
var impervaCaptchaEventHandlerFactory = function(config) {
|
|
187
195
|
return function(timeoutPauseCallback) {
|
|
188
196
|
var onImpervaCaptcha = function(event) {
|
|
189
197
|
var originHostname = new URL(event.origin).hostname;
|
|
190
|
-
if (originHostname !== location.hostname && ((config === null || config === void 0 ? void 0 : config.whiteListedHostNames) || []).
|
|
198
|
+
if (originHostname !== location.hostname && !((config === null || config === void 0 ? void 0 : config.whiteListedHostNames) || []).includes(originHostname)) {
|
|
191
199
|
return;
|
|
192
200
|
}
|
|
193
|
-
var message = event.data;
|
|
201
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment -- type is checked below */ var message = event.data;
|
|
194
202
|
if (typeof event.data === 'string') {
|
|
195
203
|
try {
|
|
196
204
|
message = JSON.parse(event.data);
|
|
@@ -201,7 +209,7 @@ var impervaCaptchaEventHandlerFactory = function(config) {
|
|
|
201
209
|
if ((typeof message === "undefined" ? "undefined" : _type_of(message)) === 'object' && isImpervaCaptchaMessage(message)) {
|
|
202
210
|
timeoutPauseCallback(message.impervaChallenge.status === 'started' ? 'timeoutStopped' : 'timeoutStarted');
|
|
203
211
|
}
|
|
204
|
-
};
|
|
212
|
+
/* eslint-enable @typescript-eslint/no-unsafe-assignment */ };
|
|
205
213
|
addEventListener('message', onImpervaCaptcha);
|
|
206
214
|
return function() {
|
|
207
215
|
removeEventListener('message', onImpervaCaptcha);
|
|
@@ -238,7 +246,7 @@ var TimeoutFetch = /*#__PURE__*/ function() {
|
|
|
238
246
|
var _this = this;
|
|
239
247
|
return {
|
|
240
248
|
transform: function(fetchCall) {
|
|
241
|
-
return(// eslint-disable-next-line no-async-promise-executor
|
|
249
|
+
return(// eslint-disable-next-line no-async-promise-executor -- all await are handled with a try-catch block
|
|
242
250
|
new Promise(/*#__PURE__*/ function() {
|
|
243
251
|
var _ref = _async_to_generator(function(resolve, reject) {
|
|
244
252
|
var timeoutCallback, timer, timerCallback, _context_controller, response, ex;
|
|
@@ -286,7 +294,7 @@ var TimeoutFetch = /*#__PURE__*/ function() {
|
|
|
286
294
|
];
|
|
287
295
|
case 3:
|
|
288
296
|
ex = _state.sent();
|
|
289
|
-
reject(ex);
|
|
297
|
+
reject(_instanceof(ex, Error) ? ex : new Error(ex.toString()));
|
|
290
298
|
return [
|
|
291
299
|
3,
|
|
292
300
|
5
|
|
@@ -221,11 +221,11 @@ var WaitForFetch = /*#__PURE__*/ function() {
|
|
|
221
221
|
var data;
|
|
222
222
|
var _this = this;
|
|
223
223
|
return {
|
|
224
|
-
// eslint-disable-next-line no-async-promise-executor
|
|
224
|
+
// eslint-disable-next-line no-async-promise-executor -- all await are handled with a try-catch block
|
|
225
225
|
canStart: function() {
|
|
226
226
|
return new Promise(/*#__PURE__*/ function() {
|
|
227
227
|
var _ref = _async_to_generator(function(resolve) {
|
|
228
|
-
var didTimeOut, timer, canStartCondition, canStart,
|
|
228
|
+
var didTimeOut, timer, canStartCondition, canStart, e;
|
|
229
229
|
return _ts_generator(this, function(_state) {
|
|
230
230
|
switch(_state.label){
|
|
231
231
|
case 0:
|
|
@@ -265,7 +265,7 @@ var WaitForFetch = /*#__PURE__*/ function() {
|
|
|
265
265
|
6
|
|
266
266
|
];
|
|
267
267
|
case 4:
|
|
268
|
-
|
|
268
|
+
e = _state.sent();
|
|
269
269
|
if (!didTimeOut) {
|
|
270
270
|
resolve(false);
|
|
271
271
|
}
|
|
@@ -347,7 +347,7 @@ describe('Wait For Fetch Plugin', function() {
|
|
|
347
347
|
response = {
|
|
348
348
|
test: true
|
|
349
349
|
};
|
|
350
|
-
fetchCall = Promise.reject(response);
|
|
350
|
+
fetchCall = Promise.reject(new Error(JSON.stringify(response)));
|
|
351
351
|
_state.label = 1;
|
|
352
352
|
case 1:
|
|
353
353
|
_state.trys.push([
|
package/cjs/utils/crypto.js
CHANGED
|
@@ -242,18 +242,18 @@ function _encryptPayload() {
|
|
|
242
242
|
if (additionalAuthenticatedData) {
|
|
243
243
|
aesParams.additionalData = additionalAuthenticatedData;
|
|
244
244
|
}
|
|
245
|
-
if (!(typeof window.msCrypto
|
|
245
|
+
if (!(typeof window.msCrypto === 'undefined')) return [
|
|
246
246
|
3,
|
|
247
247
|
2
|
|
248
248
|
];
|
|
249
249
|
return [
|
|
250
250
|
4,
|
|
251
|
-
|
|
251
|
+
window.crypto.subtle.encrypt(aesParams, key, payload)
|
|
252
252
|
];
|
|
253
253
|
case 1:
|
|
254
254
|
aesOutput = _state.sent();
|
|
255
|
-
ciphertext = aesOutput.
|
|
256
|
-
authenticationTag = aesOutput.
|
|
255
|
+
ciphertext = aesOutput.slice(0, -authenticationTagLength / 8);
|
|
256
|
+
authenticationTag = aesOutput.slice(-authenticationTagLength / 8);
|
|
257
257
|
return [
|
|
258
258
|
3,
|
|
259
259
|
4
|
|
@@ -261,12 +261,12 @@ function _encryptPayload() {
|
|
|
261
261
|
case 2:
|
|
262
262
|
return [
|
|
263
263
|
4,
|
|
264
|
-
window.
|
|
264
|
+
(0, _ie11.promisifyMsCrypto)(window.msCrypto.subtle.encrypt(aesParams, key, payload))
|
|
265
265
|
];
|
|
266
266
|
case 3:
|
|
267
267
|
aesOutput1 = _state.sent();
|
|
268
|
-
ciphertext = aesOutput1.
|
|
269
|
-
authenticationTag = aesOutput1.
|
|
268
|
+
ciphertext = aesOutput1.ciphertext;
|
|
269
|
+
authenticationTag = aesOutput1.tag;
|
|
270
270
|
_state.label = 4;
|
|
271
271
|
case 4:
|
|
272
272
|
return [
|
package/cjs/utils/encoder.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The content of this file is inspired from https://github.com/inexorabletash/text-encoding/blob/master/lib/encoding.js
|
|
1
|
+
/* eslint-disable @stylistic/brace-style -- explication with inline comments */ /* eslint-disable no-bitwise -- working on bytes */ // The content of this file is inspired from https://github.com/inexorabletash/text-encoding/blob/master/lib/encoding.js
|
|
2
2
|
// in order to support UTF8 strings encoding in case TextEncoder is not available
|
|
3
3
|
/**
|
|
4
4
|
* Represents a byte stream to be processed by and Encoder
|
|
@@ -74,7 +74,7 @@ var Stream = /*#__PURE__*/ function() {
|
|
|
74
74
|
function Stream(tokens) {
|
|
75
75
|
_class_call_check(this, Stream);
|
|
76
76
|
_define_property(this, "tokens", void 0);
|
|
77
|
-
this.tokens =
|
|
77
|
+
this.tokens = _to_consumable_array(tokens);
|
|
78
78
|
// Reversed as push/pop is more efficient than shift/unshift.
|
|
79
79
|
this.tokens.reverse();
|
|
80
80
|
}
|
|
@@ -82,9 +82,9 @@ var Stream = /*#__PURE__*/ function() {
|
|
|
82
82
|
{
|
|
83
83
|
key: "endOfStream",
|
|
84
84
|
get: /**
|
|
85
|
-
*
|
|
85
|
+
* True if end-of-stream has been hit.
|
|
86
86
|
*/ function get() {
|
|
87
|
-
return
|
|
87
|
+
return this.tokens.length === 0;
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
{
|
|
@@ -96,7 +96,7 @@ var Stream = /*#__PURE__*/ function() {
|
|
|
96
96
|
* @returns Get the next token from the stream, or
|
|
97
97
|
* end_of_stream.
|
|
98
98
|
*/ function read() {
|
|
99
|
-
if (
|
|
99
|
+
if (this.tokens.length === 0) {
|
|
100
100
|
return Stream.END_OF_STREAM;
|
|
101
101
|
}
|
|
102
102
|
return this.tokens.pop();
|
|
@@ -112,7 +112,7 @@ var Stream = /*#__PURE__*/ function() {
|
|
|
112
112
|
* stream.
|
|
113
113
|
*/ function prepend(token) {
|
|
114
114
|
if (Array.isArray(token)) {
|
|
115
|
-
while(token.length){
|
|
115
|
+
while(token.length > 0){
|
|
116
116
|
this.tokens.push(token.pop());
|
|
117
117
|
}
|
|
118
118
|
} else {
|
|
@@ -130,7 +130,7 @@ var Stream = /*#__PURE__*/ function() {
|
|
|
130
130
|
* stream.
|
|
131
131
|
*/ function push(token) {
|
|
132
132
|
if (Array.isArray(token)) {
|
|
133
|
-
while(token.length){
|
|
133
|
+
while(token.length > 0){
|
|
134
134
|
this.tokens.unshift(token.shift());
|
|
135
135
|
}
|
|
136
136
|
} else {
|
|
@@ -144,8 +144,7 @@ var Stream = /*#__PURE__*/ function() {
|
|
|
144
144
|
_define_property(Stream, "END_OF_STREAM", -1);
|
|
145
145
|
/**
|
|
146
146
|
* Returns the byte equivalent given a string
|
|
147
|
-
* @param
|
|
148
|
-
* @param s
|
|
147
|
+
* @param s Input string of UTF-16 code units.
|
|
149
148
|
* @returns Code points.
|
|
150
149
|
*/ function stringToCodePoints(s) {
|
|
151
150
|
// https://heycam.github.io/webidl/#dfn-obtain-unicode
|
|
@@ -179,14 +178,11 @@ _define_property(Stream, "END_OF_STREAM", -1);
|
|
|
179
178
|
// 2. If 0xDC00 ≤ d ≤ 0xDFFF, then:
|
|
180
179
|
if (0xDC00 <= d && d <= 0xDFFF) {
|
|
181
180
|
// 1. Let a be c & 0x3FF.
|
|
182
|
-
// eslint-disable-next-line no-bitwise
|
|
183
181
|
var a = c & 0x3FF;
|
|
184
182
|
// 2. Let b be d & 0x3FF.
|
|
185
|
-
// eslint-disable-next-line no-bitwise
|
|
186
183
|
var b = d & 0x3FF;
|
|
187
184
|
// 3. Append to U the Unicode character with code point
|
|
188
185
|
// 2^16+2^10*a+b.
|
|
189
|
-
// eslint-disable-next-line no-bitwise
|
|
190
186
|
u.push(0x10000 + (a << 10) + b);
|
|
191
187
|
// 4. Set i to i+1.
|
|
192
188
|
i += 1;
|
|
@@ -220,10 +216,10 @@ var Encoder = /*#__PURE__*/ function() {
|
|
|
220
216
|
{
|
|
221
217
|
key: "inRange",
|
|
222
218
|
value: /**
|
|
219
|
+
* True if a >= min and a <= max.
|
|
223
220
|
* @param a The number to test.
|
|
224
221
|
* @param min The minimum value in the range, inclusive.
|
|
225
222
|
* @param max The maximum value in the range, inclusive.
|
|
226
|
-
* @returns {boolean} True if a >= min and a <= max.
|
|
227
223
|
*/ function inRange(a, min, max) {
|
|
228
224
|
return min <= a && a <= max;
|
|
229
225
|
}
|
|
@@ -256,17 +252,14 @@ var Encoder = /*#__PURE__*/ function() {
|
|
|
256
252
|
}
|
|
257
253
|
// 4. Let bytes be a byte sequence whose first byte is (code
|
|
258
254
|
// point >> (6 × count)) + offset.
|
|
259
|
-
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands,no-bitwise
|
|
260
255
|
var bytes = [
|
|
261
256
|
(codePoint >> 6 * count) + offset
|
|
262
257
|
];
|
|
263
258
|
// 5. Run these substeps while count is greater than 0:
|
|
264
259
|
while(count > 0){
|
|
265
260
|
// 1. Set temp to code point >> (6 × (count − 1)).
|
|
266
|
-
// eslint-disable-next-line no-bitwise
|
|
267
261
|
var temp = codePoint >> 6 * (count - 1);
|
|
268
262
|
// 2. Append to bytes 0x80 | (temp & 0x3F).
|
|
269
|
-
// eslint-disable-next-line no-bitwise
|
|
270
263
|
bytes.push(0x80 | temp & 0x3F);
|
|
271
264
|
// 3. Decrease count by one.
|
|
272
265
|
count -= 1;
|
|
@@ -284,7 +277,6 @@ var Encoder = /*#__PURE__*/ function() {
|
|
|
284
277
|
var output = [];
|
|
285
278
|
var result;
|
|
286
279
|
// 3. While true, run these substeps:
|
|
287
|
-
// eslint-disable-next-line no-constant-condition
|
|
288
280
|
while(true){
|
|
289
281
|
// 1. Let token be the result of reading from input.
|
|
290
282
|
var token = input.read();
|
package/cjs/utils/generic-api.js
CHANGED
|
@@ -203,10 +203,9 @@ var GenericApi = /*#__PURE__*/ function() {
|
|
|
203
203
|
case 0:
|
|
204
204
|
metadataHeaderAccept = ((_requestOptions_metadata = requestOptions.metadata) === null || _requestOptions_metadata === void 0 ? void 0 : _requestOptions_metadata.headerAccept) || 'application/json';
|
|
205
205
|
headers = _object_spread({
|
|
206
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
207
206
|
'Content-Type': ((_requestOptions_metadata1 = requestOptions.metadata) === null || _requestOptions_metadata1 === void 0 ? void 0 : _requestOptions_metadata1.headerContentType) || 'application/json'
|
|
208
207
|
}, metadataHeaderAccept ? {
|
|
209
|
-
|
|
208
|
+
Accept: metadataHeaderAccept
|
|
210
209
|
} : {});
|
|
211
210
|
requestParameters = _object_spread({
|
|
212
211
|
api: _this,
|
package/cjs/utils/ie11.js
CHANGED
|
@@ -13,6 +13,7 @@ function promisifyMsCrypto(cryptoOutput) {
|
|
|
13
13
|
cryptoOutput.oncomplete = function(e) {
|
|
14
14
|
return resolve(e.target.result);
|
|
15
15
|
};
|
|
16
|
+
// eslint-disable-next-line unicorn/prefer-add-event-listener -- false positive
|
|
16
17
|
cryptoOutput.onerror = function(e) {
|
|
17
18
|
return reject(e);
|
|
18
19
|
};
|
package/cjs/utils/index.js
CHANGED
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
_export_star(require("./crypto"), exports);
|
|
6
6
|
_export_star(require("./encoder"), exports);
|
|
7
|
+
_export_star(require("./generic-api"), exports);
|
|
7
8
|
_export_star(require("./ie11"), exports);
|
|
8
9
|
_export_star(require("./json-token"), exports);
|
|
9
10
|
_export_star(require("./mime-types"), exports);
|
|
10
|
-
_export_star(require("./generic-api"), exports);
|
|
11
11
|
function _export_star(from, to) {
|
|
12
12
|
Object.keys(from).forEach(function(k) {
|
|
13
13
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
package/cjs/utils/json-token.js
CHANGED
|
@@ -168,12 +168,12 @@ function _ts_generator(thisArg, body) {
|
|
|
168
168
|
// then we convert the percent encodings into raw bytes, and finally feed it to btoa() function.
|
|
169
169
|
// encodeURI escape all non-ASCII characters but we don't want to escape latin non-ascii characters
|
|
170
170
|
// (charCode between 128 and 255).
|
|
171
|
-
return window.btoa(encodeURI(str).replace(/%C2%([89AB][
|
|
172
|
-
return String.fromCharCode(parseInt('0x' + p1, 16));
|
|
173
|
-
}).replace(/%C3%([89AB][
|
|
174
|
-
return String.fromCharCode(parseInt('0xc0', 16) + parseInt('0x' + p1, 16) - parseInt('0x80', 16));
|
|
175
|
-
}).replace(/%([
|
|
176
|
-
return String.fromCharCode(parseInt('0x' + p1, 16));
|
|
171
|
+
return window.btoa(encodeURI(str).replace(/%C2%([89AB][\dA-F])/g, function(_match, p1) {
|
|
172
|
+
return String.fromCharCode(Number.parseInt('0x' + p1, 16));
|
|
173
|
+
}).replace(/%C3%([89AB][\dA-F])/g, function(_match, p1) {
|
|
174
|
+
return String.fromCharCode(Number.parseInt('0xc0', 16) + Number.parseInt('0x' + p1, 16) - Number.parseInt('0x80', 16));
|
|
175
|
+
}).replace(/%([\dA-F]{2})/g, function(_match, p1) {
|
|
176
|
+
return String.fromCharCode(Number.parseInt('0x' + p1, 16));
|
|
177
177
|
}));
|
|
178
178
|
}
|
|
179
179
|
/**
|
|
@@ -268,7 +268,7 @@ function createJwtEncoder() {
|
|
|
268
268
|
function createJweEncoder() {
|
|
269
269
|
var aesTagLengthInBits = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 128, useHeaderAsAAD = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
270
270
|
var base64Encoder = createBase64UrlEncoder();
|
|
271
|
-
var stringEncoder = typeof window.TextEncoder
|
|
271
|
+
var stringEncoder = typeof window.TextEncoder === 'undefined' ? new _encoder.Encoder() : new TextEncoder();
|
|
272
272
|
return /*#__PURE__*/ function() {
|
|
273
273
|
var _ref = _async_to_generator(function(param, jwePayload, publicProperties) {
|
|
274
274
|
var publicKey, keyId, jweHeader, cek, wrappedCek, iv, serializedHeader, _ref, ciphertext, authenticationTag;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
+
var _nodecrypto = /*#__PURE__*/ _interop_require_default(require("node:crypto"));
|
|
5
6
|
var _jsontoken = require("./json-token");
|
|
6
7
|
function _array_like_to_array(arr, len) {
|
|
7
8
|
if (len == null || len > arr.length) len = arr.length;
|
|
@@ -40,6 +41,11 @@ function _async_to_generator(fn) {
|
|
|
40
41
|
});
|
|
41
42
|
};
|
|
42
43
|
}
|
|
44
|
+
function _interop_require_default(obj) {
|
|
45
|
+
return obj && obj.__esModule ? obj : {
|
|
46
|
+
default: obj
|
|
47
|
+
};
|
|
48
|
+
}
|
|
43
49
|
function _iterable_to_array_limit(arr, i) {
|
|
44
50
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
45
51
|
if (_i == null) return;
|
|
@@ -173,7 +179,6 @@ function _ts_generator(thisArg, body) {
|
|
|
173
179
|
};
|
|
174
180
|
}
|
|
175
181
|
}
|
|
176
|
-
var crypto = require('node:crypto');
|
|
177
182
|
describe('JSON token utils', function() {
|
|
178
183
|
it('should encode and decode in base64 properly a string that contains characters occupying more than 1 byte', function() {
|
|
179
184
|
var base64Encoder = (0, _jsontoken.createBase64Encoder)();
|
|
@@ -198,7 +203,7 @@ describe('JSON Web Encryption Token', function() {
|
|
|
198
203
|
return _ts_generator(this, function(_state) {
|
|
199
204
|
switch(_state.label){
|
|
200
205
|
case 0:
|
|
201
|
-
|
|
206
|
+
expectedJwePayload = {
|
|
202
207
|
iat: 0,
|
|
203
208
|
exp: 3600,
|
|
204
209
|
iss: 'DEMO_JWE',
|
|
@@ -208,7 +213,7 @@ describe('JSON Web Encryption Token', function() {
|
|
|
208
213
|
'{lastName}': 'Doe'
|
|
209
214
|
}
|
|
210
215
|
};
|
|
211
|
-
|
|
216
|
+
expectedJweHeader = {
|
|
212
217
|
alg: 'RSA-OAEP-256',
|
|
213
218
|
enc: 'A256GCM',
|
|
214
219
|
typ: 'JWE',
|
|
@@ -264,8 +269,7 @@ describe('JSON Web Encryption Token', function() {
|
|
|
264
269
|
167,
|
|
265
270
|
206
|
|
266
271
|
]);
|
|
267
|
-
|
|
268
|
-
expectedJweEncryptedKey = new Uint8Array([
|
|
272
|
+
/* eslint-disable @stylistic/max-len -- keep the buffer on the same line */ expectedJweEncryptedKey = new Uint8Array([
|
|
269
273
|
37,
|
|
270
274
|
70,
|
|
271
275
|
170,
|
|
@@ -523,7 +527,6 @@ describe('JSON Web Encryption Token', function() {
|
|
|
523
527
|
239,
|
|
524
528
|
108
|
|
525
529
|
]);
|
|
526
|
-
// eslint-disable-next-line max-len
|
|
527
530
|
outputAesGcm = new Uint8Array([
|
|
528
531
|
179,
|
|
529
532
|
46,
|
|
@@ -642,7 +645,7 @@ describe('JSON Web Encryption Token', function() {
|
|
|
642
645
|
126,
|
|
643
646
|
8
|
|
644
647
|
]);
|
|
645
|
-
global.window = {
|
|
648
|
+
/* eslint-enable @stylistic/max-len */ global.window = {
|
|
646
649
|
btoa: function(data) {
|
|
647
650
|
return Buffer.from(data, 'ascii').toString('base64');
|
|
648
651
|
},
|
|
@@ -672,13 +675,13 @@ describe('JSON Web Encryption Token', function() {
|
|
|
672
675
|
expect(decodeURI(Buffer.from((0, _jsontoken.base64DecodeUrl)(jweHeader), 'base64').toString())).toEqual(JSON.stringify(expectedJweHeader));
|
|
673
676
|
expect(Buffer.from((0, _jsontoken.base64DecodeUrl)(jweEncryptedKey), 'base64')).toEqual(Buffer.from(expectedJweEncryptedKey));
|
|
674
677
|
expect(Buffer.from((0, _jsontoken.base64DecodeUrl)(iv), 'base64')).toEqual(Buffer.from(expectedIv));
|
|
675
|
-
decipher =
|
|
678
|
+
decipher = _nodecrypto.default.createDecipheriv('aes-256-gcm', cek, Buffer.from((0, _jsontoken.base64DecodeUrl)(iv), 'base64'), {
|
|
676
679
|
authTagLength: 12
|
|
677
680
|
});
|
|
678
681
|
decipher.setAuthTag(Buffer.from((0, _jsontoken.base64DecodeUrl)(authenticationTag), 'base64'));
|
|
679
|
-
decrypted = decipher.update(Buffer.from((0, _jsontoken.base64DecodeUrl)(cipherContent), 'base64'));
|
|
680
|
-
decrypted += decipher.final();
|
|
681
|
-
expect(decrypted
|
|
682
|
+
decrypted = decipher.update(Buffer.from((0, _jsontoken.base64DecodeUrl)(cipherContent), 'base64')).toString();
|
|
683
|
+
decrypted += decipher.final().toString();
|
|
684
|
+
expect(decrypted).toEqual(JSON.stringify(expectedJwePayload));
|
|
682
685
|
return [
|
|
683
686
|
2
|
|
684
687
|
];
|
package/cjs/utils/mime-types.js
CHANGED
|
@@ -16,7 +16,7 @@ _export(exports, {
|
|
|
16
16
|
return jsonRegex;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
var jsonRegex = /^(:?application\/json|[
|
|
19
|
+
var jsonRegex = /^(:?application\/json|[^\t /;]+\/[^\t /;]+\+json)[\t ]*(:?;.*)?$/i;
|
|
20
20
|
function isJsonMimeType(mime) {
|
|
21
21
|
return jsonRegex.test(mime);
|
|
22
22
|
}
|
|
@@ -67,6 +67,13 @@ function _define_property(obj, key, value) {
|
|
|
67
67
|
}
|
|
68
68
|
return obj;
|
|
69
69
|
}
|
|
70
|
+
function _instanceof(left, right) {
|
|
71
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
72
|
+
return !!right[Symbol.hasInstance](left);
|
|
73
|
+
} else {
|
|
74
|
+
return left instanceof right;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
70
77
|
function _iterable_to_array(iter) {
|
|
71
78
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
72
79
|
}
|
|
@@ -218,10 +225,10 @@ function _ts_generator(thisArg, body) {
|
|
|
218
225
|
};
|
|
219
226
|
}
|
|
220
227
|
}
|
|
221
|
-
import { ExceptionReply } from '../plugins/exception';
|
|
222
|
-
import { ReviverReply } from '../plugins/reviver';
|
|
223
228
|
import { extractQueryParams, filterUndefinedValues, getResponseReviver, prepareUrl, processFormData, tokenizeRequestOptions } from '../fwk/api.helpers';
|
|
224
229
|
import { EmptyResponseError } from '../fwk/errors';
|
|
230
|
+
import { ExceptionReply } from '../plugins/exception';
|
|
231
|
+
import { ReviverReply } from '../plugins/reviver';
|
|
225
232
|
var DEFAULT_OPTIONS = {
|
|
226
233
|
replyPlugins: [
|
|
227
234
|
new ReviverReply(),
|
|
@@ -420,6 +427,7 @@ var DEFAULT_OPTIONS = {
|
|
|
420
427
|
next: function(res) {
|
|
421
428
|
return data = res;
|
|
422
429
|
},
|
|
430
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors -- subscription forwards the error from the httpRequest to asyncResponse promise
|
|
423
431
|
error: function(err) {
|
|
424
432
|
return reject(err);
|
|
425
433
|
},
|
|
@@ -430,7 +438,7 @@ var DEFAULT_OPTIONS = {
|
|
|
430
438
|
metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.throwIfAborted();
|
|
431
439
|
metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.addEventListener('abort', function() {
|
|
432
440
|
subscription.unsubscribe();
|
|
433
|
-
reject(metadataSignal.reason);
|
|
441
|
+
reject(_instanceof(metadataSignal.reason, Error) ? metadataSignal.reason : new Error(metadataSignal.reason.toString()));
|
|
434
442
|
});
|
|
435
443
|
});
|
|
436
444
|
return [
|
|
@@ -457,7 +465,7 @@ var DEFAULT_OPTIONS = {
|
|
|
457
465
|
4
|
|
458
466
|
];
|
|
459
467
|
case 4:
|
|
460
|
-
// eslint-disable-next-line no-console
|
|
468
|
+
// eslint-disable-next-line no-console -- `console.error` is supposed to be the default value if the `options` argument is not provided, can be removed in Otter v12.
|
|
461
469
|
reviver = getResponseReviver(revivers, response, operationId, {
|
|
462
470
|
disableFallback: _this.options.disableFallback,
|
|
463
471
|
log: console.error
|
|
@@ -86,8 +86,7 @@ var DEFAULT_OPTIONS = {
|
|
|
86
86
|
* Determine if the given value is a promise
|
|
87
87
|
* @deprecated Use the one exposed by {@link @ama-sdk/client-beacon}, will be removed in v13
|
|
88
88
|
* @param value The value to test
|
|
89
|
-
*/ //
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
89
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint -- the `extends unknown` is required for ESM build with TSC
|
|
91
90
|
var isPromise = function(value) {
|
|
92
91
|
return _instanceof(value, Promise);
|
|
93
92
|
};
|