@bitblit/ratchet-epsilon-common 4.0.99-alpha → 4.0.103-alpha
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/bin/cli.js +10 -0
- package/{dist/types → lib}/background/background-dynamo-log-table-handler.d.ts +3 -3
- package/{dist/es → lib}/background/background-dynamo-log-table-handler.js +6 -2
- package/{dist/types → lib}/background/background-execution-event.d.ts +1 -1
- package/{dist/types → lib}/background/background-execution-listener.d.ts +1 -1
- package/{dist/types → lib}/background/background-handler.d.ts +5 -9
- package/{dist/es → lib}/background/background-handler.js +15 -7
- package/{dist/types → lib}/background/background-http-adapter-handler.d.ts +7 -11
- package/{dist/es → lib}/background/background-http-adapter-handler.js +13 -8
- package/{dist/types → lib}/background/background-queue-response-internal.d.ts +1 -1
- package/{dist/types → lib}/background/background-validator.d.ts +5 -8
- package/{dist/es → lib}/background/background-validator.js +5 -3
- package/{dist/es → lib}/background/epsilon-background-process-error.js +6 -1
- package/{dist/types → lib}/background/internal-background-entry.d.ts +1 -1
- package/{dist/types → lib}/background/manager/abstract-background-manager.d.ts +3 -10
- package/{dist/es → lib}/background/manager/abstract-background-manager.js +5 -4
- package/{dist/types → lib}/background/manager/aws-sqs-sns-background-manager.d.ts +4 -11
- package/{dist/es → lib}/background/manager/aws-sqs-sns-background-manager.js +9 -5
- package/{dist/types → lib}/background/manager/background-manager-like.d.ts +2 -9
- package/lib/background/manager/background-manager.spec.js +73 -0
- package/{dist/types → lib}/background/manager/single-thread-local-background-manager.d.ts +3 -10
- package/{dist/es → lib}/background/manager/single-thread-local-background-manager.js +6 -6
- package/{dist/types → lib}/background/s3-background-transaction-logger.d.ts +2 -2
- package/{dist/es → lib}/background/s3-background-transaction-logger.js +6 -3
- package/{dist/types → lib}/build/ratchet-epsilon-common-info.d.ts +1 -1
- package/{dist/types → lib}/built-in/background/echo-processor.d.ts +2 -2
- package/{dist/es → lib}/built-in/background/echo-processor.js +4 -3
- package/{dist/types → lib}/built-in/background/log-and-enqueue-echo-processor.d.ts +2 -2
- package/{dist/es → lib}/built-in/background/log-and-enqueue-echo-processor.js +2 -2
- package/{dist/types → lib}/built-in/background/log-message-background-error-processor.d.ts +2 -2
- package/{dist/es → lib}/built-in/background/log-message-background-error-processor.js +1 -1
- package/{dist/types → lib}/built-in/background/no-op-processor.d.ts +2 -2
- package/{dist/es → lib}/built-in/background/no-op-processor.js +1 -1
- package/{dist/types → lib}/built-in/background/retry-processor.d.ts +2 -2
- package/{dist/es → lib}/built-in/background/retry-processor.js +8 -4
- package/{dist/types → lib}/built-in/background/sample-delay-processor.d.ts +2 -2
- package/{dist/es → lib}/built-in/background/sample-delay-processor.js +2 -1
- package/{dist/types → lib}/built-in/background/sample-input-validated-processor.d.ts +3 -3
- package/{dist/es → lib}/built-in/background/sample-input-validated-processor.js +1 -1
- package/{dist/es → lib}/built-in/built-in-trace-id-generators.js +2 -2
- package/{dist/types → lib}/built-in/daemon/daemon-authorizer-function.d.ts +2 -2
- package/{dist/types → lib}/built-in/daemon/daemon-config.d.ts +2 -2
- package/{dist/types → lib}/built-in/daemon/daemon-group-selection-function.d.ts +1 -1
- package/{dist/types → lib}/built-in/daemon/daemon-handler.d.ts +6 -12
- package/{dist/es → lib}/built-in/daemon/daemon-handler.js +9 -8
- package/lib/built-in/daemon/daemon-process-state-list.d.ts +5 -0
- package/{dist/types → lib}/built-in/http/apollo-filter.d.ts +2 -2
- package/{dist/es → lib}/built-in/http/apollo-filter.js +6 -5
- package/{dist/types → lib}/built-in/http/built-in-auth-filters.d.ts +3 -3
- package/{dist/es → lib}/built-in/http/built-in-auth-filters.js +5 -5
- package/{dist/types → lib}/built-in/http/built-in-authorizers.d.ts +2 -2
- package/{dist/es → lib}/built-in/http/built-in-authorizers.js +1 -1
- package/{dist/types → lib}/built-in/http/built-in-filters.d.ts +2 -2
- package/{dist/es → lib}/built-in/http/built-in-filters.js +9 -9
- package/{dist/types → lib}/built-in/http/built-in-handlers.d.ts +2 -2
- package/{dist/es → lib}/built-in/http/built-in-handlers.js +10 -10
- package/{dist/types → lib}/built-in/http/log-level-manipulation-filter.d.ts +1 -4
- package/{dist/es → lib}/built-in/http/log-level-manipulation-filter.js +2 -2
- package/{dist/types → lib}/built-in/http/run-handler-as-filter.d.ts +5 -5
- package/{dist/es → lib}/built-in/http/run-handler-as-filter.js +8 -8
- package/lib/built-in/http/run-handler-as-filter.spec.js +40 -0
- package/{dist/types → lib}/cli-bootstrap/ratchet-cli-handler.d.ts +2 -2
- package/{dist/es → lib}/cli-bootstrap/ratchet-cli-handler.js +6 -6
- package/lib/cli-bootstrap/run-background-process-from-command-line.d.ts +3 -0
- package/{dist/es → lib}/cli-bootstrap/run-background-process-from-command-line.js +2 -2
- package/{dist/types → lib}/config/background/background-config.d.ts +4 -4
- package/{dist/types → lib}/config/background/background-error-processor.d.ts +1 -1
- package/{dist/types → lib}/config/background/background-processor.d.ts +1 -1
- package/{dist/types → lib}/config/background/background-transaction-log.d.ts +1 -1
- package/{dist/types → lib}/config/background/background-transaction-logger.d.ts +1 -1
- package/lib/config/cron/cron-background-entry.d.ts +6 -0
- package/{dist/types → lib}/config/cron/cron-config.d.ts +1 -1
- package/{dist/types → lib}/config/dynamo-db-config.d.ts +1 -1
- package/{dist/types → lib}/config/epsilon-config.d.ts +8 -8
- package/{dist/types → lib}/config/epsilon-logger-config.d.ts +3 -2
- package/{dist/types → lib}/config/http/authorizer-function.d.ts +3 -3
- package/{dist/types → lib}/config/http/extended-api-gateway-event.d.ts +1 -1
- package/{dist/types → lib}/config/http/filter-chain-context.d.ts +4 -4
- package/{dist/types → lib}/config/http/filter-function.d.ts +1 -1
- package/{dist/types → lib}/config/http/handler-function.d.ts +1 -1
- package/{dist/types → lib}/config/http/http-config.d.ts +5 -5
- package/{dist/types → lib}/config/http/http-processing-config.d.ts +2 -2
- package/{dist/types → lib}/config/http/mapped-http-processing-config.d.ts +1 -1
- package/{dist/types → lib}/config/inter-api/inter-api-config.d.ts +2 -2
- package/lib/config/inter-api/inter-api-process-mapping.d.ts +6 -0
- package/{dist/types → lib}/config/open-api/open-api-document.d.ts +2 -2
- package/{dist/types → lib}/config/s3-config.d.ts +1 -1
- package/{dist/types → lib}/config/sns-config.d.ts +1 -1
- package/{dist/es → lib}/epsilon-build-properties.js +1 -1
- package/{dist/types → lib}/epsilon-constants.d.ts +1 -1
- package/{dist/es → lib}/epsilon-constants.js +14 -13
- package/{dist/types → lib}/epsilon-global-handler.d.ts +3 -6
- package/{dist/es → lib}/epsilon-global-handler.js +29 -24
- package/{dist/types → lib}/epsilon-instance.d.ts +6 -11
- package/lib/epsilon-logging-extension-processor.d.ts +6 -0
- package/{dist/es → lib}/epsilon-logging-extension-processor.js +1 -1
- package/{dist/types → lib}/http/auth/api-gateway-adapter-authentication-handler.d.ts +0 -10
- package/{dist/es → lib}/http/auth/api-gateway-adapter-authentication-handler.js +4 -3
- package/{dist/types → lib}/http/auth/auth0-web-token-manipulator.d.ts +2 -2
- package/{dist/es → lib}/http/auth/auth0-web-token-manipulator.js +6 -1
- package/{dist/types → lib}/http/auth/basic-auth-token.d.ts +0 -3
- package/{dist/types → lib}/http/auth/google-web-token-manipulator.d.ts +2 -2
- package/{dist/es → lib}/http/auth/google-web-token-manipulator.js +6 -3
- package/lib/http/auth/google-web-token-manipulator.spec.js +10 -0
- package/{dist/types → lib}/http/auth/jwt-ratchet-local-web-token-manipulator.d.ts +3 -5
- package/{dist/es → lib}/http/auth/jwt-ratchet-local-web-token-manipulator.js +5 -3
- package/{dist/types → lib}/http/auth/local-web-token-manipulator.d.ts +4 -5
- package/{dist/es → lib}/http/auth/local-web-token-manipulator.js +9 -5
- package/lib/http/auth/local-web-token-manipulator.spec.js +24 -0
- package/{dist/types → lib}/http/auth/web-token-manipulator.d.ts +1 -4
- package/{dist/types → lib}/http/error/bad-gateway.d.ts +1 -1
- package/{dist/es → lib}/http/error/bad-gateway.js +2 -2
- package/{dist/types → lib}/http/error/bad-request-error.d.ts +1 -1
- package/{dist/es → lib}/http/error/bad-request-error.js +2 -2
- package/{dist/types → lib}/http/error/conflict-error.d.ts +1 -1
- package/{dist/es → lib}/http/error/conflict-error.js +2 -2
- package/{dist/es → lib}/http/error/epsilon-http-error.js +9 -3
- package/lib/http/error/epsilon-http-error.spec.js +11 -0
- package/{dist/types → lib}/http/error/forbidden-error.d.ts +1 -1
- package/{dist/es → lib}/http/error/forbidden-error.js +2 -2
- package/{dist/types → lib}/http/error/gateway-timeout.d.ts +1 -1
- package/{dist/es → lib}/http/error/gateway-timeout.js +2 -2
- package/{dist/types → lib}/http/error/method-not-allowed-error.d.ts +1 -1
- package/{dist/es → lib}/http/error/method-not-allowed-error.js +2 -2
- package/{dist/types → lib}/http/error/misconfigured-error.d.ts +1 -1
- package/{dist/es → lib}/http/error/misconfigured-error.js +2 -2
- package/{dist/types → lib}/http/error/not-found-error.d.ts +1 -1
- package/{dist/es → lib}/http/error/not-found-error.js +2 -2
- package/{dist/types → lib}/http/error/not-implemented.d.ts +1 -1
- package/{dist/es → lib}/http/error/not-implemented.js +2 -2
- package/{dist/types → lib}/http/error/request-timeout-error.d.ts +1 -1
- package/{dist/es → lib}/http/error/request-timeout-error.js +2 -2
- package/{dist/types → lib}/http/error/service-unavailable.d.ts +1 -1
- package/{dist/es → lib}/http/error/service-unavailable.js +2 -2
- package/{dist/types → lib}/http/error/too-many-requests-error.d.ts +1 -1
- package/{dist/es → lib}/http/error/too-many-requests-error.js +2 -2
- package/{dist/types → lib}/http/error/unauthorized-error.d.ts +1 -1
- package/{dist/es → lib}/http/error/unauthorized-error.js +2 -2
- package/{dist/types → lib}/http/event-util.d.ts +3 -25
- package/{dist/es → lib}/http/event-util.js +9 -8
- package/lib/http/event-util.spec.js +157 -0
- package/{dist/types → lib}/http/response-util.d.ts +2 -2
- package/{dist/es → lib}/http/response-util.js +2 -2
- package/lib/http/response-util.spec.d.ts +1 -0
- package/lib/http/response-util.spec.js +88 -0
- package/lib/http/route/epsilon-router.d.ts +8 -0
- package/lib/http/route/epsilon-router.js +1 -0
- package/lib/http/route/extended-auth-response-context.js +1 -0
- package/{dist/types → lib}/http/route/route-mapping.d.ts +3 -3
- package/lib/http/route/route-mapping.js +1 -0
- package/lib/http/route/route-validator-config.js +1 -0
- package/{dist/types → lib}/http/route/router-util.d.ts +9 -12
- package/{dist/es → lib}/http/route/router-util.js +10 -10
- package/lib/http/route/router-util.spec.d.ts +1 -0
- package/lib/http/route/router-util.spec.js +23 -0
- package/{dist/types → lib}/http/web-handler.d.ts +4 -7
- package/{dist/es → lib}/http/web-handler.js +11 -10
- package/lib/http/web-handler.spec.d.ts +1 -0
- package/lib/http/web-handler.spec.js +32 -0
- package/{dist/types → lib}/http/web-v2-handler.d.ts +2 -5
- package/{dist/es → lib}/http/web-v2-handler.js +3 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/inter-api/inter-api-entry.js +1 -0
- package/{dist/types → lib}/inter-api/inter-api-util.d.ts +3 -3
- package/{dist/es → lib}/inter-api/inter-api-util.js +6 -5
- package/lib/inter-api/inter-api-util.spec.d.ts +1 -0
- package/lib/inter-api/inter-api-util.spec.js +61 -0
- package/{dist/types → lib}/inter-api-manager.d.ts +2 -5
- package/{dist/es → lib}/inter-api-manager.js +5 -3
- package/{dist/types → lib}/lambda-event-handler/cron-epsilon-lambda-event-handler.d.ts +5 -5
- package/{dist/es → lib}/lambda-event-handler/cron-epsilon-lambda-event-handler.js +5 -4
- package/lib/lambda-event-handler/cron-epsilon-lambda-event-handler.spec.d.ts +1 -0
- package/lib/lambda-event-handler/cron-epsilon-lambda-event-handler.spec.js +50 -0
- package/{dist/types → lib}/lambda-event-handler/dynamo-epsilon-lambda-event-handler.d.ts +2 -2
- package/{dist/es → lib}/lambda-event-handler/dynamo-epsilon-lambda-event-handler.js +4 -3
- package/{dist/types → lib}/lambda-event-handler/generic-sns-epsilon-lambda-event-handler.d.ts +2 -2
- package/{dist/es → lib}/lambda-event-handler/generic-sns-epsilon-lambda-event-handler.js +4 -3
- package/{dist/types → lib}/lambda-event-handler/inter-api-epsilon-lambda-event-handler.d.ts +2 -2
- package/{dist/es → lib}/lambda-event-handler/inter-api-epsilon-lambda-event-handler.js +2 -1
- package/{dist/types → lib}/lambda-event-handler/s3-epsilon-lambda-event-handler.d.ts +2 -2
- package/{dist/es → lib}/lambda-event-handler/s3-epsilon-lambda-event-handler.js +4 -3
- package/{dist/types → lib}/local-container-server.d.ts +1 -4
- package/{dist/es → lib}/local-container-server.js +8 -4
- package/lib/local-server-cert.js +67 -0
- package/{dist/types → lib}/local-server.d.ts +2 -5
- package/{dist/es → lib}/local-server.js +11 -8
- package/lib/open-api-util/open-api-doc-modifications.js +1 -0
- package/{dist/types → lib}/open-api-util/open-api-doc-modifier.d.ts +1 -4
- package/{dist/es → lib}/open-api-util/open-api-doc-modifier.js +2 -1
- package/lib/open-api-util/open-api-doc-modifier.spec.d.ts +1 -0
- package/lib/open-api-util/open-api-doc-modifier.spec.js +16 -0
- package/{dist/es → lib}/open-api-util/yaml-combiner.js +2 -2
- package/lib/open-api-util/yaml-combiner.spec.d.ts +1 -0
- package/lib/open-api-util/yaml-combiner.spec.js +22 -0
- package/{dist/types → lib}/sample/sample-server-components.d.ts +2 -2
- package/{dist/es → lib}/sample/sample-server-components.js +25 -24
- package/lib/sample/sample-server-static-files.js +593 -0
- package/{dist/types → lib}/sample/test-error-server.d.ts +1 -4
- package/{dist/es → lib}/sample/test-error-server.js +4 -2
- package/{dist/types → lib}/util/context-util.d.ts +3 -3
- package/{dist/es → lib}/util/context-util.js +11 -5
- package/{dist/types → lib}/util/cron-util.d.ts +2 -2
- package/{dist/es → lib}/util/cron-util.js +3 -3
- package/lib/util/cron-util.spec.d.ts +1 -0
- package/lib/util/cron-util.spec.js +124 -0
- package/{dist/types → lib}/util/epsilon-config-parser.d.ts +6 -6
- package/{dist/es → lib}/util/epsilon-config-parser.js +9 -9
- package/package.json +16 -19
- package/dist/cjs/background/background-dynamo-log-table-handler.js +0 -38
- package/dist/cjs/background/background-entry.js +0 -2
- package/dist/cjs/background/background-execution-event-type.js +0 -11
- package/dist/cjs/background/background-execution-event.js +0 -2
- package/dist/cjs/background/background-execution-listener.js +0 -2
- package/dist/cjs/background/background-handler.js +0 -269
- package/dist/cjs/background/background-http-adapter-handler.js +0 -127
- package/dist/cjs/background/background-meta-response-internal.js +0 -2
- package/dist/cjs/background/background-process-handling.js +0 -8
- package/dist/cjs/background/background-process-log-table-entry.js +0 -2
- package/dist/cjs/background/background-queue-response-internal.js +0 -2
- package/dist/cjs/background/background-validator.js +0 -88
- package/dist/cjs/background/epsilon-background-process-error.js +0 -93
- package/dist/cjs/background/internal-background-entry.js +0 -2
- package/dist/cjs/background/manager/abstract-background-manager.js +0 -92
- package/dist/cjs/background/manager/aws-sqs-sns-background-manager.js +0 -153
- package/dist/cjs/background/manager/background-manager-like.js +0 -2
- package/dist/cjs/background/manager/single-thread-local-background-manager.js +0 -49
- package/dist/cjs/background/s3-background-transaction-logger.js +0 -54
- package/dist/cjs/build/ratchet-epsilon-common-info.js +0 -18
- package/dist/cjs/built-in/background/echo-processor.js +0 -18
- package/dist/cjs/built-in/background/log-and-enqueue-echo-processor.js +0 -16
- package/dist/cjs/built-in/background/log-message-background-error-processor.js +0 -10
- package/dist/cjs/built-in/background/no-op-processor.js +0 -13
- package/dist/cjs/built-in/background/retry-processor.js +0 -41
- package/dist/cjs/built-in/background/sample-delay-processor.js +0 -16
- package/dist/cjs/built-in/background/sample-input-validated-processor-data.js +0 -2
- package/dist/cjs/built-in/background/sample-input-validated-processor.js +0 -16
- package/dist/cjs/built-in/built-in-trace-id-generators.js +0 -25
- package/dist/cjs/built-in/daemon/daemon-authorizer-function.js +0 -2
- package/dist/cjs/built-in/daemon/daemon-config.js +0 -2
- package/dist/cjs/built-in/daemon/daemon-group-selection-function.js +0 -2
- package/dist/cjs/built-in/daemon/daemon-handler.js +0 -62
- package/dist/cjs/built-in/daemon/daemon-process-state-list.js +0 -2
- package/dist/cjs/built-in/http/apollo-filter.js +0 -63
- package/dist/cjs/built-in/http/built-in-auth-filters.js +0 -115
- package/dist/cjs/built-in/http/built-in-authorizers.js +0 -43
- package/dist/cjs/built-in/http/built-in-filters.js +0 -222
- package/dist/cjs/built-in/http/built-in-handlers.js +0 -73
- package/dist/cjs/built-in/http/log-level-manipulation-filter.js +0 -20
- package/dist/cjs/built-in/http/run-handler-as-filter.js +0 -64
- package/dist/cjs/cli-bootstrap/ratchet-cli-handler.js +0 -24
- package/dist/cjs/cli-bootstrap/run-background-process-from-command-line.js +0 -26
- package/dist/cjs/config/background/background-aws-config.js +0 -2
- package/dist/cjs/config/background/background-config.js +0 -2
- package/dist/cjs/config/background/background-error-processor.js +0 -2
- package/dist/cjs/config/background/background-processor.js +0 -2
- package/dist/cjs/config/background/background-transaction-log.js +0 -2
- package/dist/cjs/config/background/background-transaction-logger.js +0 -2
- package/dist/cjs/config/cron/abstract-cron-entry.js +0 -2
- package/dist/cjs/config/cron/cron-background-entry.js +0 -2
- package/dist/cjs/config/cron/cron-config.js +0 -2
- package/dist/cjs/config/dynamo-db-config.js +0 -2
- package/dist/cjs/config/epsilon-config.js +0 -2
- package/dist/cjs/config/epsilon-lambda-event-handler.js +0 -2
- package/dist/cjs/config/epsilon-logger-config.js +0 -2
- package/dist/cjs/config/generic-aws-event-handler-function.js +0 -2
- package/dist/cjs/config/http/authorizer-function.js +0 -2
- package/dist/cjs/config/http/epsilon-authorization-context.js +0 -2
- package/dist/cjs/config/http/extended-api-gateway-event.js +0 -2
- package/dist/cjs/config/http/filter-chain-context.js +0 -2
- package/dist/cjs/config/http/filter-function.js +0 -2
- package/dist/cjs/config/http/handler-function.js +0 -2
- package/dist/cjs/config/http/http-config.js +0 -2
- package/dist/cjs/config/http/http-processing-config.js +0 -2
- package/dist/cjs/config/http/mapped-http-processing-config.js +0 -2
- package/dist/cjs/config/http/null-returned-object-handling.js +0 -9
- package/dist/cjs/config/inter-api/inter-api-aws-config.js +0 -2
- package/dist/cjs/config/inter-api/inter-api-config.js +0 -2
- package/dist/cjs/config/inter-api/inter-api-process-mapping.js +0 -2
- package/dist/cjs/config/logging-trace-id-generator.js +0 -2
- package/dist/cjs/config/open-api/open-api-document-components.js +0 -2
- package/dist/cjs/config/open-api/open-api-document-path.js +0 -2
- package/dist/cjs/config/open-api/open-api-document.js +0 -2
- package/dist/cjs/config/s3-config.js +0 -2
- package/dist/cjs/config/sns-config.js +0 -2
- package/dist/cjs/epsilon-build-properties.js +0 -28
- package/dist/cjs/epsilon-constants.js +0 -49
- package/dist/cjs/epsilon-global-handler.js +0 -155
- package/dist/cjs/epsilon-instance.js +0 -2
- package/dist/cjs/epsilon-logging-extension-processor.js +0 -19
- package/dist/cjs/http/auth/api-gateway-adapter-authentication-handler.js +0 -75
- package/dist/cjs/http/auth/auth0-web-token-manipulator.js +0 -62
- package/dist/cjs/http/auth/basic-auth-token.js +0 -2
- package/dist/cjs/http/auth/google-web-token-manipulator.js +0 -72
- package/dist/cjs/http/auth/jwt-ratchet-local-web-token-manipulator.js +0 -29
- package/dist/cjs/http/auth/local-web-token-manipulator.js +0 -74
- package/dist/cjs/http/auth/web-token-manipulator.js +0 -2
- package/dist/cjs/http/error/bad-gateway.js +0 -12
- package/dist/cjs/http/error/bad-request-error.js +0 -12
- package/dist/cjs/http/error/conflict-error.js +0 -12
- package/dist/cjs/http/error/epsilon-http-error.js +0 -132
- package/dist/cjs/http/error/forbidden-error.js +0 -12
- package/dist/cjs/http/error/gateway-timeout.js +0 -12
- package/dist/cjs/http/error/method-not-allowed-error.js +0 -12
- package/dist/cjs/http/error/misconfigured-error.js +0 -12
- package/dist/cjs/http/error/not-found-error.js +0 -12
- package/dist/cjs/http/error/not-implemented.js +0 -12
- package/dist/cjs/http/error/request-timeout-error.js +0 -12
- package/dist/cjs/http/error/service-unavailable.js +0 -12
- package/dist/cjs/http/error/too-many-requests-error.js +0 -12
- package/dist/cjs/http/error/unauthorized-error.js +0 -12
- package/dist/cjs/http/event-util.js +0 -180
- package/dist/cjs/http/response-util.js +0 -146
- package/dist/cjs/http/route/epsilon-router.js +0 -2
- package/dist/cjs/http/route/extended-auth-response-context.js +0 -2
- package/dist/cjs/http/route/route-mapping.js +0 -2
- package/dist/cjs/http/route/route-validator-config.js +0 -2
- package/dist/cjs/http/route/router-util.js +0 -238
- package/dist/cjs/http/web-handler.js +0 -122
- package/dist/cjs/http/web-v2-handler.js +0 -25
- package/dist/cjs/index.js +0 -135
- package/dist/cjs/inter-api/inter-api-entry.js +0 -2
- package/dist/cjs/inter-api/inter-api-util.js +0 -62
- package/dist/cjs/inter-api-manager.js +0 -67
- package/dist/cjs/lambda-event-handler/cron-epsilon-lambda-event-handler.js +0 -76
- package/dist/cjs/lambda-event-handler/dynamo-epsilon-lambda-event-handler.js +0 -36
- package/dist/cjs/lambda-event-handler/generic-sns-epsilon-lambda-event-handler.js +0 -32
- package/dist/cjs/lambda-event-handler/inter-api-epsilon-lambda-event-handler.js +0 -26
- package/dist/cjs/lambda-event-handler/s3-epsilon-lambda-event-handler.js +0 -44
- package/dist/cjs/local-container-server.js +0 -77
- package/dist/cjs/local-server-cert.js +0 -71
- package/dist/cjs/local-server.js +0 -164
- package/dist/cjs/open-api-util/open-api-doc-modifications.js +0 -2
- package/dist/cjs/open-api-util/open-api-doc-modifier.js +0 -83
- package/dist/cjs/open-api-util/yaml-combiner.js +0 -32
- package/dist/cjs/sample/sample-server-components.js +0 -188
- package/dist/cjs/sample/sample-server-static-files.js +0 -597
- package/dist/cjs/sample/test-error-server.js +0 -47
- package/dist/cjs/util/aws-util.js +0 -69
- package/dist/cjs/util/context-util.js +0 -104
- package/dist/cjs/util/cron-util.js +0 -72
- package/dist/cjs/util/epsilon-config-parser.js +0 -71
- package/dist/es/index.js +0 -132
- package/dist/es/local-server-cert.js +0 -67
- package/dist/es/sample/sample-server-static-files.js +0 -593
- package/dist/tsconfig.cjs.tsbuildinfo +0 -1
- package/dist/tsconfig.es.tsbuildinfo +0 -1
- package/dist/tsconfig.types.tsbuildinfo +0 -1
- package/dist/types/built-in/daemon/daemon-process-state-list.d.ts +0 -8
- package/dist/types/cli-bootstrap/run-background-process-from-command-line.d.ts +0 -12
- package/dist/types/config/cron/cron-background-entry.d.ts +0 -15
- package/dist/types/config/inter-api/inter-api-process-mapping.d.ts +0 -11
- package/dist/types/epsilon-logging-extension-processor.d.ts +0 -5
- package/dist/types/http/route/epsilon-router.d.ts +0 -8
- package/dist/types/index.d.ts +0 -135
- package/includes/cli.js +0 -12
- /package/{dist/types → lib}/background/background-entry.d.ts +0 -0
- /package/{dist/es → lib}/background/background-entry.js +0 -0
- /package/{dist/types → lib}/background/background-execution-event-type.d.ts +0 -0
- /package/{dist/es → lib}/background/background-execution-event-type.js +0 -0
- /package/{dist/es → lib}/background/background-execution-event.js +0 -0
- /package/{dist/es → lib}/background/background-execution-listener.js +0 -0
- /package/{dist/types → lib}/background/background-meta-response-internal.d.ts +0 -0
- /package/{dist/es → lib}/background/background-meta-response-internal.js +0 -0
- /package/{dist/types → lib}/background/background-process-handling.d.ts +0 -0
- /package/{dist/es → lib}/background/background-process-handling.js +0 -0
- /package/{dist/types → lib}/background/background-process-log-table-entry.d.ts +0 -0
- /package/{dist/es → lib}/background/background-process-log-table-entry.js +0 -0
- /package/{dist/es → lib}/background/background-queue-response-internal.js +0 -0
- /package/{dist/types → lib}/background/epsilon-background-process-error.d.ts +0 -0
- /package/{dist/es → lib}/background/internal-background-entry.js +0 -0
- /package/{dist/es → lib}/background/manager/background-manager-like.js +0 -0
- /package/{dist/es/built-in/background/sample-input-validated-processor-data.js → lib/background/manager/background-manager.spec.d.ts} +0 -0
- /package/{dist/es → lib}/build/ratchet-epsilon-common-info.js +0 -0
- /package/{dist/types → lib}/built-in/background/sample-input-validated-processor-data.d.ts +0 -0
- /package/{dist/es/built-in/daemon/daemon-authorizer-function.js → lib/built-in/background/sample-input-validated-processor-data.js} +0 -0
- /package/{dist/types → lib}/built-in/built-in-trace-id-generators.d.ts +0 -0
- /package/{dist/es/built-in/daemon/daemon-config.js → lib/built-in/daemon/daemon-authorizer-function.js} +0 -0
- /package/{dist/es/built-in/daemon/daemon-group-selection-function.js → lib/built-in/daemon/daemon-config.js} +0 -0
- /package/{dist/es/built-in/daemon/daemon-process-state-list.js → lib/built-in/daemon/daemon-group-selection-function.js} +0 -0
- /package/{dist/es/config/background/background-aws-config.js → lib/built-in/daemon/daemon-process-state-list.js} +0 -0
- /package/{dist/es/config/background/background-config.js → lib/built-in/http/run-handler-as-filter.spec.d.ts} +0 -0
- /package/{dist/types → lib}/config/background/background-aws-config.d.ts +0 -0
- /package/{dist/es/config/background/background-error-processor.js → lib/config/background/background-aws-config.js} +0 -0
- /package/{dist/es/config/background/background-processor.js → lib/config/background/background-config.js} +0 -0
- /package/{dist/es/config/background/background-transaction-log.js → lib/config/background/background-error-processor.js} +0 -0
- /package/{dist/es/config/background/background-transaction-logger.js → lib/config/background/background-processor.js} +0 -0
- /package/{dist/es/config/cron/abstract-cron-entry.js → lib/config/background/background-transaction-log.js} +0 -0
- /package/{dist/es/config/cron/cron-background-entry.js → lib/config/background/background-transaction-logger.js} +0 -0
- /package/{dist/types → lib}/config/cron/abstract-cron-entry.d.ts +0 -0
- /package/{dist/es/config/cron/cron-config.js → lib/config/cron/abstract-cron-entry.js} +0 -0
- /package/{dist/es/config/dynamo-db-config.js → lib/config/cron/cron-background-entry.js} +0 -0
- /package/{dist/es/config/epsilon-config.js → lib/config/cron/cron-config.js} +0 -0
- /package/{dist/es/config/epsilon-lambda-event-handler.js → lib/config/dynamo-db-config.js} +0 -0
- /package/{dist/es/config/epsilon-logger-config.js → lib/config/epsilon-config.js} +0 -0
- /package/{dist/types → lib}/config/epsilon-lambda-event-handler.d.ts +0 -0
- /package/{dist/es/config/generic-aws-event-handler-function.js → lib/config/epsilon-lambda-event-handler.js} +0 -0
- /package/{dist/es/config/http/authorizer-function.js → lib/config/epsilon-logger-config.js} +0 -0
- /package/{dist/types → lib}/config/generic-aws-event-handler-function.d.ts +0 -0
- /package/{dist/es/config/http/epsilon-authorization-context.js → lib/config/generic-aws-event-handler-function.js} +0 -0
- /package/{dist/es/config/http/extended-api-gateway-event.js → lib/config/http/authorizer-function.js} +0 -0
- /package/{dist/types → lib}/config/http/epsilon-authorization-context.d.ts +0 -0
- /package/{dist/es/config/http/filter-chain-context.js → lib/config/http/epsilon-authorization-context.js} +0 -0
- /package/{dist/es/config/http/filter-function.js → lib/config/http/extended-api-gateway-event.js} +0 -0
- /package/{dist/es/config/http/handler-function.js → lib/config/http/filter-chain-context.js} +0 -0
- /package/{dist/es/config/http/http-config.js → lib/config/http/filter-function.js} +0 -0
- /package/{dist/es/config/http/http-processing-config.js → lib/config/http/handler-function.js} +0 -0
- /package/{dist/es/config/http/mapped-http-processing-config.js → lib/config/http/http-config.js} +0 -0
- /package/{dist/es/config/inter-api/inter-api-aws-config.js → lib/config/http/http-processing-config.js} +0 -0
- /package/{dist/es/config/inter-api/inter-api-config.js → lib/config/http/mapped-http-processing-config.js} +0 -0
- /package/{dist/types → lib}/config/http/null-returned-object-handling.d.ts +0 -0
- /package/{dist/es → lib}/config/http/null-returned-object-handling.js +0 -0
- /package/{dist/types → lib}/config/inter-api/inter-api-aws-config.d.ts +0 -0
- /package/{dist/es/config/inter-api/inter-api-process-mapping.js → lib/config/inter-api/inter-api-aws-config.js} +0 -0
- /package/{dist/es/config/logging-trace-id-generator.js → lib/config/inter-api/inter-api-config.js} +0 -0
- /package/{dist/es/config/open-api/open-api-document-components.js → lib/config/inter-api/inter-api-process-mapping.js} +0 -0
- /package/{dist/types → lib}/config/logging-trace-id-generator.d.ts +0 -0
- /package/{dist/es/config/open-api/open-api-document-path.js → lib/config/logging-trace-id-generator.js} +0 -0
- /package/{dist/types → lib}/config/open-api/open-api-document-components.d.ts +0 -0
- /package/{dist/es/config/open-api/open-api-document.js → lib/config/open-api/open-api-document-components.js} +0 -0
- /package/{dist/types → lib}/config/open-api/open-api-document-path.d.ts +0 -0
- /package/{dist/es/config/s3-config.js → lib/config/open-api/open-api-document-path.js} +0 -0
- /package/{dist/es/config/sns-config.js → lib/config/open-api/open-api-document.js} +0 -0
- /package/{dist/es/epsilon-instance.js → lib/config/s3-config.js} +0 -0
- /package/{dist/es/http/auth/basic-auth-token.js → lib/config/sns-config.js} +0 -0
- /package/{dist/types → lib}/epsilon-build-properties.d.ts +0 -0
- /package/{dist/es/http/auth/web-token-manipulator.js → lib/epsilon-instance.js} +0 -0
- /package/{dist/es/http/route/epsilon-router.js → lib/http/auth/basic-auth-token.js} +0 -0
- /package/{dist/es/http/route/extended-auth-response-context.js → lib/http/auth/google-web-token-manipulator.spec.d.ts} +0 -0
- /package/{dist/es/http/route/route-mapping.js → lib/http/auth/local-web-token-manipulator.spec.d.ts} +0 -0
- /package/{dist/es/http/route/route-validator-config.js → lib/http/auth/web-token-manipulator.js} +0 -0
- /package/{dist/types → lib}/http/error/epsilon-http-error.d.ts +0 -0
- /package/{dist/es/inter-api/inter-api-entry.js → lib/http/error/epsilon-http-error.spec.d.ts} +0 -0
- /package/{dist/es/open-api-util/open-api-doc-modifications.js → lib/http/event-util.spec.d.ts} +0 -0
- /package/{dist/types → lib}/http/route/extended-auth-response-context.d.ts +0 -0
- /package/{dist/types → lib}/http/route/route-validator-config.d.ts +0 -0
- /package/{dist/types → lib}/inter-api/inter-api-entry.d.ts +0 -0
- /package/{dist/types → lib}/local-server-cert.d.ts +0 -0
- /package/{dist/types → lib}/open-api-util/open-api-doc-modifications.d.ts +0 -0
- /package/{dist/types → lib}/open-api-util/yaml-combiner.d.ts +0 -0
- /package/{dist/types → lib}/sample/sample-server-static-files.d.ts +0 -0
- /package/{dist/types → lib}/util/aws-util.d.ts +0 -0
- /package/{dist/es → lib}/util/aws-util.js +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { EpsilonHttpError } from './epsilon-http-error';
|
|
1
|
+
import { EpsilonHttpError } from './epsilon-http-error.js';
|
|
2
2
|
export class ServiceUnavailable extends EpsilonHttpError {
|
|
3
|
+
static HTTP_CODE = 503;
|
|
3
4
|
constructor(...errors) {
|
|
4
5
|
super(...errors);
|
|
5
6
|
this.withHttpStatusCode(ServiceUnavailable.HTTP_CODE);
|
|
6
7
|
}
|
|
7
8
|
}
|
|
8
|
-
ServiceUnavailable.HTTP_CODE = 503;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EpsilonHttpError } from './epsilon-http-error';
|
|
1
|
+
import { EpsilonHttpError } from './epsilon-http-error.js';
|
|
2
2
|
export declare class TooManyRequestsError<T = void> extends EpsilonHttpError<T> {
|
|
3
3
|
static readonly HTTP_CODE: number;
|
|
4
4
|
constructor(...errors: string[]);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { EpsilonHttpError } from './epsilon-http-error';
|
|
1
|
+
import { EpsilonHttpError } from './epsilon-http-error.js';
|
|
2
2
|
export class TooManyRequestsError extends EpsilonHttpError {
|
|
3
|
+
static HTTP_CODE = 429;
|
|
3
4
|
constructor(...errors) {
|
|
4
5
|
super(...errors);
|
|
5
6
|
this.withHttpStatusCode(TooManyRequestsError.HTTP_CODE);
|
|
6
7
|
}
|
|
7
8
|
}
|
|
8
|
-
TooManyRequestsError.HTTP_CODE = 429;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EpsilonHttpError } from './epsilon-http-error';
|
|
1
|
+
import { EpsilonHttpError } from './epsilon-http-error.js';
|
|
2
2
|
export declare class UnauthorizedError<T = void> extends EpsilonHttpError<T> {
|
|
3
3
|
static readonly HTTP_CODE: number;
|
|
4
4
|
constructor(...errors: string[]);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { EpsilonHttpError } from './epsilon-http-error';
|
|
1
|
+
import { EpsilonHttpError } from './epsilon-http-error.js';
|
|
2
2
|
export class UnauthorizedError extends EpsilonHttpError {
|
|
3
|
+
static HTTP_CODE = 401;
|
|
3
4
|
constructor(...errors) {
|
|
4
5
|
super(...errors);
|
|
5
6
|
this.withHttpStatusCode(UnauthorizedError.HTTP_CODE);
|
|
6
7
|
}
|
|
7
8
|
}
|
|
8
|
-
UnauthorizedError.HTTP_CODE = 401;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { APIGatewayEvent, APIGatewayEventRequestContext, AuthResponseContext } from 'aws-lambda';
|
|
2
|
-
import { EpsilonLoggerConfig } from '../config/epsilon-logger-config';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
/**
|
|
6
|
-
* Endpoints about the api itself
|
|
7
|
-
*/
|
|
2
|
+
import { EpsilonLoggerConfig } from '../config/epsilon-logger-config.js';
|
|
3
|
+
import { LoggerLevelName } from '@bitblit/ratchet-common/lib/logger/logger-level-name.js';
|
|
4
|
+
import { BasicAuthToken } from './auth/basic-auth-token.js';
|
|
8
5
|
export declare class EventUtil {
|
|
9
6
|
private constructor();
|
|
10
7
|
static extractStage(event: APIGatewayEvent): string;
|
|
@@ -19,26 +16,7 @@ export declare class EventUtil {
|
|
|
19
16
|
static extractFullPrefix(event: APIGatewayEvent, overrideProtocol?: string): string;
|
|
20
17
|
static jsonBodyToObject(event: APIGatewayEvent): any;
|
|
21
18
|
static calcLogLevelViaEventOrEnvParam(curLevel: LoggerLevelName, event: APIGatewayEvent, rConfig: EpsilonLoggerConfig): LoggerLevelName;
|
|
22
|
-
/**
|
|
23
|
-
* This is a weird function - sometimes your customers will not decode their query params and it
|
|
24
|
-
* results in query params that look like 'amp;SOMETHING' instead of 'SOMETHING'. This function
|
|
25
|
-
* looks for params that look like that, and strips the amp; from them. If you have any
|
|
26
|
-
* params you are expecting that have 'amp;' in front of them, DON'T use this function.
|
|
27
|
-
*
|
|
28
|
-
* Also, you are a moron for having a param that looks like that
|
|
29
|
-
*
|
|
30
|
-
* Yes, it would be better to fix this on the client side, but that is not always an option
|
|
31
|
-
* in production
|
|
32
|
-
* @param event
|
|
33
|
-
*/
|
|
34
19
|
static fixStillEncodedQueryParams(event: APIGatewayEvent): void;
|
|
35
|
-
/**
|
|
36
|
-
* Allows you to force in a token for an arbitrary event without having to pass the whole thing
|
|
37
|
-
* through Epsilon. Useful for when you need to test a handler that needs authorization,
|
|
38
|
-
* and don't need to instantiate all of epsilon, just the handler
|
|
39
|
-
* @param event Event to decorate
|
|
40
|
-
* @param jwtToken String containing a valid JWT token
|
|
41
|
-
*/
|
|
42
20
|
static applyTokenToEventForTesting(event: APIGatewayEvent, jwtToken: string): void;
|
|
43
21
|
static extractBasicAuthenticationToken(event: APIGatewayEvent, throwErrorOnMissingBad?: boolean): BasicAuthToken;
|
|
44
22
|
static eventIsAGraphQLIntrospection(event: APIGatewayEvent): boolean;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { UnauthorizedError } from './error/unauthorized-error';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { UnauthorizedError } from './error/unauthorized-error.js';
|
|
2
|
+
import { BadRequestError } from './error/bad-request-error.js';
|
|
3
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
4
|
+
import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
|
|
5
|
+
import { MapRatchet } from '@bitblit/ratchet-common/lib/lang/map-ratchet.js';
|
|
6
|
+
import { LoggerLevelName } from '@bitblit/ratchet-common/lib/logger/logger-level-name.js';
|
|
7
|
+
import { EnumRatchet } from '@bitblit/ratchet-common/lib/lang/enum-ratchet.js';
|
|
8
|
+
import { Base64Ratchet } from '@bitblit/ratchet-common/lib/lang/base64-ratchet.js';
|
|
5
9
|
import jwt from 'jsonwebtoken';
|
|
6
|
-
import {
|
|
7
|
-
import { StringRatchet } from '@bitblit/ratchet-common';
|
|
8
|
-
import { EpsilonConstants } from '../epsilon-constants';
|
|
9
|
-
import { EnumRatchet, LoggerLevelName } from '@bitblit/ratchet-common';
|
|
10
|
+
import { EpsilonConstants } from '../epsilon-constants.js';
|
|
10
11
|
export class EventUtil {
|
|
11
12
|
constructor() { }
|
|
12
13
|
static extractStage(event) {
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { EventUtil } from './event-util.js';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { EsmRatchet } from '@bitblit/ratchet-common/lib/lang/esm-ratchet.js';
|
|
5
|
+
describe('#eventUtil', function () {
|
|
6
|
+
it('should extract pieces', function () {
|
|
7
|
+
const evt = {
|
|
8
|
+
httpMethod: 'GET',
|
|
9
|
+
path: '/cw/meta/server',
|
|
10
|
+
body: null,
|
|
11
|
+
headers: {
|
|
12
|
+
Host: 'api.test.com',
|
|
13
|
+
'X-Forwarded-Proto': 'https',
|
|
14
|
+
},
|
|
15
|
+
multiValueHeaders: {
|
|
16
|
+
Host: ['api.test.com'],
|
|
17
|
+
'X-Forwarded-Proto': ['https'],
|
|
18
|
+
},
|
|
19
|
+
multiValueQueryStringParameters: null,
|
|
20
|
+
isBase64Encoded: false,
|
|
21
|
+
pathParameters: null,
|
|
22
|
+
queryStringParameters: null,
|
|
23
|
+
stageVariables: null,
|
|
24
|
+
resource: '/{proxy+}',
|
|
25
|
+
requestContext: {
|
|
26
|
+
httpMethod: 'GET',
|
|
27
|
+
accountId: '1234',
|
|
28
|
+
apiId: '7890',
|
|
29
|
+
stage: 'v0',
|
|
30
|
+
path: '/cw/meta/server',
|
|
31
|
+
domainName: 'api.test.com',
|
|
32
|
+
identity: null,
|
|
33
|
+
requestId: 'asdf1234',
|
|
34
|
+
requestTimeEpoch: 1234,
|
|
35
|
+
resourceId: '1234',
|
|
36
|
+
resourcePath: '/{proxy+}',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
expect(EventUtil.extractStage(evt)).toEqual('cw');
|
|
40
|
+
expect(EventUtil.extractApiGatewayStage(evt)).toEqual('v0');
|
|
41
|
+
expect(EventUtil.extractFullPrefix(evt)).toEqual('https://api.test.com/cw');
|
|
42
|
+
expect(EventUtil.extractFullPath(evt)).toEqual('https://api.test.com/cw/meta/server');
|
|
43
|
+
expect(EventUtil.extractHostHeader(evt)).toEqual('api.test.com');
|
|
44
|
+
});
|
|
45
|
+
it('should fix still encoded query params', function () {
|
|
46
|
+
const evt = {
|
|
47
|
+
httpMethod: 'GET',
|
|
48
|
+
path: '/cw/meta/server',
|
|
49
|
+
body: null,
|
|
50
|
+
headers: {
|
|
51
|
+
Host: 'api.test.com',
|
|
52
|
+
'X-Forwarded-Proto': 'https',
|
|
53
|
+
},
|
|
54
|
+
multiValueHeaders: {
|
|
55
|
+
Host: ['api.test.com'],
|
|
56
|
+
'X-Forwarded-Proto': ['https'],
|
|
57
|
+
},
|
|
58
|
+
isBase64Encoded: false,
|
|
59
|
+
pathParameters: null,
|
|
60
|
+
multiValueQueryStringParameters: {
|
|
61
|
+
a: ['b'],
|
|
62
|
+
'amp;c': ['d'],
|
|
63
|
+
},
|
|
64
|
+
queryStringParameters: {
|
|
65
|
+
a: 'b',
|
|
66
|
+
'amp;c': 'd',
|
|
67
|
+
},
|
|
68
|
+
stageVariables: null,
|
|
69
|
+
resource: '/{proxy+}',
|
|
70
|
+
requestContext: {
|
|
71
|
+
httpMethod: 'GET',
|
|
72
|
+
accountId: '1234',
|
|
73
|
+
apiId: '7890',
|
|
74
|
+
stage: 'v0',
|
|
75
|
+
path: '/cw/meta/server',
|
|
76
|
+
domainName: 'api.test.com',
|
|
77
|
+
identity: null,
|
|
78
|
+
requestId: 'asdf1234',
|
|
79
|
+
requestTimeEpoch: 1234,
|
|
80
|
+
resourceId: '1234',
|
|
81
|
+
resourcePath: '/{proxy+}',
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
expect(evt.queryStringParameters['a']).toBeTruthy();
|
|
85
|
+
expect(evt.queryStringParameters['amp;c']).toBeTruthy();
|
|
86
|
+
expect(evt.queryStringParameters['c']).toBeUndefined();
|
|
87
|
+
EventUtil.fixStillEncodedQueryParams(evt);
|
|
88
|
+
expect(evt.queryStringParameters['a']).toBeTruthy();
|
|
89
|
+
expect(evt.queryStringParameters['amp;c']).toBeUndefined();
|
|
90
|
+
expect(evt.queryStringParameters['c']).toBeTruthy();
|
|
91
|
+
});
|
|
92
|
+
it('should extract basic auth from headers', function () {
|
|
93
|
+
const evt = {
|
|
94
|
+
httpMethod: 'GET',
|
|
95
|
+
path: '/cw/meta/server',
|
|
96
|
+
body: null,
|
|
97
|
+
headers: {
|
|
98
|
+
Host: 'api.test.com',
|
|
99
|
+
'X-Forwarded-Proto': 'https',
|
|
100
|
+
Authorization: 'Basic dGVzdHVzZXI6dGVzdHBhc3M=',
|
|
101
|
+
},
|
|
102
|
+
multiValueHeaders: {
|
|
103
|
+
Host: ['api.test.com'],
|
|
104
|
+
'X-Forwarded-Proto': ['https'],
|
|
105
|
+
Authorization: ['Basic dGVzdHVzZXI6dGVzdHBhc3M='],
|
|
106
|
+
},
|
|
107
|
+
isBase64Encoded: false,
|
|
108
|
+
pathParameters: null,
|
|
109
|
+
multiValueQueryStringParameters: {
|
|
110
|
+
a: ['b'],
|
|
111
|
+
'amp;c': ['d'],
|
|
112
|
+
},
|
|
113
|
+
queryStringParameters: {
|
|
114
|
+
a: 'b',
|
|
115
|
+
'amp;c': 'd',
|
|
116
|
+
},
|
|
117
|
+
stageVariables: null,
|
|
118
|
+
resource: '/{proxy+}',
|
|
119
|
+
requestContext: {
|
|
120
|
+
httpMethod: 'GET',
|
|
121
|
+
accountId: '1234',
|
|
122
|
+
apiId: '7890',
|
|
123
|
+
stage: 'v0',
|
|
124
|
+
path: '/cw/meta/server',
|
|
125
|
+
domainName: 'api.test.com',
|
|
126
|
+
identity: null,
|
|
127
|
+
requestId: 'asdf1234',
|
|
128
|
+
requestTimeEpoch: 1234,
|
|
129
|
+
resourceId: '1234',
|
|
130
|
+
resourcePath: '/{proxy+}',
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
const basic = EventUtil.extractBasicAuthenticationToken(evt);
|
|
134
|
+
expect(basic).toBeTruthy();
|
|
135
|
+
expect(basic.username).toBeTruthy();
|
|
136
|
+
expect(basic.password).toBeTruthy();
|
|
137
|
+
expect(basic.username).toEqual('testuser');
|
|
138
|
+
expect(basic.password).toEqual('testpass');
|
|
139
|
+
});
|
|
140
|
+
it('should add a token to an event, along with downstream stuff', function () {
|
|
141
|
+
const evt = JSON.parse(fs.readFileSync(path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/sample-json/sample-request-1.json')).toString());
|
|
142
|
+
const jwtToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1ODg1MzY3NzU4ODcsImlzcyI6Im5lb24uYWRvbW5pLmNvbSIsInN1YiI6ImJpdGJsaXRAZ21haWwuY29tIiwiaWF0IjoxNTg4NTMzMTc1ODg3LCJ1c2VyIjp7ImlkIjo2LCJmaXJzdE5hbWUiOiJDaHJpcyIsImxhc3ROYW1lIjoiV2Vpc3MiLCJjb21wYW55IjoiQWRvbW5pIiwiZW1haWwiOiJiaXRibGl0QGdtYWlsLmNvbSIsImN1c3RvbWVyVHlwZSI6IkFETUlOIn0sImFjdGluZ1VzZXJJZCI6NiwiZ2xvYmFsIjp0cnVlLCJhZG1pbiI6eyJpZCI6NiwiZmlyc3ROYW1lIjoiQ2hyaXMiLCJsYXN0TmFtZSI6IldlaXNzIiwiY29tcGFueSI6IkFkb21uaSIsImVtYWlsIjoiYml0YmxpdEBnbWFpbC5jb20iLCJjdXN0b21lclR5cGUiOiJBRE1JTiJ9LCJzdWJVc2VycyI6W119.mwRSek5GwkvxpN44UTp49W6_9U_ARsFXThAyiqaF-eQ';
|
|
143
|
+
EventUtil.applyTokenToEventForTesting(evt, jwtToken);
|
|
144
|
+
const roundTripTokenString = EventUtil.extractBearerTokenFromEvent(evt);
|
|
145
|
+
expect(roundTripTokenString).toEqual(jwtToken);
|
|
146
|
+
});
|
|
147
|
+
it('should check if an event is a graphql introspection', function () {
|
|
148
|
+
const evt1 = JSON.parse(fs.readFileSync(path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/sample-json/sample-request-1.json')).toString());
|
|
149
|
+
const evt2 = JSON.parse(fs
|
|
150
|
+
.readFileSync(path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/sample-json/sample-gql-introspection.json'))
|
|
151
|
+
.toString());
|
|
152
|
+
const res1 = EventUtil.eventIsAGraphQLIntrospection(evt1);
|
|
153
|
+
const res2 = EventUtil.eventIsAGraphQLIntrospection(evt2);
|
|
154
|
+
expect(res1).toBeFalsy();
|
|
155
|
+
expect(res2).toBeTruthy();
|
|
156
|
+
});
|
|
157
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import { ProxyResult } from 'aws-lambda';
|
|
3
|
-
import { EpsilonHttpError } from './error/epsilon-http-error';
|
|
3
|
+
import { EpsilonHttpError } from './error/epsilon-http-error.js';
|
|
4
4
|
export declare class ResponseUtil {
|
|
5
5
|
private constructor();
|
|
6
6
|
static errorResponse<T>(err: EpsilonHttpError<T>): ProxyResult;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Logger } from '@bitblit/ratchet-common';
|
|
2
|
-
import { MapRatchet } from '@bitblit/ratchet-common';
|
|
1
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
2
|
+
import { MapRatchet } from '@bitblit/ratchet-common/lib/lang/map-ratchet.js';
|
|
3
3
|
import zlib from 'zlib';
|
|
4
4
|
export class ResponseUtil {
|
|
5
5
|
constructor() { }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { ResponseUtil } from './response-util.js';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import { BuiltInFilters } from '../built-in/http/built-in-filters.js';
|
|
5
|
+
import { EpsilonConstants } from '../epsilon-constants.js';
|
|
6
|
+
import { EsmRatchet } from '@bitblit/ratchet-common/lib/lang/esm-ratchet.js';
|
|
7
|
+
describe('#responseUtil', function () {
|
|
8
|
+
it('should correctly combine a redirect url and query params', function () {
|
|
9
|
+
const evt = {
|
|
10
|
+
httpMethod: 'get',
|
|
11
|
+
multiValueHeaders: {},
|
|
12
|
+
multiValueQueryStringParameters: {},
|
|
13
|
+
path: '/v0/meta/server',
|
|
14
|
+
body: null,
|
|
15
|
+
headers: null,
|
|
16
|
+
isBase64Encoded: false,
|
|
17
|
+
pathParameters: null,
|
|
18
|
+
stageVariables: null,
|
|
19
|
+
resource: null,
|
|
20
|
+
queryStringParameters: {
|
|
21
|
+
a: 'b',
|
|
22
|
+
c: 'd',
|
|
23
|
+
},
|
|
24
|
+
requestContext: {
|
|
25
|
+
stage: 'v0',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
const out1 = ResponseUtil.redirect('myTarget?e=f', 301, evt.queryStringParameters);
|
|
29
|
+
expect(out1).toBeTruthy();
|
|
30
|
+
expect(out1.headers).toBeTruthy();
|
|
31
|
+
expect(out1.headers.Location).toEqual('myTarget?e=f&a=b&c=d');
|
|
32
|
+
const out2 = ResponseUtil.redirect('myTarget', 301, evt.queryStringParameters);
|
|
33
|
+
expect(out2).toBeTruthy();
|
|
34
|
+
expect(out2.headers).toBeTruthy();
|
|
35
|
+
expect(out2.headers.Location).toEqual('myTarget?a=b&c=d');
|
|
36
|
+
});
|
|
37
|
+
it('should leave already encoded stuff alone', async () => {
|
|
38
|
+
const singlePixel = fs
|
|
39
|
+
.readFileSync(path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/test.png'))
|
|
40
|
+
.toString('base64');
|
|
41
|
+
const temp = {
|
|
42
|
+
body: singlePixel,
|
|
43
|
+
statusCode: 200,
|
|
44
|
+
isBase64Encoded: true,
|
|
45
|
+
headers: {
|
|
46
|
+
'content-type': 'application/zip',
|
|
47
|
+
'content-disposition': 'attachment; filename="adomni_bs_' + new Date().getTime() + '.zip"',
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
const cast = ResponseUtil.coerceToProxyResult(temp);
|
|
51
|
+
expect(cast.body).toEqual(temp.body);
|
|
52
|
+
const gzip = await ResponseUtil.applyGzipIfPossible('gzip', cast);
|
|
53
|
+
expect(cast.body).toEqual(gzip.body);
|
|
54
|
+
});
|
|
55
|
+
it('should add cors to proxy result MATCH 1', async () => {
|
|
56
|
+
const evt = JSON.parse(fs.readFileSync(path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/sample-json/sample-request-1.json')).toString());
|
|
57
|
+
const proxy = {};
|
|
58
|
+
const fCtx = {
|
|
59
|
+
event: evt,
|
|
60
|
+
rawResult: null,
|
|
61
|
+
context: null,
|
|
62
|
+
result: proxy,
|
|
63
|
+
routeAndParse: null,
|
|
64
|
+
modelValidator: null,
|
|
65
|
+
authenticators: null,
|
|
66
|
+
};
|
|
67
|
+
await BuiltInFilters.addAllowReflectionCORSHeaders(fCtx);
|
|
68
|
+
expect(proxy.headers).toBeTruthy();
|
|
69
|
+
expect(proxy.headers['Access-Control-Allow-Origin']).toEqual('http://localhost:4200');
|
|
70
|
+
expect(proxy.headers['Access-Control-Allow-Methods']).toEqual('GET');
|
|
71
|
+
expect(proxy.headers['Access-Control-Allow-Headers']).toEqual(EpsilonConstants.AUTH_HEADER_NAME.toLowerCase());
|
|
72
|
+
});
|
|
73
|
+
it('should add cors to proxy result MATCH 2', async () => {
|
|
74
|
+
const evt = JSON.parse(fs.readFileSync(path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/sample-json/sample-request-2.json')).toString());
|
|
75
|
+
const proxy = {};
|
|
76
|
+
const fCtx = {
|
|
77
|
+
event: evt,
|
|
78
|
+
rawResult: null,
|
|
79
|
+
context: null,
|
|
80
|
+
result: proxy,
|
|
81
|
+
routeAndParse: null,
|
|
82
|
+
modelValidator: null,
|
|
83
|
+
authenticators: null,
|
|
84
|
+
};
|
|
85
|
+
await BuiltInFilters.addAllowReflectionCORSHeaders(fCtx);
|
|
86
|
+
expect(proxy.headers).toBeTruthy();
|
|
87
|
+
});
|
|
88
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RouteMapping } from './route-mapping.js';
|
|
2
|
+
import { ModelValidator } from '@bitblit/ratchet-misc/lib/model-validator/model-validator.js';
|
|
3
|
+
import { HttpConfig } from '../../config/http/http-config.js';
|
|
4
|
+
export interface EpsilonRouter {
|
|
5
|
+
routes: RouteMapping[];
|
|
6
|
+
openApiModelValidator: ModelValidator;
|
|
7
|
+
config: HttpConfig;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RouteValidatorConfig } from './route-validator-config';
|
|
2
|
-
import { HandlerFunction } from '../../config/http/handler-function';
|
|
3
|
-
import { HttpProcessingConfig } from '../../config/http/http-processing-config';
|
|
1
|
+
import { RouteValidatorConfig } from './route-validator-config.js';
|
|
2
|
+
import { HandlerFunction } from '../../config/http/handler-function.js';
|
|
3
|
+
import { HttpProcessingConfig } from '../../config/http/http-processing-config.js';
|
|
4
4
|
export interface RouteMapping {
|
|
5
5
|
method: string;
|
|
6
6
|
path: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { EpsilonRouter } from './epsilon-router';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
/**
|
|
11
|
-
* Endpoints about the api itself
|
|
12
|
-
*/
|
|
1
|
+
import { EpsilonRouter } from './epsilon-router.js';
|
|
2
|
+
import { JwtTokenBase } from '@bitblit/ratchet-common/lib/jwt/jwt-token-base.js';
|
|
3
|
+
import { OpenApiDocument } from '../../config/open-api/open-api-document.js';
|
|
4
|
+
import { ModelValidator } from '@bitblit/ratchet-misc/lib/model-validator/model-validator.js';
|
|
5
|
+
import { BackgroundHttpAdapterHandler } from '../../background/background-http-adapter-handler.js';
|
|
6
|
+
import { HttpConfig } from '../../config/http/http-config.js';
|
|
7
|
+
import { HttpProcessingConfig } from '../../config/http/http-processing-config.js';
|
|
8
|
+
import { WebTokenManipulator } from '../auth/web-token-manipulator.js';
|
|
9
|
+
import { FilterFunction } from '../../config/http/filter-function.js';
|
|
13
10
|
export declare class RouterUtil {
|
|
14
11
|
private constructor();
|
|
15
12
|
static defaultAuthenticationHeaderParsingEpsilonPreFilters(webTokenManipulator: WebTokenManipulator<JwtTokenBase>): FilterFunction[];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { MisconfiguredError } from '../error/misconfigured-error';
|
|
2
|
-
import { Logger } from '@bitblit/ratchet-common';
|
|
3
|
-
import { BooleanRatchet } from '@bitblit/ratchet-common';
|
|
4
|
-
import { NullReturnedObjectHandling } from '../../config/http/null-returned-object-handling';
|
|
5
|
-
import { BuiltInFilters } from '../../built-in/http/built-in-filters';
|
|
6
|
-
import { BuiltInHandlers } from '../../built-in/http/built-in-handlers';
|
|
7
|
-
import { BuiltInAuthFilters } from '../../built-in/http/built-in-auth-filters';
|
|
8
|
-
import { LogLevelManipulationFilter } from '../../built-in/http/log-level-manipulation-filter';
|
|
1
|
+
import { MisconfiguredError } from '../error/misconfigured-error.js';
|
|
2
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
3
|
+
import { BooleanRatchet } from '@bitblit/ratchet-common/lib/lang/boolean-ratchet.js';
|
|
4
|
+
import { NullReturnedObjectHandling } from '../../config/http/null-returned-object-handling.js';
|
|
5
|
+
import { BuiltInFilters } from '../../built-in/http/built-in-filters.js';
|
|
6
|
+
import { BuiltInHandlers } from '../../built-in/http/built-in-handlers.js';
|
|
7
|
+
import { BuiltInAuthFilters } from '../../built-in/http/built-in-auth-filters.js';
|
|
8
|
+
import { LogLevelManipulationFilter } from '../../built-in/http/log-level-manipulation-filter.js';
|
|
9
9
|
export class RouterUtil {
|
|
10
10
|
constructor() { }
|
|
11
11
|
static defaultAuthenticationHeaderParsingEpsilonPreFilters(webTokenManipulator) {
|
|
@@ -49,7 +49,7 @@ export class RouterUtil {
|
|
|
49
49
|
static defaultHttpMetaProcessingConfigWithAuthenticationHeaderParsing(webTokenManipulator) {
|
|
50
50
|
const defaults = {
|
|
51
51
|
configName: 'EpsilonDefaultHttpMetaProcessingConfig',
|
|
52
|
-
timeoutMS:
|
|
52
|
+
timeoutMS: 30_000,
|
|
53
53
|
overrideAuthorizerName: null,
|
|
54
54
|
preFilters: RouterUtil.defaultAuthenticationHeaderParsingEpsilonPreFilters(webTokenManipulator),
|
|
55
55
|
postFilters: RouterUtil.defaultEpsilonPostFilters(),
|
|
@@ -61,7 +61,7 @@ export class RouterUtil {
|
|
|
61
61
|
static defaultHttpMetaProcessingConfig() {
|
|
62
62
|
const defaults = {
|
|
63
63
|
configName: 'EpsilonDefaultHttpMetaProcessingConfig',
|
|
64
|
-
timeoutMS:
|
|
64
|
+
timeoutMS: 30_000,
|
|
65
65
|
overrideAuthorizerName: null,
|
|
66
66
|
preFilters: RouterUtil.defaultEpsilonPreFilters(),
|
|
67
67
|
postFilters: RouterUtil.defaultEpsilonPostFilters(),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RouterUtil } from './router-util.js';
|
|
2
|
+
import { SampleServerComponents } from '../../sample/sample-server-components.js';
|
|
3
|
+
describe('#routerUtilApplyOpenApiDoc', function () {
|
|
4
|
+
it('should create a router config from a yaml file', async () => {
|
|
5
|
+
const inst = await SampleServerComponents.createSampleEpsilonGlobalHandler('routerUtilApplyOpenApiDoc-jest');
|
|
6
|
+
expect(inst.epsilon.modelValidator).toBeTruthy();
|
|
7
|
+
expect(inst.epsilon.modelValidator.fetchModel('AccessTokenRequest')).toBeTruthy();
|
|
8
|
+
const evt = {
|
|
9
|
+
httpMethod: 'get',
|
|
10
|
+
path: '/v0/meta/server',
|
|
11
|
+
requestContext: {
|
|
12
|
+
stage: 'v0',
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
const find = await inst.epsilon.webHandler.findBestMatchingRoute(evt);
|
|
16
|
+
expect(find).toBeTruthy();
|
|
17
|
+
});
|
|
18
|
+
it('should reformat a path to match the other library', function () {
|
|
19
|
+
const inString = '/meta/item/{itemId}';
|
|
20
|
+
const outString = RouterUtil.openApiPathToRouteParserPath(inString);
|
|
21
|
+
expect(outString).toEqual('/meta/item/:itemId');
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { EpsilonRouter } from './route/epsilon-router';
|
|
1
|
+
import { EpsilonRouter } from './route/epsilon-router.js';
|
|
2
2
|
import { APIGatewayEvent, Context, ProxyResult } from 'aws-lambda';
|
|
3
3
|
import Route from 'route-parser';
|
|
4
|
-
import { RouteMapping } from './route/route-mapping';
|
|
5
|
-
import { ExtendedAPIGatewayEvent } from '../config/http/extended-api-gateway-event';
|
|
6
|
-
import { EpsilonLambdaEventHandler } from '../config/epsilon-lambda-event-handler';
|
|
7
|
-
/**
|
|
8
|
-
* This class functions as the adapter from a default lambda function to the handlers exposed via Epsilon
|
|
9
|
-
*/
|
|
4
|
+
import { RouteMapping } from './route/route-mapping.js';
|
|
5
|
+
import { ExtendedAPIGatewayEvent } from '../config/http/extended-api-gateway-event.js';
|
|
6
|
+
import { EpsilonLambdaEventHandler } from '../config/epsilon-lambda-event-handler.js';
|
|
10
7
|
export declare class WebHandler implements EpsilonLambdaEventHandler<APIGatewayEvent> {
|
|
11
8
|
private routerConfig;
|
|
12
9
|
static readonly MAXIMUM_LAMBDA_BODY_SIZE_BYTES: number;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { Logger } from '@bitblit/ratchet-common';
|
|
1
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
2
2
|
import Route from 'route-parser';
|
|
3
|
-
import { ResponseUtil } from './response-util';
|
|
4
|
-
import { RequireRatchet } from '@bitblit/ratchet-common';
|
|
5
|
-
import { EpsilonHttpError } from './error/epsilon-http-error';
|
|
6
|
-
import { BuiltInFilters } from '../built-in/http/built-in-filters';
|
|
7
|
-
import { RunHandlerAsFilter } from '../built-in/http/run-handler-as-filter';
|
|
8
|
-
import { ContextUtil } from '../util/context-util';
|
|
9
|
-
import { StringRatchet } from '@bitblit/ratchet-common';
|
|
10
|
-
import { LambdaEventDetector } from '@bitblit/ratchet-aws';
|
|
3
|
+
import { ResponseUtil } from './response-util.js';
|
|
4
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
|
|
5
|
+
import { EpsilonHttpError } from './error/epsilon-http-error.js';
|
|
6
|
+
import { BuiltInFilters } from '../built-in/http/built-in-filters.js';
|
|
7
|
+
import { RunHandlerAsFilter } from '../built-in/http/run-handler-as-filter.js';
|
|
8
|
+
import { ContextUtil } from '../util/context-util.js';
|
|
9
|
+
import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
|
|
10
|
+
import { LambdaEventDetector } from '@bitblit/ratchet-aws/lib/lambda/lambda-event-detector.js';
|
|
11
11
|
export class WebHandler {
|
|
12
|
+
routerConfig;
|
|
13
|
+
static MAXIMUM_LAMBDA_BODY_SIZE_BYTES = 1024 * 1024 * 5 - 1024 * 100;
|
|
12
14
|
constructor(routerConfig) {
|
|
13
15
|
this.routerConfig = routerConfig;
|
|
14
16
|
RequireRatchet.notNullOrUndefined(routerConfig);
|
|
@@ -113,4 +115,3 @@ export class WebHandler {
|
|
|
113
115
|
return rval;
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
|
-
WebHandler.MAXIMUM_LAMBDA_BODY_SIZE_BYTES = 1024 * 1024 * 5 - 1024 * 100;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
2
|
+
import { SampleServerComponents } from '../sample/sample-server-components.js';
|
|
3
|
+
import { LoggerLevelName } from '@bitblit/ratchet-common/lib/logger/logger-level-name.js';
|
|
4
|
+
describe('#errorToProxyResult', function () {
|
|
5
|
+
it('should gzip responses correctly', async () => {
|
|
6
|
+
const inst = await SampleServerComponents.createSampleEpsilonGlobalHandler('jest-gzip');
|
|
7
|
+
expect(inst.epsilon.modelValidator).toBeTruthy();
|
|
8
|
+
const evt = {
|
|
9
|
+
httpMethod: 'get',
|
|
10
|
+
multiValueHeaders: {},
|
|
11
|
+
multiValueQueryStringParameters: {},
|
|
12
|
+
path: '/meta/server',
|
|
13
|
+
pathParameters: null,
|
|
14
|
+
queryStringParameters: null,
|
|
15
|
+
stageVariables: null,
|
|
16
|
+
requestContext: {},
|
|
17
|
+
resource: '/meta/server',
|
|
18
|
+
headers: {
|
|
19
|
+
'content-type': 'application/json; charset=UTF-8',
|
|
20
|
+
'accept-encoding': 'gzip, deflate, br',
|
|
21
|
+
},
|
|
22
|
+
isBase64Encoded: true,
|
|
23
|
+
body: null,
|
|
24
|
+
};
|
|
25
|
+
Logger.setLevel(LoggerLevelName.silly);
|
|
26
|
+
const result = await inst.epsilon.webHandler.processEvent(evt, {});
|
|
27
|
+
expect(result).toBeTruthy();
|
|
28
|
+
expect(result.isBase64Encoded).toEqual(true);
|
|
29
|
+
expect(result.headers).toBeTruthy();
|
|
30
|
+
expect(result.headers['Content-Encoding']).toEqual('gzip');
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { APIGatewayProxyEventV2, Context, ProxyResult } from 'aws-lambda';
|
|
2
|
-
import { EpsilonLambdaEventHandler } from '../config/epsilon-lambda-event-handler';
|
|
3
|
-
import { WebHandler } from './web-handler';
|
|
4
|
-
/**
|
|
5
|
-
* This class functions as the adapter from a default lambda function to the handlers exposed via Epsilon
|
|
6
|
-
*/
|
|
2
|
+
import { EpsilonLambdaEventHandler } from '../config/epsilon-lambda-event-handler.js';
|
|
3
|
+
import { WebHandler } from './web-handler.js';
|
|
7
4
|
export declare class WebV2Handler implements EpsilonLambdaEventHandler<APIGatewayProxyEventV2> {
|
|
8
5
|
private webHandler;
|
|
9
6
|
constructor(webHandler: WebHandler);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { AwsUtil } from '../util/aws-util';
|
|
2
|
-
import { LambdaEventDetector } from '@bitblit/ratchet-aws';
|
|
1
|
+
import { AwsUtil } from '../util/aws-util.js';
|
|
2
|
+
import { LambdaEventDetector } from '@bitblit/ratchet-aws/lib/lambda/lambda-event-detector.js';
|
|
3
3
|
export class WebV2Handler {
|
|
4
|
+
webHandler;
|
|
4
5
|
constructor(webHandler) {
|
|
5
6
|
this.webHandler = webHandler;
|
|
6
7
|
}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|