@h4ad/serverless-adapter 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -260
- 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 +17 -0
- package/lib/frameworks/lazy/index.js.map +1 -0
- package/lib/frameworks/lazy/lazy.framework.d.ts +7 -2
- package/lib/frameworks/lazy/lazy.framework.d.ts.map +1 -0
- package/lib/frameworks/lazy/lazy.framework.js +7 -2
- package/lib/frameworks/lazy/lazy.framework.js.map +1 -0
- package/lib/frameworks/trpc/index.d.ts +2 -0
- package/lib/frameworks/trpc/index.d.ts.map +1 -0
- package/lib/frameworks/trpc/index.js +18 -0
- package/lib/frameworks/trpc/index.js.map +1 -0
- package/lib/frameworks/trpc/trpc.framework.d.ts +152 -0
- package/lib/frameworks/trpc/trpc.framework.d.ts.map +1 -0
- package/lib/frameworks/trpc/trpc.framework.js +119 -0
- package/lib/frameworks/trpc/trpc.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 +29 -4
- package/lib/@types/proxy-params.d.ts +0 -8
- package/lib/@types/proxy-params.js +0 -2
|
@@ -1,31 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The return value of {@link HuaweiContext} getRequestID
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
* @breadcrumb Types / Huawei / HuaweiContext
|
|
6
|
+
*/
|
|
1
7
|
export declare type GetRequestIDSecondsReturn = string;
|
|
8
|
+
/**
|
|
9
|
+
* The return value of {@link HuaweiContext} getRemainingTimeInMilliSeconds
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
* @breadcrumb Types / Huawei / HuaweiContext
|
|
13
|
+
*/
|
|
2
14
|
export declare type GetRemainingTimeInMilliSecondsReturn = number;
|
|
15
|
+
/**
|
|
16
|
+
* The return value of {@link HuaweiContext} getAccessKey
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
* @breadcrumb Types / Huawei / HuaweiContext
|
|
20
|
+
*/
|
|
3
21
|
export declare type GetAccessKeyReturn = string;
|
|
22
|
+
/**
|
|
23
|
+
* The return value of {@link HuaweiContext} getSecretKey
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
* @breadcrumb Types / Huawei / HuaweiContext
|
|
27
|
+
*/
|
|
4
28
|
export declare type GetSecretKeyReturn = string;
|
|
29
|
+
/**
|
|
30
|
+
* The parameters of the method {@link HuaweiContext} getUserData
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
* @breadcrumb Types / Huawei / HuaweiContext
|
|
34
|
+
*/
|
|
5
35
|
export declare type GetUserDataKeyParameter = string;
|
|
36
|
+
/**
|
|
37
|
+
* The return value of {@link HuaweiContext} getUserData
|
|
38
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
* @breadcrumb Types / Huawei / HuaweiContext
|
|
41
|
+
*/
|
|
6
42
|
export declare type GetUserDataReturn = any;
|
|
43
|
+
/**
|
|
44
|
+
* The return value of {@link HuaweiContext} getFunctionName
|
|
45
|
+
*
|
|
46
|
+
* @public
|
|
47
|
+
* @breadcrumb Types / Huawei / HuaweiContext
|
|
48
|
+
*/
|
|
7
49
|
export declare type GetFunctionNameReturn = string;
|
|
50
|
+
/**
|
|
51
|
+
* The return value of {@link HuaweiContext} getRunningTimeInSeconds
|
|
52
|
+
*
|
|
53
|
+
* @public
|
|
54
|
+
* @breadcrumb Types / Huawei / HuaweiContext
|
|
55
|
+
*/
|
|
8
56
|
export declare type GetRunningTimeInSecondsReturn = number;
|
|
57
|
+
/**
|
|
58
|
+
* The return value of {@link HuaweiContext} getVersion
|
|
59
|
+
*
|
|
60
|
+
* @public
|
|
61
|
+
* @breadcrumb Types / Huawei / HuaweiContext
|
|
62
|
+
*/
|
|
9
63
|
export declare type GetVersionReturn = string;
|
|
64
|
+
/**
|
|
65
|
+
* The return value of {@link HuaweiContext} getMemorySize
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
|
+
* @breadcrumb Types / Huawei / HuaweiContext
|
|
69
|
+
*/
|
|
10
70
|
export declare type GetMemorySizeReturn = number;
|
|
71
|
+
/**
|
|
72
|
+
* The return value of {@link HuaweiContext} getCPUNumber
|
|
73
|
+
*
|
|
74
|
+
* @public
|
|
75
|
+
* @breadcrumb Types / Huawei / HuaweiContext
|
|
76
|
+
*/
|
|
11
77
|
export declare type GetCPUNumberReturn = number;
|
|
78
|
+
/**
|
|
79
|
+
* The return value of {@link HuaweiContext} getProjectID
|
|
80
|
+
*
|
|
81
|
+
* @public
|
|
82
|
+
* @breadcrumb Types / Huawei / HuaweiContext
|
|
83
|
+
*/
|
|
12
84
|
export declare type GetProjectIdReturn = number;
|
|
85
|
+
/**
|
|
86
|
+
* The return value of {@link HuaweiContext} getPackage
|
|
87
|
+
*
|
|
88
|
+
* @public
|
|
89
|
+
* @breadcrumb Types / Huawei / HuaweiContext
|
|
90
|
+
*/
|
|
13
91
|
export declare type GetPackageReturn = string;
|
|
92
|
+
/**
|
|
93
|
+
* The return value of {@link HuaweiContext} getToken
|
|
94
|
+
*
|
|
95
|
+
* @public
|
|
96
|
+
* @breadcrumb Types / Huawei / HuaweiContext
|
|
97
|
+
*/
|
|
98
|
+
export declare type GetTokenReturn = string;
|
|
99
|
+
/**
|
|
100
|
+
* The return value of {@link HuaweiContext} getLogger
|
|
101
|
+
*
|
|
102
|
+
* Is the instance of logger that can be used to send logs to
|
|
103
|
+
*
|
|
104
|
+
* @public
|
|
105
|
+
* @breadcrumb Types / Huawei / HuaweiContext
|
|
106
|
+
*/
|
|
14
107
|
export declare type GetLoggerReturn = {
|
|
15
108
|
info(message: string): void;
|
|
16
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* The interface that represents methods sent by huawei to get information about the function graph.
|
|
112
|
+
* See more in {@link https://support.huaweicloud.com/intl/en-us/devg-functiongraph/functiongraph_02_0410.html#section1 | Context Methods}
|
|
113
|
+
*
|
|
114
|
+
* @public
|
|
115
|
+
* @breadcrumb Types / Huawei / HuaweiContext
|
|
116
|
+
*/
|
|
17
117
|
export interface HuaweiContext {
|
|
118
|
+
/**
|
|
119
|
+
* Obtains a request ID.
|
|
120
|
+
*/
|
|
18
121
|
getRequestID(): GetRequestIDSecondsReturn;
|
|
122
|
+
/**
|
|
123
|
+
* Obtains the remaining running time of a function.
|
|
124
|
+
*/
|
|
19
125
|
getRemainingTimeInMilliSeconds(): GetRemainingTimeInMilliSecondsReturn;
|
|
126
|
+
/**
|
|
127
|
+
* Obtains the AK (valid for 24 hours) of an agency. If you use this method, you need to configure an agency for the function.
|
|
128
|
+
*/
|
|
20
129
|
getAccessKey(): GetAccessKeyReturn;
|
|
130
|
+
/**
|
|
131
|
+
* Obtains the SK (valid for 24 hours) of an agency. If you use this method, you need to configure an agency for the function.
|
|
132
|
+
*/
|
|
21
133
|
getSecretKey(): GetSecretKeyReturn;
|
|
134
|
+
/**
|
|
135
|
+
* Uses keys to obtain the values passed by environment variables.
|
|
136
|
+
*
|
|
137
|
+
* @param key - The key to get environment variables values
|
|
138
|
+
*/
|
|
22
139
|
getUserData(key: GetUserDataKeyParameter): GetUserDataReturn;
|
|
140
|
+
/**
|
|
141
|
+
* Obtains the name of a function.
|
|
142
|
+
*/
|
|
23
143
|
getFunctionName(): GetFunctionNameReturn;
|
|
144
|
+
/**
|
|
145
|
+
* Obtains the timeout of a function.
|
|
146
|
+
*/
|
|
24
147
|
getRunningTimeInSeconds(): GetRunningTimeInSecondsReturn;
|
|
148
|
+
/**
|
|
149
|
+
* Obtains the version of a function.
|
|
150
|
+
*/
|
|
25
151
|
getVersion(): GetVersionReturn;
|
|
152
|
+
/**
|
|
153
|
+
* Obtains the allocated memory.
|
|
154
|
+
*/
|
|
26
155
|
getMemorySize(): GetMemorySizeReturn;
|
|
156
|
+
/**
|
|
157
|
+
* Number of CPU millicores used by the function (1 core = 1000 millicores).
|
|
158
|
+
*
|
|
159
|
+
* The value of this field is proportional to that of MemorySize. By default, 100 CPU millicores are required for 128 MB memory. The number of CPU millicores is calculated as follows: Memory/128 x 100 + 200 (basic CPU millicores).
|
|
160
|
+
*/
|
|
27
161
|
getCPUNumber(): GetCPUNumberReturn;
|
|
162
|
+
/**
|
|
163
|
+
* Obtains a project ID.
|
|
164
|
+
*/
|
|
28
165
|
getProjectID(): GetProjectIdReturn;
|
|
166
|
+
/**
|
|
167
|
+
* Obtains a function group, that is, an app.
|
|
168
|
+
*/
|
|
29
169
|
getPackage(): GetPackageReturn;
|
|
170
|
+
/**
|
|
171
|
+
* Obtains the token (valid for 24 hours) of an agency. If you use this method, you need to configure an agency for the function.
|
|
172
|
+
*/
|
|
173
|
+
getToken(): GetTokenReturn;
|
|
174
|
+
/**
|
|
175
|
+
* Obtains the logger method provided by the context and returns a log output class. Logs are output in the format of Time-Request ID-Content by using the info method.
|
|
176
|
+
*
|
|
177
|
+
* For example, use the info method to output logs:
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```typescript
|
|
181
|
+
* logg = context.getLogger()
|
|
182
|
+
*
|
|
183
|
+
* logg.info("hello")
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
30
186
|
getLogger(): GetLoggerReturn;
|
|
31
187
|
}
|
|
188
|
+
//# sourceMappingURL=huawei-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"huawei-context.d.ts","sourceRoot":"","sources":["../../../src/@types/huawei/huawei-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,oBAAY,yBAAyB,GAAG,MAAM,CAAC;AAE/C;;;;;GAKG;AACH,oBAAY,oCAAoC,GAAG,MAAM,CAAC;AAE1D;;;;;GAKG;AACH,oBAAY,kBAAkB,GAAG,MAAM,CAAC;AAExC;;;;;GAKG;AACH,oBAAY,kBAAkB,GAAG,MAAM,CAAC;AAExC;;;;;GAKG;AACH,oBAAY,uBAAuB,GAAG,MAAM,CAAC;AAE7C;;;;;GAKG;AACH,oBAAY,iBAAiB,GAAG,GAAG,CAAC;AAEpC;;;;;GAKG;AACH,oBAAY,qBAAqB,GAAG,MAAM,CAAC;AAE3C;;;;;GAKG;AACH,oBAAY,6BAA6B,GAAG,MAAM,CAAC;AAEnD;;;;;GAKG;AACH,oBAAY,gBAAgB,GAAG,MAAM,CAAC;AAEtC;;;;;GAKG;AACH,oBAAY,mBAAmB,GAAG,MAAM,CAAC;AAEzC;;;;;GAKG;AACH,oBAAY,kBAAkB,GAAG,MAAM,CAAC;AAExC;;;;;GAKG;AACH,oBAAY,kBAAkB,GAAG,MAAM,CAAC;AAExC;;;;;GAKG;AACH,oBAAY,gBAAgB,GAAG,MAAM,CAAC;AAEtC;;;;;GAKG;AACH,oBAAY,cAAc,GAAG,MAAM,CAAC;AAEpC;;;;;;;GAOG;AACH,oBAAY,eAAe,GAAG;IAC5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,YAAY,IAAI,yBAAyB,CAAC;IAE1C;;OAEG;IACH,8BAA8B,IAAI,oCAAoC,CAAC;IAEvE;;OAEG;IACH,YAAY,IAAI,kBAAkB,CAAC;IAEnC;;OAEG;IACH,YAAY,IAAI,kBAAkB,CAAC;IAEnC;;;;OAIG;IACH,WAAW,CAAC,GAAG,EAAE,uBAAuB,GAAG,iBAAiB,CAAC;IAE7D;;OAEG;IACH,eAAe,IAAI,qBAAqB,CAAC;IAEzC;;OAEG;IACH,uBAAuB,IAAI,6BAA6B,CAAC;IAEzD;;OAEG;IACH,UAAU,IAAI,gBAAgB,CAAC;IAE/B;;OAEG;IACH,aAAa,IAAI,mBAAmB,CAAC;IAErC;;;;OAIG;IACH,YAAY,IAAI,kBAAkB,CAAC;IAEnC;;OAEG;IACH,YAAY,IAAI,kBAAkB,CAAC;IAEnC;;OAEG;IACH,UAAU,IAAI,gBAAgB,CAAC;IAE/B;;OAEG;IACH,QAAQ,IAAI,cAAc,CAAC;IAE3B;;;;;;;;;;;OAWG;IACH,SAAS,IAAI,eAAe,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"huawei-context.js","sourceRoot":"","sources":["../../../src/@types/huawei/huawei-context.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/@types/huawei/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -13,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
17
|
__exportStar(require("./huawei-context"), exports);
|
|
14
18
|
__exportStar(require("./huawei-api-gateway-event"), exports);
|
|
15
19
|
__exportStar(require("./huawei-api-gateway-response"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/@types/huawei/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,6DAA2C;AAC3C,gEAA8C"}
|
package/lib/@types/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/@types/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
|
package/lib/@types/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -12,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
17
|
__exportStar(require("./binary-settings"), exports);
|
|
14
18
|
__exportStar(require("./headers"), exports);
|
|
15
|
-
__exportStar(require("./
|
|
19
|
+
__exportStar(require("./helpers"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/@types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,4CAA0B;AAC1B,4CAA0B"}
|
|
@@ -2,57 +2,65 @@ import type { ALBEvent, ALBResult, Context } from 'aws-lambda';
|
|
|
2
2
|
import { AdapterContract, AdapterRequest, GetResponseAdapterProps, OnErrorProps } from '../../contracts';
|
|
3
3
|
/**
|
|
4
4
|
* The options to customize the {@link AlbAdapter}
|
|
5
|
+
*
|
|
6
|
+
* @breadcrumb Adapters / AWS / AlbAdapter
|
|
7
|
+
* @public
|
|
5
8
|
*/
|
|
6
9
|
export interface AlbAdapterOptions {
|
|
7
10
|
/**
|
|
8
11
|
* Strip base path for custom domains
|
|
9
12
|
*
|
|
10
|
-
* @
|
|
13
|
+
* @defaultValue ''
|
|
11
14
|
*/
|
|
12
15
|
stripBasePath?: string;
|
|
13
16
|
}
|
|
14
17
|
/**
|
|
15
18
|
* The adapter to handle requests from AWS ALB
|
|
16
19
|
*
|
|
17
|
-
* @example
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
18
22
|
* const stripBasePath = '/any/custom/base/path'; // default ''
|
|
19
23
|
* const adapter = new AlbAdapter({ stripBasePath });
|
|
20
24
|
* ```
|
|
21
25
|
*
|
|
22
|
-
* {@link https://docs.aws.amazon.com/lambda/latest/dg/services-alb.html Event Reference}
|
|
26
|
+
* {@link https://docs.aws.amazon.com/lambda/latest/dg/services-alb.html | Event Reference}
|
|
27
|
+
*
|
|
28
|
+
* @breadcrumb Adapters / AWS / AlbAdapter
|
|
29
|
+
* @public
|
|
23
30
|
*/
|
|
24
31
|
export declare class AlbAdapter implements AdapterContract<ALBEvent, Context, ALBResult> {
|
|
25
32
|
protected readonly options?: AlbAdapterOptions | undefined;
|
|
26
33
|
/**
|
|
27
34
|
* Default constructor
|
|
28
35
|
*
|
|
29
|
-
* @param options The options to customize the {@link AlbAdapter}
|
|
36
|
+
* @param options - The options to customize the {@link AlbAdapter}
|
|
30
37
|
*/
|
|
31
38
|
constructor(options?: AlbAdapterOptions | undefined);
|
|
32
39
|
/**
|
|
33
|
-
* @inheritDoc
|
|
40
|
+
* {@inheritDoc}
|
|
34
41
|
*/
|
|
35
42
|
getAdapterName(): string;
|
|
36
43
|
/**
|
|
37
|
-
* @inheritDoc
|
|
44
|
+
* {@inheritDoc}
|
|
38
45
|
*/
|
|
39
46
|
canHandle(event: unknown): event is ALBEvent;
|
|
40
47
|
/**
|
|
41
|
-
* @inheritDoc
|
|
48
|
+
* {@inheritDoc}
|
|
42
49
|
*/
|
|
43
50
|
getRequest(event: ALBEvent): AdapterRequest;
|
|
44
51
|
/**
|
|
45
|
-
* @inheritDoc
|
|
52
|
+
* {@inheritDoc}
|
|
46
53
|
*/
|
|
47
54
|
getResponse({ event, headers: responseHeaders, body, isBase64Encoded, statusCode, }: GetResponseAdapterProps<ALBEvent>): ALBResult;
|
|
48
55
|
/**
|
|
49
|
-
* @inheritDoc
|
|
56
|
+
* {@inheritDoc}
|
|
50
57
|
*/
|
|
51
58
|
onErrorWhileForwarding({ error, delegatedResolver, respondWithErrors, event, log, }: OnErrorProps<ALBEvent, ALBResult>): void;
|
|
52
59
|
/**
|
|
53
60
|
* Get path from event with query strings
|
|
54
61
|
*
|
|
55
|
-
* @param event The event sent by serverless
|
|
62
|
+
* @param event - The event sent by serverless
|
|
56
63
|
*/
|
|
57
64
|
protected getPathFromEvent(event: ALBEvent): string;
|
|
58
65
|
}
|
|
66
|
+
//# sourceMappingURL=alb.adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alb.adapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/aws/alb.adapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EACL,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,YAAY,EACb,MAAM,iBAAiB,CAAC;AAWzB;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,UACX,YAAW,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC;IAS5C,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC;IALvC;;;;OAIG;gBAC4B,OAAO,CAAC,+BAAmB;IAM1D;;OAEG;IACI,cAAc,IAAI,MAAM;IAI/B;;OAEG;IACI,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ;IAMnD;;OAEG;IACI,UAAU,CAAC,KAAK,EAAE,QAAQ,GAAG,cAAc;IAkClD;;OAEG;IACI,WAAW,CAAC,EACjB,KAAK,EACL,OAAO,EAAE,eAAe,EACxB,IAAI,EACJ,eAAe,EACf,UAAU,GACX,EAAE,uBAAuB,CAAC,QAAQ,CAAC,GAAG,SAAS;IAkBhD;;OAEG;IACI,sBAAsB,CAAC,EAC5B,KAAK,EACL,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,EACL,GAAG,GACJ,EAAE,YAAY,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,IAAI;IAkB3C;;;;OAIG;IACH,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM;CAgBpD"}
|
|
@@ -6,19 +6,23 @@ const core_1 = require("../../core");
|
|
|
6
6
|
/**
|
|
7
7
|
* The adapter to handle requests from AWS ALB
|
|
8
8
|
*
|
|
9
|
-
* @example
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
10
11
|
* const stripBasePath = '/any/custom/base/path'; // default ''
|
|
11
12
|
* const adapter = new AlbAdapter({ stripBasePath });
|
|
12
13
|
* ```
|
|
13
14
|
*
|
|
14
|
-
* {@link https://docs.aws.amazon.com/lambda/latest/dg/services-alb.html Event Reference}
|
|
15
|
+
* {@link https://docs.aws.amazon.com/lambda/latest/dg/services-alb.html | Event Reference}
|
|
16
|
+
*
|
|
17
|
+
* @breadcrumb Adapters / AWS / AlbAdapter
|
|
18
|
+
* @public
|
|
15
19
|
*/
|
|
16
20
|
class AlbAdapter {
|
|
17
21
|
//#region Constructor
|
|
18
22
|
/**
|
|
19
23
|
* Default constructor
|
|
20
24
|
*
|
|
21
|
-
* @param options The options to customize the {@link AlbAdapter}
|
|
25
|
+
* @param options - The options to customize the {@link AlbAdapter}
|
|
22
26
|
*/
|
|
23
27
|
constructor(options) {
|
|
24
28
|
this.options = options;
|
|
@@ -26,20 +30,20 @@ class AlbAdapter {
|
|
|
26
30
|
//#endregion
|
|
27
31
|
//#region Public Methods
|
|
28
32
|
/**
|
|
29
|
-
* @inheritDoc
|
|
33
|
+
* {@inheritDoc}
|
|
30
34
|
*/
|
|
31
35
|
getAdapterName() {
|
|
32
36
|
return AlbAdapter.name;
|
|
33
37
|
}
|
|
34
38
|
/**
|
|
35
|
-
* @inheritDoc
|
|
39
|
+
* {@inheritDoc}
|
|
36
40
|
*/
|
|
37
41
|
canHandle(event) {
|
|
38
42
|
const albEvent = event;
|
|
39
43
|
return !!((albEvent === null || albEvent === void 0 ? void 0 : albEvent.requestContext) && albEvent.requestContext.elb);
|
|
40
44
|
}
|
|
41
45
|
/**
|
|
42
|
-
* @inheritDoc
|
|
46
|
+
* {@inheritDoc}
|
|
43
47
|
*/
|
|
44
48
|
getRequest(event) {
|
|
45
49
|
const method = event.httpMethod;
|
|
@@ -66,7 +70,7 @@ class AlbAdapter {
|
|
|
66
70
|
};
|
|
67
71
|
}
|
|
68
72
|
/**
|
|
69
|
-
* @inheritDoc
|
|
73
|
+
* {@inheritDoc}
|
|
70
74
|
*/
|
|
71
75
|
getResponse({ event, headers: responseHeaders, body, isBase64Encoded, statusCode, }) {
|
|
72
76
|
const multiValueHeaders = !event.headers
|
|
@@ -84,7 +88,7 @@ class AlbAdapter {
|
|
|
84
88
|
};
|
|
85
89
|
}
|
|
86
90
|
/**
|
|
87
|
-
* @inheritDoc
|
|
91
|
+
* {@inheritDoc}
|
|
88
92
|
*/
|
|
89
93
|
onErrorWhileForwarding({ error, delegatedResolver, respondWithErrors, event, log, }) {
|
|
90
94
|
const body = respondWithErrors ? error.stack || '' : '';
|
|
@@ -103,7 +107,7 @@ class AlbAdapter {
|
|
|
103
107
|
/**
|
|
104
108
|
* Get path from event with query strings
|
|
105
109
|
*
|
|
106
|
-
* @param event The event sent by serverless
|
|
110
|
+
* @param event - The event sent by serverless
|
|
107
111
|
*/
|
|
108
112
|
getPathFromEvent(event) {
|
|
109
113
|
var _a;
|
|
@@ -117,3 +121,4 @@ class AlbAdapter {
|
|
|
117
121
|
}
|
|
118
122
|
}
|
|
119
123
|
exports.AlbAdapter = AlbAdapter;
|
|
124
|
+
//# sourceMappingURL=alb.adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alb.adapter.js","sourceRoot":"","sources":["../../../src/adapters/aws/alb.adapter.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;AASjB,qCAMoB;AAmBpB;;;;;;;;;;;;;GAaG;AACH,MAAa,UAAU;IAGrB,qBAAqB;IAErB;;;;OAIG;IACH,YAA+B,OAA2B;QAA3B,YAAO,GAAP,OAAO,CAAoB;IAAG,CAAC;IAE9D,YAAY;IAEZ,wBAAwB;IAExB;;OAEG;IACI,cAAc;QACnB,OAAO,UAAU,CAAC,IAAI,CAA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AO,IAAA,mCAA4B,EAAC,IAAI,EAAE,WAAW,IAAI,EAAE,CAAC,CAAC;IAC/D,CAAC;CAGF;AAhJD,gCAgJC"}
|
|
@@ -3,61 +3,69 @@ import type { APIGatewayProxyEvent } from 'aws-lambda/trigger/api-gateway-proxy'
|
|
|
3
3
|
import { AdapterContract, AdapterRequest, GetResponseAdapterProps, OnErrorProps } from '../../contracts';
|
|
4
4
|
/**
|
|
5
5
|
* The options to customize the {@link ApiGatewayV1Adapter}
|
|
6
|
+
*
|
|
7
|
+
* @breadcrumb Adapters / AWS / ApiGatewayV1Adapter
|
|
8
|
+
* @public
|
|
6
9
|
*/
|
|
7
10
|
export interface ApiGatewayV1Options {
|
|
8
11
|
/**
|
|
9
12
|
* Strip base path for custom domains
|
|
10
13
|
*
|
|
11
|
-
* @
|
|
14
|
+
* @defaultValue ''
|
|
12
15
|
*/
|
|
13
16
|
stripBasePath?: string;
|
|
14
17
|
}
|
|
15
18
|
/**
|
|
16
19
|
* The adapter to handle requests from AWS Api Gateway V1
|
|
17
20
|
*
|
|
18
|
-
* As per {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-known-issues.html know issues}, we throw an exception when you send the `transfer-encoding=chunked`, currently, API Gateway doesn't support chunked transfer.
|
|
21
|
+
* As per {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-known-issues.html | know issues}, we throw an exception when you send the `transfer-encoding=chunked`, currently, API Gateway doesn't support chunked transfer.
|
|
19
22
|
*
|
|
20
|
-
* @
|
|
23
|
+
* @remarks This adapter is not fully compatible with \@vendia/serverless-express, on \@vendia they filter `transfer-encoding=chunked` but we throw an exception.
|
|
21
24
|
*
|
|
22
|
-
* @example
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
23
27
|
* const stripBasePath = '/any/custom/base/path'; // default ''
|
|
24
28
|
* const adapter = new ApiGatewayV1Adapter({ stripBasePath });
|
|
25
29
|
* ```
|
|
26
30
|
*
|
|
27
|
-
* {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html Event Reference}
|
|
31
|
+
* {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html | Event Reference}
|
|
32
|
+
*
|
|
33
|
+
* @breadcrumb Adapters / AWS / ApiGatewayV1Adapter
|
|
34
|
+
* @public
|
|
28
35
|
*/
|
|
29
36
|
export declare class ApiGatewayV1Adapter implements AdapterContract<APIGatewayProxyEvent, Context, APIGatewayProxyResult> {
|
|
30
37
|
protected readonly options?: ApiGatewayV1Options | undefined;
|
|
31
38
|
/**
|
|
32
39
|
* Default constructor
|
|
33
40
|
*
|
|
34
|
-
* @param options The options to customize the {@link ApiGatewayV1Adapter}
|
|
41
|
+
* @param options - The options to customize the {@link ApiGatewayV1Adapter}
|
|
35
42
|
*/
|
|
36
43
|
constructor(options?: ApiGatewayV1Options | undefined);
|
|
37
44
|
/**
|
|
38
|
-
* @inheritDoc
|
|
45
|
+
* {@inheritDoc}
|
|
39
46
|
*/
|
|
40
47
|
getAdapterName(): string;
|
|
41
48
|
/**
|
|
42
|
-
* @inheritDoc
|
|
49
|
+
* {@inheritDoc}
|
|
43
50
|
*/
|
|
44
51
|
canHandle(event: unknown): event is APIGatewayProxyEvent;
|
|
45
52
|
/**
|
|
46
|
-
* @inheritDoc
|
|
53
|
+
* {@inheritDoc}
|
|
47
54
|
*/
|
|
48
55
|
getRequest(event: APIGatewayProxyEvent): AdapterRequest;
|
|
49
56
|
/**
|
|
50
|
-
* @inheritDoc
|
|
57
|
+
* {@inheritDoc}
|
|
51
58
|
*/
|
|
52
59
|
getResponse({ headers: responseHeaders, body, isBase64Encoded, statusCode, response, }: GetResponseAdapterProps<APIGatewayProxyEvent>): APIGatewayProxyResult;
|
|
53
60
|
/**
|
|
54
|
-
* @inheritDoc
|
|
61
|
+
* {@inheritDoc}
|
|
55
62
|
*/
|
|
56
63
|
onErrorWhileForwarding({ error, delegatedResolver, respondWithErrors, event, log, }: OnErrorProps<APIGatewayProxyEvent, APIGatewayProxyResult>): void;
|
|
57
64
|
/**
|
|
58
65
|
* Get path from event with query strings
|
|
59
66
|
*
|
|
60
|
-
* @param event The event sent by serverless
|
|
67
|
+
* @param event - The event sent by serverless
|
|
61
68
|
*/
|
|
62
69
|
protected getPathFromEvent(event: APIGatewayProxyEvent): string;
|
|
63
70
|
}
|
|
71
|
+
//# sourceMappingURL=api-gateway-v1.adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-gateway-v1.adapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/aws/api-gateway-v1.adapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EACL,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,YAAY,EACb,MAAM,iBAAiB,CAAC;AAWzB;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,mBACX,YACE,eAAe,CAAC,oBAAoB,EAAE,OAAO,EAAE,qBAAqB,CAAC;IAS3D,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC;IALvC;;;;OAIG;gBAC4B,OAAO,CAAC,iCAAqB;IAM5D;;OAEG;IACI,cAAc,IAAI,MAAM;IAI/B;;OAEG;IACI,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,oBAAoB;IAiB/D;;OAEG;IACI,UAAU,CAAC,KAAK,EAAE,oBAAoB,GAAG,cAAc;IA4B9D;;OAEG;IACI,WAAW,CAAC,EACjB,OAAO,EAAE,eAAe,EACxB,IAAI,EACJ,eAAe,EACf,UAAU,EACV,QAAQ,GACT,EAAE,uBAAuB,CAAC,oBAAoB,CAAC,GAAG,qBAAqB;IA8BxE;;OAEG;IACI,sBAAsB,CAAC,EAC5B,KAAK,EACL,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,EACL,GAAG,GACJ,EAAE,YAAY,CAAC,oBAAoB,EAAE,qBAAqB,CAAC,GAAG,IAAI;IAkBnE;;;;OAIG;IACH,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM;CAchE"}
|
|
@@ -6,23 +6,27 @@ const core_1 = require("../../core");
|
|
|
6
6
|
/**
|
|
7
7
|
* The adapter to handle requests from AWS Api Gateway V1
|
|
8
8
|
*
|
|
9
|
-
* As per {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-known-issues.html know issues}, we throw an exception when you send the `transfer-encoding=chunked`, currently, API Gateway doesn't support chunked transfer.
|
|
9
|
+
* As per {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-known-issues.html | know issues}, we throw an exception when you send the `transfer-encoding=chunked`, currently, API Gateway doesn't support chunked transfer.
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
11
|
+
* @remarks This adapter is not fully compatible with \@vendia/serverless-express, on \@vendia they filter `transfer-encoding=chunked` but we throw an exception.
|
|
12
12
|
*
|
|
13
|
-
* @example
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
14
15
|
* const stripBasePath = '/any/custom/base/path'; // default ''
|
|
15
16
|
* const adapter = new ApiGatewayV1Adapter({ stripBasePath });
|
|
16
17
|
* ```
|
|
17
18
|
*
|
|
18
|
-
* {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html Event Reference}
|
|
19
|
+
* {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html | Event Reference}
|
|
20
|
+
*
|
|
21
|
+
* @breadcrumb Adapters / AWS / ApiGatewayV1Adapter
|
|
22
|
+
* @public
|
|
19
23
|
*/
|
|
20
24
|
class ApiGatewayV1Adapter {
|
|
21
25
|
//#region Constructor
|
|
22
26
|
/**
|
|
23
27
|
* Default constructor
|
|
24
28
|
*
|
|
25
|
-
* @param options The options to customize the {@link ApiGatewayV1Adapter}
|
|
29
|
+
* @param options - The options to customize the {@link ApiGatewayV1Adapter}
|
|
26
30
|
*/
|
|
27
31
|
constructor(options) {
|
|
28
32
|
this.options = options;
|
|
@@ -30,13 +34,13 @@ class ApiGatewayV1Adapter {
|
|
|
30
34
|
//#endregion
|
|
31
35
|
//#region Public Methods
|
|
32
36
|
/**
|
|
33
|
-
* @inheritDoc
|
|
37
|
+
* {@inheritDoc}
|
|
34
38
|
*/
|
|
35
39
|
getAdapterName() {
|
|
36
40
|
return ApiGatewayV1Adapter.name;
|
|
37
41
|
}
|
|
38
42
|
/**
|
|
39
|
-
* @inheritDoc
|
|
43
|
+
* {@inheritDoc}
|
|
40
44
|
*/
|
|
41
45
|
canHandle(event) {
|
|
42
46
|
const partialEventV1 = event;
|
|
@@ -44,17 +48,17 @@ class ApiGatewayV1Adapter {
|
|
|
44
48
|
partialEventV1.version !== '2.0' &&
|
|
45
49
|
partialEventV1.headers &&
|
|
46
50
|
partialEventV1.multiValueHeaders &&
|
|
47
|
-
(partialEventV1.queryStringParameters ===
|
|
48
|
-
partialEventV1.multiValueQueryStringParameters ||
|
|
51
|
+
((partialEventV1.queryStringParameters === null &&
|
|
52
|
+
partialEventV1.multiValueQueryStringParameters === null) ||
|
|
49
53
|
(partialEventV1.queryStringParameters &&
|
|
50
54
|
partialEventV1.multiValueQueryStringParameters)));
|
|
51
55
|
}
|
|
52
56
|
/**
|
|
53
|
-
* @inheritDoc
|
|
57
|
+
* {@inheritDoc}
|
|
54
58
|
*/
|
|
55
59
|
getRequest(event) {
|
|
56
60
|
const method = event.httpMethod;
|
|
57
|
-
const headers = event.headers;
|
|
61
|
+
const headers = (0, core_1.getFlattenedHeadersMap)(event.headers, ',', true);
|
|
58
62
|
const path = this.getPathFromEvent(event);
|
|
59
63
|
let body;
|
|
60
64
|
if (event.body) {
|
|
@@ -72,7 +76,7 @@ class ApiGatewayV1Adapter {
|
|
|
72
76
|
};
|
|
73
77
|
}
|
|
74
78
|
/**
|
|
75
|
-
* @inheritDoc
|
|
79
|
+
* {@inheritDoc}
|
|
76
80
|
*/
|
|
77
81
|
getResponse({ headers: responseHeaders, body, isBase64Encoded, statusCode, response, }) {
|
|
78
82
|
const multiValueHeaders = (0, core_1.getMultiValueHeadersMap)(responseHeaders);
|
|
@@ -93,7 +97,7 @@ class ApiGatewayV1Adapter {
|
|
|
93
97
|
};
|
|
94
98
|
}
|
|
95
99
|
/**
|
|
96
|
-
* @inheritDoc
|
|
100
|
+
* {@inheritDoc}
|
|
97
101
|
*/
|
|
98
102
|
onErrorWhileForwarding({ error, delegatedResolver, respondWithErrors, event, log, }) {
|
|
99
103
|
const body = respondWithErrors ? error.stack : '';
|
|
@@ -112,7 +116,7 @@ class ApiGatewayV1Adapter {
|
|
|
112
116
|
/**
|
|
113
117
|
* Get path from event with query strings
|
|
114
118
|
*
|
|
115
|
-
* @param event The event sent by serverless
|
|
119
|
+
* @param event - The event sent by serverless
|
|
116
120
|
*/
|
|
117
121
|
getPathFromEvent(event) {
|
|
118
122
|
var _a;
|
|
@@ -124,3 +128,4 @@ class ApiGatewayV1Adapter {
|
|
|
124
128
|
}
|
|
125
129
|
}
|
|
126
130
|
exports.ApiGatewayV1Adapter = ApiGatewayV1Adapter;
|
|
131
|
+
//# sourceMappingURL=api-gateway-v1.adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-gateway-v1.adapter.js","sourceRoot":"","sources":["../../../src/adapters/aws/api-gateway-v1.adapter.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;AAUjB,qCAMoB;AAmBpB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAa,mBAAmB;IAI9B,qBAAqB;IAErB;;;;OAIG;IACH,YAA+B,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;IAAG,CAAC;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