@h4ad/serverless-adapter 2.17.0 → 3.0.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 +7 -0
- package/lib/@types/binary-settings.js +2 -11
- package/lib/@types/binary-settings.js.map +1 -1
- package/lib/@types/digital-ocean/digital-ocean-http-event.js +2 -7
- package/lib/@types/digital-ocean/digital-ocean-http-event.js.map +1 -1
- package/lib/@types/digital-ocean/digital-ocean-http-response.js +2 -7
- package/lib/@types/digital-ocean/digital-ocean-http-response.js.map +1 -1
- package/lib/@types/digital-ocean/index.js +2 -18
- package/lib/@types/digital-ocean/index.js.map +1 -1
- package/lib/@types/headers.js +2 -11
- package/lib/@types/headers.js.map +1 -1
- package/lib/@types/helpers.js +2 -6
- package/lib/@types/helpers.js.map +1 -1
- package/lib/@types/huawei/huawei-api-gateway-event.js +2 -14
- package/lib/@types/huawei/huawei-api-gateway-event.js.map +1 -1
- package/lib/@types/huawei/huawei-api-gateway-response.js +2 -7
- package/lib/@types/huawei/huawei-api-gateway-response.js.map +1 -1
- package/lib/@types/huawei/huawei-context.js +2 -36
- package/lib/@types/huawei/huawei-context.js.map +1 -1
- package/lib/@types/huawei/index.js +2 -20
- package/lib/@types/huawei/index.js.map +1 -1
- package/lib/@types/index.js +2 -20
- package/lib/@types/index.js.map +1 -1
- package/lib/adapters/apollo-server/apollo-server-mutation.adapter.js +2 -86
- package/lib/adapters/apollo-server/apollo-server-mutation.adapter.js.map +1 -1
- package/lib/adapters/apollo-server/index.js +2 -18
- package/lib/adapters/apollo-server/index.js.map +1 -1
- package/lib/adapters/aws/alb.adapter.js +2 -129
- package/lib/adapters/aws/alb.adapter.js.map +1 -1
- package/lib/adapters/aws/api-gateway-v1.adapter.js +2 -140
- package/lib/adapters/aws/api-gateway-v1.adapter.js.map +1 -1
- package/lib/adapters/aws/api-gateway-v2.adapter.js +2 -134
- package/lib/adapters/aws/api-gateway-v2.adapter.js.map +1 -1
- package/lib/adapters/aws/base/aws-simple-adapter.js +2 -99
- package/lib/adapters/aws/base/aws-simple-adapter.js.map +1 -1
- package/lib/adapters/aws/base/index.js +2 -18
- package/lib/adapters/aws/base/index.js.map +1 -1
- package/lib/adapters/aws/dynamodb.adapter.js +2 -64
- package/lib/adapters/aws/dynamodb.adapter.js.map +1 -1
- package/lib/adapters/aws/event-bridge.adapter.js +2 -75
- package/lib/adapters/aws/event-bridge.adapter.js.map +1 -1
- package/lib/adapters/aws/index.js +2 -27
- package/lib/adapters/aws/index.js.map +1 -1
- package/lib/adapters/aws/lambda-edge.adapter.js +2 -284
- package/lib/adapters/aws/lambda-edge.adapter.js.map +1 -1
- package/lib/adapters/aws/s3.adapter.js +2 -63
- package/lib/adapters/aws/s3.adapter.js.map +1 -1
- package/lib/adapters/aws/sns.adapter.js +2 -63
- package/lib/adapters/aws/sns.adapter.js.map +1 -1
- package/lib/adapters/aws/sqs.adapter.js +2 -64
- package/lib/adapters/aws/sqs.adapter.js.map +1 -1
- package/lib/adapters/azure/http-trigger-v4.adapter.js +2 -202
- package/lib/adapters/azure/http-trigger-v4.adapter.js.map +1 -1
- package/lib/adapters/azure/index.js +2 -18
- package/lib/adapters/azure/index.js.map +1 -1
- package/lib/adapters/digital-ocean/http-function.adapter.js +2 -118
- package/lib/adapters/digital-ocean/http-function.adapter.js.map +1 -1
- package/lib/adapters/digital-ocean/index.js +2 -18
- package/lib/adapters/digital-ocean/index.js.map +1 -1
- package/lib/adapters/dummy/dummy.adapter.js +2 -54
- package/lib/adapters/dummy/dummy.adapter.js.map +1 -1
- package/lib/adapters/dummy/index.js +2 -18
- package/lib/adapters/dummy/index.js.map +1 -1
- package/lib/adapters/huawei/huawei-api-gateway.adapter.js +2 -126
- package/lib/adapters/huawei/huawei-api-gateway.adapter.js.map +1 -1
- package/lib/adapters/huawei/index.js +2 -18
- package/lib/adapters/huawei/index.js.map +1 -1
- package/lib/contracts/adapter.contract.js +2 -18
- package/lib/contracts/adapter.contract.js.map +1 -1
- package/lib/contracts/framework.contract.js +2 -7
- package/lib/contracts/framework.contract.js.map +1 -1
- package/lib/contracts/handler.contract.js +2 -13
- package/lib/contracts/handler.contract.js.map +1 -1
- package/lib/contracts/index.js +2 -21
- package/lib/contracts/index.js.map +1 -1
- package/lib/contracts/resolver.contract.js +2 -15
- package/lib/contracts/resolver.contract.js.map +1 -1
- package/lib/core/base-handler.js +2 -67
- package/lib/core/base-handler.js.map +1 -1
- package/lib/core/constants.js +2 -33
- package/lib/core/constants.js.map +1 -1
- package/lib/core/current-invoke.js +2 -46
- package/lib/core/current-invoke.js.map +1 -1
- package/lib/core/event-body.js +2 -31
- package/lib/core/event-body.js.map +1 -1
- package/lib/core/headers.js +3 -97
- package/lib/core/headers.js.map +1 -1
- package/lib/core/index.js +2 -28
- package/lib/core/index.js.map +1 -1
- package/lib/core/is-binary.js +2 -118
- package/lib/core/is-binary.js.map +1 -1
- package/lib/core/logger.js +2 -115
- package/lib/core/logger.js.map +1 -1
- package/lib/core/no-op.js +2 -12
- package/lib/core/no-op.js.map +1 -1
- package/lib/core/optional.js +2 -31
- package/lib/core/optional.js.map +1 -1
- package/lib/core/path.js +2 -68
- package/lib/core/path.js.map +1 -1
- package/lib/core/stream.js +2 -63
- package/lib/core/stream.js.map +1 -1
- package/lib/frameworks/apollo-server/apollo-server.framework.js +2 -87
- package/lib/frameworks/apollo-server/apollo-server.framework.js.map +1 -1
- package/lib/frameworks/apollo-server/index.js +2 -18
- package/lib/frameworks/apollo-server/index.js.map +1 -1
- package/lib/frameworks/body-parser/base-body-parser.framework.js +2 -66
- package/lib/frameworks/body-parser/base-body-parser.framework.js.map +1 -1
- package/lib/frameworks/body-parser/index.js +2 -22
- package/lib/frameworks/body-parser/index.js.map +1 -1
- package/lib/frameworks/body-parser/json-body-parser.framework.js +2 -29
- package/lib/frameworks/body-parser/json-body-parser.framework.js.map +1 -1
- package/lib/frameworks/body-parser/raw-body-parser.framework.js +2 -29
- package/lib/frameworks/body-parser/raw-body-parser.framework.js.map +1 -1
- package/lib/frameworks/body-parser/text-body-parser.framework.js +2 -29
- package/lib/frameworks/body-parser/text-body-parser.framework.js.map +1 -1
- package/lib/frameworks/body-parser/urlencoded-body-parser.framework.js +2 -29
- package/lib/frameworks/body-parser/urlencoded-body-parser.framework.js.map +1 -1
- package/lib/frameworks/cors/cors.framework.js +3 -145
- package/lib/frameworks/cors/cors.framework.js.map +1 -1
- package/lib/frameworks/cors/index.js +2 -18
- package/lib/frameworks/cors/index.js.map +1 -1
- package/lib/frameworks/deepkit/http-deepkit.framework.js +2 -33
- package/lib/frameworks/deepkit/http-deepkit.framework.js.map +1 -1
- package/lib/frameworks/deepkit/index.js +2 -18
- package/lib/frameworks/deepkit/index.js.map +1 -1
- package/lib/frameworks/express/express.framework.js +2 -22
- package/lib/frameworks/express/express.framework.js.map +1 -1
- package/lib/frameworks/express/index.js +2 -18
- package/lib/frameworks/express/index.js.map +1 -1
- package/lib/frameworks/fastify/fastify.framework.js +2 -23
- package/lib/frameworks/fastify/fastify.framework.js.map +1 -1
- package/lib/frameworks/fastify/helpers/no-op-content-parser.js +2 -27
- package/lib/frameworks/fastify/helpers/no-op-content-parser.js.map +1 -1
- package/lib/frameworks/fastify/index.js +2 -18
- package/lib/frameworks/fastify/index.js.map +1 -1
- package/lib/frameworks/hapi/hapi.framework.js +2 -23
- package/lib/frameworks/hapi/hapi.framework.js.map +1 -1
- package/lib/frameworks/hapi/index.js +2 -18
- package/lib/frameworks/hapi/index.js.map +1 -1
- package/lib/frameworks/koa/index.js +2 -18
- package/lib/frameworks/koa/index.js.map +1 -1
- package/lib/frameworks/koa/koa.framework.js +2 -22
- package/lib/frameworks/koa/koa.framework.js.map +1 -1
- package/lib/frameworks/lazy/index.js +2 -18
- package/lib/frameworks/lazy/index.js.map +1 -1
- package/lib/frameworks/lazy/lazy.framework.js +2 -82
- package/lib/frameworks/lazy/lazy.framework.js.map +1 -1
- package/lib/frameworks/trpc/index.js +2 -18
- package/lib/frameworks/trpc/index.js.map +1 -1
- package/lib/frameworks/trpc/trpc.framework.js +2 -153
- package/lib/frameworks/trpc/trpc.framework.js.map +1 -1
- package/lib/handlers/aws/aws-stream.handler.js +2 -169
- package/lib/handlers/aws/aws-stream.handler.js.map +1 -1
- package/lib/handlers/aws/index.js +2 -18
- package/lib/handlers/aws/index.js.map +1 -1
- package/lib/handlers/azure/azure.handler.js +2 -74
- package/lib/handlers/azure/azure.handler.js.map +1 -1
- package/lib/handlers/azure/index.js +2 -18
- package/lib/handlers/azure/index.js.map +1 -1
- package/lib/handlers/base/index.js +2 -18
- package/lib/handlers/base/index.js.map +1 -1
- package/lib/handlers/base/raw-request.js +2 -65
- package/lib/handlers/base/raw-request.js.map +1 -1
- package/lib/handlers/default/default.handler.js +2 -191
- package/lib/handlers/default/default.handler.js.map +1 -1
- package/lib/handlers/default/index.js +2 -18
- package/lib/handlers/default/index.js.map +1 -1
- package/lib/handlers/digital-ocean/digital-ocean.handler.js +2 -34
- package/lib/handlers/digital-ocean/digital-ocean.handler.js.map +1 -1
- package/lib/handlers/digital-ocean/index.js +2 -18
- package/lib/handlers/digital-ocean/index.js.map +1 -1
- package/lib/handlers/firebase/http-firebase-v2.handler.js +2 -50
- package/lib/handlers/firebase/http-firebase-v2.handler.js.map +1 -1
- package/lib/handlers/firebase/http-firebase.handler.js +2 -27
- package/lib/handlers/firebase/http-firebase.handler.js.map +1 -1
- package/lib/handlers/firebase/index.js +2 -19
- package/lib/handlers/firebase/index.js.map +1 -1
- package/lib/handlers/gcp/gcp.handler.js +2 -40
- package/lib/handlers/gcp/gcp.handler.js.map +1 -1
- package/lib/handlers/gcp/index.js +2 -18
- package/lib/handlers/gcp/index.js.map +1 -1
- package/lib/handlers/huawei/http-huawei.handler.js +2 -106
- package/lib/handlers/huawei/http-huawei.handler.js.map +1 -1
- package/lib/handlers/huawei/index.js +2 -18
- package/lib/handlers/huawei/index.js.map +1 -1
- package/lib/index.doc.js +2 -0
- package/lib/index.doc.js.map +1 -0
- package/lib/index.js +2 -22
- package/lib/index.js.map +1 -1
- package/lib/network/index.js +2 -21
- package/lib/network/index.js.map +1 -1
- package/lib/network/request.js +2 -46
- package/lib/network/request.js.map +1 -1
- package/lib/network/response-stream.js +7 -88
- package/lib/network/response-stream.js.map +1 -1
- package/lib/network/response.js +4 -127
- package/lib/network/response.js.map +1 -1
- package/lib/network/utils.js +2 -21
- package/lib/network/utils.js.map +1 -1
- package/lib/resolvers/aws-context/aws-context.resolver.js +2 -59
- package/lib/resolvers/aws-context/aws-context.resolver.js.map +1 -1
- package/lib/resolvers/aws-context/index.js +2 -18
- package/lib/resolvers/aws-context/index.js.map +1 -1
- package/lib/resolvers/callback/callback.resolver.js +2 -53
- package/lib/resolvers/callback/callback.resolver.js.map +1 -1
- package/lib/resolvers/callback/index.js +2 -18
- package/lib/resolvers/callback/index.js.map +1 -1
- package/lib/resolvers/dummy/dummy.resolver.js +2 -24
- package/lib/resolvers/dummy/dummy.resolver.js.map +1 -1
- package/lib/resolvers/dummy/index.js +2 -18
- package/lib/resolvers/dummy/index.js.map +1 -1
- package/lib/resolvers/promise/index.js +2 -18
- package/lib/resolvers/promise/index.js.map +1 -1
- package/lib/resolvers/promise/promise.resolver.js +2 -48
- package/lib/resolvers/promise/promise.resolver.js.map +1 -1
- package/lib/serverless-adapter.js +2 -176
- package/lib/serverless-adapter.js.map +1 -1
- package/package.json +61 -79
- package/lib/@types/binary-settings.d.ts +0 -43
- package/lib/@types/digital-ocean/digital-ocean-http-event.d.ts +0 -37
- package/lib/@types/digital-ocean/digital-ocean-http-response.d.ts +0 -22
- package/lib/@types/digital-ocean/index.d.ts +0 -1
- package/lib/@types/headers.d.ts +0 -39
- package/lib/@types/helpers.d.ts +0 -10
- package/lib/@types/huawei/huawei-api-gateway-event.d.ts +0 -84
- package/lib/@types/huawei/huawei-api-gateway-response.d.ts +0 -27
- package/lib/@types/huawei/huawei-context.d.ts +0 -203
- package/lib/@types/huawei/index.d.ts +0 -3
- package/lib/@types/index.d.ts +0 -3
- package/lib/adapters/apollo-server/apollo-server-mutation.adapter.d.ts +0 -56
- package/lib/adapters/apollo-server/index.d.ts +0 -1
- package/lib/adapters/aws/alb.adapter.d.ts +0 -66
- package/lib/adapters/aws/api-gateway-v1.adapter.d.ts +0 -71
- package/lib/adapters/aws/api-gateway-v2.adapter.d.ts +0 -70
- package/lib/adapters/aws/base/aws-simple-adapter.d.ts +0 -85
- package/lib/adapters/aws/base/index.d.ts +0 -1
- package/lib/adapters/aws/dynamodb.adapter.d.ts +0 -56
- package/lib/adapters/aws/event-bridge.adapter.d.ts +0 -64
- package/lib/adapters/aws/index.d.ts +0 -10
- package/lib/adapters/aws/lambda-edge.adapter.d.ts +0 -213
- package/lib/adapters/aws/s3.adapter.d.ts +0 -56
- package/lib/adapters/aws/sns.adapter.d.ts +0 -56
- package/lib/adapters/aws/sqs.adapter.d.ts +0 -56
- package/lib/adapters/azure/http-trigger-v4.adapter.d.ts +0 -81
- package/lib/adapters/azure/index.d.ts +0 -1
- package/lib/adapters/digital-ocean/http-function.adapter.d.ts +0 -65
- package/lib/adapters/digital-ocean/index.d.ts +0 -1
- package/lib/adapters/dummy/dummy.adapter.d.ts +0 -30
- package/lib/adapters/dummy/index.d.ts +0 -1
- package/lib/adapters/huawei/huawei-api-gateway.adapter.d.ts +0 -66
- package/lib/adapters/huawei/index.d.ts +0 -1
- package/lib/contracts/adapter.contract.d.ts +0 -155
- package/lib/contracts/framework.contract.d.ts +0 -19
- package/lib/contracts/handler.contract.d.ts +0 -26
- package/lib/contracts/index.d.ts +0 -4
- package/lib/contracts/resolver.contract.d.ts +0 -86
- package/lib/core/base-handler.d.ts +0 -31
- package/lib/core/constants.d.ts +0 -31
- package/lib/core/current-invoke.d.ts +0 -48
- package/lib/core/event-body.d.ts +0 -21
- package/lib/core/headers.d.ts +0 -47
- package/lib/core/index.d.ts +0 -11
- package/lib/core/is-binary.d.ts +0 -72
- package/lib/core/logger.d.ts +0 -67
- package/lib/core/no-op.d.ts +0 -7
- package/lib/core/optional.d.ts +0 -21
- package/lib/core/path.d.ts +0 -36
- package/lib/core/stream.d.ts +0 -20
- package/lib/frameworks/apollo-server/apollo-server.framework.d.ts +0 -71
- package/lib/frameworks/apollo-server/index.d.ts +0 -1
- package/lib/frameworks/body-parser/base-body-parser.framework.d.ts +0 -69
- package/lib/frameworks/body-parser/index.d.ts +0 -5
- package/lib/frameworks/body-parser/json-body-parser.framework.d.ts +0 -26
- package/lib/frameworks/body-parser/raw-body-parser.framework.d.ts +0 -26
- package/lib/frameworks/body-parser/text-body-parser.framework.d.ts +0 -26
- package/lib/frameworks/body-parser/urlencoded-body-parser.framework.d.ts +0 -26
- package/lib/frameworks/cors/cors.framework.d.ts +0 -78
- package/lib/frameworks/cors/index.d.ts +0 -1
- package/lib/frameworks/deepkit/http-deepkit.framework.d.ts +0 -17
- package/lib/frameworks/deepkit/index.d.ts +0 -1
- package/lib/frameworks/express/express.framework.d.ts +0 -16
- package/lib/frameworks/express/index.d.ts +0 -1
- package/lib/frameworks/fastify/fastify.framework.d.ts +0 -16
- package/lib/frameworks/fastify/helpers/no-op-content-parser.d.ts +0 -13
- package/lib/frameworks/fastify/index.d.ts +0 -1
- package/lib/frameworks/hapi/hapi.framework.d.ts +0 -16
- package/lib/frameworks/hapi/index.d.ts +0 -1
- package/lib/frameworks/koa/index.d.ts +0 -1
- package/lib/frameworks/koa/koa.framework.d.ts +0 -16
- package/lib/frameworks/lazy/index.d.ts +0 -1
- package/lib/frameworks/lazy/lazy.framework.d.ts +0 -55
- package/lib/frameworks/trpc/index.d.ts +0 -1
- package/lib/frameworks/trpc/trpc.framework.d.ts +0 -155
- package/lib/handlers/aws/aws-stream.handler.d.ts +0 -83
- package/lib/handlers/aws/index.d.ts +0 -1
- package/lib/handlers/azure/azure.handler.d.ts +0 -45
- package/lib/handlers/azure/index.d.ts +0 -1
- package/lib/handlers/base/index.d.ts +0 -1
- package/lib/handlers/base/raw-request.d.ts +0 -30
- package/lib/handlers/default/default.handler.d.ts +0 -87
- package/lib/handlers/default/index.d.ts +0 -1
- package/lib/handlers/digital-ocean/digital-ocean.handler.d.ts +0 -16
- package/lib/handlers/digital-ocean/index.d.ts +0 -1
- package/lib/handlers/firebase/http-firebase-v2.handler.d.ts +0 -26
- package/lib/handlers/firebase/http-firebase.handler.d.ts +0 -18
- package/lib/handlers/firebase/index.d.ts +0 -2
- package/lib/handlers/gcp/gcp.handler.d.ts +0 -25
- package/lib/handlers/gcp/index.d.ts +0 -1
- package/lib/handlers/huawei/http-huawei.handler.d.ts +0 -59
- package/lib/handlers/huawei/index.d.ts +0 -1
- package/lib/index.d.ts +0 -5
- package/lib/network/index.d.ts +0 -4
- package/lib/network/request.d.ts +0 -44
- package/lib/network/response-stream.d.ts +0 -41
- package/lib/network/response.d.ts +0 -48
- package/lib/network/utils.d.ts +0 -7
- package/lib/resolvers/aws-context/aws-context.resolver.d.ts +0 -18
- package/lib/resolvers/aws-context/index.d.ts +0 -1
- package/lib/resolvers/callback/callback.resolver.d.ts +0 -23
- package/lib/resolvers/callback/index.d.ts +0 -1
- package/lib/resolvers/dummy/dummy.resolver.d.ts +0 -13
- package/lib/resolvers/dummy/index.d.ts +0 -1
- package/lib/resolvers/promise/index.d.ts +0 -1
- package/lib/resolvers/promise/promise.resolver.d.ts +0 -13
- package/lib/serverless-adapter.d.ts +0 -118
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IncomingMessage, ServerResponse } from 'http';
|
|
3
|
-
import { FrameworkContract } from '../../contracts';
|
|
4
|
-
import { ILogger } from '../../core';
|
|
5
|
-
/**
|
|
6
|
-
* The framework that asynchronously instantiates your application and forwards the request to the framework as quickly as possible.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```typescript
|
|
10
|
-
* import express from 'express';
|
|
11
|
-
* import { ServerlessAdapter } from '@h4ad/serverless-adapter';
|
|
12
|
-
* import { ExpressFramework } from '@h4ad/serverless-adapter/lib/frameworks/express';
|
|
13
|
-
* import { LazyFramework } from '@h4ad/serverless-adapter/lib/frameworks/lazy';
|
|
14
|
-
*
|
|
15
|
-
* const expressFramework = new ExpressFramework();
|
|
16
|
-
* const factory = async () => {
|
|
17
|
-
* const app = express();
|
|
18
|
-
*
|
|
19
|
-
* // do some asynchronous stuffs like create the database;
|
|
20
|
-
* await new Promise(resolve => setTimeout(resolve, 100);
|
|
21
|
-
*
|
|
22
|
-
* return app;
|
|
23
|
-
* };
|
|
24
|
-
* const framework = new LazyFramework(expressFramework, factory);
|
|
25
|
-
*
|
|
26
|
-
* export const handler = ServerlessAdapter.new(null)
|
|
27
|
-
* .setFramework(framework)
|
|
28
|
-
* // set other configurations and then build
|
|
29
|
-
* .build();
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* @breadcrumb Frameworks / LazyFramework
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
export declare class LazyFramework<TApp> implements FrameworkContract<null> {
|
|
36
|
-
protected readonly framework: FrameworkContract<TApp>;
|
|
37
|
-
protected readonly factory: () => Promise<TApp>;
|
|
38
|
-
protected readonly logger: ILogger;
|
|
39
|
-
/**
|
|
40
|
-
* Default Constructor
|
|
41
|
-
*/
|
|
42
|
-
constructor(framework: FrameworkContract<TApp>, factory: () => Promise<TApp>, logger?: ILogger);
|
|
43
|
-
/**
|
|
44
|
-
* The cached version of the app
|
|
45
|
-
*/
|
|
46
|
-
protected cachedApp?: TApp;
|
|
47
|
-
/**
|
|
48
|
-
* The delayed factory to create an instance of the app
|
|
49
|
-
*/
|
|
50
|
-
protected readonly delayedFactory: Promise<void>;
|
|
51
|
-
/**
|
|
52
|
-
* {@inheritDoc}
|
|
53
|
-
*/
|
|
54
|
-
sendRequest(app: null, request: IncomingMessage, response: ServerResponse): void;
|
|
55
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './trpc.framework';
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IncomingMessage, ServerResponse } from 'http';
|
|
3
|
-
import type { AnyRouter, DataTransformer } from '@trpc/server';
|
|
4
|
-
import { NodeHTTPCreateContextFnOptions, NodeHTTPHandlerOptions } from '@trpc/server/adapters/node-http';
|
|
5
|
-
import { SingleValueHeaders } from '../../@types';
|
|
6
|
-
import { FrameworkContract } from '../../contracts';
|
|
7
|
-
/**
|
|
8
|
-
* The transformer that is responsible to transform buffer's input to javascript objects
|
|
9
|
-
*
|
|
10
|
-
* @deprecated You should use {@link JsonBodyParserFramework} instead, is more reliable and enable you to use transformer of trpc to other things.
|
|
11
|
-
* @breadcrumb Frameworks / TrpcFramework
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
export declare class BufferToJSObjectTransformer implements DataTransformer {
|
|
15
|
-
/**
|
|
16
|
-
* Deserialize unknown values to javascript objects
|
|
17
|
-
*
|
|
18
|
-
* @param value - The value to be deserialized
|
|
19
|
-
*/
|
|
20
|
-
deserialize(value?: unknown): any;
|
|
21
|
-
/**
|
|
22
|
-
* The value to be serialized, do nothing because tRPC can handle.
|
|
23
|
-
*
|
|
24
|
-
* @param value - The value to be serialized
|
|
25
|
-
*/
|
|
26
|
-
serialize(value: any): any;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* The context created by this library that allows getting some information from the request and setting the status and header of the response.
|
|
30
|
-
*
|
|
31
|
-
* @breadcrumb Frameworks / TrpcFramework
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
export interface TrpcAdapterBaseContext {
|
|
35
|
-
/**
|
|
36
|
-
* The request object that will be forward to your app
|
|
37
|
-
*/
|
|
38
|
-
request: IncomingMessage;
|
|
39
|
-
/**
|
|
40
|
-
* The response object that will be forward to your app to output the response
|
|
41
|
-
*/
|
|
42
|
-
response: ServerResponse;
|
|
43
|
-
/**
|
|
44
|
-
* The method to set response status.
|
|
45
|
-
*
|
|
46
|
-
* @param statusCode - The response status that you want
|
|
47
|
-
*/
|
|
48
|
-
setStatus(statusCode: number): void;
|
|
49
|
-
/**
|
|
50
|
-
* The method to set some header in the response
|
|
51
|
-
*
|
|
52
|
-
* @param name - The name of the header
|
|
53
|
-
* @param value - The value to be set in the header
|
|
54
|
-
*/
|
|
55
|
-
setHeader(name: string, value: number | string): void;
|
|
56
|
-
/**
|
|
57
|
-
* The method to remove some header from the response
|
|
58
|
-
*
|
|
59
|
-
* @param name - The name of the header
|
|
60
|
-
*/
|
|
61
|
-
removeHeader(name: string): void;
|
|
62
|
-
/**
|
|
63
|
-
* The method to return the value of some header from the request
|
|
64
|
-
*
|
|
65
|
-
* @param name - The name of the header
|
|
66
|
-
*/
|
|
67
|
-
getHeader(name: string): string | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* The method to return the request headers
|
|
70
|
-
*/
|
|
71
|
-
getHeaders(): SingleValueHeaders;
|
|
72
|
-
/**
|
|
73
|
-
* The method to return user's address
|
|
74
|
-
*/
|
|
75
|
-
getIp(): string | undefined;
|
|
76
|
-
/**
|
|
77
|
-
* The method to return the URL called
|
|
78
|
-
*/
|
|
79
|
-
getUrl(): string | undefined;
|
|
80
|
-
/**
|
|
81
|
-
* The method to return the HTTP Method in the request
|
|
82
|
-
*/
|
|
83
|
-
getMethod(): string | undefined;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* This is the context merged between {@link TrpcAdapterBaseContext} and the {@link TContext} that you provided.
|
|
87
|
-
*
|
|
88
|
-
* This context will be merged with the context you created with `createContext` inside {@link TrpcFrameworkOptions}.
|
|
89
|
-
* So to make the type work, just send the properties you've added inside {@link TContext}.
|
|
90
|
-
*
|
|
91
|
-
* @example
|
|
92
|
-
* ```typescript
|
|
93
|
-
* type MyCustomContext = { user: { name: string } };
|
|
94
|
-
* type TrpcContext = TrpcAdapterContext<MyCustomContext>; // your final context type to put inside trpc.router
|
|
95
|
-
* ```
|
|
96
|
-
*
|
|
97
|
-
* @breadcrumb Frameworks / TrpcFramework
|
|
98
|
-
* @public
|
|
99
|
-
*/
|
|
100
|
-
export declare type TrpcAdapterContext<TContext> = TContext & TrpcAdapterBaseContext;
|
|
101
|
-
/**
|
|
102
|
-
* The options to customize the {@link TrpcFramework}
|
|
103
|
-
*
|
|
104
|
-
* @breadcrumb Frameworks / TrpcFramework
|
|
105
|
-
* @public
|
|
106
|
-
*/
|
|
107
|
-
export declare type TrpcFrameworkOptions<TContext> = Omit<NodeHTTPHandlerOptions<AnyRouter<TContext>, IncomingMessage, ServerResponse>, 'router' | 'createContext'> & {
|
|
108
|
-
createContext?: (opts: NodeHTTPCreateContextFnOptions<IncomingMessage, ServerResponse>) => Omit<TContext, keyof TrpcAdapterBaseContext> | Promise<Omit<TContext, keyof TrpcAdapterBaseContext>>;
|
|
109
|
-
};
|
|
110
|
-
/**
|
|
111
|
-
* The framework that forwards requests to TRPC handler
|
|
112
|
-
*
|
|
113
|
-
* @breadcrumb Frameworks / TrpcFramework
|
|
114
|
-
* @public
|
|
115
|
-
*/
|
|
116
|
-
export declare class TrpcFramework<TContext extends TrpcAdapterBaseContext> implements FrameworkContract<AnyRouter<TContext>> {
|
|
117
|
-
protected readonly options?: TrpcFrameworkOptions<TContext> | undefined;
|
|
118
|
-
/**
|
|
119
|
-
* Default constructor
|
|
120
|
-
*/
|
|
121
|
-
constructor(options?: TrpcFrameworkOptions<TContext> | undefined);
|
|
122
|
-
/**
|
|
123
|
-
* {@inheritDoc}
|
|
124
|
-
*/
|
|
125
|
-
sendRequest(app: AnyRouter<TContext>, request: IncomingMessage, response: ServerResponse): void;
|
|
126
|
-
/**
|
|
127
|
-
* Get safe url that can be used inside Trpc.
|
|
128
|
-
*
|
|
129
|
-
* @example
|
|
130
|
-
* ```typescript
|
|
131
|
-
* const url = getSafeUrlForTrpc('/users?input=hello');
|
|
132
|
-
* console.log(url); // users
|
|
133
|
-
* ```
|
|
134
|
-
*
|
|
135
|
-
* @param request - The request object that will be forward to your app
|
|
136
|
-
*/
|
|
137
|
-
protected getSafeUrlForTrpc(request: IncomingMessage): string;
|
|
138
|
-
/**
|
|
139
|
-
* Merge the default context ({@link TrpcAdapterContext}) with the context created by the user.
|
|
140
|
-
*
|
|
141
|
-
* @param createContextOptions - The options sent by trpc to create the context
|
|
142
|
-
*/
|
|
143
|
-
protected mergeDefaultContextWithOptionsContext(createContextOptions: NodeHTTPCreateContextFnOptions<IncomingMessage, ServerResponse>): TContext | Promise<TContext>;
|
|
144
|
-
/**
|
|
145
|
-
* Wraps the resolved context from the {@link TrpcFrameworkOptions} created with `createContext` and merge
|
|
146
|
-
* with the {@link TrpcAdapterContext} generated by the library.
|
|
147
|
-
*
|
|
148
|
-
* @param resolvedContext - The context created with `createContext` inside {@link TrpcFrameworkOptions}
|
|
149
|
-
* @param createContextOptions - The options sent by trpc to create the context
|
|
150
|
-
*/
|
|
151
|
-
protected wrapResolvedContextWithDefaultContext(resolvedContext: TContext, createContextOptions: NodeHTTPCreateContextFnOptions<IncomingMessage, ServerResponse>): TContext;
|
|
152
|
-
}
|
|
153
|
-
export declare type __ΩTrpcAdapterBaseContext = any[];
|
|
154
|
-
export declare type __ΩTrpcAdapterContext = any[];
|
|
155
|
-
export declare type __ΩTrpcFrameworkOptions = any[];
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Writable } from 'stream';
|
|
3
|
-
import type { APIGatewayProxyEventV2, Context } from 'aws-lambda';
|
|
4
|
-
import type { APIGatewayProxyStructuredResultV2 } from 'aws-lambda/trigger/api-gateway-proxy';
|
|
5
|
-
import { BinarySettings } from '../../@types';
|
|
6
|
-
import { AdapterContract, AdapterRequest, FrameworkContract, ResolverContract, ServerlessHandler } from '../../contracts';
|
|
7
|
-
import { BaseHandler, ILogger } from '../../core';
|
|
8
|
-
export declare type AWSResponseStream = Writable;
|
|
9
|
-
export declare type AWSStreamResponseMetadata = Pick<APIGatewayProxyStructuredResultV2, 'statusCode' | 'headers' | 'cookies'>;
|
|
10
|
-
/**
|
|
11
|
-
* The interface that describes the internal context used by the {@link AwsStreamHandler}
|
|
12
|
-
*
|
|
13
|
-
* @breadcrumb Handlers / AwsStreamHandler
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
export declare type AWSStreamContext = {
|
|
17
|
-
/**
|
|
18
|
-
* The response stream provided by the serverless
|
|
19
|
-
*/
|
|
20
|
-
response: AWSResponseStream;
|
|
21
|
-
/**
|
|
22
|
-
* The context provided by the serverless
|
|
23
|
-
*/
|
|
24
|
-
context: Context;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* The class that implements a default serverless handler consisting of a function with event, context and callback parameters respectively
|
|
28
|
-
*
|
|
29
|
-
* @breadcrumb Handlers / AwsStreamHandler
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
export declare class AwsStreamHandler<TApp> extends BaseHandler<TApp, APIGatewayProxyEventV2, AWSStreamContext, void, AWSStreamResponseMetadata, void> {
|
|
33
|
-
/**
|
|
34
|
-
* {@inheritDoc}
|
|
35
|
-
*/
|
|
36
|
-
getHandler(app: TApp, framework: FrameworkContract<TApp>, adapters: AdapterContract<APIGatewayProxyEventV2, AWSStreamContext, AWSStreamResponseMetadata>[], resolverFactory: ResolverContract<unknown, unknown, unknown, unknown, unknown>, binarySettings: BinarySettings, respondWithErrors: boolean, log: ILogger): ServerlessHandler<Promise<void>>;
|
|
37
|
-
/**
|
|
38
|
-
* The hook executed on receive a request, before the request is being processed
|
|
39
|
-
*
|
|
40
|
-
* @param log - The instance of logger
|
|
41
|
-
* @param event - The event sent by serverless
|
|
42
|
-
* @param context - The context sent by serverless
|
|
43
|
-
* @param binarySettings - The binary settings
|
|
44
|
-
* @param respondWithErrors - Indicates whether the error stack should be included in the response or not
|
|
45
|
-
*/
|
|
46
|
-
protected onReceiveRequest(log: ILogger, event: APIGatewayProxyEventV2, context: AWSStreamContext, binarySettings: BinarySettings, respondWithErrors: boolean): void;
|
|
47
|
-
/**
|
|
48
|
-
* The hook executed after resolve the adapter that will be used to handle the request and response
|
|
49
|
-
*
|
|
50
|
-
* @param log - The instance of logger
|
|
51
|
-
* @param adapter - The adapter resolved
|
|
52
|
-
*/
|
|
53
|
-
protected onResolveAdapter(log: ILogger, adapter: AdapterContract<APIGatewayProxyEventV2, AWSStreamContext, AWSStreamResponseMetadata>): void;
|
|
54
|
-
/**
|
|
55
|
-
* The hook executed after resolves the request values that will be sent to the framework
|
|
56
|
-
*
|
|
57
|
-
* @param log - The instance of logger
|
|
58
|
-
* @param requestValues - The request values returned by the adapter
|
|
59
|
-
*/
|
|
60
|
-
protected onResolveRequestValues(log: ILogger, requestValues: AdapterRequest): void;
|
|
61
|
-
/**
|
|
62
|
-
* The hook executed before sending response to the serverless with response from adapter
|
|
63
|
-
*
|
|
64
|
-
* @param log - The instance of logger
|
|
65
|
-
* @param successResponse - The success response resolved by the adapter
|
|
66
|
-
*/
|
|
67
|
-
protected onForwardResponseAdapterResponse(log: ILogger, successResponse: AWSStreamResponseMetadata): void;
|
|
68
|
-
/**
|
|
69
|
-
* The function to forward the event to the framework
|
|
70
|
-
*
|
|
71
|
-
* @param app - The instance of the app (express, hapi, etc...)
|
|
72
|
-
* @param framework - The framework that will process requests
|
|
73
|
-
* @param event - The event sent by serverless
|
|
74
|
-
* @param context - The context sent by serverless
|
|
75
|
-
* @param adapter - The adapter resolved to this event
|
|
76
|
-
* @param log - The instance of logger
|
|
77
|
-
* @param binarySettings - The binary settings
|
|
78
|
-
*/
|
|
79
|
-
protected forwardRequestToFramework(app: TApp, framework: FrameworkContract<TApp>, event: APIGatewayProxyEventV2, context: AWSStreamContext, adapter: AdapterContract<APIGatewayProxyEventV2, AWSStreamContext, AWSStreamResponseMetadata>, binarySettings: BinarySettings, log: ILogger): Promise<void>;
|
|
80
|
-
}
|
|
81
|
-
export declare type __ΩAWSResponseStream = any[];
|
|
82
|
-
export declare type __ΩAWSStreamResponseMetadata = any[];
|
|
83
|
-
export declare type __ΩAWSStreamContext = any[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './aws-stream.handler';
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { Context } from '@azure/functions';
|
|
2
|
-
import { BinarySettings } from '../../@types';
|
|
3
|
-
import { AdapterContract, FrameworkContract, ResolverContract, ServerlessHandler } from '../../contracts';
|
|
4
|
-
import { ILogger } from '../../core';
|
|
5
|
-
import { DefaultHandler } from '../default';
|
|
6
|
-
/**
|
|
7
|
-
* The options to customize {@link AzureHandler}
|
|
8
|
-
*
|
|
9
|
-
* @breadcrumb Handlers / AzureHandler
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export interface AzureHandlerOptions {
|
|
13
|
-
/**
|
|
14
|
-
* Indicates to use the context log instead console.log when logger is internal (created by the library)
|
|
15
|
-
*
|
|
16
|
-
* @defaultValue true
|
|
17
|
-
*/
|
|
18
|
-
useContextLogWhenInternalLogger: boolean;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* The class that implements a serverless handler for Azure Function.
|
|
22
|
-
*
|
|
23
|
-
* When you don't specify a custom logger, the {@link Context} logger is used instead.
|
|
24
|
-
*
|
|
25
|
-
* @breadcrumb Handlers / AzureHandler
|
|
26
|
-
* @public
|
|
27
|
-
*/
|
|
28
|
-
export declare class AzureHandler<TApp, TEvent, TCallback, TResponse, TReturn> extends DefaultHandler<TApp, TEvent, Context, TCallback, TResponse, TReturn> {
|
|
29
|
-
protected readonly options?: AzureHandlerOptions | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* Default Constructor
|
|
32
|
-
*/
|
|
33
|
-
constructor(options?: AzureHandlerOptions | undefined);
|
|
34
|
-
/**
|
|
35
|
-
* {@inheritDoc}
|
|
36
|
-
*/
|
|
37
|
-
getHandler(app: TApp, framework: FrameworkContract<TApp>, adapters: AdapterContract<TEvent, Context, TResponse>[], resolverFactory: ResolverContract<TEvent, Context, TCallback, TResponse, TReturn>, binarySettings: BinarySettings, respondWithErrors: boolean, log: ILogger): ServerlessHandler<TReturn>;
|
|
38
|
-
/**
|
|
39
|
-
* Get the {@link ILogger} instance from logger of the context
|
|
40
|
-
*
|
|
41
|
-
* @param context - The Azure Context
|
|
42
|
-
*/
|
|
43
|
-
protected createLoggerFromContext(context: Context): ILogger;
|
|
44
|
-
}
|
|
45
|
-
export declare type __ΩAzureHandlerOptions = any[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './azure.handler';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './raw-request';
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IncomingMessage, ServerResponse } from 'http';
|
|
3
|
-
import { FrameworkContract } from '../../contracts/index';
|
|
4
|
-
import { ServerlessRequest } from '../../network/index';
|
|
5
|
-
/**
|
|
6
|
-
* The class that expose some methods to be used to get raw request from Express HTTP Request
|
|
7
|
-
*
|
|
8
|
-
* @breadcrumb Handlers / Base / RawRequest
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
export declare abstract class RawRequest<TApp> {
|
|
12
|
-
/**
|
|
13
|
-
* The callback to when receive some request from external source
|
|
14
|
-
*
|
|
15
|
-
* @param app - The instance of the app
|
|
16
|
-
* @param framework - The framework for the app
|
|
17
|
-
*/
|
|
18
|
-
protected onRequestCallback(app: TApp, framework: FrameworkContract<TApp>): (req: IncomingMessage, res: ServerResponse) => void | Promise<void>;
|
|
19
|
-
/**
|
|
20
|
-
* Not sure why they think using Express instance with prebuilt middlewares was a good idea, but Firebase/GCP
|
|
21
|
-
* decides to use `Express` and `body-parser` by default, so you don't get a raw request, instead, you get a modified version by
|
|
22
|
-
* Express and also with the body parsed by `body-parser`.
|
|
23
|
-
* If you use NestJS or Express it's awesome, but for the rest of the frameworks it's terrible!
|
|
24
|
-
* That's why I have this method, just to try and create a raw request to be used and passed to the frameworks so they can handle the request
|
|
25
|
-
* as if they received the request from the native http module.
|
|
26
|
-
*
|
|
27
|
-
* @param request - The Express request
|
|
28
|
-
*/
|
|
29
|
-
protected getRequestFromExpressRequest(request: IncomingMessage): ServerlessRequest;
|
|
30
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { BinarySettings, SingleValueHeaders } from '../../@types';
|
|
2
|
-
import { AdapterContract, AdapterRequest, FrameworkContract, ResolverContract, ServerlessHandler } from '../../contracts';
|
|
3
|
-
import { BaseHandler, ILogger } from '../../core';
|
|
4
|
-
import { ServerlessResponse } from '../../network';
|
|
5
|
-
/**
|
|
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
|
|
10
|
-
*/
|
|
11
|
-
export declare class DefaultHandler<TApp, TEvent, TContext, TCallback, TResponse, TReturn> extends BaseHandler<TApp, TEvent, TContext, TCallback, TResponse, TReturn> {
|
|
12
|
-
/**
|
|
13
|
-
* {@inheritDoc}
|
|
14
|
-
*/
|
|
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>;
|
|
16
|
-
/**
|
|
17
|
-
* The hook executed on receive a request, before the request is being processed
|
|
18
|
-
*
|
|
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
|
|
24
|
-
*/
|
|
25
|
-
protected onReceiveRequest(log: ILogger, event: TEvent, context: TContext, binarySettings: BinarySettings, respondWithErrors: boolean): void;
|
|
26
|
-
/**
|
|
27
|
-
* The hook executed after resolve the adapter that will be used to handle the request and response
|
|
28
|
-
*
|
|
29
|
-
* @param log - The instance of logger
|
|
30
|
-
* @param adapter - The adapter resolved
|
|
31
|
-
*/
|
|
32
|
-
protected onResolveAdapter(log: ILogger, adapter: AdapterContract<TEvent, TContext, TResponse>): void;
|
|
33
|
-
/**
|
|
34
|
-
* The hook executed after resolves the request values that will be sent to the framework
|
|
35
|
-
*
|
|
36
|
-
* @param log - The instance of logger
|
|
37
|
-
* @param requestValues - The request values returned by the adapter
|
|
38
|
-
*/
|
|
39
|
-
protected onResolveRequestValues(log: ILogger, requestValues: AdapterRequest): void;
|
|
40
|
-
/**
|
|
41
|
-
* The hook executed after handling the response sent by the framework
|
|
42
|
-
*
|
|
43
|
-
* @param log - The instance of logger
|
|
44
|
-
* @param response - The response sent by the framework
|
|
45
|
-
*/
|
|
46
|
-
protected onResolveForwardedResponseToFramework(log: ILogger, response: ServerlessResponse): void;
|
|
47
|
-
/**
|
|
48
|
-
* The hook executed before sending response to the serverless
|
|
49
|
-
*
|
|
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
|
|
55
|
-
*/
|
|
56
|
-
protected onForwardResponse(log: ILogger, statusCode: number, body: string, headers: SingleValueHeaders, isBase64Encoded: boolean): void;
|
|
57
|
-
/**
|
|
58
|
-
* The hook executed before sending response to the serverless with response from adapter
|
|
59
|
-
*
|
|
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
|
|
63
|
-
*/
|
|
64
|
-
protected onForwardResponseAdapterResponse(log: ILogger, successResponse: TResponse, body: string): void;
|
|
65
|
-
/**
|
|
66
|
-
* The function to forward the event to the framework
|
|
67
|
-
*
|
|
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
|
|
75
|
-
*/
|
|
76
|
-
protected forwardRequestToFramework(app: TApp, framework: FrameworkContract<TApp>, event: TEvent, context: TContext, adapter: AdapterContract<TEvent, TContext, TResponse>, binarySettings: BinarySettings, log: ILogger): Promise<TResponse>;
|
|
77
|
-
/**
|
|
78
|
-
* The function to forward the response back to the serverless
|
|
79
|
-
*
|
|
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
|
|
85
|
-
*/
|
|
86
|
-
protected forwardResponse(event: TEvent, response: ServerlessResponse, adapter: AdapterContract<TEvent, TContext, TResponse>, binarySettings: BinarySettings, log: ILogger): TResponse;
|
|
87
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './default.handler';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { BinarySettings } from '../../@types';
|
|
2
|
-
import { AdapterContract, FrameworkContract, ResolverContract, ServerlessHandler } from '../../contracts';
|
|
3
|
-
import { ILogger } from '../../core';
|
|
4
|
-
import { DefaultHandler } from '../default';
|
|
5
|
-
/**
|
|
6
|
-
* The class that implements a serverless handler for Digital Ocean Functions.
|
|
7
|
-
*
|
|
8
|
-
* @breadcrumb Handlers / DigitalOceanHandler
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
export declare class DigitalOceanHandler<TApp, TEvent, TResponse, TReturn> extends DefaultHandler<TApp, TEvent, void, void, TResponse, TReturn> {
|
|
12
|
-
/**
|
|
13
|
-
* {@inheritDoc}
|
|
14
|
-
*/
|
|
15
|
-
getHandler(app: TApp, framework: FrameworkContract<TApp>, adapters: AdapterContract<TEvent, void, TResponse>[], resolverFactory: ResolverContract<TEvent, void, void, TResponse, TReturn>, binarySettings: BinarySettings, respondWithErrors: boolean, log: ILogger): ServerlessHandler<TReturn>;
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './digital-ocean.handler';
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { https } from 'firebase-functions/v2';
|
|
2
|
-
import { FrameworkContract, HandlerContract } from '../../contracts';
|
|
3
|
-
import { RawRequest } from '../base';
|
|
4
|
-
/**
|
|
5
|
-
* The class that implements a handler for Firebase Https Events
|
|
6
|
-
*
|
|
7
|
-
* @remarks Read more about Https Events {@link https://firebase.google.com/docs/functions/http-events | here}
|
|
8
|
-
*
|
|
9
|
-
* @breadcrumb Handlers / HttpFirebaseHandler
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export declare class HttpFirebaseV2Handler<TApp> extends RawRequest<TApp> implements HandlerContract<TApp, never, never, never, void, void | Promise<void>> {
|
|
13
|
-
protected readonly options?: https.HttpsOptions | undefined;
|
|
14
|
-
/**
|
|
15
|
-
* Construtor padrão
|
|
16
|
-
*/
|
|
17
|
-
constructor(options?: https.HttpsOptions | undefined);
|
|
18
|
-
/**
|
|
19
|
-
* {@inheritDoc}
|
|
20
|
-
*/
|
|
21
|
-
getHandler(app: TApp, framework: FrameworkContract<TApp>): ReturnType<HttpFirebaseV2Handler<TApp>['onRequestCallback']>;
|
|
22
|
-
/**
|
|
23
|
-
* Wrapper method around onRequest for better testability
|
|
24
|
-
*/
|
|
25
|
-
protected onRequestWithOptions(options: https.HttpsOptions, callback: ReturnType<HttpFirebaseV2Handler<TApp>['onRequestCallback']>): ReturnType<HttpFirebaseV2Handler<TApp>['onRequestCallback']>;
|
|
26
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IncomingMessage, ServerResponse } from 'http';
|
|
3
|
-
import { FrameworkContract, HandlerContract } from '../../contracts';
|
|
4
|
-
import { RawRequest } from '../base';
|
|
5
|
-
/**
|
|
6
|
-
* The class that implements a handler for Firebase Https Events
|
|
7
|
-
*
|
|
8
|
-
* @remarks Read more about Https Events {@link https://firebase.google.com/docs/functions/http-events | here}
|
|
9
|
-
*
|
|
10
|
-
* @breadcrumb Handlers / HttpFirebaseHandler
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
export declare class HttpFirebaseHandler<TApp> extends RawRequest<TApp> implements HandlerContract<TApp, never, never, never, void, void | Promise<void>> {
|
|
14
|
-
/**
|
|
15
|
-
* {@inheritDoc}
|
|
16
|
-
*/
|
|
17
|
-
getHandler(app: TApp, framework: FrameworkContract<TApp>): (req: IncomingMessage, res: ServerResponse) => void | Promise<void>;
|
|
18
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IncomingMessage, ServerResponse } from 'http';
|
|
3
|
-
import { FrameworkContract, HandlerContract } from '../../contracts';
|
|
4
|
-
import { RawRequest } from '../base/index';
|
|
5
|
-
/**
|
|
6
|
-
* The class that implements a handler for GCP Http Functions
|
|
7
|
-
*
|
|
8
|
-
* @remarks Read more about Http Cloud Function {@link https://cloud.google.com/functions/docs/create-deploy-http-nodejs | here}
|
|
9
|
-
*
|
|
10
|
-
* @breadcrumb Handlers / GCPHandler
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
export declare class GCPHandler<TApp> extends RawRequest<TApp> implements HandlerContract<TApp, never, never, never, void, void | Promise<void>> {
|
|
14
|
-
protected readonly name: string;
|
|
15
|
-
/**
|
|
16
|
-
* Default Constructor
|
|
17
|
-
*
|
|
18
|
-
* @param name - The name of this function, should be the during deploy.
|
|
19
|
-
*/
|
|
20
|
-
constructor(name: string);
|
|
21
|
-
/**
|
|
22
|
-
* {@inheritDoc}
|
|
23
|
-
*/
|
|
24
|
-
getHandler(app: TApp, framework: FrameworkContract<TApp>): (req: IncomingMessage, res: ServerResponse) => void | Promise<void>;
|
|
25
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './gcp.handler';
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import * as http from 'http';
|
|
3
|
-
import { RequestListener } from 'http';
|
|
4
|
-
import { BinarySettings } from '../../@types';
|
|
5
|
-
import { AdapterContract, FrameworkContract, HandlerContract, ResolverContract, ServerlessHandler } from '../../contracts';
|
|
6
|
-
import { ILogger } from '../../core';
|
|
7
|
-
/**
|
|
8
|
-
* The default port that huawei will proxy the request to your framework
|
|
9
|
-
*
|
|
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
|
|
14
|
-
*/
|
|
15
|
-
export declare const DEFAULT_HUAWEI_LISTEN_PORT: number;
|
|
16
|
-
/**
|
|
17
|
-
* The options to customize {@link HttpHuaweiHandler}
|
|
18
|
-
*
|
|
19
|
-
* @breadcrumb Handlers / HttpHuaweiHandler
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
22
|
-
export declare type HttpHuaweiHandlerOptions = {
|
|
23
|
-
/**
|
|
24
|
-
* @defaultValue {@link DEFAULT_HUAWEI_LISTEN_PORT}
|
|
25
|
-
*/
|
|
26
|
-
port?: number;
|
|
27
|
-
/**
|
|
28
|
-
* The factory to create a http server to use to listen huawei requests
|
|
29
|
-
*/
|
|
30
|
-
httpServerFactory?: (requestListener: RequestListener) => http.Server;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* The class that implements a huawei serverless handler with http function that exposes a http server in specific port.
|
|
34
|
-
*
|
|
35
|
-
* In this Handler, you don't need to specific resolver and adapter, so you can use DummyAdapter and DummyResolver instead.
|
|
36
|
-
*
|
|
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
|
|
41
|
-
*/
|
|
42
|
-
export declare class HttpHuaweiHandler<TApp> implements HandlerContract<TApp, void, void, void, void, Promise<void>> {
|
|
43
|
-
protected readonly options?: HttpHuaweiHandlerOptions | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* Construtor padrão
|
|
46
|
-
*/
|
|
47
|
-
constructor(options?: HttpHuaweiHandlerOptions | undefined);
|
|
48
|
-
/**
|
|
49
|
-
* {@inheritDoc}
|
|
50
|
-
*/
|
|
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>>;
|
|
52
|
-
/**
|
|
53
|
-
* The method that creates the instance of http server
|
|
54
|
-
*
|
|
55
|
-
* @param requestListener - O método que lidará com as requisições recebidas
|
|
56
|
-
*/
|
|
57
|
-
protected createHttpServer(requestListener: RequestListener): http.Server;
|
|
58
|
-
}
|
|
59
|
-
export declare type __ΩHttpHuaweiHandlerOptions = any[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './http-huawei.handler';
|
package/lib/index.d.ts
DELETED
package/lib/network/index.d.ts
DELETED