@h4ad/serverless-adapter 3.2.0 → 4.0.1
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/lib/adapter.contract-EQE3rlgO.d.ts +278 -0
- package/lib/adapter.contract-y5xSjOjo.d.cts +278 -0
- package/lib/adapters/apollo-server/index.cjs +4 -0
- package/lib/adapters/apollo-server/index.cjs.map +1 -0
- package/lib/adapters/apollo-server/{apollo-server-mutation.adapter.d.ts → index.d.cts} +10 -5
- package/lib/adapters/apollo-server/index.d.ts +61 -2
- package/lib/adapters/apollo-server/index.mjs +2 -0
- package/lib/adapters/apollo-server/index.mjs.map +1 -0
- package/lib/adapters/aws/index.cjs +4 -0
- package/lib/adapters/aws/index.cjs.map +1 -0
- package/lib/adapters/aws/index.d.cts +910 -0
- package/lib/adapters/aws/index.d.ts +910 -12
- package/lib/adapters/aws/index.mjs +2 -0
- package/lib/adapters/aws/index.mjs.map +1 -0
- package/lib/adapters/azure/index.cjs +4 -0
- package/lib/adapters/azure/index.cjs.map +1 -0
- package/lib/adapters/azure/{http-trigger-v4.adapter.d.ts → index.d.cts} +11 -6
- package/lib/adapters/azure/index.d.ts +86 -2
- package/lib/adapters/azure/index.mjs +2 -0
- package/lib/adapters/azure/index.mjs.map +1 -0
- package/lib/adapters/digital-ocean/index.cjs +4 -0
- package/lib/adapters/digital-ocean/index.cjs.map +1 -0
- package/lib/adapters/digital-ocean/index.d.cts +126 -0
- package/lib/adapters/digital-ocean/index.d.ts +126 -2
- package/lib/adapters/digital-ocean/index.mjs +2 -0
- package/lib/adapters/digital-ocean/index.mjs.map +1 -0
- package/lib/adapters/dummy/index.cjs +4 -0
- package/lib/adapters/dummy/index.cjs.map +1 -0
- package/lib/adapters/dummy/{dummy.adapter.d.ts → index.d.cts} +10 -4
- package/lib/adapters/dummy/index.d.ts +37 -2
- package/lib/adapters/dummy/index.mjs +2 -0
- package/lib/adapters/dummy/index.mjs.map +1 -0
- package/lib/adapters/huawei/index.cjs +4 -0
- package/lib/adapters/huawei/index.cjs.map +1 -0
- package/lib/adapters/huawei/index.d.cts +365 -0
- package/lib/adapters/huawei/index.d.ts +365 -2
- package/lib/adapters/huawei/index.mjs +2 -0
- package/lib/adapters/huawei/index.mjs.map +1 -0
- package/lib/{core/base-handler.d.ts → base-handler-fYEk59Xq.d.ts} +9 -6
- package/lib/base-handler-peEBoKtZ.d.cts +35 -0
- package/lib/chunk-22SSVZU5.mjs +1 -0
- package/lib/chunk-22SSVZU5.mjs.map +1 -0
- package/lib/chunk-HU5XBQCP.mjs +10 -0
- package/lib/chunk-HU5XBQCP.mjs.map +1 -0
- package/lib/chunk-NSO4L3EI.mjs +2 -0
- package/lib/chunk-NSO4L3EI.mjs.map +1 -0
- package/lib/chunk-OYOJMOFP.mjs +2 -0
- package/lib/chunk-OYOJMOFP.mjs.map +1 -0
- package/lib/chunk-Y6H576RS.mjs +2 -0
- package/lib/chunk-Y6H576RS.mjs.map +1 -0
- package/lib/{core/constants.d.ts → constants-0cgQlFSV.d.cts} +6 -5
- package/lib/constants-0cgQlFSV.d.ts +32 -0
- package/lib/{contracts/framework.contract.d.ts → framework.contract-YnJ-fl1w.d.cts} +4 -3
- package/lib/framework.contract-YnJ-fl1w.d.ts +20 -0
- package/lib/frameworks/apollo-server/index.cjs +4 -0
- package/lib/frameworks/apollo-server/index.cjs.map +1 -0
- package/lib/frameworks/apollo-server/{apollo-server.framework.d.ts → index.d.cts} +12 -9
- package/lib/frameworks/apollo-server/index.d.ts +72 -2
- package/lib/frameworks/apollo-server/index.mjs +2 -0
- package/lib/frameworks/apollo-server/index.mjs.map +1 -0
- package/lib/frameworks/body-parser/index.cjs +4 -0
- package/lib/frameworks/body-parser/index.cjs.map +1 -0
- package/lib/frameworks/body-parser/index.d.cts +159 -0
- package/lib/frameworks/body-parser/index.d.ts +159 -6
- package/lib/frameworks/body-parser/index.mjs +2 -0
- package/lib/frameworks/body-parser/index.mjs.map +1 -0
- package/lib/frameworks/cors/index.cjs +5 -0
- package/lib/frameworks/cors/index.cjs.map +1 -0
- package/lib/frameworks/cors/{cors.framework.d.ts → index.d.cts} +6 -5
- package/lib/frameworks/cors/index.d.ts +79 -2
- package/lib/frameworks/cors/index.mjs +3 -0
- package/lib/frameworks/cors/index.mjs.map +1 -0
- package/lib/frameworks/deepkit/index.cjs +4 -0
- package/lib/frameworks/deepkit/index.cjs.map +1 -0
- package/lib/frameworks/deepkit/{http-deepkit.framework.d.ts → index.d.cts} +8 -5
- package/lib/frameworks/deepkit/index.d.ts +21 -2
- package/lib/frameworks/deepkit/index.mjs +2 -0
- package/lib/frameworks/deepkit/index.mjs.map +1 -0
- package/lib/frameworks/express/index.cjs +2 -0
- package/lib/frameworks/express/index.cjs.map +1 -0
- package/lib/frameworks/express/{express.framework.d.ts → index.d.cts} +6 -5
- package/lib/frameworks/express/index.d.ts +18 -2
- package/lib/frameworks/express/index.mjs +2 -0
- package/lib/frameworks/express/index.mjs.map +1 -0
- package/lib/frameworks/fastify/index.cjs +2 -0
- package/lib/frameworks/fastify/index.cjs.map +1 -0
- package/lib/frameworks/fastify/{fastify.framework.d.ts → index.d.cts} +6 -5
- package/lib/frameworks/fastify/index.d.ts +18 -2
- package/lib/frameworks/fastify/index.mjs +2 -0
- package/lib/frameworks/fastify/index.mjs.map +1 -0
- package/lib/frameworks/hapi/index.cjs +2 -0
- package/lib/frameworks/hapi/index.cjs.map +1 -0
- package/lib/frameworks/hapi/{hapi.framework.d.ts → index.d.cts} +6 -5
- package/lib/frameworks/hapi/index.d.ts +18 -2
- package/lib/frameworks/hapi/index.mjs +2 -0
- package/lib/frameworks/hapi/index.mjs.map +1 -0
- package/lib/frameworks/koa/index.cjs +2 -0
- package/lib/frameworks/koa/index.cjs.map +1 -0
- package/lib/frameworks/koa/{koa.framework.d.ts → index.d.cts} +6 -5
- package/lib/frameworks/koa/index.d.ts +18 -2
- package/lib/frameworks/koa/index.mjs +2 -0
- package/lib/frameworks/koa/index.mjs.map +1 -0
- package/lib/frameworks/lazy/index.cjs +4 -0
- package/lib/frameworks/lazy/index.cjs.map +1 -0
- package/lib/frameworks/lazy/{lazy.framework.d.ts → index.d.cts} +7 -6
- package/lib/frameworks/lazy/index.d.ts +57 -2
- package/lib/frameworks/lazy/index.mjs +2 -0
- package/lib/frameworks/lazy/index.mjs.map +1 -0
- package/lib/frameworks/trpc/index.cjs +4 -0
- package/lib/frameworks/trpc/index.cjs.map +1 -0
- package/lib/frameworks/trpc/{trpc.framework.d.ts → index.d.cts} +12 -11
- package/lib/frameworks/trpc/index.d.ts +154 -2
- package/lib/frameworks/trpc/index.mjs +2 -0
- package/lib/frameworks/trpc/index.mjs.map +1 -0
- package/lib/handler.contract-8Cb7qLSi.d.ts +66 -0
- package/lib/handler.contract-TQk8iM8f.d.cts +66 -0
- package/lib/handlers/aws/index.cjs +10 -0
- package/lib/handlers/aws/index.cjs.map +1 -0
- package/lib/handlers/aws/{aws-stream.handler.d.ts → index.d.cts} +22 -15
- package/lib/handlers/aws/index.d.ts +96 -2
- package/lib/handlers/aws/index.mjs +2 -0
- package/lib/handlers/aws/index.mjs.map +1 -0
- package/lib/handlers/azure/index.cjs +4 -0
- package/lib/handlers/azure/index.cjs.map +1 -0
- package/lib/handlers/azure/{azure.handler.d.ts → index.d.cts} +16 -8
- package/lib/handlers/azure/index.d.ts +53 -2
- package/lib/handlers/azure/index.mjs +2 -0
- package/lib/handlers/azure/index.mjs.map +1 -0
- package/lib/handlers/default/index.cjs +4 -0
- package/lib/handlers/default/index.cjs.map +1 -0
- package/lib/handlers/default/{default.handler.d.ts → index.d.cts} +13 -6
- package/lib/handlers/default/index.d.ts +95 -2
- package/lib/handlers/default/index.mjs +2 -0
- package/lib/handlers/default/index.mjs.map +1 -0
- package/lib/handlers/digital-ocean/index.cjs +4 -0
- package/lib/handlers/digital-ocean/index.cjs.map +1 -0
- package/lib/handlers/digital-ocean/index.d.cts +25 -0
- package/lib/handlers/digital-ocean/index.d.ts +25 -2
- package/lib/handlers/digital-ocean/index.mjs +2 -0
- package/lib/handlers/digital-ocean/index.mjs.map +1 -0
- package/lib/handlers/firebase/index.cjs +4 -0
- package/lib/handlers/firebase/index.cjs.map +1 -0
- package/lib/handlers/firebase/index.d.cts +59 -0
- package/lib/handlers/firebase/index.d.ts +59 -3
- package/lib/handlers/firebase/index.mjs +2 -0
- package/lib/handlers/firebase/index.mjs.map +1 -0
- package/lib/handlers/gcp/index.cjs +4 -0
- package/lib/handlers/gcp/index.cjs.map +1 -0
- package/lib/handlers/gcp/{gcp.handler.d.ts → index.d.cts} +12 -5
- package/lib/handlers/gcp/index.d.ts +33 -2
- package/lib/handlers/gcp/index.mjs +2 -0
- package/lib/handlers/gcp/index.mjs.map +1 -0
- package/lib/handlers/huawei/index.cjs +4 -0
- package/lib/handlers/huawei/index.cjs.map +1 -0
- package/lib/handlers/huawei/{http-huawei.handler.d.ts → index.d.cts} +15 -12
- package/lib/handlers/huawei/index.d.ts +62 -2
- package/lib/handlers/huawei/index.mjs +2 -0
- package/lib/handlers/huawei/index.mjs.map +1 -0
- package/lib/{@types/headers.d.ts → headers-K2qbcurv.d.cts} +5 -4
- package/lib/headers-K2qbcurv.d.ts +38 -0
- package/lib/index.cjs +10 -0
- package/lib/index.cjs.map +1 -0
- package/lib/index.d.cts +439 -0
- package/lib/index.d.ts +439 -6
- package/lib/index.mjs +2 -0
- package/lib/index.mjs.map +1 -0
- package/lib/{core/logger.d.ts → logger-9me5n48P.d.cts} +8 -7
- package/lib/logger-9me5n48P.d.ts +65 -0
- package/lib/{core/path.d.ts → path-yBwCb8C1.d.cts} +16 -5
- package/lib/path-yBwCb8C1.d.ts +64 -0
- package/lib/{handlers/base/raw-request.d.ts → raw-request-B2vPjAfE.d.cts} +6 -5
- package/lib/raw-request-b6AYnkxd.d.ts +32 -0
- package/lib/{network/request.d.ts → request-DNNIV9ub.d.cts} +7 -7
- package/lib/request-sVa4pxmx.d.ts +44 -0
- package/lib/resolvers/aws-context/index.cjs +2 -0
- package/lib/resolvers/aws-context/index.cjs.map +1 -0
- package/lib/resolvers/aws-context/{aws-context.resolver.d.ts → index.d.cts} +10 -4
- package/lib/resolvers/aws-context/index.d.ts +25 -2
- package/lib/resolvers/aws-context/index.mjs +2 -0
- package/lib/resolvers/aws-context/index.mjs.map +1 -0
- package/lib/resolvers/callback/index.cjs +2 -0
- package/lib/resolvers/callback/index.cjs.map +1 -0
- package/lib/resolvers/callback/{callback.resolver.d.ts → index.d.cts} +10 -4
- package/lib/resolvers/callback/index.d.ts +29 -2
- package/lib/resolvers/callback/index.mjs +2 -0
- package/lib/resolvers/callback/index.mjs.map +1 -0
- package/lib/resolvers/dummy/index.cjs +2 -0
- package/lib/resolvers/dummy/index.cjs.map +1 -0
- package/lib/resolvers/dummy/index.d.cts +20 -0
- package/lib/resolvers/dummy/index.d.ts +20 -2
- package/lib/resolvers/dummy/index.mjs +2 -0
- package/lib/resolvers/dummy/index.mjs.map +1 -0
- package/lib/resolvers/promise/index.cjs +2 -0
- package/lib/resolvers/promise/index.cjs.map +1 -0
- package/lib/resolvers/promise/index.d.cts +20 -0
- package/lib/resolvers/promise/index.d.ts +20 -2
- package/lib/resolvers/promise/index.mjs +2 -0
- package/lib/resolvers/promise/index.mjs.map +1 -0
- package/package.json +565 -7
- package/lib/@types/binary-settings.d.ts +0 -41
- package/lib/@types/binary-settings.d.ts.map +0 -1
- package/lib/@types/binary-settings.js +0 -2
- package/lib/@types/binary-settings.js.map +0 -1
- package/lib/@types/digital-ocean/digital-ocean-http-event.d.ts +0 -37
- package/lib/@types/digital-ocean/digital-ocean-http-event.d.ts.map +0 -1
- package/lib/@types/digital-ocean/digital-ocean-http-event.js +0 -2
- package/lib/@types/digital-ocean/digital-ocean-http-event.js.map +0 -1
- package/lib/@types/digital-ocean/digital-ocean-http-response.d.ts +0 -22
- package/lib/@types/digital-ocean/digital-ocean-http-response.d.ts.map +0 -1
- package/lib/@types/digital-ocean/digital-ocean-http-response.js +0 -2
- package/lib/@types/digital-ocean/digital-ocean-http-response.js.map +0 -1
- package/lib/@types/digital-ocean/index.d.ts +0 -2
- package/lib/@types/digital-ocean/index.d.ts.map +0 -1
- package/lib/@types/digital-ocean/index.js +0 -2
- package/lib/@types/digital-ocean/index.js.map +0 -1
- package/lib/@types/headers.d.ts.map +0 -1
- package/lib/@types/headers.js +0 -2
- package/lib/@types/headers.js.map +0 -1
- package/lib/@types/helpers.d.ts +0 -10
- package/lib/@types/helpers.d.ts.map +0 -1
- package/lib/@types/helpers.js +0 -2
- package/lib/@types/helpers.js.map +0 -1
- package/lib/@types/huawei/huawei-api-gateway-event.d.ts +0 -81
- package/lib/@types/huawei/huawei-api-gateway-event.d.ts.map +0 -1
- package/lib/@types/huawei/huawei-api-gateway-event.js +0 -2
- package/lib/@types/huawei/huawei-api-gateway-event.js.map +0 -1
- package/lib/@types/huawei/huawei-api-gateway-response.d.ts +0 -27
- package/lib/@types/huawei/huawei-api-gateway-response.d.ts.map +0 -1
- package/lib/@types/huawei/huawei-api-gateway-response.js +0 -2
- package/lib/@types/huawei/huawei-api-gateway-response.js.map +0 -1
- package/lib/@types/huawei/huawei-context.d.ts +0 -188
- package/lib/@types/huawei/huawei-context.d.ts.map +0 -1
- package/lib/@types/huawei/huawei-context.js +0 -2
- package/lib/@types/huawei/huawei-context.js.map +0 -1
- package/lib/@types/huawei/index.d.ts +0 -4
- package/lib/@types/huawei/index.d.ts.map +0 -1
- package/lib/@types/huawei/index.js +0 -2
- package/lib/@types/huawei/index.js.map +0 -1
- package/lib/@types/index.d.ts +0 -4
- package/lib/@types/index.d.ts.map +0 -1
- package/lib/@types/index.js +0 -2
- package/lib/@types/index.js.map +0 -1
- package/lib/adapters/apollo-server/apollo-server-mutation.adapter.d.ts.map +0 -1
- package/lib/adapters/apollo-server/apollo-server-mutation.adapter.js +0 -2
- package/lib/adapters/apollo-server/apollo-server-mutation.adapter.js.map +0 -1
- package/lib/adapters/apollo-server/index.d.ts.map +0 -1
- package/lib/adapters/apollo-server/index.js +0 -2
- package/lib/adapters/apollo-server/index.js.map +0 -1
- package/lib/adapters/aws/alb.adapter.d.ts +0 -71
- package/lib/adapters/aws/alb.adapter.d.ts.map +0 -1
- package/lib/adapters/aws/alb.adapter.js +0 -2
- package/lib/adapters/aws/alb.adapter.js.map +0 -1
- package/lib/adapters/aws/api-gateway-v1.adapter.d.ts +0 -76
- package/lib/adapters/aws/api-gateway-v1.adapter.d.ts.map +0 -1
- package/lib/adapters/aws/api-gateway-v1.adapter.js +0 -2
- package/lib/adapters/aws/api-gateway-v1.adapter.js.map +0 -1
- package/lib/adapters/aws/api-gateway-v2.adapter.d.ts +0 -75
- package/lib/adapters/aws/api-gateway-v2.adapter.d.ts.map +0 -1
- package/lib/adapters/aws/api-gateway-v2.adapter.js +0 -2
- package/lib/adapters/aws/api-gateway-v2.adapter.js.map +0 -1
- package/lib/adapters/aws/base/aws-simple-adapter.d.ts +0 -83
- package/lib/adapters/aws/base/aws-simple-adapter.d.ts.map +0 -1
- package/lib/adapters/aws/base/aws-simple-adapter.js +0 -2
- package/lib/adapters/aws/base/aws-simple-adapter.js.map +0 -1
- package/lib/adapters/aws/base/index.d.ts +0 -2
- package/lib/adapters/aws/base/index.d.ts.map +0 -1
- package/lib/adapters/aws/base/index.js +0 -2
- package/lib/adapters/aws/base/index.js.map +0 -1
- package/lib/adapters/aws/dynamodb.adapter.d.ts +0 -56
- package/lib/adapters/aws/dynamodb.adapter.d.ts.map +0 -1
- package/lib/adapters/aws/dynamodb.adapter.js +0 -2
- package/lib/adapters/aws/dynamodb.adapter.js.map +0 -1
- package/lib/adapters/aws/event-bridge.adapter.d.ts +0 -63
- package/lib/adapters/aws/event-bridge.adapter.d.ts.map +0 -1
- package/lib/adapters/aws/event-bridge.adapter.js +0 -2
- package/lib/adapters/aws/event-bridge.adapter.js.map +0 -1
- package/lib/adapters/aws/index.d.ts.map +0 -1
- package/lib/adapters/aws/index.js +0 -2
- package/lib/adapters/aws/index.js.map +0 -1
- package/lib/adapters/aws/lambda-edge.adapter.d.ts +0 -209
- package/lib/adapters/aws/lambda-edge.adapter.d.ts.map +0 -1
- package/lib/adapters/aws/lambda-edge.adapter.js +0 -2
- package/lib/adapters/aws/lambda-edge.adapter.js.map +0 -1
- package/lib/adapters/aws/request-lambda-edge.adapter.d.ts +0 -131
- package/lib/adapters/aws/request-lambda-edge.adapter.d.ts.map +0 -1
- package/lib/adapters/aws/request-lambda-edge.adapter.js +0 -2
- package/lib/adapters/aws/request-lambda-edge.adapter.js.map +0 -1
- package/lib/adapters/aws/s3.adapter.d.ts +0 -56
- package/lib/adapters/aws/s3.adapter.d.ts.map +0 -1
- package/lib/adapters/aws/s3.adapter.js +0 -2
- package/lib/adapters/aws/s3.adapter.js.map +0 -1
- package/lib/adapters/aws/sns.adapter.d.ts +0 -56
- package/lib/adapters/aws/sns.adapter.d.ts.map +0 -1
- package/lib/adapters/aws/sns.adapter.js +0 -2
- package/lib/adapters/aws/sns.adapter.js.map +0 -1
- package/lib/adapters/aws/sqs.adapter.d.ts +0 -56
- package/lib/adapters/aws/sqs.adapter.d.ts.map +0 -1
- package/lib/adapters/aws/sqs.adapter.js +0 -2
- package/lib/adapters/aws/sqs.adapter.js.map +0 -1
- package/lib/adapters/azure/http-trigger-v4.adapter.d.ts.map +0 -1
- package/lib/adapters/azure/http-trigger-v4.adapter.js +0 -2
- package/lib/adapters/azure/http-trigger-v4.adapter.js.map +0 -1
- package/lib/adapters/azure/index.d.ts.map +0 -1
- package/lib/adapters/azure/index.js +0 -2
- package/lib/adapters/azure/index.js.map +0 -1
- package/lib/adapters/digital-ocean/http-function.adapter.d.ts +0 -65
- package/lib/adapters/digital-ocean/http-function.adapter.d.ts.map +0 -1
- package/lib/adapters/digital-ocean/http-function.adapter.js +0 -2
- package/lib/adapters/digital-ocean/http-function.adapter.js.map +0 -1
- package/lib/adapters/digital-ocean/index.d.ts.map +0 -1
- package/lib/adapters/digital-ocean/index.js +0 -2
- package/lib/adapters/digital-ocean/index.js.map +0 -1
- package/lib/adapters/dummy/dummy.adapter.d.ts.map +0 -1
- package/lib/adapters/dummy/dummy.adapter.js +0 -2
- package/lib/adapters/dummy/dummy.adapter.js.map +0 -1
- package/lib/adapters/dummy/index.d.ts.map +0 -1
- package/lib/adapters/dummy/index.js +0 -2
- package/lib/adapters/dummy/index.js.map +0 -1
- package/lib/adapters/huawei/huawei-api-gateway.adapter.d.ts +0 -66
- package/lib/adapters/huawei/huawei-api-gateway.adapter.d.ts.map +0 -1
- package/lib/adapters/huawei/huawei-api-gateway.adapter.js +0 -2
- package/lib/adapters/huawei/huawei-api-gateway.adapter.js.map +0 -1
- package/lib/adapters/huawei/index.d.ts.map +0 -1
- package/lib/adapters/huawei/index.js +0 -2
- package/lib/adapters/huawei/index.js.map +0 -1
- package/lib/contracts/adapter.contract.d.ts +0 -152
- package/lib/contracts/adapter.contract.d.ts.map +0 -1
- package/lib/contracts/adapter.contract.js +0 -2
- package/lib/contracts/adapter.contract.js.map +0 -1
- package/lib/contracts/framework.contract.d.ts.map +0 -1
- package/lib/contracts/framework.contract.js +0 -2
- package/lib/contracts/framework.contract.js.map +0 -1
- package/lib/contracts/handler.contract.d.ts +0 -25
- package/lib/contracts/handler.contract.d.ts.map +0 -1
- package/lib/contracts/handler.contract.js +0 -2
- package/lib/contracts/handler.contract.js.map +0 -1
- package/lib/contracts/index.d.ts +0 -5
- package/lib/contracts/index.d.ts.map +0 -1
- package/lib/contracts/index.js +0 -2
- package/lib/contracts/index.js.map +0 -1
- package/lib/contracts/resolver.contract.d.ts +0 -83
- package/lib/contracts/resolver.contract.d.ts.map +0 -1
- package/lib/contracts/resolver.contract.js +0 -2
- package/lib/contracts/resolver.contract.js.map +0 -1
- package/lib/core/base-handler.d.ts.map +0 -1
- package/lib/core/base-handler.js +0 -2
- package/lib/core/base-handler.js.map +0 -1
- package/lib/core/constants.d.ts.map +0 -1
- package/lib/core/constants.js +0 -2
- package/lib/core/constants.js.map +0 -1
- package/lib/core/current-invoke.d.ts +0 -48
- package/lib/core/current-invoke.d.ts.map +0 -1
- package/lib/core/current-invoke.js +0 -2
- package/lib/core/current-invoke.js.map +0 -1
- package/lib/core/event-body.d.ts +0 -22
- package/lib/core/event-body.d.ts.map +0 -1
- package/lib/core/event-body.js +0 -2
- package/lib/core/event-body.js.map +0 -1
- package/lib/core/headers.d.ts +0 -73
- package/lib/core/headers.d.ts.map +0 -1
- package/lib/core/headers.js +0 -3
- package/lib/core/headers.js.map +0 -1
- package/lib/core/index.d.ts +0 -12
- package/lib/core/index.d.ts.map +0 -1
- package/lib/core/index.js +0 -2
- package/lib/core/index.js.map +0 -1
- package/lib/core/is-binary.d.ts +0 -73
- package/lib/core/is-binary.d.ts.map +0 -1
- package/lib/core/is-binary.js +0 -2
- package/lib/core/is-binary.js.map +0 -1
- package/lib/core/logger.d.ts.map +0 -1
- package/lib/core/logger.js +0 -2
- package/lib/core/logger.js.map +0 -1
- package/lib/core/no-op.d.ts +0 -8
- package/lib/core/no-op.d.ts.map +0 -1
- package/lib/core/no-op.js +0 -2
- package/lib/core/no-op.js.map +0 -1
- package/lib/core/optional.d.ts +0 -22
- package/lib/core/optional.d.ts.map +0 -1
- package/lib/core/optional.js +0 -2
- package/lib/core/optional.js.map +0 -1
- package/lib/core/path.d.ts.map +0 -1
- package/lib/core/path.js +0 -2
- package/lib/core/path.js.map +0 -1
- package/lib/core/stream.d.ts +0 -21
- package/lib/core/stream.d.ts.map +0 -1
- package/lib/core/stream.js +0 -2
- package/lib/core/stream.js.map +0 -1
- package/lib/frameworks/apollo-server/apollo-server.framework.d.ts.map +0 -1
- package/lib/frameworks/apollo-server/apollo-server.framework.js +0 -2
- package/lib/frameworks/apollo-server/apollo-server.framework.js.map +0 -1
- package/lib/frameworks/apollo-server/index.d.ts.map +0 -1
- package/lib/frameworks/apollo-server/index.js +0 -2
- package/lib/frameworks/apollo-server/index.js.map +0 -1
- package/lib/frameworks/body-parser/base-body-parser.framework.d.ts +0 -69
- package/lib/frameworks/body-parser/base-body-parser.framework.d.ts.map +0 -1
- package/lib/frameworks/body-parser/base-body-parser.framework.js +0 -2
- package/lib/frameworks/body-parser/base-body-parser.framework.js.map +0 -1
- package/lib/frameworks/body-parser/index.d.ts.map +0 -1
- package/lib/frameworks/body-parser/index.js +0 -2
- package/lib/frameworks/body-parser/index.js.map +0 -1
- package/lib/frameworks/body-parser/json-body-parser.framework.d.ts +0 -26
- package/lib/frameworks/body-parser/json-body-parser.framework.d.ts.map +0 -1
- package/lib/frameworks/body-parser/json-body-parser.framework.js +0 -2
- package/lib/frameworks/body-parser/json-body-parser.framework.js.map +0 -1
- package/lib/frameworks/body-parser/raw-body-parser.framework.d.ts +0 -26
- package/lib/frameworks/body-parser/raw-body-parser.framework.d.ts.map +0 -1
- package/lib/frameworks/body-parser/raw-body-parser.framework.js +0 -2
- package/lib/frameworks/body-parser/raw-body-parser.framework.js.map +0 -1
- package/lib/frameworks/body-parser/text-body-parser.framework.d.ts +0 -26
- package/lib/frameworks/body-parser/text-body-parser.framework.d.ts.map +0 -1
- package/lib/frameworks/body-parser/text-body-parser.framework.js +0 -2
- package/lib/frameworks/body-parser/text-body-parser.framework.js.map +0 -1
- package/lib/frameworks/body-parser/urlencoded-body-parser.framework.d.ts +0 -26
- package/lib/frameworks/body-parser/urlencoded-body-parser.framework.d.ts.map +0 -1
- package/lib/frameworks/body-parser/urlencoded-body-parser.framework.js +0 -2
- package/lib/frameworks/body-parser/urlencoded-body-parser.framework.js.map +0 -1
- package/lib/frameworks/cors/cors.framework.d.ts.map +0 -1
- package/lib/frameworks/cors/cors.framework.js +0 -3
- package/lib/frameworks/cors/cors.framework.js.map +0 -1
- package/lib/frameworks/cors/index.d.ts.map +0 -1
- package/lib/frameworks/cors/index.js +0 -2
- package/lib/frameworks/cors/index.js.map +0 -1
- package/lib/frameworks/deepkit/http-deepkit.framework.d.ts.map +0 -1
- package/lib/frameworks/deepkit/http-deepkit.framework.js +0 -2
- package/lib/frameworks/deepkit/http-deepkit.framework.js.map +0 -1
- package/lib/frameworks/deepkit/index.d.ts.map +0 -1
- package/lib/frameworks/deepkit/index.js +0 -2
- package/lib/frameworks/deepkit/index.js.map +0 -1
- package/lib/frameworks/express/express.framework.d.ts.map +0 -1
- package/lib/frameworks/express/express.framework.js +0 -2
- package/lib/frameworks/express/express.framework.js.map +0 -1
- package/lib/frameworks/express/index.d.ts.map +0 -1
- package/lib/frameworks/express/index.js +0 -2
- package/lib/frameworks/express/index.js.map +0 -1
- package/lib/frameworks/fastify/fastify.framework.d.ts.map +0 -1
- package/lib/frameworks/fastify/fastify.framework.js +0 -2
- package/lib/frameworks/fastify/fastify.framework.js.map +0 -1
- package/lib/frameworks/fastify/helpers/no-op-content-parser.d.ts +0 -14
- package/lib/frameworks/fastify/helpers/no-op-content-parser.d.ts.map +0 -1
- package/lib/frameworks/fastify/helpers/no-op-content-parser.js +0 -2
- package/lib/frameworks/fastify/helpers/no-op-content-parser.js.map +0 -1
- package/lib/frameworks/fastify/index.d.ts.map +0 -1
- package/lib/frameworks/fastify/index.js +0 -2
- package/lib/frameworks/fastify/index.js.map +0 -1
- package/lib/frameworks/hapi/hapi.framework.d.ts.map +0 -1
- package/lib/frameworks/hapi/hapi.framework.js +0 -2
- package/lib/frameworks/hapi/hapi.framework.js.map +0 -1
- package/lib/frameworks/hapi/index.d.ts.map +0 -1
- package/lib/frameworks/hapi/index.js +0 -2
- package/lib/frameworks/hapi/index.js.map +0 -1
- package/lib/frameworks/koa/index.d.ts.map +0 -1
- package/lib/frameworks/koa/index.js +0 -2
- package/lib/frameworks/koa/index.js.map +0 -1
- package/lib/frameworks/koa/koa.framework.d.ts.map +0 -1
- package/lib/frameworks/koa/koa.framework.js +0 -2
- package/lib/frameworks/koa/koa.framework.js.map +0 -1
- package/lib/frameworks/lazy/index.d.ts.map +0 -1
- package/lib/frameworks/lazy/index.js +0 -2
- package/lib/frameworks/lazy/index.js.map +0 -1
- package/lib/frameworks/lazy/lazy.framework.d.ts.map +0 -1
- package/lib/frameworks/lazy/lazy.framework.js +0 -2
- package/lib/frameworks/lazy/lazy.framework.js.map +0 -1
- package/lib/frameworks/trpc/index.d.ts.map +0 -1
- package/lib/frameworks/trpc/index.js +0 -2
- package/lib/frameworks/trpc/index.js.map +0 -1
- package/lib/frameworks/trpc/trpc.framework.d.ts.map +0 -1
- package/lib/frameworks/trpc/trpc.framework.js +0 -2
- package/lib/frameworks/trpc/trpc.framework.js.map +0 -1
- package/lib/handlers/aws/aws-stream.handler.d.ts.map +0 -1
- package/lib/handlers/aws/aws-stream.handler.js +0 -2
- package/lib/handlers/aws/aws-stream.handler.js.map +0 -1
- package/lib/handlers/aws/index.d.ts.map +0 -1
- package/lib/handlers/aws/index.js +0 -2
- package/lib/handlers/aws/index.js.map +0 -1
- package/lib/handlers/azure/azure.handler.d.ts.map +0 -1
- package/lib/handlers/azure/azure.handler.js +0 -2
- package/lib/handlers/azure/azure.handler.js.map +0 -1
- package/lib/handlers/azure/index.d.ts.map +0 -1
- package/lib/handlers/azure/index.js +0 -2
- package/lib/handlers/azure/index.js.map +0 -1
- package/lib/handlers/base/index.d.ts +0 -2
- package/lib/handlers/base/index.d.ts.map +0 -1
- package/lib/handlers/base/index.js +0 -2
- package/lib/handlers/base/index.js.map +0 -1
- package/lib/handlers/base/raw-request.d.ts.map +0 -1
- package/lib/handlers/base/raw-request.js +0 -2
- package/lib/handlers/base/raw-request.js.map +0 -1
- package/lib/handlers/default/default.handler.d.ts.map +0 -1
- package/lib/handlers/default/default.handler.js +0 -2
- package/lib/handlers/default/default.handler.js.map +0 -1
- package/lib/handlers/default/index.d.ts.map +0 -1
- package/lib/handlers/default/index.js +0 -2
- package/lib/handlers/default/index.js.map +0 -1
- package/lib/handlers/digital-ocean/digital-ocean.handler.d.ts +0 -17
- package/lib/handlers/digital-ocean/digital-ocean.handler.d.ts.map +0 -1
- package/lib/handlers/digital-ocean/digital-ocean.handler.js +0 -2
- package/lib/handlers/digital-ocean/digital-ocean.handler.js.map +0 -1
- package/lib/handlers/digital-ocean/index.d.ts.map +0 -1
- package/lib/handlers/digital-ocean/index.js +0 -2
- package/lib/handlers/digital-ocean/index.js.map +0 -1
- package/lib/handlers/firebase/http-firebase-v2.handler.d.ts +0 -27
- package/lib/handlers/firebase/http-firebase-v2.handler.d.ts.map +0 -1
- package/lib/handlers/firebase/http-firebase-v2.handler.js +0 -2
- package/lib/handlers/firebase/http-firebase-v2.handler.js.map +0 -1
- package/lib/handlers/firebase/http-firebase.handler.d.ts +0 -19
- package/lib/handlers/firebase/http-firebase.handler.d.ts.map +0 -1
- package/lib/handlers/firebase/http-firebase.handler.js +0 -2
- package/lib/handlers/firebase/http-firebase.handler.js.map +0 -1
- package/lib/handlers/firebase/index.d.ts.map +0 -1
- package/lib/handlers/firebase/index.js +0 -2
- package/lib/handlers/firebase/index.js.map +0 -1
- package/lib/handlers/gcp/gcp.handler.d.ts.map +0 -1
- package/lib/handlers/gcp/gcp.handler.js +0 -2
- package/lib/handlers/gcp/gcp.handler.js.map +0 -1
- package/lib/handlers/gcp/index.d.ts.map +0 -1
- package/lib/handlers/gcp/index.js +0 -2
- package/lib/handlers/gcp/index.js.map +0 -1
- package/lib/handlers/huawei/http-huawei.handler.d.ts.map +0 -1
- package/lib/handlers/huawei/http-huawei.handler.js +0 -2
- package/lib/handlers/huawei/http-huawei.handler.js.map +0 -1
- package/lib/handlers/huawei/index.d.ts.map +0 -1
- package/lib/handlers/huawei/index.js +0 -2
- package/lib/handlers/huawei/index.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.doc.js +0 -2
- package/lib/index.doc.js.map +0 -1
- package/lib/index.js +0 -2
- package/lib/index.js.map +0 -1
- package/lib/network/index.d.ts +0 -5
- package/lib/network/index.d.ts.map +0 -1
- package/lib/network/index.js +0 -2
- package/lib/network/index.js.map +0 -1
- package/lib/network/request.d.ts.map +0 -1
- package/lib/network/request.js +0 -2
- package/lib/network/request.js.map +0 -1
- package/lib/network/response-stream.d.ts +0 -41
- package/lib/network/response-stream.d.ts.map +0 -1
- package/lib/network/response-stream.js +0 -7
- package/lib/network/response-stream.js.map +0 -1
- package/lib/network/response.d.ts +0 -48
- package/lib/network/response.d.ts.map +0 -1
- package/lib/network/response.js +0 -4
- package/lib/network/response.js.map +0 -1
- package/lib/network/utils.d.ts +0 -9
- package/lib/network/utils.d.ts.map +0 -1
- package/lib/network/utils.js +0 -2
- package/lib/network/utils.js.map +0 -1
- package/lib/resolvers/aws-context/aws-context.resolver.d.ts.map +0 -1
- package/lib/resolvers/aws-context/aws-context.resolver.js +0 -2
- package/lib/resolvers/aws-context/aws-context.resolver.js.map +0 -1
- package/lib/resolvers/aws-context/index.d.ts.map +0 -1
- package/lib/resolvers/aws-context/index.js +0 -2
- package/lib/resolvers/aws-context/index.js.map +0 -1
- package/lib/resolvers/callback/callback.resolver.d.ts.map +0 -1
- package/lib/resolvers/callback/callback.resolver.js +0 -2
- package/lib/resolvers/callback/callback.resolver.js.map +0 -1
- package/lib/resolvers/callback/index.d.ts.map +0 -1
- package/lib/resolvers/callback/index.js +0 -2
- package/lib/resolvers/callback/index.js.map +0 -1
- package/lib/resolvers/dummy/dummy.resolver.d.ts +0 -14
- package/lib/resolvers/dummy/dummy.resolver.d.ts.map +0 -1
- package/lib/resolvers/dummy/dummy.resolver.js +0 -2
- package/lib/resolvers/dummy/dummy.resolver.js.map +0 -1
- package/lib/resolvers/dummy/index.d.ts.map +0 -1
- package/lib/resolvers/dummy/index.js +0 -2
- package/lib/resolvers/dummy/index.js.map +0 -1
- package/lib/resolvers/promise/index.d.ts.map +0 -1
- package/lib/resolvers/promise/index.js +0 -2
- package/lib/resolvers/promise/index.js.map +0 -1
- package/lib/resolvers/promise/promise.resolver.d.ts +0 -14
- package/lib/resolvers/promise/promise.resolver.d.ts.map +0 -1
- package/lib/resolvers/promise/promise.resolver.js +0 -2
- package/lib/resolvers/promise/promise.resolver.js.map +0 -1
- package/lib/serverless-adapter.d.ts +0 -119
- package/lib/serverless-adapter.d.ts.map +0 -1
- package/lib/serverless-adapter.js +0 -2
- package/lib/serverless-adapter.js.map +0 -1
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { S as SingleValueHeaders, B as BothValueHeaders } from './headers-K2qbcurv.js';
|
|
2
|
+
import * as http from 'http';
|
|
3
|
+
import { ServerResponse, IncomingMessage } from 'node:http';
|
|
4
|
+
import { I as ILogger } from './logger-9me5n48P.js';
|
|
5
|
+
|
|
6
|
+
declare const BODY: unique symbol;
|
|
7
|
+
declare const HEADERS: unique symbol;
|
|
8
|
+
/**
|
|
9
|
+
* The properties to create a {@link ServerlessResponse}.
|
|
10
|
+
*
|
|
11
|
+
* @breadcrumb Network / ServerlessResponse
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
interface ServerlessResponseProps {
|
|
15
|
+
/**
|
|
16
|
+
* The HTTP Method from request
|
|
17
|
+
*/
|
|
18
|
+
method?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The class that represents a response instance used to send to the framework and wait until the framework finishes processing the request.
|
|
22
|
+
* Once it's happens, we use the properties from this response to built the response to the cloud.
|
|
23
|
+
*
|
|
24
|
+
* @breadcrumb Network / ServerlessResponse
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
declare class ServerlessResponse extends ServerResponse {
|
|
28
|
+
constructor({ method }: ServerlessResponseProps);
|
|
29
|
+
_header: string;
|
|
30
|
+
_headers?: Record<any, any>;
|
|
31
|
+
_wroteHeader?: boolean;
|
|
32
|
+
[BODY]: any[];
|
|
33
|
+
[HEADERS]: Record<any, any>;
|
|
34
|
+
get headers(): Record<any, any>;
|
|
35
|
+
static from(res: IncomingMessage): ServerlessResponse;
|
|
36
|
+
static body(res: ServerlessResponse): Buffer;
|
|
37
|
+
static headers(res: ServerlessResponse): http.OutgoingHttpHeaders & Record<any, any>;
|
|
38
|
+
setHeader(key: string, value: number | string | readonly string[]): any;
|
|
39
|
+
writeHead(statusCode: number, statusMessage?: string | any | any[], obj?: any | any[]): any;
|
|
40
|
+
/**
|
|
41
|
+
* I use ignore here because in nodejs 12.x, statusMessage can be string | OutgoingHttpHeaders
|
|
42
|
+
* But in nodejs \>=14.x, statusMessage can also be OutgoingHttpHeaders[]
|
|
43
|
+
* I take care of these cases above, but here I can't handle it well, so I give up
|
|
44
|
+
* nodejs 12.x ref: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v12/http.d.ts#L229
|
|
45
|
+
* nodejs 14.x ref: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v14/http.d.ts#L263
|
|
46
|
+
*/
|
|
47
|
+
protected callNativeWriteHead(statusCode: number, statusMessage?: string | any | any[], obj?: any | any[]): this;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The type that represents a resolver used to send the response, error or success, to the client
|
|
52
|
+
*
|
|
53
|
+
* @breadcrumb Contracts / ResolverContract
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
type Resolver<TResponse, TReturn> = {
|
|
57
|
+
/**
|
|
58
|
+
* 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
|
|
59
|
+
*
|
|
60
|
+
* @param task - The task to be executed
|
|
61
|
+
*/
|
|
62
|
+
run(task: () => Promise<TResponse>): TReturn;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* The type that represents a delegate resolver that is passed to the adapter to handle what to do when an error occurs during forwarding.
|
|
66
|
+
*
|
|
67
|
+
* @breadcrumb Contracts / ResolverContract
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
type DelegatedResolver<TResponse> = {
|
|
71
|
+
/**
|
|
72
|
+
* Send the success response to the client
|
|
73
|
+
*
|
|
74
|
+
* @param success - The serverless response
|
|
75
|
+
*/
|
|
76
|
+
succeed: (response: TResponse) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Send the error response to the client
|
|
79
|
+
*
|
|
80
|
+
* @param error - The error object
|
|
81
|
+
*/
|
|
82
|
+
fail: (error: Error) => void;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* The createResolver contract props
|
|
86
|
+
*
|
|
87
|
+
* @breadcrumb Contracts / ResolverContract
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
90
|
+
type ResolverProps<TEvent, TContext, TCallback, TResponse> = {
|
|
91
|
+
/**
|
|
92
|
+
* The event sent by the serverless environment
|
|
93
|
+
*/
|
|
94
|
+
event: TEvent;
|
|
95
|
+
/**
|
|
96
|
+
* Indicates whether to forward the (error.stack) or not to the client
|
|
97
|
+
*/
|
|
98
|
+
respondWithErrors: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* The instance of the logger
|
|
101
|
+
*/
|
|
102
|
+
log: ILogger;
|
|
103
|
+
/**
|
|
104
|
+
* The instance of the adapter
|
|
105
|
+
*/
|
|
106
|
+
adapter: AdapterContract<TEvent, TContext, TResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* The context sent by serverless
|
|
109
|
+
*/
|
|
110
|
+
context?: TContext;
|
|
111
|
+
/**
|
|
112
|
+
* The callback sent by serverless
|
|
113
|
+
*/
|
|
114
|
+
callback?: TCallback;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* The interface that represents the contract used to send the response to the client
|
|
118
|
+
*
|
|
119
|
+
* @breadcrumb Contracts / ResolverContract
|
|
120
|
+
* @public
|
|
121
|
+
*/
|
|
122
|
+
interface ResolverContract<TEvent, TContext, TCallback, TResponse, TReturn> {
|
|
123
|
+
/**
|
|
124
|
+
* Create the resolver based on the context, callback or promise
|
|
125
|
+
*
|
|
126
|
+
* @param props - The props used to create the resolver
|
|
127
|
+
*/
|
|
128
|
+
createResolver(props: ResolverProps<TEvent, TContext, TCallback, TResponse>): Resolver<TResponse, TReturn>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The request interface used to bridge any event source to the framework.
|
|
133
|
+
*
|
|
134
|
+
* @breadcrumb Contracts / AdapterContract
|
|
135
|
+
* @public
|
|
136
|
+
*/
|
|
137
|
+
interface AdapterRequest {
|
|
138
|
+
/**
|
|
139
|
+
* The HTTP Method to use to create the request to the framework
|
|
140
|
+
*/
|
|
141
|
+
method: string;
|
|
142
|
+
/**
|
|
143
|
+
* The path to use to create the request to the framework
|
|
144
|
+
*/
|
|
145
|
+
path: string;
|
|
146
|
+
/**
|
|
147
|
+
* The headers to use to create the request to the framework
|
|
148
|
+
*/
|
|
149
|
+
headers: SingleValueHeaders;
|
|
150
|
+
/**
|
|
151
|
+
* The body as buffer to use to create the request to the framework
|
|
152
|
+
*/
|
|
153
|
+
body?: Buffer;
|
|
154
|
+
/**
|
|
155
|
+
* The remote address (client ip) to use to create the request to the framework
|
|
156
|
+
*/
|
|
157
|
+
remoteAddress?: string;
|
|
158
|
+
/**
|
|
159
|
+
* The address of the event source (used in Lambda\@edge)
|
|
160
|
+
*
|
|
161
|
+
* @deprecated It is no longer used in the library and will be removed in the next major release.
|
|
162
|
+
*/
|
|
163
|
+
host?: string;
|
|
164
|
+
/**
|
|
165
|
+
* The address of the event source (used in Lambda\@edge)
|
|
166
|
+
*
|
|
167
|
+
* @deprecated It is no longer used in the library and will be removed in the next major release.
|
|
168
|
+
*/
|
|
169
|
+
hostname?: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The props of the method that get the response from the framework and transform it into a format that the event source can handle
|
|
173
|
+
*
|
|
174
|
+
* @breadcrumb Contracts / AdapterContract
|
|
175
|
+
* @public
|
|
176
|
+
*/
|
|
177
|
+
interface GetResponseAdapterProps<TEvent> {
|
|
178
|
+
/**
|
|
179
|
+
* The event sent by the serverless
|
|
180
|
+
*/
|
|
181
|
+
event: TEvent;
|
|
182
|
+
/**
|
|
183
|
+
* The framework {@link ServerlessResponse | response}.
|
|
184
|
+
*
|
|
185
|
+
* @remarks It can be optional, as this method can be used when an error occurs during the handling of the request by the framework.
|
|
186
|
+
*/
|
|
187
|
+
response?: ServerlessResponse;
|
|
188
|
+
/**
|
|
189
|
+
* The framework response status code
|
|
190
|
+
*/
|
|
191
|
+
statusCode: number;
|
|
192
|
+
/**
|
|
193
|
+
* The framework response body
|
|
194
|
+
*/
|
|
195
|
+
body: string;
|
|
196
|
+
/**
|
|
197
|
+
* The framework response headers
|
|
198
|
+
*/
|
|
199
|
+
headers: BothValueHeaders;
|
|
200
|
+
/**
|
|
201
|
+
* Indicates whether the response is base64 encoded or not
|
|
202
|
+
*/
|
|
203
|
+
isBase64Encoded: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* The instance of the logger
|
|
206
|
+
*/
|
|
207
|
+
log: ILogger;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* The props of the method that handle the response when an error occurs while forwarding the request to the framework
|
|
211
|
+
*
|
|
212
|
+
* @breadcrumb Contracts / AdapterContract
|
|
213
|
+
* @public
|
|
214
|
+
*/
|
|
215
|
+
interface OnErrorProps<TEvent, TResponse> {
|
|
216
|
+
/**
|
|
217
|
+
* The event sent by the serverless
|
|
218
|
+
*/
|
|
219
|
+
event: TEvent;
|
|
220
|
+
/**
|
|
221
|
+
* The error throwed during forwarding
|
|
222
|
+
*/
|
|
223
|
+
error: Error;
|
|
224
|
+
/**
|
|
225
|
+
* The instance of the resolver
|
|
226
|
+
*/
|
|
227
|
+
delegatedResolver: DelegatedResolver<TResponse>;
|
|
228
|
+
/**
|
|
229
|
+
* Indicates whether to forward the (error.stack) or not to the client
|
|
230
|
+
*/
|
|
231
|
+
respondWithErrors: boolean;
|
|
232
|
+
/**
|
|
233
|
+
* The instance of the logger
|
|
234
|
+
*/
|
|
235
|
+
log: ILogger;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* The interface that represents a contract between the adapter and the actual implementation of the adapter.
|
|
239
|
+
*
|
|
240
|
+
* @breadcrumb Contracts / AdapterContract
|
|
241
|
+
* @public
|
|
242
|
+
*/
|
|
243
|
+
interface AdapterContract<TEvent, TContext, TResponse> {
|
|
244
|
+
/**
|
|
245
|
+
* Get the adapter name
|
|
246
|
+
*/
|
|
247
|
+
getAdapterName(): string;
|
|
248
|
+
/**
|
|
249
|
+
* Decide if this adapter can handle a request based in the event payload
|
|
250
|
+
*
|
|
251
|
+
* @param event - The event sent by serverless
|
|
252
|
+
* @param context - The context sent by the serverless
|
|
253
|
+
* @param log - The instance of logger
|
|
254
|
+
*/
|
|
255
|
+
canHandle(event: unknown, context: TContext, log: ILogger): boolean;
|
|
256
|
+
/**
|
|
257
|
+
* Maps the serverless payload to an actual request that a framework can handle
|
|
258
|
+
*
|
|
259
|
+
* @param event - The event sent by serverless
|
|
260
|
+
* @param context - The context sent by the serverless
|
|
261
|
+
* @param log - The instance of logger
|
|
262
|
+
*/
|
|
263
|
+
getRequest(event: TEvent, context: TContext, log: ILogger): AdapterRequest;
|
|
264
|
+
/**
|
|
265
|
+
* Maps the response of the framework to a payload that serverless can handle
|
|
266
|
+
*
|
|
267
|
+
* @param props - The props sent by serverless
|
|
268
|
+
*/
|
|
269
|
+
getResponse(props: GetResponseAdapterProps<TEvent>): TResponse;
|
|
270
|
+
/**
|
|
271
|
+
* When an error occurs while forwarding the request to the framework
|
|
272
|
+
*
|
|
273
|
+
* @remarks You must call resolver.fail or resolver.succeed when implementing this method.
|
|
274
|
+
*/
|
|
275
|
+
onErrorWhileForwarding(props: OnErrorProps<TEvent, TResponse>): void;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export { type AdapterContract as A, type DelegatedResolver as D, type GetResponseAdapterProps as G, type OnErrorProps as O, type ResolverContract as R, ServerlessResponse as S, type AdapterRequest as a, type ResolverProps as b, type Resolver as c, type ServerlessResponseProps as d };
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { S as SingleValueHeaders, B as BothValueHeaders } from './headers-K2qbcurv.cjs';
|
|
2
|
+
import * as http from 'http';
|
|
3
|
+
import { ServerResponse, IncomingMessage } from 'node:http';
|
|
4
|
+
import { I as ILogger } from './logger-9me5n48P.cjs';
|
|
5
|
+
|
|
6
|
+
declare const BODY: unique symbol;
|
|
7
|
+
declare const HEADERS: unique symbol;
|
|
8
|
+
/**
|
|
9
|
+
* The properties to create a {@link ServerlessResponse}.
|
|
10
|
+
*
|
|
11
|
+
* @breadcrumb Network / ServerlessResponse
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
interface ServerlessResponseProps {
|
|
15
|
+
/**
|
|
16
|
+
* The HTTP Method from request
|
|
17
|
+
*/
|
|
18
|
+
method?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The class that represents a response instance used to send to the framework and wait until the framework finishes processing the request.
|
|
22
|
+
* Once it's happens, we use the properties from this response to built the response to the cloud.
|
|
23
|
+
*
|
|
24
|
+
* @breadcrumb Network / ServerlessResponse
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
declare class ServerlessResponse extends ServerResponse {
|
|
28
|
+
constructor({ method }: ServerlessResponseProps);
|
|
29
|
+
_header: string;
|
|
30
|
+
_headers?: Record<any, any>;
|
|
31
|
+
_wroteHeader?: boolean;
|
|
32
|
+
[BODY]: any[];
|
|
33
|
+
[HEADERS]: Record<any, any>;
|
|
34
|
+
get headers(): Record<any, any>;
|
|
35
|
+
static from(res: IncomingMessage): ServerlessResponse;
|
|
36
|
+
static body(res: ServerlessResponse): Buffer;
|
|
37
|
+
static headers(res: ServerlessResponse): http.OutgoingHttpHeaders & Record<any, any>;
|
|
38
|
+
setHeader(key: string, value: number | string | readonly string[]): any;
|
|
39
|
+
writeHead(statusCode: number, statusMessage?: string | any | any[], obj?: any | any[]): any;
|
|
40
|
+
/**
|
|
41
|
+
* I use ignore here because in nodejs 12.x, statusMessage can be string | OutgoingHttpHeaders
|
|
42
|
+
* But in nodejs \>=14.x, statusMessage can also be OutgoingHttpHeaders[]
|
|
43
|
+
* I take care of these cases above, but here I can't handle it well, so I give up
|
|
44
|
+
* nodejs 12.x ref: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v12/http.d.ts#L229
|
|
45
|
+
* nodejs 14.x ref: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v14/http.d.ts#L263
|
|
46
|
+
*/
|
|
47
|
+
protected callNativeWriteHead(statusCode: number, statusMessage?: string | any | any[], obj?: any | any[]): this;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The type that represents a resolver used to send the response, error or success, to the client
|
|
52
|
+
*
|
|
53
|
+
* @breadcrumb Contracts / ResolverContract
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
type Resolver<TResponse, TReturn> = {
|
|
57
|
+
/**
|
|
58
|
+
* 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
|
|
59
|
+
*
|
|
60
|
+
* @param task - The task to be executed
|
|
61
|
+
*/
|
|
62
|
+
run(task: () => Promise<TResponse>): TReturn;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* The type that represents a delegate resolver that is passed to the adapter to handle what to do when an error occurs during forwarding.
|
|
66
|
+
*
|
|
67
|
+
* @breadcrumb Contracts / ResolverContract
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
type DelegatedResolver<TResponse> = {
|
|
71
|
+
/**
|
|
72
|
+
* Send the success response to the client
|
|
73
|
+
*
|
|
74
|
+
* @param success - The serverless response
|
|
75
|
+
*/
|
|
76
|
+
succeed: (response: TResponse) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Send the error response to the client
|
|
79
|
+
*
|
|
80
|
+
* @param error - The error object
|
|
81
|
+
*/
|
|
82
|
+
fail: (error: Error) => void;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* The createResolver contract props
|
|
86
|
+
*
|
|
87
|
+
* @breadcrumb Contracts / ResolverContract
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
90
|
+
type ResolverProps<TEvent, TContext, TCallback, TResponse> = {
|
|
91
|
+
/**
|
|
92
|
+
* The event sent by the serverless environment
|
|
93
|
+
*/
|
|
94
|
+
event: TEvent;
|
|
95
|
+
/**
|
|
96
|
+
* Indicates whether to forward the (error.stack) or not to the client
|
|
97
|
+
*/
|
|
98
|
+
respondWithErrors: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* The instance of the logger
|
|
101
|
+
*/
|
|
102
|
+
log: ILogger;
|
|
103
|
+
/**
|
|
104
|
+
* The instance of the adapter
|
|
105
|
+
*/
|
|
106
|
+
adapter: AdapterContract<TEvent, TContext, TResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* The context sent by serverless
|
|
109
|
+
*/
|
|
110
|
+
context?: TContext;
|
|
111
|
+
/**
|
|
112
|
+
* The callback sent by serverless
|
|
113
|
+
*/
|
|
114
|
+
callback?: TCallback;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* The interface that represents the contract used to send the response to the client
|
|
118
|
+
*
|
|
119
|
+
* @breadcrumb Contracts / ResolverContract
|
|
120
|
+
* @public
|
|
121
|
+
*/
|
|
122
|
+
interface ResolverContract<TEvent, TContext, TCallback, TResponse, TReturn> {
|
|
123
|
+
/**
|
|
124
|
+
* Create the resolver based on the context, callback or promise
|
|
125
|
+
*
|
|
126
|
+
* @param props - The props used to create the resolver
|
|
127
|
+
*/
|
|
128
|
+
createResolver(props: ResolverProps<TEvent, TContext, TCallback, TResponse>): Resolver<TResponse, TReturn>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The request interface used to bridge any event source to the framework.
|
|
133
|
+
*
|
|
134
|
+
* @breadcrumb Contracts / AdapterContract
|
|
135
|
+
* @public
|
|
136
|
+
*/
|
|
137
|
+
interface AdapterRequest {
|
|
138
|
+
/**
|
|
139
|
+
* The HTTP Method to use to create the request to the framework
|
|
140
|
+
*/
|
|
141
|
+
method: string;
|
|
142
|
+
/**
|
|
143
|
+
* The path to use to create the request to the framework
|
|
144
|
+
*/
|
|
145
|
+
path: string;
|
|
146
|
+
/**
|
|
147
|
+
* The headers to use to create the request to the framework
|
|
148
|
+
*/
|
|
149
|
+
headers: SingleValueHeaders;
|
|
150
|
+
/**
|
|
151
|
+
* The body as buffer to use to create the request to the framework
|
|
152
|
+
*/
|
|
153
|
+
body?: Buffer;
|
|
154
|
+
/**
|
|
155
|
+
* The remote address (client ip) to use to create the request to the framework
|
|
156
|
+
*/
|
|
157
|
+
remoteAddress?: string;
|
|
158
|
+
/**
|
|
159
|
+
* The address of the event source (used in Lambda\@edge)
|
|
160
|
+
*
|
|
161
|
+
* @deprecated It is no longer used in the library and will be removed in the next major release.
|
|
162
|
+
*/
|
|
163
|
+
host?: string;
|
|
164
|
+
/**
|
|
165
|
+
* The address of the event source (used in Lambda\@edge)
|
|
166
|
+
*
|
|
167
|
+
* @deprecated It is no longer used in the library and will be removed in the next major release.
|
|
168
|
+
*/
|
|
169
|
+
hostname?: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The props of the method that get the response from the framework and transform it into a format that the event source can handle
|
|
173
|
+
*
|
|
174
|
+
* @breadcrumb Contracts / AdapterContract
|
|
175
|
+
* @public
|
|
176
|
+
*/
|
|
177
|
+
interface GetResponseAdapterProps<TEvent> {
|
|
178
|
+
/**
|
|
179
|
+
* The event sent by the serverless
|
|
180
|
+
*/
|
|
181
|
+
event: TEvent;
|
|
182
|
+
/**
|
|
183
|
+
* The framework {@link ServerlessResponse | response}.
|
|
184
|
+
*
|
|
185
|
+
* @remarks It can be optional, as this method can be used when an error occurs during the handling of the request by the framework.
|
|
186
|
+
*/
|
|
187
|
+
response?: ServerlessResponse;
|
|
188
|
+
/**
|
|
189
|
+
* The framework response status code
|
|
190
|
+
*/
|
|
191
|
+
statusCode: number;
|
|
192
|
+
/**
|
|
193
|
+
* The framework response body
|
|
194
|
+
*/
|
|
195
|
+
body: string;
|
|
196
|
+
/**
|
|
197
|
+
* The framework response headers
|
|
198
|
+
*/
|
|
199
|
+
headers: BothValueHeaders;
|
|
200
|
+
/**
|
|
201
|
+
* Indicates whether the response is base64 encoded or not
|
|
202
|
+
*/
|
|
203
|
+
isBase64Encoded: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* The instance of the logger
|
|
206
|
+
*/
|
|
207
|
+
log: ILogger;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* The props of the method that handle the response when an error occurs while forwarding the request to the framework
|
|
211
|
+
*
|
|
212
|
+
* @breadcrumb Contracts / AdapterContract
|
|
213
|
+
* @public
|
|
214
|
+
*/
|
|
215
|
+
interface OnErrorProps<TEvent, TResponse> {
|
|
216
|
+
/**
|
|
217
|
+
* The event sent by the serverless
|
|
218
|
+
*/
|
|
219
|
+
event: TEvent;
|
|
220
|
+
/**
|
|
221
|
+
* The error throwed during forwarding
|
|
222
|
+
*/
|
|
223
|
+
error: Error;
|
|
224
|
+
/**
|
|
225
|
+
* The instance of the resolver
|
|
226
|
+
*/
|
|
227
|
+
delegatedResolver: DelegatedResolver<TResponse>;
|
|
228
|
+
/**
|
|
229
|
+
* Indicates whether to forward the (error.stack) or not to the client
|
|
230
|
+
*/
|
|
231
|
+
respondWithErrors: boolean;
|
|
232
|
+
/**
|
|
233
|
+
* The instance of the logger
|
|
234
|
+
*/
|
|
235
|
+
log: ILogger;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* The interface that represents a contract between the adapter and the actual implementation of the adapter.
|
|
239
|
+
*
|
|
240
|
+
* @breadcrumb Contracts / AdapterContract
|
|
241
|
+
* @public
|
|
242
|
+
*/
|
|
243
|
+
interface AdapterContract<TEvent, TContext, TResponse> {
|
|
244
|
+
/**
|
|
245
|
+
* Get the adapter name
|
|
246
|
+
*/
|
|
247
|
+
getAdapterName(): string;
|
|
248
|
+
/**
|
|
249
|
+
* Decide if this adapter can handle a request based in the event payload
|
|
250
|
+
*
|
|
251
|
+
* @param event - The event sent by serverless
|
|
252
|
+
* @param context - The context sent by the serverless
|
|
253
|
+
* @param log - The instance of logger
|
|
254
|
+
*/
|
|
255
|
+
canHandle(event: unknown, context: TContext, log: ILogger): boolean;
|
|
256
|
+
/**
|
|
257
|
+
* Maps the serverless payload to an actual request that a framework can handle
|
|
258
|
+
*
|
|
259
|
+
* @param event - The event sent by serverless
|
|
260
|
+
* @param context - The context sent by the serverless
|
|
261
|
+
* @param log - The instance of logger
|
|
262
|
+
*/
|
|
263
|
+
getRequest(event: TEvent, context: TContext, log: ILogger): AdapterRequest;
|
|
264
|
+
/**
|
|
265
|
+
* Maps the response of the framework to a payload that serverless can handle
|
|
266
|
+
*
|
|
267
|
+
* @param props - The props sent by serverless
|
|
268
|
+
*/
|
|
269
|
+
getResponse(props: GetResponseAdapterProps<TEvent>): TResponse;
|
|
270
|
+
/**
|
|
271
|
+
* When an error occurs while forwarding the request to the framework
|
|
272
|
+
*
|
|
273
|
+
* @remarks You must call resolver.fail or resolver.succeed when implementing this method.
|
|
274
|
+
*/
|
|
275
|
+
onErrorWhileForwarding(props: OnErrorProps<TEvent, TResponse>): void;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export { type AdapterContract as A, type DelegatedResolver as D, type GetResponseAdapterProps as G, type OnErrorProps as O, type ResolverContract as R, ServerlessResponse as S, type AdapterRequest as a, type ResolverProps as b, type Resolver as c, type ServerlessResponseProps as d };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";var c=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var o=(r,e)=>c(r,"name",{value:e,configurable:!0});var w=(r,e)=>{for(var t in e)c(r,t,{get:e[t],enumerable:!0})},C=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of A(e))!E.call(r,n)&&n!==t&&c(r,n,{get:()=>e[n],enumerable:!(s=b(e,n))||s.enumerable});return r};var B=r=>C(c({},"__esModule",{value:!0}),r);var H={};w(H,{ApolloServerMutationAdapter:()=>m});module.exports=B(H);var k=require("http");var v=require("http");function g(r){if(Buffer.isBuffer(r))return r.toString("utf8");if(typeof r=="string")return r;if(r instanceof Uint8Array)return new TextDecoder().decode(r);throw new Error(`response.write() of unexpected type: ${typeof r}`)}o(g,"getString");var h=`\r
|
|
2
|
+
\r
|
|
3
|
+
`,l=Symbol("Response body"),u=Symbol("Response headers");function x(r,e){if(Buffer.isBuffer(e)||typeof e=="string"||e instanceof Uint8Array)r[l].push(Buffer.from(e));else throw new Error(`response.write() of unexpected type: ${typeof e}`)}o(x,"addData");var y=class r extends v.ServerResponse{static{o(this,"ServerlessResponse")}constructor({method:e}){super({method:e}),this[l]=[],this[u]={},this.useChunkedEncodingByDefault=!1,this.chunkedEncoding=!1,this._header="";let t={_writableState:{},writable:!0,on:a,removeListener:a,destroy:a,cork:a,uncork:a,write:(s,n,i)=>{if(typeof n=="function"&&(i=n,n=null),this._header===""||this._wroteHeader)x(this,s);else{let p=g(s),d=p.indexOf(h);if(d!==-1){let f=p.slice(d+h.length);f&&x(this,f),this._wroteHeader=!0}}typeof i=="function"&&i()}};this.assignSocket(t)}_header;_headers;_wroteHeader;[l];[u];get headers(){return this[u]}static from(e){let t=new r({method:e.method});return t.statusCode=e.statusCode||0,t[u]=e.headers,t[l]=e.body?[Buffer.from(e.body)]:[],t.end(),t}static body(e){return Buffer.concat(e[l])}static headers(e){let t=e.getHeaders();return Object.assign(t,e[u])}setHeader(e,t){this._wroteHeader?this[u][e]=t:super.setHeader(e,t)}writeHead(e,t,s){let n=typeof t=="string"?s:t,i=Array.isArray(n)?n:[n||{}];for(let p of i)for(let d in p)if(this.setHeader(d,p[d]),!this._wroteHeader)break;return this.callNativeWriteHead(e,t,s)}callNativeWriteHead(e,t,s){return super.writeHead(e,t,s)}};var L=require("http");function T(r,e){let t=e?"base64":"utf8",s=Buffer.from(r,t),n=Buffer.byteLength(s,t);return[s,n]}o(T,"getEventBodyAsBuffer");var a=o(()=>{},"NO_OP");var ye=Symbol("InternalLogger");function S(r,e){return r===void 0?e:r}o(S,"getDefaultIfUndefined");var Re=require("stream");var m=class{constructor(e,t){this.baseAdapter=e;this.options=t}static{o(this,"ApolloServerMutationAdapter")}canHandle(e,t,s){return this.baseAdapter.canHandle(e,t,s)}getAdapterName(){return this.baseAdapter.getAdapterName()+"Mutation"}getRequest(e,t,s){let n=this.baseAdapter.getRequest(e,t,s);n.method="POST";let i=this.options.mutationName,p=S(this.options.mutationResultQuery,"{ __typename }"),d=JSON.stringify({operationName:i,query:`mutation ${i} ($event: String) { ${i} (event: $event) ${p} }`,variables:{event:n.body?.toString()||""}}),[f,R]=T(d,!1);return n.body=f,n.headers["content-type"]="application/json",n.headers["content-length"]=String(R),n}getResponse(e){let{data:t,errors:s}=JSON.parse(e.body);return s?this.baseAdapter.getResponse(e):this.baseAdapter.getResponse({...e,body:JSON.stringify(t[this.options.mutationName])})}onErrorWhileForwarding(e){return this.baseAdapter.onErrorWhileForwarding(e)}};0&&(module.exports={ApolloServerMutationAdapter});
|
|
4
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/adapters/apollo-server/index.ts","../../../src/network/request.ts","../../../src/network/response.ts","../../../src/network/utils.ts","../../../src/network/response-stream.ts","../../../src/core/event-body.ts","../../../src/core/no-op.ts","../../../src/core/logger.ts","../../../src/core/optional.ts","../../../src/core/stream.ts","../../../src/adapters/apollo-server/apollo-server-mutation.adapter.ts"],"sourcesContent":["export * from './apollo-server-mutation.adapter';\n","// ATTRIBUTION: https://github.com/dougmoscrop/serverless-http\nimport { IncomingMessage } from 'node:http';\nimport type { AddressInfo } from 'node:net';\nimport type { SingleValueHeaders } from '../@types';\nimport { NO_OP } from '../core';\n\nconst HTTPS_PORT = 443;\n\n/**\n * The properties to create a {@link ServerlessRequest}\n *\n * @breadcrumb Network / ServerlessRequest\n * @public\n */\nexport interface ServerlessRequestProps {\n /**\n * The HTTP Method of the request\n */\n method: string;\n\n /**\n * The URL requested\n */\n url: string;\n\n /**\n * The headers from the event source\n */\n headers: SingleValueHeaders;\n\n /**\n * The body from the event source\n */\n body?: Buffer | Uint8Array;\n\n /**\n * The IP Address from caller\n */\n remoteAddress?: string;\n}\n\n/**\n * The class that represents an {@link http#IncomingMessage} created by the library to represent an actual request to the framework.\n *\n * @breadcrumb Network / ServerlessRequest\n * @public\n */\nexport class ServerlessRequest extends IncomingMessage {\n constructor({\n method,\n url,\n headers,\n body,\n remoteAddress,\n }: ServerlessRequestProps) {\n super({\n encrypted: true,\n readable: false,\n remoteAddress,\n address: () => ({ port: HTTPS_PORT }) as AddressInfo,\n end: NO_OP,\n destroy: NO_OP,\n } as any);\n\n this.statusCode = 200;\n this.statusMessage = 'OK';\n this.complete = true;\n this.httpVersion = '1.1';\n this.httpVersionMajor = 1;\n this.httpVersionMinor = 1;\n this.method = method;\n this.headers = headers;\n this.body = body;\n this.url = url;\n this.ip = remoteAddress;\n\n this._read = () => {\n this.push(body);\n this.push(null);\n };\n }\n\n ip?: string;\n body?: Buffer | Uint8Array;\n}\n","// ATTRIBUTION: https://github.com/dougmoscrop/serverless-http\nimport { IncomingMessage, ServerResponse } from 'node:http';\nimport type { Socket } from 'node:net';\nimport { NO_OP } from '../core';\nimport { getString } from './utils';\n\nconst headerEnd = '\\r\\n\\r\\n';\n\nconst BODY = Symbol('Response body');\nconst HEADERS = Symbol('Response headers');\n\nfunction addData(stream: ServerlessResponse, data: Uint8Array | string) {\n if (\n Buffer.isBuffer(data) ||\n typeof data === 'string' ||\n data instanceof Uint8Array\n )\n stream[BODY].push(Buffer.from(data));\n else throw new Error(`response.write() of unexpected type: ${typeof data}`);\n}\n\n/**\n * The properties to create a {@link ServerlessResponse}.\n *\n * @breadcrumb Network / ServerlessResponse\n * @public\n */\nexport interface ServerlessResponseProps {\n /**\n * The HTTP Method from request\n */\n method?: string;\n}\n\n/**\n * The class that represents a response instance used to send to the framework and wait until the framework finishes processing the request.\n * Once it's happens, we use the properties from this response to built the response to the cloud.\n *\n * @breadcrumb Network / ServerlessResponse\n * @public\n */\nexport class ServerlessResponse extends ServerResponse {\n constructor({ method }: ServerlessResponseProps) {\n super({ method } as any);\n\n this[BODY] = [];\n this[HEADERS] = {};\n\n this.useChunkedEncodingByDefault = false;\n this.chunkedEncoding = false;\n this._header = '';\n\n const socket: Partial<Socket> & { _writableState: any } = {\n _writableState: {},\n writable: true,\n on: NO_OP,\n removeListener: NO_OP,\n destroy: NO_OP,\n cork: NO_OP,\n uncork: NO_OP,\n write: (\n data: Uint8Array | string,\n encoding?: string | null | (() => void),\n cb?: () => void,\n ): any => {\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (this._header === '' || this._wroteHeader) addData(this, data);\n else {\n const string = getString(data);\n const index = string.indexOf(headerEnd);\n\n if (index !== -1) {\n const remainder = string.slice(index + headerEnd.length);\n\n if (remainder) addData(this, remainder);\n\n this._wroteHeader = true;\n }\n }\n\n if (typeof cb === 'function') cb();\n },\n };\n\n this.assignSocket(socket as unknown as Socket);\n }\n\n _header: string;\n _headers?: Record<any, any>;\n _wroteHeader?: boolean;\n\n [BODY]: any[];\n [HEADERS]: Record<any, any>;\n\n get headers(): Record<any, any> {\n return this[HEADERS];\n }\n\n static from(res: IncomingMessage) {\n const response = new ServerlessResponse({ method: res.method });\n\n response.statusCode = res.statusCode || 0;\n response[HEADERS] = res.headers;\n response[BODY] = (res as any).body ? [Buffer.from((res as any).body)] : [];\n response.end();\n\n return response;\n }\n\n static body(res: ServerlessResponse): Buffer {\n return Buffer.concat(res[BODY]);\n }\n\n static headers(res: ServerlessResponse) {\n const headers = res.getHeaders();\n\n return Object.assign(headers, res[HEADERS]);\n }\n\n override setHeader(\n key: string,\n value: number | string | readonly string[],\n ): any {\n if (this._wroteHeader) this[HEADERS][key] = value;\n else super.setHeader(key, value);\n }\n\n override writeHead(\n statusCode: number,\n statusMessage?: string | any | any[],\n obj?: any | any[],\n ): any {\n const headersObjOrArray =\n typeof statusMessage === 'string' ? obj : statusMessage;\n\n const arrayHeaders = Array.isArray(headersObjOrArray)\n ? headersObjOrArray\n : [headersObjOrArray || {}];\n\n for (const headers of arrayHeaders) {\n for (const name in headers) {\n this.setHeader(name, headers[name]!);\n\n if (!this._wroteHeader) {\n // we only need to initiate super.headers once\n // writeHead will add the other headers itself\n break;\n }\n }\n }\n\n return this.callNativeWriteHead(statusCode, statusMessage, obj);\n }\n\n /**\n * I use ignore here because in nodejs 12.x, statusMessage can be string | OutgoingHttpHeaders\n * But in nodejs \\>=14.x, statusMessage can also be OutgoingHttpHeaders[]\n * I take care of these cases above, but here I can't handle it well, so I give up\n * nodejs 12.x ref: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v12/http.d.ts#L229\n * nodejs 14.x ref: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v14/http.d.ts#L263\n */\n protected callNativeWriteHead(\n statusCode: number,\n statusMessage?: string | any | any[],\n obj?: any | any[],\n ): this {\n return super.writeHead(statusCode, statusMessage, obj);\n }\n}\n","/**\n * Get the data from a buffer, string, or Uint8Array\n *\n * @breadcrumb Network\n * @param data - The data that was written inside the stream\n */\nexport function getString(data: Buffer | string | unknown) {\n if (Buffer.isBuffer(data)) return data.toString('utf8');\n else if (typeof data === 'string') return data;\n else if (data instanceof Uint8Array) return new TextDecoder().decode(data);\n else throw new Error(`response.write() of unexpected type: ${typeof data}`);\n}\n","import { ServerResponse } from 'node:http';\nimport type { Socket } from 'node:net';\nimport type { Writable } from 'node:stream';\nimport type { BothValueHeaders } from '../@types';\nimport { type ILogger, NO_OP, parseHeaders } from '../core';\nimport { getString } from './utils';\n\nconst endChunked = '0\\r\\n\\r\\n';\nconst headerEnd = '\\r\\n\\r\\n';\nconst endStatusSeparator = '\\r\\n';\n\n/**\n * The properties to create a {@link ServerlessStreamResponse}.\n *\n * @breadcrumb Network / ServerlessStreamResponse\n * @public\n */\nexport interface ServerlessStreamResponseProps {\n /**\n * The HTTP Method from request\n */\n method?: string;\n\n /**\n * The callback to receive the headers when they are written to the stream\n * You need to return a writable stream be able to continue writing the response\n *\n * @param statusCode - The status code of the response\n * @param headers - The headers of the response\n */\n onReceiveHeaders: (statusCode: number, headers: BothValueHeaders) => Writable;\n\n /**\n * Instance of the logger\n */\n log: ILogger;\n}\n\n/**\n * The class that represents a response instance used to send to the framework and wait until the framework finishes processing the request.\n * This response is specially built to deal with transfer-encoding: chunked\n *\n * @breadcrumb Network / ServerlessStreamResponse\n * @public\n */\nexport class ServerlessStreamResponse extends ServerResponse {\n constructor({\n method,\n onReceiveHeaders,\n log,\n }: ServerlessStreamResponseProps) {\n super({ method } as any);\n\n this.useChunkedEncodingByDefault = true;\n this.chunkedEncoding = true;\n\n let internalWritable: Writable | null = null;\n let isFirstCall = true;\n // this ignore is used because I need to ignore these write calls:\n // https://github.com/nodejs/node/blob/main/lib/_http_outgoing.js#L934-L935\n // https://github.com/nodejs/node/blob/main/lib/_http_outgoing.js#L937\n let writesToIgnore = 0;\n\n const socket: Partial<Socket> & { _writableState: any } = {\n _writableState: {},\n writable: true,\n on: NO_OP,\n removeListener: NO_OP,\n destroy: NO_OP,\n cork: NO_OP,\n uncork: NO_OP,\n write: (\n data: Uint8Array | string,\n encoding?: string | null | (() => void),\n cb?: () => void,\n ): any => {\n // very unlikely, I don't even know how to reproduce this, but exist on types\n // istanbul ignore if\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n log.debug('SERVERLESS_ADAPTER:RESPONSE_STREAM:DATA', () => ({\n data: Buffer.isBuffer(data) ? data.toString('utf8') : data,\n encoding,\n }));\n\n if (!isFirstCall && internalWritable) {\n if (data === endChunked) {\n internalWritable.end(cb);\n\n return true;\n }\n\n if (writesToIgnore > 0) {\n writesToIgnore--;\n return true;\n }\n\n internalWritable.write(data, cb);\n writesToIgnore = 3;\n } else if (isFirstCall) {\n isFirstCall = false;\n\n const stringData = getString(data);\n const endStatusIndex = stringData.indexOf(endStatusSeparator);\n const status = +stringData.slice(0, endStatusIndex).split(' ')[1];\n\n const headerData = stringData.slice(\n endStatusIndex + 2,\n stringData.indexOf(headerEnd),\n );\n const headers = parseHeaders(headerData);\n log.debug('SERVERLESS_ADAPTER:RESPONSE_STREAM:FRAMEWORK_HEADERS', {\n headers,\n });\n\n writesToIgnore = 1;\n internalWritable = onReceiveHeaders(status, headers);\n }\n\n return true;\n },\n };\n\n this.assignSocket(socket as unknown as Socket);\n }\n}\n","/**\n * Get the event body as buffer from body string with content length\n *\n * @example\n * ```typescript\n * const body = '{}';\n * const [buffer, contentLength] = getEventBodyAsBuffer(body, false);\n * console.log(buffer);\n * // <Buffer 7b 7d>\n * console.log(contentLength);\n * // 2\n * ```\n *\n * @param body - The body string that can be encoded or not\n * @param isBase64Encoded - Tells if body string is encoded in base64\n *\n * @breadcrumb Core\n * @public\n */\nexport function getEventBodyAsBuffer(\n body: string,\n isBase64Encoded: boolean,\n): [body: Buffer, contentLength: number] {\n const encoding: BufferEncoding = isBase64Encoded ? 'base64' : 'utf8';\n\n const buffer = Buffer.from(body, encoding);\n const contentLength = Buffer.byteLength(buffer, encoding);\n\n return [buffer, contentLength];\n}\n","/**\n * No operation function is used when we need to pass a function, but we don't want to specify any behavior.\n *\n * @breadcrumb Core\n * @public\n */\nexport const NO_OP: (...args: any[]) => any = () => void 0;\n","import { NO_OP } from './no-op';\n\n/**\n * The type representing the possible log levels to choose from.\n *\n * @breadcrumb Core / Logger\n * @public\n */\nexport type LogLevels =\n | 'debug'\n | 'verbose'\n | 'info'\n | 'warn'\n | 'error'\n | 'none';\n\n/**\n * The options to customize {@link ILogger}\n *\n * @breadcrumb Core / Logger\n * @public\n */\nexport type LoggerOptions = {\n /**\n * Select the log level, {@link LogLevels | see more}.\n *\n * @defaultValue error\n */\n level: LogLevels;\n};\n\n/**\n * The log function used in any level.\n *\n * @breadcrumb Core / Logger\n * @public\n */\nexport type LoggerFN = (message: any, ...additional: any[]) => void;\n\n/**\n * The interface representing the logger, you can provide a custom logger by implementing this interface.\n *\n * @breadcrumb Core / Logger\n * @public\n */\nexport type ILogger = Record<Exclude<LogLevels, 'none'>, LoggerFN>;\n\n/**\n * The symbol used to check against an ILogger instace to verify if that ILogger was created by this library\n *\n * @breadcrumb Core / Logger\n * @public\n */\nconst InternalLoggerSymbol = Symbol('InternalLogger');\n\nconst logLevels: Record<\n LogLevels,\n [level: LogLevels, consoleMethod: keyof Console][]\n> = {\n debug: [\n ['debug', 'debug'],\n ['verbose', 'debug'],\n ['info', 'info'],\n ['error', 'error'],\n ['warn', 'warn'],\n ],\n verbose: [\n ['verbose', 'debug'],\n ['info', 'info'],\n ['error', 'error'],\n ['warn', 'warn'],\n ],\n info: [\n ['info', 'info'],\n ['error', 'error'],\n ['warn', 'warn'],\n ],\n warn: [\n ['warn', 'warn'],\n ['error', 'error'],\n ],\n error: [['error', 'error']],\n none: [],\n};\n\nconst lazyPrint = (value: () => any | unknown) => {\n if (typeof value === 'function') return value();\n\n return value;\n};\n\nconst print =\n (fn: string) =>\n (message: any, ...additional: (() => any)[]) =>\n console[fn](message, ...additional.map(lazyPrint));\n\n/**\n * The method used to create a simple logger instance to use in this library.\n *\n * @remarks Behind the scenes, this simple logger sends the message to the `console` methods.\n *\n * @example\n * ```typescript\n * const logger = createDefaultLogger();\n *\n * logger.error('An error happens.');\n * // An error happens.\n * ```\n *\n * @param level - Select the level of the log\n *\n * @breadcrumb Core / Logger\n * @public\n */\nexport function createDefaultLogger(\n { level }: LoggerOptions = { level: 'error' },\n): ILogger {\n const levels = logLevels[level];\n\n if (!levels) throw new Error('Invalid log level');\n\n const logger = {\n [InternalLoggerSymbol]: true,\n error: NO_OP,\n debug: NO_OP,\n info: NO_OP,\n verbose: NO_OP,\n warn: NO_OP,\n } as ILogger;\n\n for (const [level, consoleMethod] of levels)\n logger[level] = print(consoleMethod);\n\n return logger;\n}\n\n/**\n * The method used to chck if logger was created by this library, or it was defined by the user.\n *\n * @param logger - The instance of the logger to check\n *\n * @breadcrumb Core / Logger\n * @public\n */\nexport function isInternalLogger(logger: ILogger): boolean {\n return !!logger[InternalLoggerSymbol];\n}\n","/**\n * Return the defaultValue whether the value is undefined, otherwise, return the value.\n *\n * @example\n * ```typescript\n * const value1 = getDefaultIfUndefined(undefined, true);\n * const value2 = getDefaultIfUndefined(false, true);\n *\n * console.log(value1);\n * // true\n * console.log(value2);\n * // false\n * ```\n *\n * @param value - The value to be checked\n * @param defaultValue - The default value when value is undefined\n *\n * @breadcrumb Core\n * @public\n */\nexport function getDefaultIfUndefined<T>(\n value: T | undefined,\n defaultValue: T,\n): T {\n if (value === undefined) return defaultValue;\n\n return value;\n}\n","//#region Imports\n\nimport { Readable, Writable } from 'node:stream';\n\n//#endregion\n\n/**\n * Check if stream already ended\n *\n * @param stream - The stream\n *\n * @breadcrumb Core / Stream\n * @public\n */\nexport function isStreamEnded(stream: Readable | Writable): boolean {\n if ('readableEnded' in stream && stream.readableEnded) return true;\n\n if ('writableEnded' in stream && stream.writableEnded) return true;\n\n return false;\n}\n\n/**\n * Wait asynchronous the stream to complete\n *\n * @param stream - The stream\n *\n * @breadcrumb Core / Stream\n * @public\n */\nexport function waitForStreamComplete<TStream extends Readable | Writable>(\n stream: TStream,\n): Promise<TStream> {\n if (isStreamEnded(stream)) return Promise.resolve(stream);\n\n return new Promise<TStream>((resolve, reject) => {\n // Reading the {@link https://github.com/nodejs/node/blob/v12.22.9/lib/events.js#L262 | emit source code},\n // it's almost impossible to complete being called twice because the emit function runs synchronously and removes the other listeners,\n // but I'll leave it at that because I didn't write that code, so I couldn't figure out what the author thought when he wrote this.\n let isComplete = false;\n\n function complete(err: any) {\n /* istanbul ignore next */\n if (isComplete) return;\n\n isComplete = true;\n\n stream.removeListener('error', complete);\n stream.removeListener('end', complete);\n stream.removeListener('finish', complete);\n\n if (err) reject(err);\n else resolve(stream);\n }\n\n stream.once('error', complete);\n stream.once('end', complete);\n stream.once('finish', complete);\n });\n}\n","//#region Imports\n\nimport type {\n AdapterContract,\n AdapterRequest,\n GetResponseAdapterProps,\n OnErrorProps,\n} from '../../contracts';\nimport {\n type ILogger,\n getDefaultIfUndefined,\n getEventBodyAsBuffer,\n} from '../../core';\n\n//#endregion\n\n/**\n * The options for {@link ApolloServerMutationAdapter}\n *\n * @breadcrumb Adapters / Apollo Server / ApolloServerMutationAdapter\n * @public\n */\nexport type ApolloServerMutationAdapterOptions = {\n /**\n * Specify the name of mutation that will be called when an event was received\n */\n mutationName: string;\n\n /**\n * Specify the mutation result schema.\n * Use this to customize the behavior when you need to return a specific object to be handled by the Adapter, like SQS with Batch Mode.\n *\n * @defaultValue `{ __typename }`\n */\n mutationResultQuery?: string;\n};\n\n/**\n * The adapter that wraps another adapter to force a transformation of the event data as a mutation to Apollo Server be able to handle.\n *\n * @breadcrumb Adapters / Apollo Server / ApolloServerMutationAdapter\n * @public\n */\nexport class ApolloServerMutationAdapter<\n TEvent,\n TContext,\n TResponse,\n TBaseAdapter extends AdapterContract<TEvent, TContext, TResponse>,\n> implements AdapterContract<TEvent, TContext, TResponse>\n{\n //#region Constructor\n\n /**\n * The default constructor\n */\n constructor(\n protected readonly baseAdapter: TBaseAdapter,\n protected readonly options: ApolloServerMutationAdapterOptions,\n ) {}\n\n //#endregion\n\n //#region Public Methods\n\n /**\n * {@inheritDoc}\n */\n public canHandle(event: unknown, context: TContext, log: ILogger): boolean {\n return this.baseAdapter.canHandle(event, context, log);\n }\n\n /**\n * {@inheritDoc}\n */\n public getAdapterName(): string {\n return this.baseAdapter.getAdapterName() + 'Mutation';\n }\n\n /**\n * {@inheritDoc}\n */\n public getRequest(\n event: TEvent,\n context: TContext,\n log: ILogger,\n ): AdapterRequest {\n const request = this.baseAdapter.getRequest(event, context, log);\n\n request.method = 'POST';\n\n const operationName = this.options.mutationName;\n const mutationResultQuery = getDefaultIfUndefined(\n this.options.mutationResultQuery,\n '{ __typename }',\n );\n\n const mutationBody = JSON.stringify({\n operationName,\n query: `mutation ${operationName} ($event: String) { ${operationName} (event: $event) ${mutationResultQuery} }`,\n variables: {\n event: request.body?.toString() || '',\n },\n });\n\n const [buffer, contentLength] = getEventBodyAsBuffer(mutationBody, false);\n\n request.body = buffer;\n request.headers['content-type'] = 'application/json';\n request.headers['content-length'] = String(contentLength);\n\n return request;\n }\n\n /**\n * {@inheritDoc}\n */\n public getResponse(props: GetResponseAdapterProps<TEvent>): TResponse {\n const { data, errors } = JSON.parse(props.body);\n\n if (!errors) {\n return this.baseAdapter.getResponse({\n ...props,\n body: JSON.stringify(data[this.options.mutationName]),\n });\n }\n\n // when error happens, is the responsability of base adapter\n // to deal with error status code.\n return this.baseAdapter.getResponse(props);\n }\n\n /**\n * {@inheritDoc}\n */\n public onErrorWhileForwarding(props: OnErrorProps<TEvent, TResponse>): void {\n return this.baseAdapter.onErrorWhileForwarding(props);\n }\n\n //#endregion\n}\n"],"mappings":"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","names":["apollo_server_exports","__export","ApolloServerMutationAdapter","__toCommonJS","import_node_http","import_node_http","getString","data","__name","headerEnd","BODY","HEADERS","addData","stream","data","__name","ServerlessResponse","_ServerlessResponse","method","socket","NO_OP","encoding","cb","string","getString","index","remainder","res","response","headers","key","value","statusCode","statusMessage","obj","headersObjOrArray","arrayHeaders","name","import_node_http","getEventBodyAsBuffer","body","isBase64Encoded","encoding","buffer","contentLength","__name","NO_OP","__name","InternalLoggerSymbol","getDefaultIfUndefined","value","defaultValue","__name","import_node_stream","ApolloServerMutationAdapter","baseAdapter","options","__name","event","context","log","request","operationName","mutationResultQuery","getDefaultIfUndefined","mutationBody","buffer","contentLength","getEventBodyAsBuffer","props","data","errors"]}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { AdapterContract, AdapterRequest, GetResponseAdapterProps, OnErrorProps } from '../../
|
|
2
|
-
import { ILogger } from '../../
|
|
1
|
+
import { A as AdapterContract, a as AdapterRequest, G as GetResponseAdapterProps, O as OnErrorProps } from '../../adapter.contract-y5xSjOjo.cjs';
|
|
2
|
+
import { I as ILogger } from '../../logger-9me5n48P.cjs';
|
|
3
|
+
import '../../headers-K2qbcurv.cjs';
|
|
4
|
+
import 'http';
|
|
5
|
+
import 'node:http';
|
|
6
|
+
|
|
3
7
|
/**
|
|
4
8
|
* The options for {@link ApolloServerMutationAdapter}
|
|
5
9
|
*
|
|
6
10
|
* @breadcrumb Adapters / Apollo Server / ApolloServerMutationAdapter
|
|
7
11
|
* @public
|
|
8
12
|
*/
|
|
9
|
-
|
|
13
|
+
type ApolloServerMutationAdapterOptions = {
|
|
10
14
|
/**
|
|
11
15
|
* Specify the name of mutation that will be called when an event was received
|
|
12
16
|
*/
|
|
@@ -25,7 +29,7 @@ export type ApolloServerMutationAdapterOptions = {
|
|
|
25
29
|
* @breadcrumb Adapters / Apollo Server / ApolloServerMutationAdapter
|
|
26
30
|
* @public
|
|
27
31
|
*/
|
|
28
|
-
|
|
32
|
+
declare class ApolloServerMutationAdapter<TEvent, TContext, TResponse, TBaseAdapter extends AdapterContract<TEvent, TContext, TResponse>> implements AdapterContract<TEvent, TContext, TResponse> {
|
|
29
33
|
protected readonly baseAdapter: TBaseAdapter;
|
|
30
34
|
protected readonly options: ApolloServerMutationAdapterOptions;
|
|
31
35
|
/**
|
|
@@ -53,4 +57,5 @@ export declare class ApolloServerMutationAdapter<TEvent, TContext, TResponse, TB
|
|
|
53
57
|
*/
|
|
54
58
|
onErrorWhileForwarding(props: OnErrorProps<TEvent, TResponse>): void;
|
|
55
59
|
}
|
|
56
|
-
|
|
60
|
+
|
|
61
|
+
export { ApolloServerMutationAdapter, type ApolloServerMutationAdapterOptions };
|