@ama-sdk/core 10.0.0-next.8 → 11.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -31
- package/cjs/clients/api-angular-client.js +6 -2
- package/cjs/clients/api-beacon-client.js +3 -2
- package/cjs/clients/api-fetch-client.js +9 -4
- package/cjs/fwk/Reviver.js +3 -3
- package/cjs/fwk/api.helpers.js +9 -10
- package/cjs/fwk/api.js +2 -2
- package/cjs/fwk/date.js +4 -39
- package/cjs/fwk/errors.js +10 -11
- package/cjs/fwk/index.js +1 -0
- package/cjs/fwk/logger.js +9 -0
- package/cjs/fwk/mocks/alf-mock-adapter.js +1 -8
- package/cjs/fwk/mocks/base-mock-adapter.js +0 -12
- package/cjs/plugins/additional-params/additional-params.request.js +5 -5
- package/cjs/plugins/api-configuration-override/api-configuration-override.request.js +2 -2
- package/cjs/plugins/api-key/api-key.request.js +2 -2
- package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +77 -105
- package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +9 -98
- package/cjs/plugins/client-facts/client-facts.request.js +5 -7
- package/cjs/plugins/concurrent/concurrent.fetch.js +2 -2
- package/cjs/plugins/core/plugin.js +1 -3
- package/cjs/plugins/custom-info/custom-info.reply.js +0 -1
- package/cjs/plugins/index.js +0 -21
- package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +7 -9
- package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +1 -0
- package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +5 -4
- package/cjs/plugins/mock-intercept/mock-intercept.request.js +3 -3
- package/cjs/plugins/mock-intercept/mock-intercept.spec.js +1 -3
- package/cjs/plugins/perf-metric/perf-metric.fetch.js +2 -5
- package/cjs/plugins/pii-tokenizer/pii-tokenizer.request.js +12 -14
- package/cjs/plugins/pii-tokenizer/pii-tokenizer.spec.js +3 -1
- package/cjs/plugins/retry/retry.fetch.js +2 -3
- package/cjs/plugins/session-id/session-id.request.js +10 -11
- package/cjs/plugins/session-id/session-id.spec.js +12 -8
- package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +2 -4
- package/cjs/plugins/timeout/timeout.fetch.js +75 -15
- package/cjs/plugins/timeout/timeout.spec.js +102 -3
- package/cjs/plugins/url-rewrite/url-rewrite.request.js +2 -2
- package/cjs/plugins/wait-for/wait-for.fetch.js +2 -2
- package/cjs/public_api.js +1 -0
- package/cjs/utils/crypto.js +5 -5
- package/cjs/utils/encoder.js +0 -5
- package/cjs/{plugins/gateway-token → utils}/index.js +5 -2
- package/cjs/utils/json-token.js +11 -13
- package/cjs/utils/json-token.spec.js +4 -2
- package/cjs/utils/mime-types.js +22 -0
- package/cli/clear-index.cjs +25 -0
- package/cli/clear-index.cjs.map +1 -0
- package/cli/clear-index.d.cts +3 -0
- package/cli/clear-index.d.cts.map +1 -0
- package/cli/files-pack.cjs +84 -0
- package/cli/files-pack.cjs.map +1 -0
- package/cli/files-pack.d.cts +3 -0
- package/cli/files-pack.d.cts.map +1 -0
- package/cli/package.json +3 -0
- package/esm2015/clients/api-angular-client.js +6 -2
- package/esm2015/clients/api-beacon-client.js +3 -2
- package/esm2015/clients/api-fetch-client.js +9 -4
- package/esm2015/fwk/Reviver.js +0 -3
- package/esm2015/fwk/api.helpers.js +3 -3
- package/esm2015/fwk/api.interface.js +1 -1
- package/esm2015/fwk/api.js +2 -2
- package/esm2015/fwk/core/api-client.js +0 -1
- package/esm2015/fwk/core/base-api-constructor.js +0 -1
- package/esm2015/fwk/date.js +1 -38
- package/esm2015/fwk/errors.js +2 -3
- package/esm2015/fwk/index.js +1 -0
- package/esm2015/fwk/logger.js +6 -0
- package/esm2015/fwk/mocks/alf-mock-adapter.js +1 -9
- package/esm2015/fwk/mocks/base-mock-adapter.js +0 -12
- package/esm2015/fwk/mocks/encoded-api-request.js +3 -1
- package/esm2015/fwk/mocks/helpers.js +0 -2
- package/esm2015/fwk/mocks/mock-adapter.js +1 -1
- package/esm2015/fwk/mocks/path-object.js +1 -1
- package/esm2015/plugins/additional-params/additional-params.request.js +2 -3
- package/esm2015/plugins/api-configuration-override/api-configuration-override.request.js +2 -3
- package/esm2015/plugins/api-key/api-key.request.js +2 -2
- package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +84 -118
- package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +10 -99
- package/esm2015/plugins/client-facts/client-facts.request.js +14 -7
- package/esm2015/plugins/concurrent/concurrent.fetch.js +2 -2
- package/esm2015/plugins/core/fetch-plugin.js +4 -1
- package/esm2015/plugins/core/plugin.js +1 -1
- package/esm2015/plugins/core/reply-plugin.js +4 -1
- package/esm2015/plugins/core/request-plugin.js +4 -1
- package/esm2015/plugins/custom-info/custom-info.reply.js +0 -1
- package/esm2015/plugins/index.js +0 -4
- package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +3 -7
- package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +1 -0
- package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +5 -4
- package/esm2015/plugins/mock-intercept/mock-intercept.request.js +3 -3
- package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +1 -3
- package/esm2015/plugins/perf-metric/perf-metric.fetch.js +2 -5
- package/esm2015/plugins/pii-tokenizer/pii-tokenizer.request.js +19 -21
- package/esm2015/plugins/retry/retry.fetch.js +2 -3
- package/esm2015/plugins/session-id/session-id.request.js +10 -11
- package/esm2015/plugins/session-id/session-id.spec.js +12 -8
- package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +10 -10
- package/esm2015/plugins/timeout/timeout.fetch.js +70 -12
- package/esm2015/plugins/timeout/timeout.spec.js +102 -3
- package/esm2015/plugins/url-rewrite/url-rewrite.request.js +2 -2
- package/esm2015/plugins/wait-for/wait-for.fetch.js +4 -3
- package/esm2015/public_api.js +1 -0
- package/esm2015/utils/crypto.js +0 -4
- package/esm2015/utils/encoder.js +0 -5
- package/esm2015/utils/ie11.js +0 -1
- package/esm2015/utils/index.js +5 -0
- package/esm2015/utils/json-token.js +2 -7
- package/esm2015/utils/json-token.spec.js +4 -2
- package/esm2015/utils/mime-types.js +7 -0
- package/package.json +51 -36
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +38 -20
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/schema.json +2 -2
- package/src/clients/api-angular-client.d.ts.map +1 -1
- package/src/clients/api-angular-client.js +3 -2
- package/src/clients/api-angular-client.js.map +1 -1
- package/src/clients/api-beacon-client.d.ts +0 -1
- package/src/clients/api-beacon-client.d.ts.map +1 -1
- package/src/clients/api-beacon-client.js +1 -3
- package/src/clients/api-beacon-client.js.map +1 -1
- package/src/clients/api-fetch-client.d.ts +0 -1
- package/src/clients/api-fetch-client.d.ts.map +1 -1
- package/src/clients/api-fetch-client.js +5 -5
- package/src/clients/api-fetch-client.js.map +1 -1
- package/src/fwk/Reviver.d.ts +0 -3
- package/src/fwk/Reviver.d.ts.map +1 -1
- package/src/fwk/Reviver.js +0 -3
- package/src/fwk/Reviver.js.map +1 -1
- package/src/fwk/api.helpers.d.ts +2 -1
- package/src/fwk/api.helpers.d.ts.map +1 -1
- package/src/fwk/api.helpers.js +2 -1
- package/src/fwk/api.helpers.js.map +1 -1
- package/src/fwk/core/api-client.d.ts +0 -4
- package/src/fwk/core/api-client.d.ts.map +1 -1
- package/src/fwk/core/api-client.js +0 -1
- package/src/fwk/core/api-client.js.map +1 -1
- package/src/fwk/core/base-api-constructor.d.ts +3 -2
- package/src/fwk/core/base-api-constructor.d.ts.map +1 -1
- package/src/fwk/core/base-api-constructor.js +0 -1
- package/src/fwk/core/base-api-constructor.js.map +1 -1
- package/src/fwk/date.d.ts +0 -15
- package/src/fwk/date.d.ts.map +1 -1
- package/src/fwk/date.js +0 -36
- package/src/fwk/date.js.map +1 -1
- package/src/fwk/index.d.ts +1 -0
- package/src/fwk/index.d.ts.map +1 -1
- package/src/fwk/index.js +1 -0
- package/src/fwk/index.js.map +1 -1
- package/src/fwk/logger.d.ts +39 -0
- package/src/fwk/logger.d.ts.map +1 -0
- package/src/fwk/logger.js +2 -0
- package/src/fwk/logger.js.map +1 -0
- package/src/fwk/mocks/alf-mock-adapter.d.ts +0 -1
- package/src/fwk/mocks/alf-mock-adapter.d.ts.map +1 -1
- package/src/fwk/mocks/alf-mock-adapter.js +0 -7
- package/src/fwk/mocks/alf-mock-adapter.js.map +1 -1
- package/src/fwk/mocks/base-mock-adapter.d.ts +0 -4
- package/src/fwk/mocks/base-mock-adapter.d.ts.map +1 -1
- package/src/fwk/mocks/base-mock-adapter.js +0 -10
- package/src/fwk/mocks/base-mock-adapter.js.map +1 -1
- package/src/fwk/mocks/helpers.d.ts +0 -2
- package/src/fwk/mocks/helpers.d.ts.map +1 -1
- package/src/fwk/mocks/helpers.js +0 -2
- package/src/fwk/mocks/helpers.js.map +1 -1
- package/src/fwk/mocks/mock-adapter.d.ts +0 -10
- package/src/fwk/mocks/mock-adapter.d.ts.map +1 -1
- package/src/fwk/mocks/random-mock-adapter.d.ts +1 -1
- package/src/fwk/mocks/random-mock-adapter.d.ts.map +1 -1
- package/src/fwk/mocks/random-mock-adapter.js.map +1 -1
- package/src/plugins/additional-params/additional-params-sync.request.d.ts +1 -2
- package/src/plugins/additional-params/additional-params-sync.request.d.ts.map +1 -1
- package/src/plugins/additional-params/additional-params-sync.request.js +0 -1
- package/src/plugins/additional-params/additional-params-sync.request.js.map +1 -1
- package/src/plugins/additional-params/additional-params.request.d.ts +1 -3
- package/src/plugins/additional-params/additional-params.request.d.ts.map +1 -1
- package/src/plugins/additional-params/additional-params.request.js +0 -2
- package/src/plugins/additional-params/additional-params.request.js.map +1 -1
- package/src/plugins/api-configuration-override/api-configuration-override.request.d.ts +2 -4
- 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 +0 -2
- package/src/plugins/api-configuration-override/api-configuration-override.request.js.map +1 -1
- package/src/plugins/api-key/api-key.request.d.ts +2 -3
- package/src/plugins/api-key/api-key.request.d.ts.map +1 -1
- package/src/plugins/api-key/api-key.request.js +0 -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 +16 -31
- 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 +20 -61
- package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js.map +1 -1
- package/src/plugins/client-facts/client-facts.request.d.ts +15 -8
- package/src/plugins/client-facts/client-facts.request.d.ts.map +1 -1
- package/src/plugins/client-facts/client-facts.request.js +12 -5
- package/src/plugins/client-facts/client-facts.request.js.map +1 -1
- package/src/plugins/concurrent/concurrent.fetch.d.ts +1 -2
- package/src/plugins/concurrent/concurrent.fetch.d.ts.map +1 -1
- package/src/plugins/concurrent/concurrent.fetch.js +0 -1
- package/src/plugins/concurrent/concurrent.fetch.js.map +1 -1
- package/src/plugins/core/fetch-plugin.d.ts +7 -4
- package/src/plugins/core/fetch-plugin.d.ts.map +1 -1
- package/src/plugins/core/plugin.d.ts +15 -2
- package/src/plugins/core/plugin.d.ts.map +1 -1
- package/src/plugins/core/reply-plugin.d.ts +8 -5
- package/src/plugins/core/reply-plugin.d.ts.map +1 -1
- package/src/plugins/core/request-plugin.d.ts +11 -3
- package/src/plugins/core/request-plugin.d.ts.map +1 -1
- package/src/plugins/custom-info/custom-info.reply.d.ts +1 -3
- package/src/plugins/custom-info/custom-info.reply.d.ts.map +1 -1
- package/src/plugins/custom-info/custom-info.reply.js +0 -2
- package/src/plugins/custom-info/custom-info.reply.js.map +1 -1
- package/src/plugins/exception/exception.reply.d.ts +1 -1
- package/src/plugins/exception/exception.reply.d.ts.map +1 -1
- package/src/plugins/exception/exception.reply.js.map +1 -1
- package/src/plugins/fetch-cache/fetch-cache.request.d.ts +3 -3
- package/src/plugins/fetch-cache/fetch-cache.request.d.ts.map +1 -1
- package/src/plugins/fetch-credentials/fetch-credentials.request.d.ts +1 -1
- package/src/plugins/fetch-credentials/fetch-credentials.request.d.ts.map +1 -1
- package/src/plugins/index.d.ts +0 -4
- package/src/plugins/index.d.ts.map +1 -1
- package/src/plugins/index.js +0 -4
- package/src/plugins/index.js.map +1 -1
- package/src/plugins/json-token/json-token.reply.d.ts +0 -1
- package/src/plugins/json-token/json-token.reply.d.ts.map +1 -1
- package/src/plugins/json-token/json-token.reply.js +0 -1
- package/src/plugins/json-token/json-token.reply.js.map +1 -1
- package/src/plugins/json-token/json-token.request.d.ts +2 -3
- package/src/plugins/json-token/json-token.request.d.ts.map +1 -1
- package/src/plugins/json-token/json-token.request.js +0 -1
- package/src/plugins/json-token/json-token.request.js.map +1 -1
- package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.d.ts +2 -8
- 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 +0 -6
- package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.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 +3 -2
- package/src/plugins/mock-intercept/mock-intercept.fetch.js.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.request.d.ts +1 -1
- package/src/plugins/mock-intercept/mock-intercept.request.d.ts.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.request.js +1 -1
- package/src/plugins/mock-intercept/mock-intercept.request.js.map +1 -1
- package/src/plugins/perf-metric/perf-metric.fetch.d.ts +0 -3
- package/src/plugins/perf-metric/perf-metric.fetch.d.ts.map +1 -1
- package/src/plugins/perf-metric/perf-metric.fetch.js +0 -3
- package/src/plugins/perf-metric/perf-metric.fetch.js.map +1 -1
- package/src/plugins/pii-tokenizer/pii-tokenizer.request.d.ts +19 -21
- package/src/plugins/pii-tokenizer/pii-tokenizer.request.d.ts.map +1 -1
- package/src/plugins/pii-tokenizer/pii-tokenizer.request.js +18 -20
- package/src/plugins/pii-tokenizer/pii-tokenizer.request.js.map +1 -1
- package/src/plugins/retry/retry.fetch.d.ts +8 -7
- package/src/plugins/retry/retry.fetch.d.ts.map +1 -1
- package/src/plugins/retry/retry.fetch.js +0 -2
- package/src/plugins/retry/retry.fetch.js.map +1 -1
- package/src/plugins/session-id/session-id.request.d.ts +7 -6
- package/src/plugins/session-id/session-id.request.d.ts.map +1 -1
- package/src/plugins/session-id/session-id.request.js +11 -12
- package/src/plugins/session-id/session-id.request.js.map +1 -1
- package/src/plugins/si-token/si-token.request.d.ts +0 -1
- package/src/plugins/si-token/si-token.request.d.ts.map +1 -1
- package/src/plugins/si-token/si-token.request.js +0 -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 +10 -11
- 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 +8 -9
- package/src/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js.map +1 -1
- package/src/plugins/timeout/timeout.fetch.d.ts +31 -2
- package/src/plugins/timeout/timeout.fetch.d.ts.map +1 -1
- package/src/plugins/timeout/timeout.fetch.js +62 -10
- package/src/plugins/timeout/timeout.fetch.js.map +1 -1
- package/src/plugins/url-rewrite/url-rewrite.request.d.ts +1 -2
- package/src/plugins/url-rewrite/url-rewrite.request.d.ts.map +1 -1
- package/src/plugins/url-rewrite/url-rewrite.request.js +0 -1
- package/src/plugins/url-rewrite/url-rewrite.request.js.map +1 -1
- package/src/plugins/wait-for/wait-for.fetch.d.ts +2 -3
- 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/public_api.d.ts +1 -0
- package/src/public_api.d.ts.map +1 -1
- package/src/public_api.js +1 -0
- package/src/public_api.js.map +1 -1
- package/src/utils/crypto.d.ts +0 -4
- package/src/utils/crypto.d.ts.map +1 -1
- package/src/utils/crypto.js +0 -4
- package/src/utils/crypto.js.map +1 -1
- package/src/utils/encoder.d.ts +0 -1
- package/src/utils/encoder.d.ts.map +1 -1
- package/src/utils/encoder.js +0 -5
- package/src/utils/encoder.js.map +1 -1
- package/src/utils/ie11.d.ts +0 -1
- package/src/utils/ie11.d.ts.map +1 -1
- package/src/utils/ie11.js +0 -1
- package/src/utils/ie11.js.map +1 -1
- package/src/utils/index.d.ts +6 -0
- package/src/utils/index.d.ts.map +1 -0
- package/src/utils/index.js +6 -0
- package/src/utils/index.js.map +1 -0
- package/src/utils/json-token.d.ts +0 -3
- package/src/utils/json-token.d.ts.map +1 -1
- package/src/utils/json-token.js +0 -5
- package/src/utils/json-token.js.map +1 -1
- package/src/utils/mime-types.d.ts +7 -0
- package/src/utils/mime-types.d.ts.map +1 -0
- package/src/utils/mime-types.js +9 -0
- package/src/utils/mime-types.js.map +1 -0
- package/cjs/plugins/fetch-options/fetch-options.request.js +0 -87
- package/cjs/plugins/fetch-options/fetch-options.spec.js +0 -280
- package/cjs/plugins/fetch-options/index.js +0 -18
- package/cjs/plugins/gateway-token/gateway-authentication.js +0 -275
- package/cjs/plugins/gateway-token/gateway-token.request.js +0 -388
- package/cjs/plugins/gateway-token/gateway-token.spec.js +0 -360
- package/cjs/plugins/imperva/imperva.fetch.js +0 -307
- package/cjs/plugins/imperva/imperva.spec.js +0 -347
- package/cjs/plugins/imperva/index.js +0 -18
- package/cjs/plugins/public-facts/index.js +0 -18
- package/cjs/plugins/public-facts/public-facts.request.js +0 -101
- package/cjs/plugins/public-facts/public-facts.spec.js +0 -367
- package/esm2015/plugins/fetch-options/fetch-options.request.js +0 -81
- package/esm2015/plugins/fetch-options/fetch-options.spec.js +0 -276
- package/esm2015/plugins/fetch-options/index.js +0 -1
- package/esm2015/plugins/gateway-token/gateway-authentication.js +0 -262
- package/esm2015/plugins/gateway-token/gateway-token.request.js +0 -406
- package/esm2015/plugins/gateway-token/gateway-token.spec.js +0 -356
- package/esm2015/plugins/gateway-token/index.js +0 -2
- package/esm2015/plugins/imperva/imperva.fetch.js +0 -303
- package/esm2015/plugins/imperva/imperva.spec.js +0 -343
- package/esm2015/plugins/imperva/index.js +0 -1
- package/esm2015/plugins/public-facts/index.js +0 -1
- package/esm2015/plugins/public-facts/public-facts.request.js +0 -138
- package/esm2015/plugins/public-facts/public-facts.spec.js +0 -363
- package/src/plugins/fetch-options/fetch-options.request.d.ts +0 -26
- package/src/plugins/fetch-options/fetch-options.request.d.ts.map +0 -1
- package/src/plugins/fetch-options/fetch-options.request.js +0 -22
- package/src/plugins/fetch-options/fetch-options.request.js.map +0 -1
- package/src/plugins/fetch-options/index.d.ts +0 -2
- package/src/plugins/fetch-options/index.d.ts.map +0 -1
- package/src/plugins/fetch-options/index.js +0 -2
- package/src/plugins/fetch-options/index.js.map +0 -1
- package/src/plugins/gateway-token/gateway-authentication.d.ts +0 -105
- package/src/plugins/gateway-token/gateway-authentication.d.ts.map +0 -1
- package/src/plugins/gateway-token/gateway-authentication.js +0 -74
- package/src/plugins/gateway-token/gateway-authentication.js.map +0 -1
- package/src/plugins/gateway-token/gateway-token.request.d.ts +0 -97
- package/src/plugins/gateway-token/gateway-token.request.d.ts.map +0 -1
- package/src/plugins/gateway-token/gateway-token.request.js +0 -127
- package/src/plugins/gateway-token/gateway-token.request.js.map +0 -1
- package/src/plugins/gateway-token/index.d.ts +0 -3
- package/src/plugins/gateway-token/index.d.ts.map +0 -1
- package/src/plugins/gateway-token/index.js +0 -3
- package/src/plugins/gateway-token/index.js.map +0 -1
- package/src/plugins/imperva/imperva.fetch.d.ts +0 -33
- package/src/plugins/imperva/imperva.fetch.d.ts.map +0 -1
- package/src/plugins/imperva/imperva.fetch.js +0 -41
- package/src/plugins/imperva/imperva.fetch.js.map +0 -1
- package/src/plugins/imperva/index.d.ts +0 -2
- package/src/plugins/imperva/index.d.ts.map +0 -1
- package/src/plugins/imperva/index.js +0 -2
- package/src/plugins/imperva/index.js.map +0 -1
- package/src/plugins/public-facts/index.d.ts +0 -2
- package/src/plugins/public-facts/index.d.ts.map +0 -1
- package/src/plugins/public-facts/index.js +0 -2
- package/src/plugins/public-facts/index.js.map +0 -1
- package/src/plugins/public-facts/public-facts.request.d.ts +0 -89
- package/src/plugins/public-facts/public-facts.request.d.ts.map +0 -1
- package/src/plugins/public-facts/public-facts.request.js +0 -62
- package/src/plugins/public-facts/public-facts.request.js.map +0 -1
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-redeclare */ /* eslint-disable camelcase, @typescript-eslint/naming-convention */ "use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
reviveResponse: function() {
|
|
13
|
-
return reviveResponse;
|
|
14
|
-
},
|
|
15
|
-
Oauth2Api: function() {
|
|
16
|
-
return Oauth2Api;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
var _index = require("../../fwk/index");
|
|
20
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
21
|
-
try {
|
|
22
|
-
var info = gen[key](arg);
|
|
23
|
-
var value = info.value;
|
|
24
|
-
} catch (error) {
|
|
25
|
-
reject(error);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (info.done) {
|
|
29
|
-
resolve(value);
|
|
30
|
-
} else {
|
|
31
|
-
Promise.resolve(value).then(_next, _throw);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function _async_to_generator(fn) {
|
|
35
|
-
return function() {
|
|
36
|
-
var self = this, args = arguments;
|
|
37
|
-
return new Promise(function(resolve, reject) {
|
|
38
|
-
var gen = fn.apply(self, args);
|
|
39
|
-
function _next(value) {
|
|
40
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
41
|
-
}
|
|
42
|
-
function _throw(err) {
|
|
43
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
44
|
-
}
|
|
45
|
-
_next(undefined);
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
function _class_call_check(instance, Constructor) {
|
|
50
|
-
if (!(instance instanceof Constructor)) {
|
|
51
|
-
throw new TypeError("Cannot call a class as a function");
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
function _defineProperties(target, props) {
|
|
55
|
-
for(var i = 0; i < props.length; i++){
|
|
56
|
-
var descriptor = props[i];
|
|
57
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
58
|
-
descriptor.configurable = true;
|
|
59
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
60
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
64
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
65
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
66
|
-
return Constructor;
|
|
67
|
-
}
|
|
68
|
-
function _define_property(obj, key, value) {
|
|
69
|
-
if (key in obj) {
|
|
70
|
-
Object.defineProperty(obj, key, {
|
|
71
|
-
value: value,
|
|
72
|
-
enumerable: true,
|
|
73
|
-
configurable: true,
|
|
74
|
-
writable: true
|
|
75
|
-
});
|
|
76
|
-
} else {
|
|
77
|
-
obj[key] = value;
|
|
78
|
-
}
|
|
79
|
-
return obj;
|
|
80
|
-
}
|
|
81
|
-
function _ts_generator(thisArg, body) {
|
|
82
|
-
var f, y, t, g, _ = {
|
|
83
|
-
label: 0,
|
|
84
|
-
sent: function() {
|
|
85
|
-
if (t[0] & 1) throw t[1];
|
|
86
|
-
return t[1];
|
|
87
|
-
},
|
|
88
|
-
trys: [],
|
|
89
|
-
ops: []
|
|
90
|
-
};
|
|
91
|
-
return g = {
|
|
92
|
-
next: verb(0),
|
|
93
|
-
"throw": verb(1),
|
|
94
|
-
"return": verb(2)
|
|
95
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
96
|
-
return this;
|
|
97
|
-
}), g;
|
|
98
|
-
function verb(n) {
|
|
99
|
-
return function(v) {
|
|
100
|
-
return step([
|
|
101
|
-
n,
|
|
102
|
-
v
|
|
103
|
-
]);
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function step(op) {
|
|
107
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
108
|
-
while(_)try {
|
|
109
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
110
|
-
if (y = 0, t) op = [
|
|
111
|
-
op[0] & 2,
|
|
112
|
-
t.value
|
|
113
|
-
];
|
|
114
|
-
switch(op[0]){
|
|
115
|
-
case 0:
|
|
116
|
-
case 1:
|
|
117
|
-
t = op;
|
|
118
|
-
break;
|
|
119
|
-
case 4:
|
|
120
|
-
_.label++;
|
|
121
|
-
return {
|
|
122
|
-
value: op[1],
|
|
123
|
-
done: false
|
|
124
|
-
};
|
|
125
|
-
case 5:
|
|
126
|
-
_.label++;
|
|
127
|
-
y = op[1];
|
|
128
|
-
op = [
|
|
129
|
-
0
|
|
130
|
-
];
|
|
131
|
-
continue;
|
|
132
|
-
case 7:
|
|
133
|
-
op = _.ops.pop();
|
|
134
|
-
_.trys.pop();
|
|
135
|
-
continue;
|
|
136
|
-
default:
|
|
137
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
138
|
-
_ = 0;
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
142
|
-
_.label = op[1];
|
|
143
|
-
break;
|
|
144
|
-
}
|
|
145
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
146
|
-
_.label = t[1];
|
|
147
|
-
t = op;
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
if (t && _.label < t[2]) {
|
|
151
|
-
_.label = t[2];
|
|
152
|
-
_.ops.push(op);
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
if (t[2]) _.ops.pop();
|
|
156
|
-
_.trys.pop();
|
|
157
|
-
continue;
|
|
158
|
-
}
|
|
159
|
-
op = body.call(thisArg, _);
|
|
160
|
-
} catch (e) {
|
|
161
|
-
op = [
|
|
162
|
-
6,
|
|
163
|
-
e
|
|
164
|
-
];
|
|
165
|
-
y = 0;
|
|
166
|
-
} finally{
|
|
167
|
-
f = t = 0;
|
|
168
|
-
}
|
|
169
|
-
if (op[0] & 5) throw op[1];
|
|
170
|
-
return {
|
|
171
|
-
value: op[0] ? op[1] : void 0,
|
|
172
|
-
done: true
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
function reviveResponse(data, _dictionaries) {
|
|
177
|
-
if (!data) {
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
return data;
|
|
181
|
-
}
|
|
182
|
-
var Oauth2Api = /*#__PURE__*/ function() {
|
|
183
|
-
"use strict";
|
|
184
|
-
function Oauth2Api(apiClient) {
|
|
185
|
-
_class_call_check(this, Oauth2Api);
|
|
186
|
-
/** @inheritdoc */ _define_property(this, "apiName", Oauth2Api.apiName);
|
|
187
|
-
/** @inheritDoc */ _define_property(this, "client", void 0);
|
|
188
|
-
this.client = apiClient;
|
|
189
|
-
}
|
|
190
|
-
_create_class(Oauth2Api, [
|
|
191
|
-
{
|
|
192
|
-
key: "getAccessTokenInfo",
|
|
193
|
-
value: /**
|
|
194
|
-
* Retrieve information about a given access token generated using the POST /token operation
|
|
195
|
-
* Operation to get information (ie time before expiration, type, status, etc.) about a given access_token generated via the POST /tokens operation.
|
|
196
|
-
* The HTTP method to use is GET. All other HTTP methods are forbidden and an exception (ie error 405: Invalid HTTP method) is raised.
|
|
197
|
-
* The path parameter to give is a valid access token (this access token can be revoked or expired but need to be created at least).
|
|
198
|
-
* If this token is invalid, an exception is raised (ie error 404: Resource not found).
|
|
199
|
-
*
|
|
200
|
-
* @param data Data to provide to the API call
|
|
201
|
-
*/ function getAccessTokenInfo(data) {
|
|
202
|
-
var _this = this;
|
|
203
|
-
return _async_to_generator(function() {
|
|
204
|
-
var getParams, headers, basePathUrl, options, url, ret;
|
|
205
|
-
return _ts_generator(this, function(_state) {
|
|
206
|
-
switch(_state.label){
|
|
207
|
-
case 0:
|
|
208
|
-
getParams = _this.client.extractQueryParams(data, []);
|
|
209
|
-
headers = {};
|
|
210
|
-
basePathUrl = "".concat(_this.client.options.basePath, "/token/").concat(data.access_token);
|
|
211
|
-
return [
|
|
212
|
-
4,
|
|
213
|
-
_this.client.prepareOptions(basePathUrl, "GET", getParams, headers, undefined)
|
|
214
|
-
];
|
|
215
|
-
case 1:
|
|
216
|
-
options = _state.sent();
|
|
217
|
-
url = _this.client.prepareUrl(options.basePath, options.queryParams);
|
|
218
|
-
ret = _this.client.processCall(url, options, _index.ApiTypes.DEFAULT, Oauth2Api.apiName, reviveResponse);
|
|
219
|
-
return [
|
|
220
|
-
2,
|
|
221
|
-
ret
|
|
222
|
-
];
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
})();
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
key: "postAccessToken",
|
|
230
|
-
value: /**
|
|
231
|
-
* Generate a temporary access token which makes the user able to pass throught authentication policy and consume Amadeus resources in a secure way
|
|
232
|
-
* Operation to generate an access token in order to pass throught authentication and then consume Amadeus resources in a secure way.
|
|
233
|
-
* The HTTP method to use is POST. All other HTTP methods are forbidden and an exception (ie error 405: Invalid HTTP method) is raised.
|
|
234
|
-
* A given body using the x-www-form-urlencoded format is madatory. In this body, client_id (id of the app), client_secret (secret of the app)
|
|
235
|
-
* and grant_type are mandatory. If one of these parameters are missing or invalid, an exception (ie error 401: Invalid parameters) is raised.
|
|
236
|
-
* The value for grant_type parameter is unique: client_credentials. All others values will raise an exception (ie error 400: Invalid parameters).
|
|
237
|
-
*
|
|
238
|
-
* @param data Data to provide to the API call
|
|
239
|
-
*/ function postAccessToken(data) {
|
|
240
|
-
var _this = this;
|
|
241
|
-
return _async_to_generator(function() {
|
|
242
|
-
var getParams, headers, body, basePathUrl, options, url, ret;
|
|
243
|
-
return _ts_generator(this, function(_state) {
|
|
244
|
-
switch(_state.label){
|
|
245
|
-
case 0:
|
|
246
|
-
getParams = _this.client.extractQueryParams(data, []);
|
|
247
|
-
headers = {
|
|
248
|
-
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
|
|
249
|
-
};
|
|
250
|
-
body = "".concat(encodeURIComponent("client_id"), "=").concat(encodeURIComponent(data.bodyToProvide.client_id), "&").concat(encodeURIComponent("client_secret"), "=").concat(encodeURIComponent(data.bodyToProvide.client_secret), "&").concat(encodeURIComponent("grant_type"), "=").concat(encodeURIComponent(data.bodyToProvide.grant_type));
|
|
251
|
-
if (data.bodyToProvide.guest_office_id) {
|
|
252
|
-
body = "".concat(body, "&").concat(encodeURIComponent("guest_office_id"), "=").concat(encodeURIComponent(data.bodyToProvide.guest_office_id));
|
|
253
|
-
}
|
|
254
|
-
basePathUrl = "".concat(_this.client.options.basePath, "/token");
|
|
255
|
-
return [
|
|
256
|
-
4,
|
|
257
|
-
_this.client.prepareOptions(basePathUrl, "POST", getParams, headers, body || undefined)
|
|
258
|
-
];
|
|
259
|
-
case 1:
|
|
260
|
-
options = _state.sent();
|
|
261
|
-
url = _this.client.prepareUrl(options.basePath, options.queryParams);
|
|
262
|
-
ret = _this.client.processCall(url, options, _index.ApiTypes.DEFAULT, Oauth2Api.apiName, reviveResponse);
|
|
263
|
-
return [
|
|
264
|
-
2,
|
|
265
|
-
ret
|
|
266
|
-
];
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
})();
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
]);
|
|
273
|
-
return Oauth2Api;
|
|
274
|
-
}();
|
|
275
|
-
/** Gateway authentication api name */ _define_property(Oauth2Api, "apiName", "Oauth2Api");
|
|
@@ -1,388 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "GatewayTokenRequestPlugin", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return GatewayTokenRequestPlugin;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _clients = require("../../clients");
|
|
12
|
-
var _additionalparams = require("../additional-params");
|
|
13
|
-
var _exception = require("../exception");
|
|
14
|
-
var _fetchcredentials = require("../fetch-credentials");
|
|
15
|
-
var _gatewayauthentication = require("./gateway-authentication");
|
|
16
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
17
|
-
try {
|
|
18
|
-
var info = gen[key](arg);
|
|
19
|
-
var value = info.value;
|
|
20
|
-
} catch (error) {
|
|
21
|
-
reject(error);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
if (info.done) {
|
|
25
|
-
resolve(value);
|
|
26
|
-
} else {
|
|
27
|
-
Promise.resolve(value).then(_next, _throw);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function _async_to_generator(fn) {
|
|
31
|
-
return function() {
|
|
32
|
-
var self = this, args = arguments;
|
|
33
|
-
return new Promise(function(resolve, reject) {
|
|
34
|
-
var gen = fn.apply(self, args);
|
|
35
|
-
function _next(value) {
|
|
36
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
37
|
-
}
|
|
38
|
-
function _throw(err) {
|
|
39
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
40
|
-
}
|
|
41
|
-
_next(undefined);
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function _class_call_check(instance, Constructor) {
|
|
46
|
-
if (!(instance instanceof Constructor)) {
|
|
47
|
-
throw new TypeError("Cannot call a class as a function");
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
function _defineProperties(target, props) {
|
|
51
|
-
for(var i = 0; i < props.length; i++){
|
|
52
|
-
var descriptor = props[i];
|
|
53
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
54
|
-
descriptor.configurable = true;
|
|
55
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
56
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
60
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
61
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
62
|
-
return Constructor;
|
|
63
|
-
}
|
|
64
|
-
function _define_property(obj, key, value) {
|
|
65
|
-
if (key in obj) {
|
|
66
|
-
Object.defineProperty(obj, key, {
|
|
67
|
-
value: value,
|
|
68
|
-
enumerable: true,
|
|
69
|
-
configurable: true,
|
|
70
|
-
writable: true
|
|
71
|
-
});
|
|
72
|
-
} else {
|
|
73
|
-
obj[key] = value;
|
|
74
|
-
}
|
|
75
|
-
return obj;
|
|
76
|
-
}
|
|
77
|
-
function _ts_generator(thisArg, body) {
|
|
78
|
-
var f, y, t, g, _ = {
|
|
79
|
-
label: 0,
|
|
80
|
-
sent: function() {
|
|
81
|
-
if (t[0] & 1) throw t[1];
|
|
82
|
-
return t[1];
|
|
83
|
-
},
|
|
84
|
-
trys: [],
|
|
85
|
-
ops: []
|
|
86
|
-
};
|
|
87
|
-
return(g = {
|
|
88
|
-
next: verb(0),
|
|
89
|
-
"throw": verb(1),
|
|
90
|
-
"return": verb(2)
|
|
91
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
92
|
-
return this;
|
|
93
|
-
}), g);
|
|
94
|
-
function verb(n) {
|
|
95
|
-
return function(v) {
|
|
96
|
-
return step([
|
|
97
|
-
n,
|
|
98
|
-
v
|
|
99
|
-
]);
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
function step(op) {
|
|
103
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
104
|
-
while(_)try {
|
|
105
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
106
|
-
if (y = 0, t) op = [
|
|
107
|
-
op[0] & 2,
|
|
108
|
-
t.value
|
|
109
|
-
];
|
|
110
|
-
switch(op[0]){
|
|
111
|
-
case 0:
|
|
112
|
-
case 1:
|
|
113
|
-
t = op;
|
|
114
|
-
break;
|
|
115
|
-
case 4:
|
|
116
|
-
_.label++;
|
|
117
|
-
return {
|
|
118
|
-
value: op[1],
|
|
119
|
-
done: false
|
|
120
|
-
};
|
|
121
|
-
case 5:
|
|
122
|
-
_.label++;
|
|
123
|
-
y = op[1];
|
|
124
|
-
op = [
|
|
125
|
-
0
|
|
126
|
-
];
|
|
127
|
-
continue;
|
|
128
|
-
case 7:
|
|
129
|
-
op = _.ops.pop();
|
|
130
|
-
_.trys.pop();
|
|
131
|
-
continue;
|
|
132
|
-
default:
|
|
133
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
134
|
-
_ = 0;
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
138
|
-
_.label = op[1];
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
142
|
-
_.label = t[1];
|
|
143
|
-
t = op;
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
if (t && _.label < t[2]) {
|
|
147
|
-
_.label = t[2];
|
|
148
|
-
_.ops.push(op);
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
if (t[2]) _.ops.pop();
|
|
152
|
-
_.trys.pop();
|
|
153
|
-
continue;
|
|
154
|
-
}
|
|
155
|
-
op = body.call(thisArg, _);
|
|
156
|
-
} catch (e) {
|
|
157
|
-
op = [
|
|
158
|
-
6,
|
|
159
|
-
e
|
|
160
|
-
];
|
|
161
|
-
y = 0;
|
|
162
|
-
} finally{
|
|
163
|
-
f = t = 0;
|
|
164
|
-
}
|
|
165
|
-
if (op[0] & 5) throw op[1];
|
|
166
|
-
return {
|
|
167
|
-
value: op[0] ? op[1] : void 0,
|
|
168
|
-
done: true
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
var GatewayTokenRequestPlugin = /*#__PURE__*/ function() {
|
|
173
|
-
"use strict";
|
|
174
|
-
function GatewayTokenRequestPlugin(gatewayUrl, gatewayClientId, gatewayClientPrivate, basePath, guestOfficeId) {
|
|
175
|
-
var storageTokenKey = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : "gateway-auth-tokens";
|
|
176
|
-
_class_call_check(this, GatewayTokenRequestPlugin);
|
|
177
|
-
_define_property(this, "storageTokenKey", void 0);
|
|
178
|
-
/**
|
|
179
|
-
* Default expiration time on the token in seconds
|
|
180
|
-
* Corresponds to 8 hours
|
|
181
|
-
*/ _define_property(this, "DEFAULT_EXPIRATION_TIME_S", void 0);
|
|
182
|
-
/**
|
|
183
|
-
* Buffer time in milliseconds. Allows to regenerate a new token before the expiration of the token.
|
|
184
|
-
* Corresponds to 5 minutes
|
|
185
|
-
*/ _define_property(this, "EXPIRATION_TIME_BUFFER_MS", void 0);
|
|
186
|
-
/**
|
|
187
|
-
* Promise of gateway URL
|
|
188
|
-
*/ _define_property(this, "gatewayUrl", void 0);
|
|
189
|
-
/**
|
|
190
|
-
* Promise of gateway client id
|
|
191
|
-
*/ _define_property(this, "gatewayClientId", void 0);
|
|
192
|
-
/**
|
|
193
|
-
* Promise of gateway client secret
|
|
194
|
-
*/ _define_property(this, "gatewayClientPrivate", void 0);
|
|
195
|
-
/**
|
|
196
|
-
* guestOfficeId is either a method to be ran before each call to the Api Gateway to determine what is the guest
|
|
197
|
-
* office ID to be used, or a Promise of office ID
|
|
198
|
-
*/ _define_property(this, "guestOfficeId", void 0);
|
|
199
|
-
/**
|
|
200
|
-
* Promise of the gateway call
|
|
201
|
-
*/ _define_property(this, "gatewayCallPromise", void 0);
|
|
202
|
-
/** API Client */ _define_property(this, "apiClient", void 0);
|
|
203
|
-
this.storageTokenKey = storageTokenKey;
|
|
204
|
-
this.DEFAULT_EXPIRATION_TIME_S = 28800;
|
|
205
|
-
this.EXPIRATION_TIME_BUFFER_MS = 300000;
|
|
206
|
-
this.gatewayUrl = Promise.resolve(gatewayUrl);
|
|
207
|
-
this.gatewayClientId = Promise.resolve(gatewayClientId);
|
|
208
|
-
this.gatewayClientPrivate = Promise.resolve(gatewayClientPrivate);
|
|
209
|
-
this.guestOfficeId = guestOfficeId;
|
|
210
|
-
this.apiClient = new _clients.ApiFetchClient({
|
|
211
|
-
requestPlugins: [
|
|
212
|
-
new _fetchcredentials.FetchCredentialsRequest()
|
|
213
|
-
],
|
|
214
|
-
replyPlugins: [
|
|
215
|
-
new _exception.ExceptionReply()
|
|
216
|
-
],
|
|
217
|
-
basePath: basePath
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
_create_class(GatewayTokenRequestPlugin, [
|
|
221
|
-
{
|
|
222
|
-
key: "getStoreAuthHeader",
|
|
223
|
-
value: /**
|
|
224
|
-
* Check if the gateway authorization token is stored and include it in the Authorization header.
|
|
225
|
-
* If it is not stored yet, a call is triggered to the gateway in order to get this authorization token.
|
|
226
|
-
* @param gatewayUrl URL of the gateway
|
|
227
|
-
* @param gatewayClientId Client id related to the gateway client configuration
|
|
228
|
-
* @param gatewayClientPrivate Client private related to the gateway client configuration
|
|
229
|
-
* @param guestOfficeId office ID to be used instead of the default one
|
|
230
|
-
* office ID to be used
|
|
231
|
-
*/ function getStoreAuthHeader(gatewayUrl, gatewayClientId, gatewayClientPrivate, guestOfficeId) {
|
|
232
|
-
var _this = this;
|
|
233
|
-
return _async_to_generator(function() {
|
|
234
|
-
var gatewayApi, storedTokens, storedTokensParsed, officeId, _tmp, key, token, response, e;
|
|
235
|
-
return _ts_generator(this, function(_state) {
|
|
236
|
-
switch(_state.label){
|
|
237
|
-
case 0:
|
|
238
|
-
_this.apiClient.options.basePath = gatewayUrl;
|
|
239
|
-
gatewayApi = new _gatewayauthentication.Oauth2Api(_this.apiClient);
|
|
240
|
-
storedTokens = typeof sessionStorage !== "undefined" ? sessionStorage.getItem(_this.storageTokenKey) : null;
|
|
241
|
-
storedTokensParsed = storedTokens ? JSON.parse(storedTokens) : {};
|
|
242
|
-
if (!(typeof guestOfficeId === "function")) return [
|
|
243
|
-
3,
|
|
244
|
-
2
|
|
245
|
-
];
|
|
246
|
-
return [
|
|
247
|
-
4,
|
|
248
|
-
guestOfficeId()
|
|
249
|
-
];
|
|
250
|
-
case 1:
|
|
251
|
-
_tmp = _state.sent();
|
|
252
|
-
return [
|
|
253
|
-
3,
|
|
254
|
-
4
|
|
255
|
-
];
|
|
256
|
-
case 2:
|
|
257
|
-
return [
|
|
258
|
-
4,
|
|
259
|
-
guestOfficeId
|
|
260
|
-
];
|
|
261
|
-
case 3:
|
|
262
|
-
_tmp = _state.sent();
|
|
263
|
-
_state.label = 4;
|
|
264
|
-
case 4:
|
|
265
|
-
officeId = _tmp;
|
|
266
|
-
key = officeId ? "".concat(gatewayClientId, "-").concat(officeId) : "".concat(gatewayClientId, "-default");
|
|
267
|
-
token = storedTokensParsed[key];
|
|
268
|
-
if (!(!token || Date.now() + _this.EXPIRATION_TIME_BUFFER_MS >= token.expiresAt)) return [
|
|
269
|
-
3,
|
|
270
|
-
8
|
|
271
|
-
];
|
|
272
|
-
_state.label = 5;
|
|
273
|
-
case 5:
|
|
274
|
-
_state.trys.push([
|
|
275
|
-
5,
|
|
276
|
-
7,
|
|
277
|
-
,
|
|
278
|
-
8
|
|
279
|
-
]);
|
|
280
|
-
if (!_this.gatewayCallPromise) {
|
|
281
|
-
_this.gatewayCallPromise = gatewayApi.postAccessToken({
|
|
282
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention, camelcase
|
|
283
|
-
bodyToProvide: {
|
|
284
|
-
client_id: gatewayClientId,
|
|
285
|
-
client_secret: gatewayClientPrivate,
|
|
286
|
-
grant_type: "client_credentials",
|
|
287
|
-
guest_office_id: officeId
|
|
288
|
-
}
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
return [
|
|
292
|
-
4,
|
|
293
|
-
_this.gatewayCallPromise
|
|
294
|
-
];
|
|
295
|
-
case 6:
|
|
296
|
-
response = _state.sent();
|
|
297
|
-
_this.gatewayCallPromise = undefined;
|
|
298
|
-
token = {
|
|
299
|
-
token: response.access_token,
|
|
300
|
-
expiresAt: Date.now() + (response.expires_in ? response.expires_in : _this.DEFAULT_EXPIRATION_TIME_S) * 1000
|
|
301
|
-
};
|
|
302
|
-
if (typeof sessionStorage !== "undefined") {
|
|
303
|
-
storedTokensParsed[key] = token;
|
|
304
|
-
sessionStorage.setItem(_this.storageTokenKey, JSON.stringify(storedTokensParsed));
|
|
305
|
-
}
|
|
306
|
-
return [
|
|
307
|
-
3,
|
|
308
|
-
8
|
|
309
|
-
];
|
|
310
|
-
case 7:
|
|
311
|
-
e = _state.sent();
|
|
312
|
-
// eslint-disable-next-line no-console
|
|
313
|
-
console.error("An error occurred when trying to get the gateway authentication token " + e);
|
|
314
|
-
return [
|
|
315
|
-
3,
|
|
316
|
-
8
|
|
317
|
-
];
|
|
318
|
-
case 8:
|
|
319
|
-
if (token) {
|
|
320
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
321
|
-
return [
|
|
322
|
-
2,
|
|
323
|
-
{
|
|
324
|
-
Authorization: "Bearer ".concat(token.token)
|
|
325
|
-
}
|
|
326
|
-
];
|
|
327
|
-
}
|
|
328
|
-
return [
|
|
329
|
-
2,
|
|
330
|
-
{}
|
|
331
|
-
];
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
})();
|
|
335
|
-
}
|
|
336
|
-
},
|
|
337
|
-
{
|
|
338
|
-
key: "addGatewayToken",
|
|
339
|
-
value: /**
|
|
340
|
-
* Check if the gateway authorization token is stored and include it in the Authorization header.
|
|
341
|
-
* If it is not stored yet, a call is triggered to the gateway in order to get this authorization token.
|
|
342
|
-
* @returns a function that take the actual headers as parameter and return an Promise containing the Authorization header and its value
|
|
343
|
-
*/ function addGatewayToken() {
|
|
344
|
-
var _this = this;
|
|
345
|
-
return function() {
|
|
346
|
-
var _ref = _async_to_generator(function(_headers) {
|
|
347
|
-
var params;
|
|
348
|
-
return _ts_generator(this, function(_state) {
|
|
349
|
-
switch(_state.label){
|
|
350
|
-
case 0:
|
|
351
|
-
return [
|
|
352
|
-
4,
|
|
353
|
-
Promise.all([
|
|
354
|
-
_this.gatewayUrl,
|
|
355
|
-
_this.gatewayClientId,
|
|
356
|
-
_this.gatewayClientPrivate
|
|
357
|
-
])
|
|
358
|
-
];
|
|
359
|
-
case 1:
|
|
360
|
-
params = _state.sent();
|
|
361
|
-
return [
|
|
362
|
-
2,
|
|
363
|
-
_this.getStoreAuthHeader(params[0], params[1], params[2], _this.guestOfficeId)
|
|
364
|
-
];
|
|
365
|
-
}
|
|
366
|
-
});
|
|
367
|
-
});
|
|
368
|
-
return function(_headers) {
|
|
369
|
-
return _ref.apply(this, arguments);
|
|
370
|
-
};
|
|
371
|
-
}();
|
|
372
|
-
}
|
|
373
|
-
},
|
|
374
|
-
{
|
|
375
|
-
key: "load",
|
|
376
|
-
value: /**
|
|
377
|
-
* @inheritDoc
|
|
378
|
-
*/ function load() {
|
|
379
|
-
return {
|
|
380
|
-
transform: new _additionalparams.AdditionalParamsRequest({
|
|
381
|
-
headers: this.addGatewayToken()
|
|
382
|
-
}).load().transform
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
]);
|
|
387
|
-
return GatewayTokenRequestPlugin;
|
|
388
|
-
}();
|