@bitblit/ratchet-epsilon-common 4.0.99-alpha → 4.0.102-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/dist/{types/background → background}/background-dynamo-log-table-handler.d.ts +3 -3
- package/dist/{es/background → background}/background-dynamo-log-table-handler.js +6 -2
- package/dist/{types/background → background}/background-execution-event.d.ts +1 -1
- package/dist/{types/background → background}/background-execution-listener.d.ts +1 -1
- package/dist/{types/background → background}/background-handler.d.ts +5 -9
- package/dist/{es/background → background}/background-handler.js +15 -7
- package/dist/{types/background → background}/background-http-adapter-handler.d.ts +7 -11
- package/dist/{es/background → background}/background-http-adapter-handler.js +13 -8
- package/dist/{types/background → background}/background-queue-response-internal.d.ts +1 -1
- package/dist/{types/background → background}/background-validator.d.ts +5 -8
- package/dist/{es/background → background}/background-validator.js +5 -3
- package/dist/{es/background → background}/epsilon-background-process-error.js +6 -1
- package/dist/{types/background → background}/internal-background-entry.d.ts +1 -1
- package/dist/{types/background → background}/manager/abstract-background-manager.d.ts +3 -10
- package/dist/{es/background → background}/manager/abstract-background-manager.js +5 -4
- package/dist/{types/background → background}/manager/aws-sqs-sns-background-manager.d.ts +4 -11
- package/dist/{es/background → background}/manager/aws-sqs-sns-background-manager.js +9 -5
- package/dist/{types/background → background}/manager/background-manager-like.d.ts +2 -9
- package/dist/background/manager/background-manager.spec.js +73 -0
- package/dist/{types/background → background}/manager/single-thread-local-background-manager.d.ts +3 -10
- package/dist/{es/background → background}/manager/single-thread-local-background-manager.js +6 -6
- package/dist/{types/background → background}/s3-background-transaction-logger.d.ts +2 -2
- package/dist/{es/background → background}/s3-background-transaction-logger.js +6 -3
- package/dist/{types/build → build}/ratchet-epsilon-common-info.d.ts +1 -1
- package/dist/{types/built-in → built-in}/background/echo-processor.d.ts +2 -2
- package/dist/{es/built-in → built-in}/background/echo-processor.js +4 -3
- package/dist/{types/built-in → built-in}/background/log-and-enqueue-echo-processor.d.ts +2 -2
- package/dist/{es/built-in → built-in}/background/log-and-enqueue-echo-processor.js +2 -2
- package/dist/{types/built-in → built-in}/background/log-message-background-error-processor.d.ts +2 -2
- package/dist/{es/built-in → built-in}/background/log-message-background-error-processor.js +1 -1
- package/dist/{types/built-in → built-in}/background/no-op-processor.d.ts +2 -2
- package/dist/{es/built-in → built-in}/background/no-op-processor.js +1 -1
- package/dist/{types/built-in → built-in}/background/retry-processor.d.ts +2 -2
- package/dist/{es/built-in → built-in}/background/retry-processor.js +8 -4
- package/dist/{types/built-in → built-in}/background/sample-delay-processor.d.ts +2 -2
- package/dist/{es/built-in → built-in}/background/sample-delay-processor.js +2 -1
- package/dist/{types/built-in → built-in}/background/sample-input-validated-processor.d.ts +3 -3
- package/dist/{es/built-in → built-in}/background/sample-input-validated-processor.js +1 -1
- package/dist/{es/built-in → built-in}/built-in-trace-id-generators.js +2 -2
- package/dist/{types/built-in → built-in}/daemon/daemon-authorizer-function.d.ts +2 -2
- package/dist/{types/built-in → built-in}/daemon/daemon-config.d.ts +2 -2
- package/dist/{types/built-in → built-in}/daemon/daemon-group-selection-function.d.ts +1 -1
- package/dist/{types/built-in → built-in}/daemon/daemon-handler.d.ts +6 -12
- package/dist/{es/built-in → built-in}/daemon/daemon-handler.js +9 -8
- package/dist/built-in/daemon/daemon-process-state-list.d.ts +5 -0
- package/dist/{types/built-in → built-in}/http/apollo-filter.d.ts +2 -2
- package/dist/{es/built-in → built-in}/http/apollo-filter.js +6 -5
- package/dist/{types/built-in → built-in}/http/built-in-auth-filters.d.ts +3 -3
- package/dist/{es/built-in → built-in}/http/built-in-auth-filters.js +5 -5
- package/dist/{types/built-in → built-in}/http/built-in-authorizers.d.ts +2 -2
- package/dist/{es/built-in → built-in}/http/built-in-authorizers.js +1 -1
- package/dist/{types/built-in → built-in}/http/built-in-filters.d.ts +2 -2
- package/dist/{es/built-in → built-in}/http/built-in-filters.js +9 -9
- package/dist/{types/built-in → built-in}/http/built-in-handlers.d.ts +2 -2
- package/dist/{es/built-in → built-in}/http/built-in-handlers.js +10 -10
- package/dist/{types/built-in → built-in}/http/log-level-manipulation-filter.d.ts +1 -4
- package/dist/{es/built-in → built-in}/http/log-level-manipulation-filter.js +2 -2
- package/dist/{types/built-in → built-in}/http/run-handler-as-filter.d.ts +5 -5
- package/dist/{es/built-in → built-in}/http/run-handler-as-filter.js +8 -8
- package/dist/built-in/http/run-handler-as-filter.spec.js +40 -0
- package/dist/{types/cli-bootstrap → cli-bootstrap}/ratchet-cli-handler.d.ts +2 -2
- package/dist/{es/cli-bootstrap → cli-bootstrap}/ratchet-cli-handler.js +6 -6
- package/dist/cli-bootstrap/run-background-process-from-command-line.d.ts +3 -0
- package/dist/{es/cli-bootstrap → cli-bootstrap}/run-background-process-from-command-line.js +2 -2
- package/dist/{types/config → config}/background/background-config.d.ts +4 -4
- package/dist/{types/config → config}/background/background-error-processor.d.ts +1 -1
- package/dist/{types/config → config}/background/background-processor.d.ts +1 -1
- package/dist/{types/config → config}/background/background-transaction-log.d.ts +1 -1
- package/dist/{types/config → config}/background/background-transaction-logger.d.ts +1 -1
- package/dist/config/cron/cron-background-entry.d.ts +6 -0
- package/dist/{types/config → config}/cron/cron-config.d.ts +1 -1
- package/dist/{types/config → config}/dynamo-db-config.d.ts +1 -1
- package/dist/{types/config → config}/epsilon-config.d.ts +8 -8
- package/dist/{types/config → config}/epsilon-logger-config.d.ts +3 -2
- package/dist/{types/config → config}/http/authorizer-function.d.ts +3 -3
- package/dist/{types/config → config}/http/extended-api-gateway-event.d.ts +1 -1
- package/dist/{types/config → config}/http/filter-chain-context.d.ts +4 -4
- package/dist/{types/config → config}/http/filter-function.d.ts +1 -1
- package/dist/{types/config → config}/http/handler-function.d.ts +1 -1
- package/dist/{types/config → config}/http/http-config.d.ts +5 -5
- package/dist/{types/config → config}/http/http-processing-config.d.ts +2 -2
- package/dist/{types/config → config}/http/mapped-http-processing-config.d.ts +1 -1
- package/dist/{types/config → config}/inter-api/inter-api-config.d.ts +2 -2
- package/dist/config/inter-api/inter-api-process-mapping.d.ts +6 -0
- package/dist/{types/config → config}/open-api/open-api-document.d.ts +2 -2
- package/dist/{types/config → config}/s3-config.d.ts +1 -1
- package/dist/{types/config → config}/sns-config.d.ts +1 -1
- package/dist/{es/epsilon-build-properties.js → epsilon-build-properties.js} +1 -1
- package/dist/{types/epsilon-constants.d.ts → epsilon-constants.d.ts} +1 -1
- package/dist/{es/epsilon-constants.js → epsilon-constants.js} +14 -13
- package/dist/{types/epsilon-global-handler.d.ts → epsilon-global-handler.d.ts} +3 -6
- package/dist/{es/epsilon-global-handler.js → epsilon-global-handler.js} +29 -24
- package/dist/{types/epsilon-instance.d.ts → epsilon-instance.d.ts} +6 -11
- package/dist/epsilon-logging-extension-processor.d.ts +6 -0
- package/dist/{es/epsilon-logging-extension-processor.js → epsilon-logging-extension-processor.js} +1 -1
- package/dist/{types/http → http}/auth/api-gateway-adapter-authentication-handler.d.ts +0 -10
- package/dist/{es/http → http}/auth/api-gateway-adapter-authentication-handler.js +4 -3
- package/dist/{types/http → http}/auth/auth0-web-token-manipulator.d.ts +2 -2
- package/dist/{es/http → http}/auth/auth0-web-token-manipulator.js +6 -1
- package/dist/{types/http → http}/auth/basic-auth-token.d.ts +0 -3
- package/dist/{types/http → http}/auth/google-web-token-manipulator.d.ts +2 -2
- package/dist/{es/http → http}/auth/google-web-token-manipulator.js +6 -3
- package/dist/http/auth/google-web-token-manipulator.spec.js +10 -0
- package/dist/{types/http → http}/auth/jwt-ratchet-local-web-token-manipulator.d.ts +3 -5
- package/dist/{es/http → http}/auth/jwt-ratchet-local-web-token-manipulator.js +5 -3
- package/dist/{types/http → http}/auth/local-web-token-manipulator.d.ts +4 -5
- package/dist/{es/http → http}/auth/local-web-token-manipulator.js +9 -5
- package/dist/http/auth/local-web-token-manipulator.spec.js +24 -0
- package/dist/{types/http → http}/auth/web-token-manipulator.d.ts +1 -4
- package/dist/{types/http → http}/error/bad-gateway.d.ts +1 -1
- package/dist/{es/http → http}/error/bad-gateway.js +2 -2
- package/dist/{types/http → http}/error/bad-request-error.d.ts +1 -1
- package/dist/{es/http → http}/error/bad-request-error.js +2 -2
- package/dist/{types/http → http}/error/conflict-error.d.ts +1 -1
- package/dist/{es/http → http}/error/conflict-error.js +2 -2
- package/dist/{es/http → http}/error/epsilon-http-error.js +9 -3
- package/dist/http/error/epsilon-http-error.spec.js +11 -0
- package/dist/{types/http → http}/error/forbidden-error.d.ts +1 -1
- package/dist/{es/http → http}/error/forbidden-error.js +2 -2
- package/dist/{types/http → http}/error/gateway-timeout.d.ts +1 -1
- package/dist/{es/http → http}/error/gateway-timeout.js +2 -2
- package/dist/{types/http → http}/error/method-not-allowed-error.d.ts +1 -1
- package/dist/{es/http → http}/error/method-not-allowed-error.js +2 -2
- package/dist/{types/http → http}/error/misconfigured-error.d.ts +1 -1
- package/dist/{es/http → http}/error/misconfigured-error.js +2 -2
- package/dist/{types/http → http}/error/not-found-error.d.ts +1 -1
- package/dist/{es/http → http}/error/not-found-error.js +2 -2
- package/dist/{types/http → http}/error/not-implemented.d.ts +1 -1
- package/dist/{es/http → http}/error/not-implemented.js +2 -2
- package/dist/{types/http → http}/error/request-timeout-error.d.ts +1 -1
- package/dist/{es/http → http}/error/request-timeout-error.js +2 -2
- package/dist/{types/http → http}/error/service-unavailable.d.ts +1 -1
- package/dist/{es/http → http}/error/service-unavailable.js +2 -2
- package/dist/{types/http → http}/error/too-many-requests-error.d.ts +1 -1
- package/dist/{es/http → http}/error/too-many-requests-error.js +2 -2
- package/dist/{types/http → http}/error/unauthorized-error.d.ts +1 -1
- package/dist/{es/http → http}/error/unauthorized-error.js +2 -2
- package/dist/{types/http → http}/event-util.d.ts +3 -25
- package/dist/{es/http → http}/event-util.js +9 -8
- package/dist/http/event-util.spec.js +157 -0
- package/dist/{types/http → http}/response-util.d.ts +2 -2
- package/dist/{es/http → http}/response-util.js +2 -2
- package/dist/http/response-util.spec.d.ts +1 -0
- package/dist/http/response-util.spec.js +88 -0
- package/dist/http/route/epsilon-router.d.ts +8 -0
- package/dist/http/route/epsilon-router.js +1 -0
- package/dist/http/route/extended-auth-response-context.js +1 -0
- package/dist/{types/http → http}/route/route-mapping.d.ts +3 -3
- package/dist/http/route/route-mapping.js +1 -0
- package/dist/http/route/route-validator-config.js +1 -0
- package/dist/{types/http → http}/route/router-util.d.ts +9 -12
- package/dist/{es/http → http}/route/router-util.js +10 -10
- package/dist/http/route/router-util.spec.d.ts +1 -0
- package/dist/http/route/router-util.spec.js +23 -0
- package/dist/{types/http → http}/web-handler.d.ts +4 -7
- package/dist/{es/http → http}/web-handler.js +11 -10
- package/dist/http/web-handler.spec.d.ts +1 -0
- package/dist/http/web-handler.spec.js +32 -0
- package/dist/{types/http → http}/web-v2-handler.d.ts +2 -5
- package/dist/{es/http → http}/web-v2-handler.js +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/inter-api/inter-api-entry.js +1 -0
- package/dist/{types/inter-api → inter-api}/inter-api-util.d.ts +3 -3
- package/dist/{es/inter-api → inter-api}/inter-api-util.js +6 -5
- package/dist/inter-api/inter-api-util.spec.d.ts +1 -0
- package/dist/inter-api/inter-api-util.spec.js +61 -0
- package/dist/{types/inter-api-manager.d.ts → inter-api-manager.d.ts} +2 -5
- package/dist/{es/inter-api-manager.js → inter-api-manager.js} +5 -3
- package/dist/{types/lambda-event-handler → lambda-event-handler}/cron-epsilon-lambda-event-handler.d.ts +5 -5
- package/dist/{es/lambda-event-handler → lambda-event-handler}/cron-epsilon-lambda-event-handler.js +5 -4
- package/dist/lambda-event-handler/cron-epsilon-lambda-event-handler.spec.d.ts +1 -0
- package/dist/lambda-event-handler/cron-epsilon-lambda-event-handler.spec.js +50 -0
- package/dist/{types/lambda-event-handler → lambda-event-handler}/dynamo-epsilon-lambda-event-handler.d.ts +2 -2
- package/dist/{es/lambda-event-handler → lambda-event-handler}/dynamo-epsilon-lambda-event-handler.js +4 -3
- package/dist/{types/lambda-event-handler → lambda-event-handler}/generic-sns-epsilon-lambda-event-handler.d.ts +2 -2
- package/dist/{es/lambda-event-handler → lambda-event-handler}/generic-sns-epsilon-lambda-event-handler.js +4 -3
- package/dist/{types/lambda-event-handler → lambda-event-handler}/inter-api-epsilon-lambda-event-handler.d.ts +2 -2
- package/dist/{es/lambda-event-handler → lambda-event-handler}/inter-api-epsilon-lambda-event-handler.js +2 -1
- package/dist/{types/lambda-event-handler → lambda-event-handler}/s3-epsilon-lambda-event-handler.d.ts +2 -2
- package/dist/{es/lambda-event-handler → lambda-event-handler}/s3-epsilon-lambda-event-handler.js +4 -3
- package/dist/{types/local-container-server.d.ts → local-container-server.d.ts} +1 -4
- package/dist/{es/local-container-server.js → local-container-server.js} +8 -4
- package/dist/local-server-cert.js +67 -0
- package/dist/{types/local-server.d.ts → local-server.d.ts} +2 -5
- package/dist/{es/local-server.js → local-server.js} +11 -8
- package/dist/open-api-util/open-api-doc-modifications.js +1 -0
- package/dist/{types/open-api-util → open-api-util}/open-api-doc-modifier.d.ts +1 -4
- package/dist/{es/open-api-util → open-api-util}/open-api-doc-modifier.js +2 -1
- package/dist/open-api-util/open-api-doc-modifier.spec.d.ts +1 -0
- package/dist/open-api-util/open-api-doc-modifier.spec.js +16 -0
- package/dist/{es/open-api-util → open-api-util}/yaml-combiner.js +2 -2
- package/dist/open-api-util/yaml-combiner.spec.d.ts +1 -0
- package/dist/open-api-util/yaml-combiner.spec.js +22 -0
- package/dist/{types/sample → sample}/sample-server-components.d.ts +2 -2
- package/dist/{es/sample → sample}/sample-server-components.js +25 -24
- package/dist/sample/sample-server-static-files.js +593 -0
- package/dist/{types/sample → sample}/test-error-server.d.ts +1 -4
- package/dist/{es/sample → sample}/test-error-server.js +4 -2
- package/dist/{types/util → util}/context-util.d.ts +3 -3
- package/dist/{es/util → util}/context-util.js +11 -5
- package/dist/{types/util → util}/cron-util.d.ts +2 -2
- package/dist/{es/util → util}/cron-util.js +3 -3
- package/dist/util/cron-util.spec.d.ts +1 -0
- package/dist/util/cron-util.spec.js +124 -0
- package/dist/{types/util → util}/epsilon-config-parser.d.ts +6 -6
- package/dist/{es/util → util}/epsilon-config-parser.js +9 -9
- package/includes/cli.js +8 -10
- package/package.json +12 -15
- 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/dist/{types/background → background}/background-entry.d.ts +0 -0
- /package/dist/{es/background → background}/background-entry.js +0 -0
- /package/dist/{types/background → background}/background-execution-event-type.d.ts +0 -0
- /package/dist/{es/background → background}/background-execution-event-type.js +0 -0
- /package/dist/{es/background → background}/background-execution-event.js +0 -0
- /package/dist/{es/background → background}/background-execution-listener.js +0 -0
- /package/dist/{types/background → background}/background-meta-response-internal.d.ts +0 -0
- /package/dist/{es/background → background}/background-meta-response-internal.js +0 -0
- /package/dist/{types/background → background}/background-process-handling.d.ts +0 -0
- /package/dist/{es/background → background}/background-process-handling.js +0 -0
- /package/dist/{types/background → background}/background-process-log-table-entry.d.ts +0 -0
- /package/dist/{es/background → background}/background-process-log-table-entry.js +0 -0
- /package/dist/{es/background → background}/background-queue-response-internal.js +0 -0
- /package/dist/{types/background → background}/epsilon-background-process-error.d.ts +0 -0
- /package/dist/{es/background → background}/internal-background-entry.js +0 -0
- /package/dist/{es/background → background}/manager/background-manager-like.js +0 -0
- /package/dist/{es/built-in/background/sample-input-validated-processor-data.js → background/manager/background-manager.spec.d.ts} +0 -0
- /package/dist/{es/build → build}/ratchet-epsilon-common-info.js +0 -0
- /package/dist/{types/built-in → built-in}/background/sample-input-validated-processor-data.d.ts +0 -0
- /package/dist/{es/built-in/daemon/daemon-authorizer-function.js → built-in/background/sample-input-validated-processor-data.js} +0 -0
- /package/dist/{types/built-in → built-in}/built-in-trace-id-generators.d.ts +0 -0
- /package/dist/{es/built-in/daemon/daemon-config.js → built-in/daemon/daemon-authorizer-function.js} +0 -0
- /package/dist/{es/built-in/daemon/daemon-group-selection-function.js → built-in/daemon/daemon-config.js} +0 -0
- /package/dist/{es/built-in/daemon/daemon-process-state-list.js → built-in/daemon/daemon-group-selection-function.js} +0 -0
- /package/dist/{es/config/background/background-aws-config.js → built-in/daemon/daemon-process-state-list.js} +0 -0
- /package/dist/{es/config/background/background-config.js → built-in/http/run-handler-as-filter.spec.d.ts} +0 -0
- /package/dist/{types/config → config}/background/background-aws-config.d.ts +0 -0
- /package/dist/{es/config/background/background-error-processor.js → config/background/background-aws-config.js} +0 -0
- /package/dist/{es/config/background/background-processor.js → config/background/background-config.js} +0 -0
- /package/dist/{es/config/background/background-transaction-log.js → config/background/background-error-processor.js} +0 -0
- /package/dist/{es/config/background/background-transaction-logger.js → config/background/background-processor.js} +0 -0
- /package/dist/{es/config/cron/abstract-cron-entry.js → config/background/background-transaction-log.js} +0 -0
- /package/dist/{es/config/cron/cron-background-entry.js → config/background/background-transaction-logger.js} +0 -0
- /package/dist/{types/config → config}/cron/abstract-cron-entry.d.ts +0 -0
- /package/dist/{es/config/cron/cron-config.js → config/cron/abstract-cron-entry.js} +0 -0
- /package/dist/{es/config/dynamo-db-config.js → config/cron/cron-background-entry.js} +0 -0
- /package/dist/{es/config/epsilon-config.js → config/cron/cron-config.js} +0 -0
- /package/dist/{es/config/epsilon-lambda-event-handler.js → config/dynamo-db-config.js} +0 -0
- /package/dist/{es/config/epsilon-logger-config.js → config/epsilon-config.js} +0 -0
- /package/dist/{types/config → config}/epsilon-lambda-event-handler.d.ts +0 -0
- /package/dist/{es/config/generic-aws-event-handler-function.js → config/epsilon-lambda-event-handler.js} +0 -0
- /package/dist/{es/config/http/authorizer-function.js → config/epsilon-logger-config.js} +0 -0
- /package/dist/{types/config → config}/generic-aws-event-handler-function.d.ts +0 -0
- /package/dist/{es/config/http/epsilon-authorization-context.js → config/generic-aws-event-handler-function.js} +0 -0
- /package/dist/{es/config/http/extended-api-gateway-event.js → config/http/authorizer-function.js} +0 -0
- /package/dist/{types/config → config}/http/epsilon-authorization-context.d.ts +0 -0
- /package/dist/{es/config/http/filter-chain-context.js → config/http/epsilon-authorization-context.js} +0 -0
- /package/dist/{es/config/http/filter-function.js → config/http/extended-api-gateway-event.js} +0 -0
- /package/dist/{es/config/http/handler-function.js → config/http/filter-chain-context.js} +0 -0
- /package/dist/{es/config/http/http-config.js → config/http/filter-function.js} +0 -0
- /package/dist/{es/config/http/http-processing-config.js → config/http/handler-function.js} +0 -0
- /package/dist/{es/config/http/mapped-http-processing-config.js → config/http/http-config.js} +0 -0
- /package/dist/{es/config/inter-api/inter-api-aws-config.js → config/http/http-processing-config.js} +0 -0
- /package/dist/{es/config/inter-api/inter-api-config.js → config/http/mapped-http-processing-config.js} +0 -0
- /package/dist/{types/config → config}/http/null-returned-object-handling.d.ts +0 -0
- /package/dist/{es/config → config}/http/null-returned-object-handling.js +0 -0
- /package/dist/{types/config → config}/inter-api/inter-api-aws-config.d.ts +0 -0
- /package/dist/{es/config/inter-api/inter-api-process-mapping.js → config/inter-api/inter-api-aws-config.js} +0 -0
- /package/dist/{es/config/logging-trace-id-generator.js → config/inter-api/inter-api-config.js} +0 -0
- /package/dist/{es/config/open-api/open-api-document-components.js → config/inter-api/inter-api-process-mapping.js} +0 -0
- /package/dist/{types/config → config}/logging-trace-id-generator.d.ts +0 -0
- /package/dist/{es/config/open-api/open-api-document-path.js → config/logging-trace-id-generator.js} +0 -0
- /package/dist/{types/config → config}/open-api/open-api-document-components.d.ts +0 -0
- /package/dist/{es/config/open-api/open-api-document.js → config/open-api/open-api-document-components.js} +0 -0
- /package/dist/{types/config → config}/open-api/open-api-document-path.d.ts +0 -0
- /package/dist/{es/config/s3-config.js → config/open-api/open-api-document-path.js} +0 -0
- /package/dist/{es/config/sns-config.js → config/open-api/open-api-document.js} +0 -0
- /package/dist/{es/epsilon-instance.js → config/s3-config.js} +0 -0
- /package/dist/{es/http/auth/basic-auth-token.js → config/sns-config.js} +0 -0
- /package/dist/{types/epsilon-build-properties.d.ts → epsilon-build-properties.d.ts} +0 -0
- /package/dist/{es/http/auth/web-token-manipulator.js → epsilon-instance.js} +0 -0
- /package/dist/{es/http/route/epsilon-router.js → http/auth/basic-auth-token.js} +0 -0
- /package/dist/{es/http/route/extended-auth-response-context.js → http/auth/google-web-token-manipulator.spec.d.ts} +0 -0
- /package/dist/{es/http/route/route-mapping.js → http/auth/local-web-token-manipulator.spec.d.ts} +0 -0
- /package/dist/{es/http/route/route-validator-config.js → http/auth/web-token-manipulator.js} +0 -0
- /package/dist/{types/http → http}/error/epsilon-http-error.d.ts +0 -0
- /package/dist/{es/inter-api/inter-api-entry.js → http/error/epsilon-http-error.spec.d.ts} +0 -0
- /package/dist/{es/open-api-util/open-api-doc-modifications.js → http/event-util.spec.d.ts} +0 -0
- /package/dist/{types/http → http}/route/extended-auth-response-context.d.ts +0 -0
- /package/dist/{types/http → http}/route/route-validator-config.d.ts +0 -0
- /package/dist/{types/inter-api → inter-api}/inter-api-entry.d.ts +0 -0
- /package/dist/{types/local-server-cert.d.ts → local-server-cert.d.ts} +0 -0
- /package/dist/{types/open-api-util → open-api-util}/open-api-doc-modifications.d.ts +0 -0
- /package/dist/{types/open-api-util → open-api-util}/yaml-combiner.d.ts +0 -0
- /package/dist/{types/sample → sample}/sample-server-static-files.d.ts +0 -0
- /package/dist/{types/util → util}/aws-util.d.ts +0 -0
- /package/dist/{es/util → util}/aws-util.js +0 -0
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CronEpsilonLambdaEventHandler = void 0;
|
|
4
|
-
const ratchet_common_1 = require("@bitblit/ratchet-common");
|
|
5
|
-
const aws_util_1 = require("../util/aws-util");
|
|
6
|
-
const cron_util_1 = require("../util/cron-util");
|
|
7
|
-
const ratchet_aws_1 = require("@bitblit/ratchet-aws");
|
|
8
|
-
class CronEpsilonLambdaEventHandler {
|
|
9
|
-
constructor(_epsilon) {
|
|
10
|
-
this._epsilon = _epsilon;
|
|
11
|
-
}
|
|
12
|
-
extractLabel(evt, context) {
|
|
13
|
-
return 'CronEvt:' + evt.source;
|
|
14
|
-
}
|
|
15
|
-
handlesEvent(evt) {
|
|
16
|
-
return ratchet_aws_1.LambdaEventDetector.isValidCronEvent(evt);
|
|
17
|
-
}
|
|
18
|
-
async processEvent(evt, context) {
|
|
19
|
-
let rval = null;
|
|
20
|
-
ratchet_common_1.Logger.debug('Epsilon: CRON: %j', evt);
|
|
21
|
-
if (!this._epsilon.config.cron) {
|
|
22
|
-
ratchet_common_1.Logger.debug('Skipping - CRON disabled');
|
|
23
|
-
rval = {
|
|
24
|
-
statusCode: 200,
|
|
25
|
-
body: JSON.stringify({ message: 'CRON skipped - disabled' }),
|
|
26
|
-
isBase64Encoded: false,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
const output = await CronEpsilonLambdaEventHandler.processCronEvent(evt, this._epsilon.config.cron, this._epsilon.backgroundManager, this._epsilon.backgroundHandler);
|
|
31
|
-
rval = {
|
|
32
|
-
statusCode: 200,
|
|
33
|
-
body: JSON.stringify({ message: 'CRON complete' }),
|
|
34
|
-
isBase64Encoded: false,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
return rval;
|
|
38
|
-
}
|
|
39
|
-
static async processCronEvent(evt, cronConfig, backgroundManager, background) {
|
|
40
|
-
let rval = false;
|
|
41
|
-
if (cronConfig && evt && evt.resources[0]) {
|
|
42
|
-
if (!!cronConfig.entries) {
|
|
43
|
-
if (!!background) {
|
|
44
|
-
const toEnqueue = [];
|
|
45
|
-
for (let i = 0; i < cronConfig.entries.length; i++) {
|
|
46
|
-
const smCronEntry = cronConfig.entries[i];
|
|
47
|
-
if (cron_util_1.CronUtil.eventMatchesEntry(evt, smCronEntry, cronConfig)) {
|
|
48
|
-
ratchet_common_1.Logger.info('CRON Firing : %s', cron_util_1.CronUtil.cronEntryName(smCronEntry));
|
|
49
|
-
const backgroundEntry = {
|
|
50
|
-
type: smCronEntry.backgroundTaskType,
|
|
51
|
-
data: aws_util_1.AwsUtil.resolvePotentialFunctionToResult(smCronEntry.data, {}),
|
|
52
|
-
};
|
|
53
|
-
ratchet_common_1.Logger.silly('Resolved entry : %j', backgroundEntry);
|
|
54
|
-
if (smCronEntry.fireImmediate) {
|
|
55
|
-
await backgroundManager.fireImmediateProcessRequest(backgroundEntry);
|
|
56
|
-
rval = true;
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
toEnqueue.push(backgroundEntry);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (toEnqueue.length > 0) {
|
|
64
|
-
await backgroundManager.addEntriesToQueue(toEnqueue, true);
|
|
65
|
-
rval = true;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
ratchet_common_1.Logger.warn('Cron defines background tasks, but no background manager provided');
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return rval;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.CronEpsilonLambdaEventHandler = CronEpsilonLambdaEventHandler;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DynamoEpsilonLambdaEventHandler = void 0;
|
|
4
|
-
const ratchet_common_1 = require("@bitblit/ratchet-common");
|
|
5
|
-
const aws_util_1 = require("../util/aws-util");
|
|
6
|
-
const ratchet_aws_1 = require("@bitblit/ratchet-aws");
|
|
7
|
-
class DynamoEpsilonLambdaEventHandler {
|
|
8
|
-
constructor(_epsilon) {
|
|
9
|
-
this._epsilon = _epsilon;
|
|
10
|
-
}
|
|
11
|
-
extractLabel(evt, context) {
|
|
12
|
-
return 'DDBEvt:' + evt.Records[0].eventName + ':' + evt.Records[0].eventSource;
|
|
13
|
-
}
|
|
14
|
-
handlesEvent(evt) {
|
|
15
|
-
return ratchet_aws_1.LambdaEventDetector.isValidDynamoDBEvent(evt);
|
|
16
|
-
}
|
|
17
|
-
async processEvent(evt, context) {
|
|
18
|
-
let rval = null;
|
|
19
|
-
if (this._epsilon.config && this._epsilon.config.dynamoDb && evt && evt.Records && evt.Records.length > 0) {
|
|
20
|
-
const finder = evt.Records[0].eventSourceARN;
|
|
21
|
-
const handler = aws_util_1.AwsUtil.findInMap(finder, this._epsilon.config.dynamoDb.handlers);
|
|
22
|
-
if (handler) {
|
|
23
|
-
rval = await handler(evt);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
ratchet_common_1.Logger.info('Found no Dynamo handler for : %s', finder);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return rval;
|
|
30
|
-
}
|
|
31
|
-
async processUncaughtError(event, context, err) {
|
|
32
|
-
ratchet_common_1.Logger.error('Error slipped out to outer edge (Dynamo). Logging and rethrowing : %s', err, err);
|
|
33
|
-
throw err;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.DynamoEpsilonLambdaEventHandler = DynamoEpsilonLambdaEventHandler;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GenericSnsEpsilonLambdaEventHandler = void 0;
|
|
4
|
-
const ratchet_common_1 = require("@bitblit/ratchet-common");
|
|
5
|
-
const aws_util_1 = require("../util/aws-util");
|
|
6
|
-
const ratchet_aws_1 = require("@bitblit/ratchet-aws");
|
|
7
|
-
class GenericSnsEpsilonLambdaEventHandler {
|
|
8
|
-
constructor(_epsilon) {
|
|
9
|
-
this._epsilon = _epsilon;
|
|
10
|
-
}
|
|
11
|
-
extractLabel(evt, context) {
|
|
12
|
-
return 'SNSEvt:' + evt.Records[0].EventSource;
|
|
13
|
-
}
|
|
14
|
-
handlesEvent(evt) {
|
|
15
|
-
return ratchet_aws_1.LambdaEventDetector.isValidSnsEvent(evt);
|
|
16
|
-
}
|
|
17
|
-
async processEvent(evt, context) {
|
|
18
|
-
let rval = null;
|
|
19
|
-
if (this._epsilon.config && this._epsilon.config.sns && evt && evt.Records.length > 0) {
|
|
20
|
-
const finder = evt.Records[0].Sns.TopicArn;
|
|
21
|
-
const handler = aws_util_1.AwsUtil.findInMap(finder, this._epsilon.config.sns.handlers);
|
|
22
|
-
if (handler) {
|
|
23
|
-
rval = await handler(evt);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
ratchet_common_1.Logger.info('Found no SNS handler for : %s', finder);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return rval;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.GenericSnsEpsilonLambdaEventHandler = GenericSnsEpsilonLambdaEventHandler;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InterApiEpsilonLambdaEventHandler = void 0;
|
|
4
|
-
const inter_api_util_1 = require("../inter-api/inter-api-util");
|
|
5
|
-
class InterApiEpsilonLambdaEventHandler {
|
|
6
|
-
constructor(_epsilon) {
|
|
7
|
-
this._epsilon = _epsilon;
|
|
8
|
-
}
|
|
9
|
-
extractLabel(evt, context) {
|
|
10
|
-
const ent = inter_api_util_1.InterApiUtil.extractEntryFromEvent(evt);
|
|
11
|
-
return 'InterApi:' + ent.source + ':' + ent.type;
|
|
12
|
-
}
|
|
13
|
-
handlesEvent(evt) {
|
|
14
|
-
return this._epsilon.config.interApiConfig && inter_api_util_1.InterApiUtil.isInterApiSnsEvent(evt);
|
|
15
|
-
}
|
|
16
|
-
async processEvent(evt, context) {
|
|
17
|
-
const tmp = await inter_api_util_1.InterApiUtil.processInterApiEvent(evt, this._epsilon.config.interApiConfig, this._epsilon.backgroundManager);
|
|
18
|
-
const rval = {
|
|
19
|
-
statusCode: 200,
|
|
20
|
-
body: JSON.stringify(tmp),
|
|
21
|
-
isBase64Encoded: false,
|
|
22
|
-
};
|
|
23
|
-
return rval;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.InterApiEpsilonLambdaEventHandler = InterApiEpsilonLambdaEventHandler;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.S3EpsilonLambdaEventHandler = void 0;
|
|
4
|
-
const ratchet_common_1 = require("@bitblit/ratchet-common");
|
|
5
|
-
const aws_util_1 = require("../util/aws-util");
|
|
6
|
-
const ratchet_aws_1 = require("@bitblit/ratchet-aws");
|
|
7
|
-
class S3EpsilonLambdaEventHandler {
|
|
8
|
-
constructor(_epsilon) {
|
|
9
|
-
this._epsilon = _epsilon;
|
|
10
|
-
}
|
|
11
|
-
extractLabel(evt, context) {
|
|
12
|
-
return 'S3Evt:' + evt.Records[0].eventSource;
|
|
13
|
-
}
|
|
14
|
-
handlesEvent(evt) {
|
|
15
|
-
return ratchet_aws_1.LambdaEventDetector.isValidS3Event(evt);
|
|
16
|
-
}
|
|
17
|
-
async processEvent(evt, context) {
|
|
18
|
-
let rval = null;
|
|
19
|
-
if (this._epsilon.config && this._epsilon.config.s3 && evt && evt.Records.length > 0) {
|
|
20
|
-
const finder = evt.Records[0].s3.bucket.name + '/' + evt.Records[0].s3.object.key;
|
|
21
|
-
const isRemoveEvent = evt.Records[0].eventName && evt.Records[0].eventName.startsWith('ObjectRemoved');
|
|
22
|
-
if (isRemoveEvent) {
|
|
23
|
-
const handler = aws_util_1.AwsUtil.findInMap(finder, this._epsilon.config.s3.removeHandlers);
|
|
24
|
-
if (handler) {
|
|
25
|
-
rval = await handler(evt);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
ratchet_common_1.Logger.info('Found no s3 create handler for : %s', finder);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
const handler = aws_util_1.AwsUtil.findInMap(finder, this._epsilon.config.s3.createHandlers);
|
|
33
|
-
if (handler) {
|
|
34
|
-
rval = await handler(evt);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
ratchet_common_1.Logger.info('Found no s3 remove handler for : %s', finder);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return rval;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.S3EpsilonLambdaEventHandler = S3EpsilonLambdaEventHandler;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LocalContainerServer = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const ratchet_common_1 = require("@bitblit/ratchet-common");
|
|
6
|
-
const http_1 = tslib_1.__importDefault(require("http"));
|
|
7
|
-
const event_util_1 = require("./http/event-util");
|
|
8
|
-
const cross_fetch_1 = tslib_1.__importDefault(require("cross-fetch"));
|
|
9
|
-
const local_server_1 = require("./local-server");
|
|
10
|
-
class LocalContainerServer {
|
|
11
|
-
constructor(port = 8889) {
|
|
12
|
-
this.port = port;
|
|
13
|
-
this.aborted = false;
|
|
14
|
-
}
|
|
15
|
-
async runServer() {
|
|
16
|
-
return new Promise((res, rej) => {
|
|
17
|
-
try {
|
|
18
|
-
ratchet_common_1.Logger.info('Starting Epsilon server on port %d', this.port);
|
|
19
|
-
this.server = http_1.default.createServer(this.requestHandler.bind(this)).listen(this.port);
|
|
20
|
-
ratchet_common_1.Logger.info('Epsilon server is listening');
|
|
21
|
-
process.on('SIGINT', () => {
|
|
22
|
-
ratchet_common_1.Logger.info('Caught SIGINT - shutting down test server...');
|
|
23
|
-
this.aborted = true;
|
|
24
|
-
res(true);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
28
|
-
ratchet_common_1.Logger.error('Local server failed : %s', err, err);
|
|
29
|
-
rej(err);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
async requestHandler(request, response) {
|
|
34
|
-
const context = {
|
|
35
|
-
awsRequestId: 'LOCAL-' + ratchet_common_1.StringRatchet.createType4Guid(),
|
|
36
|
-
getRemainingTimeInMillis() {
|
|
37
|
-
return 300000;
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
const evt = await local_server_1.LocalServer.messageToApiGatewayEvent(request, context);
|
|
41
|
-
const logEventLevel = event_util_1.EventUtil.eventIsAGraphQLIntrospection(evt) ? ratchet_common_1.LoggerLevelName.silly : ratchet_common_1.LoggerLevelName.info;
|
|
42
|
-
ratchet_common_1.Logger.logByLevel(logEventLevel, 'Processing event: %j', evt);
|
|
43
|
-
if (evt.path == '/epsilon-poison-pill') {
|
|
44
|
-
this.aborted = true;
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
const url = 'http://localhost:8080/2015-03-31/functions/function/invocations';
|
|
49
|
-
try {
|
|
50
|
-
const postResp = await (0, cross_fetch_1.default)(url, { method: 'POST', body: JSON.stringify(evt) });
|
|
51
|
-
const respBody = await postResp.json();
|
|
52
|
-
const result = respBody;
|
|
53
|
-
const written = await local_server_1.LocalServer.writeProxyResultToServerResponse(result, response);
|
|
54
|
-
return written;
|
|
55
|
-
}
|
|
56
|
-
catch (err) {
|
|
57
|
-
ratchet_common_1.Logger.error('Failed: %s', err);
|
|
58
|
-
return '{"bad":true}';
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
static async runFromCliArgs(args) {
|
|
63
|
-
try {
|
|
64
|
-
ratchet_common_1.Logger.setLevel(ratchet_common_1.LoggerLevelName.debug);
|
|
65
|
-
ratchet_common_1.Logger.debug('Running local container server : %j', process === null || process === void 0 ? void 0 : process.argv);
|
|
66
|
-
const testServer = new LocalContainerServer();
|
|
67
|
-
await testServer.runServer();
|
|
68
|
-
ratchet_common_1.Logger.info('Got res server');
|
|
69
|
-
process.exit(0);
|
|
70
|
-
}
|
|
71
|
-
catch (err) {
|
|
72
|
-
ratchet_common_1.Logger.error('Error : %s', err);
|
|
73
|
-
process.exit(1);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.LocalContainerServer = LocalContainerServer;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LocalServerCert = void 0;
|
|
4
|
-
class LocalServerCert {
|
|
5
|
-
}
|
|
6
|
-
exports.LocalServerCert = LocalServerCert;
|
|
7
|
-
LocalServerCert.CLIENT_CSR = '-----BEGIN CERTIFICATE REQUEST-----\n' +
|
|
8
|
-
'MIICwjCCAaoCAQAwfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk5WMRIwEAYDVQQH\n' +
|
|
9
|
-
'DAlMYXMgVmVnYXMxDjAMBgNVBAoMBVBsdW1hMRkwFwYDVQQDDBB3d3cuaGV5cGx1\n' +
|
|
10
|
-
'bWEuY29tMSIwIAYJKoZIhvcNAQkBFhNjd2Vpc3NAaGV5cGx1bWEuY29tMIIBIjAN\n' +
|
|
11
|
-
'BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Gh1SD1VciosMgh3MHF7IyKgNTu2\n' +
|
|
12
|
-
'DjGMoORJV4VNKzrjp7UOdKnD3so0Xx3A6bUTYAL8Vtc+EG+8LZjUpBIOwuKzzbVo\n' +
|
|
13
|
-
't16+yt3YXBxzTZPU9g7sFsXx42RoNispIFq0enRtJrq/zq8izZxUZdGn9XD2DidL\n' +
|
|
14
|
-
'AedtRGjb8cmRuP6wmMRPBO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0e49qmbBjzTqAEBw2nn/JVMFHyI/s//JVF7Q9GfBZAF5XF6mJ24yzTKgF\n' +
|
|
70
|
-
'kSoO5T+7s8NXi0eAIBe4CkWCBX7kWEZtu46GuVhsrC3oEazuLOs=\n' +
|
|
71
|
-
'-----END RSA PRIVATE KEY-----\n';
|
package/dist/cjs/local-server.js
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LocalServer = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const ratchet_common_1 = require("@bitblit/ratchet-common");
|
|
6
|
-
const http_1 = tslib_1.__importDefault(require("http"));
|
|
7
|
-
const https_1 = tslib_1.__importDefault(require("https"));
|
|
8
|
-
const ratchet_common_2 = require("@bitblit/ratchet-common");
|
|
9
|
-
const luxon_1 = require("luxon");
|
|
10
|
-
const querystring_1 = tslib_1.__importDefault(require("querystring"));
|
|
11
|
-
const event_util_1 = require("./http/event-util");
|
|
12
|
-
const ratchet_common_3 = require("@bitblit/ratchet-common");
|
|
13
|
-
const local_server_cert_1 = require("./local-server-cert");
|
|
14
|
-
const sample_server_components_1 = require("./sample/sample-server-components");
|
|
15
|
-
const local_web_token_manipulator_1 = require("./http/auth/local-web-token-manipulator");
|
|
16
|
-
class LocalServer {
|
|
17
|
-
constructor(globalHandler, port = 8888, https = false) {
|
|
18
|
-
this.globalHandler = globalHandler;
|
|
19
|
-
this.port = port;
|
|
20
|
-
this.aborted = false;
|
|
21
|
-
}
|
|
22
|
-
async runServer() {
|
|
23
|
-
return new Promise((res, rej) => {
|
|
24
|
-
try {
|
|
25
|
-
ratchet_common_1.Logger.info('Starting Epsilon server on port %d', this.port);
|
|
26
|
-
if (https_1.default) {
|
|
27
|
-
const options = {
|
|
28
|
-
key: local_server_cert_1.LocalServerCert.CLIENT_KEY_PEM,
|
|
29
|
-
cert: local_server_cert_1.LocalServerCert.CLIENT_CERT_PEM,
|
|
30
|
-
};
|
|
31
|
-
ratchet_common_1.Logger.info('Starting https server - THIS SERVER IS NOT SECURE! The KEYS are in the code! Testing Server Only - Use at your own risk!');
|
|
32
|
-
this.server = https_1.default.createServer(options, this.requestHandler.bind(this)).listen(this.port);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
this.server = http_1.default.createServer(this.requestHandler.bind(this)).listen(this.port);
|
|
36
|
-
}
|
|
37
|
-
ratchet_common_1.Logger.info('Epsilon server is listening');
|
|
38
|
-
process.on('SIGINT', () => {
|
|
39
|
-
ratchet_common_1.Logger.info('Caught SIGINT - shutting down test server...');
|
|
40
|
-
this.aborted = true;
|
|
41
|
-
res(true);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
catch (err) {
|
|
45
|
-
ratchet_common_1.Logger.error('Local server failed : %s', err, err);
|
|
46
|
-
rej(err);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
async requestHandler(request, response) {
|
|
51
|
-
const context = {
|
|
52
|
-
awsRequestId: 'LOCAL-' + ratchet_common_2.StringRatchet.createType4Guid(),
|
|
53
|
-
getRemainingTimeInMillis() {
|
|
54
|
-
return 300000;
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
const evt = await LocalServer.messageToApiGatewayEvent(request, context);
|
|
58
|
-
const logEventLevel = event_util_1.EventUtil.eventIsAGraphQLIntrospection(evt) ? ratchet_common_3.LoggerLevelName.silly : ratchet_common_3.LoggerLevelName.info;
|
|
59
|
-
if (evt.path == '/epsilon-poison-pill') {
|
|
60
|
-
this.aborted = true;
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
const result = await this.globalHandler.lambdaHandler(evt, context);
|
|
65
|
-
const written = await LocalServer.writeProxyResultToServerResponse(result, response);
|
|
66
|
-
return written;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
static async bodyAsBase64String(request) {
|
|
70
|
-
return new Promise((res, rej) => {
|
|
71
|
-
const body = [];
|
|
72
|
-
request.on('data', (chunk) => {
|
|
73
|
-
body.push(chunk);
|
|
74
|
-
});
|
|
75
|
-
request.on('end', () => {
|
|
76
|
-
const rval = Buffer.concat(body).toString('base64');
|
|
77
|
-
res(rval);
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
static async messageToApiGatewayEvent(request, context) {
|
|
82
|
-
const bodyString = await LocalServer.bodyAsBase64String(request);
|
|
83
|
-
const stageIdx = request.url.indexOf('/', 1);
|
|
84
|
-
const stage = request.url.substring(1, stageIdx);
|
|
85
|
-
const path = request.url.substring(stageIdx + 1);
|
|
86
|
-
const reqTime = new Date().getTime();
|
|
87
|
-
const formattedTime = luxon_1.DateTime.utc().toFormat('dd/MMM/yyyy:hh:mm:ss ZZ');
|
|
88
|
-
const queryIdx = request.url.indexOf('?');
|
|
89
|
-
const queryStringParams = queryIdx > -1 ? querystring_1.default.parse(request.url.substring(queryIdx + 1)) : {};
|
|
90
|
-
const headers = Object.assign({}, request.headers);
|
|
91
|
-
headers['X-Forwarded-Proto'] = 'http';
|
|
92
|
-
const rval = {
|
|
93
|
-
body: bodyString,
|
|
94
|
-
multiValueHeaders: {},
|
|
95
|
-
multiValueQueryStringParameters: {},
|
|
96
|
-
resource: '/{proxy+}',
|
|
97
|
-
path: request.url,
|
|
98
|
-
httpMethod: request.method.toLowerCase(),
|
|
99
|
-
isBase64Encoded: true,
|
|
100
|
-
queryStringParameters: queryStringParams,
|
|
101
|
-
pathParameters: {
|
|
102
|
-
proxy: path,
|
|
103
|
-
},
|
|
104
|
-
stageVariables: {
|
|
105
|
-
baz: 'qux',
|
|
106
|
-
},
|
|
107
|
-
headers: headers,
|
|
108
|
-
requestContext: {
|
|
109
|
-
accountId: '123456789012',
|
|
110
|
-
resourceId: '123456',
|
|
111
|
-
stage: stage,
|
|
112
|
-
requestId: context.awsRequestId,
|
|
113
|
-
requestTime: formattedTime,
|
|
114
|
-
requestTimeEpoch: reqTime,
|
|
115
|
-
identity: null,
|
|
116
|
-
path: request.url,
|
|
117
|
-
domainName: request.headers['host'],
|
|
118
|
-
resourcePath: '/{proxy+}',
|
|
119
|
-
httpMethod: request.method.toLowerCase(),
|
|
120
|
-
apiId: '1234567890',
|
|
121
|
-
protocol: 'HTTP/1.1',
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
return rval;
|
|
125
|
-
}
|
|
126
|
-
static async writeProxyResultToServerResponse(proxyResult, response) {
|
|
127
|
-
const isGraphQLSchemaResponse = !!proxyResult && !!proxyResult.body && proxyResult.body.indexOf('{"data":{"__schema"') > -1;
|
|
128
|
-
if (!isGraphQLSchemaResponse) {
|
|
129
|
-
ratchet_common_1.Logger.debug('Result: %j', proxyResult);
|
|
130
|
-
}
|
|
131
|
-
response.statusCode = proxyResult.statusCode;
|
|
132
|
-
if (proxyResult.headers) {
|
|
133
|
-
Object.keys(proxyResult.headers).forEach((hk) => {
|
|
134
|
-
response.setHeader(hk, String(proxyResult.headers[hk]));
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
if (proxyResult.multiValueHeaders) {
|
|
138
|
-
Object.keys(proxyResult.multiValueHeaders).forEach((hk) => {
|
|
139
|
-
response.setHeader(hk, proxyResult.multiValueHeaders[hk].join(','));
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
const toWrite = proxyResult.isBase64Encoded ? Buffer.from(proxyResult.body, 'base64') : Buffer.from(proxyResult.body);
|
|
143
|
-
response.end(toWrite);
|
|
144
|
-
return !!proxyResult.body;
|
|
145
|
-
}
|
|
146
|
-
static async runSampleBatchOnlyServerFromCliArgs(args) {
|
|
147
|
-
ratchet_common_1.Logger.setLevel(ratchet_common_3.LoggerLevelName.debug);
|
|
148
|
-
const handler = await sample_server_components_1.SampleServerComponents.createSampleBatchOnlyEpsilonGlobalHandler('SampleBatchOnlyLocalServer-' + Date.now());
|
|
149
|
-
const testServer = new LocalServer(handler);
|
|
150
|
-
const res = await testServer.runServer();
|
|
151
|
-
ratchet_common_1.Logger.info('Res was : %s', res);
|
|
152
|
-
}
|
|
153
|
-
static async runSampleLocalServerFromCliArgs(args) {
|
|
154
|
-
ratchet_common_1.Logger.setLevel(ratchet_common_3.LoggerLevelName.debug);
|
|
155
|
-
const localTokenHandler = new local_web_token_manipulator_1.LocalWebTokenManipulator(['abcd1234'], 'sample-server');
|
|
156
|
-
const token = await localTokenHandler.createJWTStringAsync('asdf', {}, ['USER'], 3600);
|
|
157
|
-
ratchet_common_1.Logger.info('Use token: %s', token);
|
|
158
|
-
const handler = await sample_server_components_1.SampleServerComponents.createSampleEpsilonGlobalHandler('SampleLocalServer-' + Date.now());
|
|
159
|
-
const testServer = new LocalServer(handler, 8888, true);
|
|
160
|
-
const res = await testServer.runServer();
|
|
161
|
-
ratchet_common_1.Logger.info('Res was : %s', res);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
exports.LocalServer = LocalServer;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OpenApiDocModifier = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
6
|
-
const ratchet_common_1 = require("@bitblit/ratchet-common");
|
|
7
|
-
class OpenApiDocModifier {
|
|
8
|
-
constructor(options) {
|
|
9
|
-
this.options = options;
|
|
10
|
-
}
|
|
11
|
-
modifyOpenApiDoc(yamlString) {
|
|
12
|
-
let rval;
|
|
13
|
-
if (!!yamlString && !!this.options) {
|
|
14
|
-
try {
|
|
15
|
-
const openApi = js_yaml_1.default.load(yamlString);
|
|
16
|
-
const removeTags = this.options.removeTags ? this.options.removeTags.map((t) => t.toLowerCase()) : [];
|
|
17
|
-
if (this.options.newServerPath) {
|
|
18
|
-
openApi['servers'] = [{ url: this.options.newServerPath }];
|
|
19
|
-
}
|
|
20
|
-
if (!!this.options.removeTags && openApi['tags']) {
|
|
21
|
-
if (openApi['tags']) {
|
|
22
|
-
openApi['tags'] = openApi.tags.filter((f) => {
|
|
23
|
-
const n = !!f && !!f['name'] ? f['name'].toLowerCase() : '';
|
|
24
|
-
const i = removeTags.indexOf(n);
|
|
25
|
-
return i === -1;
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
if (openApi['paths']) {
|
|
30
|
-
let newPaths = {};
|
|
31
|
-
Object.keys(openApi['paths']).forEach((p) => {
|
|
32
|
-
const path = openApi['paths'][p];
|
|
33
|
-
Object.keys(path).forEach((verb) => {
|
|
34
|
-
const entry = path[verb];
|
|
35
|
-
entry.tags = !!entry.tags ? entry.tags.filter((t) => removeTags.lastIndexOf(t.toLowerCase()) == -1) : entry.tags;
|
|
36
|
-
const matcher = verb.toLowerCase() + ' ' + p.toLowerCase();
|
|
37
|
-
if (this.matchNone(matcher, this.options.removeEndpoints)) {
|
|
38
|
-
newPaths[p] = newPaths[p] || {};
|
|
39
|
-
newPaths[p][verb] = entry;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
if (this.options.sortEndpoints) {
|
|
44
|
-
const keys = Object.keys(newPaths).sort();
|
|
45
|
-
const newPaths2 = {};
|
|
46
|
-
keys.forEach((k) => {
|
|
47
|
-
newPaths2[k] = newPaths[k];
|
|
48
|
-
});
|
|
49
|
-
newPaths = newPaths2;
|
|
50
|
-
}
|
|
51
|
-
openApi['paths'] = newPaths;
|
|
52
|
-
}
|
|
53
|
-
let remSchemas = this.options.removeSchemas || [];
|
|
54
|
-
remSchemas = remSchemas.map((s) => s.toLowerCase());
|
|
55
|
-
if (openApi['components'] && openApi['components']['schemas']) {
|
|
56
|
-
const keys = Object.keys(openApi['components']['schemas']).sort();
|
|
57
|
-
const newComp = {};
|
|
58
|
-
keys.forEach((k) => {
|
|
59
|
-
if (remSchemas.indexOf(k.toLowerCase()) === -1) {
|
|
60
|
-
newComp[k] = openApi['components']['schemas'][k];
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
openApi['components']['schemas'] = newComp;
|
|
64
|
-
}
|
|
65
|
-
rval = js_yaml_1.default.dump(openApi);
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
ratchet_common_1.Logger.error('Error processing yaml: %s', err, err);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return rval;
|
|
72
|
-
}
|
|
73
|
-
matchNone(input, regex) {
|
|
74
|
-
let rval = true;
|
|
75
|
-
if (!!input && !!regex) {
|
|
76
|
-
regex.forEach((r) => {
|
|
77
|
-
rval = rval && !r.test(input);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
return rval;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
exports.OpenApiDocModifier = OpenApiDocModifier;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.YamlCombiner = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
-
const ratchet_common_1 = require("@bitblit/ratchet-common");
|
|
7
|
-
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
8
|
-
const ratchet_common_2 = require("@bitblit/ratchet-common");
|
|
9
|
-
class YamlCombiner {
|
|
10
|
-
static combine(files, inRootPath = []) {
|
|
11
|
-
ratchet_common_1.RequireRatchet.notNullOrUndefined(files, 'Files argument');
|
|
12
|
-
ratchet_common_1.RequireRatchet.true(files.length > 0, 'Files argument larger than 0');
|
|
13
|
-
ratchet_common_1.RequireRatchet.notNullOrUndefined(inRootPath, 'Root path argument');
|
|
14
|
-
ratchet_common_2.Logger.info('Processing %d files into output', files.length);
|
|
15
|
-
let allElements = {};
|
|
16
|
-
for (let i = 0; i < files.length; i++) {
|
|
17
|
-
const fileContents = fs_1.default.readFileSync(files[i]).toString();
|
|
18
|
-
const openApi = js_yaml_1.default.load(fileContents);
|
|
19
|
-
allElements = Object.assign(allElements, openApi);
|
|
20
|
-
}
|
|
21
|
-
const rootPath = Object.assign([], inRootPath);
|
|
22
|
-
while (rootPath.length > 0) {
|
|
23
|
-
const next = {};
|
|
24
|
-
next[rootPath[rootPath.length - 1]] = allElements;
|
|
25
|
-
rootPath.splice(rootPath.length - 1, 1);
|
|
26
|
-
allElements = next;
|
|
27
|
-
}
|
|
28
|
-
const rval = js_yaml_1.default.dump(allElements);
|
|
29
|
-
return rval;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.YamlCombiner = YamlCombiner;
|