@h4ad/serverless-adapter 2.2.0 → 2.3.2
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 +4 -253
- package/lib/@types/binary-settings.d.ts +24 -6
- package/lib/@types/binary-settings.d.ts.map +1 -0
- package/lib/@types/binary-settings.js +1 -0
- package/lib/@types/binary-settings.js.map +1 -0
- package/lib/@types/headers.d.ts +16 -3
- package/lib/@types/headers.d.ts.map +1 -0
- package/lib/@types/headers.js +1 -0
- package/lib/@types/headers.js.map +1 -0
- package/lib/@types/helpers.d.ts +4 -0
- package/lib/@types/helpers.d.ts.map +1 -0
- package/lib/@types/helpers.js +1 -0
- package/lib/@types/helpers.js.map +1 -0
- package/lib/@types/huawei/huawei-api-gateway-event.d.ts +62 -0
- package/lib/@types/huawei/huawei-api-gateway-event.d.ts.map +1 -0
- package/lib/@types/huawei/huawei-api-gateway-event.js +2 -0
- package/lib/@types/huawei/huawei-api-gateway-event.js.map +1 -0
- package/lib/@types/huawei/huawei-api-gateway-response.d.ts +20 -0
- package/lib/@types/huawei/huawei-api-gateway-response.d.ts.map +1 -0
- package/lib/@types/huawei/huawei-api-gateway-response.js +2 -0
- package/lib/@types/huawei/huawei-api-gateway-response.js.map +1 -0
- package/lib/@types/huawei/huawei-context.d.ts +157 -0
- package/lib/@types/huawei/huawei-context.d.ts.map +1 -0
- package/lib/@types/huawei/huawei-context.js +1 -0
- package/lib/@types/huawei/huawei-context.js.map +1 -0
- package/lib/@types/huawei/index.d.ts +1 -0
- package/lib/@types/huawei/index.d.ts.map +1 -0
- package/lib/@types/huawei/index.js +6 -1
- package/lib/@types/huawei/index.js.map +1 -0
- package/lib/@types/index.d.ts +2 -1
- package/lib/@types/index.d.ts.map +1 -0
- package/lib/@types/index.js +7 -2
- package/lib/@types/index.js.map +1 -0
- package/lib/adapters/aws/alb.adapter.d.ts +18 -10
- package/lib/adapters/aws/alb.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/alb.adapter.js +14 -9
- package/lib/adapters/aws/alb.adapter.js.map +1 -0
- package/lib/adapters/aws/api-gateway-v1.adapter.d.ts +20 -12
- package/lib/adapters/aws/api-gateway-v1.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/api-gateway-v1.adapter.js +19 -14
- package/lib/adapters/aws/api-gateway-v1.adapter.js.map +1 -0
- package/lib/adapters/aws/api-gateway-v2.adapter.d.ts +19 -11
- package/lib/adapters/aws/api-gateway-v2.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/api-gateway-v2.adapter.js +15 -10
- package/lib/adapters/aws/api-gateway-v2.adapter.js.map +1 -0
- package/lib/adapters/aws/dynamodb.adapter.d.ts +18 -10
- package/lib/adapters/aws/dynamodb.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/dynamodb.adapter.js +13 -8
- package/lib/adapters/aws/dynamodb.adapter.js.map +1 -0
- package/lib/adapters/aws/event-bridge.adapter.d.ts +21 -10
- package/lib/adapters/aws/event-bridge.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/event-bridge.adapter.js +13 -8
- package/lib/adapters/aws/event-bridge.adapter.js.map +1 -0
- package/lib/adapters/aws/index.d.ts +1 -0
- package/lib/adapters/aws/index.d.ts.map +1 -0
- package/lib/adapters/aws/index.js +6 -1
- package/lib/adapters/aws/index.js.map +1 -0
- package/lib/adapters/aws/lambda-edge.adapter.d.ts +76 -46
- package/lib/adapters/aws/lambda-edge.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/lambda-edge.adapter.js +40 -24
- package/lib/adapters/aws/lambda-edge.adapter.js.map +1 -0
- package/lib/adapters/aws/sns.adapter.d.ts +18 -10
- package/lib/adapters/aws/sns.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/sns.adapter.js +13 -8
- package/lib/adapters/aws/sns.adapter.js.map +1 -0
- package/lib/adapters/aws/sqs.adapter.d.ts +18 -10
- package/lib/adapters/aws/sqs.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/sqs.adapter.js +13 -8
- package/lib/adapters/aws/sqs.adapter.js.map +1 -0
- package/lib/adapters/dummy/dummy.adapter.d.ts +9 -5
- package/lib/adapters/dummy/dummy.adapter.d.ts.map +1 -0
- package/lib/adapters/dummy/dummy.adapter.js +9 -5
- package/lib/adapters/dummy/dummy.adapter.js.map +1 -0
- package/lib/adapters/dummy/index.d.ts +1 -0
- package/lib/adapters/dummy/index.d.ts.map +1 -0
- package/lib/adapters/dummy/index.js +6 -1
- package/lib/adapters/dummy/index.js.map +1 -0
- package/lib/adapters/huawei/huawei-api-gateway.adapter.d.ts +19 -12
- package/lib/adapters/huawei/huawei-api-gateway.adapter.d.ts.map +1 -0
- package/lib/adapters/huawei/huawei-api-gateway.adapter.js +14 -9
- package/lib/adapters/huawei/huawei-api-gateway.adapter.js.map +1 -0
- package/lib/adapters/huawei/index.d.ts +1 -0
- package/lib/adapters/huawei/index.d.ts.map +1 -0
- package/lib/adapters/huawei/index.js +6 -1
- package/lib/adapters/huawei/index.js.map +1 -0
- package/lib/contracts/adapter.contract.d.ts +30 -30
- package/lib/contracts/adapter.contract.d.ts.map +1 -0
- package/lib/contracts/adapter.contract.js +2 -0
- package/lib/contracts/adapter.contract.js.map +1 -0
- package/lib/contracts/framework.contract.d.ts +7 -3
- package/lib/contracts/framework.contract.d.ts.map +1 -0
- package/lib/contracts/framework.contract.js +1 -0
- package/lib/contracts/framework.contract.js.map +1 -0
- package/lib/contracts/handler.contract.d.ts +7 -0
- package/lib/contracts/handler.contract.d.ts.map +1 -0
- package/lib/contracts/handler.contract.js +1 -0
- package/lib/contracts/handler.contract.js.map +1 -0
- package/lib/contracts/index.d.ts +1 -0
- package/lib/contracts/index.d.ts.map +1 -0
- package/lib/contracts/index.js +6 -1
- package/lib/contracts/index.js.map +1 -0
- package/lib/contracts/resolver.contract.d.ts +17 -4
- package/lib/contracts/resolver.contract.d.ts.map +1 -0
- package/lib/contracts/resolver.contract.js +1 -0
- package/lib/contracts/resolver.contract.js.map +1 -0
- package/lib/core/base-handler.d.ts +9 -5
- package/lib/core/base-handler.d.ts.map +1 -0
- package/lib/core/base-handler.js +9 -5
- package/lib/core/base-handler.js.map +1 -0
- package/lib/core/constants.d.ts +27 -0
- package/lib/core/constants.d.ts.map +1 -0
- package/lib/core/constants.js +21 -0
- package/lib/core/constants.js.map +1 -0
- package/lib/core/current-invoke.d.ts +17 -6
- package/lib/core/current-invoke.d.ts.map +1 -0
- package/lib/core/current-invoke.js +12 -4
- package/lib/core/current-invoke.js.map +1 -0
- package/lib/core/event-body.d.ts +9 -3
- package/lib/core/event-body.d.ts.map +1 -0
- package/lib/core/event-body.js +9 -3
- package/lib/core/event-body.js.map +1 -0
- package/lib/core/headers.d.ts +17 -6
- package/lib/core/headers.d.ts.map +1 -0
- package/lib/core/headers.js +17 -6
- package/lib/core/headers.js.map +1 -0
- package/lib/core/index.d.ts +1 -0
- package/lib/core/index.d.ts.map +1 -0
- package/lib/core/index.js +6 -1
- package/lib/core/index.js.map +1 -0
- package/lib/core/is-binary.d.ts +29 -11
- package/lib/core/is-binary.d.ts.map +1 -0
- package/lib/core/is-binary.js +29 -11
- package/lib/core/is-binary.js.map +1 -0
- package/lib/core/logger.d.ts +22 -5
- package/lib/core/logger.d.ts.map +1 -0
- package/lib/core/logger.js +8 -3
- package/lib/core/logger.js.map +1 -0
- package/lib/core/no-op.d.ts +4 -0
- package/lib/core/no-op.d.ts.map +1 -0
- package/lib/core/no-op.js +4 -0
- package/lib/core/no-op.js.map +1 -0
- package/lib/core/optional.d.ts +8 -3
- package/lib/core/optional.d.ts.map +1 -0
- package/lib/core/optional.js +8 -3
- package/lib/core/optional.js.map +1 -0
- package/lib/core/path.d.ts +14 -5
- package/lib/core/path.d.ts.map +1 -0
- package/lib/core/path.js +14 -5
- package/lib/core/path.js.map +1 -0
- package/lib/core/stream.d.ts +5 -1
- package/lib/core/stream.d.ts.map +1 -0
- package/lib/core/stream.js +6 -2
- package/lib/core/stream.js.map +1 -0
- package/lib/frameworks/express/express.framework.d.ts +5 -1
- package/lib/frameworks/express/express.framework.d.ts.map +1 -0
- package/lib/frameworks/express/express.framework.js +5 -1
- package/lib/frameworks/express/express.framework.js.map +1 -0
- package/lib/frameworks/express/index.d.ts +1 -0
- package/lib/frameworks/express/index.d.ts.map +1 -0
- package/lib/frameworks/express/index.js +6 -1
- package/lib/frameworks/express/index.js.map +1 -0
- package/lib/frameworks/fastify/fastify.framework.d.ts +5 -1
- package/lib/frameworks/fastify/fastify.framework.d.ts.map +1 -0
- package/lib/frameworks/fastify/fastify.framework.js +5 -1
- package/lib/frameworks/fastify/fastify.framework.js.map +1 -0
- package/lib/frameworks/fastify/index.d.ts +1 -0
- package/lib/frameworks/fastify/index.d.ts.map +1 -0
- package/lib/frameworks/fastify/index.js +6 -1
- package/lib/frameworks/fastify/index.js.map +1 -0
- package/lib/frameworks/hapi/hapi.framework.d.ts +5 -1
- package/lib/frameworks/hapi/hapi.framework.d.ts.map +1 -0
- package/lib/frameworks/hapi/hapi.framework.js +5 -1
- package/lib/frameworks/hapi/hapi.framework.js.map +1 -0
- package/lib/frameworks/hapi/index.d.ts +1 -0
- package/lib/frameworks/hapi/index.d.ts.map +1 -0
- package/lib/frameworks/hapi/index.js +6 -1
- package/lib/frameworks/hapi/index.js.map +1 -0
- package/lib/frameworks/koa/index.d.ts +1 -0
- package/lib/frameworks/koa/index.d.ts.map +1 -0
- package/lib/frameworks/koa/index.js +6 -1
- package/lib/frameworks/koa/index.js.map +1 -0
- package/lib/frameworks/koa/koa.framework.d.ts +5 -1
- package/lib/frameworks/koa/koa.framework.d.ts.map +1 -0
- package/lib/frameworks/koa/koa.framework.js +5 -1
- package/lib/frameworks/koa/koa.framework.js.map +1 -0
- 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 +18 -0
- package/lib/frameworks/lazy/index.js.map +1 -0
- 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 +75 -0
- package/lib/frameworks/lazy/lazy.framework.js.map +1 -0
- package/lib/handlers/default/default.handler.d.ts +36 -32
- package/lib/handlers/default/default.handler.d.ts.map +1 -0
- package/lib/handlers/default/default.handler.js +36 -32
- package/lib/handlers/default/default.handler.js.map +1 -0
- package/lib/handlers/default/index.d.ts +1 -0
- package/lib/handlers/default/index.d.ts.map +1 -0
- package/lib/handlers/default/index.js +6 -1
- package/lib/handlers/default/index.js.map +1 -0
- package/lib/handlers/huawei/http-huawei.handler.d.ts +14 -4
- package/lib/handlers/huawei/http-huawei.handler.d.ts.map +1 -0
- package/lib/handlers/huawei/http-huawei.handler.js +15 -4
- package/lib/handlers/huawei/http-huawei.handler.js.map +1 -0
- package/lib/handlers/huawei/index.d.ts +1 -0
- package/lib/handlers/huawei/index.d.ts.map +1 -0
- package/lib/handlers/huawei/index.js +6 -1
- package/lib/handlers/huawei/index.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +6 -1
- package/lib/index.js.map +1 -0
- package/lib/network/index.d.ts +1 -0
- package/lib/network/index.d.ts.map +1 -0
- package/lib/network/index.js +6 -1
- package/lib/network/index.js.map +1 -0
- package/lib/network/request.d.ts +28 -0
- package/lib/network/request.d.ts.map +1 -0
- package/lib/network/request.js +7 -0
- package/lib/network/request.js.map +1 -0
- package/lib/network/response.d.ts +18 -1
- package/lib/network/response.d.ts.map +1 -0
- package/lib/network/response.js +9 -1
- package/lib/network/response.js.map +1 -0
- package/lib/resolvers/aws-context/aws-context.resolver.d.ts +7 -9
- package/lib/resolvers/aws-context/aws-context.resolver.d.ts.map +1 -0
- package/lib/resolvers/aws-context/aws-context.resolver.js +7 -9
- package/lib/resolvers/aws-context/aws-context.resolver.js.map +1 -0
- package/lib/resolvers/aws-context/index.d.ts +1 -0
- package/lib/resolvers/aws-context/index.d.ts.map +1 -0
- package/lib/resolvers/aws-context/index.js +6 -1
- package/lib/resolvers/aws-context/index.js.map +1 -0
- package/lib/resolvers/callback/callback.resolver.d.ts +9 -2
- package/lib/resolvers/callback/callback.resolver.d.ts.map +1 -0
- package/lib/resolvers/callback/callback.resolver.js +6 -2
- package/lib/resolvers/callback/callback.resolver.js.map +1 -0
- package/lib/resolvers/callback/index.d.ts +1 -0
- package/lib/resolvers/callback/index.d.ts.map +1 -0
- package/lib/resolvers/callback/index.js +6 -1
- package/lib/resolvers/callback/index.js.map +1 -0
- package/lib/resolvers/dummy/dummy.resolver.d.ts +5 -1
- package/lib/resolvers/dummy/dummy.resolver.d.ts.map +1 -0
- package/lib/resolvers/dummy/dummy.resolver.js +5 -1
- package/lib/resolvers/dummy/dummy.resolver.js.map +1 -0
- package/lib/resolvers/dummy/index.d.ts +1 -0
- package/lib/resolvers/dummy/index.d.ts.map +1 -0
- package/lib/resolvers/dummy/index.js +6 -1
- package/lib/resolvers/dummy/index.js.map +1 -0
- package/lib/resolvers/promise/index.d.ts +1 -0
- package/lib/resolvers/promise/index.d.ts.map +1 -0
- package/lib/resolvers/promise/index.js +6 -1
- package/lib/resolvers/promise/index.js.map +1 -0
- package/lib/resolvers/promise/promise.resolver.d.ts +5 -1
- package/lib/resolvers/promise/promise.resolver.d.ts.map +1 -0
- package/lib/resolvers/promise/promise.resolver.js +5 -1
- package/lib/resolvers/promise/promise.resolver.js.map +1 -0
- package/lib/serverless-adapter.d.ts +17 -12
- package/lib/serverless-adapter.d.ts.map +1 -0
- package/lib/serverless-adapter.js +17 -12
- package/lib/serverless-adapter.js.map +1 -0
- package/package.json +22 -2
- package/lib/@types/proxy-params.d.ts +0 -8
- package/lib/@types/proxy-params.js +0 -2
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Run REST APIs and other web applications using your existing Node.js application
|
|
|
23
23
|
Fastify), on top of AWS Lambda, Huawei and many other clouds.
|
|
24
24
|
|
|
25
25
|
This library was a refactored version of [@vendia/serverless-express](https://github.com/vendia/serverless-express), I
|
|
26
|
-
|
|
26
|
+
create a new way to interact and extend event sources by creating contracts to abstract the integrations between each
|
|
27
27
|
library layer.
|
|
28
28
|
|
|
29
29
|
Why you would use this libray instead of [@vendia/serverless-express](https://github.com/vendia/serverless-express)?
|
|
@@ -35,266 +35,17 @@ Why you would use this libray instead of [@vendia/serverless-express](https://gi
|
|
|
35
35
|
- This is important because if you find a bug, you can quickly resolve it by extending the class, _and then you can
|
|
36
36
|
submit a PR to fix the bug_.
|
|
37
37
|
- All code was written in Typescript.
|
|
38
|
+
- Well documented, any method, class, or interface has comments to explain the behavior.
|
|
38
39
|
- We have >99% coverage.
|
|
39
40
|
|
|
40
|
-
#
|
|
41
|
+
# Documentation
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
npm install --save @h4ad/serverless-adapter
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Using Yarn:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
yarn add @h4ad/serverless-adapter
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
# Usage
|
|
55
|
-
|
|
56
|
-
You can quickly use this library as follows:
|
|
57
|
-
|
|
58
|
-
```ts
|
|
59
|
-
import { ServerlessAdapter } from '@h4ad/serverless-adapter';
|
|
60
|
-
import { ApiGatewayV2Adapter, AlbAdapter, SQSAdapter, SNSAdapter } from '@h4ad/serverless-adapter/lib/adapters/aws';
|
|
61
|
-
import { ExpressFramework } from '@h4ad/serverless-adapter/lib/frameworks/express';
|
|
62
|
-
import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default';
|
|
63
|
-
import { PromiseResolver } from '@h4ad/serverless-adapter/lib/resolvers/promise';
|
|
64
|
-
import app from './app';
|
|
65
|
-
|
|
66
|
-
export const handler = ServerlessAdapter.new(app)
|
|
67
|
-
.setFramework(new ExpressFramework())
|
|
68
|
-
.setHandler(new DefaultHandler())
|
|
69
|
-
.setResolver(new PromiseResolver())
|
|
70
|
-
.addAdapter(new AlbAdapter())
|
|
71
|
-
.addAdapter(new SQSAdapter())
|
|
72
|
-
.addAdapter(new SNSAdapter())
|
|
73
|
-
.build();
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Too fast? Ok, I can explain.
|
|
77
|
-
|
|
78
|
-
First, you need to create an instance of the builder with `ServerlessAdapter.new(app)`. The variable `app` is the
|
|
79
|
-
instance of your framework (Express, Fastify, Koa, etc).
|
|
80
|
-
|
|
81
|
-
So you need to specify for this library which `framework` you will use to handle the `request` with `setFramework`, you
|
|
82
|
-
can only use one. If you use express in our backend, use [ExpressFramework](src/frameworks/express/express.framework.ts)
|
|
83
|
-
, see more in [support](#support).
|
|
84
|
-
|
|
85
|
-
Then you specify which `handler` you will use to interact with the serverless cloud with `setHandler`, currently we only
|
|
86
|
-
have one, the [DefaultHandler](src/handlers/default/default.handler.ts). In the next releases, maybe we will add support
|
|
87
|
-
for Azure, Huawei and others, for now, you can use this default.
|
|
88
|
-
|
|
89
|
-
Then you specify with `setResolver` which `resolver` you will use to wait for the library to forward the request to
|
|
90
|
-
your `framework`, and then get the `response` back to your cloud. I recommend you
|
|
91
|
-
use [PromiseResolver](src/resolvers/promise/promise.resolver.ts), it's the most cloud-agnostic `resolver`.
|
|
92
|
-
|
|
93
|
-
By now, you've already added the basic abstractions of this library, now, you can add the `adapters` that will add
|
|
94
|
-
support for receiving and processing different sources of `addAdapter` events. In the example I
|
|
95
|
-
added [AlbAdapter](./src/adapters/aws/alb.adapter.ts), [SQSAdapter](./src/adapters/aws/sqs.adapter.ts)
|
|
96
|
-
and [SNSAdapter](./src/adapters/aws/sns.adapter.ts). With these adapters you can connect your lambda to three different
|
|
97
|
-
event sources and you can add more if you wish.
|
|
98
|
-
|
|
99
|
-
Finally, we call `build` which will assemble your handler that you can expose directly to your cloud.
|
|
100
|
-
|
|
101
|
-
Final thoughts:
|
|
102
|
-
|
|
103
|
-
- You can set the `framework` only once.
|
|
104
|
-
- You can set the `handler` only once.
|
|
105
|
-
- You can set the `resolver` only once.
|
|
106
|
-
- You can have as many `adapters` as you like, use and extend as you wish.
|
|
107
|
-
|
|
108
|
-
# Support
|
|
109
|
-
|
|
110
|
-
> We are in beta, so some adapters may not work as expected, feel free to create an issue or provide feedback on current behavior.
|
|
111
|
-
|
|
112
|
-
By design we have these contracts that define the layers of the library: Frameworks, Adapters, Resolvers and Handlers.
|
|
113
|
-
|
|
114
|
-
> If you don't know what each thing means, see [Architecture](#architecture).
|
|
115
|
-
|
|
116
|
-
Currently, we support these frameworks:
|
|
117
|
-
|
|
118
|
-
- [Express](https://expressjs.com/) by using ([ExpressFramework](src/frameworks/express/express.framework.ts))
|
|
119
|
-
- [Fastify](https://www.fastify.io/) by using ([FastifyFramework](src/frameworks/fastify/fastify.framework.ts))
|
|
120
|
-
- [Hapi](https://hapi.dev/) by using ([HapiFramework](src/frameworks/hapi/hapi.framework.ts))
|
|
121
|
-
- [Koa](https://koajs.com/) by using ([KoaFramework](src/frameworks/koa/koa.framework.ts))
|
|
122
|
-
|
|
123
|
-
We support these event sources:
|
|
124
|
-
|
|
125
|
-
- AWS
|
|
126
|
-
- [AWS Load Balancer](https://docs.aws.amazon.com/lambda/latest/dg/services-alb.html) by
|
|
127
|
-
using ([AlbAdapter](./src/adapters/aws/alb.adapter.ts))
|
|
128
|
-
- [AWS Api Gateway V1](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html)
|
|
129
|
-
by using ([ApiGatewayV1Adapter](./src/adapters/aws/api-gateway-v1.adapter.ts))
|
|
130
|
-
- [AWS Api Gateway V2](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html)
|
|
131
|
-
by using ([ApiGatewayV2Adapter](./src/adapters/aws/api-gateway-v2.adapter.ts))
|
|
132
|
-
- [AWS DynamoDB](https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html) by
|
|
133
|
-
using ([DynamoDBAdapter](./src/adapters/aws/dynamodb.adapter.ts))
|
|
134
|
-
- [AWS Event Bridge / CloudWatch Events](https://docs.aws.amazon.com/lambda/latest/dg/services-cloudwatchevents.html)
|
|
135
|
-
by using ([EventBridgeAdapter](./src/adapters/aws/event-bridge.adapter.ts))
|
|
136
|
-
- [AWS Lambda Edge](https://docs.aws.amazon.com/lambda/latest/dg/lambda-edge.html) by
|
|
137
|
-
using ([LambdaEdgeAdapter](./src/adapters/aws/lambda-edge.adapter.ts))
|
|
138
|
-
- [AWS SNS](https://docs.aws.amazon.com/pt_br/lambda/latest/dg/with-sns.html) by
|
|
139
|
-
using ([SNSAdapter](./src/adapters/aws/sns.adapter.ts))
|
|
140
|
-
- [AWS SQS](https://docs.aws.amazon.com/pt_br/lambda/latest/dg/with-sqs.html) by
|
|
141
|
-
using ([SQSAdapter](./src/adapters/aws/sqs.adapter.ts))
|
|
142
|
-
- Huawei
|
|
143
|
-
- [Http Function](https://support.huaweicloud.com/intl/en-us/usermanual-functiongraph/functiongraph_01_1442.html): Look [this section](#huawei-http-function) about Huawei support for Http Function.
|
|
144
|
-
- [Event Function](https://support.huaweicloud.com/intl/en-us/usermanual-functiongraph/functiongraph_01_1441.html):
|
|
145
|
-
- [Api Gateway](https://support.huaweicloud.com/intl/en-us/devg-functiongraph/functiongraph_02_0102.html#functiongraph_02_0102__li5178638110137) by using ([HuaweiApiGatewayAdapter](src/adapters/huawei/huawei-api-gateway.adapter.ts)).
|
|
146
|
-
- Azure
|
|
147
|
-
- [The support is coming soon.](https://github.com/H4ad/serverless-adapter/issues/3)
|
|
148
|
-
- Firebase
|
|
149
|
-
- The support is coming soon.
|
|
150
|
-
- GCP
|
|
151
|
-
- The support is coming soon.
|
|
152
|
-
|
|
153
|
-
We support these resolvers:
|
|
154
|
-
|
|
155
|
-
- Promise by using ([PromiseResolver](src/resolvers/promise/promise.resolver.ts))
|
|
156
|
-
- Callback by using ([CallbackResolver](src/resolvers/callback/callback.resolver.ts))
|
|
157
|
-
- AWS Context by using ([AwsContextResolver](src/resolvers/aws-context/aws-context.resolver.ts))
|
|
158
|
-
|
|
159
|
-
We support these handlers:
|
|
160
|
-
|
|
161
|
-
- Default by using ([DefaultHandler](src/handlers/default/default.handler.ts))
|
|
162
|
-
- Huawei by using ([HttpHuaweiHandler](src/handlers/huawei/http-huawei.handler.ts)) and ([EventHuaweiHandler](#huawei-event-function))
|
|
163
|
-
|
|
164
|
-
## Huawei
|
|
165
|
-
|
|
166
|
-
In Huawei, we added support to FunctionGraphV2 with Http Function and Event Function.
|
|
167
|
-
|
|
168
|
-
The difference between Http Function and Event Function is that in Http Function you must expose port 8000 and Huawei will proxy Api Gateway requests to your application.
|
|
169
|
-
So, on implementation, this library will create an http server to listen on port 8000 and forward the request to your framework.
|
|
170
|
-
|
|
171
|
-
In Event Function, you will receive the event from event source in the same way you receive in AWS, an object with some structure, you can see the supported event sources [here](https://support.huaweicloud.com/intl/en-us/devg-functiongraph/functiongraph_02_0102.html).
|
|
172
|
-
|
|
173
|
-
### Huawei Http Function
|
|
174
|
-
|
|
175
|
-
To integrate your app with Huawei FunctionGrapth with the Http Function type, you must do the following:
|
|
176
|
-
|
|
177
|
-
```ts
|
|
178
|
-
import { ServerlessAdapter } from '@h4ad/serverless-adapter';
|
|
179
|
-
import { ExpressFramework } from '@h4ad/serverless-adapter/lib/frameworks/express';
|
|
180
|
-
import { HttpHuaweiHandler } from '@h4ad/serverless-adapter/lib/handlers/huawei';
|
|
181
|
-
import { DummyResolver } from '@h4ad/serverless-adapter/lib/resolvers/dummy';
|
|
182
|
-
import { DummyAdapter } from '@h4ad/serverless-adapter/lib/adapters/dummy';
|
|
183
|
-
import app from './app';
|
|
184
|
-
|
|
185
|
-
// instead exposing handler, you have the dispose function
|
|
186
|
-
// this dispose function is never called
|
|
187
|
-
// but you can to close the http server created with him
|
|
188
|
-
const dispose = ServerlessAdapter.new(app)
|
|
189
|
-
.setHandler(new HttpHuaweiHandler())
|
|
190
|
-
.setFramework(new ExpressFramework())
|
|
191
|
-
// dummy resolver and adapter is used because
|
|
192
|
-
// they are necessary in the core of the library to build
|
|
193
|
-
// but is optional to make huawei http function works.
|
|
194
|
-
.setResolver(new DummyResolver())
|
|
195
|
-
.addAdapter(new DummyAdapter())
|
|
196
|
-
.build();
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
> You don't need to expose a variable called `handler` when you choose Http Function, you just need to call build to the library create a http server.
|
|
200
|
-
|
|
201
|
-
By the way of Huawei architecture in Http Function, they have no use for Resolvers and Adapters, so you need to use the dummy versions because the library requires it.
|
|
202
|
-
|
|
203
|
-
#### ONE IMPORTANT THING
|
|
204
|
-
|
|
205
|
-
You need to configure a file called `bootstrap` in the root of folder that you upload to Huawei, is like the file `Procfile` but for Huawei.
|
|
206
|
-
|
|
207
|
-
In my setup, I configure like:
|
|
208
|
-
```
|
|
209
|
-
node /opt/function/code/index.js
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
The path `/opt/function/code` is where your code is uploaded when you deploy something and `index.js` is the file that contains the `ServerlessAdapter`.
|
|
213
|
-
|
|
214
|
-
In the end, the structure of the zip file you upload looks like this:
|
|
215
|
-
|
|
216
|
-
- `bootstrap`
|
|
217
|
-
- `index.js`
|
|
218
|
-
|
|
219
|
-
### Huawei Event Function
|
|
220
|
-
|
|
221
|
-
With Http Function you need to use [HttpHuaweiHandler](src/handlers/huawei/http-huawei.handler.ts),
|
|
222
|
-
but with Event Function you should use [DefaultHandler](src/handlers/default/default.handler.ts).
|
|
223
|
-
|
|
224
|
-
So, to add support to Api Gateway you do the following:
|
|
225
|
-
|
|
226
|
-
```ts
|
|
227
|
-
import { ServerlessAdapter } from '@h4ad/serverless-adapter';
|
|
228
|
-
import { HuaweiApiGatewayAdapter } from '@h4ad/serverless-adapter/lib/adapters/huawei';
|
|
229
|
-
import { ExpressFramework } from '@h4ad/serverless-adapter/lib/frameworks/express';
|
|
230
|
-
import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default';
|
|
231
|
-
import { CallbackResolver } from '@h4ad/serverless-adapter/lib/resolvers/callback';
|
|
232
|
-
import app from './app';
|
|
233
|
-
|
|
234
|
-
export const handler = ServerlessAdapter.new(app)
|
|
235
|
-
.setFramework(new ExpressFramework())
|
|
236
|
-
.setHandler(new DefaultHandler())
|
|
237
|
-
.setResolver(new CallbackResolver())
|
|
238
|
-
.addAdapter(new HuaweiApiGatewayAdapter())
|
|
239
|
-
.build();
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
#### One important thing
|
|
243
|
-
|
|
244
|
-
You must use the callback resolver because I couldn't get it to work with the PromiseResolver.
|
|
245
|
-
Maybe it's a bug in the library or something specific in Huawei, if you have a tip please create an issue.
|
|
43
|
+
See how to use this library [here](https://viniciusl.com.br/serverless-adapter/docs/category/getting-started).
|
|
246
44
|
|
|
247
45
|
# Examples
|
|
248
46
|
|
|
249
47
|
You can see some examples of how to use this library [here](https://github.com/H4ad/serverless-adapter-examples).
|
|
250
48
|
|
|
251
|
-
# Architecture
|
|
252
|
-
|
|
253
|
-
The main purpose of this library is to allow the developer to add support for any cloud and as many event sources as he
|
|
254
|
-
wants, without having to create an issue to request the feature or copy the library code because the library doesn't
|
|
255
|
-
expose good APIs for you to extend its functionality
|
|
256
|
-
|
|
257
|
-
So I refactored [@vendia/serverless-express](https://github.com/vendia/serverless-express) with 4 layers of abstraction:
|
|
258
|
-
Framework, Handler, Resolver and Adapter.
|
|
259
|
-
|
|
260
|
-
The [FrameworkContract](./src/contracts/framework.contract.ts) is responsible for forwarding
|
|
261
|
-
to [IncomingMessage](https://nodejs.org/api/http.html#class-httpincomingmessage)
|
|
262
|
-
and [ServerResponse](https://nodejs.org/api/http.html#class-httpserverresponse) for your application instance. With this
|
|
263
|
-
abstraction you can implement any framework you want, they just need to accept both parameters and
|
|
264
|
-
call [end](https://nodejs.org/api/http.html#class-httpserverresponse)
|
|
265
|
-
in [ServerResponse](https://nodejs.org/api/http.html#class-httpserverresponse), so the library knows when to continue
|
|
266
|
-
and return the response.
|
|
267
|
-
|
|
268
|
-
The [HandlerContract](./src/contracts/handler.contract.ts) is responsible to get the input from the serverless and then
|
|
269
|
-
manage to call each layer of abstraction to return a response. With this abstraction, you can implement different ways
|
|
270
|
-
to receive input from your serverless environment. They usually have the same structure, but if you need to deal with a
|
|
271
|
-
very different cloud, you can use this abstraction to add support for that cloud.
|
|
272
|
-
|
|
273
|
-
> Handler is a good choice for implementing (~~monsters~~) ways to receive input.
|
|
274
|
-
> For example, we can create an http server as its handler to test our serverless code without having to launch the framework. Because? I don't know, but you can.
|
|
275
|
-
|
|
276
|
-
The [ResolverContract](./src/contracts/resolver.contract.ts) is responsible for waiting for the framework to handle the
|
|
277
|
-
request and then returning the response to the cloud. Using AWS for example, you have three ways to wait for the
|
|
278
|
-
response: returning a promise, calling the callback, and ~~using in-context methods~~, each option has its own benefits,
|
|
279
|
-
but generally the promise option will be the better because any good cloud provider will support promises.
|
|
280
|
-
|
|
281
|
-
Finally, the masterpiece of this library, the [AdapterContract](./src/contracts/adapter.contract.ts) is responsible for
|
|
282
|
-
handling the received event, transforming the request in a way that your application can understand and then
|
|
283
|
-
transforming the response in a way your cloud can understand.
|
|
284
|
-
|
|
285
|
-
Well, with these four contracts, you'll be able to add support to any cloud that exists (no more excuses not to use
|
|
286
|
-
cloud X with NodeJS).
|
|
287
|
-
|
|
288
|
-
## Why you create this library?
|
|
289
|
-
|
|
290
|
-
The real reason I created this library was because I wanted to add API Gateway and SQS support at the same time to save
|
|
291
|
-
some money. But, [@vendia/serverless-express](https://github.com/vendia/serverless-express) was not supported, so
|
|
292
|
-
I [created a PR](https://github.com/vendia/serverless-express/pull/483), but until I finished this library, that PR was
|
|
293
|
-
never accepted.
|
|
294
|
-
|
|
295
|
-
So I build my own library based on that library with better APIs so I never have to wait for the maintainer to accept my
|
|
296
|
-
PR just to extend the library's functionality :)
|
|
297
|
-
|
|
298
49
|
# Credits
|
|
299
50
|
|
|
300
51
|
Honestly, I just refactored all the code that the @vendia team and many other contributors wrote, thanks so much to them
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The interface representing the settings
|
|
2
|
+
* The interface representing the binary settings implementation by function
|
|
3
3
|
*
|
|
4
|
-
* @
|
|
4
|
+
* @breadcrumb Types / BinarySettings
|
|
5
|
+
* @public
|
|
5
6
|
*/
|
|
6
|
-
export
|
|
7
|
+
export interface BinarySettingsFunction {
|
|
7
8
|
/**
|
|
8
9
|
* This property can be a function that receives the response headers and returns whether that response should be encoded as binary.
|
|
9
10
|
* Otherwise, you can specify not to treat any response as binary by putting `false` in this property.
|
|
10
11
|
*
|
|
11
|
-
* @
|
|
12
|
+
* @remarks Setting this property prevents the `contentTypes` and `contentEncodings` properties from being used.
|
|
12
13
|
*/
|
|
13
14
|
isBinary: ((headers: Record<string, string | string[] | undefined>) => boolean) | false;
|
|
14
|
-
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The interface representing the binary settings implementation by looking inside the headers
|
|
18
|
+
*
|
|
19
|
+
* @breadcrumb Types / BinarySettings
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export interface BinarySettingsContentHeaders {
|
|
15
23
|
/**
|
|
16
24
|
* The list of content types that will be treated as binary
|
|
17
25
|
*/
|
|
@@ -20,4 +28,14 @@ export declare type BinarySettings = {
|
|
|
20
28
|
* The list of content encodings that will be treated as binary
|
|
21
29
|
*/
|
|
22
30
|
contentEncodings: string[];
|
|
23
|
-
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The interface representing the settings for whether the response should be treated as binary or not
|
|
34
|
+
*
|
|
35
|
+
* @remarks Encoded as binary means the response body will be converted to base64
|
|
36
|
+
*
|
|
37
|
+
* @breadcrumb Types / BinarySettings
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export declare type BinarySettings = BinarySettingsFunction | BinarySettingsContentHeaders;
|
|
41
|
+
//# sourceMappingURL=binary-settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-settings.d.ts","sourceRoot":"","sources":["../../src/@types/binary-settings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;;OAKG;IACH,QAAQ,EACJ,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,KAAK,OAAO,CAAC,GACrE,KAAK,CAAC;CACX;AAED;;;;;GAKG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,YAAY,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAElC;;OAEG;IACH,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,oBAAY,cAAc,GACtB,sBAAsB,GACtB,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-settings.js","sourceRoot":"","sources":["../../src/@types/binary-settings.ts"],"names":[],"mappings":""}
|
package/lib/@types/headers.d.ts
CHANGED
|
@@ -1,24 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The record that represents the headers that doesn't have multiple values in the value
|
|
3
3
|
*
|
|
4
|
-
* @example
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
5
6
|
* { 'Accept-Encoding': 'gzip, deflate, br' }
|
|
6
7
|
* ```
|
|
8
|
+
*
|
|
9
|
+
* @breadcrumb Types
|
|
10
|
+
* @public
|
|
7
11
|
*/
|
|
8
12
|
export declare type SingleValueHeaders = Record<string, string | undefined>;
|
|
9
13
|
/**
|
|
10
14
|
* The record that represents the headers that have multiple values in the value
|
|
11
15
|
*
|
|
12
|
-
* @example
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
13
18
|
* { 'Accept-Encoding': ['gzip', 'deflate', 'br'] }
|
|
14
19
|
* ```
|
|
20
|
+
*
|
|
21
|
+
* @breadcrumb Types
|
|
22
|
+
* @public
|
|
15
23
|
*/
|
|
16
24
|
export declare type MultiValueHeaders = Record<string, string[] | undefined>;
|
|
17
25
|
/**
|
|
18
26
|
* The record that represents the headers that can both single or multiple values in the value
|
|
19
27
|
*
|
|
20
|
-
* @example
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
21
30
|
* { 'Accept-Encoding': ['gzip', 'deflate', 'br'], 'Host': 'xyz.execute-api.us-east-1.amazonaws.com' }
|
|
22
31
|
* ```
|
|
32
|
+
*
|
|
33
|
+
* @breadcrumb Types
|
|
34
|
+
* @public
|
|
23
35
|
*/
|
|
24
36
|
export declare type BothValueHeaders = Record<string, string | string[] | undefined>;
|
|
37
|
+
//# sourceMappingURL=headers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../src/@types/headers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,oBAAY,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAEpE;;;;;;;;;;GAUG;AACH,oBAAY,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;AAErE;;;;;;;;;;GAUG;AACH,oBAAY,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC"}
|
package/lib/@types/headers.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headers.js","sourceRoot":"","sources":["../../src/@types/headers.ts"],"names":[],"mappings":""}
|
package/lib/@types/helpers.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/@types/helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,oBAAY,QAAQ,CAAC,IAAI,IAAI;KAC1B,QAAQ,IAAI,MAAM,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;CAC3C,CAAC"}
|
package/lib/@types/helpers.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/@types/helpers.ts"],"names":[],"mappings":""}
|
|
@@ -1,19 +1,81 @@
|
|
|
1
1
|
import { BothValueHeaders } from '../index';
|
|
2
|
+
/**
|
|
3
|
+
* The interface that represents the Api Gateway Event of Huawei when integrate with Function Graph of Event Type.
|
|
4
|
+
* See more in {@link https://support.huaweicloud.com/intl/en-us/devg-functiongraph/functiongraph_02_0102.html#functiongraph_02_0102__li5178638110137 | Reference}.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
* @breadcrumb Types / Huawei / HuaweiApiGatewayEvent
|
|
8
|
+
*/
|
|
2
9
|
export interface HuaweiApiGatewayEvent {
|
|
10
|
+
/**
|
|
11
|
+
* The body value with the content of this event serialized in JSON
|
|
12
|
+
*/
|
|
3
13
|
body: string;
|
|
14
|
+
/**
|
|
15
|
+
* The headers of the request which this event represents
|
|
16
|
+
*/
|
|
4
17
|
headers: BothValueHeaders;
|
|
18
|
+
/**
|
|
19
|
+
* The HTTP Method of the request which this event represents
|
|
20
|
+
*/
|
|
5
21
|
httpMethod: string;
|
|
22
|
+
/**
|
|
23
|
+
* Tells if the body is base64 encoded
|
|
24
|
+
*/
|
|
6
25
|
isBase64Encoded: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The path of the request which this event represents
|
|
28
|
+
*/
|
|
7
29
|
path: string;
|
|
30
|
+
/**
|
|
31
|
+
* The path parameters of the request which this event represents
|
|
32
|
+
*/
|
|
8
33
|
pathParameters: HuaweiRequestPathParameters;
|
|
34
|
+
/**
|
|
35
|
+
* The query strings of the request which this event represents
|
|
36
|
+
*/
|
|
9
37
|
queryStringParameters: HuaweiRequestQueryStringParameters;
|
|
38
|
+
/**
|
|
39
|
+
* The request context with information about the stage, api and requestId
|
|
40
|
+
*/
|
|
10
41
|
requestContext: HuaweiRequestContext;
|
|
42
|
+
/**
|
|
43
|
+
* It can have more properties that I could not discover yet
|
|
44
|
+
*/
|
|
11
45
|
[key: string]: any;
|
|
12
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* The path parameters of the request, usually is the name of the wildcard you create in FunctionGraph, such as /\{proxy\}.
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
* @breadcrumb Types / Huawei / HuaweiApiGatewayEvent
|
|
52
|
+
*/
|
|
13
53
|
export declare type HuaweiRequestPathParameters = Record<string, string>;
|
|
54
|
+
/**
|
|
55
|
+
* The query strings of the request
|
|
56
|
+
*
|
|
57
|
+
* @public
|
|
58
|
+
* @breadcrumb Types / Huawei / HuaweiApiGatewayEvent
|
|
59
|
+
*/
|
|
14
60
|
export declare type HuaweiRequestQueryStringParameters = Record<string, string | string[]>;
|
|
61
|
+
/**
|
|
62
|
+
* The interface that represents the values you can get inside request context.
|
|
63
|
+
*
|
|
64
|
+
* @public
|
|
65
|
+
* @breadcrumb Types / Huawei / HuaweiApiGatewayEvent
|
|
66
|
+
*/
|
|
15
67
|
export interface HuaweiRequestContext {
|
|
68
|
+
/**
|
|
69
|
+
* The ID of your API inside Api Gateway
|
|
70
|
+
*/
|
|
16
71
|
apiId: string;
|
|
72
|
+
/**
|
|
73
|
+
* The ID of this request
|
|
74
|
+
*/
|
|
17
75
|
requestId: string;
|
|
76
|
+
/**
|
|
77
|
+
* The name of the stage running this Function Graph
|
|
78
|
+
*/
|
|
18
79
|
stage: string;
|
|
19
80
|
}
|
|
81
|
+
//# sourceMappingURL=huawei-api-gateway-event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"huawei-api-gateway-event.d.ts","sourceRoot":"","sources":["../../../src/@types/huawei/huawei-api-gateway-event.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAI5C;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,EAAE,gBAAgB,CAAC;IAE1B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IAEzB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,cAAc,EAAE,2BAA2B,CAAC;IAE5C;;OAEG;IACH,qBAAqB,EAAE,kCAAkC,CAAC;IAE1D;;OAEG;IACH,cAAc,EAAE,oBAAoB,CAAC;IAErC;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;;;GAKG;AACH,oBAAY,2BAA2B,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEjE;;;;;GAKG;AACH,oBAAY,kCAAkC,GAAG,MAAM,CACrD,MAAM,EACN,MAAM,GAAG,MAAM,EAAE,CAClB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"huawei-api-gateway-event.js","sourceRoot":"","sources":["../../../src/@types/huawei/huawei-api-gateway-event.ts"],"names":[],"mappings":";AAAA,iBAAiB"}
|
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
import { MultiValueHeaders } from '../headers';
|
|
2
|
+
/**
|
|
3
|
+
* The interface that represents the Api Gateway Response of Huawei when integrate with Function Graph of Event Type.
|
|
4
|
+
* See more in {@link https://support.huaweicloud.com/intl/en-us/devg-functiongraph/functiongraph_02_0102.html#functiongraph_02_0102__li5178638110137 | Reference}.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
* @breadcrumb Types / Huawei / HuaweiApiGatewayResponse
|
|
8
|
+
*/
|
|
2
9
|
export interface HuaweiApiGatewayResponse {
|
|
10
|
+
/**
|
|
11
|
+
* Tells if the body was encoded as base64
|
|
12
|
+
*/
|
|
3
13
|
isBase64Encoded: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The HTTP Status code of this response
|
|
16
|
+
*/
|
|
4
17
|
statusCode: number;
|
|
18
|
+
/**
|
|
19
|
+
* The headers sent with this response
|
|
20
|
+
*/
|
|
5
21
|
headers: MultiValueHeaders;
|
|
22
|
+
/**
|
|
23
|
+
* The body value with the content of this response serialized in JSON
|
|
24
|
+
*/
|
|
6
25
|
body: string;
|
|
7
26
|
}
|
|
27
|
+
//# sourceMappingURL=huawei-api-gateway-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"huawei-api-gateway-response.d.ts","sourceRoot":"","sources":["../../../src/@types/huawei/huawei-api-gateway-response.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAI/C;;;;;;GAMG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IAEzB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,OAAO,EAAE,iBAAiB,CAAC;IAE3B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"huawei-api-gateway-response.js","sourceRoot":"","sources":["../../../src/@types/huawei/huawei-api-gateway-response.ts"],"names":[],"mappings":";AAAA,iBAAiB"}
|