@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
|
@@ -183,7 +183,7 @@ function impervaProtectionRetrieverFactory(protectionTimeout, tokenTimeout) {
|
|
|
183
183
|
var getProtection = function() {
|
|
184
184
|
return new Promise(function(resolve, reject) {
|
|
185
185
|
var timeout = setTimeout(function() {
|
|
186
|
-
return reject("[SDK][Plug-in][BotProtectionFingerprintRequest] Timeout: no Protection object was received in time.\nIf the application runs on a domain that is not protected by Imperva, this plugin should be disabled.");
|
|
186
|
+
return reject(new Error("[SDK][Plug-in][BotProtectionFingerprintRequest] Timeout: no Protection object was received in time.\nIf the application runs on a domain that is not protected by Imperva, this plugin should be disabled."));
|
|
187
187
|
}, protectionTimeout);
|
|
188
188
|
window.protectionLoaded = function(protectionObject) {
|
|
189
189
|
protection = protectionObject;
|
|
@@ -244,7 +244,7 @@ function impervaProtectionRetrieverFactory(protectionTimeout, tokenTimeout) {
|
|
|
244
244
|
];
|
|
245
245
|
case 6:
|
|
246
246
|
e1 = _state.sent();
|
|
247
|
-
(logger || console).error('[SDK][Plug-in][BotProtectionFingerprintRequest] Timeout: no Token was received in time.');
|
|
247
|
+
(logger || console).error('[SDK][Plug-in][BotProtectionFingerprintRequest] Timeout: no Token was received in time.', e1);
|
|
248
248
|
return [
|
|
249
249
|
2
|
|
250
250
|
];
|
|
@@ -261,7 +261,7 @@ function impervaProtectionRetrieverFactory(protectionTimeout, tokenTimeout) {
|
|
|
261
261
|
}();
|
|
262
262
|
}
|
|
263
263
|
function akamaiTelemetryRetrieverFactory(bmakOpt) {
|
|
264
|
-
var bmak = bmakOpt || (typeof window
|
|
264
|
+
var bmak = bmakOpt || (typeof window === 'undefined' ? undefined : window.bmak);
|
|
265
265
|
return function() {
|
|
266
266
|
if (!bmak || !(typeof bmak.get_telemetry === 'function')) {
|
|
267
267
|
return;
|
|
@@ -141,7 +141,7 @@ describe('BotProtectionFingerprint', function() {
|
|
|
141
141
|
};
|
|
142
142
|
var protectionReject = {
|
|
143
143
|
token: function() {
|
|
144
|
-
return Promise.reject('error');
|
|
144
|
+
return Promise.reject(new Error('error'));
|
|
145
145
|
}
|
|
146
146
|
};
|
|
147
147
|
var registerEvent = function(protection) {
|
|
@@ -158,13 +158,11 @@ describe('BotProtectionFingerprint', function() {
|
|
|
158
158
|
beforeEach(function() {
|
|
159
159
|
consoleMock = jest.spyOn(console, 'error').mockImplementation();
|
|
160
160
|
windowBackup = global.window;
|
|
161
|
-
// eslint-disable-next-line no-global-assign
|
|
162
161
|
global.window = {};
|
|
163
162
|
retriever = (0, _botprotectionfingerprintrequest.impervaProtectionRetrieverFactory)(50, 50);
|
|
164
163
|
tokenValue = 'dummyToken';
|
|
165
164
|
});
|
|
166
165
|
afterEach(function() {
|
|
167
|
-
// eslint-disable-next-line no-global-assign
|
|
168
166
|
global.window = windowBackup;
|
|
169
167
|
consoleMock.mockReset();
|
|
170
168
|
});
|
|
@@ -188,7 +186,7 @@ describe('BotProtectionFingerprint', function() {
|
|
|
188
186
|
expect.apply(void 0, [
|
|
189
187
|
_state.sent()
|
|
190
188
|
]).toBeUndefined();
|
|
191
|
-
// eslint-disable-next-line no-console
|
|
189
|
+
// eslint-disable-next-line no-console -- console.error is not called here
|
|
192
190
|
expect(console.error).toHaveBeenCalledTimes(1);
|
|
193
191
|
return [
|
|
194
192
|
2
|
|
@@ -217,7 +215,7 @@ describe('BotProtectionFingerprint', function() {
|
|
|
217
215
|
expect.apply(void 0, [
|
|
218
216
|
_state.sent()
|
|
219
217
|
]).toBeUndefined();
|
|
220
|
-
// eslint-disable-next-line no-console
|
|
218
|
+
// eslint-disable-next-line no-console -- console.error is not called here
|
|
221
219
|
expect(console.error).toHaveBeenCalledTimes(1);
|
|
222
220
|
return [
|
|
223
221
|
2
|
|
@@ -246,7 +244,7 @@ describe('BotProtectionFingerprint', function() {
|
|
|
246
244
|
expect.apply(void 0, [
|
|
247
245
|
_state.sent()
|
|
248
246
|
]).toBeUndefined();
|
|
249
|
-
// eslint-disable-next-line no-console
|
|
247
|
+
// eslint-disable-next-line no-console -- console.error is not called here
|
|
250
248
|
expect(console.error).toHaveBeenCalledTimes(1);
|
|
251
249
|
return [
|
|
252
250
|
2
|
|
@@ -291,7 +289,7 @@ describe('BotProtectionFingerprint', function() {
|
|
|
291
289
|
expect.apply(void 0, [
|
|
292
290
|
_state.sent()
|
|
293
291
|
]).toBe(tokenValue);
|
|
294
|
-
// eslint-disable-next-line no-console
|
|
292
|
+
// eslint-disable-next-line no-console -- console.error is not called here
|
|
295
293
|
expect(console.error).not.toHaveBeenCalled();
|
|
296
294
|
return [
|
|
297
295
|
2
|
|
@@ -304,20 +302,19 @@ describe('BotProtectionFingerprint', function() {
|
|
|
304
302
|
it('Should return undefined if bmak object doesn\'t exist.', function() {
|
|
305
303
|
expect((0, _botprotectionfingerprintrequest.akamaiTelemetryRetrieverFactory)()()).toBeUndefined();
|
|
306
304
|
expect((0, _botprotectionfingerprintrequest.akamaiTelemetryRetrieverFactory)({})()).toBeUndefined();
|
|
307
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention,camelcase
|
|
308
305
|
expect((0, _botprotectionfingerprintrequest.akamaiTelemetryRetrieverFactory)({
|
|
309
306
|
get_telemetry: 'test'
|
|
310
307
|
})()).toBeUndefined();
|
|
311
308
|
});
|
|
312
309
|
it('Should return telemetry', function() {
|
|
313
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
310
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention -- naming convention imposed by Akamai
|
|
314
311
|
expect((0, _botprotectionfingerprintrequest.akamaiTelemetryRetrieverFactory)({
|
|
315
312
|
get_telemetry: function() {
|
|
316
313
|
return 'telemetryValue';
|
|
317
314
|
}
|
|
318
315
|
})()).toBe('telemetryValue');
|
|
319
316
|
global.window = {};
|
|
320
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
317
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention -- naming convention imposed by Akamai
|
|
321
318
|
global.window.bmak = {
|
|
322
319
|
get_telemetry: function() {
|
|
323
320
|
return 'telemetryValue2';
|
|
@@ -188,13 +188,13 @@ function _ts_generator(thisArg, body) {
|
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
+
var jwtPayload = function(data) {
|
|
192
|
+
return _object_spread({
|
|
193
|
+
sub: 'fact'
|
|
194
|
+
}, data);
|
|
195
|
+
};
|
|
191
196
|
function createJwtFactsEncoder() {
|
|
192
197
|
var jwtEncoder = (0, _jsontoken.createJwtEncoder)();
|
|
193
|
-
var jwtPayload = function(data) {
|
|
194
|
-
return _object_spread({
|
|
195
|
-
sub: 'fact'
|
|
196
|
-
}, data);
|
|
197
|
-
};
|
|
198
198
|
return function(data) {
|
|
199
199
|
return jwtEncoder(jwtPayload(data));
|
|
200
200
|
};
|
|
@@ -189,7 +189,7 @@ var ConcurrentFetch = /*#__PURE__*/ function() {
|
|
|
189
189
|
value: /**
|
|
190
190
|
* Unstack and resolve the promise stopping the call to start
|
|
191
191
|
*/ function unstackResolve() {
|
|
192
|
-
if (this.canStart() && this.waitingResolvers.length) {
|
|
192
|
+
if (this.canStart() && this.waitingResolvers.length > 0) {
|
|
193
193
|
this.waitingResolvers.shift()(true);
|
|
194
194
|
}
|
|
195
195
|
}
|
|
@@ -208,7 +208,7 @@ var ConcurrentFetch = /*#__PURE__*/ function() {
|
|
|
208
208
|
},
|
|
209
209
|
transform: /*#__PURE__*/ function() {
|
|
210
210
|
var _ref = _async_to_generator(function(fetchCall) {
|
|
211
|
-
var fetchResponse
|
|
211
|
+
var fetchResponse;
|
|
212
212
|
return _ts_generator(this, function(_state) {
|
|
213
213
|
switch(_state.label){
|
|
214
214
|
case 0:
|
|
@@ -217,9 +217,9 @@ var ConcurrentFetch = /*#__PURE__*/ function() {
|
|
|
217
217
|
case 1:
|
|
218
218
|
_state.trys.push([
|
|
219
219
|
1,
|
|
220
|
+
,
|
|
220
221
|
3,
|
|
221
|
-
4
|
|
222
|
-
5
|
|
222
|
+
4
|
|
223
223
|
]);
|
|
224
224
|
return [
|
|
225
225
|
4,
|
|
@@ -232,10 +232,6 @@ var ConcurrentFetch = /*#__PURE__*/ function() {
|
|
|
232
232
|
fetchResponse
|
|
233
233
|
];
|
|
234
234
|
case 3:
|
|
235
|
-
e = _state.sent();
|
|
236
|
-
throw e;
|
|
237
|
-
case 4:
|
|
238
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
239
235
|
_this1.pool = _this1.pool.filter(function(call) {
|
|
240
236
|
return call !== fetchCall;
|
|
241
237
|
});
|
|
@@ -244,7 +240,7 @@ var ConcurrentFetch = /*#__PURE__*/ function() {
|
|
|
244
240
|
return [
|
|
245
241
|
7
|
|
246
242
|
];
|
|
247
|
-
case
|
|
243
|
+
case 4:
|
|
248
244
|
return [
|
|
249
245
|
2
|
|
250
246
|
];
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
_export_star(require("./plugin"), exports);
|
|
6
5
|
_export_star(require("./fetch-plugin"), exports);
|
|
7
|
-
_export_star(require("./
|
|
6
|
+
_export_star(require("./plugin"), exports);
|
|
8
7
|
_export_star(require("./reply-plugin"), exports);
|
|
8
|
+
_export_star(require("./request-plugin"), exports);
|
|
9
9
|
function _export_star(from, to) {
|
|
10
10
|
Object.keys(from).forEach(function(k) {
|
|
11
11
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -53,8 +53,7 @@ var CustomInfoReply = /*#__PURE__*/ function() {
|
|
|
53
53
|
value: /**
|
|
54
54
|
* Checks if the reply has a customInfo node
|
|
55
55
|
* @param reply
|
|
56
|
-
*/
|
|
57
|
-
function hasCustomInfo(reply) {
|
|
56
|
+
*/ function hasCustomInfo(reply) {
|
|
58
57
|
return !!(reply && reply.customInfo);
|
|
59
58
|
}
|
|
60
59
|
},
|
|
@@ -65,6 +64,7 @@ var CustomInfoReply = /*#__PURE__*/ function() {
|
|
|
65
64
|
return {
|
|
66
65
|
transform: function(data) {
|
|
67
66
|
return Object.assign(data || Object.assign({}, data), {
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- explicit `any`
|
|
68
68
|
customInfo: data && data.customInfo ? Object.assign(data.customInfo, _this.customInfo) : _this.customInfo
|
|
69
69
|
});
|
|
70
70
|
}
|
|
@@ -94,7 +94,7 @@ var FetchCacheRequest = /*#__PURE__*/ function() {
|
|
|
94
94
|
*/ _define_property(this, "shouldAddCacheControlHeaders", void 0);
|
|
95
95
|
this.fetchCache = fetchCache;
|
|
96
96
|
this.cacheControl = cacheControl;
|
|
97
|
-
this.shouldAddCacheControlHeaders = typeof shouldAddCacheControlHeaders
|
|
97
|
+
this.shouldAddCacheControlHeaders = typeof shouldAddCacheControlHeaders === 'undefined' ? typeof fetch === 'undefined' || fetch.polyfill : shouldAddCacheControlHeaders;
|
|
98
98
|
}
|
|
99
99
|
_create_class(FetchCacheRequest, [
|
|
100
100
|
{
|
|
@@ -134,7 +134,7 @@ describe('Fetch API credentials Request Plugin', function() {
|
|
|
134
134
|
method: 'get'
|
|
135
135
|
};
|
|
136
136
|
it('credentials should be set to same-origin by default', /*#__PURE__*/ _async_to_generator(function() {
|
|
137
|
-
var plugin, runner, cred;
|
|
137
|
+
var plugin, runner, _ref, cred;
|
|
138
138
|
return _ts_generator(this, function(_state) {
|
|
139
139
|
switch(_state.label){
|
|
140
140
|
case 0:
|
|
@@ -151,7 +151,7 @@ describe('Fetch API credentials Request Plugin', function() {
|
|
|
151
151
|
plugin.load().transform(options)
|
|
152
152
|
];
|
|
153
153
|
case 2:
|
|
154
|
-
|
|
154
|
+
_ref = _state.sent(), cred = _ref.credentials;
|
|
155
155
|
expect(cred).toBe('same-origin');
|
|
156
156
|
return [
|
|
157
157
|
2
|
|
@@ -160,7 +160,7 @@ describe('Fetch API credentials Request Plugin', function() {
|
|
|
160
160
|
});
|
|
161
161
|
}));
|
|
162
162
|
it('credentials should be set correctly', /*#__PURE__*/ _async_to_generator(function() {
|
|
163
|
-
var plugin, runner, cred;
|
|
163
|
+
var plugin, runner, _ref, cred;
|
|
164
164
|
return _ts_generator(this, function(_state) {
|
|
165
165
|
switch(_state.label){
|
|
166
166
|
case 0:
|
|
@@ -177,7 +177,7 @@ describe('Fetch API credentials Request Plugin', function() {
|
|
|
177
177
|
plugin.load().transform(options)
|
|
178
178
|
];
|
|
179
179
|
case 2:
|
|
180
|
-
|
|
180
|
+
_ref = _state.sent(), cred = _ref.credentials;
|
|
181
181
|
expect(cred).toBe('include');
|
|
182
182
|
return [
|
|
183
183
|
2
|
|
@@ -62,16 +62,16 @@ var JsonTokenReply = /*#__PURE__*/ function() {
|
|
|
62
62
|
}
|
|
63
63
|
if (context.response.headers.has('Authorization')) {
|
|
64
64
|
var token = context.response.headers.get('Authorization');
|
|
65
|
-
if (typeof sessionStorage
|
|
66
|
-
sessionStorage.setItem(_this.storageTokenKey, token);
|
|
67
|
-
} else {
|
|
65
|
+
if (typeof sessionStorage === 'undefined') {
|
|
68
66
|
_this.sharedMemory[_this.storageTokenKey] = token;
|
|
67
|
+
} else {
|
|
68
|
+
sessionStorage.setItem(_this.storageTokenKey, token);
|
|
69
69
|
}
|
|
70
70
|
} else {
|
|
71
|
-
if (typeof sessionStorage
|
|
72
|
-
sessionStorage.removeItem(_this.storageTokenKey);
|
|
73
|
-
} else {
|
|
71
|
+
if (typeof sessionStorage === 'undefined') {
|
|
74
72
|
_this.sharedMemory[_this.storageTokenKey] = undefined;
|
|
73
|
+
} else {
|
|
74
|
+
sessionStorage.removeItem(_this.storageTokenKey);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
return data;
|
|
@@ -58,7 +58,7 @@ var JsonTokenRequest = /*#__PURE__*/ function() {
|
|
|
58
58
|
return {
|
|
59
59
|
transform: function(data) {
|
|
60
60
|
// Handle Authorization Tokens
|
|
61
|
-
var token = typeof sessionStorage
|
|
61
|
+
var token = typeof sessionStorage === 'undefined' ? _this.sharedMemory[_this.storageTokenKey] : sessionStorage.getItem(_this.storageTokenKey);
|
|
62
62
|
if (token) {
|
|
63
63
|
data.credentials = 'same-origin';
|
|
64
64
|
data.headers.append('Authorization', token);
|
|
@@ -169,8 +169,8 @@ describe('Json Token', function() {
|
|
|
169
169
|
case 1:
|
|
170
170
|
result = _state.sent();
|
|
171
171
|
if (typeof window !== 'undefined' && typeof window.sessionStorage !== 'undefined') {
|
|
172
|
-
expect(window.sessionStorage.getItem).toHaveBeenCalledWith(tokenKey);
|
|
173
|
-
}
|
|
172
|
+
/* eslint-disable jest/no-conditional-expect -- the same condition is verified above to set up the checked spy */ expect(window.sessionStorage.getItem).toHaveBeenCalledWith(tokenKey);
|
|
173
|
+
/* eslint-enable jest/no-conditional-expect */ }
|
|
174
174
|
expect(result.credentials).toBe('same-origin');
|
|
175
175
|
expect(result.headers.get('Authorization')).toBe(tokenValue);
|
|
176
176
|
return [
|
|
@@ -199,8 +199,8 @@ describe('Json Token', function() {
|
|
|
199
199
|
case 1:
|
|
200
200
|
result = _state.sent();
|
|
201
201
|
if (typeof window !== 'undefined' && typeof window.sessionStorage !== 'undefined') {
|
|
202
|
-
expect(window.sessionStorage.getItem).toHaveBeenCalledWith(tokenKey);
|
|
203
|
-
}
|
|
202
|
+
/* eslint-disable jest/no-conditional-expect -- the same condition is verified above to set up the checked spy */ expect(window.sessionStorage.getItem).toHaveBeenCalledWith(tokenKey);
|
|
203
|
+
/* eslint-enable jest/no-conditional-expect */ }
|
|
204
204
|
expect(result.credentials).toBeUndefined();
|
|
205
205
|
expect(result.headers.get('Authorization')).toBeNull();
|
|
206
206
|
return [
|
|
@@ -224,7 +224,6 @@ describe('Json Token', function() {
|
|
|
224
224
|
runner = plugin.load({
|
|
225
225
|
reviver: reviver,
|
|
226
226
|
apiType: _api.ApiTypes.DEFAULT,
|
|
227
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
228
227
|
response: {
|
|
229
228
|
headers: new Headers({
|
|
230
229
|
Authorization: tokenValue
|
|
@@ -242,10 +241,9 @@ describe('Json Token', function() {
|
|
|
242
241
|
case 1:
|
|
243
242
|
_state.sent();
|
|
244
243
|
if (typeof window !== 'undefined' && typeof window.sessionStorage !== 'undefined') {
|
|
245
|
-
expect(window.sessionStorage.setItem).toHaveBeenCalledWith(tokenKey, tokenValue);
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
244
|
+
/* eslint-disable jest/no-conditional-expect -- the same condition is verified above to set up the checked spy */ expect(window.sessionStorage.setItem).toHaveBeenCalledWith(tokenKey, tokenValue);
|
|
245
|
+
/* eslint-enable jest/no-conditional-expect */ }
|
|
246
|
+
expect(memory.testToken).toBe(tokenValue);
|
|
249
247
|
return [
|
|
250
248
|
2
|
|
251
249
|
];
|
|
@@ -326,7 +326,6 @@ describe('JSON auth token request plugin', function() {
|
|
|
326
326
|
];
|
|
327
327
|
case 3:
|
|
328
328
|
secretKey = _state.sent();
|
|
329
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
330
329
|
message = "".concat(base64UrlEncoder(JSON.stringify(header)), ".").concat(base64UrlEncoder(JSON.stringify(payload)));
|
|
331
330
|
return [
|
|
332
331
|
4,
|
|
@@ -375,7 +374,6 @@ describe('JSON auth token request plugin', function() {
|
|
|
375
374
|
];
|
|
376
375
|
case 3:
|
|
377
376
|
secretKey = _state.sent();
|
|
378
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
379
377
|
message = "".concat(base64UrlEncoder(JSON.stringify(header)), ".").concat(base64UrlEncoder(JSON.stringify(payload)));
|
|
380
378
|
return [
|
|
381
379
|
4,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
_export_star(require("./mock-intercept.request"), exports);
|
|
6
5
|
_export_star(require("./mock-intercept.fetch"), exports);
|
|
7
6
|
_export_star(require("./mock-intercept.interface"), exports);
|
|
7
|
+
_export_star(require("./mock-intercept.request"), exports);
|
|
8
8
|
function _export_star(from, to) {
|
|
9
9
|
Object.keys(from).forEach(function(k) {
|
|
10
10
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "MockInterceptAngular", {
|
|
|
8
8
|
return MockInterceptAngular;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
var _http = require("@angular/common/http");
|
|
11
12
|
var _rxjs = require("rxjs");
|
|
12
13
|
var _mockinterceptinterface = require("./mock-intercept.interface");
|
|
13
14
|
var _mockinterceptrequest = require("./mock-intercept.request");
|
|
14
|
-
var _http = require("@angular/common/http");
|
|
15
15
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
16
16
|
try {
|
|
17
17
|
var info = gen[key](arg);
|
|
@@ -246,7 +246,7 @@ var MockInterceptAngular = /*#__PURE__*/ function() {
|
|
|
246
246
|
case 1:
|
|
247
247
|
_state.sent();
|
|
248
248
|
originalCall = call;
|
|
249
|
-
// eslint-disable-next-line @typescript-eslint/no-
|
|
249
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- type of options is explicitly `any`
|
|
250
250
|
if (!context.options.headers || !_instanceof(context.options.headers, Headers) || !context.options.headers.has(_mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER)) {
|
|
251
251
|
return [
|
|
252
252
|
2,
|
|
@@ -282,7 +282,7 @@ var MockInterceptAngular = /*#__PURE__*/ function() {
|
|
|
282
282
|
originalCall = originalCall.pipe((0, _rxjs.delay)(delayTime));
|
|
283
283
|
_state.label = 5;
|
|
284
284
|
case 5:
|
|
285
|
-
// eslint-disable-next-line @typescript-eslint/no-
|
|
285
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- type of options is explicitly `any`
|
|
286
286
|
operationId = context.options.headers.get(_mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER);
|
|
287
287
|
try {
|
|
288
288
|
mock = _this1.options.adapter.getLatestMock(operationId);
|
|
@@ -317,7 +317,7 @@ var MockInterceptAngular = /*#__PURE__*/ function() {
|
|
|
317
317
|
];
|
|
318
318
|
}
|
|
319
319
|
});
|
|
320
|
-
});
|
|
320
|
+
/* eslint-enable-next-line @typescript-eslint/no-unsafe-assignment */ });
|
|
321
321
|
return function(res) {
|
|
322
322
|
return _ref.apply(this, arguments);
|
|
323
323
|
};
|
|
@@ -204,7 +204,6 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
|
|
|
204
204
|
case 1:
|
|
205
205
|
_state.sent();
|
|
206
206
|
responsePromise = fetchCall;
|
|
207
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
208
207
|
if (!context.options.headers || !_instanceof(context.options.headers, Headers) || !context.options.headers.has(_mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER)) {
|
|
209
208
|
return [
|
|
210
209
|
2,
|
|
@@ -247,7 +246,6 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
|
|
|
247
246
|
});
|
|
248
247
|
_state.label = 6;
|
|
249
248
|
case 6:
|
|
250
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
251
249
|
operationId = context.options.headers.get(_mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER);
|
|
252
250
|
try {
|
|
253
251
|
mock = _this.options.adapter.getLatestMock(operationId);
|
|
@@ -238,7 +238,7 @@ describe('Mock intercept', function() {
|
|
|
238
238
|
});
|
|
239
239
|
}));
|
|
240
240
|
it('should intercept the request', /*#__PURE__*/ _async_to_generator(function() {
|
|
241
|
-
var plugin, originalRequest, loaded, transformed, res;
|
|
241
|
+
var plugin, originalRequest, loaded, transformed, res, text;
|
|
242
242
|
return _ts_generator(this, function(_state) {
|
|
243
243
|
switch(_state.label){
|
|
244
244
|
case 0:
|
|
@@ -265,14 +265,15 @@ describe('Mock intercept', function() {
|
|
|
265
265
|
fetch(transformed.basePath, transformed)
|
|
266
266
|
];
|
|
267
267
|
case 2:
|
|
268
|
+
res = _state.sent();
|
|
268
269
|
return [
|
|
269
270
|
4,
|
|
270
|
-
|
|
271
|
+
res.text()
|
|
271
272
|
];
|
|
272
273
|
case 3:
|
|
273
|
-
|
|
274
|
+
text = _state.sent();
|
|
274
275
|
expect(getMockSpy).toHaveBeenCalled();
|
|
275
|
-
expect(
|
|
276
|
+
expect(text).toBe(JSON.stringify(testMock.mockData));
|
|
276
277
|
expect(initializeSpy).toHaveBeenCalled();
|
|
277
278
|
return [
|
|
278
279
|
2
|
|
@@ -70,6 +70,13 @@ function _define_property(obj, key, value) {
|
|
|
70
70
|
}
|
|
71
71
|
return obj;
|
|
72
72
|
}
|
|
73
|
+
function _instanceof(left, right) {
|
|
74
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
75
|
+
return !!right[Symbol.hasInstance](left);
|
|
76
|
+
} else {
|
|
77
|
+
return left instanceof right;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
73
80
|
function _object_spread(target) {
|
|
74
81
|
for(var i = 1; i < arguments.length; i++){
|
|
75
82
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -236,7 +243,7 @@ var PerformanceMetricPlugin = /*#__PURE__*/ function() {
|
|
|
236
243
|
return "sdk:".concat(status, ":").concat(markId);
|
|
237
244
|
});
|
|
238
245
|
this.getPerformanceTag = (options === null || options === void 0 ? void 0 : options.getPerformanceTag) || this.getPerformanceTag;
|
|
239
|
-
this.performance = (options === null || options === void 0 ? void 0 : options.performance) || (typeof window
|
|
246
|
+
this.performance = (options === null || options === void 0 ? void 0 : options.performance) || (typeof window === 'undefined' ? undefined : window.performance);
|
|
240
247
|
this.onMarkComplete = options ? options.onMarkComplete : this.onMarkComplete;
|
|
241
248
|
this.onMarkError = options ? options.onMarkError : this.onMarkError;
|
|
242
249
|
this.onMarkOpen = options ? options.onMarkOpen : this.onMarkOpen;
|
|
@@ -350,7 +357,8 @@ var PerformanceMetricPlugin = /*#__PURE__*/ function() {
|
|
|
350
357
|
];
|
|
351
358
|
case 3:
|
|
352
359
|
exception = _state.sent();
|
|
353
|
-
|
|
360
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access -- type is explicitly `any`
|
|
361
|
+
_this.closeMarkWithError(markId, _instanceof(exception, Error) ? exception : new Error(exception.toString()));
|
|
354
362
|
throw exception;
|
|
355
363
|
case 4:
|
|
356
364
|
return [
|
|
@@ -201,7 +201,6 @@ function createJwtPiiEncoder(applicationId) {
|
|
|
201
201
|
iat: timestamp,
|
|
202
202
|
exp: timestamp + expirationDelay,
|
|
203
203
|
iss: applicationId,
|
|
204
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
205
204
|
'ama-tokens': values
|
|
206
205
|
};
|
|
207
206
|
};
|
|
@@ -219,7 +218,6 @@ function createJwePiiEncoder(applicationId) {
|
|
|
219
218
|
iat: timestamp,
|
|
220
219
|
exp: timestamp + expirationDelay,
|
|
221
220
|
iss: applicationId,
|
|
222
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
223
221
|
'ama-tokens': values
|
|
224
222
|
};
|
|
225
223
|
};
|
|
@@ -238,14 +236,10 @@ var PiiTokenizerRequest = /*#__PURE__*/ function() {
|
|
|
238
236
|
this.tokensHeader = options.headerName || 'ama-client-facts';
|
|
239
237
|
this.challengeHeader = options.challengeHeaderName || 'ama-client-facts-challenge';
|
|
240
238
|
this.silent = options.silent || false;
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
], options.useHeaderAsAdditionalAuthenticatedData);
|
|
246
|
-
} else {
|
|
247
|
-
this.tokenEncoder = createJwtPiiEncoder(options.applicationId, options.expirationDelay);
|
|
248
|
-
}
|
|
239
|
+
this.tokenEncoder = options.key ? createJwePiiEncoder(options.applicationId, options.expirationDelay, options.key, options.publicProperties || [
|
|
240
|
+
'iss',
|
|
241
|
+
'sub'
|
|
242
|
+
], options.useHeaderAsAdditionalAuthenticatedData) : createJwtPiiEncoder(options.applicationId, options.expirationDelay);
|
|
249
243
|
}
|
|
250
244
|
_create_class(PiiTokenizerRequest, [
|
|
251
245
|
{
|
|
@@ -279,7 +273,7 @@ var PiiTokenizerRequest = /*#__PURE__*/ function() {
|
|
|
279
273
|
case 2:
|
|
280
274
|
e = _state.sent();
|
|
281
275
|
if (_this.silent) {
|
|
282
|
-
(logger || console).error('Couldn\'t encode the token');
|
|
276
|
+
(logger || console).error('Couldn\'t encode the token', e);
|
|
283
277
|
} else {
|
|
284
278
|
throw new Error('Couldn\'t encode the token');
|
|
285
279
|
}
|
|
@@ -321,7 +321,7 @@ describe('Tokenizer Request Plugin', function() {
|
|
|
321
321
|
expect(result.queryParams.classicParam).toEqual('classicParamValue');
|
|
322
322
|
expect(result.queryParams.sensitiveParam).toEqual('sensitiveParamValue');
|
|
323
323
|
expect(result.headers.get('ama-client-facts')).toBeNull();
|
|
324
|
-
// eslint-disable-next-line no-console
|
|
324
|
+
// eslint-disable-next-line no-console -- not calling console.error but expect if it has been called or not
|
|
325
325
|
expect(console.error).toHaveBeenCalled();
|
|
326
326
|
return [
|
|
327
327
|
2
|
|
@@ -352,7 +352,7 @@ describe('Tokenizer Request Plugin', function() {
|
|
|
352
352
|
expect(result.queryParams.classicParam).toEqual('classicParamValue');
|
|
353
353
|
expect(result.queryParams.sensitiveParam).toEqual('sensitiveParamValue');
|
|
354
354
|
expect(result.headers.get('ama-client-facts')).toBeNull();
|
|
355
|
-
// eslint-disable-next-line no-console
|
|
355
|
+
// eslint-disable-next-line no-console -- not calling console.error but expect if it has been called or not
|
|
356
356
|
expect(console.error).not.toHaveBeenCalled();
|
|
357
357
|
return [
|
|
358
358
|
2
|
|
@@ -418,7 +418,6 @@ describe('Tokenizer Request Plugin', function() {
|
|
|
418
418
|
case 1:
|
|
419
419
|
result = _state.sent();
|
|
420
420
|
expectedJwePayload = {
|
|
421
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
422
421
|
'ama-tokens': {
|
|
423
422
|
$pathParamToken$: 'pathParamValue',
|
|
424
423
|
$sensitiveParamToken$: 'sensitiveParamValue'
|
|
@@ -467,7 +466,7 @@ describe('Tokenizer Request Plugin', function() {
|
|
|
467
466
|
case 1:
|
|
468
467
|
_state.sent();
|
|
469
468
|
expect(mockJweEncoder).toHaveBeenCalled();
|
|
470
|
-
// eslint-disable-next-line no-console
|
|
469
|
+
// eslint-disable-next-line no-console -- not calling console.error but expect if it has been called or not
|
|
471
470
|
expect(console.error).not.toHaveBeenCalled();
|
|
472
471
|
return [
|
|
473
472
|
2
|
|
@@ -503,7 +502,7 @@ describe('Tokenizer Request Plugin', function() {
|
|
|
503
502
|
case 1:
|
|
504
503
|
_state.sent();
|
|
505
504
|
expect(mockJweEncoder).toHaveBeenCalled();
|
|
506
|
-
// eslint-disable-next-line no-console
|
|
505
|
+
// eslint-disable-next-line no-console -- not calling console.error but expect if it has been called or not
|
|
507
506
|
expect(console.error).toHaveBeenCalled();
|
|
508
507
|
return [
|
|
509
508
|
2
|
|
@@ -546,7 +545,7 @@ describe('Tokenizer Request Plugin', function() {
|
|
|
546
545
|
expect(result.queryParams.classicParam).toEqual('classicParamValue');
|
|
547
546
|
expect(result.queryParams.sensitiveParam).toEqual('$sensitiveParamToken$');
|
|
548
547
|
expect(result.headers.get('ama-client-facts')).toEqual('myDeepLinkToken');
|
|
549
|
-
// eslint-disable-next-line no-console
|
|
548
|
+
// eslint-disable-next-line no-console -- not calling console.error but expect if it has been called or not
|
|
550
549
|
expect(console.error).not.toHaveBeenCalled();
|
|
551
550
|
return [
|
|
552
551
|
2
|