@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,363 +0,0 @@
|
|
|
1
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
-
try {
|
|
3
|
-
var info = gen[key](arg);
|
|
4
|
-
var value = info.value;
|
|
5
|
-
} catch (error) {
|
|
6
|
-
reject(error);
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
if (info.done) {
|
|
10
|
-
resolve(value);
|
|
11
|
-
} else {
|
|
12
|
-
Promise.resolve(value).then(_next, _throw);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function _async_to_generator(fn) {
|
|
16
|
-
return function() {
|
|
17
|
-
var self = this, args = arguments;
|
|
18
|
-
return new Promise(function(resolve, reject) {
|
|
19
|
-
var gen = fn.apply(self, args);
|
|
20
|
-
function _next(value) {
|
|
21
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
-
}
|
|
23
|
-
function _throw(err) {
|
|
24
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
-
}
|
|
26
|
-
_next(undefined);
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function _define_property(obj, key, value) {
|
|
31
|
-
if (key in obj) {
|
|
32
|
-
Object.defineProperty(obj, key, {
|
|
33
|
-
value: value,
|
|
34
|
-
enumerable: true,
|
|
35
|
-
configurable: true,
|
|
36
|
-
writable: true
|
|
37
|
-
});
|
|
38
|
-
} else {
|
|
39
|
-
obj[key] = value;
|
|
40
|
-
}
|
|
41
|
-
return obj;
|
|
42
|
-
}
|
|
43
|
-
function _object_spread(target) {
|
|
44
|
-
for(var i = 1; i < arguments.length; i++){
|
|
45
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
46
|
-
var ownKeys = Object.keys(source);
|
|
47
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
48
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
49
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
ownKeys.forEach(function(key) {
|
|
53
|
-
_define_property(target, key, source[key]);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
return target;
|
|
57
|
-
}
|
|
58
|
-
function _ts_generator(thisArg, body) {
|
|
59
|
-
var f, y, t, g, _ = {
|
|
60
|
-
label: 0,
|
|
61
|
-
sent: function() {
|
|
62
|
-
if (t[0] & 1) throw t[1];
|
|
63
|
-
return t[1];
|
|
64
|
-
},
|
|
65
|
-
trys: [],
|
|
66
|
-
ops: []
|
|
67
|
-
};
|
|
68
|
-
return g = {
|
|
69
|
-
next: verb(0),
|
|
70
|
-
"throw": verb(1),
|
|
71
|
-
"return": verb(2)
|
|
72
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
73
|
-
return this;
|
|
74
|
-
}), g;
|
|
75
|
-
function verb(n) {
|
|
76
|
-
return function(v) {
|
|
77
|
-
return step([
|
|
78
|
-
n,
|
|
79
|
-
v
|
|
80
|
-
]);
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
function step(op) {
|
|
84
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
85
|
-
while(_)try {
|
|
86
|
-
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;
|
|
87
|
-
if (y = 0, t) op = [
|
|
88
|
-
op[0] & 2,
|
|
89
|
-
t.value
|
|
90
|
-
];
|
|
91
|
-
switch(op[0]){
|
|
92
|
-
case 0:
|
|
93
|
-
case 1:
|
|
94
|
-
t = op;
|
|
95
|
-
break;
|
|
96
|
-
case 4:
|
|
97
|
-
_.label++;
|
|
98
|
-
return {
|
|
99
|
-
value: op[1],
|
|
100
|
-
done: false
|
|
101
|
-
};
|
|
102
|
-
case 5:
|
|
103
|
-
_.label++;
|
|
104
|
-
y = op[1];
|
|
105
|
-
op = [
|
|
106
|
-
0
|
|
107
|
-
];
|
|
108
|
-
continue;
|
|
109
|
-
case 7:
|
|
110
|
-
op = _.ops.pop();
|
|
111
|
-
_.trys.pop();
|
|
112
|
-
continue;
|
|
113
|
-
default:
|
|
114
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
115
|
-
_ = 0;
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
119
|
-
_.label = op[1];
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
123
|
-
_.label = t[1];
|
|
124
|
-
t = op;
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
if (t && _.label < t[2]) {
|
|
128
|
-
_.label = t[2];
|
|
129
|
-
_.ops.push(op);
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
if (t[2]) _.ops.pop();
|
|
133
|
-
_.trys.pop();
|
|
134
|
-
continue;
|
|
135
|
-
}
|
|
136
|
-
op = body.call(thisArg, _);
|
|
137
|
-
} catch (e) {
|
|
138
|
-
op = [
|
|
139
|
-
6,
|
|
140
|
-
e
|
|
141
|
-
];
|
|
142
|
-
y = 0;
|
|
143
|
-
} finally{
|
|
144
|
-
f = t = 0;
|
|
145
|
-
}
|
|
146
|
-
if (op[0] & 5) throw op[1];
|
|
147
|
-
return {
|
|
148
|
-
value: op[0] ? op[1] : void 0,
|
|
149
|
-
done: true
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
import { createJwtFactsEncoder, PublicFactsRequestPlugin } from "./public-facts.request";
|
|
154
|
-
var defaultFacts = {
|
|
155
|
-
foo: "one",
|
|
156
|
-
bar: "two"
|
|
157
|
-
};
|
|
158
|
-
var specificFacts = {
|
|
159
|
-
bar: "three",
|
|
160
|
-
specific: "I am specific"
|
|
161
|
-
};
|
|
162
|
-
var jwtFactsEncoder = createJwtFactsEncoder();
|
|
163
|
-
var defaultHeader = "ama-client-facts";
|
|
164
|
-
describe("Public Facts request plugin", function() {
|
|
165
|
-
var options;
|
|
166
|
-
var specificOptions;
|
|
167
|
-
beforeEach(function() {
|
|
168
|
-
options = {
|
|
169
|
-
basePath: "dummypath",
|
|
170
|
-
headers: new Headers(),
|
|
171
|
-
method: "GET"
|
|
172
|
-
};
|
|
173
|
-
specificOptions = {
|
|
174
|
-
basePath: "/order",
|
|
175
|
-
headers: new Headers(),
|
|
176
|
-
method: "POST"
|
|
177
|
-
};
|
|
178
|
-
});
|
|
179
|
-
it("Should encode the facts as unsecured JWT", function() {
|
|
180
|
-
expect(jwtFactsEncoder(defaultFacts)).toEqual("eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJzdWIiOiJmYWN0IiwiZm9vIjoib25lIiwiYmFyIjoidHdvIn0.");
|
|
181
|
-
});
|
|
182
|
-
it("Should apply global facts to every requests to the default header", /*#__PURE__*/ _async_to_generator(function() {
|
|
183
|
-
var plugin, firstOptions, secondOptions;
|
|
184
|
-
return _ts_generator(this, function(_state) {
|
|
185
|
-
switch(_state.label){
|
|
186
|
-
case 0:
|
|
187
|
-
plugin = new PublicFactsRequestPlugin({
|
|
188
|
-
initialGlobalFacts: defaultFacts
|
|
189
|
-
});
|
|
190
|
-
return [
|
|
191
|
-
4,
|
|
192
|
-
plugin.load().transform(options)
|
|
193
|
-
];
|
|
194
|
-
case 1:
|
|
195
|
-
firstOptions = _state.sent();
|
|
196
|
-
expect(firstOptions.headers.has(defaultHeader)).toBeTruthy();
|
|
197
|
-
expect(firstOptions.headers.get(defaultHeader)).toEqual(jwtFactsEncoder(defaultFacts));
|
|
198
|
-
options.headers = new Headers();
|
|
199
|
-
return [
|
|
200
|
-
4,
|
|
201
|
-
plugin.load().transform(options)
|
|
202
|
-
];
|
|
203
|
-
case 2:
|
|
204
|
-
secondOptions = _state.sent();
|
|
205
|
-
expect(secondOptions.headers.has(defaultHeader)).toBeTruthy();
|
|
206
|
-
expect(secondOptions.headers.get(defaultHeader)).toEqual(jwtFactsEncoder(defaultFacts));
|
|
207
|
-
return [
|
|
208
|
-
2
|
|
209
|
-
];
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
}));
|
|
213
|
-
it("Should allow to configure header name", /*#__PURE__*/ _async_to_generator(function() {
|
|
214
|
-
var plugin, newOptions;
|
|
215
|
-
return _ts_generator(this, function(_state) {
|
|
216
|
-
switch(_state.label){
|
|
217
|
-
case 0:
|
|
218
|
-
plugin = new PublicFactsRequestPlugin({
|
|
219
|
-
initialGlobalFacts: defaultFacts,
|
|
220
|
-
headerName: "dummy"
|
|
221
|
-
});
|
|
222
|
-
return [
|
|
223
|
-
4,
|
|
224
|
-
plugin.load().transform(options)
|
|
225
|
-
];
|
|
226
|
-
case 1:
|
|
227
|
-
newOptions = _state.sent();
|
|
228
|
-
expect(newOptions.headers.has("dummy")).toBeTruthy();
|
|
229
|
-
expect(newOptions.headers.has(defaultHeader)).toBeFalsy();
|
|
230
|
-
return [
|
|
231
|
-
2
|
|
232
|
-
];
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
}));
|
|
236
|
-
it("Should allow to change facts via a function", /*#__PURE__*/ _async_to_generator(function() {
|
|
237
|
-
var plugin, newOptions;
|
|
238
|
-
return _ts_generator(this, function(_state) {
|
|
239
|
-
switch(_state.label){
|
|
240
|
-
case 0:
|
|
241
|
-
plugin = new PublicFactsRequestPlugin({
|
|
242
|
-
initialGlobalFacts: defaultFacts
|
|
243
|
-
});
|
|
244
|
-
plugin.setGlobalFacts({
|
|
245
|
-
foo: "bar"
|
|
246
|
-
});
|
|
247
|
-
return [
|
|
248
|
-
4,
|
|
249
|
-
plugin.load().transform(options)
|
|
250
|
-
];
|
|
251
|
-
case 1:
|
|
252
|
-
newOptions = _state.sent();
|
|
253
|
-
expect(newOptions.headers.has(defaultHeader)).toBeTruthy();
|
|
254
|
-
expect(newOptions.headers.get(defaultHeader)).toEqual(jwtFactsEncoder({
|
|
255
|
-
foo: "bar"
|
|
256
|
-
}));
|
|
257
|
-
return [
|
|
258
|
-
2
|
|
259
|
-
];
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
}));
|
|
263
|
-
it("Should allow to return facts only for specific requests thanks to factories", /*#__PURE__*/ _async_to_generator(function() {
|
|
264
|
-
var plugin, newOptions, newSpecificOptions;
|
|
265
|
-
return _ts_generator(this, function(_state) {
|
|
266
|
-
switch(_state.label){
|
|
267
|
-
case 0:
|
|
268
|
-
plugin = new PublicFactsRequestPlugin({
|
|
269
|
-
factsFactory: function(request) {
|
|
270
|
-
if (request.basePath.includes("/order") && request.method !== "GET") {
|
|
271
|
-
return specificFacts;
|
|
272
|
-
}
|
|
273
|
-
return {};
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
return [
|
|
277
|
-
4,
|
|
278
|
-
plugin.load().transform(options)
|
|
279
|
-
];
|
|
280
|
-
case 1:
|
|
281
|
-
newOptions = _state.sent();
|
|
282
|
-
expect(newOptions.headers.has(defaultHeader)).toBeFalsy();
|
|
283
|
-
return [
|
|
284
|
-
4,
|
|
285
|
-
plugin.load().transform(specificOptions)
|
|
286
|
-
];
|
|
287
|
-
case 2:
|
|
288
|
-
newSpecificOptions = _state.sent();
|
|
289
|
-
expect(newSpecificOptions.headers.has(defaultHeader)).toBeTruthy();
|
|
290
|
-
expect(newSpecificOptions.headers.get(defaultHeader)).toEqual(jwtFactsEncoder(specificFacts));
|
|
291
|
-
return [
|
|
292
|
-
2
|
|
293
|
-
];
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
}));
|
|
297
|
-
it("Specific facts should have priority over global facts", /*#__PURE__*/ _async_to_generator(function() {
|
|
298
|
-
var plugin, newSpecificOptions;
|
|
299
|
-
return _ts_generator(this, function(_state) {
|
|
300
|
-
switch(_state.label){
|
|
301
|
-
case 0:
|
|
302
|
-
plugin = new PublicFactsRequestPlugin({
|
|
303
|
-
initialGlobalFacts: defaultFacts,
|
|
304
|
-
factsFactory: function(request) {
|
|
305
|
-
if (request.basePath.includes("/order") && request.method !== "GET") {
|
|
306
|
-
return specificFacts;
|
|
307
|
-
}
|
|
308
|
-
return {};
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
return [
|
|
312
|
-
4,
|
|
313
|
-
plugin.load().transform(specificOptions)
|
|
314
|
-
];
|
|
315
|
-
case 1:
|
|
316
|
-
newSpecificOptions = _state.sent();
|
|
317
|
-
expect(newSpecificOptions.headers.has(defaultHeader)).toBeTruthy();
|
|
318
|
-
expect(newSpecificOptions.headers.get(defaultHeader)).toEqual(jwtFactsEncoder(_object_spread({}, defaultFacts, specificFacts)));
|
|
319
|
-
return [
|
|
320
|
-
2
|
|
321
|
-
];
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
}));
|
|
325
|
-
it("Factories should be allowed to be asynchronous and return a Promise of facts", /*#__PURE__*/ _async_to_generator(function() {
|
|
326
|
-
var plugin, promise, newSpecificOptions;
|
|
327
|
-
return _ts_generator(this, function(_state) {
|
|
328
|
-
switch(_state.label){
|
|
329
|
-
case 0:
|
|
330
|
-
plugin = new PublicFactsRequestPlugin({
|
|
331
|
-
factsFactory: function(request) {
|
|
332
|
-
if (request.basePath.includes("/order") && request.method !== "GET") {
|
|
333
|
-
return new Promise(function(resolve) {
|
|
334
|
-
return setTimeout(function() {
|
|
335
|
-
return resolve(specificFacts);
|
|
336
|
-
}, 500);
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
return {};
|
|
340
|
-
}
|
|
341
|
-
});
|
|
342
|
-
promise = plugin.load().transform(specificOptions);
|
|
343
|
-
return [
|
|
344
|
-
4,
|
|
345
|
-
jest.runAllTimersAsync()
|
|
346
|
-
];
|
|
347
|
-
case 1:
|
|
348
|
-
_state.sent();
|
|
349
|
-
return [
|
|
350
|
-
4,
|
|
351
|
-
promise
|
|
352
|
-
];
|
|
353
|
-
case 2:
|
|
354
|
-
newSpecificOptions = _state.sent();
|
|
355
|
-
expect(newSpecificOptions.headers.has(defaultHeader)).toBeTruthy();
|
|
356
|
-
expect(newSpecificOptions.headers.get(defaultHeader)).toEqual(jwtFactsEncoder(specificFacts));
|
|
357
|
-
return [
|
|
358
|
-
2
|
|
359
|
-
];
|
|
360
|
-
}
|
|
361
|
-
});
|
|
362
|
-
}));
|
|
363
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { PluginRunner, RequestOptions, RequestPlugin } from '../core';
|
|
2
|
-
/**
|
|
3
|
-
* Authorized fetch options for this plugin
|
|
4
|
-
*/
|
|
5
|
-
export interface AuthorizedFetchOptions {
|
|
6
|
-
cache: RequestCache;
|
|
7
|
-
credentials: RequestCredentials;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Plugin to set the options of the fetch API for every request it is applied to.
|
|
11
|
-
*
|
|
12
|
-
* @deprecated Use fetch-cache and fetch-credential plugins instead, will be removed in v10
|
|
13
|
-
*/
|
|
14
|
-
export declare class FetchOptionsRequest implements RequestPlugin {
|
|
15
|
-
/**
|
|
16
|
-
* Value that will be set as the options of the fetch API.
|
|
17
|
-
*/
|
|
18
|
-
private fetchOptions;
|
|
19
|
-
/**
|
|
20
|
-
* Default fetch options
|
|
21
|
-
*/
|
|
22
|
-
private defaultFetchOptions;
|
|
23
|
-
constructor(fetchOptions?: Partial<AuthorizedFetchOptions>);
|
|
24
|
-
load(): PluginRunner<RequestOptions, RequestOptions>;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=fetch-options.request.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-options.request.d.ts","sourceRoot":"","sources":["../../../../src/plugins/fetch-options/fetch-options.request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,YAAY,CAAC;IACpB,WAAW,EAAE,kBAAkB,CAAC;CACjC;AAED;;;;GAIG;AACH,qBAAa,mBAAoB,YAAW,aAAa;IAEvD;;OAEG;IACH,OAAO,CAAC,YAAY,CAAyB;IAE7C;;OAEG;IACH,OAAO,CAAC,mBAAmB,CAA2E;gBAE1F,YAAY,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC;IAInD,IAAI,IAAI,YAAY,CAAC,cAAc,EAAE,cAAc,CAAC;CAO5D"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plugin to set the options of the fetch API for every request it is applied to.
|
|
3
|
-
*
|
|
4
|
-
* @deprecated Use fetch-cache and fetch-credential plugins instead, will be removed in v10
|
|
5
|
-
*/
|
|
6
|
-
export class FetchOptionsRequest {
|
|
7
|
-
constructor(fetchOptions) {
|
|
8
|
-
/**
|
|
9
|
-
* Default fetch options
|
|
10
|
-
*/
|
|
11
|
-
this.defaultFetchOptions = { cache: 'no-cache', credentials: 'same-origin' };
|
|
12
|
-
this.fetchOptions = { ...this.defaultFetchOptions, ...(fetchOptions ? fetchOptions : {}) };
|
|
13
|
-
}
|
|
14
|
-
load() {
|
|
15
|
-
return {
|
|
16
|
-
transform: (data) => {
|
|
17
|
-
return { ...data, ...this.fetchOptions };
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=fetch-options.request.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-options.request.js","sourceRoot":"","sources":["../../../../src/plugins/fetch-options/fetch-options.request.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,MAAM,OAAO,mBAAmB;IAY9B,YAAY,YAA8C;QAL1D;;WAEG;QACK,wBAAmB,GAA2B,EAAC,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAC,CAAC;QAGpG,IAAI,CAAC,YAAY,GAAG,EAAC,GAAG,IAAI,CAAC,mBAAmB,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,EAAC,CAAC;IAC3F,CAAC;IAEM,IAAI;QACT,OAAO;YACL,SAAS,EAAE,CAAC,IAAoB,EAAE,EAAE;gBAClC,OAAO,EAAC,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,YAAY,EAAC,CAAC;YACzC,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/fetch-options/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/fetch-options/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import type { Api, ApiClient } from '../../fwk/index';
|
|
2
|
-
/** Token name */
|
|
3
|
-
export type TypeEnum = 'amadeusOAuth2Token';
|
|
4
|
-
/** Token type */
|
|
5
|
-
export type TokenTypeEnum = 'Bearer';
|
|
6
|
-
/** Token state */
|
|
7
|
-
export type StateEnum = 'approved' | 'revoked' | 'expired';
|
|
8
|
-
/** Error returned */
|
|
9
|
-
export type ErrorEnum = 'invalid_request' | 'invalid_client' | 'invalid_grant' | 'unauthorized_client' | 'unsupported_grant_type' | 'invalid_scope';
|
|
10
|
-
/** Object to provide when calling the gateway api */
|
|
11
|
-
export interface BodyToProvide {
|
|
12
|
-
/** The client identifier */
|
|
13
|
-
client_id: string;
|
|
14
|
-
/** The client credentials */
|
|
15
|
-
client_secret: string;
|
|
16
|
-
/** The type of given grantType in order to generate a valid access token. The only possible value is \"client_credentials\" */
|
|
17
|
-
grant_type: 'client_credentials';
|
|
18
|
-
/** The office ID the access token will be granted to */
|
|
19
|
-
guest_office_id: string | undefined;
|
|
20
|
-
}
|
|
21
|
-
/** Gateway api response object */
|
|
22
|
-
export interface Response {
|
|
23
|
-
/** Type of the generated access token, e.g. \"amadeusOAuth2Token\" (additional information, not in the RFC) */
|
|
24
|
-
type?: TypeEnum;
|
|
25
|
-
/** The email of the application owner (additional information, not in the RFC) */
|
|
26
|
-
username?: string;
|
|
27
|
-
/** The display name of the application (additional information, not in the RFC) */
|
|
28
|
-
application_name?: string;
|
|
29
|
-
/** The type of the generated access token (ie Bearer, REQUIRED in the RFC 6749) */
|
|
30
|
-
token_type: TokenTypeEnum;
|
|
31
|
-
/** The application client_id (additional information, not in the RFC) */
|
|
32
|
-
client_id?: string;
|
|
33
|
-
/** The access token (REQUIRED in the RFC 6749) */
|
|
34
|
-
access_token: string;
|
|
35
|
-
/** The time in seconds left before the access token expiration (RECOMMENDED in the RFC 6749) */
|
|
36
|
-
expires_in?: number;
|
|
37
|
-
/** The status of the related access token, e.g. \"approved\", \"revoked\", \"expired\" (additional information, not in the RFC) */
|
|
38
|
-
state?: StateEnum;
|
|
39
|
-
/** OAuth 2.0 scopes provide a way to limit the amount of access that is granted to an access token (OPTIONAL in the RFC 6749) */
|
|
40
|
-
scope?: string;
|
|
41
|
-
}
|
|
42
|
-
/** Error returned by gateway api */
|
|
43
|
-
export interface Error {
|
|
44
|
-
/** Error code in integer format corresponding to a defined canned message */
|
|
45
|
-
code?: number;
|
|
46
|
-
/** The title of the error */
|
|
47
|
-
title?: string;
|
|
48
|
-
/** A detailed message of the current error (RECOMMENDED in the RFC) */
|
|
49
|
-
error_description?: string;
|
|
50
|
-
/** The error according to the RFC standards (REQUIRED in the RFC) */
|
|
51
|
-
error: ErrorEnum;
|
|
52
|
-
}
|
|
53
|
-
/** The identifier for the acces token */
|
|
54
|
-
export interface GetAccessTokenInfo {
|
|
55
|
-
/** The access token for which information need to be retrieved */
|
|
56
|
-
'access_token': string;
|
|
57
|
-
}
|
|
58
|
-
/** Gateway post body request */
|
|
59
|
-
export interface PostAccessToken {
|
|
60
|
-
/** The body to provide to get a valid access token */
|
|
61
|
-
'bodyToProvide': BodyToProvide;
|
|
62
|
-
}
|
|
63
|
-
export declare function reviveResponse(data: undefined, dictionaries?: any): undefined;
|
|
64
|
-
export declare function reviveResponse(data: Response, dictionaries?: any): Response;
|
|
65
|
-
export declare function reviveResponse(data: any, dictionaries?: any): Response | undefined;
|
|
66
|
-
export declare function reviveResponse<T extends Response>(data: T, dictionaries?: any): T;
|
|
67
|
-
export declare function reviveResponse<T extends Response>(data: any, dictionaries?: any): T | undefined;
|
|
68
|
-
/** Class which exposes methods to access the gateway api */
|
|
69
|
-
export declare class Oauth2Api implements Api {
|
|
70
|
-
/** Gateway authentication api name */
|
|
71
|
-
static readonly apiName = "Oauth2Api";
|
|
72
|
-
/** @inheritdoc */
|
|
73
|
-
readonly apiName = "Oauth2Api";
|
|
74
|
-
/** @inheritDoc */
|
|
75
|
-
client: ApiClient;
|
|
76
|
-
/**
|
|
77
|
-
* Initialize your interface
|
|
78
|
-
*
|
|
79
|
-
* @param apiClient
|
|
80
|
-
* @params apiClient Client used to process call to the API
|
|
81
|
-
*/
|
|
82
|
-
constructor(apiClient: ApiClient);
|
|
83
|
-
/**
|
|
84
|
-
* Retrieve information about a given access token generated using the POST /token operation
|
|
85
|
-
* Operation to get information (ie time before expiration, type, status, etc.) about a given access_token generated via the POST /tokens operation.
|
|
86
|
-
* The HTTP method to use is GET. All other HTTP methods are forbidden and an exception (ie error 405: Invalid HTTP method) is raised.
|
|
87
|
-
* 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).
|
|
88
|
-
* If this token is invalid, an exception is raised (ie error 404: Resource not found).
|
|
89
|
-
*
|
|
90
|
-
* @param data Data to provide to the API call
|
|
91
|
-
*/
|
|
92
|
-
getAccessTokenInfo(data: GetAccessTokenInfo): Promise<Response>;
|
|
93
|
-
/**
|
|
94
|
-
* Generate a temporary access token which makes the user able to pass throught authentication policy and consume Amadeus resources in a secure way
|
|
95
|
-
* Operation to generate an access token in order to pass throught authentication and then consume Amadeus resources in a secure way.
|
|
96
|
-
* The HTTP method to use is POST. All other HTTP methods are forbidden and an exception (ie error 405: Invalid HTTP method) is raised.
|
|
97
|
-
* 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)
|
|
98
|
-
* and grant_type are mandatory. If one of these parameters are missing or invalid, an exception (ie error 401: Invalid parameters) is raised.
|
|
99
|
-
* The value for grant_type parameter is unique: client_credentials. All others values will raise an exception (ie error 400: Invalid parameters).
|
|
100
|
-
*
|
|
101
|
-
* @param data Data to provide to the API call
|
|
102
|
-
*/
|
|
103
|
-
postAccessToken(data: PostAccessToken): Promise<Response>;
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=gateway-authentication.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gateway-authentication.d.ts","sourceRoot":"","sources":["../../../../src/plugins/gateway-token/gateway-authentication.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEtD,iBAAiB;AACjB,MAAM,MAAM,QAA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|
|
2
|
-
/* eslint-disable camelcase, @typescript-eslint/naming-convention */
|
|
3
|
-
import { ApiTypes } from '../../fwk/index';
|
|
4
|
-
/**
|
|
5
|
-
* Function to revive the data object received from gateway API
|
|
6
|
-
*
|
|
7
|
-
* @param data
|
|
8
|
-
* @param _dictionaries
|
|
9
|
-
*/
|
|
10
|
-
export function reviveResponse(data, _dictionaries) {
|
|
11
|
-
if (!data) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
return data;
|
|
15
|
-
}
|
|
16
|
-
/** Class which exposes methods to access the gateway api */
|
|
17
|
-
export class Oauth2Api {
|
|
18
|
-
/**
|
|
19
|
-
* Initialize your interface
|
|
20
|
-
*
|
|
21
|
-
* @param apiClient
|
|
22
|
-
* @params apiClient Client used to process call to the API
|
|
23
|
-
*/
|
|
24
|
-
constructor(apiClient) {
|
|
25
|
-
/** @inheritdoc */
|
|
26
|
-
this.apiName = Oauth2Api.apiName;
|
|
27
|
-
this.client = apiClient;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Retrieve information about a given access token generated using the POST /token operation
|
|
31
|
-
* Operation to get information (ie time before expiration, type, status, etc.) about a given access_token generated via the POST /tokens operation.
|
|
32
|
-
* The HTTP method to use is GET. All other HTTP methods are forbidden and an exception (ie error 405: Invalid HTTP method) is raised.
|
|
33
|
-
* 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).
|
|
34
|
-
* If this token is invalid, an exception is raised (ie error 404: Resource not found).
|
|
35
|
-
*
|
|
36
|
-
* @param data Data to provide to the API call
|
|
37
|
-
*/
|
|
38
|
-
async getAccessTokenInfo(data) {
|
|
39
|
-
const getParams = this.client.extractQueryParams(data, []);
|
|
40
|
-
const headers = {};
|
|
41
|
-
const basePathUrl = `${this.client.options.basePath}/token/${data.access_token}`;
|
|
42
|
-
const options = await this.client.prepareOptions(basePathUrl, 'GET', getParams, headers, undefined);
|
|
43
|
-
const url = this.client.prepareUrl(options.basePath, options.queryParams);
|
|
44
|
-
const ret = this.client.processCall(url, options, ApiTypes.DEFAULT, Oauth2Api.apiName, reviveResponse);
|
|
45
|
-
return ret;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Generate a temporary access token which makes the user able to pass throught authentication policy and consume Amadeus resources in a secure way
|
|
49
|
-
* Operation to generate an access token in order to pass throught authentication and then consume Amadeus resources in a secure way.
|
|
50
|
-
* The HTTP method to use is POST. All other HTTP methods are forbidden and an exception (ie error 405: Invalid HTTP method) is raised.
|
|
51
|
-
* 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)
|
|
52
|
-
* and grant_type are mandatory. If one of these parameters are missing or invalid, an exception (ie error 401: Invalid parameters) is raised.
|
|
53
|
-
* The value for grant_type parameter is unique: client_credentials. All others values will raise an exception (ie error 400: Invalid parameters).
|
|
54
|
-
*
|
|
55
|
-
* @param data Data to provide to the API call
|
|
56
|
-
*/
|
|
57
|
-
async postAccessToken(data) {
|
|
58
|
-
const getParams = this.client.extractQueryParams(data, []);
|
|
59
|
-
const headers = { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' };
|
|
60
|
-
// eslint-disable-next-line max-len
|
|
61
|
-
let body = `${encodeURIComponent('client_id')}=${encodeURIComponent(data.bodyToProvide.client_id)}&${encodeURIComponent('client_secret')}=${encodeURIComponent(data.bodyToProvide.client_secret)}&${encodeURIComponent('grant_type')}=${encodeURIComponent(data.bodyToProvide.grant_type)}`;
|
|
62
|
-
if (data.bodyToProvide.guest_office_id) {
|
|
63
|
-
body = `${body}&${encodeURIComponent('guest_office_id')}=${encodeURIComponent(data.bodyToProvide.guest_office_id)}`;
|
|
64
|
-
}
|
|
65
|
-
const basePathUrl = `${this.client.options.basePath}/token`;
|
|
66
|
-
const options = await this.client.prepareOptions(basePathUrl, 'POST', getParams, headers, body || undefined);
|
|
67
|
-
const url = this.client.prepareUrl(options.basePath, options.queryParams);
|
|
68
|
-
const ret = this.client.processCall(url, options, ApiTypes.DEFAULT, Oauth2Api.apiName, reviveResponse);
|
|
69
|
-
return ret;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
/** Gateway authentication api name */
|
|
73
|
-
Oauth2Api.apiName = 'Oauth2Api';
|
|
74
|
-
//# sourceMappingURL=gateway-authentication.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gateway-authentication.js","sourceRoot":"","sources":["../../../../src/plugins/gateway-token/gateway-authentication.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,oEAAoE;AAGpE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAyE3C;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAgC,IAAS,EAAE,aAAmB;IAC1F,IAAI,CAAC,IAAI,EAAE;QAAE,OAAO;KAAE;IACtB,OAAO,IAAS,CAAC;AACnB,CAAC;AAED,4DAA4D;AAC5D,MAAM,OAAO,SAAS;IAWpB;;;;;OAKG;IACH,YAAY,SAAoB;QAZhC,kBAAkB;QACF,YAAO,GAAG,SAAS,CAAC,OAAO,CAAC;QAY1C,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IAC1B,CAAC;IAED;;;;;;;;OAQG;IACI,KAAK,CAAC,kBAAkB,CAAC,IAAwB;QAEtD,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAqB,IAAI,EAAE,EAAa,CAAC,CAAC;QAC1F,MAAM,OAAO,GAA8B,EAAE,CAAC;QAE9C,MAAM,WAAW,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,UAAU,IAAI,CAAC,YAAY,EAAE,CAAC;QAEjF,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QACpG,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAA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