@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
|
@@ -4,81 +4,85 @@ import { BaseHandler, ILogger } from '../../core';
|
|
|
4
4
|
import { ServerlessResponse } from '../../network';
|
|
5
5
|
/**
|
|
6
6
|
* The class that implements a default serverless handler consisting of a function with event, context and callback parameters respectively
|
|
7
|
+
*
|
|
8
|
+
* @breadcrumb Handlers / DefaultHandler
|
|
9
|
+
* @public
|
|
7
10
|
*/
|
|
8
11
|
export declare class DefaultHandler<TApp, TEvent, TContext, TCallback, TResponse, TReturn> extends BaseHandler<TApp, TEvent, TContext, TCallback, TResponse, TReturn> {
|
|
9
12
|
/**
|
|
10
|
-
* @inheritDoc
|
|
13
|
+
* {@inheritDoc}
|
|
11
14
|
*/
|
|
12
15
|
getHandler(app: TApp, framework: FrameworkContract<TApp>, adapters: AdapterContract<TEvent, TContext, TResponse>[], resolverFactory: ResolverContract<TEvent, TContext, TCallback, TResponse, TReturn>, binarySettings: BinarySettings, respondWithErrors: boolean, log: ILogger): ServerlessHandler<TReturn>;
|
|
13
16
|
/**
|
|
14
17
|
* The hook executed on receive a request, before the request is being processed
|
|
15
18
|
*
|
|
16
|
-
* @param log The instance of logger
|
|
17
|
-
* @param event The event sent by serverless
|
|
18
|
-
* @param context The context sent by serverless
|
|
19
|
-
* @param binarySettings The binary settings
|
|
20
|
-
* @param respondWithErrors Indicates whether the error stack should be included in the response or not
|
|
19
|
+
* @param log - The instance of logger
|
|
20
|
+
* @param event - The event sent by serverless
|
|
21
|
+
* @param context - The context sent by serverless
|
|
22
|
+
* @param binarySettings - The binary settings
|
|
23
|
+
* @param respondWithErrors - Indicates whether the error stack should be included in the response or not
|
|
21
24
|
*/
|
|
22
25
|
protected onReceiveRequest(log: ILogger, event: TEvent, context: TContext, binarySettings: BinarySettings, respondWithErrors: boolean): void;
|
|
23
26
|
/**
|
|
24
27
|
* The hook executed after resolve the adapter that will be used to handle the request and response
|
|
25
28
|
*
|
|
26
|
-
* @param log The instance of logger
|
|
27
|
-
* @param adapter The adapter resolved
|
|
29
|
+
* @param log - The instance of logger
|
|
30
|
+
* @param adapter - The adapter resolved
|
|
28
31
|
*/
|
|
29
32
|
protected onResolveAdapter(log: ILogger, adapter: AdapterContract<TEvent, TContext, TResponse>): void;
|
|
30
33
|
/**
|
|
31
34
|
* The hook executed after resolves the request values that will be sent to the framework
|
|
32
35
|
*
|
|
33
|
-
* @param log The instance of logger
|
|
34
|
-
* @param requestValues The request values returned by the adapter
|
|
36
|
+
* @param log - The instance of logger
|
|
37
|
+
* @param requestValues - The request values returned by the adapter
|
|
35
38
|
*/
|
|
36
39
|
protected onResolveRequestValues(log: ILogger, requestValues: AdapterRequest): void;
|
|
37
40
|
/**
|
|
38
41
|
* The hook executed after handling the response sent by the framework
|
|
39
42
|
*
|
|
40
|
-
* @param log The instance of logger
|
|
41
|
-
* @param response The response sent by the framework
|
|
43
|
+
* @param log - The instance of logger
|
|
44
|
+
* @param response - The response sent by the framework
|
|
42
45
|
*/
|
|
43
46
|
protected onResolveForwardedResponseToFramework(log: ILogger, response: ServerlessResponse): void;
|
|
44
47
|
/**
|
|
45
48
|
* The hook executed before sending response to the serverless
|
|
46
49
|
*
|
|
47
|
-
* @param log The instance of logger
|
|
48
|
-
* @param statusCode The status code of the response
|
|
49
|
-
* @param body The body of the response
|
|
50
|
-
* @param headers The headers of the response
|
|
51
|
-
* @param isBase64Encoded Indicates whether the response was encoded as binary or not
|
|
50
|
+
* @param log - The instance of logger
|
|
51
|
+
* @param statusCode - The status code of the response
|
|
52
|
+
* @param body - The body of the response
|
|
53
|
+
* @param headers - The headers of the response
|
|
54
|
+
* @param isBase64Encoded - Indicates whether the response was encoded as binary or not
|
|
52
55
|
*/
|
|
53
56
|
protected onForwardResponse(log: ILogger, statusCode: number, body: string, headers: SingleValueHeaders, isBase64Encoded: boolean): void;
|
|
54
57
|
/**
|
|
55
58
|
* The hook executed before sending response to the serverless with response from adapter
|
|
56
59
|
*
|
|
57
|
-
* @param log The instance of logger
|
|
58
|
-
* @param successResponse The success response resolved by the adapter
|
|
59
|
-
* @param body The body of the response sent by the framework
|
|
60
|
+
* @param log - The instance of logger
|
|
61
|
+
* @param successResponse - The success response resolved by the adapter
|
|
62
|
+
* @param body - The body of the response sent by the framework
|
|
60
63
|
*/
|
|
61
64
|
protected onForwardResponseAdapterResponse(log: ILogger, successResponse: TResponse, body: string): void;
|
|
62
65
|
/**
|
|
63
66
|
* The function to forward the event to the framework
|
|
64
67
|
*
|
|
65
|
-
* @param app The instance of the app (express, hapi, etc...)
|
|
66
|
-
* @param framework The framework that will process requests
|
|
67
|
-
* @param event The event sent by serverless
|
|
68
|
-
* @param context The context sent by serverless
|
|
69
|
-
* @param adapter The adapter resolved to this event
|
|
70
|
-
* @param log The instance of logger
|
|
71
|
-
* @param binarySettings The binary settings
|
|
68
|
+
* @param app - The instance of the app (express, hapi, etc...)
|
|
69
|
+
* @param framework - The framework that will process requests
|
|
70
|
+
* @param event - The event sent by serverless
|
|
71
|
+
* @param context - The context sent by serverless
|
|
72
|
+
* @param adapter - The adapter resolved to this event
|
|
73
|
+
* @param log - The instance of logger
|
|
74
|
+
* @param binarySettings - The binary settings
|
|
72
75
|
*/
|
|
73
76
|
protected forwardRequestToFramework(app: TApp, framework: FrameworkContract<TApp>, event: TEvent, context: TContext, adapter: AdapterContract<TEvent, TContext, TResponse>, binarySettings: BinarySettings, log: ILogger): Promise<TResponse>;
|
|
74
77
|
/**
|
|
75
78
|
* The function to forward the response back to the serverless
|
|
76
79
|
*
|
|
77
|
-
* @param event The event sent by serverless
|
|
78
|
-
* @param response The response of the framework
|
|
79
|
-
* @param adapter The adapter resolved to this event
|
|
80
|
-
* @param binarySettings The binary settings
|
|
81
|
-
* @param log The instance of logger
|
|
80
|
+
* @param event - The event sent by serverless
|
|
81
|
+
* @param response - The response of the framework
|
|
82
|
+
* @param adapter - The adapter resolved to this event
|
|
83
|
+
* @param binarySettings - The binary settings
|
|
84
|
+
* @param log - The instance of logger
|
|
82
85
|
*/
|
|
83
86
|
protected forwardResponse(event: TEvent, response: ServerlessResponse, adapter: AdapterContract<TEvent, TContext, TResponse>, binarySettings: BinarySettings, log: ILogger): TResponse;
|
|
84
87
|
}
|
|
88
|
+
//# sourceMappingURL=default.handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.handler.d.ts","sourceRoot":"","sources":["../../../src/handlers/default/default.handler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,WAAW,EACX,OAAO,EAIR,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAInD;;;;;GAKG;AACH,qBAAa,cAAc,CACzB,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,CACP,SAAQ,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC;IAG1E;;OAEG;IACI,UAAU,CACf,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAClC,QAAQ,EAAE,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,EACxD,eAAe,EAAE,gBAAgB,CAC/B,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,CACR,EACD,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,OAAO,EAC1B,GAAG,EAAE,OAAO,GACX,iBAAiB,CAAC,OAAO,CAAC;IAgD7B;;;;;;;;OAQG;IACH,SAAS,CAAC,gBAAgB,C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AS,CAAC,EACrD,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,OAAO,GACX,SAAS;CA0Bb"}
|
|
@@ -20,11 +20,14 @@ const network_1 = require("../../network");
|
|
|
20
20
|
//#endregion
|
|
21
21
|
/**
|
|
22
22
|
* The class that implements a default serverless handler consisting of a function with event, context and callback parameters respectively
|
|
23
|
+
*
|
|
24
|
+
* @breadcrumb Handlers / DefaultHandler
|
|
25
|
+
* @public
|
|
23
26
|
*/
|
|
24
27
|
class DefaultHandler extends core_1.BaseHandler {
|
|
25
28
|
//#region Public Methods
|
|
26
29
|
/**
|
|
27
|
-
* @inheritDoc
|
|
30
|
+
* {@inheritDoc}
|
|
28
31
|
*/
|
|
29
32
|
getHandler(app, framework, adapters, resolverFactory, binarySettings, respondWithErrors, log) {
|
|
30
33
|
return (event, context, callback) => {
|
|
@@ -48,11 +51,11 @@ class DefaultHandler extends core_1.BaseHandler {
|
|
|
48
51
|
/**
|
|
49
52
|
* The hook executed on receive a request, before the request is being processed
|
|
50
53
|
*
|
|
51
|
-
* @param log The instance of logger
|
|
52
|
-
* @param event The event sent by serverless
|
|
53
|
-
* @param context The context sent by serverless
|
|
54
|
-
* @param binarySettings The binary settings
|
|
55
|
-
* @param respondWithErrors Indicates whether the error stack should be included in the response or not
|
|
54
|
+
* @param log - The instance of logger
|
|
55
|
+
* @param event - The event sent by serverless
|
|
56
|
+
* @param context - The context sent by serverless
|
|
57
|
+
* @param binarySettings - The binary settings
|
|
58
|
+
* @param respondWithErrors - Indicates whether the error stack should be included in the response or not
|
|
56
59
|
*/
|
|
57
60
|
onReceiveRequest(log, event, context, binarySettings, respondWithErrors) {
|
|
58
61
|
log.debug('SERVERLESS_ADAPTER:PROXY', {
|
|
@@ -65,8 +68,8 @@ class DefaultHandler extends core_1.BaseHandler {
|
|
|
65
68
|
/**
|
|
66
69
|
* The hook executed after resolve the adapter that will be used to handle the request and response
|
|
67
70
|
*
|
|
68
|
-
* @param log The instance of logger
|
|
69
|
-
* @param adapter The adapter resolved
|
|
71
|
+
* @param log - The instance of logger
|
|
72
|
+
* @param adapter - The adapter resolved
|
|
70
73
|
*/
|
|
71
74
|
onResolveAdapter(log, adapter) {
|
|
72
75
|
log.debug('SERVERLESS_ADAPTER:RESOLVED_ADAPTER_NAME: ', adapter.getAdapterName());
|
|
@@ -74,8 +77,8 @@ class DefaultHandler extends core_1.BaseHandler {
|
|
|
74
77
|
/**
|
|
75
78
|
* The hook executed after resolves the request values that will be sent to the framework
|
|
76
79
|
*
|
|
77
|
-
* @param log The instance of logger
|
|
78
|
-
* @param requestValues The request values returned by the adapter
|
|
80
|
+
* @param log - The instance of logger
|
|
81
|
+
* @param requestValues - The request values returned by the adapter
|
|
79
82
|
*/
|
|
80
83
|
onResolveRequestValues(log, requestValues) {
|
|
81
84
|
var _a;
|
|
@@ -87,8 +90,8 @@ class DefaultHandler extends core_1.BaseHandler {
|
|
|
87
90
|
/**
|
|
88
91
|
* The hook executed after handling the response sent by the framework
|
|
89
92
|
*
|
|
90
|
-
* @param log The instance of logger
|
|
91
|
-
* @param response The response sent by the framework
|
|
93
|
+
* @param log - The instance of logger
|
|
94
|
+
* @param response - The response sent by the framework
|
|
92
95
|
*/
|
|
93
96
|
onResolveForwardedResponseToFramework(log, response) {
|
|
94
97
|
log.debug('SERVERLESS_ADAPTER:FORWARD_REQUEST_TO_FRAMEWORK:RESPONSE', {
|
|
@@ -98,11 +101,11 @@ class DefaultHandler extends core_1.BaseHandler {
|
|
|
98
101
|
/**
|
|
99
102
|
* The hook executed before sending response to the serverless
|
|
100
103
|
*
|
|
101
|
-
* @param log The instance of logger
|
|
102
|
-
* @param statusCode The status code of the response
|
|
103
|
-
* @param body The body of the response
|
|
104
|
-
* @param headers The headers of the response
|
|
105
|
-
* @param isBase64Encoded Indicates whether the response was encoded as binary or not
|
|
104
|
+
* @param log - The instance of logger
|
|
105
|
+
* @param statusCode - The status code of the response
|
|
106
|
+
* @param body - The body of the response
|
|
107
|
+
* @param headers - The headers of the response
|
|
108
|
+
* @param isBase64Encoded - Indicates whether the response was encoded as binary or not
|
|
106
109
|
*/
|
|
107
110
|
onForwardResponse(log, statusCode, body, headers, isBase64Encoded) {
|
|
108
111
|
log.debug('SERVERLESS_ADAPTER:FORWARD_RESPONSE:EVENT_SOURCE_RESPONSE_PARAMS', {
|
|
@@ -115,9 +118,9 @@ class DefaultHandler extends core_1.BaseHandler {
|
|
|
115
118
|
/**
|
|
116
119
|
* The hook executed before sending response to the serverless with response from adapter
|
|
117
120
|
*
|
|
118
|
-
* @param log The instance of logger
|
|
119
|
-
* @param successResponse The success response resolved by the adapter
|
|
120
|
-
* @param body The body of the response sent by the framework
|
|
121
|
+
* @param log - The instance of logger
|
|
122
|
+
* @param successResponse - The success response resolved by the adapter
|
|
123
|
+
* @param body - The body of the response sent by the framework
|
|
121
124
|
*/
|
|
122
125
|
onForwardResponseAdapterResponse(log, successResponse, body) {
|
|
123
126
|
log.debug('SERVERLESS_ADAPTER:FORWARD_RESPONSE:EVENT_SOURCE_RESPONSE', {
|
|
@@ -130,13 +133,13 @@ class DefaultHandler extends core_1.BaseHandler {
|
|
|
130
133
|
/**
|
|
131
134
|
* The function to forward the event to the framework
|
|
132
135
|
*
|
|
133
|
-
* @param app The instance of the app (express, hapi, etc...)
|
|
134
|
-
* @param framework The framework that will process requests
|
|
135
|
-
* @param event The event sent by serverless
|
|
136
|
-
* @param context The context sent by serverless
|
|
137
|
-
* @param adapter The adapter resolved to this event
|
|
138
|
-
* @param log The instance of logger
|
|
139
|
-
* @param binarySettings The binary settings
|
|
136
|
+
* @param app - The instance of the app (express, hapi, etc...)
|
|
137
|
+
* @param framework - The framework that will process requests
|
|
138
|
+
* @param event - The event sent by serverless
|
|
139
|
+
* @param context - The context sent by serverless
|
|
140
|
+
* @param adapter - The adapter resolved to this event
|
|
141
|
+
* @param log - The instance of logger
|
|
142
|
+
* @param binarySettings - The binary settings
|
|
140
143
|
*/
|
|
141
144
|
forwardRequestToFramework(app, framework, event, context, adapter, binarySettings, log) {
|
|
142
145
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -152,11 +155,11 @@ class DefaultHandler extends core_1.BaseHandler {
|
|
|
152
155
|
/**
|
|
153
156
|
* The function to forward the response back to the serverless
|
|
154
157
|
*
|
|
155
|
-
* @param event The event sent by serverless
|
|
156
|
-
* @param response The response of the framework
|
|
157
|
-
* @param adapter The adapter resolved to this event
|
|
158
|
-
* @param binarySettings The binary settings
|
|
159
|
-
* @param log The instance of logger
|
|
158
|
+
* @param event - The event sent by serverless
|
|
159
|
+
* @param response - The response of the framework
|
|
160
|
+
* @param adapter - The adapter resolved to this event
|
|
161
|
+
* @param binarySettings - The binary settings
|
|
162
|
+
* @param log - The instance of logger
|
|
160
163
|
*/
|
|
161
164
|
forwardResponse(event, response, adapter, binarySettings, log) {
|
|
162
165
|
const statusCode = response.statusCode;
|
|
@@ -180,3 +183,4 @@ class DefaultHandler extends core_1.BaseHandler {
|
|
|
180
183
|
}
|
|
181
184
|
}
|
|
182
185
|
exports.DefaultHandler = DefaultHandler;
|
|
186
|
+
//# sourceMappingURL=default.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.handler.js","sourceRoot":"","sources":["../../../src/handlers/default/default.handler.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;;;;;;;;;;;;;AAEjB,gDAAwB;AASxB,qCAMoB;AACpB,2CAAmD;AAEnD,YAAY;AAEZ;;;;;GAKG;AACH,MAAa,cAOX,SAAQ,kBAAkE;IAC1E,wBAAwB;IAExB;;OAEG;IACI,UAAU,CACf,GAAS,EACT,SAAkC,EAClC,QAAwD,EACxD,eAMC,EACD,cAA8B,EAC9B,iBAA0B,EAC1B,GAAY;QAEZ,OAAO,CAAC,KAAa,EAAE,OAAiB,EAAE,QAAoB,EAAE,EAAE;YAChE,IAAI,CAAC,gBAAgB,CACnB,GAAG,EACH,KAAK,EACL,OAAO,EACP,cAAc,EACd,iBAAiB,CAClB,CAAC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index.d.ts","sourceRoot":"","sources":["../../../src/handlers/default/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,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];
|
|
@@ -11,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
15
|
};
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
17
|
__exportStar(require("./default.handler"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/handlers/default/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC"}
|
|
@@ -7,15 +7,21 @@ import { ILogger } from '../../core';
|
|
|
7
7
|
/**
|
|
8
8
|
* The default port that huawei will proxy the request to your framework
|
|
9
9
|
*
|
|
10
|
-
* {@link https://support.huaweicloud.com/intl/en-us/ae-ad-1-usermanual-functiongraph/functiongraph_01_1442.html#functiongraph_01_1442__li194597302096 Reference}
|
|
10
|
+
* {@link https://support.huaweicloud.com/intl/en-us/ae-ad-1-usermanual-functiongraph/functiongraph_01_1442.html#functiongraph_01_1442__li194597302096 | Reference}
|
|
11
|
+
*
|
|
12
|
+
* @breadcrumb Handlers / HttpHuaweiHandler
|
|
13
|
+
* @public
|
|
11
14
|
*/
|
|
12
15
|
export declare const DEFAULT_HUAWEI_LISTEN_PORT: number;
|
|
13
16
|
/**
|
|
14
17
|
* The options to customize {@link HttpHuaweiHandler}
|
|
18
|
+
*
|
|
19
|
+
* @breadcrumb Handlers / HttpHuaweiHandler
|
|
20
|
+
* @public
|
|
15
21
|
*/
|
|
16
22
|
export declare type HttpHuaweiHandlerOptions = {
|
|
17
23
|
/**
|
|
18
|
-
* @
|
|
24
|
+
* @defaultValue {@link DEFAULT_HUAWEI_LISTEN_PORT}
|
|
19
25
|
*/
|
|
20
26
|
port?: number;
|
|
21
27
|
/**
|
|
@@ -29,6 +35,9 @@ export declare type HttpHuaweiHandlerOptions = {
|
|
|
29
35
|
* In this Handler, you don't need to specific resolver and adapter, so you can use DummyAdapter and DummyResolver instead.
|
|
30
36
|
*
|
|
31
37
|
* @see https://support.huaweicloud.com/intl/en-us/ae-ad-1-usermanual-functiongraph/functiongraph_01_1442.html#functiongraph_01_1442__li194597302096
|
|
38
|
+
*
|
|
39
|
+
* @breadcrumb Handlers / HttpHuaweiHandler
|
|
40
|
+
* @public
|
|
32
41
|
*/
|
|
33
42
|
export declare class HttpHuaweiHandler<TApp> implements HandlerContract<TApp, void, void, void, void, Promise<void>> {
|
|
34
43
|
protected readonly options?: HttpHuaweiHandlerOptions | undefined;
|
|
@@ -37,13 +46,14 @@ export declare class HttpHuaweiHandler<TApp> implements HandlerContract<TApp, vo
|
|
|
37
46
|
*/
|
|
38
47
|
constructor(options?: HttpHuaweiHandlerOptions | undefined);
|
|
39
48
|
/**
|
|
40
|
-
* @inheritDoc
|
|
49
|
+
* {@inheritDoc}
|
|
41
50
|
*/
|
|
42
51
|
getHandler(app: TApp, framework: FrameworkContract<TApp>, _: AdapterContract<void, void, void>[], __: ResolverContract<void, void, void, void, void>, binarySettings: BinarySettings, respondWithErrors: boolean, log: ILogger): ServerlessHandler<Promise<void>>;
|
|
43
52
|
/**
|
|
44
53
|
* The method that creates the instance of http server
|
|
45
54
|
*
|
|
46
|
-
* @param requestListener O método que lidará com as requisições recebidas
|
|
55
|
+
* @param requestListener - O método que lidará com as requisições recebidas
|
|
47
56
|
*/
|
|
48
57
|
protected createHttpServer(requestListener: RequestListener): http.Server;
|
|
49
58
|
}
|
|
59
|
+
//# sourceMappingURL=http-huawei.handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-huawei.handler.d.ts","sourceRoot":"","sources":["../../../src/handlers/huawei/http-huawei.handler.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAyB,MAAM,YAAY,CAAC;AAI5D;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,EAAE,MAAa,CAAC;AAEvD;;;;;GAKG;AACH,oBAAY,wBAAwB,GAAG;IACrC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,eAAe,EAAE,eAAe,KAAK,IAAI,CAAC,MAAM,CAAC;CACvE,CAAC;AAEF;;;;;;;;;GASG;AACH,qBAAa,iBAAiB,CAAC,IAAI,CACjC,YAAW,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAO3D,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC;IAHvC;;OAEG;gBAC4B,OAAO,CAAC,sCAA0B;IAMjE;;OAEG;IACI,UAAU,CACf,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAClC,CAAC,EAAE,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,EACtC,EAAE,EAAE,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAClD,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,OAAO,EAC1B,GAAG,EAAE,OAAO,GACX,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAmCnC;;;;OAIG;IACH,SAAS,CAAC,gBAAgB,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC,MAAM;CAK1E"}
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
//#region Imports
|
|
3
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
4
|
if (k2 === undefined) k2 = k;
|
|
5
|
-
Object.
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
6
10
|
}) : (function(o, m, k, k2) {
|
|
7
11
|
if (k2 === undefined) k2 = k;
|
|
8
12
|
o[k2] = m[k];
|
|
@@ -27,7 +31,10 @@ const core_1 = require("../../core");
|
|
|
27
31
|
/**
|
|
28
32
|
* The default port that huawei will proxy the request to your framework
|
|
29
33
|
*
|
|
30
|
-
* {@link https://support.huaweicloud.com/intl/en-us/ae-ad-1-usermanual-functiongraph/functiongraph_01_1442.html#functiongraph_01_1442__li194597302096 Reference}
|
|
34
|
+
* {@link https://support.huaweicloud.com/intl/en-us/ae-ad-1-usermanual-functiongraph/functiongraph_01_1442.html#functiongraph_01_1442__li194597302096 | Reference}
|
|
35
|
+
*
|
|
36
|
+
* @breadcrumb Handlers / HttpHuaweiHandler
|
|
37
|
+
* @public
|
|
31
38
|
*/
|
|
32
39
|
exports.DEFAULT_HUAWEI_LISTEN_PORT = 8000;
|
|
33
40
|
/**
|
|
@@ -36,6 +43,9 @@ exports.DEFAULT_HUAWEI_LISTEN_PORT = 8000;
|
|
|
36
43
|
* In this Handler, you don't need to specific resolver and adapter, so you can use DummyAdapter and DummyResolver instead.
|
|
37
44
|
*
|
|
38
45
|
* @see https://support.huaweicloud.com/intl/en-us/ae-ad-1-usermanual-functiongraph/functiongraph_01_1442.html#functiongraph_01_1442__li194597302096
|
|
46
|
+
*
|
|
47
|
+
* @breadcrumb Handlers / HttpHuaweiHandler
|
|
48
|
+
* @public
|
|
39
49
|
*/
|
|
40
50
|
class HttpHuaweiHandler {
|
|
41
51
|
//#region Constructor
|
|
@@ -48,7 +58,7 @@ class HttpHuaweiHandler {
|
|
|
48
58
|
//#endregion
|
|
49
59
|
//#region Public Methods
|
|
50
60
|
/**
|
|
51
|
-
* @inheritDoc
|
|
61
|
+
* {@inheritDoc}
|
|
52
62
|
*/
|
|
53
63
|
getHandler(app, framework, _, __, binarySettings, respondWithErrors, log) {
|
|
54
64
|
var _a, _b;
|
|
@@ -73,10 +83,11 @@ class HttpHuaweiHandler {
|
|
|
73
83
|
/**
|
|
74
84
|
* The method that creates the instance of http server
|
|
75
85
|
*
|
|
76
|
-
* @param requestListener O método que lidará com as requisições recebidas
|
|
86
|
+
* @param requestListener - O método que lidará com as requisições recebidas
|
|
77
87
|
*/
|
|
78
88
|
createHttpServer(requestListener) {
|
|
79
89
|
return http.createServer(requestListener);
|
|
80
90
|
}
|
|
81
91
|
}
|
|
82
92
|
exports.HttpHuaweiHandler = HttpHuaweiHandler;
|
|
93
|
+
//# sourceMappingURL=http-huawei.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-huawei.handler.js","sourceRoot":"","sources":["../../../src/handlers/huawei/http-huawei.handler.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;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CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACvD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;IAED,YAAY;IAEZ,2BAA2B;IAE3B;;;;OAIG;IACO,gBAAgB,CAAC,eAAgC;QACzD,OAAO,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IAC5C,CAAC;CAGF;AAtED,8CAsEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/handlers/huawei/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,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];
|
|
@@ -11,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
15
|
};
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
17
|
__exportStar(require("./http-huawei.handler"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/handlers/huawei/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC"}
|
package/lib/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];
|
|
@@ -15,3 +19,4 @@ __exportStar(require("./contracts"), exports);
|
|
|
15
19
|
__exportStar(require("./core"), exports);
|
|
16
20
|
__exportStar(require("./network"), exports);
|
|
17
21
|
__exportStar(require("./serverless-adapter"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,8CAA4B;AAC5B,yCAAuB;AACvB,4CAA0B;AAC1B,uDAAqC"}
|
package/lib/network/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/network/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
package/lib/network/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,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
17
|
__exportStar(require("./request"), exports);
|
|
14
18
|
__exportStar(require("./response"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/network/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B"}
|
package/lib/network/request.d.ts
CHANGED
|
@@ -1,15 +1,43 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { IncomingMessage } from 'http';
|
|
3
3
|
import { SingleValueHeaders } from '../@types';
|
|
4
|
+
/**
|
|
5
|
+
* The properties to create a {@link ServerlessRequest}
|
|
6
|
+
*
|
|
7
|
+
* @breadcrumb Network / ServerlessRequest
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
4
10
|
export interface ServerlessRequestProps {
|
|
11
|
+
/**
|
|
12
|
+
* The HTTP Method of the request
|
|
13
|
+
*/
|
|
5
14
|
method: string;
|
|
15
|
+
/**
|
|
16
|
+
* The URL requested
|
|
17
|
+
*/
|
|
6
18
|
url: string;
|
|
19
|
+
/**
|
|
20
|
+
* The headers from the event source
|
|
21
|
+
*/
|
|
7
22
|
headers: SingleValueHeaders;
|
|
23
|
+
/**
|
|
24
|
+
* The body from the event source
|
|
25
|
+
*/
|
|
8
26
|
body?: Buffer;
|
|
27
|
+
/**
|
|
28
|
+
* The IP Address from caller
|
|
29
|
+
*/
|
|
9
30
|
remoteAddress?: string;
|
|
10
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* The class that represents an {@link http#IncomingMessage} created by the library to represent an actual request to the framework.
|
|
34
|
+
*
|
|
35
|
+
* @breadcrumb Network / ServerlessRequest
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
11
38
|
export declare class ServerlessRequest extends IncomingMessage {
|
|
12
39
|
constructor({ method, url, headers, body, remoteAddress, }: ServerlessRequestProps);
|
|
13
40
|
ip?: string;
|
|
14
41
|
body?: Buffer;
|
|
15
42
|
}
|
|
43
|
+
//# sourceMappingURL=request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/network/request.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAEvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAK/C;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,OAAO,EAAE,kBAAkB,CAAC;IAE5B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,eAAe;gBACxC,EACV,MAAM,EACN,GAAG,EACH,OAAO,EACP,IAAI,EACJ,aAAa,GACd,EAAE,sBAAsB;IA4BzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
package/lib/network/request.js
CHANGED
|
@@ -5,6 +5,12 @@ exports.ServerlessRequest = void 0;
|
|
|
5
5
|
const http_1 = require("http");
|
|
6
6
|
const core_1 = require("../core");
|
|
7
7
|
const HTTPS_PORT = 443;
|
|
8
|
+
/**
|
|
9
|
+
* The class that represents an {@link http#IncomingMessage} created by the library to represent an actual request to the framework.
|
|
10
|
+
*
|
|
11
|
+
* @breadcrumb Network / ServerlessRequest
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
8
14
|
class ServerlessRequest extends http_1.IncomingMessage {
|
|
9
15
|
constructor({ method, url, headers, body, remoteAddress, }) {
|
|
10
16
|
super({
|
|
@@ -33,3 +39,4 @@ class ServerlessRequest extends http_1.IncomingMessage {
|
|
|
33
39
|
}
|
|
34
40
|
}
|
|
35
41
|
exports.ServerlessRequest = ServerlessRequest;
|
|
42
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/network/request.ts"],"names":[],"mappings":";;;AAAA,8DAA8D;AAC9D,+BAAuC;AAGvC,kCAAgC;AAEhC,MAAM,UAAU,GAAG,GAAG,CAAC;AAmCvB;;;;;GAKG;AACH,MAAa,iBAAkB,SAAQ,sBAAe;IACpD,YAAY,EACV,MAAM,EACN,GAAG,EACH,OAAO,EACP,IAAI,EACJ,aAAa,GACU;QACvB,KAAK,CAAC;YACJ,SAAS,EAAE,IAAI;YACf,QAAQ,EAAE,KAAK;YACf,aAAa;YACb,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAkB,CAAA;YACpD,GAAG,EAAE,YAAK;YACV,OAAO,EAAE,YAAK;SACR,CAAC,CAAC;QAEV,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;QACtB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,EAAE,GAAG,aAAa,CAAC;QAExB,IAAI,CAAC,KAAK,GAAG,GAAG,EAAE;YAChB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAChB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC,CAAC;IACJ,CAAC;CAIF;AArCD,8CAqCC"}
|
|
@@ -2,9 +2,25 @@
|
|
|
2
2
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
3
3
|
declare const BODY: unique symbol;
|
|
4
4
|
declare const HEADERS: unique symbol;
|
|
5
|
+
/**
|
|
6
|
+
* The properties to create a {@link ServerlessResponse}.
|
|
7
|
+
*
|
|
8
|
+
* @breadcrumb Network / ServerlessResponse
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
5
11
|
export interface ServerlessResponseProps {
|
|
12
|
+
/**
|
|
13
|
+
* The HTTP Method from request
|
|
14
|
+
*/
|
|
6
15
|
method?: string;
|
|
7
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* The class that represents a response instance used to send to the framework and wait until the framework finishes processing the request.
|
|
19
|
+
* Once it's happens, we use the properties from this response to built the response to the cloud.
|
|
20
|
+
*
|
|
21
|
+
* @breadcrumb Network / ServerlessResponse
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
8
24
|
export declare class ServerlessResponse extends ServerResponse {
|
|
9
25
|
constructor({ method }: ServerlessResponseProps);
|
|
10
26
|
_header: string;
|
|
@@ -20,7 +36,7 @@ export declare class ServerlessResponse extends ServerResponse {
|
|
|
20
36
|
writeHead(statusCode: number, statusMessage?: string | any | any[], obj?: any | any[]): any;
|
|
21
37
|
/**
|
|
22
38
|
* I use ignore here because in nodejs 12.x, statusMessage can be string | OutgoingHttpHeaders
|
|
23
|
-
* But in nodejs
|
|
39
|
+
* But in nodejs \>=14.x, statusMessage can also be OutgoingHttpHeaders[]
|
|
24
40
|
* I take care of these cases above, but here I can't handle it well, so I give up
|
|
25
41
|
* nodejs 12.x ref: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v12/http.d.ts#L229
|
|
26
42
|
* nodejs 14.x ref: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v14/http.d.ts#L263
|
|
@@ -28,3 +44,4 @@ export declare class ServerlessResponse extends ServerResponse {
|
|
|
28
44
|
protected callNativeWriteHead(statusCode: number, statusMessage?: string | any | any[], obj?: any | any[]): this;
|
|
29
45
|
}
|
|
30
46
|
export {};
|
|
47
|
+
//# sourceMappingURL=response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/network/response.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAMvD,QAAA,MAAM,IAAI,eAA0B,CAAC;AACrC,QAAA,MAAM,OAAO,eAA6B,CAAC;AAc3C;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,qBAAa,kBAAmB,SAAQ,cAAc;gBACxC,EAAE,MAAM,EAAE,EAAE,uBAAuB;IAiD/C,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC5B,YAAY,CAAC,E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