@h4ad/serverless-adapter 2.2.0 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -253
- package/lib/@types/binary-settings.d.ts +24 -6
- package/lib/@types/binary-settings.d.ts.map +1 -0
- package/lib/@types/binary-settings.js +1 -0
- package/lib/@types/binary-settings.js.map +1 -0
- package/lib/@types/headers.d.ts +16 -3
- package/lib/@types/headers.d.ts.map +1 -0
- package/lib/@types/headers.js +1 -0
- package/lib/@types/headers.js.map +1 -0
- package/lib/@types/helpers.d.ts +4 -0
- package/lib/@types/helpers.d.ts.map +1 -0
- package/lib/@types/helpers.js +1 -0
- package/lib/@types/helpers.js.map +1 -0
- package/lib/@types/huawei/huawei-api-gateway-event.d.ts +62 -0
- package/lib/@types/huawei/huawei-api-gateway-event.d.ts.map +1 -0
- package/lib/@types/huawei/huawei-api-gateway-event.js +2 -0
- package/lib/@types/huawei/huawei-api-gateway-event.js.map +1 -0
- package/lib/@types/huawei/huawei-api-gateway-response.d.ts +20 -0
- package/lib/@types/huawei/huawei-api-gateway-response.d.ts.map +1 -0
- package/lib/@types/huawei/huawei-api-gateway-response.js +2 -0
- package/lib/@types/huawei/huawei-api-gateway-response.js.map +1 -0
- package/lib/@types/huawei/huawei-context.d.ts +157 -0
- package/lib/@types/huawei/huawei-context.d.ts.map +1 -0
- package/lib/@types/huawei/huawei-context.js +1 -0
- package/lib/@types/huawei/huawei-context.js.map +1 -0
- package/lib/@types/huawei/index.d.ts +1 -0
- package/lib/@types/huawei/index.d.ts.map +1 -0
- package/lib/@types/huawei/index.js +6 -1
- package/lib/@types/huawei/index.js.map +1 -0
- package/lib/@types/index.d.ts +2 -1
- package/lib/@types/index.d.ts.map +1 -0
- package/lib/@types/index.js +7 -2
- package/lib/@types/index.js.map +1 -0
- package/lib/adapters/aws/alb.adapter.d.ts +18 -10
- package/lib/adapters/aws/alb.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/alb.adapter.js +14 -9
- package/lib/adapters/aws/alb.adapter.js.map +1 -0
- package/lib/adapters/aws/api-gateway-v1.adapter.d.ts +20 -12
- package/lib/adapters/aws/api-gateway-v1.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/api-gateway-v1.adapter.js +19 -14
- package/lib/adapters/aws/api-gateway-v1.adapter.js.map +1 -0
- package/lib/adapters/aws/api-gateway-v2.adapter.d.ts +19 -11
- package/lib/adapters/aws/api-gateway-v2.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/api-gateway-v2.adapter.js +15 -10
- package/lib/adapters/aws/api-gateway-v2.adapter.js.map +1 -0
- package/lib/adapters/aws/dynamodb.adapter.d.ts +18 -10
- package/lib/adapters/aws/dynamodb.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/dynamodb.adapter.js +13 -8
- package/lib/adapters/aws/dynamodb.adapter.js.map +1 -0
- package/lib/adapters/aws/event-bridge.adapter.d.ts +21 -10
- package/lib/adapters/aws/event-bridge.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/event-bridge.adapter.js +13 -8
- package/lib/adapters/aws/event-bridge.adapter.js.map +1 -0
- package/lib/adapters/aws/index.d.ts +1 -0
- package/lib/adapters/aws/index.d.ts.map +1 -0
- package/lib/adapters/aws/index.js +6 -1
- package/lib/adapters/aws/index.js.map +1 -0
- package/lib/adapters/aws/lambda-edge.adapter.d.ts +76 -46
- package/lib/adapters/aws/lambda-edge.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/lambda-edge.adapter.js +40 -24
- package/lib/adapters/aws/lambda-edge.adapter.js.map +1 -0
- package/lib/adapters/aws/sns.adapter.d.ts +18 -10
- package/lib/adapters/aws/sns.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/sns.adapter.js +13 -8
- package/lib/adapters/aws/sns.adapter.js.map +1 -0
- package/lib/adapters/aws/sqs.adapter.d.ts +18 -10
- package/lib/adapters/aws/sqs.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/sqs.adapter.js +13 -8
- package/lib/adapters/aws/sqs.adapter.js.map +1 -0
- package/lib/adapters/dummy/dummy.adapter.d.ts +9 -5
- package/lib/adapters/dummy/dummy.adapter.d.ts.map +1 -0
- package/lib/adapters/dummy/dummy.adapter.js +9 -5
- package/lib/adapters/dummy/dummy.adapter.js.map +1 -0
- package/lib/adapters/dummy/index.d.ts +1 -0
- package/lib/adapters/dummy/index.d.ts.map +1 -0
- package/lib/adapters/dummy/index.js +6 -1
- package/lib/adapters/dummy/index.js.map +1 -0
- package/lib/adapters/huawei/huawei-api-gateway.adapter.d.ts +19 -12
- package/lib/adapters/huawei/huawei-api-gateway.adapter.d.ts.map +1 -0
- package/lib/adapters/huawei/huawei-api-gateway.adapter.js +14 -9
- package/lib/adapters/huawei/huawei-api-gateway.adapter.js.map +1 -0
- package/lib/adapters/huawei/index.d.ts +1 -0
- package/lib/adapters/huawei/index.d.ts.map +1 -0
- package/lib/adapters/huawei/index.js +6 -1
- package/lib/adapters/huawei/index.js.map +1 -0
- package/lib/contracts/adapter.contract.d.ts +30 -30
- package/lib/contracts/adapter.contract.d.ts.map +1 -0
- package/lib/contracts/adapter.contract.js +2 -0
- package/lib/contracts/adapter.contract.js.map +1 -0
- package/lib/contracts/framework.contract.d.ts +7 -3
- package/lib/contracts/framework.contract.d.ts.map +1 -0
- package/lib/contracts/framework.contract.js +1 -0
- package/lib/contracts/framework.contract.js.map +1 -0
- package/lib/contracts/handler.contract.d.ts +7 -0
- package/lib/contracts/handler.contract.d.ts.map +1 -0
- package/lib/contracts/handler.contract.js +1 -0
- package/lib/contracts/handler.contract.js.map +1 -0
- package/lib/contracts/index.d.ts +1 -0
- package/lib/contracts/index.d.ts.map +1 -0
- package/lib/contracts/index.js +6 -1
- package/lib/contracts/index.js.map +1 -0
- package/lib/contracts/resolver.contract.d.ts +17 -4
- package/lib/contracts/resolver.contract.d.ts.map +1 -0
- package/lib/contracts/resolver.contract.js +1 -0
- package/lib/contracts/resolver.contract.js.map +1 -0
- package/lib/core/base-handler.d.ts +9 -5
- package/lib/core/base-handler.d.ts.map +1 -0
- package/lib/core/base-handler.js +9 -5
- package/lib/core/base-handler.js.map +1 -0
- package/lib/core/constants.d.ts +27 -0
- package/lib/core/constants.d.ts.map +1 -0
- package/lib/core/constants.js +21 -0
- package/lib/core/constants.js.map +1 -0
- package/lib/core/current-invoke.d.ts +17 -6
- package/lib/core/current-invoke.d.ts.map +1 -0
- package/lib/core/current-invoke.js +12 -4
- package/lib/core/current-invoke.js.map +1 -0
- package/lib/core/event-body.d.ts +9 -3
- package/lib/core/event-body.d.ts.map +1 -0
- package/lib/core/event-body.js +9 -3
- package/lib/core/event-body.js.map +1 -0
- package/lib/core/headers.d.ts +17 -6
- package/lib/core/headers.d.ts.map +1 -0
- package/lib/core/headers.js +17 -6
- package/lib/core/headers.js.map +1 -0
- package/lib/core/index.d.ts +1 -0
- package/lib/core/index.d.ts.map +1 -0
- package/lib/core/index.js +6 -1
- package/lib/core/index.js.map +1 -0
- package/lib/core/is-binary.d.ts +29 -11
- package/lib/core/is-binary.d.ts.map +1 -0
- package/lib/core/is-binary.js +29 -11
- package/lib/core/is-binary.js.map +1 -0
- package/lib/core/logger.d.ts +22 -5
- package/lib/core/logger.d.ts.map +1 -0
- package/lib/core/logger.js +8 -3
- package/lib/core/logger.js.map +1 -0
- package/lib/core/no-op.d.ts +4 -0
- package/lib/core/no-op.d.ts.map +1 -0
- package/lib/core/no-op.js +4 -0
- package/lib/core/no-op.js.map +1 -0
- package/lib/core/optional.d.ts +8 -3
- package/lib/core/optional.d.ts.map +1 -0
- package/lib/core/optional.js +8 -3
- package/lib/core/optional.js.map +1 -0
- package/lib/core/path.d.ts +14 -5
- package/lib/core/path.d.ts.map +1 -0
- package/lib/core/path.js +14 -5
- package/lib/core/path.js.map +1 -0
- package/lib/core/stream.d.ts +5 -1
- package/lib/core/stream.d.ts.map +1 -0
- package/lib/core/stream.js +6 -2
- package/lib/core/stream.js.map +1 -0
- package/lib/frameworks/express/express.framework.d.ts +5 -1
- package/lib/frameworks/express/express.framework.d.ts.map +1 -0
- package/lib/frameworks/express/express.framework.js +5 -1
- package/lib/frameworks/express/express.framework.js.map +1 -0
- package/lib/frameworks/express/index.d.ts +1 -0
- package/lib/frameworks/express/index.d.ts.map +1 -0
- package/lib/frameworks/express/index.js +6 -1
- package/lib/frameworks/express/index.js.map +1 -0
- package/lib/frameworks/fastify/fastify.framework.d.ts +5 -1
- package/lib/frameworks/fastify/fastify.framework.d.ts.map +1 -0
- package/lib/frameworks/fastify/fastify.framework.js +5 -1
- package/lib/frameworks/fastify/fastify.framework.js.map +1 -0
- package/lib/frameworks/fastify/index.d.ts +1 -0
- package/lib/frameworks/fastify/index.d.ts.map +1 -0
- package/lib/frameworks/fastify/index.js +6 -1
- package/lib/frameworks/fastify/index.js.map +1 -0
- package/lib/frameworks/hapi/hapi.framework.d.ts +5 -1
- package/lib/frameworks/hapi/hapi.framework.d.ts.map +1 -0
- package/lib/frameworks/hapi/hapi.framework.js +5 -1
- package/lib/frameworks/hapi/hapi.framework.js.map +1 -0
- package/lib/frameworks/hapi/index.d.ts +1 -0
- package/lib/frameworks/hapi/index.d.ts.map +1 -0
- package/lib/frameworks/hapi/index.js +6 -1
- package/lib/frameworks/hapi/index.js.map +1 -0
- package/lib/frameworks/koa/index.d.ts +1 -0
- package/lib/frameworks/koa/index.d.ts.map +1 -0
- package/lib/frameworks/koa/index.js +6 -1
- package/lib/frameworks/koa/index.js.map +1 -0
- package/lib/frameworks/koa/koa.framework.d.ts +5 -1
- package/lib/frameworks/koa/koa.framework.d.ts.map +1 -0
- package/lib/frameworks/koa/koa.framework.js +5 -1
- package/lib/frameworks/koa/koa.framework.js.map +1 -0
- package/lib/frameworks/lazy/index.d.ts +2 -0
- package/lib/frameworks/lazy/index.d.ts.map +1 -0
- package/lib/frameworks/lazy/index.js +18 -0
- package/lib/frameworks/lazy/index.js.map +1 -0
- package/lib/frameworks/lazy/lazy.framework.d.ts +56 -0
- package/lib/frameworks/lazy/lazy.framework.d.ts.map +1 -0
- package/lib/frameworks/lazy/lazy.framework.js +75 -0
- package/lib/frameworks/lazy/lazy.framework.js.map +1 -0
- package/lib/handlers/default/default.handler.d.ts +36 -32
- package/lib/handlers/default/default.handler.d.ts.map +1 -0
- package/lib/handlers/default/default.handler.js +36 -32
- package/lib/handlers/default/default.handler.js.map +1 -0
- package/lib/handlers/default/index.d.ts +1 -0
- package/lib/handlers/default/index.d.ts.map +1 -0
- package/lib/handlers/default/index.js +6 -1
- package/lib/handlers/default/index.js.map +1 -0
- package/lib/handlers/huawei/http-huawei.handler.d.ts +14 -4
- package/lib/handlers/huawei/http-huawei.handler.d.ts.map +1 -0
- package/lib/handlers/huawei/http-huawei.handler.js +15 -4
- package/lib/handlers/huawei/http-huawei.handler.js.map +1 -0
- package/lib/handlers/huawei/index.d.ts +1 -0
- package/lib/handlers/huawei/index.d.ts.map +1 -0
- package/lib/handlers/huawei/index.js +6 -1
- package/lib/handlers/huawei/index.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +6 -1
- package/lib/index.js.map +1 -0
- package/lib/network/index.d.ts +1 -0
- package/lib/network/index.d.ts.map +1 -0
- package/lib/network/index.js +6 -1
- package/lib/network/index.js.map +1 -0
- package/lib/network/request.d.ts +28 -0
- package/lib/network/request.d.ts.map +1 -0
- package/lib/network/request.js +7 -0
- package/lib/network/request.js.map +1 -0
- package/lib/network/response.d.ts +18 -1
- package/lib/network/response.d.ts.map +1 -0
- package/lib/network/response.js +9 -1
- package/lib/network/response.js.map +1 -0
- package/lib/resolvers/aws-context/aws-context.resolver.d.ts +7 -9
- package/lib/resolvers/aws-context/aws-context.resolver.d.ts.map +1 -0
- package/lib/resolvers/aws-context/aws-context.resolver.js +7 -9
- package/lib/resolvers/aws-context/aws-context.resolver.js.map +1 -0
- package/lib/resolvers/aws-context/index.d.ts +1 -0
- package/lib/resolvers/aws-context/index.d.ts.map +1 -0
- package/lib/resolvers/aws-context/index.js +6 -1
- package/lib/resolvers/aws-context/index.js.map +1 -0
- package/lib/resolvers/callback/callback.resolver.d.ts +9 -2
- package/lib/resolvers/callback/callback.resolver.d.ts.map +1 -0
- package/lib/resolvers/callback/callback.resolver.js +6 -2
- package/lib/resolvers/callback/callback.resolver.js.map +1 -0
- package/lib/resolvers/callback/index.d.ts +1 -0
- package/lib/resolvers/callback/index.d.ts.map +1 -0
- package/lib/resolvers/callback/index.js +6 -1
- package/lib/resolvers/callback/index.js.map +1 -0
- package/lib/resolvers/dummy/dummy.resolver.d.ts +5 -1
- package/lib/resolvers/dummy/dummy.resolver.d.ts.map +1 -0
- package/lib/resolvers/dummy/dummy.resolver.js +5 -1
- package/lib/resolvers/dummy/dummy.resolver.js.map +1 -0
- package/lib/resolvers/dummy/index.d.ts +1 -0
- package/lib/resolvers/dummy/index.d.ts.map +1 -0
- package/lib/resolvers/dummy/index.js +6 -1
- package/lib/resolvers/dummy/index.js.map +1 -0
- package/lib/resolvers/promise/index.d.ts +1 -0
- package/lib/resolvers/promise/index.d.ts.map +1 -0
- package/lib/resolvers/promise/index.js +6 -1
- package/lib/resolvers/promise/index.js.map +1 -0
- package/lib/resolvers/promise/promise.resolver.d.ts +5 -1
- package/lib/resolvers/promise/promise.resolver.d.ts.map +1 -0
- package/lib/resolvers/promise/promise.resolver.js +5 -1
- package/lib/resolvers/promise/promise.resolver.js.map +1 -0
- package/lib/serverless-adapter.d.ts +17 -12
- package/lib/serverless-adapter.d.ts.map +1 -0
- package/lib/serverless-adapter.js +17 -12
- package/lib/serverless-adapter.js.map +1 -0
- package/package.json +22 -2
- package/lib/@types/proxy-params.d.ts +0 -8
- package/lib/@types/proxy-params.js +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework.contract.d.ts","sourceRoot":"","sources":["../../src/contracts/framework.contract.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAIvD;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB,CAAC,IAAI;IACrC;;;;;;OAMG;IACH,WAAW,CACT,GAAG,EAAE,IAAI,EACT,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,cAAc,GACvB,IAAI,CAAC;CACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework.contract.js","sourceRoot":"","sources":["../../src/contracts/framework.contract.ts"],"names":[],"mappings":";AAAA,iBAAiB"}
|
|
@@ -5,10 +5,16 @@ import { FrameworkContract } from './framework.contract';
|
|
|
5
5
|
import { ResolverContract } from './resolver.contract';
|
|
6
6
|
/**
|
|
7
7
|
* The function used to handle serverless requests
|
|
8
|
+
*
|
|
9
|
+
* @breadcrumb Contracts / HandlerContract
|
|
10
|
+
* @public
|
|
8
11
|
*/
|
|
9
12
|
export declare type ServerlessHandler<TReturn> = (...args: any[]) => TReturn;
|
|
10
13
|
/**
|
|
11
14
|
* The interface that represents the contract between the handler and the real implementation
|
|
15
|
+
*
|
|
16
|
+
* @breadcrumb Contracts / HandlerContract
|
|
17
|
+
* @public
|
|
12
18
|
*/
|
|
13
19
|
export interface HandlerContract<TApp, TEvent, TContext, TCallback, TResponse, TReturn> {
|
|
14
20
|
/**
|
|
@@ -16,3 +22,4 @@ export interface HandlerContract<TApp, TEvent, TContext, TCallback, TResponse, T
|
|
|
16
22
|
*/
|
|
17
23
|
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>;
|
|
18
24
|
}
|
|
25
|
+
//# sourceMappingURL=handler.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.contract.d.ts","sourceRoot":"","sources":["../../src/contracts/handler.contract.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvD;;;;;GAKG;AACH,oBAAY,iBAAiB,CAAC,OAAO,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;AAErE;;;;;GAKG;AACH,MAAM,WAAW,eAAe,CAC9B,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO;IAEP;;OAEG;IACH,UAAU,CACR,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,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.contract.js","sourceRoot":"","sources":["../../src/contracts/handler.contract.ts"],"names":[],"mappings":";AAAA,iBAAiB"}
|
package/lib/contracts/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
|
package/lib/contracts/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];
|
|
@@ -14,3 +18,4 @@ __exportStar(require("./adapter.contract"), exports);
|
|
|
14
18
|
__exportStar(require("./framework.contract"), exports);
|
|
15
19
|
__exportStar(require("./handler.contract"), exports);
|
|
16
20
|
__exportStar(require("./resolver.contract"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,uDAAqC;AACrC,qDAAmC;AACnC,sDAAoC"}
|
|
@@ -2,34 +2,43 @@ import { ILogger } from '../core';
|
|
|
2
2
|
import { AdapterContract } from './adapter.contract';
|
|
3
3
|
/**
|
|
4
4
|
* The type that represents a resolver used to send the response, error or success, to the client
|
|
5
|
+
*
|
|
6
|
+
* @breadcrumb Contracts / ResolverContract
|
|
7
|
+
* @public
|
|
5
8
|
*/
|
|
6
9
|
export declare type Resolver<TResponse, TReturn> = {
|
|
7
10
|
/**
|
|
8
11
|
* The method that will perform the task of forwarding the request to the framework and waiting for the promise to be resolved with the response
|
|
9
12
|
*
|
|
10
|
-
* @param task The task to be executed
|
|
13
|
+
* @param task - The task to be executed
|
|
11
14
|
*/
|
|
12
15
|
run(task: () => Promise<TResponse>): TReturn;
|
|
13
16
|
};
|
|
14
17
|
/**
|
|
15
18
|
* The type that represents a delegate resolver that is passed to the adapter to handle what to do when an error occurs during forwarding.
|
|
19
|
+
*
|
|
20
|
+
* @breadcrumb Contracts / ResolverContract
|
|
21
|
+
* @public
|
|
16
22
|
*/
|
|
17
23
|
export declare type DelegatedResolver<TResponse> = {
|
|
18
24
|
/**
|
|
19
25
|
* Send the success response to the client
|
|
20
26
|
*
|
|
21
|
-
* @param success The serverless response
|
|
27
|
+
* @param success - The serverless response
|
|
22
28
|
*/
|
|
23
29
|
succeed: (response: TResponse) => void;
|
|
24
30
|
/**
|
|
25
31
|
* Send the error response to the client
|
|
26
32
|
*
|
|
27
|
-
* @param error The error object
|
|
33
|
+
* @param error - The error object
|
|
28
34
|
*/
|
|
29
35
|
fail: (error: Error) => void;
|
|
30
36
|
};
|
|
31
37
|
/**
|
|
32
38
|
* The createResolver contract props
|
|
39
|
+
*
|
|
40
|
+
* @breadcrumb Contracts / ResolverContract
|
|
41
|
+
* @public
|
|
33
42
|
*/
|
|
34
43
|
export declare type ResolverProps<TEvent, TContext, TCallback, TResponse> = {
|
|
35
44
|
/**
|
|
@@ -59,12 +68,16 @@ export declare type ResolverProps<TEvent, TContext, TCallback, TResponse> = {
|
|
|
59
68
|
};
|
|
60
69
|
/**
|
|
61
70
|
* The interface that represents the contract used to send the response to the client
|
|
71
|
+
*
|
|
72
|
+
* @breadcrumb Contracts / ResolverContract
|
|
73
|
+
* @public
|
|
62
74
|
*/
|
|
63
75
|
export interface ResolverContract<TEvent, TContext, TCallback, TResponse, TReturn> {
|
|
64
76
|
/**
|
|
65
77
|
* Create the resolver based on the context, callback or promise
|
|
66
78
|
*
|
|
67
|
-
* @param props The props used to create the resolver
|
|
79
|
+
* @param props - The props used to create the resolver
|
|
68
80
|
*/
|
|
69
81
|
createResolver(props: ResolverProps<TEvent, TContext, TCallback, TResponse>): Resolver<TResponse, TReturn>;
|
|
70
82
|
}
|
|
83
|
+
//# sourceMappingURL=resolver.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.contract.d.ts","sourceRoot":"","sources":["../../src/contracts/resolver.contract.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAIrD;;;;;GAKG;AACH,oBAAY,QAAQ,CAAC,SAAS,EAAE,OAAO,IAAI;IACzC;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;CAC9C,CAAC;AAEF;;;;;GAKG;AACH,oBAAY,iBAAiB,CAAC,SAAS,IAAI;IACzC;;;;OAIG;IACH,OAAO,EAAE,CAAC,QAAQ,EAAE,SAAS,KAAK,IAAI,CAAC;IAEvC;;;;OAIG;IACH,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAC9B,CAAC;AAEF;;;;;GAKG;AACH,oBAAY,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,IAAI;IAClE;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,iBAAiB,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,GAAG,EAAE,OAAO,CAAC;IAEb;;OAEG;IACH,OAAO,EAAE,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IAEtD;;OAEG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB,CAC/B,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO;IAEP;;;;OAIG;IACH,cAAc,CACZ,KAAK,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,GAC3D,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.contract.js","sourceRoot":"","sources":["../../src/contracts/resolver.contract.ts"],"names":[],"mappings":";AAAA,iBAAiB"}
|
|
@@ -4,6 +4,9 @@ import { ServerlessRequest, ServerlessResponse } from '../network';
|
|
|
4
4
|
import { ILogger } from './index';
|
|
5
5
|
/**
|
|
6
6
|
* The abstract class that represents the base class for a handler
|
|
7
|
+
*
|
|
8
|
+
* @breadcrumb Core
|
|
9
|
+
* @public
|
|
7
10
|
*/
|
|
8
11
|
export declare abstract class BaseHandler<TApp, TEvent, TContext, TCallback, TResponse, TReturn> implements HandlerContract<TApp, TEvent, TContext, TCallback, TResponse, TReturn> {
|
|
9
12
|
/**
|
|
@@ -13,16 +16,17 @@ export declare abstract class BaseHandler<TApp, TEvent, TContext, TCallback, TRe
|
|
|
13
16
|
/**
|
|
14
17
|
* Get the adapter to handle a specific event and context
|
|
15
18
|
*
|
|
16
|
-
* @param event The event sent by serverless
|
|
17
|
-
* @param context The context sent by serverless
|
|
18
|
-
* @param adapters The list of adapters
|
|
19
|
-
* @param log The instance of logger
|
|
19
|
+
* @param event - The event sent by serverless
|
|
20
|
+
* @param context - The context sent by serverless
|
|
21
|
+
* @param adapters - The list of adapters
|
|
22
|
+
* @param log - The instance of logger
|
|
20
23
|
*/
|
|
21
24
|
protected getAdapterByEventAndContext(event: TEvent, context: TContext, adapters: AdapterContract<TEvent, TContext, TResponse>[], log: ILogger): AdapterContract<TEvent, TContext, TResponse>;
|
|
22
25
|
/**
|
|
23
26
|
* Get serverless request and response frmo the adapter request
|
|
24
27
|
*
|
|
25
|
-
* @param requestValues The request values from adapter
|
|
28
|
+
* @param requestValues - The request values from adapter
|
|
26
29
|
*/
|
|
27
30
|
protected getServerlessRequestResponseFromAdapterRequest(requestValues: AdapterRequest): [request: ServerlessRequest, response: ServerlessResponse];
|
|
28
31
|
}
|
|
32
|
+
//# sourceMappingURL=base-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-handler.d.ts","sourceRoot":"","sources":["../../src/core/base-handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIlC;;;;;GAKG;AACH,8BAAsB,WAAW,CAC/B,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,CACP,YACE,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC;IAIxE;;OAEG;aACa,UAAU,CACxB,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;IAM7B;;;;;;;OAOG;IACH,SAAS,CAAC,2BAA2B,CACnC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,QAAQ,EACjB,QAAQ,EAAE,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,EACxD,GAAG,EAAE,OAAO,GACX,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC;IAsB/C;;;;OAIG;IACH,SAAS,CAAC,8CAA8C,CACtD,aAAa,EAAE,cAAc,GAC5B,CAAC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,kBAAkB,CAAC;CAiB9D"}
|
package/lib/core/base-handler.js
CHANGED
|
@@ -6,6 +6,9 @@ const network_1 = require("../network");
|
|
|
6
6
|
//#endregion
|
|
7
7
|
/**
|
|
8
8
|
* The abstract class that represents the base class for a handler
|
|
9
|
+
*
|
|
10
|
+
* @breadcrumb Core
|
|
11
|
+
* @public
|
|
9
12
|
*/
|
|
10
13
|
class BaseHandler {
|
|
11
14
|
//#endregion
|
|
@@ -13,10 +16,10 @@ class BaseHandler {
|
|
|
13
16
|
/**
|
|
14
17
|
* Get the adapter to handle a specific event and context
|
|
15
18
|
*
|
|
16
|
-
* @param event The event sent by serverless
|
|
17
|
-
* @param context The context sent by serverless
|
|
18
|
-
* @param adapters The list of adapters
|
|
19
|
-
* @param log The instance of logger
|
|
19
|
+
* @param event - The event sent by serverless
|
|
20
|
+
* @param context - The context sent by serverless
|
|
21
|
+
* @param adapters - The list of adapters
|
|
22
|
+
* @param log - The instance of logger
|
|
20
23
|
*/
|
|
21
24
|
getAdapterByEventAndContext(event, context, adapters, log) {
|
|
22
25
|
const resolvedAdapters = adapters.filter(adapter => adapter.canHandle(event, context, log));
|
|
@@ -33,7 +36,7 @@ class BaseHandler {
|
|
|
33
36
|
/**
|
|
34
37
|
* Get serverless request and response frmo the adapter request
|
|
35
38
|
*
|
|
36
|
-
* @param requestValues The request values from adapter
|
|
39
|
+
* @param requestValues - The request values from adapter
|
|
37
40
|
*/
|
|
38
41
|
getServerlessRequestResponseFromAdapterRequest(requestValues) {
|
|
39
42
|
const request = new network_1.ServerlessRequest({
|
|
@@ -50,3 +53,4 @@ class BaseHandler {
|
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
exports.BaseHandler = BaseHandler;
|
|
56
|
+
//# sourceMappingURL=base-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-handler.js","sourceRoot":"","sources":["../../src/core/base-handler.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;AAWjB,wCAAmE;AAGnE,YAAY;AAEZ;;;;;GAKG;AACH,MAAsB,WAAW;IA+B/B,YAAY;IAEZ,2BAA2B;IAE3B;;;;;;;OAOG;IACO,2BAA2B,CACnC,KAAa,EACb,OAAiB,EACjB,QAAwD,EACxD,GAAY;QAEZ,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CACjD,OAAO,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,CACvC,CAAC;QAEF,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE;YACjC,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;SACH;QAED,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;YAC/B,MAAM,IAAI,KAAK,CACb,yFAAyF,QAAQ;iBAC9F,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;iBACxC,IAAI,CAAC,IAAI,CAAC,GAAG,CACjB,CAAC;SACH;QAED,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACO,8CAA8C,CACtD,aAA6B;QAE7B,MAAM,OAAO,GAAG,IAAI,2BAAiB,CAAC;YACpC,MAAM,EAAE,aAAa,CAAC,MAAM;YAC5B,OAAO,EAAE,aAAa,CAAC,OAAO;YAC9B,IAAI,EAAE,aAAa,CAAC,IAAI;YACxB,aAAa,EAAE,aAAa,CAAC,aAAa;YAC1C,GAAG,EAAE,aAAa,CAAC,IAAI;SACxB,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,IAAI,4BAAkB,CAAC;YACtC,MAAM,EAAE,aAAa,CAAC,MAAM;SAC7B,CAAC,CAAC;QAEH,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC7B,CAAC;CAGF;AA9FD,kCA8FC"}
|
package/lib/core/constants.d.ts
CHANGED
|
@@ -1,4 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default encodings that are treated as binary, they are compared with the `Content-Encoding` header.
|
|
3
|
+
*
|
|
4
|
+
* @breadcrumb Core / Constants
|
|
5
|
+
* @defaultValue ['gzip', 'deflate', 'br']
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
1
8
|
export declare const DEFAULT_BINARY_ENCODINGS: string[];
|
|
9
|
+
/**
|
|
10
|
+
* Default content types that are treated as binary, they are compared with the `Content-Type` header.
|
|
11
|
+
*
|
|
12
|
+
* @breadcrumb Core / Constants
|
|
13
|
+
* @defaultValue [new RegExp('^image/.*$'), new RegExp('^video/.*$'), 'application/pdf']
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
2
16
|
export declare const DEFAULT_BINARY_CONTENT_TYPES: (string | RegExp)[];
|
|
17
|
+
/**
|
|
18
|
+
* Type alias for empty response and can be used on some adapters when the adapter does not need to return a response.
|
|
19
|
+
*
|
|
20
|
+
* @breadcrumb Core / Constants
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
3
23
|
export declare type IEmptyResponse = {};
|
|
24
|
+
/**
|
|
25
|
+
* Constant for empty response and can be used on some adapters when the adapter does not need to return a response.
|
|
26
|
+
*
|
|
27
|
+
* @breadcrumb Core / Constants
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
4
30
|
export declare const EmptyResponse: IEmptyResponse;
|
|
31
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,EAA8B,CAAC;AAE5E;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAI3D,CAAC;AAEF;;;;;GAKG;AAEH,oBAAY,cAAc,GAAG,EAAE,CAAC;AAEhC;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,cAAmB,CAAC"}
|
package/lib/core/constants.js
CHANGED
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EmptyResponse = exports.DEFAULT_BINARY_CONTENT_TYPES = exports.DEFAULT_BINARY_ENCODINGS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Default encodings that are treated as binary, they are compared with the `Content-Encoding` header.
|
|
6
|
+
*
|
|
7
|
+
* @breadcrumb Core / Constants
|
|
8
|
+
* @defaultValue ['gzip', 'deflate', 'br']
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
4
11
|
exports.DEFAULT_BINARY_ENCODINGS = ['gzip', 'deflate', 'br'];
|
|
12
|
+
/**
|
|
13
|
+
* Default content types that are treated as binary, they are compared with the `Content-Type` header.
|
|
14
|
+
*
|
|
15
|
+
* @breadcrumb Core / Constants
|
|
16
|
+
* @defaultValue [new RegExp('^image/.*$'), new RegExp('^video/.*$'), 'application/pdf']
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
5
19
|
exports.DEFAULT_BINARY_CONTENT_TYPES = [
|
|
6
20
|
new RegExp('^image/.*$'),
|
|
7
21
|
new RegExp('^video/.*$'),
|
|
8
22
|
'application/pdf',
|
|
9
23
|
];
|
|
24
|
+
/**
|
|
25
|
+
* Constant for empty response and can be used on some adapters when the adapter does not need to return a response.
|
|
26
|
+
*
|
|
27
|
+
* @breadcrumb Core / Constants
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
10
30
|
exports.EmptyResponse = {};
|
|
31
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACU,QAAA,wBAAwB,GAAa,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAE5E;;;;;;GAMG;AACU,QAAA,4BAA4B,GAAwB;IAC/D,IAAI,MAAM,CAAC,YAAY,CAAC;IACxB,IAAI,MAAM,CAAC,YAAY,CAAC;IACxB,iBAAiB;CAClB,CAAC;AAWF;;;;;GAKG;AACU,QAAA,aAAa,GAAmB,EAAE,CAAC"}
|
|
@@ -1,37 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The type that represents the object that handles the references to the event created by the serverless trigger or context created by the serverless environment.
|
|
3
|
+
*
|
|
4
|
+
* @breadcrumb Core / Current Invoke
|
|
5
|
+
* @public
|
|
3
6
|
*/
|
|
4
7
|
export declare type CurrentInvoke<TEvent, TContext> = {
|
|
5
8
|
/**
|
|
6
9
|
* The event created by the serverless trigger
|
|
7
10
|
*
|
|
8
|
-
* @
|
|
11
|
+
* @remarks It's only null when you call {@link getCurrentInvoke} outside this library's pipeline.
|
|
9
12
|
*/
|
|
10
13
|
event: TEvent | null;
|
|
11
14
|
/**
|
|
12
15
|
* The context created by the serverless environment
|
|
13
16
|
*
|
|
14
|
-
* @
|
|
17
|
+
* @remarks It's only null when you call {@link getCurrentInvoke} outside this library's pipeline.
|
|
15
18
|
*/
|
|
16
19
|
context: TContext | null;
|
|
17
20
|
};
|
|
18
21
|
/**
|
|
19
22
|
* Get the reference to the event created by the serverless trigger or context created by the serverless environment.
|
|
20
23
|
*
|
|
21
|
-
* @example
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
22
26
|
* import type { ALBEvent, Context } from 'aws-lambda';
|
|
23
27
|
*
|
|
24
28
|
* // inside the method that handles the aws alb request.
|
|
25
29
|
* const { event, context } = getCurrentInvoke<ALBEvent, Context>();
|
|
26
30
|
* ```
|
|
31
|
+
*
|
|
32
|
+
* @breadcrumb Core / Current Invoke
|
|
33
|
+
* @public
|
|
27
34
|
*/
|
|
28
35
|
export declare function getCurrentInvoke<TEvent = any, TContext = any>(): CurrentInvoke<TEvent, TContext>;
|
|
29
36
|
/**
|
|
30
37
|
* Method that saves to the event created by the serverless trigger or context created by the serverless environment.
|
|
31
38
|
*
|
|
32
|
-
* @
|
|
39
|
+
* @remarks This method MUST NOT be called by you, this method MUST only be used internally in this library.
|
|
40
|
+
*
|
|
41
|
+
* @param event - The event created by the serverless trigger
|
|
42
|
+
* @param context - The context created by the serverless environment
|
|
33
43
|
*
|
|
34
|
-
* @
|
|
35
|
-
* @
|
|
44
|
+
* @breadcrumb Core / Current Invoke
|
|
45
|
+
* @public
|
|
36
46
|
*/
|
|
37
47
|
export declare function setCurrentInvoke<TEvent = any, TContext = any>({ event, context, }: CurrentInvoke<TEvent, TContext>): void;
|
|
48
|
+
//# sourceMappingURL=current-invoke.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"current-invoke.d.ts","sourceRoot":"","sources":["../../src/core/current-invoke.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,oBAAY,aAAa,CAAC,MAAM,EAAE,QAAQ,IAAI;IAC5C;;;;OAIG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB;;;;OAIG;IACH,OAAO,EAAE,QAAQ,GAAG,IAAI,CAAC;CAC1B,CAAC;AAOF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,GAAG,GAAG,EAAE,QAAQ,GAAG,GAAG,KAAK,aAAa,CAC7E,MAAM,EACN,QAAQ,CACT,CAEA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,GAAG,GAAG,EAAE,QAAQ,GAAG,GAAG,EAAE,EAC7D,KAAK,EACL,OAAO,GACR,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,QAGjC"}
|
|
@@ -8,12 +8,16 @@ const currentInvoke = {
|
|
|
8
8
|
/**
|
|
9
9
|
* Get the reference to the event created by the serverless trigger or context created by the serverless environment.
|
|
10
10
|
*
|
|
11
|
-
* @example
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
12
13
|
* import type { ALBEvent, Context } from 'aws-lambda';
|
|
13
14
|
*
|
|
14
15
|
* // inside the method that handles the aws alb request.
|
|
15
16
|
* const { event, context } = getCurrentInvoke<ALBEvent, Context>();
|
|
16
17
|
* ```
|
|
18
|
+
*
|
|
19
|
+
* @breadcrumb Core / Current Invoke
|
|
20
|
+
* @public
|
|
17
21
|
*/
|
|
18
22
|
function getCurrentInvoke() {
|
|
19
23
|
return currentInvoke;
|
|
@@ -22,13 +26,17 @@ exports.getCurrentInvoke = getCurrentInvoke;
|
|
|
22
26
|
/**
|
|
23
27
|
* Method that saves to the event created by the serverless trigger or context created by the serverless environment.
|
|
24
28
|
*
|
|
25
|
-
* @
|
|
29
|
+
* @remarks This method MUST NOT be called by you, this method MUST only be used internally in this library.
|
|
30
|
+
*
|
|
31
|
+
* @param event - The event created by the serverless trigger
|
|
32
|
+
* @param context - The context created by the serverless environment
|
|
26
33
|
*
|
|
27
|
-
* @
|
|
28
|
-
* @
|
|
34
|
+
* @breadcrumb Core / Current Invoke
|
|
35
|
+
* @public
|
|
29
36
|
*/
|
|
30
37
|
function setCurrentInvoke({ event, context, }) {
|
|
31
38
|
currentInvoke.event = event;
|
|
32
39
|
currentInvoke.context = context;
|
|
33
40
|
}
|
|
34
41
|
exports.setCurrentInvoke = setCurrentInvoke;
|
|
42
|
+
//# sourceMappingURL=current-invoke.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"current-invoke.js","sourceRoot":"","sources":["../../src/core/current-invoke.ts"],"names":[],"mappings":";;;AAsBA,MAAM,aAAa,GAA4B;IAC7C,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,IAAI;CACZ,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,SAAgB,gBAAgB;IAI9B,OAAO,aAAa,CAAC;AACvB,CAAC;AALD,4CAKC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,gBAAgB,CAA+B,EAC7D,KAAK,EACL,OAAO,GACyB;IAChC,aAAa,CAAC,KAAK,GAAG,KAAK,CAAC;IAC5B,aAAa,CAAC,OAAO,GAAG,OAAO,CAAC;AAClC,CAAC;AAND,4CAMC"}
|
package/lib/core/event-body.d.ts
CHANGED
|
@@ -2,15 +2,21 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Get the event body as buffer from body string with content length
|
|
4
4
|
*
|
|
5
|
-
* @example
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
6
7
|
* const body = '{}';
|
|
7
8
|
* const [buffer, contentLength] = getEventBodyAsBuffer(body, false);
|
|
8
9
|
* console.log(buffer);
|
|
9
10
|
* // <Buffer 7b 7d>
|
|
10
11
|
* console.log(contentLength);
|
|
11
12
|
* // 2
|
|
13
|
+
* ```
|
|
12
14
|
*
|
|
13
|
-
* @param body The body string that can be encoded or not
|
|
14
|
-
* @param isBase64Encoded Tells if body string is encoded in base64
|
|
15
|
+
* @param body - The body string that can be encoded or not
|
|
16
|
+
* @param isBase64Encoded - Tells if body string is encoded in base64
|
|
17
|
+
*
|
|
18
|
+
* @breadcrumb Core
|
|
19
|
+
* @public
|
|
15
20
|
*/
|
|
16
21
|
export declare function getEventBodyAsBuffer(body: string, isBase64Encoded: boolean): [body: Buffer, contentLength: number];
|
|
22
|
+
//# sourceMappingURL=event-body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-body.d.ts","sourceRoot":"","sources":["../../src/core/event-body.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,OAAO,GACvB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC,CAOvC"}
|
package/lib/core/event-body.js
CHANGED
|
@@ -4,16 +4,21 @@ exports.getEventBodyAsBuffer = void 0;
|
|
|
4
4
|
/**
|
|
5
5
|
* Get the event body as buffer from body string with content length
|
|
6
6
|
*
|
|
7
|
-
* @example
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
8
9
|
* const body = '{}';
|
|
9
10
|
* const [buffer, contentLength] = getEventBodyAsBuffer(body, false);
|
|
10
11
|
* console.log(buffer);
|
|
11
12
|
* // <Buffer 7b 7d>
|
|
12
13
|
* console.log(contentLength);
|
|
13
14
|
* // 2
|
|
15
|
+
* ```
|
|
14
16
|
*
|
|
15
|
-
* @param body The body string that can be encoded or not
|
|
16
|
-
* @param isBase64Encoded Tells if body string is encoded in base64
|
|
17
|
+
* @param body - The body string that can be encoded or not
|
|
18
|
+
* @param isBase64Encoded - Tells if body string is encoded in base64
|
|
19
|
+
*
|
|
20
|
+
* @breadcrumb Core
|
|
21
|
+
* @public
|
|
17
22
|
*/
|
|
18
23
|
function getEventBodyAsBuffer(body, isBase64Encoded) {
|
|
19
24
|
const encoding = isBase64Encoded ? 'base64' : 'utf8';
|
|
@@ -22,3 +27,4 @@ function getEventBodyAsBuffer(body, isBase64Encoded) {
|
|
|
22
27
|
return [buffer, contentLength];
|
|
23
28
|
}
|
|
24
29
|
exports.getEventBodyAsBuffer = getEventBodyAsBuffer;
|
|
30
|
+
//# sourceMappingURL=event-body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-body.js","sourceRoot":"","sources":["../../src/core/event-body.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,oBAAoB,CAClC,IAAY,EACZ,eAAwB;IAExB,MAAM,QAAQ,GAAmB,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;IAErE,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC3C,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAE1D,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AACjC,CAAC;AAVD,oDAUC"}
|
package/lib/core/headers.d.ts
CHANGED
|
@@ -2,26 +2,37 @@ import { BothValueHeaders } from '../@types';
|
|
|
2
2
|
/**
|
|
3
3
|
* Transform a header map and make sure the value is not an array
|
|
4
4
|
*
|
|
5
|
-
* @example
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
6
7
|
* const headers = { 'accept-encoding': 'gzip', 'accept-language': ['en-US', 'en;q=0.9'] };
|
|
7
8
|
* const flattenedHeaders = getFlattenedHeadersMap(headers, ',', true);
|
|
8
9
|
* console.log(flattenedHeaders);
|
|
9
10
|
* // { 'accept-encoding': 'gzip', 'accept-language': 'en-US,en;q=0.9' }
|
|
10
11
|
* ```
|
|
11
|
-
*
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
12
|
+
*
|
|
13
|
+
* @param headersMap - The initial headers
|
|
14
|
+
* @param separator - The separator used when we join the array of header's value
|
|
15
|
+
* @param lowerCaseKey - Should put all keys in lowercase
|
|
16
|
+
*
|
|
17
|
+
* @breadcrumb Core / Headers
|
|
18
|
+
* @public
|
|
14
19
|
*/
|
|
15
20
|
export declare function getFlattenedHeadersMap(headersMap: BothValueHeaders, separator?: string, lowerCaseKey?: boolean): Record<string, string>;
|
|
16
21
|
/**
|
|
17
22
|
* Transforms a header map into a multi-value map header.
|
|
18
23
|
*
|
|
19
|
-
* @example
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
20
26
|
* const headers = { 'accept-encoding': 'gzip', 'connection': ['keep-alive'] };
|
|
21
27
|
* const multiValueHeaders = getMultiValueHeadersMap(headers);
|
|
22
28
|
* console.log(multiValueHeaders);
|
|
23
29
|
* // { 'accept-encoding': ['gzip'], 'connection': ['keep-alive'] }
|
|
24
30
|
* ```
|
|
25
|
-
*
|
|
31
|
+
*
|
|
32
|
+
* @param headersMap - The initial headers
|
|
33
|
+
*
|
|
34
|
+
* @breadcrumb Core / Headers
|
|
35
|
+
* @public
|
|
26
36
|
*/
|
|
27
37
|
export declare function getMultiValueHeadersMap(headersMap: BothValueHeaders): Record<string, string[]>;
|
|
38
|
+
//# sourceMappingURL=headers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../src/core/headers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAI7C;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,gBAAgB,EAC5B,SAAS,GAAE,MAAY,EACvB,YAAY,GAAE,OAAe,GAC5B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAaxB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,gBAAgB,GAC3B,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAW1B"}
|
package/lib/core/headers.js
CHANGED
|
@@ -6,15 +6,20 @@ exports.getMultiValueHeadersMap = exports.getFlattenedHeadersMap = void 0;
|
|
|
6
6
|
/**
|
|
7
7
|
* Transform a header map and make sure the value is not an array
|
|
8
8
|
*
|
|
9
|
-
* @example
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
10
11
|
* const headers = { 'accept-encoding': 'gzip', 'accept-language': ['en-US', 'en;q=0.9'] };
|
|
11
12
|
* const flattenedHeaders = getFlattenedHeadersMap(headers, ',', true);
|
|
12
13
|
* console.log(flattenedHeaders);
|
|
13
14
|
* // { 'accept-encoding': 'gzip', 'accept-language': 'en-US,en;q=0.9' }
|
|
14
15
|
* ```
|
|
15
|
-
*
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
16
|
+
*
|
|
17
|
+
* @param headersMap - The initial headers
|
|
18
|
+
* @param separator - The separator used when we join the array of header's value
|
|
19
|
+
* @param lowerCaseKey - Should put all keys in lowercase
|
|
20
|
+
*
|
|
21
|
+
* @breadcrumb Core / Headers
|
|
22
|
+
* @public
|
|
18
23
|
*/
|
|
19
24
|
function getFlattenedHeadersMap(headersMap, separator = ',', lowerCaseKey = false) {
|
|
20
25
|
const commaDelimitedHeaders = {};
|
|
@@ -32,13 +37,18 @@ exports.getFlattenedHeadersMap = getFlattenedHeadersMap;
|
|
|
32
37
|
/**
|
|
33
38
|
* Transforms a header map into a multi-value map header.
|
|
34
39
|
*
|
|
35
|
-
* @example
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
36
42
|
* const headers = { 'accept-encoding': 'gzip', 'connection': ['keep-alive'] };
|
|
37
43
|
* const multiValueHeaders = getMultiValueHeadersMap(headers);
|
|
38
44
|
* console.log(multiValueHeaders);
|
|
39
45
|
* // { 'accept-encoding': ['gzip'], 'connection': ['keep-alive'] }
|
|
40
46
|
* ```
|
|
41
|
-
*
|
|
47
|
+
*
|
|
48
|
+
* @param headersMap - The initial headers
|
|
49
|
+
*
|
|
50
|
+
* @breadcrumb Core / Headers
|
|
51
|
+
* @public
|
|
42
52
|
*/
|
|
43
53
|
function getMultiValueHeadersMap(headersMap) {
|
|
44
54
|
const multiValueHeaders = {};
|
|
@@ -51,3 +61,4 @@ function getMultiValueHeadersMap(headersMap) {
|
|
|
51
61
|
return multiValueHeaders;
|
|
52
62
|
}
|
|
53
63
|
exports.getMultiValueHeadersMap = getMultiValueHeadersMap;
|
|
64
|
+
//# sourceMappingURL=headers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headers.js","sourceRoot":"","sources":["../../src/core/headers.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;AAIjB,YAAY;AAEZ;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,sBAAsB,CACpC,UAA4B,EAC5B,YAAoB,GAAG,EACvB,eAAwB,KAAK;IAE7B,MAAM,qBAAqB,GAA2B,EAAE,CAAC;IACzD,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAErD,KAAK,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,iBAAiB,EAAE;QACxD,MAAM,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QAElE,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC;YAC5B,qBAAqB,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;;YACzD,qBAAqB,CAAC,MAAM,CAAC,GAAG,WAAW,IAAI,EAAE,CAAC;KACxD;IAED,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAjBD,wDAiBC;AAED;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,uBAAuB,CACrC,UAA4B;IAE5B,MAAM,iBAAiB,GAA6B,EAAE,CAAC;IACvD,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAErD,KAAK,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,iBAAiB,EAAE;QACxD,iBAAiB,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC;YACrE,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC;YACzB,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;KAC3B;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAbD,0DAaC"}
|
package/lib/core/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
|
package/lib/core/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];
|
|
@@ -21,3 +25,4 @@ __exportStar(require("./no-op"), exports);
|
|
|
21
25
|
__exportStar(require("./optional"), exports);
|
|
22
26
|
__exportStar(require("./path"), exports);
|
|
23
27
|
__exportStar(require("./stream"), exports);
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,8CAA4B;AAC5B,mDAAiC;AACjC,+CAA6B;AAC7B,4CAA0B;AAC1B,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,6CAA2B;AAC3B,yCAAuB;AACvB,2CAAyB"}
|