@h4ad/serverless-adapter 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -7
- package/lib/@types/binary-settings.d.ts +41 -0
- package/lib/@types/binary-settings.d.ts.map +1 -0
- package/lib/@types/binary-settings.js +1 -1
- package/lib/@types/binary-settings.js.map +1 -1
- package/lib/@types/digital-ocean/digital-ocean-http-event.d.ts +37 -0
- package/lib/@types/digital-ocean/digital-ocean-http-event.d.ts.map +1 -0
- package/lib/@types/digital-ocean/digital-ocean-http-event.js +1 -1
- package/lib/@types/digital-ocean/digital-ocean-http-event.js.map +1 -1
- package/lib/@types/digital-ocean/digital-ocean-http-response.d.ts +22 -0
- package/lib/@types/digital-ocean/digital-ocean-http-response.d.ts.map +1 -0
- package/lib/@types/digital-ocean/digital-ocean-http-response.js +1 -1
- package/lib/@types/digital-ocean/digital-ocean-http-response.js.map +1 -1
- package/lib/@types/digital-ocean/index.d.ts +2 -0
- package/lib/@types/digital-ocean/index.d.ts.map +1 -0
- package/lib/@types/digital-ocean/index.js +1 -1
- package/lib/@types/digital-ocean/index.js.map +1 -1
- package/lib/@types/headers.d.ts +37 -0
- package/lib/@types/headers.d.ts.map +1 -0
- package/lib/@types/headers.js +1 -1
- package/lib/@types/headers.js.map +1 -1
- package/lib/@types/helpers.d.ts +10 -0
- package/lib/@types/helpers.d.ts.map +1 -0
- package/lib/@types/helpers.js +1 -1
- package/lib/@types/helpers.js.map +1 -1
- package/lib/@types/huawei/huawei-api-gateway-event.d.ts +81 -0
- package/lib/@types/huawei/huawei-api-gateway-event.d.ts.map +1 -0
- package/lib/@types/huawei/huawei-api-gateway-event.js +1 -1
- package/lib/@types/huawei/huawei-api-gateway-event.js.map +1 -1
- package/lib/@types/huawei/huawei-api-gateway-response.d.ts +27 -0
- package/lib/@types/huawei/huawei-api-gateway-response.d.ts.map +1 -0
- package/lib/@types/huawei/huawei-api-gateway-response.js +1 -1
- package/lib/@types/huawei/huawei-api-gateway-response.js.map +1 -1
- package/lib/@types/huawei/huawei-context.d.ts +188 -0
- package/lib/@types/huawei/huawei-context.d.ts.map +1 -0
- package/lib/@types/huawei/huawei-context.js +1 -1
- package/lib/@types/huawei/huawei-context.js.map +1 -1
- package/lib/@types/huawei/index.d.ts +4 -0
- package/lib/@types/huawei/index.d.ts.map +1 -0
- package/lib/@types/huawei/index.js +1 -1
- package/lib/@types/huawei/index.js.map +1 -1
- package/lib/@types/index.d.ts +4 -0
- package/lib/@types/index.d.ts.map +1 -0
- package/lib/@types/index.js +1 -1
- package/lib/@types/index.js.map +1 -1
- package/lib/adapters/apollo-server/apollo-server-mutation.adapter.d.ts +56 -0
- package/lib/adapters/apollo-server/apollo-server-mutation.adapter.d.ts.map +1 -0
- package/lib/adapters/apollo-server/apollo-server-mutation.adapter.js +1 -1
- package/lib/adapters/apollo-server/apollo-server-mutation.adapter.js.map +1 -1
- package/lib/adapters/apollo-server/index.d.ts +2 -0
- package/lib/adapters/apollo-server/index.d.ts.map +1 -0
- package/lib/adapters/apollo-server/index.js +1 -1
- package/lib/adapters/apollo-server/index.js.map +1 -1
- package/lib/adapters/aws/alb.adapter.d.ts +71 -0
- package/lib/adapters/aws/alb.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/alb.adapter.js +1 -1
- package/lib/adapters/aws/alb.adapter.js.map +1 -1
- package/lib/adapters/aws/api-gateway-v1.adapter.d.ts +76 -0
- package/lib/adapters/aws/api-gateway-v1.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/api-gateway-v1.adapter.js +1 -1
- package/lib/adapters/aws/api-gateway-v1.adapter.js.map +1 -1
- package/lib/adapters/aws/api-gateway-v2.adapter.d.ts +75 -0
- package/lib/adapters/aws/api-gateway-v2.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/api-gateway-v2.adapter.js +1 -1
- package/lib/adapters/aws/api-gateway-v2.adapter.js.map +1 -1
- package/lib/adapters/aws/base/aws-simple-adapter.d.ts +83 -0
- package/lib/adapters/aws/base/aws-simple-adapter.d.ts.map +1 -0
- package/lib/adapters/aws/base/aws-simple-adapter.js +1 -1
- package/lib/adapters/aws/base/aws-simple-adapter.js.map +1 -1
- package/lib/adapters/aws/base/index.d.ts +2 -0
- package/lib/adapters/aws/base/index.d.ts.map +1 -0
- package/lib/adapters/aws/base/index.js +1 -1
- package/lib/adapters/aws/base/index.js.map +1 -1
- package/lib/adapters/aws/dynamodb.adapter.d.ts +56 -0
- package/lib/adapters/aws/dynamodb.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/dynamodb.adapter.js +1 -1
- package/lib/adapters/aws/dynamodb.adapter.js.map +1 -1
- package/lib/adapters/aws/event-bridge.adapter.d.ts +63 -0
- package/lib/adapters/aws/event-bridge.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/event-bridge.adapter.js +1 -1
- package/lib/adapters/aws/event-bridge.adapter.js.map +1 -1
- package/lib/adapters/aws/index.d.ts +12 -0
- package/lib/adapters/aws/index.d.ts.map +1 -0
- package/lib/adapters/aws/index.js +1 -1
- package/lib/adapters/aws/index.js.map +1 -1
- package/lib/adapters/aws/lambda-edge.adapter.d.ts +209 -0
- package/lib/adapters/aws/lambda-edge.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/lambda-edge.adapter.js +1 -1
- package/lib/adapters/aws/lambda-edge.adapter.js.map +1 -1
- package/lib/adapters/aws/request-lambda-edge.adapter.d.ts +131 -0
- package/lib/adapters/aws/request-lambda-edge.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/request-lambda-edge.adapter.js +2 -0
- package/lib/adapters/aws/request-lambda-edge.adapter.js.map +1 -0
- package/lib/adapters/aws/s3.adapter.d.ts +56 -0
- package/lib/adapters/aws/s3.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/s3.adapter.js +1 -1
- package/lib/adapters/aws/s3.adapter.js.map +1 -1
- package/lib/adapters/aws/sns.adapter.d.ts +56 -0
- package/lib/adapters/aws/sns.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/sns.adapter.js +1 -1
- package/lib/adapters/aws/sns.adapter.js.map +1 -1
- package/lib/adapters/aws/sqs.adapter.d.ts +56 -0
- package/lib/adapters/aws/sqs.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/sqs.adapter.js +1 -1
- package/lib/adapters/aws/sqs.adapter.js.map +1 -1
- package/lib/adapters/azure/http-trigger-v4.adapter.d.ts +81 -0
- package/lib/adapters/azure/http-trigger-v4.adapter.d.ts.map +1 -0
- package/lib/adapters/azure/http-trigger-v4.adapter.js +1 -1
- package/lib/adapters/azure/http-trigger-v4.adapter.js.map +1 -1
- package/lib/adapters/azure/index.d.ts +2 -0
- package/lib/adapters/azure/index.d.ts.map +1 -0
- package/lib/adapters/azure/index.js +1 -1
- package/lib/adapters/azure/index.js.map +1 -1
- package/lib/adapters/digital-ocean/http-function.adapter.d.ts +65 -0
- package/lib/adapters/digital-ocean/http-function.adapter.d.ts.map +1 -0
- package/lib/adapters/digital-ocean/http-function.adapter.js +1 -1
- package/lib/adapters/digital-ocean/http-function.adapter.js.map +1 -1
- package/lib/adapters/digital-ocean/index.d.ts +2 -0
- package/lib/adapters/digital-ocean/index.d.ts.map +1 -0
- package/lib/adapters/digital-ocean/index.js +1 -1
- package/lib/adapters/digital-ocean/index.js.map +1 -1
- package/lib/adapters/dummy/dummy.adapter.d.ts +31 -0
- package/lib/adapters/dummy/dummy.adapter.d.ts.map +1 -0
- package/lib/adapters/dummy/dummy.adapter.js +1 -1
- package/lib/adapters/dummy/dummy.adapter.js.map +1 -1
- package/lib/adapters/dummy/index.d.ts +2 -0
- package/lib/adapters/dummy/index.d.ts.map +1 -0
- package/lib/adapters/dummy/index.js +1 -1
- package/lib/adapters/dummy/index.js.map +1 -1
- package/lib/adapters/huawei/huawei-api-gateway.adapter.d.ts +66 -0
- package/lib/adapters/huawei/huawei-api-gateway.adapter.d.ts.map +1 -0
- package/lib/adapters/huawei/huawei-api-gateway.adapter.js +1 -1
- package/lib/adapters/huawei/huawei-api-gateway.adapter.js.map +1 -1
- package/lib/adapters/huawei/index.d.ts +2 -0
- package/lib/adapters/huawei/index.d.ts.map +1 -0
- package/lib/adapters/huawei/index.js +1 -1
- package/lib/adapters/huawei/index.js.map +1 -1
- package/lib/contracts/adapter.contract.d.ts +152 -0
- package/lib/contracts/adapter.contract.d.ts.map +1 -0
- package/lib/contracts/adapter.contract.js +1 -1
- package/lib/contracts/adapter.contract.js.map +1 -1
- package/lib/contracts/framework.contract.d.ts +19 -0
- package/lib/contracts/framework.contract.d.ts.map +1 -0
- package/lib/contracts/framework.contract.js +1 -1
- package/lib/contracts/framework.contract.js.map +1 -1
- package/lib/contracts/handler.contract.d.ts +25 -0
- package/lib/contracts/handler.contract.d.ts.map +1 -0
- package/lib/contracts/handler.contract.js +1 -1
- package/lib/contracts/handler.contract.js.map +1 -1
- package/lib/contracts/index.d.ts +5 -0
- package/lib/contracts/index.d.ts.map +1 -0
- package/lib/contracts/index.js +1 -1
- package/lib/contracts/index.js.map +1 -1
- package/lib/contracts/resolver.contract.d.ts +83 -0
- package/lib/contracts/resolver.contract.d.ts.map +1 -0
- package/lib/contracts/resolver.contract.js +1 -1
- package/lib/contracts/resolver.contract.js.map +1 -1
- package/lib/core/base-handler.d.ts +32 -0
- package/lib/core/base-handler.d.ts.map +1 -0
- package/lib/core/base-handler.js +1 -1
- package/lib/core/base-handler.js.map +1 -1
- package/lib/core/constants.d.ts +31 -0
- package/lib/core/constants.d.ts.map +1 -0
- package/lib/core/constants.js +1 -1
- package/lib/core/constants.js.map +1 -1
- package/lib/core/current-invoke.d.ts +48 -0
- package/lib/core/current-invoke.d.ts.map +1 -0
- package/lib/core/current-invoke.js +1 -1
- package/lib/core/current-invoke.js.map +1 -1
- package/lib/core/event-body.d.ts +22 -0
- package/lib/core/event-body.d.ts.map +1 -0
- package/lib/core/event-body.js +1 -1
- package/lib/core/event-body.js.map +1 -1
- package/lib/core/headers.d.ts +73 -0
- package/lib/core/headers.d.ts.map +1 -0
- package/lib/core/headers.js +2 -2
- package/lib/core/headers.js.map +1 -1
- package/lib/core/index.d.ts +12 -0
- package/lib/core/index.d.ts.map +1 -0
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/is-binary.d.ts +73 -0
- package/lib/core/is-binary.d.ts.map +1 -0
- package/lib/core/is-binary.js +1 -1
- package/lib/core/is-binary.js.map +1 -1
- package/lib/core/logger.d.ts +64 -0
- package/lib/core/logger.d.ts.map +1 -0
- package/lib/core/logger.js +1 -1
- package/lib/core/logger.js.map +1 -1
- package/lib/core/no-op.d.ts +8 -0
- package/lib/core/no-op.d.ts.map +1 -0
- package/lib/core/no-op.js +1 -1
- package/lib/core/no-op.js.map +1 -1
- package/lib/core/optional.d.ts +22 -0
- package/lib/core/optional.d.ts.map +1 -0
- package/lib/core/optional.js +1 -1
- package/lib/core/optional.js.map +1 -1
- package/lib/core/path.d.ts +53 -0
- package/lib/core/path.d.ts.map +1 -0
- package/lib/core/path.js +1 -1
- package/lib/core/path.js.map +1 -1
- package/lib/core/stream.d.ts +21 -0
- package/lib/core/stream.d.ts.map +1 -0
- package/lib/core/stream.js +1 -1
- package/lib/core/stream.js.map +1 -1
- package/lib/frameworks/apollo-server/apollo-server.framework.d.ts +69 -0
- package/lib/frameworks/apollo-server/apollo-server.framework.d.ts.map +1 -0
- package/lib/frameworks/apollo-server/apollo-server.framework.js +1 -1
- package/lib/frameworks/apollo-server/apollo-server.framework.js.map +1 -1
- package/lib/frameworks/apollo-server/index.d.ts +2 -0
- package/lib/frameworks/apollo-server/index.d.ts.map +1 -0
- package/lib/frameworks/apollo-server/index.js +1 -1
- package/lib/frameworks/apollo-server/index.js.map +1 -1
- package/lib/frameworks/body-parser/base-body-parser.framework.d.ts +69 -0
- package/lib/frameworks/body-parser/base-body-parser.framework.d.ts.map +1 -0
- package/lib/frameworks/body-parser/base-body-parser.framework.js +1 -1
- package/lib/frameworks/body-parser/base-body-parser.framework.js.map +1 -1
- package/lib/frameworks/body-parser/index.d.ts +6 -0
- package/lib/frameworks/body-parser/index.d.ts.map +1 -0
- package/lib/frameworks/body-parser/index.js +1 -1
- package/lib/frameworks/body-parser/index.js.map +1 -1
- package/lib/frameworks/body-parser/json-body-parser.framework.d.ts +26 -0
- package/lib/frameworks/body-parser/json-body-parser.framework.d.ts.map +1 -0
- package/lib/frameworks/body-parser/json-body-parser.framework.js +1 -1
- package/lib/frameworks/body-parser/json-body-parser.framework.js.map +1 -1
- package/lib/frameworks/body-parser/raw-body-parser.framework.d.ts +26 -0
- package/lib/frameworks/body-parser/raw-body-parser.framework.d.ts.map +1 -0
- package/lib/frameworks/body-parser/raw-body-parser.framework.js +1 -1
- package/lib/frameworks/body-parser/raw-body-parser.framework.js.map +1 -1
- package/lib/frameworks/body-parser/text-body-parser.framework.d.ts +26 -0
- package/lib/frameworks/body-parser/text-body-parser.framework.d.ts.map +1 -0
- package/lib/frameworks/body-parser/text-body-parser.framework.js +1 -1
- package/lib/frameworks/body-parser/text-body-parser.framework.js.map +1 -1
- package/lib/frameworks/body-parser/urlencoded-body-parser.framework.d.ts +26 -0
- package/lib/frameworks/body-parser/urlencoded-body-parser.framework.d.ts.map +1 -0
- package/lib/frameworks/body-parser/urlencoded-body-parser.framework.js +1 -1
- package/lib/frameworks/body-parser/urlencoded-body-parser.framework.js.map +1 -1
- package/lib/frameworks/cors/cors.framework.d.ts +78 -0
- package/lib/frameworks/cors/cors.framework.d.ts.map +1 -0
- package/lib/frameworks/cors/cors.framework.js +2 -2
- package/lib/frameworks/cors/cors.framework.js.map +1 -1
- package/lib/frameworks/cors/index.d.ts +2 -0
- package/lib/frameworks/cors/index.d.ts.map +1 -0
- package/lib/frameworks/cors/index.js +1 -1
- package/lib/frameworks/cors/index.js.map +1 -1
- package/lib/frameworks/deepkit/http-deepkit.framework.d.ts +18 -0
- package/lib/frameworks/deepkit/http-deepkit.framework.d.ts.map +1 -0
- package/lib/frameworks/deepkit/http-deepkit.framework.js +1 -1
- package/lib/frameworks/deepkit/http-deepkit.framework.js.map +1 -1
- package/lib/frameworks/deepkit/index.d.ts +2 -0
- package/lib/frameworks/deepkit/index.d.ts.map +1 -0
- package/lib/frameworks/deepkit/index.js +1 -1
- package/lib/frameworks/deepkit/index.js.map +1 -1
- package/lib/frameworks/express/express.framework.d.ts +17 -0
- package/lib/frameworks/express/express.framework.d.ts.map +1 -0
- package/lib/frameworks/express/express.framework.js +1 -1
- package/lib/frameworks/express/express.framework.js.map +1 -1
- package/lib/frameworks/express/index.d.ts +2 -0
- package/lib/frameworks/express/index.d.ts.map +1 -0
- package/lib/frameworks/express/index.js +1 -1
- package/lib/frameworks/express/index.js.map +1 -1
- package/lib/frameworks/fastify/fastify.framework.d.ts +17 -0
- package/lib/frameworks/fastify/fastify.framework.d.ts.map +1 -0
- package/lib/frameworks/fastify/fastify.framework.js +1 -1
- package/lib/frameworks/fastify/fastify.framework.js.map +1 -1
- package/lib/frameworks/fastify/helpers/no-op-content-parser.d.ts +14 -0
- package/lib/frameworks/fastify/helpers/no-op-content-parser.d.ts.map +1 -0
- package/lib/frameworks/fastify/helpers/no-op-content-parser.js +1 -1
- package/lib/frameworks/fastify/helpers/no-op-content-parser.js.map +1 -1
- package/lib/frameworks/fastify/index.d.ts +2 -0
- package/lib/frameworks/fastify/index.d.ts.map +1 -0
- package/lib/frameworks/fastify/index.js +1 -1
- package/lib/frameworks/fastify/index.js.map +1 -1
- package/lib/frameworks/hapi/hapi.framework.d.ts +17 -0
- package/lib/frameworks/hapi/hapi.framework.d.ts.map +1 -0
- package/lib/frameworks/hapi/hapi.framework.js +1 -1
- package/lib/frameworks/hapi/hapi.framework.js.map +1 -1
- package/lib/frameworks/hapi/index.d.ts +2 -0
- package/lib/frameworks/hapi/index.d.ts.map +1 -0
- package/lib/frameworks/hapi/index.js +1 -1
- package/lib/frameworks/hapi/index.js.map +1 -1
- package/lib/frameworks/koa/index.d.ts +2 -0
- package/lib/frameworks/koa/index.d.ts.map +1 -0
- package/lib/frameworks/koa/index.js +1 -1
- package/lib/frameworks/koa/index.js.map +1 -1
- package/lib/frameworks/koa/koa.framework.d.ts +17 -0
- package/lib/frameworks/koa/koa.framework.d.ts.map +1 -0
- package/lib/frameworks/koa/koa.framework.js +1 -1
- package/lib/frameworks/koa/koa.framework.js.map +1 -1
- package/lib/frameworks/lazy/index.d.ts +2 -0
- package/lib/frameworks/lazy/index.d.ts.map +1 -0
- package/lib/frameworks/lazy/index.js +1 -1
- package/lib/frameworks/lazy/index.js.map +1 -1
- package/lib/frameworks/lazy/lazy.framework.d.ts +56 -0
- package/lib/frameworks/lazy/lazy.framework.d.ts.map +1 -0
- package/lib/frameworks/lazy/lazy.framework.js +1 -1
- package/lib/frameworks/lazy/lazy.framework.js.map +1 -1
- package/lib/frameworks/trpc/index.d.ts +2 -0
- package/lib/frameworks/trpc/index.d.ts.map +1 -0
- package/lib/frameworks/trpc/index.js +1 -1
- package/lib/frameworks/trpc/index.js.map +1 -1
- package/lib/frameworks/trpc/trpc.framework.d.ts +153 -0
- package/lib/frameworks/trpc/trpc.framework.d.ts.map +1 -0
- package/lib/frameworks/trpc/trpc.framework.js +1 -1
- package/lib/frameworks/trpc/trpc.framework.js.map +1 -1
- package/lib/handlers/aws/aws-stream.handler.d.ts +89 -0
- package/lib/handlers/aws/aws-stream.handler.d.ts.map +1 -0
- package/lib/handlers/aws/aws-stream.handler.js +1 -1
- package/lib/handlers/aws/aws-stream.handler.js.map +1 -1
- package/lib/handlers/aws/index.d.ts +2 -0
- package/lib/handlers/aws/index.d.ts.map +1 -0
- package/lib/handlers/aws/index.js +1 -1
- package/lib/handlers/aws/index.js.map +1 -1
- package/lib/handlers/azure/azure.handler.d.ts +45 -0
- package/lib/handlers/azure/azure.handler.d.ts.map +1 -0
- package/lib/handlers/azure/azure.handler.js +1 -1
- package/lib/handlers/azure/azure.handler.js.map +1 -1
- package/lib/handlers/azure/index.d.ts +2 -0
- package/lib/handlers/azure/index.d.ts.map +1 -0
- package/lib/handlers/azure/index.js +1 -1
- package/lib/handlers/azure/index.js.map +1 -1
- package/lib/handlers/base/index.d.ts +2 -0
- package/lib/handlers/base/index.d.ts.map +1 -0
- package/lib/handlers/base/index.js +1 -1
- package/lib/handlers/base/index.js.map +1 -1
- package/lib/handlers/base/raw-request.d.ts +31 -0
- package/lib/handlers/base/raw-request.d.ts.map +1 -0
- package/lib/handlers/base/raw-request.js +1 -1
- package/lib/handlers/base/raw-request.js.map +1 -1
- package/lib/handlers/default/default.handler.d.ts +88 -0
- package/lib/handlers/default/default.handler.d.ts.map +1 -0
- package/lib/handlers/default/default.handler.js +1 -1
- package/lib/handlers/default/default.handler.js.map +1 -1
- package/lib/handlers/default/index.d.ts +2 -0
- package/lib/handlers/default/index.d.ts.map +1 -0
- package/lib/handlers/default/index.js +1 -1
- package/lib/handlers/default/index.js.map +1 -1
- package/lib/handlers/digital-ocean/digital-ocean.handler.d.ts +17 -0
- package/lib/handlers/digital-ocean/digital-ocean.handler.d.ts.map +1 -0
- package/lib/handlers/digital-ocean/digital-ocean.handler.js +1 -1
- package/lib/handlers/digital-ocean/digital-ocean.handler.js.map +1 -1
- package/lib/handlers/digital-ocean/index.d.ts +2 -0
- package/lib/handlers/digital-ocean/index.d.ts.map +1 -0
- package/lib/handlers/digital-ocean/index.js +1 -1
- package/lib/handlers/digital-ocean/index.js.map +1 -1
- package/lib/handlers/firebase/http-firebase-v2.handler.d.ts +27 -0
- package/lib/handlers/firebase/http-firebase-v2.handler.d.ts.map +1 -0
- package/lib/handlers/firebase/http-firebase-v2.handler.js +1 -1
- package/lib/handlers/firebase/http-firebase-v2.handler.js.map +1 -1
- package/lib/handlers/firebase/http-firebase.handler.d.ts +19 -0
- package/lib/handlers/firebase/http-firebase.handler.d.ts.map +1 -0
- package/lib/handlers/firebase/http-firebase.handler.js +1 -1
- package/lib/handlers/firebase/http-firebase.handler.js.map +1 -1
- package/lib/handlers/firebase/index.d.ts +3 -0
- package/lib/handlers/firebase/index.d.ts.map +1 -0
- package/lib/handlers/firebase/index.js +1 -1
- package/lib/handlers/firebase/index.js.map +1 -1
- package/lib/handlers/gcp/gcp.handler.d.ts +26 -0
- package/lib/handlers/gcp/gcp.handler.d.ts.map +1 -0
- package/lib/handlers/gcp/gcp.handler.js +1 -1
- package/lib/handlers/gcp/gcp.handler.js.map +1 -1
- package/lib/handlers/gcp/index.d.ts +2 -0
- package/lib/handlers/gcp/index.d.ts.map +1 -0
- package/lib/handlers/gcp/index.js +1 -1
- package/lib/handlers/gcp/index.js.map +1 -1
- package/lib/handlers/huawei/http-huawei.handler.d.ts +59 -0
- package/lib/handlers/huawei/http-huawei.handler.d.ts.map +1 -0
- package/lib/handlers/huawei/http-huawei.handler.js +1 -1
- package/lib/handlers/huawei/http-huawei.handler.js.map +1 -1
- package/lib/handlers/huawei/index.d.ts +2 -0
- package/lib/handlers/huawei/index.d.ts.map +1 -0
- package/lib/handlers/huawei/index.js +1 -1
- package/lib/handlers/huawei/index.js.map +1 -1
- package/lib/index.d.ts +6 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.doc.js +1 -1
- package/lib/index.doc.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/network/index.d.ts +5 -0
- package/lib/network/index.d.ts.map +1 -0
- package/lib/network/index.js +1 -1
- package/lib/network/index.js.map +1 -1
- package/lib/network/request.d.ts +44 -0
- package/lib/network/request.d.ts.map +1 -0
- package/lib/network/request.js +1 -1
- package/lib/network/request.js.map +1 -1
- package/lib/network/response-stream.d.ts +41 -0
- package/lib/network/response-stream.d.ts.map +1 -0
- package/lib/network/response-stream.js +4 -4
- package/lib/network/response-stream.js.map +1 -1
- package/lib/network/response.d.ts +48 -0
- package/lib/network/response.d.ts.map +1 -0
- package/lib/network/response.js +2 -2
- package/lib/network/response.js.map +1 -1
- package/lib/network/utils.d.ts +9 -0
- package/lib/network/utils.d.ts.map +1 -0
- package/lib/network/utils.js +1 -1
- package/lib/network/utils.js.map +1 -1
- package/lib/resolvers/aws-context/aws-context.resolver.d.ts +19 -0
- package/lib/resolvers/aws-context/aws-context.resolver.d.ts.map +1 -0
- package/lib/resolvers/aws-context/aws-context.resolver.js +1 -1
- package/lib/resolvers/aws-context/aws-context.resolver.js.map +1 -1
- package/lib/resolvers/aws-context/index.d.ts +2 -0
- package/lib/resolvers/aws-context/index.d.ts.map +1 -0
- package/lib/resolvers/aws-context/index.js +1 -1
- package/lib/resolvers/aws-context/index.js.map +1 -1
- package/lib/resolvers/callback/callback.resolver.d.ts +23 -0
- package/lib/resolvers/callback/callback.resolver.d.ts.map +1 -0
- package/lib/resolvers/callback/callback.resolver.js +1 -1
- package/lib/resolvers/callback/callback.resolver.js.map +1 -1
- package/lib/resolvers/callback/index.d.ts +2 -0
- package/lib/resolvers/callback/index.d.ts.map +1 -0
- package/lib/resolvers/callback/index.js +1 -1
- package/lib/resolvers/callback/index.js.map +1 -1
- package/lib/resolvers/dummy/dummy.resolver.d.ts +14 -0
- package/lib/resolvers/dummy/dummy.resolver.d.ts.map +1 -0
- package/lib/resolvers/dummy/dummy.resolver.js +1 -1
- package/lib/resolvers/dummy/dummy.resolver.js.map +1 -1
- package/lib/resolvers/dummy/index.d.ts +2 -0
- package/lib/resolvers/dummy/index.d.ts.map +1 -0
- package/lib/resolvers/dummy/index.js +1 -1
- package/lib/resolvers/dummy/index.js.map +1 -1
- package/lib/resolvers/promise/index.d.ts +2 -0
- package/lib/resolvers/promise/index.d.ts.map +1 -0
- package/lib/resolvers/promise/index.js +1 -1
- package/lib/resolvers/promise/index.js.map +1 -1
- package/lib/resolvers/promise/promise.resolver.d.ts +14 -0
- package/lib/resolvers/promise/promise.resolver.d.ts.map +1 -0
- package/lib/resolvers/promise/promise.resolver.js +1 -1
- package/lib/resolvers/promise/promise.resolver.js.map +1 -1
- package/lib/serverless-adapter.d.ts +119 -0
- package/lib/serverless-adapter.d.ts.map +1 -0
- package/lib/serverless-adapter.js +1 -1
- package/lib/serverless-adapter.js.map +1 -1
- package/package.json +47 -54
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { BothValueHeaders, SingleValueHeaders } from '../@types';
|
|
3
|
+
import { ILogger } from '../core';
|
|
4
|
+
import { ServerlessResponse } from '../network';
|
|
5
|
+
import { DelegatedResolver } from './resolver.contract';
|
|
6
|
+
/**
|
|
7
|
+
* The request interface used to bridge any event source to the framework.
|
|
8
|
+
*
|
|
9
|
+
* @breadcrumb Contracts / AdapterContract
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export interface AdapterRequest {
|
|
13
|
+
/**
|
|
14
|
+
* The HTTP Method to use to create the request to the framework
|
|
15
|
+
*/
|
|
16
|
+
method: string;
|
|
17
|
+
/**
|
|
18
|
+
* The path to use to create the request to the framework
|
|
19
|
+
*/
|
|
20
|
+
path: string;
|
|
21
|
+
/**
|
|
22
|
+
* The headers to use to create the request to the framework
|
|
23
|
+
*/
|
|
24
|
+
headers: SingleValueHeaders;
|
|
25
|
+
/**
|
|
26
|
+
* The body as buffer to use to create the request to the framework
|
|
27
|
+
*/
|
|
28
|
+
body?: Buffer;
|
|
29
|
+
/**
|
|
30
|
+
* The remote address (client ip) to use to create the request to the framework
|
|
31
|
+
*/
|
|
32
|
+
remoteAddress?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The address of the event source (used in Lambda\@edge)
|
|
35
|
+
*
|
|
36
|
+
* @deprecated It is no longer used in the library and will be removed in the next major release.
|
|
37
|
+
*/
|
|
38
|
+
host?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The address of the event source (used in Lambda\@edge)
|
|
41
|
+
*
|
|
42
|
+
* @deprecated It is no longer used in the library and will be removed in the next major release.
|
|
43
|
+
*/
|
|
44
|
+
hostname?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The props of the method that get the response from the framework and transform it into a format that the event source can handle
|
|
48
|
+
*
|
|
49
|
+
* @breadcrumb Contracts / AdapterContract
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export interface GetResponseAdapterProps<TEvent> {
|
|
53
|
+
/**
|
|
54
|
+
* The event sent by the serverless
|
|
55
|
+
*/
|
|
56
|
+
event: TEvent;
|
|
57
|
+
/**
|
|
58
|
+
* The framework {@link ServerlessResponse | response}.
|
|
59
|
+
*
|
|
60
|
+
* @remarks It can be optional, as this method can be used when an error occurs during the handling of the request by the framework.
|
|
61
|
+
*/
|
|
62
|
+
response?: ServerlessResponse;
|
|
63
|
+
/**
|
|
64
|
+
* The framework response status code
|
|
65
|
+
*/
|
|
66
|
+
statusCode: number;
|
|
67
|
+
/**
|
|
68
|
+
* The framework response body
|
|
69
|
+
*/
|
|
70
|
+
body: string;
|
|
71
|
+
/**
|
|
72
|
+
* The framework response headers
|
|
73
|
+
*/
|
|
74
|
+
headers: BothValueHeaders;
|
|
75
|
+
/**
|
|
76
|
+
* Indicates whether the response is base64 encoded or not
|
|
77
|
+
*/
|
|
78
|
+
isBase64Encoded: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* The instance of the logger
|
|
81
|
+
*/
|
|
82
|
+
log: ILogger;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The props of the method that handle the response when an error occurs while forwarding the request to the framework
|
|
86
|
+
*
|
|
87
|
+
* @breadcrumb Contracts / AdapterContract
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
90
|
+
export interface OnErrorProps<TEvent, TResponse> {
|
|
91
|
+
/**
|
|
92
|
+
* The event sent by the serverless
|
|
93
|
+
*/
|
|
94
|
+
event: TEvent;
|
|
95
|
+
/**
|
|
96
|
+
* The error throwed during forwarding
|
|
97
|
+
*/
|
|
98
|
+
error: Error;
|
|
99
|
+
/**
|
|
100
|
+
* The instance of the resolver
|
|
101
|
+
*/
|
|
102
|
+
delegatedResolver: DelegatedResolver<TResponse>;
|
|
103
|
+
/**
|
|
104
|
+
* Indicates whether to forward the (error.stack) or not to the client
|
|
105
|
+
*/
|
|
106
|
+
respondWithErrors: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* The instance of the logger
|
|
109
|
+
*/
|
|
110
|
+
log: ILogger;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The interface that represents a contract between the adapter and the actual implementation of the adapter.
|
|
114
|
+
*
|
|
115
|
+
* @breadcrumb Contracts / AdapterContract
|
|
116
|
+
* @public
|
|
117
|
+
*/
|
|
118
|
+
export interface AdapterContract<TEvent, TContext, TResponse> {
|
|
119
|
+
/**
|
|
120
|
+
* Get the adapter name
|
|
121
|
+
*/
|
|
122
|
+
getAdapterName(): string;
|
|
123
|
+
/**
|
|
124
|
+
* Decide if this adapter can handle a request based in the event payload
|
|
125
|
+
*
|
|
126
|
+
* @param event - The event sent by serverless
|
|
127
|
+
* @param context - The context sent by the serverless
|
|
128
|
+
* @param log - The instance of logger
|
|
129
|
+
*/
|
|
130
|
+
canHandle(event: unknown, context: TContext, log: ILogger): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Maps the serverless payload to an actual request that a framework can handle
|
|
133
|
+
*
|
|
134
|
+
* @param event - The event sent by serverless
|
|
135
|
+
* @param context - The context sent by the serverless
|
|
136
|
+
* @param log - The instance of logger
|
|
137
|
+
*/
|
|
138
|
+
getRequest(event: TEvent, context: TContext, log: ILogger): AdapterRequest;
|
|
139
|
+
/**
|
|
140
|
+
* Maps the response of the framework to a payload that serverless can handle
|
|
141
|
+
*
|
|
142
|
+
* @param props - The props sent by serverless
|
|
143
|
+
*/
|
|
144
|
+
getResponse(props: GetResponseAdapterProps<TEvent>): TResponse;
|
|
145
|
+
/**
|
|
146
|
+
* When an error occurs while forwarding the request to the framework
|
|
147
|
+
*
|
|
148
|
+
* @remarks You must call resolver.fail or resolver.succeed when implementing this method.
|
|
149
|
+
*/
|
|
150
|
+
onErrorWhileForwarding(props: OnErrorProps<TEvent, TResponse>): void;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=adapter.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.contract.d.ts","sourceRoot":"","sources":["../../src/contracts/adapter.contract.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIxD;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,EAAE,kBAAkB,CAAC;IAE5B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB,CAAC,MAAM;IAC7C;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAE9B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,EAAE,gBAAgB,CAAC;IAE1B;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IAEzB;;OAEG;IACH,GAAG,EAAE,OAAO,CAAC;CACd;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY,CAAC,MAAM,EAAE,SAAS;IAC7C;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC;IAEb;;OAEG;IACH,iBAAiB,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAEhD;;OAEG;IACH,iBAAiB,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,GAAG,EAAE,OAAO,CAAC;CACd;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS;IAC1D;;OAEG;IACH,cAAc,IAAI,MAAM,CAAC;IAEzB;;;;;;OAMG;IACH,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC;IAEpE;;;;;;OAMG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,GAAG,cAAc,CAAC;IAE3E;;;;OAIG;IACH,WAAW,CAAC,KAAK,EAAE,uBAAuB,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAE/D;;;;OAIG;IACH,sBAAsB,CAAC,KAAK,EAAE,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC;CACtE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),adapter_contract_exports={};module.exports=__toCommonJS(adapter_contract_exports);
|
|
2
2
|
//# sourceMappingURL=adapter.contract.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.contract.js","sources":["../../src/contracts/adapter.contract.ts"],"sourcesContent":["//#region Imports\n\nimport { BothValueHeaders, SingleValueHeaders } from '../@types';\nimport { ILogger } from '../core';\nimport { ServerlessResponse } from '../network';\nimport { DelegatedResolver } from './resolver.contract';\n\n//#endregion\n\n/**\n * The request interface used to bridge any event source to the framework.\n *\n * @breadcrumb Contracts / AdapterContract\n * @public\n */\nexport interface AdapterRequest {\n /**\n * The HTTP Method to use to create the request to the framework\n */\n method: string;\n\n /**\n * The path to use to create the request to the framework\n */\n path: string;\n\n /**\n * The headers to use to create the request to the framework\n */\n headers: SingleValueHeaders;\n\n /**\n * The body as buffer to use to create the request to the framework\n */\n body?: Buffer;\n\n /**\n * The remote address (client ip) to use to create the request to the framework\n */\n remoteAddress?: string;\n\n /**\n * The address of the event source (used in Lambda\\@edge)\n *\n * @deprecated It is no longer used in the library and will be removed in the next major release.\n */\n host?: string;\n\n /**\n * The address of the event source (used in Lambda\\@edge)\n *\n * @deprecated It is no longer used in the library and will be removed in the next major release.\n */\n hostname?: string;\n}\n\n/**\n * The props of the method that get the response from the framework and transform it into a format that the event source can handle\n *\n * @breadcrumb Contracts / AdapterContract\n * @public\n */\nexport interface GetResponseAdapterProps<TEvent> {\n /**\n * The event sent by the serverless\n */\n event: TEvent;\n\n /**\n * The framework {@link ServerlessResponse | response}.\n *\n * @remarks It can be optional, as this method can be used when an error occurs during the handling of the request by the framework.\n */\n response?: ServerlessResponse;\n\n /**\n * The framework response status code\n */\n statusCode: number;\n\n /**\n * The framework response body\n */\n body: string;\n\n /**\n * The framework response headers\n */\n headers: BothValueHeaders;\n\n /**\n * Indicates whether the response is base64 encoded or not\n */\n isBase64Encoded: boolean;\n\n /**\n * The instance of the logger\n */\n log: ILogger;\n}\n\n/**\n * The props of the method that handle the response when an error occurs while forwarding the request to the framework\n *\n * @breadcrumb Contracts / AdapterContract\n * @public\n */\nexport interface OnErrorProps<TEvent, TResponse> {\n /**\n * The event sent by the serverless\n */\n event: TEvent;\n\n /**\n * The error throwed during forwarding\n */\n error: Error;\n\n /**\n * The instance of the resolver\n */\n delegatedResolver: DelegatedResolver<TResponse>;\n\n /**\n * Indicates whether to forward the (error.stack) or not to the client\n */\n respondWithErrors: boolean;\n\n /**\n * The instance of the logger\n */\n log: ILogger;\n}\n\n/**\n * The interface that represents a contract between the adapter and the actual implementation of the adapter.\n *\n * @breadcrumb Contracts / AdapterContract\n * @public\n */\nexport interface AdapterContract<TEvent, TContext, TResponse> {\n /**\n * Get the adapter name\n */\n getAdapterName(): string;\n\n /**\n * Decide if this adapter can handle a request based in the event payload\n *\n * @param event - The event sent by serverless\n * @param context - The context sent by the serverless\n * @param log - The instance of logger\n */\n canHandle(event: unknown, context: TContext, log: ILogger): boolean;\n\n /**\n * Maps the serverless payload to an actual request that a framework can handle\n *\n * @param event - The event sent by serverless\n * @param context - The context sent by the serverless\n * @param log - The instance of logger\n */\n getRequest(event: TEvent, context: TContext, log: ILogger): AdapterRequest;\n\n /**\n * Maps the response of the framework to a payload that serverless can handle\n *\n * @param props - The props sent by serverless\n */\n getResponse(props: GetResponseAdapterProps<TEvent>): TResponse;\n\n /**\n * When an error occurs while forwarding the request to the framework\n *\n * @remarks You must call resolver.fail or resolver.succeed when implementing this method.\n */\n onErrorWhileForwarding(props: OnErrorProps<TEvent, TResponse>): void;\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"adapter.contract.js","sources":["../../src/contracts/adapter.contract.ts"],"sourcesContent":["//#region Imports\n\nimport { BothValueHeaders, SingleValueHeaders } from '../@types';\nimport { ILogger } from '../core';\nimport { ServerlessResponse } from '../network';\nimport { DelegatedResolver } from './resolver.contract';\n\n//#endregion\n\n/**\n * The request interface used to bridge any event source to the framework.\n *\n * @breadcrumb Contracts / AdapterContract\n * @public\n */\nexport interface AdapterRequest {\n /**\n * The HTTP Method to use to create the request to the framework\n */\n method: string;\n\n /**\n * The path to use to create the request to the framework\n */\n path: string;\n\n /**\n * The headers to use to create the request to the framework\n */\n headers: SingleValueHeaders;\n\n /**\n * The body as buffer to use to create the request to the framework\n */\n body?: Buffer;\n\n /**\n * The remote address (client ip) to use to create the request to the framework\n */\n remoteAddress?: string;\n\n /**\n * The address of the event source (used in Lambda\\@edge)\n *\n * @deprecated It is no longer used in the library and will be removed in the next major release.\n */\n host?: string;\n\n /**\n * The address of the event source (used in Lambda\\@edge)\n *\n * @deprecated It is no longer used in the library and will be removed in the next major release.\n */\n hostname?: string;\n}\n\n/**\n * The props of the method that get the response from the framework and transform it into a format that the event source can handle\n *\n * @breadcrumb Contracts / AdapterContract\n * @public\n */\nexport interface GetResponseAdapterProps<TEvent> {\n /**\n * The event sent by the serverless\n */\n event: TEvent;\n\n /**\n * The framework {@link ServerlessResponse | response}.\n *\n * @remarks It can be optional, as this method can be used when an error occurs during the handling of the request by the framework.\n */\n response?: ServerlessResponse;\n\n /**\n * The framework response status code\n */\n statusCode: number;\n\n /**\n * The framework response body\n */\n body: string;\n\n /**\n * The framework response headers\n */\n headers: BothValueHeaders;\n\n /**\n * Indicates whether the response is base64 encoded or not\n */\n isBase64Encoded: boolean;\n\n /**\n * The instance of the logger\n */\n log: ILogger;\n}\n\n/**\n * The props of the method that handle the response when an error occurs while forwarding the request to the framework\n *\n * @breadcrumb Contracts / AdapterContract\n * @public\n */\nexport interface OnErrorProps<TEvent, TResponse> {\n /**\n * The event sent by the serverless\n */\n event: TEvent;\n\n /**\n * The error throwed during forwarding\n */\n error: Error;\n\n /**\n * The instance of the resolver\n */\n delegatedResolver: DelegatedResolver<TResponse>;\n\n /**\n * Indicates whether to forward the (error.stack) or not to the client\n */\n respondWithErrors: boolean;\n\n /**\n * The instance of the logger\n */\n log: ILogger;\n}\n\n/**\n * The interface that represents a contract between the adapter and the actual implementation of the adapter.\n *\n * @breadcrumb Contracts / AdapterContract\n * @public\n */\nexport interface AdapterContract<TEvent, TContext, TResponse> {\n /**\n * Get the adapter name\n */\n getAdapterName(): string;\n\n /**\n * Decide if this adapter can handle a request based in the event payload\n *\n * @param event - The event sent by serverless\n * @param context - The context sent by the serverless\n * @param log - The instance of logger\n */\n canHandle(event: unknown, context: TContext, log: ILogger): boolean;\n\n /**\n * Maps the serverless payload to an actual request that a framework can handle\n *\n * @param event - The event sent by serverless\n * @param context - The context sent by the serverless\n * @param log - The instance of logger\n */\n getRequest(event: TEvent, context: TContext, log: ILogger): AdapterRequest;\n\n /**\n * Maps the response of the framework to a payload that serverless can handle\n *\n * @param props - The props sent by serverless\n */\n getResponse(props: GetResponseAdapterProps<TEvent>): TResponse;\n\n /**\n * When an error occurs while forwarding the request to the framework\n *\n * @remarks You must call resolver.fail or resolver.succeed when implementing this method.\n */\n onErrorWhileForwarding(props: OnErrorProps<TEvent, TResponse>): void;\n}\n"],"names":[],"mappings":"kiBAAA,yBAAA,CAAA,EAAA,OAAA,QAAA,aAAA,wBAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { IncomingMessage, ServerResponse } from 'http';
|
|
3
|
+
/**
|
|
4
|
+
* The interface that represents a contract between the framework and the framework implementation
|
|
5
|
+
*
|
|
6
|
+
* @breadcrumb Contracts
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export interface FrameworkContract<TApp> {
|
|
10
|
+
/**
|
|
11
|
+
* Send the request and response objects to the framework
|
|
12
|
+
*
|
|
13
|
+
* @param app - The instance of your app (Express, Fastify, Koa, etc...)
|
|
14
|
+
* @param request - The request object that will be forward to your app
|
|
15
|
+
* @param response - The response object that will be forward to your app to output the response
|
|
16
|
+
*/
|
|
17
|
+
sendRequest(app: TApp, request: IncomingMessage, response: ServerResponse): void;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=framework.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework.contract.d.ts","sourceRoot":"","sources":["../../src/contracts/framework.contract.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAIvD;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB,CAAC,IAAI;IACrC;;;;;;OAMG;IACH,WAAW,CACT,GAAG,EAAE,IAAI,EACT,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,cAAc,GACvB,IAAI,CAAC;CACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),framework_contract_exports={};module.exports=__toCommonJS(framework_contract_exports);
|
|
2
2
|
//# sourceMappingURL=framework.contract.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework.contract.js","sources":["../../src/contracts/framework.contract.ts"],"sourcesContent":["//#region Imports\n\nimport { IncomingMessage, ServerResponse } from 'http';\n\n//#endregion\n\n/**\n * The interface that represents a contract between the framework and the framework implementation\n *\n * @breadcrumb Contracts\n * @public\n */\nexport interface FrameworkContract<TApp> {\n /**\n * Send the request and response objects to the framework\n *\n * @param app - The instance of your app (Express, Fastify, Koa, etc...)\n * @param request - The request object that will be forward to your app\n * @param response - The response object that will be forward to your app to output the response\n */\n sendRequest(\n app: TApp,\n request: IncomingMessage,\n response: ServerResponse,\n ): void;\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"framework.contract.js","sources":["../../src/contracts/framework.contract.ts"],"sourcesContent":["//#region Imports\n\nimport { IncomingMessage, ServerResponse } from 'http';\n\n//#endregion\n\n/**\n * The interface that represents a contract between the framework and the framework implementation\n *\n * @breadcrumb Contracts\n * @public\n */\nexport interface FrameworkContract<TApp> {\n /**\n * Send the request and response objects to the framework\n *\n * @param app - The instance of your app (Express, Fastify, Koa, etc...)\n * @param request - The request object that will be forward to your app\n * @param response - The response object that will be forward to your app to output the response\n */\n sendRequest(\n app: TApp,\n request: IncomingMessage,\n response: ServerResponse,\n ): void;\n}\n"],"names":[],"mappings":"kiBAAA,2BAAA,CAAA,EAAA,OAAA,QAAA,aAAA,0BAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BinarySettings } from '../@types';
|
|
2
|
+
import { ILogger } from '../core';
|
|
3
|
+
import { AdapterContract } from './adapter.contract';
|
|
4
|
+
import { FrameworkContract } from './framework.contract';
|
|
5
|
+
import { ResolverContract } from './resolver.contract';
|
|
6
|
+
/**
|
|
7
|
+
* The function used to handle serverless requests
|
|
8
|
+
*
|
|
9
|
+
* @breadcrumb Contracts / HandlerContract
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export type ServerlessHandler<TReturn> = (...args: any[]) => TReturn;
|
|
13
|
+
/**
|
|
14
|
+
* The interface that represents the contract between the handler and the real implementation
|
|
15
|
+
*
|
|
16
|
+
* @breadcrumb Contracts / HandlerContract
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export interface HandlerContract<TApp, TEvent, TContext, TCallback, TResponse, TReturn> {
|
|
20
|
+
/**
|
|
21
|
+
* Get the handler that will handle serverless requests
|
|
22
|
+
*/
|
|
23
|
+
getHandler(app: TApp, framework: FrameworkContract<TApp>, adapters: AdapterContract<TEvent, TContext, TResponse>[], resolverFactory: ResolverContract<TEvent, TContext, TCallback, TResponse, TReturn>, binarySettings: BinarySettings, respondWithErrors: boolean, log: ILogger): ServerlessHandler<TReturn>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=handler.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.contract.d.ts","sourceRoot":"","sources":["../../src/contracts/handler.contract.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvD;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,CAAC,OAAO,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;AAErE;;;;;GAKG;AACH,MAAM,WAAW,eAAe,CAC9B,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO;IAEP;;OAEG;IACH,UAAU,CACR,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAClC,QAAQ,EAAE,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,EACxD,eAAe,EAAE,gBAAgB,CAC/B,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,CACR,EACD,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,OAAO,EAC1B,GAAG,EAAE,OAAO,GACX,iBAAiB,CAAC,OAAO,CAAC,CAAC;CAC/B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),handler_contract_exports={};module.exports=__toCommonJS(handler_contract_exports);
|
|
2
2
|
//# sourceMappingURL=handler.contract.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.contract.js","sources":["../../src/contracts/handler.contract.ts"],"sourcesContent":["//#region Imports\n\nimport { BinarySettings } from '../@types';\nimport { ILogger } from '../core';\nimport { AdapterContract } from './adapter.contract';\nimport { FrameworkContract } from './framework.contract';\nimport { ResolverContract } from './resolver.contract';\n\n//#endregion\n\n/**\n * The function used to handle serverless requests\n *\n * @breadcrumb Contracts / HandlerContract\n * @public\n */\nexport type ServerlessHandler<TReturn> = (...args: any[]) => TReturn;\n\n/**\n * The interface that represents the contract between the handler and the real implementation\n *\n * @breadcrumb Contracts / HandlerContract\n * @public\n */\nexport interface HandlerContract<\n TApp,\n TEvent,\n TContext,\n TCallback,\n TResponse,\n TReturn,\n> {\n /**\n * Get the handler that will handle serverless requests\n */\n getHandler(\n app: TApp,\n framework: FrameworkContract<TApp>,\n adapters: AdapterContract<TEvent, TContext, TResponse>[],\n resolverFactory: ResolverContract<\n TEvent,\n TContext,\n TCallback,\n TResponse,\n TReturn\n >,\n binarySettings: BinarySettings,\n respondWithErrors: boolean,\n log: ILogger,\n ): ServerlessHandler<TReturn>;\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"handler.contract.js","sources":["../../src/contracts/handler.contract.ts"],"sourcesContent":["//#region Imports\n\nimport { BinarySettings } from '../@types';\nimport { ILogger } from '../core';\nimport { AdapterContract } from './adapter.contract';\nimport { FrameworkContract } from './framework.contract';\nimport { ResolverContract } from './resolver.contract';\n\n//#endregion\n\n/**\n * The function used to handle serverless requests\n *\n * @breadcrumb Contracts / HandlerContract\n * @public\n */\nexport type ServerlessHandler<TReturn> = (...args: any[]) => TReturn;\n\n/**\n * The interface that represents the contract between the handler and the real implementation\n *\n * @breadcrumb Contracts / HandlerContract\n * @public\n */\nexport interface HandlerContract<\n TApp,\n TEvent,\n TContext,\n TCallback,\n TResponse,\n TReturn,\n> {\n /**\n * Get the handler that will handle serverless requests\n */\n getHandler(\n app: TApp,\n framework: FrameworkContract<TApp>,\n adapters: AdapterContract<TEvent, TContext, TResponse>[],\n resolverFactory: ResolverContract<\n TEvent,\n TContext,\n TCallback,\n TResponse,\n TReturn\n >,\n binarySettings: BinarySettings,\n respondWithErrors: boolean,\n log: ILogger,\n ): ServerlessHandler<TReturn>;\n}\n"],"names":[],"mappings":"kiBAAA,yBAAA,CAAA,EAAA,OAAA,QAAA,aAAA,wBAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
|
package/lib/contracts/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__reExport=(target,mod,secondTarget)=>(__copyProps(target,mod,"default"),secondTarget&&__copyProps(secondTarget,mod,"default")),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),contracts_exports={};module.exports=__toCommonJS(contracts_exports);__reExport(contracts_exports,require("./adapter.contract"),module.exports);__reExport(contracts_exports,require("./framework.contract"),module.exports);__reExport(contracts_exports,require("./handler.contract"),module.exports);__reExport(contracts_exports,require("./resolver.contract"),module.exports);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/contracts/index.ts"],"sourcesContent":["export * from './adapter.contract';\nexport * from './framework.contract';\nexport * from './handler.contract';\nexport * from './resolver.contract';\n"],"names":[
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/contracts/index.ts"],"sourcesContent":["export * from './adapter.contract';\nexport * from './framework.contract';\nexport * from './handler.contract';\nexport * from './resolver.contract';\n"],"names":[],"mappings":"kqBAAA,kBAAA,CAAA,EAAA,OAAA,QAAA,aAAA,iBAAA,EAAA,WAAA,kBAAc,QAAd,oBAAA,EAAA,OAAA,OAAA,EACA,WAAA,kBAAc,QADd,sBAAA,EAAA,OAAA,OAAA,EAEA,WAAA,kBAAc,QAFd,oBAAA,EAAA,OAAA,OAAA,EAGA,WAAA,kBAAc,QAHd,qBAAA,EAAA,OAAA,OAAA"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ILogger } from '../core';
|
|
2
|
+
import { AdapterContract } from './adapter.contract';
|
|
3
|
+
/**
|
|
4
|
+
* The type that represents a resolver used to send the response, error or success, to the client
|
|
5
|
+
*
|
|
6
|
+
* @breadcrumb Contracts / ResolverContract
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export type Resolver<TResponse, TReturn> = {
|
|
10
|
+
/**
|
|
11
|
+
* The method that will perform the task of forwarding the request to the framework and waiting for the promise to be resolved with the response
|
|
12
|
+
*
|
|
13
|
+
* @param task - The task to be executed
|
|
14
|
+
*/
|
|
15
|
+
run(task: () => Promise<TResponse>): TReturn;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The type that represents a delegate resolver that is passed to the adapter to handle what to do when an error occurs during forwarding.
|
|
19
|
+
*
|
|
20
|
+
* @breadcrumb Contracts / ResolverContract
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export type DelegatedResolver<TResponse> = {
|
|
24
|
+
/**
|
|
25
|
+
* Send the success response to the client
|
|
26
|
+
*
|
|
27
|
+
* @param success - The serverless response
|
|
28
|
+
*/
|
|
29
|
+
succeed: (response: TResponse) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Send the error response to the client
|
|
32
|
+
*
|
|
33
|
+
* @param error - The error object
|
|
34
|
+
*/
|
|
35
|
+
fail: (error: Error) => void;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The createResolver contract props
|
|
39
|
+
*
|
|
40
|
+
* @breadcrumb Contracts / ResolverContract
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
export type ResolverProps<TEvent, TContext, TCallback, TResponse> = {
|
|
44
|
+
/**
|
|
45
|
+
* The event sent by the serverless environment
|
|
46
|
+
*/
|
|
47
|
+
event: TEvent;
|
|
48
|
+
/**
|
|
49
|
+
* Indicates whether to forward the (error.stack) or not to the client
|
|
50
|
+
*/
|
|
51
|
+
respondWithErrors: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* The instance of the logger
|
|
54
|
+
*/
|
|
55
|
+
log: ILogger;
|
|
56
|
+
/**
|
|
57
|
+
* The instance of the adapter
|
|
58
|
+
*/
|
|
59
|
+
adapter: AdapterContract<TEvent, TContext, TResponse>;
|
|
60
|
+
/**
|
|
61
|
+
* The context sent by serverless
|
|
62
|
+
*/
|
|
63
|
+
context?: TContext;
|
|
64
|
+
/**
|
|
65
|
+
* The callback sent by serverless
|
|
66
|
+
*/
|
|
67
|
+
callback?: TCallback;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* The interface that represents the contract used to send the response to the client
|
|
71
|
+
*
|
|
72
|
+
* @breadcrumb Contracts / ResolverContract
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
export interface ResolverContract<TEvent, TContext, TCallback, TResponse, TReturn> {
|
|
76
|
+
/**
|
|
77
|
+
* Create the resolver based on the context, callback or promise
|
|
78
|
+
*
|
|
79
|
+
* @param props - The props used to create the resolver
|
|
80
|
+
*/
|
|
81
|
+
createResolver(props: ResolverProps<TEvent, TContext, TCallback, TResponse>): Resolver<TResponse, TReturn>;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=resolver.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.contract.d.ts","sourceRoot":"","sources":["../../src/contracts/resolver.contract.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAIrD;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,CAAC,SAAS,EAAE,OAAO,IAAI;IACzC;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;CAC9C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,CAAC,SAAS,IAAI;IACzC;;;;OAIG;IACH,OAAO,EAAE,CAAC,QAAQ,EAAE,SAAS,KAAK,IAAI,CAAC;IAEvC;;;;OAIG;IACH,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAC9B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,IAAI;IAClE;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,iBAAiB,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,GAAG,EAAE,OAAO,CAAC;IAEb;;OAEG;IACH,OAAO,EAAE,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IAEtD;;OAEG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB,CAC/B,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO;IAEP;;;;OAIG;IACH,cAAc,CACZ,KAAK,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,GAC3D,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;CACjC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),resolver_contract_exports={};module.exports=__toCommonJS(resolver_contract_exports);
|
|
2
2
|
//# sourceMappingURL=resolver.contract.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.contract.js","sources":["../../src/contracts/resolver.contract.ts"],"sourcesContent":["//#region Imports\n\nimport { ILogger } from '../core';\nimport { AdapterContract } from './adapter.contract';\n\n//#endregion\n\n/**\n * The type that represents a resolver used to send the response, error or success, to the client\n *\n * @breadcrumb Contracts / ResolverContract\n * @public\n */\nexport type Resolver<TResponse, TReturn> = {\n /**\n * The method that will perform the task of forwarding the request to the framework and waiting for the promise to be resolved with the response\n *\n * @param task - The task to be executed\n */\n run(task: () => Promise<TResponse>): TReturn;\n};\n\n/**\n * The type that represents a delegate resolver that is passed to the adapter to handle what to do when an error occurs during forwarding.\n *\n * @breadcrumb Contracts / ResolverContract\n * @public\n */\nexport type DelegatedResolver<TResponse> = {\n /**\n * Send the success response to the client\n *\n * @param success - The serverless response\n */\n succeed: (response: TResponse) => void;\n\n /**\n * Send the error response to the client\n *\n * @param error - The error object\n */\n fail: (error: Error) => void;\n};\n\n/**\n * The createResolver contract props\n *\n * @breadcrumb Contracts / ResolverContract\n * @public\n */\nexport type ResolverProps<TEvent, TContext, TCallback, TResponse> = {\n /**\n * The event sent by the serverless environment\n */\n event: TEvent;\n\n /**\n * Indicates whether to forward the (error.stack) or not to the client\n */\n respondWithErrors: boolean;\n\n /**\n * The instance of the logger\n */\n log: ILogger;\n\n /**\n * The instance of the adapter\n */\n adapter: AdapterContract<TEvent, TContext, TResponse>;\n\n /**\n * The context sent by serverless\n */\n context?: TContext;\n\n /**\n * The callback sent by serverless\n */\n callback?: TCallback;\n};\n\n/**\n * The interface that represents the contract used to send the response to the client\n *\n * @breadcrumb Contracts / ResolverContract\n * @public\n */\nexport interface ResolverContract<\n TEvent,\n TContext,\n TCallback,\n TResponse,\n TReturn,\n> {\n /**\n * Create the resolver based on the context, callback or promise\n *\n * @param props - The props used to create the resolver\n */\n createResolver(\n props: ResolverProps<TEvent, TContext, TCallback, TResponse>,\n ): Resolver<TResponse, TReturn>;\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"resolver.contract.js","sources":["../../src/contracts/resolver.contract.ts"],"sourcesContent":["//#region Imports\n\nimport { ILogger } from '../core';\nimport { AdapterContract } from './adapter.contract';\n\n//#endregion\n\n/**\n * The type that represents a resolver used to send the response, error or success, to the client\n *\n * @breadcrumb Contracts / ResolverContract\n * @public\n */\nexport type Resolver<TResponse, TReturn> = {\n /**\n * The method that will perform the task of forwarding the request to the framework and waiting for the promise to be resolved with the response\n *\n * @param task - The task to be executed\n */\n run(task: () => Promise<TResponse>): TReturn;\n};\n\n/**\n * The type that represents a delegate resolver that is passed to the adapter to handle what to do when an error occurs during forwarding.\n *\n * @breadcrumb Contracts / ResolverContract\n * @public\n */\nexport type DelegatedResolver<TResponse> = {\n /**\n * Send the success response to the client\n *\n * @param success - The serverless response\n */\n succeed: (response: TResponse) => void;\n\n /**\n * Send the error response to the client\n *\n * @param error - The error object\n */\n fail: (error: Error) => void;\n};\n\n/**\n * The createResolver contract props\n *\n * @breadcrumb Contracts / ResolverContract\n * @public\n */\nexport type ResolverProps<TEvent, TContext, TCallback, TResponse> = {\n /**\n * The event sent by the serverless environment\n */\n event: TEvent;\n\n /**\n * Indicates whether to forward the (error.stack) or not to the client\n */\n respondWithErrors: boolean;\n\n /**\n * The instance of the logger\n */\n log: ILogger;\n\n /**\n * The instance of the adapter\n */\n adapter: AdapterContract<TEvent, TContext, TResponse>;\n\n /**\n * The context sent by serverless\n */\n context?: TContext;\n\n /**\n * The callback sent by serverless\n */\n callback?: TCallback;\n};\n\n/**\n * The interface that represents the contract used to send the response to the client\n *\n * @breadcrumb Contracts / ResolverContract\n * @public\n */\nexport interface ResolverContract<\n TEvent,\n TContext,\n TCallback,\n TResponse,\n TReturn,\n> {\n /**\n * Create the resolver based on the context, callback or promise\n *\n * @param props - The props used to create the resolver\n */\n createResolver(\n props: ResolverProps<TEvent, TContext, TCallback, TResponse>,\n ): Resolver<TResponse, TReturn>;\n}\n"],"names":[],"mappings":"kiBAAA,0BAAA,CAAA,EAAA,OAAA,QAAA,aAAA,yBAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BinarySettings } from '../@types';
|
|
2
|
+
import { AdapterContract, AdapterRequest, FrameworkContract, HandlerContract, ResolverContract, ServerlessHandler } from '../contracts';
|
|
3
|
+
import { ServerlessRequest, ServerlessResponse } from '../network';
|
|
4
|
+
import { ILogger } from './index';
|
|
5
|
+
/**
|
|
6
|
+
* The abstract class that represents the base class for a handler
|
|
7
|
+
*
|
|
8
|
+
* @breadcrumb Core
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare abstract class BaseHandler<TApp, TEvent, TContext, TCallback, TResponse, TReturn> implements HandlerContract<TApp, TEvent, TContext, TCallback, TResponse, TReturn> {
|
|
12
|
+
/**
|
|
13
|
+
* Get the handler that will handle serverless requests
|
|
14
|
+
*/
|
|
15
|
+
abstract getHandler(app: TApp, framework: FrameworkContract<TApp>, adapters: AdapterContract<TEvent, TContext, TResponse>[], resolverFactory: ResolverContract<TEvent, TContext, TCallback, TResponse, TReturn>, binarySettings: BinarySettings, respondWithErrors: boolean, log: ILogger): ServerlessHandler<TReturn>;
|
|
16
|
+
/**
|
|
17
|
+
* Get the adapter to handle a specific event and context
|
|
18
|
+
*
|
|
19
|
+
* @param event - The event sent by serverless
|
|
20
|
+
* @param context - The context sent by serverless
|
|
21
|
+
* @param adapters - The list of adapters
|
|
22
|
+
* @param log - The instance of logger
|
|
23
|
+
*/
|
|
24
|
+
protected getAdapterByEventAndContext(event: TEvent, context: TContext, adapters: AdapterContract<TEvent, TContext, TResponse>[], log: ILogger): AdapterContract<TEvent, TContext, TResponse>;
|
|
25
|
+
/**
|
|
26
|
+
* Get serverless request and response frmo the adapter request
|
|
27
|
+
*
|
|
28
|
+
* @param requestValues - The request values from adapter
|
|
29
|
+
*/
|
|
30
|
+
protected getServerlessRequestResponseFromAdapterRequest(requestValues: AdapterRequest): [request: ServerlessRequest, response: ServerlessResponse];
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=base-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-handler.d.ts","sourceRoot":"","sources":["../../src/core/base-handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIlC;;;;;GAKG;AACH,8BAAsB,WAAW,CAC/B,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,CACP,YACE,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC;IAIxE;;OAEG;aACa,UAAU,CACxB,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAClC,QAAQ,EAAE,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,EACxD,eAAe,EAAE,gBAAgB,CAC/B,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,CACR,EACD,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,OAAO,EAC1B,GAAG,EAAE,OAAO,GACX,iBAAiB,CAAC,OAAO,CAAC;IAM7B;;;;;;;OAOG;IACH,SAAS,CAAC,2BAA2B,CACnC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,QAAQ,EACjB,QAAQ,EAAE,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,EACxD,GAAG,EAAE,OAAO,GACX,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC;IAsB/C;;;;OAIG;IACH,SAAS,CAAC,8CAA8C,CACtD,aAAa,EAAE,cAAc,GAC5B,CAAC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,kBAAkB,CAAC;CAiB9D"}
|
package/lib/core/base-handler.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),base_handler_exports={};__export(base_handler_exports,{BaseHandler:()=>BaseHandler});module.exports=__toCommonJS(base_handler_exports);var import_network=require("../network");class BaseHandler{getAdapterByEventAndContext(event,context,adapters,log){const resolvedAdapters=adapters.filter(adapter=>adapter.canHandle(event,context,log));if(resolvedAdapters.length===0)throw new Error("SERVERLESS_ADAPTER: Couldn't find adapter to handle this event.");if(resolvedAdapters.length>1)throw new Error(`SERVERLESS_ADAPTER: Two or more adapters was resolved by the event, the adapters are: ${adapters.map(adapter=>adapter.getAdapterName()).join(", ")}.`);return resolvedAdapters[0]}getServerlessRequestResponseFromAdapterRequest(requestValues){const request=new import_network.ServerlessRequest({method:requestValues.method,headers:requestValues.headers,body:requestValues.body,remoteAddress:requestValues.remoteAddress,url:requestValues.path}),response=new import_network.ServerlessResponse({method:requestValues.method});return[request,response]}}
|
|
2
2
|
//# sourceMappingURL=base-handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-handler.js","sources":["../../src/core/base-handler.ts"],"sourcesContent":["//#region Imports\n\nimport { BinarySettings } from '../@types';\nimport {\n AdapterContract,\n AdapterRequest,\n FrameworkContract,\n HandlerContract,\n ResolverContract,\n ServerlessHandler,\n} from '../contracts';\nimport { ServerlessRequest, ServerlessResponse } from '../network';\nimport { ILogger } from './index';\n\n//#endregion\n\n/**\n * The abstract class that represents the base class for a handler\n *\n * @breadcrumb Core\n * @public\n */\nexport abstract class BaseHandler<\n TApp,\n TEvent,\n TContext,\n TCallback,\n TResponse,\n TReturn,\n> implements\n HandlerContract<TApp, TEvent, TContext, TCallback, TResponse, TReturn>\n{\n //#region Public Methods\n\n /**\n * Get the handler that will handle serverless requests\n */\n public abstract getHandler(\n app: TApp,\n framework: FrameworkContract<TApp>,\n adapters: AdapterContract<TEvent, TContext, TResponse>[],\n resolverFactory: ResolverContract<\n TEvent,\n TContext,\n TCallback,\n TResponse,\n TReturn\n >,\n binarySettings: BinarySettings,\n respondWithErrors: boolean,\n log: ILogger,\n ): ServerlessHandler<TReturn>;\n\n //#endregion\n\n //#region Protected Methods\n\n /**\n * Get the adapter to handle a specific event and context\n *\n * @param event - The event sent by serverless\n * @param context - The context sent by serverless\n * @param adapters - The list of adapters\n * @param log - The instance of logger\n */\n protected getAdapterByEventAndContext(\n event: TEvent,\n context: TContext,\n adapters: AdapterContract<TEvent, TContext, TResponse>[],\n log: ILogger,\n ): AdapterContract<TEvent, TContext, TResponse> {\n const resolvedAdapters = adapters.filter(adapter =>\n adapter.canHandle(event, context, log),\n );\n\n if (resolvedAdapters.length === 0) {\n throw new Error(\n \"SERVERLESS_ADAPTER: Couldn't find adapter to handle this event.\",\n );\n }\n\n if (resolvedAdapters.length > 1) {\n throw new Error(\n `SERVERLESS_ADAPTER: Two or more adapters was resolved by the event, the adapters are: ${adapters\n .map(adapter => adapter.getAdapterName())\n .join(', ')}.`,\n );\n }\n\n return resolvedAdapters[0];\n }\n\n /**\n * Get serverless request and response frmo the adapter request\n *\n * @param requestValues - The request values from adapter\n */\n protected getServerlessRequestResponseFromAdapterRequest(\n requestValues: AdapterRequest,\n ): [request: ServerlessRequest, response: ServerlessResponse] {\n const request = new ServerlessRequest({\n method: requestValues.method,\n headers: requestValues.headers,\n body: requestValues.body,\n remoteAddress: requestValues.remoteAddress,\n url: requestValues.path,\n });\n\n const response = new ServerlessResponse({\n method: requestValues.method,\n });\n\n return [request, response];\n }\n\n //#endregion\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"base-handler.js","sources":["../../src/core/base-handler.ts"],"sourcesContent":["//#region Imports\n\nimport { BinarySettings } from '../@types';\nimport {\n AdapterContract,\n AdapterRequest,\n FrameworkContract,\n HandlerContract,\n ResolverContract,\n ServerlessHandler,\n} from '../contracts';\nimport { ServerlessRequest, ServerlessResponse } from '../network';\nimport { ILogger } from './index';\n\n//#endregion\n\n/**\n * The abstract class that represents the base class for a handler\n *\n * @breadcrumb Core\n * @public\n */\nexport abstract class BaseHandler<\n TApp,\n TEvent,\n TContext,\n TCallback,\n TResponse,\n TReturn,\n> implements\n HandlerContract<TApp, TEvent, TContext, TCallback, TResponse, TReturn>\n{\n //#region Public Methods\n\n /**\n * Get the handler that will handle serverless requests\n */\n public abstract getHandler(\n app: TApp,\n framework: FrameworkContract<TApp>,\n adapters: AdapterContract<TEvent, TContext, TResponse>[],\n resolverFactory: ResolverContract<\n TEvent,\n TContext,\n TCallback,\n TResponse,\n TReturn\n >,\n binarySettings: BinarySettings,\n respondWithErrors: boolean,\n log: ILogger,\n ): ServerlessHandler<TReturn>;\n\n //#endregion\n\n //#region Protected Methods\n\n /**\n * Get the adapter to handle a specific event and context\n *\n * @param event - The event sent by serverless\n * @param context - The context sent by serverless\n * @param adapters - The list of adapters\n * @param log - The instance of logger\n */\n protected getAdapterByEventAndContext(\n event: TEvent,\n context: TContext,\n adapters: AdapterContract<TEvent, TContext, TResponse>[],\n log: ILogger,\n ): AdapterContract<TEvent, TContext, TResponse> {\n const resolvedAdapters = adapters.filter(adapter =>\n adapter.canHandle(event, context, log),\n );\n\n if (resolvedAdapters.length === 0) {\n throw new Error(\n \"SERVERLESS_ADAPTER: Couldn't find adapter to handle this event.\",\n );\n }\n\n if (resolvedAdapters.length > 1) {\n throw new Error(\n `SERVERLESS_ADAPTER: Two or more adapters was resolved by the event, the adapters are: ${adapters\n .map(adapter => adapter.getAdapterName())\n .join(', ')}.`,\n );\n }\n\n return resolvedAdapters[0];\n }\n\n /**\n * Get serverless request and response frmo the adapter request\n *\n * @param requestValues - The request values from adapter\n */\n protected getServerlessRequestResponseFromAdapterRequest(\n requestValues: AdapterRequest,\n ): [request: ServerlessRequest, response: ServerlessResponse] {\n const request = new ServerlessRequest({\n method: requestValues.method,\n headers: requestValues.headers,\n body: requestValues.body,\n remoteAddress: requestValues.remoteAddress,\n url: requestValues.path,\n });\n\n const response = new ServerlessResponse({\n method: requestValues.method,\n });\n\n return [request, response];\n }\n\n //#endregion\n}\n"],"names":[],"mappings":"ooBAAA,qBAAA,CAAA,EAAA,SAAA,qBAAA,CAAA,YAAA,IAAA,WAAA,CAAA,EAAA,OAAA,QAAA,aAAA,oBAAA,EAWA,IAAsD,eAAA,QAAA,YAAA,EAW/C,MAAe,WAStB,CAkCY,4BACR,MACA,QACA,SACA,IAC8C,CAC9C,MAAM,iBAAmB,SAAS,OAChC,SAAA,QAAQ,UAAU,MAAO,QAAS,GAAG,CAAA,EAGnC,GAAA,iBAAiB,SAAW,EAC9B,MAAM,IAAI,MACR,iEAAA,EAIA,GAAA,iBAAiB,OAAS,EAC5B,MAAM,IAAI,MACR,yFAAyF,SACtF,IAAe,SAAA,QAAQ,gBAAgB,EACvC,KAAK,IAAI,CAAC,GAAA,EAIjB,OAAO,iBAAiB,CAAC,CAC3B,CAOU,+CACR,cAC4D,CACtD,MAAA,QAAU,IAAI,eAAkB,kBAAA,CACpC,OAAQ,cAAc,OACtB,QAAS,cAAc,QACvB,KAAM,cAAc,KACpB,cAAe,cAAc,cAC7B,IAAK,cAAc,IAAA,CACpB,EAEK,SAAW,IAAI,eAAmB,mBAAA,CACtC,OAAQ,cAAc,MAAA,CACvB,EAEM,MAAA,CAAC,QAAS,QAAQ,CAC3B,CAGF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default encodings that are treated as binary, they are compared with the `Content-Encoding` header.
|
|
3
|
+
*
|
|
4
|
+
* @breadcrumb Core / Constants
|
|
5
|
+
* @defaultValue ['gzip', 'deflate', 'br']
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEFAULT_BINARY_ENCODINGS: string[];
|
|
9
|
+
/**
|
|
10
|
+
* Default content types that are treated as binary, they are compared with the `Content-Type` header.
|
|
11
|
+
*
|
|
12
|
+
* @breadcrumb Core / Constants
|
|
13
|
+
* @defaultValue ['image/png', 'image/jpeg', 'image/jpg', 'image/avif', 'image/bmp', 'image/x-png', 'image/gif', 'image/webp', 'video/mp4', 'application/pdf']
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export declare const DEFAULT_BINARY_CONTENT_TYPES: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Type alias for empty response and can be used on some adapters when the adapter does not need to return a response.
|
|
19
|
+
*
|
|
20
|
+
* @breadcrumb Core / Constants
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export type IEmptyResponse = {};
|
|
24
|
+
/**
|
|
25
|
+
* Constant for empty response and can be used on some adapters when the adapter does not need to return a response.
|
|
26
|
+
*
|
|
27
|
+
* @breadcrumb Core / Constants
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export declare const EmptyResponse: IEmptyResponse;
|
|
31
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,EAA8B,CAAC;AAE5E;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAM,EAWhD,CAAC;AAEF;;;;;GAKG;AAEH,MAAM,MAAM,cAAc,GAAG,EAAE,CAAC;AAEhC;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,cAAmB,CAAC"}
|
package/lib/core/constants.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),constants_exports={};__export(constants_exports,{DEFAULT_BINARY_CONTENT_TYPES:()=>DEFAULT_BINARY_CONTENT_TYPES,DEFAULT_BINARY_ENCODINGS:()=>DEFAULT_BINARY_ENCODINGS,EmptyResponse:()=>EmptyResponse});module.exports=__toCommonJS(constants_exports);const DEFAULT_BINARY_ENCODINGS=["gzip","deflate","br"],DEFAULT_BINARY_CONTENT_TYPES=["image/png","image/jpeg","image/jpg","image/avif","image/bmp","image/x-png","image/gif","image/webp","video/mp4","application/pdf"],EmptyResponse={};
|
|
2
2
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../src/core/constants.ts"],"sourcesContent":["/**\n * Default encodings that are treated as binary, they are compared with the `Content-Encoding` header.\n *\n * @breadcrumb Core / Constants\n * @defaultValue ['gzip', 'deflate', 'br']\n * @public\n */\nexport const DEFAULT_BINARY_ENCODINGS: string[] = ['gzip', 'deflate', 'br'];\n\n/**\n * Default content types that are treated as binary, they are compared with the `Content-Type` header.\n *\n * @breadcrumb Core / Constants\n * @defaultValue ['image/png', 'image/jpeg', 'image/jpg', 'image/avif', 'image/bmp', 'image/x-png', 'image/gif', 'image/webp', 'video/mp4', 'application/pdf']\n * @public\n */\nexport const DEFAULT_BINARY_CONTENT_TYPES: string[] = [\n 'image/png',\n 'image/jpeg',\n 'image/jpg',\n 'image/avif',\n 'image/bmp',\n 'image/x-png',\n 'image/gif',\n 'image/webp',\n 'video/mp4',\n 'application/pdf',\n];\n\n/**\n * Type alias for empty response and can be used on some adapters when the adapter does not need to return a response.\n *\n * @breadcrumb Core / Constants\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type IEmptyResponse = {};\n\n/**\n * Constant for empty response and can be used on some adapters when the adapter does not need to return a response.\n *\n * @breadcrumb Core / Constants\n * @public\n */\nexport const EmptyResponse: IEmptyResponse = {};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../src/core/constants.ts"],"sourcesContent":["/**\n * Default encodings that are treated as binary, they are compared with the `Content-Encoding` header.\n *\n * @breadcrumb Core / Constants\n * @defaultValue ['gzip', 'deflate', 'br']\n * @public\n */\nexport const DEFAULT_BINARY_ENCODINGS: string[] = ['gzip', 'deflate', 'br'];\n\n/**\n * Default content types that are treated as binary, they are compared with the `Content-Type` header.\n *\n * @breadcrumb Core / Constants\n * @defaultValue ['image/png', 'image/jpeg', 'image/jpg', 'image/avif', 'image/bmp', 'image/x-png', 'image/gif', 'image/webp', 'video/mp4', 'application/pdf']\n * @public\n */\nexport const DEFAULT_BINARY_CONTENT_TYPES: string[] = [\n 'image/png',\n 'image/jpeg',\n 'image/jpg',\n 'image/avif',\n 'image/bmp',\n 'image/x-png',\n 'image/gif',\n 'image/webp',\n 'video/mp4',\n 'application/pdf',\n];\n\n/**\n * Type alias for empty response and can be used on some adapters when the adapter does not need to return a response.\n *\n * @breadcrumb Core / Constants\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type IEmptyResponse = {};\n\n/**\n * Constant for empty response and can be used on some adapters when the adapter does not need to return a response.\n *\n * @breadcrumb Core / Constants\n * @public\n */\nexport const EmptyResponse: IEmptyResponse = {};\n"],"names":[],"mappings":"ooBAAA,kBAAA,CAAA,EAAA,SAAA,kBAAA,CAAA,6BAAA,IAAA,6BAAA,yBAAA,IAAA,yBAAA,cAAA,IAAA,aAAA,CAAA,EAAA,OAAA,QAAA,aAAA,iBAAA,EAOO,MAAM,yBAAqC,CAAC,OAAQ,UAAW,IAAI,EAS7D,6BAAyC,CACpD,YACA,aACA,YACA,aACA,YACA,cACA,YACA,aACA,YACA,iBACF,EAiBa,cAAgC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The type that represents the object that handles the references to the event created by the serverless trigger or context created by the serverless environment.
|
|
3
|
+
*
|
|
4
|
+
* @breadcrumb Core / Current Invoke
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export type CurrentInvoke<TEvent, TContext> = {
|
|
8
|
+
/**
|
|
9
|
+
* The event created by the serverless trigger
|
|
10
|
+
*
|
|
11
|
+
* @remarks It's only null when you call {@link getCurrentInvoke} outside this library's pipeline.
|
|
12
|
+
*/
|
|
13
|
+
event: TEvent | null;
|
|
14
|
+
/**
|
|
15
|
+
* The context created by the serverless environment
|
|
16
|
+
*
|
|
17
|
+
* @remarks It's only null when you call {@link getCurrentInvoke} outside this library's pipeline.
|
|
18
|
+
*/
|
|
19
|
+
context: TContext | null;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Get the reference to the event created by the serverless trigger or context created by the serverless environment.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* import type { ALBEvent, Context } from 'aws-lambda';
|
|
27
|
+
*
|
|
28
|
+
* // inside the method that handles the aws alb request.
|
|
29
|
+
* const { event, context } = getCurrentInvoke<ALBEvent, Context>();
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @breadcrumb Core / Current Invoke
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export declare function getCurrentInvoke<TEvent = any, TContext = any>(): CurrentInvoke<TEvent, TContext>;
|
|
36
|
+
/**
|
|
37
|
+
* Method that saves to the event created by the serverless trigger or context created by the serverless environment.
|
|
38
|
+
*
|
|
39
|
+
* @remarks This method MUST NOT be called by you, this method MUST only be used internally in this library.
|
|
40
|
+
*
|
|
41
|
+
* @param event - The event created by the serverless trigger
|
|
42
|
+
* @param context - The context created by the serverless environment
|
|
43
|
+
*
|
|
44
|
+
* @breadcrumb Core / Current Invoke
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
export declare function setCurrentInvoke<TEvent = any, TContext = any>({ event, context, }: CurrentInvoke<TEvent, TContext>): void;
|
|
48
|
+
//# sourceMappingURL=current-invoke.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"current-invoke.d.ts","sourceRoot":"","sources":["../../src/core/current-invoke.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,aAAa,CAAC,MAAM,EAAE,QAAQ,IAAI;IAC5C;;;;OAIG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB;;;;OAIG;IACH,OAAO,EAAE,QAAQ,GAAG,IAAI,CAAC;CAC1B,CAAC;AAOF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,GAAG,GAAG,EAAE,QAAQ,GAAG,GAAG,KAAK,aAAa,CAC7E,MAAM,EACN,QAAQ,CACT,CAEA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,GAAG,GAAG,EAAE,QAAQ,GAAG,GAAG,EAAE,EAC7D,KAAK,EACL,OAAO,GACR,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,QAGjC"}
|