@ama-sdk/core 11.6.0-prerelease.2 → 11.6.0-prerelease.20
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
|
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "ApiAngularClient", {
|
|
|
8
8
|
return ApiAngularClient;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
var _exception = require("../plugins/exception");
|
|
12
|
-
var _reviver = require("../plugins/reviver");
|
|
13
11
|
var _apihelpers = require("../fwk/api.helpers");
|
|
14
12
|
var _errors = require("../fwk/errors");
|
|
13
|
+
var _exception = require("../plugins/exception");
|
|
14
|
+
var _reviver = require("../plugins/reviver");
|
|
15
15
|
function _array_like_to_array(arr, len) {
|
|
16
16
|
if (len == null || len > arr.length) len = arr.length;
|
|
17
17
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -81,6 +81,13 @@ function _define_property(obj, key, value) {
|
|
|
81
81
|
}
|
|
82
82
|
return obj;
|
|
83
83
|
}
|
|
84
|
+
function _instanceof(left, right) {
|
|
85
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
86
|
+
return !!right[Symbol.hasInstance](left);
|
|
87
|
+
} else {
|
|
88
|
+
return left instanceof right;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
84
91
|
function _iterable_to_array(iter) {
|
|
85
92
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
86
93
|
}
|
|
@@ -427,6 +434,7 @@ var ApiAngularClient = /*#__PURE__*/ function() {
|
|
|
427
434
|
next: function(res) {
|
|
428
435
|
return data = res;
|
|
429
436
|
},
|
|
437
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors -- subscription forwards the error from the httpRequest to asyncResponse promise
|
|
430
438
|
error: function(err) {
|
|
431
439
|
return reject(err);
|
|
432
440
|
},
|
|
@@ -437,7 +445,7 @@ var ApiAngularClient = /*#__PURE__*/ function() {
|
|
|
437
445
|
metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.throwIfAborted();
|
|
438
446
|
metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.addEventListener('abort', function() {
|
|
439
447
|
subscription.unsubscribe();
|
|
440
|
-
reject(metadataSignal.reason);
|
|
448
|
+
reject(_instanceof(metadataSignal.reason, Error) ? metadataSignal.reason : new Error(metadataSignal.reason.toString()));
|
|
441
449
|
});
|
|
442
450
|
});
|
|
443
451
|
return [
|
|
@@ -464,7 +472,7 @@ var ApiAngularClient = /*#__PURE__*/ function() {
|
|
|
464
472
|
4
|
|
465
473
|
];
|
|
466
474
|
case 4:
|
|
467
|
-
// eslint-disable-next-line no-console
|
|
475
|
+
// 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.
|
|
468
476
|
reviver = (0, _apihelpers.getResponseReviver)(revivers, response, operationId, {
|
|
469
477
|
disableFallback: _this.options.disableFallback,
|
|
470
478
|
log: console.error
|
|
@@ -96,8 +96,7 @@ var DEFAULT_OPTIONS = {
|
|
|
96
96
|
* Determine if the given value is a promise
|
|
97
97
|
* @deprecated Use the one exposed by {@link @ama-sdk/client-beacon}, will be removed in v13
|
|
98
98
|
* @param value The value to test
|
|
99
|
-
*/ //
|
|
100
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
99
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint -- the `extends unknown` is required for ESM build with TSC
|
|
101
100
|
var isPromise = function(value) {
|
|
102
101
|
return _instanceof(value, Promise);
|
|
103
102
|
};
|
|
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "ApiFetchClient", {
|
|
|
8
8
|
return ApiFetchClient;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
var _exception = require("../plugins/exception");
|
|
12
|
-
var _reviver = require("../plugins/reviver");
|
|
13
11
|
var _apihelpers = require("../fwk/api.helpers");
|
|
14
12
|
var _errors = require("../fwk/errors");
|
|
13
|
+
var _exception = require("../plugins/exception");
|
|
14
|
+
var _reviver = require("../plugins/reviver");
|
|
15
15
|
function _array_like_to_array(arr, len) {
|
|
16
16
|
if (len == null || len > arr.length) len = arr.length;
|
|
17
17
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -417,17 +417,12 @@ var ApiFetchClient = /*#__PURE__*/ function() {
|
|
|
417
417
|
case 2:
|
|
418
418
|
canStart = _state.sent();
|
|
419
419
|
isCanceledBy = canStart.indexOf(false);
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
origin: origin
|
|
427
|
-
}));
|
|
428
|
-
} else {
|
|
429
|
-
asyncResponse = fetch(url, options);
|
|
430
|
-
}
|
|
420
|
+
asyncResponse = isCanceledBy === -1 ? fetch(url, options) : Promise.reject(new _errors.CanceledCallError("Is canceled by the plugin ".concat(isCanceledBy), isCanceledBy, _this.options.fetchPlugins[isCanceledBy], {
|
|
421
|
+
apiName: apiName,
|
|
422
|
+
operationId: operationId,
|
|
423
|
+
url: url,
|
|
424
|
+
origin: origin
|
|
425
|
+
}));
|
|
431
426
|
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
432
427
|
try {
|
|
433
428
|
for(_iterator = loadedPlugins[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
@@ -466,16 +461,12 @@ var ApiFetchClient = /*#__PURE__*/ function() {
|
|
|
466
461
|
];
|
|
467
462
|
case 5:
|
|
468
463
|
e = _state.sent();
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
url: url,
|
|
476
|
-
origin: origin
|
|
477
|
-
});
|
|
478
|
-
}
|
|
464
|
+
exception = _instanceof(e, _errors.CanceledCallError) ? e : new _errors.EmptyResponseError(e.message || 'Fail to Fetch', undefined, {
|
|
465
|
+
apiName: apiName,
|
|
466
|
+
operationId: operationId,
|
|
467
|
+
url: url,
|
|
468
|
+
origin: origin
|
|
469
|
+
});
|
|
479
470
|
return [
|
|
480
471
|
3,
|
|
481
472
|
6
|
|
@@ -491,7 +482,7 @@ var ApiFetchClient = /*#__PURE__*/ function() {
|
|
|
491
482
|
origin: origin
|
|
492
483
|
});
|
|
493
484
|
}
|
|
494
|
-
// eslint-disable-next-line no-console
|
|
485
|
+
// 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.
|
|
495
486
|
reviver = (0, _apihelpers.getResponseReviver)(revivers, response, operationId, {
|
|
496
487
|
disableFallback: _this.options.disableFallback,
|
|
497
488
|
log: console.error
|
package/cjs/fwk/api.helpers.js
CHANGED
|
@@ -112,8 +112,8 @@ function prepareUrl(url) {
|
|
|
112
112
|
}).map(function(name) {
|
|
113
113
|
return "".concat(name, "=").concat(queryParameters[name]);
|
|
114
114
|
}).join('&');
|
|
115
|
-
var paramsPrefix = url.
|
|
116
|
-
return url + (
|
|
115
|
+
var paramsPrefix = url.includes('?') ? '&' : '?';
|
|
116
|
+
return url + (queryPart ? paramsPrefix + queryPart : '');
|
|
117
117
|
}
|
|
118
118
|
function extractQueryParams(data, names) {
|
|
119
119
|
return names.filter(function(name) {
|
|
@@ -125,29 +125,29 @@ function extractQueryParams(data, names) {
|
|
|
125
125
|
}, {});
|
|
126
126
|
}
|
|
127
127
|
function filterUndefinedValues(object) {
|
|
128
|
-
return
|
|
128
|
+
return object ? Object.keys(object).filter(function(objectKey) {
|
|
129
129
|
return typeof object[objectKey] !== 'undefined';
|
|
130
130
|
}).reduce(function(acc, objectKey) {
|
|
131
131
|
acc[objectKey] = object[objectKey];
|
|
132
132
|
return acc;
|
|
133
|
-
}, {});
|
|
133
|
+
}, {}) : {};
|
|
134
134
|
}
|
|
135
135
|
function processFormData(data, type) {
|
|
136
136
|
var encodedData;
|
|
137
|
-
|
|
137
|
+
if (type === 'multipart/form-data') {
|
|
138
138
|
var formData = new FormData();
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
Object.entries(data).forEach(function(param) {
|
|
140
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
141
|
+
return formData.append(key, value);
|
|
142
|
+
});
|
|
142
143
|
encodedData = formData;
|
|
143
144
|
} else {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
encodedData = formData1.join('&');
|
|
145
|
+
encodedData = Object.entries(data).map(function(param) {
|
|
146
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
147
|
+
return "".concat(key, "=").concat(encodeURIComponent(value));
|
|
148
|
+
}).join('&');
|
|
149
149
|
}
|
|
150
|
-
|
|
150
|
+
return encodedData;
|
|
151
151
|
}
|
|
152
152
|
function computePiiParameterTokens(piiParameterNames) {
|
|
153
153
|
return piiParameterNames.reduce(function(tokens, parameterName) {
|
|
@@ -174,24 +174,20 @@ function tokenizeRequestOptions(tokenizedUrl, queryParameters, piiParamTokens, d
|
|
|
174
174
|
queryParams: tokenizedQueryParams
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
|
-
function getResponseReviver(revivers, response,
|
|
178
|
-
|
|
179
|
-
var
|
|
180
|
-
disableFallback: false,
|
|
181
|
-
log: console.error
|
|
182
|
-
};
|
|
177
|
+
function getResponseReviver(revivers, response, endpoint, options) {
|
|
178
|
+
// eslint-disable-next-line no-console -- set as default value
|
|
179
|
+
var _ref = options !== null && options !== void 0 ? options : {}, _ref_disableFallback = _ref.disableFallback, disableFallback = _ref_disableFallback === void 0 ? false : _ref_disableFallback, tmp = _ref.log, logMsg = tmp === void 0 ? options ? function() {} : console.error : tmp;
|
|
183
180
|
var logPrefix = "API status code error for ".concat(endpoint || 'unknown', " endpoint");
|
|
184
|
-
var logMsg = options.log || function() {};
|
|
185
181
|
if (!response || !response.ok) {
|
|
186
182
|
return undefined;
|
|
187
183
|
}
|
|
188
184
|
if (typeof revivers === 'function' || typeof revivers === 'undefined') {
|
|
189
185
|
return revivers;
|
|
190
186
|
}
|
|
191
|
-
if (response.status && Object.keys(revivers).
|
|
187
|
+
if (response.status && Object.keys(revivers).includes("".concat(response.status))) {
|
|
192
188
|
return revivers[response.status];
|
|
193
189
|
}
|
|
194
|
-
if (
|
|
190
|
+
if (disableFallback) {
|
|
195
191
|
logMsg("".concat(logPrefix, " - Missing ").concat(response.status, " from API specification - fallback is deactivated, no revive will run on this response"));
|
|
196
192
|
return undefined;
|
|
197
193
|
}
|
|
@@ -211,7 +207,7 @@ endpoint) {
|
|
|
211
207
|
statusCode: Number.MAX_SAFE_INTEGER,
|
|
212
208
|
reviver: undefined
|
|
213
209
|
});
|
|
214
|
-
var fallbackLog = Number.MAX_SAFE_INTEGER
|
|
210
|
+
var fallbackLog = Number.MAX_SAFE_INTEGER === fallback.statusCode ? 'No fallback found' : "Fallback to ".concat(fallback.statusCode, "'s reviver");
|
|
215
211
|
logMsg("".concat(logPrefix, " - Unknown ").concat(response.status || 'undefined', " code returned by the API - ").concat(fallbackLog));
|
|
216
212
|
return fallback.reviver;
|
|
217
213
|
}
|
|
@@ -9,5 +9,6 @@ Object.defineProperty(exports, "isApiClient", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
function isApiClient(client) {
|
|
12
|
-
|
|
12
|
+
var apiClient = client;
|
|
13
|
+
return !!apiClient && !!apiClient.options && typeof apiClient.extractQueryParams === 'function' && typeof apiClient.getRequestOptions === 'function' && typeof apiClient.prepareUrl === 'function' && typeof apiClient.processFormData === 'function' && typeof apiClient.processCall === 'function';
|
|
13
14
|
}
|
package/cjs/fwk/core/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
_export_star(require("./base-api-constructor"), exports);
|
|
6
5
|
_export_star(require("./api-client"), exports);
|
|
6
|
+
_export_star(require("./base-api-constructor"), exports);
|
|
7
7
|
function _export_star(from, to) {
|
|
8
8
|
Object.keys(from).forEach(function(k) {
|
|
9
9
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
package/cjs/fwk/date.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention -- keep to not introduce breaking change
|
|
2
|
+
"use strict";
|
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
|
3
4
|
value: true
|
|
4
5
|
});
|
|
@@ -187,27 +188,23 @@ var CommonDate = /*#__PURE__*/ function(Date1) {
|
|
|
187
188
|
args[_key] = arguments[_key];
|
|
188
189
|
}
|
|
189
190
|
_class_call_check(this, CommonDate);
|
|
190
|
-
if (args) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
args[0] += "".concat(TIME_ZONE_OFFSET < 0 ? '+' : '-').concat(pad(Math.floor(Math.abs(TIME_ZONE_OFFSET / 60))), ":").concat(pad(Math.abs(TIME_ZONE_OFFSET % 60)));
|
|
208
|
-
}
|
|
209
|
-
} else if (_instanceof(args[0], CommonDate)) {
|
|
210
|
-
args[0] = args[0];
|
|
191
|
+
if (args && typeof args[0] === 'string') {
|
|
192
|
+
var idxT = args[0].lastIndexOf('T');
|
|
193
|
+
// TZD = time zone designator (Z or +hh:mm or -hh:mm)
|
|
194
|
+
var idx = args[0].lastIndexOf('Z');
|
|
195
|
+
if (idx < 0) {
|
|
196
|
+
idx = args[0].lastIndexOf('+');
|
|
197
|
+
}
|
|
198
|
+
if (idx < 0 && idxT > 0) {
|
|
199
|
+
var relativeIdx = args[0].substring(idxT).lastIndexOf('-');
|
|
200
|
+
idx = relativeIdx > 0 ? relativeIdx + idxT : relativeIdx;
|
|
201
|
+
}
|
|
202
|
+
if (idx > 0) {
|
|
203
|
+
args[0] = args[0].substring(0, idx);
|
|
204
|
+
}
|
|
205
|
+
var TIME_ZONE_OFFSET = _construct(Date, _to_consumable_array(args)).getTimezoneOffset();
|
|
206
|
+
if (idxT > 0) {
|
|
207
|
+
args[0] += "".concat(TIME_ZONE_OFFSET < 0 ? '+' : '-').concat(pad(Math.floor(Math.abs(TIME_ZONE_OFFSET / 60))), ":").concat(pad(Math.abs(TIME_ZONE_OFFSET % 60)));
|
|
211
208
|
}
|
|
212
209
|
}
|
|
213
210
|
return _call_super(this, CommonDate, _to_consumable_array(args));
|
|
@@ -233,7 +230,7 @@ var CommonDate = /*#__PURE__*/ function(Date1) {
|
|
|
233
230
|
args[_key] = arguments[_key];
|
|
234
231
|
}
|
|
235
232
|
_class_call_check(this, Date1);
|
|
236
|
-
if (args && typeof args[0] === 'string' && args[0].
|
|
233
|
+
if (args && typeof args[0] === 'string' && !args[0].includes('T')) {
|
|
237
234
|
args[0] = "".concat(args[0], "T00:00:00Z");
|
|
238
235
|
} else if (_instanceof(args[0], _NativeDateClass)) {
|
|
239
236
|
args[0] = "".concat(args[0].getFullYear(), "-").concat(pad(args[0].getMonth() + 1), "-").concat(pad(args[0].getDate()), "T00:00:00Z");
|
|
@@ -245,7 +242,8 @@ var CommonDate = /*#__PURE__*/ function(Date1) {
|
|
|
245
242
|
key: "_Date",
|
|
246
243
|
value: /**
|
|
247
244
|
* To ensure that users cannot use a standard Date instead of utils.Date
|
|
248
|
-
*/
|
|
245
|
+
*/ // eslint-disable-next-line @typescript-eslint/naming-convention -- keep to not introduce breaking change
|
|
246
|
+
function _Date() {}
|
|
249
247
|
},
|
|
250
248
|
{
|
|
251
249
|
key: "toJSON",
|
|
@@ -259,9 +257,8 @@ var CommonDate = /*#__PURE__*/ function(Date1) {
|
|
|
259
257
|
key: "equals",
|
|
260
258
|
value: /**
|
|
261
259
|
* Compare if two dates are equals.
|
|
262
|
-
*
|
|
263
260
|
* @param {Date} date the date to compare
|
|
264
|
-
* @
|
|
261
|
+
* @returns {boolean} true if the dates are equals.
|
|
265
262
|
*/ function equals(date) {
|
|
266
263
|
if (!date) {
|
|
267
264
|
return false;
|
|
@@ -280,6 +277,7 @@ var CommonDate = /*#__PURE__*/ function(Date1) {
|
|
|
280
277
|
args[_key] = arguments[_key];
|
|
281
278
|
}
|
|
282
279
|
_class_call_check(this, DateTime);
|
|
280
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- type is explicitly `any`
|
|
283
281
|
return _call_super(this, DateTime, _to_consumable_array(args));
|
|
284
282
|
}
|
|
285
283
|
_create_class(DateTime, [
|
|
@@ -287,7 +285,8 @@ var CommonDate = /*#__PURE__*/ function(Date1) {
|
|
|
287
285
|
key: "_DateTime",
|
|
288
286
|
value: /**
|
|
289
287
|
* To ensure that users cannot use a standard Date instead of utils.DateTime
|
|
290
|
-
*/
|
|
288
|
+
*/ // eslint-disable-next-line @typescript-eslint/naming-convention -- keep to not introduce breaking change
|
|
289
|
+
function _DateTime() {}
|
|
291
290
|
}
|
|
292
291
|
]);
|
|
293
292
|
return DateTime;
|
package/cjs/fwk/date.spec.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
var _date = require("./date");
|
|
6
6
|
describe('DateTime', function() {
|
|
7
7
|
it('should support timestamp', function() {
|
|
8
|
-
var ts =
|
|
8
|
+
var ts = Date.now();
|
|
9
9
|
var dateUtils = new _date.utils.DateTime(ts);
|
|
10
10
|
expect(dateUtils.getTime()).toEqual(ts);
|
|
11
11
|
});
|
|
@@ -19,6 +19,7 @@ describe('DateTime', function() {
|
|
|
19
19
|
});
|
|
20
20
|
it('should support json conversions', function() {
|
|
21
21
|
var originalDate = new _date.utils.DateTime(new Date());
|
|
22
|
+
// eslint-disable-next-line unicorn/prefer-structured-clone -- we test the JSON conversion
|
|
22
23
|
var jsonDate = JSON.parse(JSON.stringify(originalDate));
|
|
23
24
|
expect(new _date.utils.DateTime(jsonDate)).toEqual(originalDate);
|
|
24
25
|
});
|
|
@@ -56,7 +57,7 @@ describe('DateTime', function() {
|
|
|
56
57
|
});
|
|
57
58
|
describe('Date', function() {
|
|
58
59
|
it('should support timestamp', function() {
|
|
59
|
-
var ts =
|
|
60
|
+
var ts = Date.now();
|
|
60
61
|
var dateUtils = new _date.utils.Date(ts);
|
|
61
62
|
expect(dateUtils.getTime()).toEqual(ts);
|
|
62
63
|
});
|
|
@@ -70,6 +71,7 @@ describe('Date', function() {
|
|
|
70
71
|
});
|
|
71
72
|
it('should support json conversions', function() {
|
|
72
73
|
var originalDate = new _date.utils.Date(new Date());
|
|
74
|
+
// eslint-disable-next-line unicorn/prefer-structured-clone -- we test the JSON conversion
|
|
73
75
|
var jsonDate = JSON.parse(JSON.stringify(originalDate));
|
|
74
76
|
expect(new _date.utils.Date(jsonDate)).toEqual(originalDate);
|
|
75
77
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/** Type helper to ignore the constraint on literal union type (enum) of an SDK model */
|
|
2
|
-
"use strict";
|
|
1
|
+
/** Type helper to ignore the constraint on literal union type (enum) of an SDK model */ "use strict";
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
3
|
value: true
|
|
5
4
|
});
|
package/cjs/fwk/index.js
CHANGED
|
@@ -11,7 +11,7 @@ _export_star(require("./errors"), exports);
|
|
|
11
11
|
_export_star(require("./ignore-enum.type"), exports);
|
|
12
12
|
_export_star(require("./logger"), exports);
|
|
13
13
|
_export_star(require("./mocks/index"), exports);
|
|
14
|
-
_export_star(require("./
|
|
14
|
+
_export_star(require("./reviver"), exports);
|
|
15
15
|
function _export_star(from, to) {
|
|
16
16
|
Object.keys(from).forEach(function(k) {
|
|
17
17
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -188,19 +188,19 @@ function _ts_generator(thisArg, body) {
|
|
|
188
188
|
}
|
|
189
189
|
/**
|
|
190
190
|
* a new call is detected thanks to the timestamp printed by ALF on a new line, ex: "2021/12/16 18:21:28.312472 "
|
|
191
|
-
*/ var logNewCallRegex = RegExp(/^\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}\.\d{6}\b/gm);
|
|
191
|
+
*/ var logNewCallRegex = new RegExp(/^\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}\.\d{6}\b/gm);
|
|
192
192
|
/**
|
|
193
193
|
* the correlation Id is printed this way by ALF, ex: CorrID=0001W37ZH480AJ,
|
|
194
|
-
*/ var correlationIdRegex = RegExp(/CorrID=([^,]*),/);
|
|
194
|
+
*/ var correlationIdRegex = new RegExp(/CorrID=([^,]*),/);
|
|
195
195
|
/**
|
|
196
196
|
* a request is logged with its HTTP method and the path targetted on a new line, ex: "GET /1ASIUAIRFAC/v2/shopping..."
|
|
197
|
-
*/ var requestRegex = RegExp(/^(POST|GET|PATCH|DELETE) \/(
|
|
197
|
+
*/ var requestRegex = new RegExp(/^(POST|GET|PATCH|DELETE) \/(\S*)/m);
|
|
198
198
|
/**
|
|
199
199
|
* a request is logged with its HTTP version and the HTTP status on a new line, ex: "HTTP/1.1 200 OK"
|
|
200
|
-
*/ var responseRegex = RegExp(/^(HTTP\/1.1 \d{3})/m);
|
|
200
|
+
*/ var responseRegex = new RegExp(/^(HTTP\/1.1 \d{3})/m);
|
|
201
201
|
/**
|
|
202
202
|
* the response data is logged with its JSON content on a new line
|
|
203
|
-
*/ var requestResponseJsonRegexp = RegExp(/(^{.*}$)/m);
|
|
203
|
+
*/ var requestResponseJsonRegexp = new RegExp(/(^{.*}$)/m);
|
|
204
204
|
/**
|
|
205
205
|
* Split the logs
|
|
206
206
|
* @param log alf log
|
|
@@ -220,7 +220,7 @@ function _ts_generator(thisArg, body) {
|
|
|
220
220
|
if (match && match[1] && match[2]) {
|
|
221
221
|
// the match looks like this 1ASIUAIRFAC/v2/shopping/carts/19DXNCKB931CYX3S?refresh=true
|
|
222
222
|
// so we remove the SAP information at the beginning and URL parameters at the end if any
|
|
223
|
-
var requestUrl = match[2].substring(match[2].indexOf('/'), match[2].
|
|
223
|
+
var requestUrl = match[2].substring(match[2].indexOf('/'), match[2].includes('?') ? match[2].indexOf('?') : match[2].length);
|
|
224
224
|
var method = match[1];
|
|
225
225
|
var pathObject = (0, _helpers.getPath)(requestUrl, operationAdapter, method);
|
|
226
226
|
if (pathObject) {
|
|
@@ -327,6 +327,7 @@ function _ts_generator(thisArg, body) {
|
|
|
327
327
|
mockMap[alfCall.operationId] = [];
|
|
328
328
|
}
|
|
329
329
|
mockMap[alfCall.operationId].push({
|
|
330
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- type is explicitly `any`
|
|
330
331
|
mockData: alfCall.response ? JSON.parse(alfCall.response) : ''
|
|
331
332
|
});
|
|
332
333
|
return mockMap;
|
|
@@ -174,10 +174,10 @@ var BaseMockAdapter = /*#__PURE__*/ function() {
|
|
|
174
174
|
_define_property(this, "mockFactory", void 0);
|
|
175
175
|
this.pathObjects = pathObjects;
|
|
176
176
|
this.mocks = {};
|
|
177
|
-
if (typeof mockMap
|
|
178
|
-
this.mocks = mockMap;
|
|
179
|
-
} else {
|
|
177
|
+
if (typeof mockMap === 'function') {
|
|
180
178
|
this.mockFactory = mockMap;
|
|
179
|
+
} else {
|
|
180
|
+
this.mocks = mockMap;
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
_create_class(BaseMockAdapter, [
|
package/cjs/fwk/mocks/helpers.js
CHANGED
|
@@ -45,12 +45,12 @@ function getPath(requestUrl, pathObjects, method) {
|
|
|
45
45
|
return newMatches;
|
|
46
46
|
}, []);
|
|
47
47
|
var lastIndex = -1;
|
|
48
|
-
var nextIndex = -1;
|
|
49
48
|
while(matches.length > 1){
|
|
50
|
-
|
|
49
|
+
var result = matches.reduce(function(param, match) {
|
|
50
|
+
var newMatches = param.matches, nextIndex = param.nextIndex;
|
|
51
51
|
var newIndex = match.segments.findIndex(function(segment) {
|
|
52
52
|
return segment.startsWith('{') && segment.endsWith('}');
|
|
53
|
-
}
|
|
53
|
+
});
|
|
54
54
|
// Complete static match so use some value that can't be exceeded
|
|
55
55
|
if (newIndex === -1) {
|
|
56
56
|
newIndex = Infinity;
|
|
@@ -63,11 +63,19 @@ function getPath(requestUrl, pathObjects, method) {
|
|
|
63
63
|
} else if (newIndex === nextIndex) {
|
|
64
64
|
newMatches.push(match);
|
|
65
65
|
}
|
|
66
|
-
return
|
|
67
|
-
|
|
66
|
+
return {
|
|
67
|
+
matches: newMatches,
|
|
68
|
+
nextIndex: nextIndex
|
|
69
|
+
};
|
|
70
|
+
}, {
|
|
71
|
+
matches: [],
|
|
72
|
+
nextIndex: -1
|
|
73
|
+
});
|
|
74
|
+
var next = result.nextIndex;
|
|
75
|
+
matches = result.matches;
|
|
68
76
|
// At this point we have tried to filter the matches but there are multiple matches that are identical and cannot
|
|
69
77
|
// be filtered further. Trying to filter on the HTTP method if provided, then choose the first match.
|
|
70
|
-
if (lastIndex ===
|
|
78
|
+
if (lastIndex === next) {
|
|
71
79
|
if (method) {
|
|
72
80
|
// Try to filter the multiple matches based on the HTTP method
|
|
73
81
|
matches.splice(0, matches.findIndex(function(match) {
|
|
@@ -76,7 +84,7 @@ function getPath(requestUrl, pathObjects, method) {
|
|
|
76
84
|
}
|
|
77
85
|
matches.splice(1);
|
|
78
86
|
}
|
|
79
|
-
lastIndex =
|
|
87
|
+
lastIndex = next;
|
|
80
88
|
}
|
|
81
89
|
return matches.length > 0 ? pathObjects[matches[0].index] : undefined;
|
|
82
90
|
}
|
package/cjs/fwk/mocks/index.js
CHANGED
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
_export_star(require("./alf-mock-adapter"), exports);
|
|
6
|
+
_export_star(require("./base-mock-adapter"), exports);
|
|
6
7
|
_export_star(require("./encoded-api-request"), exports);
|
|
7
|
-
_export_star(require("./
|
|
8
|
+
_export_star(require("./helpers"), exports);
|
|
8
9
|
_export_star(require("./mock"), exports);
|
|
10
|
+
_export_star(require("./mock-adapter"), exports);
|
|
9
11
|
_export_star(require("./operation"), exports);
|
|
10
12
|
_export_star(require("./path-object"), exports);
|
|
11
|
-
_export_star(require("./base-mock-adapter"), exports);
|
|
12
|
-
_export_star(require("./helpers"), exports);
|
|
13
13
|
_export_star(require("./random-mock-adapter"), exports);
|
|
14
14
|
_export_star(require("./sequential-mock-adapter"), exports);
|
|
15
15
|
function _export_star(from, to) {
|
|
@@ -26,8 +26,7 @@ function reviveMap(data) {
|
|
|
26
26
|
}
|
|
27
27
|
var revived = {};
|
|
28
28
|
for(var key in data){
|
|
29
|
-
|
|
30
|
-
if (data.hasOwnProperty(key)) {
|
|
29
|
+
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
|
31
30
|
revived[key] = reviver(data[key], dictionaries, options);
|
|
32
31
|
}
|
|
33
32
|
}
|
package/cjs/fwk/reviver.spec.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
var
|
|
5
|
+
var _reviver = require("./reviver");
|
|
6
6
|
describe('Revivers :', function() {
|
|
7
7
|
it('reviveDictionarizedArray', function() {
|
|
8
8
|
var dictionary = {
|
|
@@ -13,13 +13,13 @@ describe('Revivers :', function() {
|
|
|
13
13
|
p2: 'v2'
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
expect((0,
|
|
16
|
+
expect((0, _reviver.reviveDictionarizedArray)(undefined, {}, function(data) {
|
|
17
17
|
return data;
|
|
18
18
|
})).toBeUndefined();
|
|
19
|
-
expect((0,
|
|
19
|
+
expect((0, _reviver.reviveDictionarizedArray)([], {}, function(data) {
|
|
20
20
|
return data;
|
|
21
21
|
})).toEqual({});
|
|
22
|
-
expect((0,
|
|
22
|
+
expect((0, _reviver.reviveDictionarizedArray)([
|
|
23
23
|
'id1',
|
|
24
24
|
'id2'
|
|
25
25
|
], {}, function(data) {
|
|
@@ -28,10 +28,10 @@ describe('Revivers :', function() {
|
|
|
28
28
|
id1: undefined,
|
|
29
29
|
id2: undefined
|
|
30
30
|
});
|
|
31
|
-
expect((0,
|
|
31
|
+
expect((0, _reviver.reviveDictionarizedArray)([], dictionary, function(data) {
|
|
32
32
|
return data;
|
|
33
33
|
})).toEqual({});
|
|
34
|
-
var result = (0,
|
|
34
|
+
var result = (0, _reviver.reviveDictionarizedArray)([
|
|
35
35
|
'id1',
|
|
36
36
|
'id2'
|
|
37
37
|
], dictionary, function(data) {
|
|
@@ -49,7 +49,7 @@ describe('Revivers :', function() {
|
|
|
49
49
|
var options = {
|
|
50
50
|
logger: jest.fn()
|
|
51
51
|
};
|
|
52
|
-
(0,
|
|
52
|
+
(0, _reviver.reviveArray)([
|
|
53
53
|
1
|
|
54
54
|
], null, reviver, options);
|
|
55
55
|
expect(reviver).toHaveBeenCalledWith(1, null, options);
|
|
@@ -62,7 +62,7 @@ describe('Revivers :', function() {
|
|
|
62
62
|
var dictionary = {
|
|
63
63
|
key: 'test'
|
|
64
64
|
};
|
|
65
|
-
(0,
|
|
65
|
+
(0, _reviver.reviveDictionarizedArray)([
|
|
66
66
|
'key'
|
|
67
67
|
], dictionary, reviver, options);
|
|
68
68
|
expect(reviver).toHaveBeenCalledWith('test', dictionary, options);
|
|
@@ -75,7 +75,7 @@ describe('Revivers :', function() {
|
|
|
75
75
|
var dictionary = {
|
|
76
76
|
key: 'test'
|
|
77
77
|
};
|
|
78
|
-
(0,
|
|
78
|
+
(0, _reviver.reviveMap)([
|
|
79
79
|
'key'
|
|
80
80
|
], dictionary, reviver, options);
|
|
81
81
|
expect(reviver).toHaveBeenCalledWith('key', dictionary, options);
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
_export_star(require("./additional-params.request"), exports);
|
|
6
5
|
_export_star(require("./additional-params-sync.request"), exports);
|
|
6
|
+
_export_star(require("./additional-params.request"), exports);
|
|
7
7
|
function _export_star(from, to) {
|
|
8
8
|
Object.keys(from).forEach(function(k) {
|
|
9
9
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|