@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,7 +1,7 @@
|
|
|
1
|
-
import { RequireRatchet } from '@bitblit/ratchet-common';
|
|
2
|
-
import {
|
|
1
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
|
|
2
|
+
import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
|
|
3
|
+
import { ErrorRatchet } from '@bitblit/ratchet-common/lib/lang/error-ratchet.js';
|
|
3
4
|
import { DateTime } from 'luxon';
|
|
4
|
-
import { StringRatchet } from '@bitblit/ratchet-common';
|
|
5
5
|
export class CronUtil {
|
|
6
6
|
static everyNMinuteFilter(n) {
|
|
7
7
|
return CronUtil.everyNElementFilter(n, 60);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { CronUtil } from './cron-util.js';
|
|
4
|
+
import { EsmRatchet } from '@bitblit/ratchet-common/lib/lang/esm-ratchet.js';
|
|
5
|
+
describe('#cronUtil', function () {
|
|
6
|
+
it('should test matching event to entry', async () => {
|
|
7
|
+
const sEvent = JSON.parse(fs
|
|
8
|
+
.readFileSync(path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/sample-json/sample-schedule-event-1.json'))
|
|
9
|
+
.toString());
|
|
10
|
+
const cfg = {
|
|
11
|
+
context: 'prod',
|
|
12
|
+
timezone: 'America/Los_Angeles',
|
|
13
|
+
entries: [],
|
|
14
|
+
};
|
|
15
|
+
const cron1 = {
|
|
16
|
+
contextMatchFilter: new RegExp('prod'),
|
|
17
|
+
};
|
|
18
|
+
const match1 = CronUtil.eventMatchesEntry(sEvent, cron1, cfg);
|
|
19
|
+
expect(match1).toBeTruthy();
|
|
20
|
+
const cron2 = {
|
|
21
|
+
contextMatchFilter: new RegExp('dev'),
|
|
22
|
+
};
|
|
23
|
+
const match2 = CronUtil.eventMatchesEntry(sEvent, cron2, cfg);
|
|
24
|
+
expect(match2).toBeFalsy();
|
|
25
|
+
const cron3 = {
|
|
26
|
+
eventFilter: new RegExp('.*MyScheduledRule.*'),
|
|
27
|
+
};
|
|
28
|
+
const match3 = CronUtil.eventMatchesEntry(sEvent, cron3, cfg);
|
|
29
|
+
expect(match3).toBeTruthy();
|
|
30
|
+
const cron4 = {
|
|
31
|
+
eventFilter: new RegExp('.*NotMyRule.*'),
|
|
32
|
+
};
|
|
33
|
+
const match4 = CronUtil.eventMatchesEntry(sEvent, cron4, cfg);
|
|
34
|
+
expect(match4).toBeFalsy();
|
|
35
|
+
});
|
|
36
|
+
it('should match times', async () => {
|
|
37
|
+
const sEvent = JSON.parse(fs
|
|
38
|
+
.readFileSync(path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/sample-json/sample-schedule-event-1.json'))
|
|
39
|
+
.toString());
|
|
40
|
+
const cfg = {
|
|
41
|
+
context: 'prod',
|
|
42
|
+
timezone: 'America/Los_Angeles',
|
|
43
|
+
entries: [],
|
|
44
|
+
};
|
|
45
|
+
const entry1 = {};
|
|
46
|
+
const cron1 = {
|
|
47
|
+
contextMatchFilter: new RegExp('prod'),
|
|
48
|
+
};
|
|
49
|
+
const match1 = CronUtil.eventMatchesEntry(sEvent, cron1, cfg);
|
|
50
|
+
expect(match1).toBeTruthy();
|
|
51
|
+
const cron2 = {
|
|
52
|
+
contextMatchFilter: new RegExp('dev'),
|
|
53
|
+
};
|
|
54
|
+
const match2 = CronUtil.eventMatchesEntry(sEvent, cron2, cfg);
|
|
55
|
+
expect(match2).toBeFalsy();
|
|
56
|
+
const cron3 = {
|
|
57
|
+
eventFilter: new RegExp('.*MyScheduledRule.*'),
|
|
58
|
+
};
|
|
59
|
+
const match3 = CronUtil.eventMatchesEntry(sEvent, cron3, cfg);
|
|
60
|
+
expect(match3).toBeTruthy();
|
|
61
|
+
const cron4 = {
|
|
62
|
+
eventFilter: new RegExp('.*NotMyRule.*'),
|
|
63
|
+
};
|
|
64
|
+
const match4 = CronUtil.eventMatchesEntry(sEvent, cron4, cfg);
|
|
65
|
+
expect(match4).toBeFalsy();
|
|
66
|
+
});
|
|
67
|
+
it('should match time with override', async () => {
|
|
68
|
+
const sEvent = JSON.parse(fs
|
|
69
|
+
.readFileSync(path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/sample-json/sample-schedule-event-1.json'))
|
|
70
|
+
.toString());
|
|
71
|
+
const cfg = {
|
|
72
|
+
context: 'prod',
|
|
73
|
+
timezone: 'America/Los_Angeles',
|
|
74
|
+
entries: [],
|
|
75
|
+
};
|
|
76
|
+
const entry1 = {};
|
|
77
|
+
const cron1 = {
|
|
78
|
+
hourFilter: [3],
|
|
79
|
+
};
|
|
80
|
+
const cron2 = {
|
|
81
|
+
overrideTimezone: 'etc/utc',
|
|
82
|
+
hourFilter: [3],
|
|
83
|
+
};
|
|
84
|
+
const testTimestampEpochMS = 1652931000000;
|
|
85
|
+
const match1 = CronUtil.eventMatchesEntry(sEvent, cron1, cfg, testTimestampEpochMS);
|
|
86
|
+
const match2 = CronUtil.eventMatchesEntry(sEvent, cron2, cfg, testTimestampEpochMS);
|
|
87
|
+
expect(match1).toBeFalsy();
|
|
88
|
+
expect(match2).toBeTruthy();
|
|
89
|
+
});
|
|
90
|
+
it('should match day of month filters', async () => {
|
|
91
|
+
const sEvent = JSON.parse(fs
|
|
92
|
+
.readFileSync(path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/sample-json/sample-schedule-event-1.json'))
|
|
93
|
+
.toString());
|
|
94
|
+
const cfg = {
|
|
95
|
+
context: 'prod',
|
|
96
|
+
timezone: 'etc/utc',
|
|
97
|
+
entries: [],
|
|
98
|
+
};
|
|
99
|
+
const entry1 = {};
|
|
100
|
+
const testTimestampEpochMS = 1652931000000;
|
|
101
|
+
const dayOfMonth = {
|
|
102
|
+
dayOfMonthFilter: [19],
|
|
103
|
+
};
|
|
104
|
+
const matchDay = CronUtil.eventMatchesEntry(sEvent, dayOfMonth, cfg, testTimestampEpochMS);
|
|
105
|
+
expect(matchDay).toBeTruthy();
|
|
106
|
+
});
|
|
107
|
+
it('should match month of year filter', async () => {
|
|
108
|
+
const sEvent = JSON.parse(fs
|
|
109
|
+
.readFileSync(path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/sample-json/sample-schedule-event-1.json'))
|
|
110
|
+
.toString());
|
|
111
|
+
const cfg = {
|
|
112
|
+
context: 'prod',
|
|
113
|
+
timezone: 'etc/utc',
|
|
114
|
+
entries: [],
|
|
115
|
+
};
|
|
116
|
+
const entry1 = {};
|
|
117
|
+
const testTimestampEpochMS = 1652931000000;
|
|
118
|
+
const monthOfYear = {
|
|
119
|
+
monthOfYearFilter: [5],
|
|
120
|
+
};
|
|
121
|
+
const matchMonth = CronUtil.eventMatchesEntry(sEvent, monthOfYear, cfg, testTimestampEpochMS);
|
|
122
|
+
expect(matchMonth).toBeTruthy();
|
|
123
|
+
});
|
|
124
|
+
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ModelValidator } from '@bitblit/ratchet-misc';
|
|
2
|
-
import { OpenApiDocument } from '../config/open-api/open-api-document';
|
|
3
|
-
import { EpsilonConfig } from '../config/epsilon-config';
|
|
4
|
-
import { EpsilonInstance } from '../epsilon-instance';
|
|
5
|
-
import { EpsilonGlobalHandler } from '../epsilon-global-handler';
|
|
6
|
-
import { BackgroundManagerLike } from '../background/manager/background-manager-like';
|
|
1
|
+
import { ModelValidator } from '@bitblit/ratchet-misc/lib/model-validator/model-validator.js';
|
|
2
|
+
import { OpenApiDocument } from '../config/open-api/open-api-document.js';
|
|
3
|
+
import { EpsilonConfig } from '../config/epsilon-config.js';
|
|
4
|
+
import { EpsilonInstance } from '../epsilon-instance.js';
|
|
5
|
+
import { EpsilonGlobalHandler } from '../epsilon-global-handler.js';
|
|
6
|
+
import { BackgroundManagerLike } from '../background/manager/background-manager-like.js';
|
|
7
7
|
export declare class EpsilonConfigParser {
|
|
8
8
|
constructor();
|
|
9
9
|
static epsilonConfigToEpsilonGlobalHandler(config: EpsilonConfig, backgroundManager?: BackgroundManagerLike): EpsilonGlobalHandler;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Logger } from '@bitblit/ratchet-common';
|
|
2
|
-
import { ErrorRatchet } from '@bitblit/ratchet-common';
|
|
1
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
2
|
+
import { ErrorRatchet } from '@bitblit/ratchet-common/lib/lang/error-ratchet.js';
|
|
3
3
|
import yaml from 'js-yaml';
|
|
4
|
-
import { ModelValidator } from '@bitblit/ratchet-misc';
|
|
5
|
-
import { BackgroundHttpAdapterHandler } from '../background/background-http-adapter-handler';
|
|
6
|
-
import { BackgroundHandler } from '../background/background-handler';
|
|
7
|
-
import { RouterUtil } from '../http/route/router-util';
|
|
8
|
-
import { WebHandler } from '../http/web-handler';
|
|
9
|
-
import { MisconfiguredError } from '../http/error/misconfigured-error';
|
|
10
|
-
import { EpsilonGlobalHandler } from '../epsilon-global-handler';
|
|
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 { BackgroundHandler } from '../background/background-handler.js';
|
|
7
|
+
import { RouterUtil } from '../http/route/router-util.js';
|
|
8
|
+
import { WebHandler } from '../http/web-handler.js';
|
|
9
|
+
import { MisconfiguredError } from '../http/error/misconfigured-error.js';
|
|
10
|
+
import { EpsilonGlobalHandler } from '../epsilon-global-handler.js';
|
|
11
11
|
export class EpsilonConfigParser {
|
|
12
12
|
constructor() { }
|
|
13
13
|
static epsilonConfigToEpsilonGlobalHandler(config, backgroundManager) {
|
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitblit/ratchet-epsilon-common",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.103-alpha",
|
|
4
4
|
"description": "Tiny adapter to simplify building API gateway Lambda APIS",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"bin": {
|
|
7
|
-
"epsilon-cli": "./
|
|
7
|
+
"epsilon-cli": "./bin/cli.js"
|
|
8
8
|
},
|
|
9
|
-
"
|
|
10
|
-
"module": "
|
|
11
|
-
"types": "./dist/types/index.d.ts",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"module": "index.js",
|
|
12
11
|
"files": [
|
|
13
|
-
"
|
|
14
|
-
"
|
|
12
|
+
"lib/*",
|
|
13
|
+
"bin/*"
|
|
15
14
|
],
|
|
16
15
|
"contributors": [
|
|
17
16
|
"Christopher Weiss <bitblit@gmail.com>",
|
|
@@ -32,20 +31,18 @@
|
|
|
32
31
|
"config": {},
|
|
33
32
|
"scripts": {
|
|
34
33
|
"watch": "tsc-watch",
|
|
35
|
-
"clean": "shx rm -Rf
|
|
36
|
-
"test": "jest",
|
|
34
|
+
"clean": "shx rm -Rf lib",
|
|
35
|
+
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
|
|
37
36
|
"lint": "eslint src/**/*.ts",
|
|
38
37
|
"lint-fix": "eslint --fix src/**/*.ts",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"build
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"run-
|
|
45
|
-
"run-sample-server": "yarn build
|
|
46
|
-
"run-
|
|
47
|
-
"run-batch-sample-server": "yarn build:cjs && node includes/cli.js run-sample-local-batch-server",
|
|
48
|
-
"run-background-process-from-command-line-dry-run": "yarn build:cjs && node includes/cli.js run-background-process"
|
|
38
|
+
"__generate-barrels": "barrelsby -q --delete -d src -e .*\\.spec\\.ts",
|
|
39
|
+
"__build": "yarn run generate-barrels && tsc",
|
|
40
|
+
"build": "tsc",
|
|
41
|
+
"run-local-container-server": "yarn build && node bin/cli.js run-local-container-server",
|
|
42
|
+
"run-sample-server": "yarn build && node bin/cli.js run-sample-local-server",
|
|
43
|
+
"run-test-error-server": "yarn build && node bin/cli.js run-test-error-server",
|
|
44
|
+
"run-batch-sample-server": "yarn build && node bin/cli.js run-sample-local-batch-server",
|
|
45
|
+
"run-background-process-from-command-line-dry-run": "yarn build && node bin/cli.js run-background-process"
|
|
49
46
|
},
|
|
50
47
|
"repository": {
|
|
51
48
|
"type": "git",
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BackgroundDynamoLogTableHandler = void 0;
|
|
4
|
-
const background_execution_event_type_1 = require("./background-execution-event-type");
|
|
5
|
-
const context_util_1 = require("../util/context-util");
|
|
6
|
-
class BackgroundDynamoLogTableHandler {
|
|
7
|
-
constructor(dynamo, tableName, env, backgroundQueueName) {
|
|
8
|
-
this.dynamo = dynamo;
|
|
9
|
-
this.tableName = tableName;
|
|
10
|
-
this.env = env;
|
|
11
|
-
this.backgroundQueueName = backgroundQueueName;
|
|
12
|
-
}
|
|
13
|
-
async onEvent(event) {
|
|
14
|
-
var _a, _b;
|
|
15
|
-
const entry = {
|
|
16
|
-
env: this.env,
|
|
17
|
-
backgroundQueueName: this.backgroundQueueName,
|
|
18
|
-
requestId: context_util_1.ContextUtil.currentRequestId(),
|
|
19
|
-
guid: event.guid,
|
|
20
|
-
processTypeName: event.processorType,
|
|
21
|
-
state: event.type.toString(),
|
|
22
|
-
timestampEpochMs: new Date().getTime(),
|
|
23
|
-
};
|
|
24
|
-
if (event.type == background_execution_event_type_1.BackgroundExecutionEventType.DataValidationError) {
|
|
25
|
-
const errors = ((_a = event === null || event === void 0 ? void 0 : event.errors) === null || _a === void 0 ? void 0 : _a.length) ? event.errors : ['No-Error'];
|
|
26
|
-
entry.errors = errors;
|
|
27
|
-
}
|
|
28
|
-
else if (event.type == background_execution_event_type_1.BackgroundExecutionEventType.ProcessStarting) {
|
|
29
|
-
entry.params = event.data;
|
|
30
|
-
}
|
|
31
|
-
else if (event.type == background_execution_event_type_1.BackgroundExecutionEventType.ExecutionFailedError) {
|
|
32
|
-
const errors = ((_b = event === null || event === void 0 ? void 0 : event.errors) === null || _b === void 0 ? void 0 : _b.length) ? event.errors : ['No-Error'];
|
|
33
|
-
entry.errors = errors;
|
|
34
|
-
}
|
|
35
|
-
await this.dynamo.simplePut(this.tableName, entry);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
exports.BackgroundDynamoLogTableHandler = BackgroundDynamoLogTableHandler;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BackgroundExecutionEventType = void 0;
|
|
4
|
-
var BackgroundExecutionEventType;
|
|
5
|
-
(function (BackgroundExecutionEventType) {
|
|
6
|
-
BackgroundExecutionEventType["ProcessStarting"] = "ProcessStarting";
|
|
7
|
-
BackgroundExecutionEventType["DataValidationError"] = "DataValidationError";
|
|
8
|
-
BackgroundExecutionEventType["ExecutionSuccessfullyComplete"] = "ExecutionSuccessfullyComplete";
|
|
9
|
-
BackgroundExecutionEventType["ExecutionFailedError"] = "ExecutionRuntimeError";
|
|
10
|
-
BackgroundExecutionEventType["NoMatchProcessorName"] = "NoMatchProcessorName";
|
|
11
|
-
})(BackgroundExecutionEventType = exports.BackgroundExecutionEventType || (exports.BackgroundExecutionEventType = {}));
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BackgroundHandler = void 0;
|
|
4
|
-
const ratchet_common_1 = require("@bitblit/ratchet-common");
|
|
5
|
-
const ratchet_aws_1 = require("@bitblit/ratchet-aws");
|
|
6
|
-
const epsilon_constants_1 = require("../epsilon-constants");
|
|
7
|
-
const background_validator_1 = require("./background-validator");
|
|
8
|
-
const background_execution_event_type_1 = require("./background-execution-event-type");
|
|
9
|
-
const context_util_1 = require("../util/context-util");
|
|
10
|
-
const abstract_background_manager_1 = require("./manager/abstract-background-manager");
|
|
11
|
-
class BackgroundHandler {
|
|
12
|
-
constructor(cfg, mgr, modelValidator) {
|
|
13
|
-
this.cfg = cfg;
|
|
14
|
-
this.mgr = mgr;
|
|
15
|
-
this.modelValidator = modelValidator;
|
|
16
|
-
const cfgErrors = background_validator_1.BackgroundValidator.validateConfig(cfg);
|
|
17
|
-
if (cfgErrors.length > 0) {
|
|
18
|
-
ratchet_common_1.ErrorRatchet.throwFormattedErr('Invalid background config : %j', cfgErrors);
|
|
19
|
-
}
|
|
20
|
-
ratchet_common_1.Logger.silly('Starting Background processor, %d processors', cfg.processors.length);
|
|
21
|
-
this.validator = new background_validator_1.BackgroundValidator(cfg, modelValidator);
|
|
22
|
-
this.processors = background_validator_1.BackgroundValidator.validateAndMapProcessors(cfg.processors, modelValidator);
|
|
23
|
-
if ((mgr === null || mgr === void 0 ? void 0 : mgr.immediateProcessQueue) && mgr.immediateProcessQueue()) {
|
|
24
|
-
ratchet_common_1.Logger.info('Attaching to immediate processing queue');
|
|
25
|
-
mgr.immediateProcessQueue().subscribe(async (evt) => {
|
|
26
|
-
ratchet_common_1.Logger.debug('Processing local background entry : %j', evt);
|
|
27
|
-
const rval = await this.processSingleBackgroundEntry(evt);
|
|
28
|
-
ratchet_common_1.Logger.info('Processor returned %s', rval);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
extractLabel(evt, context) {
|
|
33
|
-
let rval = null;
|
|
34
|
-
if (this.isBackgroundStartSnsEvent(evt)) {
|
|
35
|
-
rval = 'BG:START-EVT';
|
|
36
|
-
}
|
|
37
|
-
else if (this.isBackgroundImmediateFireEvent(evt)) {
|
|
38
|
-
const pEvt = this.parseImmediateFireBackgroundEntry(evt);
|
|
39
|
-
rval = 'BG:' + pEvt.type + ':' + pEvt.guid;
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
rval = 'BG:UNKNOWN';
|
|
43
|
-
}
|
|
44
|
-
return rval;
|
|
45
|
-
}
|
|
46
|
-
handlesEvent(evt) {
|
|
47
|
-
return ratchet_aws_1.LambdaEventDetector.isValidSnsEvent(evt) && this.isBackgroundSNSEvent(evt);
|
|
48
|
-
}
|
|
49
|
-
isBackgroundSNSEvent(event) {
|
|
50
|
-
return this.isBackgroundStartSnsEvent(event) || this.isBackgroundImmediateFireEvent(event);
|
|
51
|
-
}
|
|
52
|
-
isBackgroundStartSnsEvent(event) {
|
|
53
|
-
let rval = false;
|
|
54
|
-
if (event) {
|
|
55
|
-
if (ratchet_aws_1.LambdaEventDetector.isSingleSnsEvent(event)) {
|
|
56
|
-
const cast = event;
|
|
57
|
-
rval = cast.Records[0].Sns.Message === epsilon_constants_1.EpsilonConstants.BACKGROUND_SNS_START_MARKER;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return rval;
|
|
61
|
-
}
|
|
62
|
-
isBackgroundImmediateFireEvent(event) {
|
|
63
|
-
let rval = false;
|
|
64
|
-
if (!!event) {
|
|
65
|
-
if (ratchet_aws_1.LambdaEventDetector.isSingleSnsEvent(event)) {
|
|
66
|
-
const cast = event;
|
|
67
|
-
const msg = cast.Records[0].Sns.Message;
|
|
68
|
-
if (!!ratchet_common_1.StringRatchet.trimToNull(msg)) {
|
|
69
|
-
const parsed = JSON.parse(msg);
|
|
70
|
-
rval = !!parsed && parsed['type'] === epsilon_constants_1.EpsilonConstants.BACKGROUND_SNS_IMMEDIATE_RUN_FLAG;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return rval;
|
|
75
|
-
}
|
|
76
|
-
parseImmediateFireBackgroundEntry(event) {
|
|
77
|
-
let rval = null;
|
|
78
|
-
try {
|
|
79
|
-
if (!!event) {
|
|
80
|
-
if (ratchet_aws_1.LambdaEventDetector.isSingleSnsEvent(event)) {
|
|
81
|
-
const cast = event;
|
|
82
|
-
const msg = cast.Records[0].Sns.Message;
|
|
83
|
-
if (!!ratchet_common_1.StringRatchet.trimToNull(msg)) {
|
|
84
|
-
const parsed = JSON.parse(msg);
|
|
85
|
-
if (!!parsed && parsed['type'] === epsilon_constants_1.EpsilonConstants.BACKGROUND_SNS_IMMEDIATE_RUN_FLAG) {
|
|
86
|
-
rval = parsed['backgroundEntry'];
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
catch (err) {
|
|
93
|
-
ratchet_common_1.Logger.error('Could not parse %j as an immediate run event : %s', event, err, err);
|
|
94
|
-
}
|
|
95
|
-
return rval;
|
|
96
|
-
}
|
|
97
|
-
async processEvent(event, context) {
|
|
98
|
-
let procd = null;
|
|
99
|
-
if (!this.isBackgroundStartSnsEvent(event)) {
|
|
100
|
-
const backgroundEntry = this.parseImmediateFireBackgroundEntry(event);
|
|
101
|
-
if (!!backgroundEntry) {
|
|
102
|
-
ratchet_common_1.Logger.silly('Processing immediate fire event : %j', backgroundEntry);
|
|
103
|
-
const result = await this.processSingleBackgroundEntry(backgroundEntry);
|
|
104
|
-
procd = 1;
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
ratchet_common_1.Logger.warn('Tried to process non-background start / immediate event : %j returning false', event);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
ratchet_common_1.Logger.info('Reading task from background queue');
|
|
112
|
-
procd = await this.takeAndProcessSingleBackgroundQueueEntry();
|
|
113
|
-
if (procd > 0) {
|
|
114
|
-
ratchet_common_1.Logger.info('Processed %d elements from background queue, refiring', procd);
|
|
115
|
-
const refire = await this.mgr.fireStartProcessingRequest();
|
|
116
|
-
ratchet_common_1.Logger.info('Refire returned %s', refire);
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
ratchet_common_1.Logger.info('No items processed - stopping');
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
const rval = {
|
|
123
|
-
statusCode: 200,
|
|
124
|
-
body: ratchet_common_1.StringRatchet.safeString(procd),
|
|
125
|
-
isBase64Encoded: false,
|
|
126
|
-
};
|
|
127
|
-
return rval;
|
|
128
|
-
}
|
|
129
|
-
async takeAndProcessSingleBackgroundQueueEntry() {
|
|
130
|
-
let rval = null;
|
|
131
|
-
const entries = await this.mgr.takeEntryFromBackgroundQueue();
|
|
132
|
-
ratchet_common_1.Logger.info('Found %d entries - processing', entries.length);
|
|
133
|
-
for (let i = 0; i < entries.length; i++) {
|
|
134
|
-
const e = entries[i];
|
|
135
|
-
const result = await this.processSingleBackgroundEntry(e);
|
|
136
|
-
rval += result ? 1 : 0;
|
|
137
|
-
}
|
|
138
|
-
ratchet_common_1.Logger.debug('Returning %d', rval);
|
|
139
|
-
return rval;
|
|
140
|
-
}
|
|
141
|
-
async safeWriteToLogger(entry) {
|
|
142
|
-
if (this.cfg.transactionLogger) {
|
|
143
|
-
try {
|
|
144
|
-
await this.cfg.transactionLogger.logTransaction(entry);
|
|
145
|
-
}
|
|
146
|
-
catch (err) {
|
|
147
|
-
ratchet_common_1.Logger.error('Failed to write to transaction logger : %j : %s', entry, err, err);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
ratchet_common_1.Logger.silly('Skipping - no logger defined');
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
async conditionallyStartTransactionLog(e) {
|
|
155
|
-
if (!ratchet_common_1.StringRatchet.trimToNull(e.guid)) {
|
|
156
|
-
ratchet_common_1.Logger.warn('No guid found - creating');
|
|
157
|
-
e.guid = abstract_background_manager_1.AbstractBackgroundManager.generateBackgroundGuid();
|
|
158
|
-
const log = {
|
|
159
|
-
request: e,
|
|
160
|
-
running: true,
|
|
161
|
-
};
|
|
162
|
-
await this.safeWriteToLogger(log);
|
|
163
|
-
}
|
|
164
|
-
ratchet_common_1.Logger.debug('Starting transaction log');
|
|
165
|
-
}
|
|
166
|
-
async conditionallyCompleteTransactionLog(e, result, error, runtimeMS) {
|
|
167
|
-
ratchet_common_1.Logger.debug('Completing transaction log');
|
|
168
|
-
const log = {
|
|
169
|
-
request: e,
|
|
170
|
-
result: result,
|
|
171
|
-
error: error ? ratchet_common_1.ErrorRatchet.safeStringifyErr(error) : null,
|
|
172
|
-
running: false,
|
|
173
|
-
runtimeMS: runtimeMS,
|
|
174
|
-
};
|
|
175
|
-
await this.safeWriteToLogger(log);
|
|
176
|
-
}
|
|
177
|
-
async conditionallyRunErrorProcessor(e, error) {
|
|
178
|
-
try {
|
|
179
|
-
if (this.cfg.errorProcessor) {
|
|
180
|
-
ratchet_common_1.Logger.info('Running error processor');
|
|
181
|
-
await this.cfg.errorProcessor.handleError(e, error);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
catch (err) {
|
|
185
|
-
ratchet_common_1.Logger.error('Background : BAD - Failed to run error processor : %s', err, err);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
async fireListenerEvent(event) {
|
|
189
|
-
const listeners = this.cfg.executionListeners || [];
|
|
190
|
-
for (const listener of listeners) {
|
|
191
|
-
try {
|
|
192
|
-
await listener.onEvent(event);
|
|
193
|
-
}
|
|
194
|
-
catch (err) {
|
|
195
|
-
ratchet_common_1.Logger.error('Failure triggering handler %s : %s', ratchet_common_1.StringRatchet.trimToNull(listener === null || listener === void 0 ? void 0 : listener.label) || 'No-name', err);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
async processSingleBackgroundEntry(e) {
|
|
200
|
-
context_util_1.ContextUtil.setOverrideTraceFromInternalBackgroundEntry(e);
|
|
201
|
-
ratchet_common_1.Logger.info('Background Process Start: %j', e);
|
|
202
|
-
const sw = new ratchet_common_1.StopWatch();
|
|
203
|
-
await this.conditionallyStartTransactionLog(e);
|
|
204
|
-
let rval = false;
|
|
205
|
-
try {
|
|
206
|
-
await this.fireListenerEvent({
|
|
207
|
-
type: background_execution_event_type_1.BackgroundExecutionEventType.ProcessStarting,
|
|
208
|
-
processorType: e.type,
|
|
209
|
-
data: e.data,
|
|
210
|
-
guid: e.guid,
|
|
211
|
-
});
|
|
212
|
-
const processorInput = this.processors.get(e.type);
|
|
213
|
-
if (!processorInput) {
|
|
214
|
-
ratchet_common_1.ErrorRatchet.throwFormattedErr('Found no processor for background entry : %j (returning false)', e);
|
|
215
|
-
await this.fireListenerEvent({
|
|
216
|
-
type: background_execution_event_type_1.BackgroundExecutionEventType.NoMatchProcessorName,
|
|
217
|
-
processorType: e.type,
|
|
218
|
-
data: e.data,
|
|
219
|
-
guid: e.guid,
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
let dataValidationErrors = [];
|
|
223
|
-
if (ratchet_common_1.StringRatchet.trimToNull(processorInput.dataSchemaName)) {
|
|
224
|
-
dataValidationErrors = this.modelValidator.validate(processorInput.dataSchemaName, e.data, false, false);
|
|
225
|
-
}
|
|
226
|
-
if (dataValidationErrors.length > 0) {
|
|
227
|
-
await this.fireListenerEvent({
|
|
228
|
-
type: background_execution_event_type_1.BackgroundExecutionEventType.DataValidationError,
|
|
229
|
-
processorType: e.type,
|
|
230
|
-
data: e.data,
|
|
231
|
-
errors: dataValidationErrors,
|
|
232
|
-
guid: e.guid,
|
|
233
|
-
});
|
|
234
|
-
ratchet_common_1.ErrorRatchet.throwFormattedErr('Not processing, data failed validation; entry was %j : errors : %j', e, dataValidationErrors);
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
let result = await processorInput.handleEvent(e.data, this.mgr);
|
|
238
|
-
result = result || 'SUCCESSFUL COMPLETION : NO RESULT RETURNED';
|
|
239
|
-
await this.conditionallyCompleteTransactionLog(e, result, null, sw.elapsedMS());
|
|
240
|
-
await this.fireListenerEvent({
|
|
241
|
-
type: background_execution_event_type_1.BackgroundExecutionEventType.ExecutionSuccessfullyComplete,
|
|
242
|
-
processorType: e.type,
|
|
243
|
-
data: result,
|
|
244
|
-
guid: e.guid,
|
|
245
|
-
});
|
|
246
|
-
rval = true;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
catch (err) {
|
|
250
|
-
ratchet_common_1.Logger.error('Background Process Error: %j : %s', e, err, err);
|
|
251
|
-
await this.conditionallyRunErrorProcessor(e, err);
|
|
252
|
-
await this.conditionallyCompleteTransactionLog(e, null, err, sw.elapsedMS());
|
|
253
|
-
await this.fireListenerEvent({
|
|
254
|
-
type: background_execution_event_type_1.BackgroundExecutionEventType.ExecutionFailedError,
|
|
255
|
-
processorType: e.type,
|
|
256
|
-
data: e.data,
|
|
257
|
-
errors: [ratchet_common_1.ErrorRatchet.safeStringifyErr(err)],
|
|
258
|
-
guid: e.guid,
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
ratchet_common_1.Logger.info('Background Process Stop: %j : %s', e, sw.dump());
|
|
262
|
-
return rval;
|
|
263
|
-
}
|
|
264
|
-
getConfig() {
|
|
265
|
-
const rval = Object.assign({}, this.cfg);
|
|
266
|
-
return rval;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
exports.BackgroundHandler = BackgroundHandler;
|