@h4ad/serverless-adapter 2.10.0 → 2.12.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 +10 -3
- package/lib/@types/binary-settings.d.ts +0 -1
- package/lib/@types/digital-ocean/digital-ocean-http-event.d.ts +0 -1
- package/lib/@types/digital-ocean/digital-ocean-http-response.d.ts +0 -1
- package/lib/@types/digital-ocean/index.d.ts +0 -1
- package/lib/@types/headers.d.ts +0 -1
- package/lib/@types/helpers.d.ts +0 -1
- package/lib/@types/huawei/huawei-api-gateway-event.d.ts +0 -1
- package/lib/@types/huawei/huawei-api-gateway-response.d.ts +0 -1
- package/lib/@types/huawei/huawei-context.d.ts +0 -1
- package/lib/@types/huawei/index.d.ts +0 -1
- package/lib/@types/index.d.ts +0 -1
- package/lib/adapters/aws/alb.adapter.d.ts +0 -1
- package/lib/adapters/aws/api-gateway-v1.adapter.d.ts +0 -1
- package/lib/adapters/aws/api-gateway-v2.adapter.d.ts +0 -1
- package/lib/adapters/aws/dynamodb.adapter.d.ts +0 -1
- package/lib/adapters/aws/event-bridge.adapter.d.ts +0 -1
- package/lib/adapters/aws/index.d.ts +0 -1
- package/lib/adapters/aws/lambda-edge.adapter.d.ts +0 -1
- package/lib/adapters/aws/s3.adapter.d.ts +0 -1
- package/lib/adapters/aws/sns.adapter.d.ts +0 -1
- package/lib/adapters/aws/sqs.adapter.d.ts +0 -1
- package/lib/adapters/azure/http-trigger-v4.adapter.d.ts +0 -1
- package/lib/adapters/azure/index.d.ts +0 -1
- package/lib/adapters/digital-ocean/http-function.adapter.d.ts +0 -1
- package/lib/adapters/digital-ocean/index.d.ts +0 -1
- package/lib/adapters/dummy/dummy.adapter.d.ts +0 -1
- package/lib/adapters/dummy/index.d.ts +0 -1
- package/lib/adapters/huawei/huawei-api-gateway.adapter.d.ts +0 -1
- package/lib/adapters/huawei/index.d.ts +0 -1
- package/lib/contracts/adapter.contract.d.ts +0 -1
- package/lib/contracts/framework.contract.d.ts +0 -1
- package/lib/contracts/handler.contract.d.ts +0 -1
- package/lib/contracts/index.d.ts +0 -1
- package/lib/contracts/resolver.contract.d.ts +0 -1
- package/lib/core/base-handler.d.ts +0 -1
- package/lib/core/constants.d.ts +0 -1
- package/lib/core/current-invoke.d.ts +0 -1
- package/lib/core/event-body.d.ts +0 -1
- package/lib/core/headers.d.ts +0 -1
- package/lib/core/index.d.ts +0 -1
- package/lib/core/is-binary.d.ts +0 -1
- package/lib/core/logger.d.ts +0 -1
- package/lib/core/no-op.d.ts +0 -1
- package/lib/core/optional.d.ts +0 -1
- package/lib/core/path.d.ts +0 -1
- package/lib/core/stream.d.ts +9 -1
- package/lib/core/stream.js +19 -4
- package/lib/core/stream.js.map +1 -1
- package/lib/frameworks/body-parser/base-body-parser.framework.d.ts +66 -0
- package/lib/frameworks/body-parser/base-body-parser.framework.js +66 -0
- package/lib/frameworks/body-parser/base-body-parser.framework.js.map +1 -0
- package/lib/frameworks/body-parser/index.d.ts +5 -0
- package/lib/frameworks/body-parser/index.js +22 -0
- package/lib/frameworks/body-parser/index.js.map +1 -0
- package/lib/frameworks/body-parser/json-body-parser.framework.d.ts +26 -0
- package/lib/frameworks/body-parser/json-body-parser.framework.js +29 -0
- package/lib/frameworks/body-parser/json-body-parser.framework.js.map +1 -0
- package/lib/frameworks/body-parser/raw-body-parser.framework.d.ts +26 -0
- package/lib/frameworks/body-parser/raw-body-parser.framework.js +29 -0
- package/lib/frameworks/body-parser/raw-body-parser.framework.js.map +1 -0
- package/lib/frameworks/body-parser/text-body-parser.framework.d.ts +26 -0
- package/lib/frameworks/body-parser/text-body-parser.framework.js +29 -0
- package/lib/frameworks/body-parser/text-body-parser.framework.js.map +1 -0
- package/lib/frameworks/body-parser/urlencoded-body-parser.framework.d.ts +26 -0
- package/lib/frameworks/body-parser/urlencoded-body-parser.framework.js +29 -0
- package/lib/frameworks/body-parser/urlencoded-body-parser.framework.js.map +1 -0
- package/lib/frameworks/cors/cors.framework.d.ts +78 -0
- package/lib/frameworks/cors/cors.framework.js +145 -0
- package/lib/frameworks/cors/cors.framework.js.map +1 -0
- package/lib/frameworks/cors/index.d.ts +1 -0
- package/lib/frameworks/cors/index.js +18 -0
- package/lib/frameworks/cors/index.js.map +1 -0
- package/lib/frameworks/deepkit/http-deepkit.framework.d.ts +0 -1
- package/lib/frameworks/deepkit/index.d.ts +0 -1
- package/lib/frameworks/express/express.framework.d.ts +0 -1
- package/lib/frameworks/express/index.d.ts +0 -1
- package/lib/frameworks/fastify/fastify.framework.d.ts +0 -1
- package/lib/frameworks/fastify/helpers/no-op-content-parser.d.ts +13 -0
- package/lib/frameworks/fastify/helpers/no-op-content-parser.js +27 -0
- package/lib/frameworks/fastify/helpers/no-op-content-parser.js.map +1 -0
- package/lib/frameworks/fastify/index.d.ts +0 -1
- package/lib/frameworks/hapi/hapi.framework.d.ts +0 -1
- 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 -1
- package/lib/frameworks/lazy/index.d.ts +0 -1
- package/lib/frameworks/lazy/lazy.framework.d.ts +0 -1
- package/lib/frameworks/trpc/index.d.ts +0 -1
- package/lib/frameworks/trpc/trpc.framework.d.ts +0 -1
- package/lib/handlers/azure/azure.handler.d.ts +0 -1
- package/lib/handlers/azure/index.d.ts +0 -1
- package/lib/handlers/default/default.handler.d.ts +0 -1
- package/lib/handlers/default/index.d.ts +0 -1
- package/lib/handlers/digital-ocean/digital-ocean.handler.d.ts +0 -1
- package/lib/handlers/digital-ocean/index.d.ts +0 -1
- package/lib/handlers/firebase/http-firebase.handler.d.ts +0 -1
- package/lib/handlers/firebase/index.d.ts +0 -1
- package/lib/handlers/huawei/http-huawei.handler.d.ts +0 -1
- package/lib/handlers/huawei/index.d.ts +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/network/index.d.ts +0 -1
- package/lib/network/request.d.ts +0 -1
- package/lib/network/response.d.ts +0 -1
- package/lib/resolvers/aws-context/aws-context.resolver.d.ts +0 -1
- package/lib/resolvers/aws-context/index.d.ts +0 -1
- package/lib/resolvers/callback/callback.resolver.d.ts +0 -1
- package/lib/resolvers/callback/index.d.ts +0 -1
- package/lib/resolvers/dummy/dummy.resolver.d.ts +0 -1
- 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 -1
- package/lib/serverless-adapter.d.ts +0 -1
- package/package.json +23 -4
- package/lib/@types/binary-settings.d.ts.map +0 -1
- package/lib/@types/digital-ocean/digital-ocean-http-event.d.ts.map +0 -1
- package/lib/@types/digital-ocean/digital-ocean-http-response.d.ts.map +0 -1
- package/lib/@types/digital-ocean/index.d.ts.map +0 -1
- package/lib/@types/headers.d.ts.map +0 -1
- package/lib/@types/helpers.d.ts.map +0 -1
- package/lib/@types/huawei/huawei-api-gateway-event.d.ts.map +0 -1
- package/lib/@types/huawei/huawei-api-gateway-response.d.ts.map +0 -1
- package/lib/@types/huawei/huawei-context.d.ts.map +0 -1
- package/lib/@types/huawei/index.d.ts.map +0 -1
- package/lib/@types/index.d.ts.map +0 -1
- package/lib/adapters/aws/alb.adapter.d.ts.map +0 -1
- package/lib/adapters/aws/api-gateway-v1.adapter.d.ts.map +0 -1
- package/lib/adapters/aws/api-gateway-v2.adapter.d.ts.map +0 -1
- package/lib/adapters/aws/dynamodb.adapter.d.ts.map +0 -1
- package/lib/adapters/aws/event-bridge.adapter.d.ts.map +0 -1
- package/lib/adapters/aws/index.d.ts.map +0 -1
- package/lib/adapters/aws/lambda-edge.adapter.d.ts.map +0 -1
- package/lib/adapters/aws/s3.adapter.d.ts.map +0 -1
- package/lib/adapters/aws/sns.adapter.d.ts.map +0 -1
- package/lib/adapters/aws/sqs.adapter.d.ts.map +0 -1
- package/lib/adapters/azure/http-trigger-v4.adapter.d.ts.map +0 -1
- package/lib/adapters/azure/index.d.ts.map +0 -1
- package/lib/adapters/digital-ocean/http-function.adapter.d.ts.map +0 -1
- package/lib/adapters/digital-ocean/index.d.ts.map +0 -1
- package/lib/adapters/dummy/dummy.adapter.d.ts.map +0 -1
- package/lib/adapters/dummy/index.d.ts.map +0 -1
- package/lib/adapters/huawei/huawei-api-gateway.adapter.d.ts.map +0 -1
- package/lib/adapters/huawei/index.d.ts.map +0 -1
- package/lib/contracts/adapter.contract.d.ts.map +0 -1
- package/lib/contracts/framework.contract.d.ts.map +0 -1
- package/lib/contracts/handler.contract.d.ts.map +0 -1
- package/lib/contracts/index.d.ts.map +0 -1
- package/lib/contracts/resolver.contract.d.ts.map +0 -1
- package/lib/core/base-handler.d.ts.map +0 -1
- package/lib/core/constants.d.ts.map +0 -1
- package/lib/core/current-invoke.d.ts.map +0 -1
- package/lib/core/event-body.d.ts.map +0 -1
- package/lib/core/headers.d.ts.map +0 -1
- package/lib/core/index.d.ts.map +0 -1
- package/lib/core/is-binary.d.ts.map +0 -1
- package/lib/core/logger.d.ts.map +0 -1
- package/lib/core/no-op.d.ts.map +0 -1
- package/lib/core/optional.d.ts.map +0 -1
- package/lib/core/path.d.ts.map +0 -1
- package/lib/core/stream.d.ts.map +0 -1
- package/lib/frameworks/deepkit/http-deepkit.framework.d.ts.map +0 -1
- package/lib/frameworks/deepkit/index.d.ts.map +0 -1
- package/lib/frameworks/express/express.framework.d.ts.map +0 -1
- package/lib/frameworks/express/index.d.ts.map +0 -1
- package/lib/frameworks/fastify/fastify.framework.d.ts.map +0 -1
- package/lib/frameworks/fastify/index.d.ts.map +0 -1
- package/lib/frameworks/hapi/hapi.framework.d.ts.map +0 -1
- package/lib/frameworks/hapi/index.d.ts.map +0 -1
- package/lib/frameworks/koa/index.d.ts.map +0 -1
- package/lib/frameworks/koa/koa.framework.d.ts.map +0 -1
- package/lib/frameworks/lazy/index.d.ts.map +0 -1
- package/lib/frameworks/lazy/lazy.framework.d.ts.map +0 -1
- package/lib/frameworks/trpc/index.d.ts.map +0 -1
- package/lib/frameworks/trpc/trpc.framework.d.ts.map +0 -1
- package/lib/handlers/azure/azure.handler.d.ts.map +0 -1
- package/lib/handlers/azure/index.d.ts.map +0 -1
- package/lib/handlers/default/default.handler.d.ts.map +0 -1
- package/lib/handlers/default/index.d.ts.map +0 -1
- package/lib/handlers/digital-ocean/digital-ocean.handler.d.ts.map +0 -1
- package/lib/handlers/digital-ocean/index.d.ts.map +0 -1
- package/lib/handlers/firebase/http-firebase.handler.d.ts.map +0 -1
- package/lib/handlers/firebase/index.d.ts.map +0 -1
- package/lib/handlers/huawei/http-huawei.handler.d.ts.map +0 -1
- package/lib/handlers/huawei/index.d.ts.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/network/index.d.ts.map +0 -1
- package/lib/network/request.d.ts.map +0 -1
- package/lib/network/response.d.ts.map +0 -1
- package/lib/resolvers/aws-context/aws-context.resolver.d.ts.map +0 -1
- package/lib/resolvers/aws-context/index.d.ts.map +0 -1
- package/lib/resolvers/callback/callback.resolver.d.ts.map +0 -1
- package/lib/resolvers/callback/index.d.ts.map +0 -1
- package/lib/resolvers/dummy/dummy.resolver.d.ts.map +0 -1
- package/lib/resolvers/dummy/index.d.ts.map +0 -1
- package/lib/resolvers/promise/index.d.ts.map +0 -1
- package/lib/resolvers/promise/promise.resolver.d.ts.map +0 -1
- package/lib/serverless-adapter.d.ts.map +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Options } from 'body-parser';
|
|
2
|
+
import { FrameworkContract } from '../../contracts';
|
|
3
|
+
import { BaseBodyParserFramework, BodyParserOptions } from './base-body-parser.framework';
|
|
4
|
+
/**
|
|
5
|
+
* The body-parser options for application/octet-stream
|
|
6
|
+
*
|
|
7
|
+
* @remarks {@link https://github.com/expressjs/body-parser#bodyparserrawoptions}
|
|
8
|
+
*
|
|
9
|
+
* @breadcrumb Frameworks / BodyParserFramework / RawBodyParserFramework
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare type RawBodyParserFrameworkOptions = Options & BodyParserOptions;
|
|
13
|
+
/**
|
|
14
|
+
* The body-parser class used to parse application/octet-stream.
|
|
15
|
+
*
|
|
16
|
+
* @breadcrumb Frameworks / BodyParserFramework / RawBodyParserFramework
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare class RawBodyParserFramework<TApp> extends BaseBodyParserFramework<TApp> implements FrameworkContract<TApp> {
|
|
20
|
+
protected readonly framework: FrameworkContract<TApp>;
|
|
21
|
+
/**
|
|
22
|
+
* Default Constructor
|
|
23
|
+
*/
|
|
24
|
+
constructor(framework: FrameworkContract<TApp>, options?: RawBodyParserFrameworkOptions);
|
|
25
|
+
}
|
|
26
|
+
export declare type __ΩRawBodyParserFrameworkOptions = any[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RawBodyParserFramework = exports.__ΩRawBodyParserFrameworkOptions = void 0;
|
|
4
|
+
const { __ΩFrameworkContract } = require('../../contracts');
|
|
5
|
+
const { __ΩBodyParserOptions } = require('./base-body-parser.framework');
|
|
6
|
+
//#region Imports
|
|
7
|
+
const body_parser_1 = require("body-parser");
|
|
8
|
+
const base_body_parser_framework_1 = require("./base-body-parser.framework");
|
|
9
|
+
const __ΩRawBodyParserFrameworkOptions = [() => __ΩBodyParserOptions, 'P!n!K'];
|
|
10
|
+
exports.__ΩRawBodyParserFrameworkOptions = __ΩRawBodyParserFrameworkOptions;
|
|
11
|
+
/**
|
|
12
|
+
* The body-parser class used to parse application/octet-stream.
|
|
13
|
+
*
|
|
14
|
+
* @breadcrumb Frameworks / BodyParserFramework / RawBodyParserFramework
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
class RawBodyParserFramework extends base_body_parser_framework_1.BaseBodyParserFramework {
|
|
18
|
+
//#region Constructor
|
|
19
|
+
/**
|
|
20
|
+
* Default Constructor
|
|
21
|
+
*/
|
|
22
|
+
constructor(framework, options) {
|
|
23
|
+
super(framework, (0, body_parser_1.raw)(options), options);
|
|
24
|
+
this.framework = framework;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.RawBodyParserFramework = RawBodyParserFramework;
|
|
28
|
+
RawBodyParserFramework.__type = ['TApp', () => base_body_parser_framework_1.BaseBodyParserFramework, () => __ΩFrameworkContract, 'framework', () => __ΩRawBodyParserFrameworkOptions, 'options', 'constructor', 'b!Pe"!7"Pe"!o#"2$<9n%2&8"0\'5e!!6"'];
|
|
29
|
+
//# sourceMappingURL=raw-body-parser.framework.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raw-body-parser.framework.js","sourceRoot":"","sources":["../../../src/frameworks/body-parser/raw-body-parser.framework.ts"],"names":[],"mappings":";;;yCAGkC,iBAAiB;yCAI5C,8BAA8B;AAPrC,iBAAiB;AAEjB,6CAA2C;AAE3C,6EAGsC;;;AActC;;;;;GAKG;AACH,MAAa,sBACX,SAAQ,oDAA6B;IAGrC,qBAAqB;IAErB;;OAEG;IACH,YACqB,SAAkC,EACrD,OAAuC;QAEvC,KAAK,CAAC,SAAS,EAAE,IAAA,iBAAG,EAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;QAHrB,cAAS,GAAT,SAAS,CAAyB;IAIvD,CAAC;;AAdH,wDAiBC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { OptionsText } from 'body-parser';
|
|
2
|
+
import { FrameworkContract } from '../../contracts';
|
|
3
|
+
import { BaseBodyParserFramework, BodyParserOptions } from './base-body-parser.framework';
|
|
4
|
+
/**
|
|
5
|
+
* The body-parser options for text/plain
|
|
6
|
+
*
|
|
7
|
+
* @remarks {@link https://github.com/expressjs/body-parser#bodyparsertextoptions}
|
|
8
|
+
*
|
|
9
|
+
* @breadcrumb Frameworks / BodyParserFramework / TextBodyParserFramework
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare type TextBodyParserFrameworkOptions = OptionsText & BodyParserOptions;
|
|
13
|
+
/**
|
|
14
|
+
* The body-parser class used to parse text/plain.
|
|
15
|
+
*
|
|
16
|
+
* @breadcrumb Frameworks / BodyParserFramework / TextBodyParserFramework
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare class TextBodyParserFramework<TApp> extends BaseBodyParserFramework<TApp> implements FrameworkContract<TApp> {
|
|
20
|
+
protected readonly framework: FrameworkContract<TApp>;
|
|
21
|
+
/**
|
|
22
|
+
* Default Constructor
|
|
23
|
+
*/
|
|
24
|
+
constructor(framework: FrameworkContract<TApp>, options?: TextBodyParserFrameworkOptions);
|
|
25
|
+
}
|
|
26
|
+
export declare type __ΩTextBodyParserFrameworkOptions = any[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextBodyParserFramework = exports.__ΩTextBodyParserFrameworkOptions = void 0;
|
|
4
|
+
const { __ΩFrameworkContract } = require('../../contracts');
|
|
5
|
+
const { __ΩBodyParserOptions } = require('./base-body-parser.framework');
|
|
6
|
+
//#region Imports
|
|
7
|
+
const body_parser_1 = require("body-parser");
|
|
8
|
+
const base_body_parser_framework_1 = require("./base-body-parser.framework");
|
|
9
|
+
const __ΩTextBodyParserFrameworkOptions = [() => __ΩBodyParserOptions, 'P!n!K'];
|
|
10
|
+
exports.__ΩTextBodyParserFrameworkOptions = __ΩTextBodyParserFrameworkOptions;
|
|
11
|
+
/**
|
|
12
|
+
* The body-parser class used to parse text/plain.
|
|
13
|
+
*
|
|
14
|
+
* @breadcrumb Frameworks / BodyParserFramework / TextBodyParserFramework
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
class TextBodyParserFramework extends base_body_parser_framework_1.BaseBodyParserFramework {
|
|
18
|
+
//#region Constructor
|
|
19
|
+
/**
|
|
20
|
+
* Default Constructor
|
|
21
|
+
*/
|
|
22
|
+
constructor(framework, options) {
|
|
23
|
+
super(framework, (0, body_parser_1.text)(options), options);
|
|
24
|
+
this.framework = framework;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.TextBodyParserFramework = TextBodyParserFramework;
|
|
28
|
+
TextBodyParserFramework.__type = ['TApp', () => base_body_parser_framework_1.BaseBodyParserFramework, () => __ΩFrameworkContract, 'framework', () => __ΩTextBodyParserFrameworkOptions, 'options', 'constructor', 'b!Pe"!7"Pe"!o#"2$<9n%2&8"0\'5e!!6"'];
|
|
29
|
+
//# sourceMappingURL=text-body-parser.framework.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-body-parser.framework.js","sourceRoot":"","sources":["../../../src/frameworks/body-parser/text-body-parser.framework.ts"],"names":[],"mappings":";;;yCAGkC,iBAAiB;yCAI5C,8BAA8B;AAPrC,iBAAiB;AAEjB,6CAAgD;AAEhD,6EAGsC;;;AActC;;;;;GAKG;AACH,MAAa,uBACX,SAAQ,oDAA6B;IAGrC,qBAAqB;IAErB;;OAEG;IACH,YACqB,SAAkC,EACrD,OAAwC;QAExC,KAAK,CAAC,SAAS,EAAE,IAAA,kBAAI,EAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;QAHtB,cAAS,GAAT,SAAS,CAAyB;IAIvD,CAAC;;AAdH,0DAiBC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { OptionsUrlencoded } from 'body-parser';
|
|
2
|
+
import { FrameworkContract } from '../../contracts';
|
|
3
|
+
import { BaseBodyParserFramework, BodyParserOptions } from './base-body-parser.framework';
|
|
4
|
+
/**
|
|
5
|
+
* The body parser options for application/x-www-form-urlencoded
|
|
6
|
+
*
|
|
7
|
+
* @remarks {@link https://github.com/expressjs/body-parser#bodyparserurlencodedoptions}
|
|
8
|
+
*
|
|
9
|
+
* @breadcrumb Frameworks / BodyParserFramework / UrlencodedBodyParserFramework
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare type UrlencodedBodyParserFrameworkOptions = OptionsUrlencoded & BodyParserOptions;
|
|
13
|
+
/**
|
|
14
|
+
* The body-parser class used to parse application/x-www-form-urlencoded.
|
|
15
|
+
*
|
|
16
|
+
* @breadcrumb Frameworks / BodyParserFramework / UrlencodedBodyParserFramework
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare class UrlencodedBodyParserFramework<TApp> extends BaseBodyParserFramework<TApp> implements FrameworkContract<TApp> {
|
|
20
|
+
protected readonly framework: FrameworkContract<TApp>;
|
|
21
|
+
/**
|
|
22
|
+
* Default Constructor
|
|
23
|
+
*/
|
|
24
|
+
constructor(framework: FrameworkContract<TApp>, options?: UrlencodedBodyParserFrameworkOptions);
|
|
25
|
+
}
|
|
26
|
+
export declare type __ΩUrlencodedBodyParserFrameworkOptions = any[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UrlencodedBodyParserFramework = exports.__ΩUrlencodedBodyParserFrameworkOptions = void 0;
|
|
4
|
+
const { __ΩFrameworkContract } = require('../../contracts');
|
|
5
|
+
const { __ΩBodyParserOptions } = require('./base-body-parser.framework');
|
|
6
|
+
//#region Imports
|
|
7
|
+
const body_parser_1 = require("body-parser");
|
|
8
|
+
const base_body_parser_framework_1 = require("./base-body-parser.framework");
|
|
9
|
+
const __ΩUrlencodedBodyParserFrameworkOptions = [() => __ΩBodyParserOptions, 'P!n!K'];
|
|
10
|
+
exports.__ΩUrlencodedBodyParserFrameworkOptions = __ΩUrlencodedBodyParserFrameworkOptions;
|
|
11
|
+
/**
|
|
12
|
+
* The body-parser class used to parse application/x-www-form-urlencoded.
|
|
13
|
+
*
|
|
14
|
+
* @breadcrumb Frameworks / BodyParserFramework / UrlencodedBodyParserFramework
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
class UrlencodedBodyParserFramework extends base_body_parser_framework_1.BaseBodyParserFramework {
|
|
18
|
+
//#region Constructor
|
|
19
|
+
/**
|
|
20
|
+
* Default Constructor
|
|
21
|
+
*/
|
|
22
|
+
constructor(framework, options) {
|
|
23
|
+
super(framework, (0, body_parser_1.urlencoded)(options), options);
|
|
24
|
+
this.framework = framework;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.UrlencodedBodyParserFramework = UrlencodedBodyParserFramework;
|
|
28
|
+
UrlencodedBodyParserFramework.__type = ['TApp', () => base_body_parser_framework_1.BaseBodyParserFramework, () => __ΩFrameworkContract, 'framework', () => __ΩUrlencodedBodyParserFrameworkOptions, 'options', 'constructor', 'b!Pe"!7"Pe"!o#"2$<9n%2&8"0\'5e!!6"'];
|
|
29
|
+
//# sourceMappingURL=urlencoded-body-parser.framework.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urlencoded-body-parser.framework.js","sourceRoot":"","sources":["../../../src/frameworks/body-parser/urlencoded-body-parser.framework.ts"],"names":[],"mappings":";;;yCAGkC,iBAAiB;yCAI5C,8BAA8B;AAPrC,iBAAiB;AAEjB,6CAA4D;AAE5D,6EAGsC;;;AAetC;;;;;GAKG;AACH,MAAa,6BACX,SAAQ,oDAA6B;IAGrC,qBAAqB;IAErB;;OAEG;IACH,YACqB,SAAkC,EACrD,OAA8C;QAE9C,KAAK,CAAC,SAAS,EAAE,IAAA,wBAAU,EAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;QAH5B,cAAS,GAAT,SAAS,CAAyB;IAIvD,CAAC;;AAdH,sEAiBC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { IncomingMessage, ServerResponse } from 'http';
|
|
3
|
+
import cors, { CorsOptions } from 'cors';
|
|
4
|
+
import { FrameworkContract } from '../../contracts';
|
|
5
|
+
/**
|
|
6
|
+
* The options to customize {@link CorsFramework}
|
|
7
|
+
*
|
|
8
|
+
* @breadcrumb Frameworks / CorsFramework
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare type CorsFrameworkOptions = CorsOptions & {
|
|
12
|
+
/**
|
|
13
|
+
* Send error 403 when cors is invalid. From what I read in `cors`, `fastify/cors` and [this problem](https://stackoverflow.com/questions/57212248/why-is-http-request-been-processed-in-action-even-when-cors-is-not-enabled)
|
|
14
|
+
* it is normal to process the request even if the origin is invalid.
|
|
15
|
+
* So this option will respond with error if this method was called from an invalid origin (or not allowed method) like [access control lib](https://github.com/primus/access-control/blob/master/index.js#L95-L115) .
|
|
16
|
+
*
|
|
17
|
+
* @defaultValue true
|
|
18
|
+
*/
|
|
19
|
+
forbiddenOnInvalidOriginOrMethod?: boolean;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The framework that handles cors for your api without relying on internals of the framework
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* import express from 'express';
|
|
27
|
+
* import { ServerlessAdapter } from '@h4ad/serverless-adapter';
|
|
28
|
+
* import { ExpressFramework } from '@h4ad/serverless-adapter/lib/frameworks/express';
|
|
29
|
+
* import { CorsFramework } from '@h4ad/serverless-adapter/lib/frameworks/cors';
|
|
30
|
+
*
|
|
31
|
+
* const expressFramework = new ExpressFramework();
|
|
32
|
+
* const options: CorsOptions = {}; // customize the options
|
|
33
|
+
* const framework = new CorsFramework(expressFramework, options);
|
|
34
|
+
*
|
|
35
|
+
* export const handler = ServerlessAdapter.new(null)
|
|
36
|
+
* .setFramework(framework)
|
|
37
|
+
* // set other configurations and then build
|
|
38
|
+
* .build();
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @breadcrumb Frameworks / CorsFramework
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
export declare class CorsFramework<TApp> implements FrameworkContract<TApp> {
|
|
45
|
+
protected readonly framework: FrameworkContract<TApp>;
|
|
46
|
+
protected readonly options?: CorsFrameworkOptions | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Default Constructor
|
|
49
|
+
*/
|
|
50
|
+
constructor(framework: FrameworkContract<TApp>, options?: CorsFrameworkOptions | undefined);
|
|
51
|
+
/**
|
|
52
|
+
* All cors headers that can be added by cors package
|
|
53
|
+
*/
|
|
54
|
+
protected readonly corsHeaders: string[];
|
|
55
|
+
/**
|
|
56
|
+
* The cached instance of cors
|
|
57
|
+
*/
|
|
58
|
+
protected readonly cachedCorsInstance: ReturnType<typeof cors>;
|
|
59
|
+
/**
|
|
60
|
+
* {@inheritDoc}
|
|
61
|
+
*/
|
|
62
|
+
sendRequest(app: TApp, request: IncomingMessage, response: ServerResponse): void;
|
|
63
|
+
/**
|
|
64
|
+
* Handle next execution called by the cors package
|
|
65
|
+
*/
|
|
66
|
+
protected onCorsNext(app: TApp, request: IncomingMessage, response: ServerResponse): () => void;
|
|
67
|
+
/**
|
|
68
|
+
* Format the headers to be standardized with the rest of the library, such as ApiGatewayV2.
|
|
69
|
+
* Also, some frameworks don't support headers as an array, so we need to format the values.
|
|
70
|
+
*/
|
|
71
|
+
protected formatHeaderValuesAddedByCorsPackage(response: ServerResponse): void;
|
|
72
|
+
/**
|
|
73
|
+
* Check if the origin is invalid or if the method is not allowed.
|
|
74
|
+
* Highly inspired by [access-control](https://github.com/primus/access-control/blob/master/index.js#L95-L115)
|
|
75
|
+
*/
|
|
76
|
+
protected isInvalidOriginOrMethodIsNotAllowed(request: IncomingMessage, allowedOrigin: number | string | string[] | undefined): boolean;
|
|
77
|
+
}
|
|
78
|
+
export declare type __ΩCorsFrameworkOptions = any[];
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CorsFramework = exports.__ΩCorsFrameworkOptions = void 0;
|
|
7
|
+
const { __ΩFrameworkContract } = require('../../contracts');
|
|
8
|
+
function __assignType(fn, args) {
|
|
9
|
+
fn.__type = args;
|
|
10
|
+
return fn;
|
|
11
|
+
}
|
|
12
|
+
const __ΩReturnType = ['T', 'args', '', 'l>e"!R"RPde#!P"@2"h"!/#qk#\'QRb!Pde"!p)'];
|
|
13
|
+
const cors_1 = __importDefault(require("cors"));
|
|
14
|
+
const core_1 = require("../../core");
|
|
15
|
+
const __ΩCorsFrameworkOptions = ['forbiddenOnInvalidOriginOrMethod', 'P!P)4!8MK'];
|
|
16
|
+
exports.__ΩCorsFrameworkOptions = __ΩCorsFrameworkOptions;
|
|
17
|
+
/**
|
|
18
|
+
* The framework that handles cors for your api without relying on internals of the framework
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import express from 'express';
|
|
23
|
+
* import { ServerlessAdapter } from '@h4ad/serverless-adapter';
|
|
24
|
+
* import { ExpressFramework } from '@h4ad/serverless-adapter/lib/frameworks/express';
|
|
25
|
+
* import { CorsFramework } from '@h4ad/serverless-adapter/lib/frameworks/cors';
|
|
26
|
+
*
|
|
27
|
+
* const expressFramework = new ExpressFramework();
|
|
28
|
+
* const options: CorsOptions = {}; // customize the options
|
|
29
|
+
* const framework = new CorsFramework(expressFramework, options);
|
|
30
|
+
*
|
|
31
|
+
* export const handler = ServerlessAdapter.new(null)
|
|
32
|
+
* .setFramework(framework)
|
|
33
|
+
* // set other configurations and then build
|
|
34
|
+
* .build();
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @breadcrumb Frameworks / CorsFramework
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
class CorsFramework {
|
|
41
|
+
//#region Constructor
|
|
42
|
+
/**
|
|
43
|
+
* Default Constructor
|
|
44
|
+
*/
|
|
45
|
+
constructor(framework, options) {
|
|
46
|
+
this.framework = framework;
|
|
47
|
+
this.options = options;
|
|
48
|
+
//#endregion
|
|
49
|
+
/**
|
|
50
|
+
* All cors headers that can be added by cors package
|
|
51
|
+
*/
|
|
52
|
+
this.corsHeaders = [
|
|
53
|
+
'Access-Control-Max-Age',
|
|
54
|
+
'Access-Control-Expose-Headers',
|
|
55
|
+
'Access-Control-Allow-Headers',
|
|
56
|
+
'Access-Control-Request-Headers',
|
|
57
|
+
'Access-Control-Allow-Credentials',
|
|
58
|
+
'Access-Control-Allow-Methods',
|
|
59
|
+
'Access-Control-Allow-Origin',
|
|
60
|
+
];
|
|
61
|
+
this.cachedCorsInstance = (0, cors_1.default)(this.options);
|
|
62
|
+
}
|
|
63
|
+
//#region Public Methods
|
|
64
|
+
/**
|
|
65
|
+
* {@inheritDoc}
|
|
66
|
+
*/
|
|
67
|
+
sendRequest(app, request, response) {
|
|
68
|
+
this.cachedCorsInstance(request, response, this.onCorsNext(app, request, response));
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region Protected Methods
|
|
72
|
+
/**
|
|
73
|
+
* Handle next execution called by the cors package
|
|
74
|
+
*/
|
|
75
|
+
onCorsNext(app, request, response) {
|
|
76
|
+
return () => {
|
|
77
|
+
var _a;
|
|
78
|
+
this.formatHeaderValuesAddedByCorsPackage(response);
|
|
79
|
+
const errorOnInvalidOrigin = (0, core_1.getDefaultIfUndefined)((_a = this.options) === null || _a === void 0 ? void 0 : _a.forbiddenOnInvalidOriginOrMethod, true);
|
|
80
|
+
if (errorOnInvalidOrigin) {
|
|
81
|
+
const allowedOrigin = response.getHeader('access-control-allow-origin');
|
|
82
|
+
const isInvalidOrigin = this.isInvalidOriginOrMethodIsNotAllowed(request, allowedOrigin);
|
|
83
|
+
if (isInvalidOrigin) {
|
|
84
|
+
response.statusCode = 403;
|
|
85
|
+
response.setHeader('Content-Type', 'text/plain');
|
|
86
|
+
response.end([
|
|
87
|
+
'Invalid HTTP Access Control (CORS) request:',
|
|
88
|
+
` Origin: ${request.headers.origin}`,
|
|
89
|
+
` Method: ${request.method}`,
|
|
90
|
+
].join('\n'));
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
this.framework.sendRequest(app, request, response);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Format the headers to be standardized with the rest of the library, such as ApiGatewayV2.
|
|
99
|
+
* Also, some frameworks don't support headers as an array, so we need to format the values.
|
|
100
|
+
*/
|
|
101
|
+
formatHeaderValuesAddedByCorsPackage(response) {
|
|
102
|
+
for (const corsHeader of this.corsHeaders) {
|
|
103
|
+
const value = response.getHeader(corsHeader);
|
|
104
|
+
if (value === undefined)
|
|
105
|
+
continue;
|
|
106
|
+
response.removeHeader(corsHeader);
|
|
107
|
+
response.setHeader(corsHeader.toLowerCase(), Array.isArray(value) ? value.join(',') : value);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Check if the origin is invalid or if the method is not allowed.
|
|
112
|
+
* Highly inspired by [access-control](https://github.com/primus/access-control/blob/master/index.js#L95-L115)
|
|
113
|
+
*/
|
|
114
|
+
isInvalidOriginOrMethodIsNotAllowed(request, allowedOrigin) {
|
|
115
|
+
var _a;
|
|
116
|
+
if (!allowedOrigin)
|
|
117
|
+
return true;
|
|
118
|
+
if (!!request.headers.origin &&
|
|
119
|
+
allowedOrigin !== '*' &&
|
|
120
|
+
request.headers.origin !== allowedOrigin)
|
|
121
|
+
return true;
|
|
122
|
+
const notPermitedInMethods = this.options &&
|
|
123
|
+
Array.isArray(this.options.methods) &&
|
|
124
|
+
this.options.methods.every(__assignType(m => { var _a; return m.toLowerCase() !== ((_a = request.method) === null || _a === void 0 ? void 0 : _a.toLowerCase()); }, ['m', '', 'P"2!"/"']));
|
|
125
|
+
const differentMethod = this.options &&
|
|
126
|
+
typeof this.options.methods === 'string' &&
|
|
127
|
+
this.options.methods
|
|
128
|
+
.split(',')
|
|
129
|
+
.every(__assignType(m => { var _a; return m.trim().toLowerCase() !== ((_a = request.method) === null || _a === void 0 ? void 0 : _a.toLowerCase()); }, ['m', '', 'P"2!"/"']));
|
|
130
|
+
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.methods) && (notPermitedInMethods || differentMethod))
|
|
131
|
+
return true;
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
exports.CorsFramework = CorsFramework;
|
|
136
|
+
CorsFramework.__type = ['TApp', () => __ΩFrameworkContract, 'framework', () => __ΩCorsFrameworkOptions, 'options', 'constructor', 'corsHeaders', function () { return [
|
|
137
|
+
'Access-Control-Max-Age',
|
|
138
|
+
'Access-Control-Expose-Headers',
|
|
139
|
+
'Access-Control-Allow-Headers',
|
|
140
|
+
'Access-Control-Request-Headers',
|
|
141
|
+
'Access-Control-Allow-Credentials',
|
|
142
|
+
'Access-Control-Allow-Methods',
|
|
143
|
+
'Access-Control-Allow-Origin',
|
|
144
|
+
]; }, () => __ΩReturnType, () => cors_1.default, 'cachedCorsInstance', 'app', 'request', 'response', 'sendRequest', '', 'onCorsNext', 'formatHeaderValuesAddedByCorsPackage', 'allowedOrigin', 'isInvalidOriginOrMethodIsNotAllowed', 'b!Pe"!o""2#<9n$2%8<9"0&&F3\'9<>(i*o)"3+9<Pe"!2,!2-!2.$0/Pe"!2,!2-!2.P$/001<P!2.$02<P!2-P\'&&F-J23)04<5e!!6"'];
|
|
145
|
+
//# sourceMappingURL=cors.framework.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cors.framework.js","sourceRoot":"","sources":["../../../src/frameworks/cors/cors.framework.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './cors.framework';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
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);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./cors.framework"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/frameworks/cors/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FastifyInstance } from 'fastify';
|
|
2
|
+
/**
|
|
3
|
+
* Just return the current body as it was parsed.
|
|
4
|
+
*
|
|
5
|
+
* @remarks This function is intended to be used with BodyParserFrameworks.
|
|
6
|
+
*
|
|
7
|
+
* @param app - The instance of fastify
|
|
8
|
+
* @param contentType - The content type to be anuled
|
|
9
|
+
*
|
|
10
|
+
* @breadcrumb Frameworks / FastifyFramework / Helpers
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare function setNoOpForContentType(app: FastifyInstance, contentType: string): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setNoOpForContentType = void 0;
|
|
4
|
+
function __assignType(fn, args) {
|
|
5
|
+
fn.__type = args;
|
|
6
|
+
return fn;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
/**
|
|
10
|
+
* Just return the current body as it was parsed.
|
|
11
|
+
*
|
|
12
|
+
* @remarks This function is intended to be used with BodyParserFrameworks.
|
|
13
|
+
*
|
|
14
|
+
* @param app - The instance of fastify
|
|
15
|
+
* @param contentType - The content type to be anuled
|
|
16
|
+
*
|
|
17
|
+
* @breadcrumb Frameworks / FastifyFramework / Helpers
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
function setNoOpForContentType(app, contentType) {
|
|
21
|
+
app.addContentTypeParser(contentType, __assignType((_, req, done) => {
|
|
22
|
+
return done(null, req.body);
|
|
23
|
+
}, ['_', 'req', 'done', '', 'P"2!"2""2#"/$']));
|
|
24
|
+
}
|
|
25
|
+
exports.setNoOpForContentType = setNoOpForContentType;
|
|
26
|
+
setNoOpForContentType.__type = ['app', 'contentType', 'setNoOpForContentType', 'P"2!&2"$/#'];
|
|
27
|
+
//# sourceMappingURL=no-op-content-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-op-content-parser.js","sourceRoot":"","sources":["../../../../src/frameworks/fastify/helpers/no-op-content-parser.ts"],"names":[],"mappings":";;;;;;;AAIA,YAAY;AAEZ;;;;;;;;;;GAUG;AACH,SAAgB,qBAAqB,CACnC,GAAoB,EACpB,WAAmB;IAEnB,GAAG,CAAC,oBAAoB,CAAC,WAAW,eAAE,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACrD,OAAO,IAAI,CAAC,IAAI,EAAG,GAAW,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC,6CAAC,CAAC;AACL,CAAC;AAPD,sDAOC"}
|
|
@@ -152,4 +152,3 @@ export declare class TrpcFramework<TContext extends TrpcAdapterBaseContext> impl
|
|
|
152
152
|
export declare type __ΩTrpcAdapterBaseContext = any[];
|
|
153
153
|
export declare type __ΩTrpcAdapterContext = any[];
|
|
154
154
|
export declare type __ΩTrpcFrameworkOptions = any[];
|
|
155
|
-
//# sourceMappingURL=trpc.framework.d.ts.map
|
|
@@ -85,4 +85,3 @@ export declare class DefaultHandler<TApp, TEvent, TContext, TCallback, TResponse
|
|
|
85
85
|
*/
|
|
86
86
|
protected forwardResponse(event: TEvent, response: ServerlessResponse, adapter: AdapterContract<TEvent, TContext, TResponse>, binarySettings: BinarySettings, log: ILogger): TResponse;
|
|
87
87
|
}
|
|
88
|
-
//# sourceMappingURL=default.handler.d.ts.map
|
|
@@ -14,4 +14,3 @@ export declare class DigitalOceanHandler<TApp, TEvent, TResponse, TReturn> exten
|
|
|
14
14
|
*/
|
|
15
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
16
|
}
|
|
17
|
-
//# sourceMappingURL=digital-ocean.handler.d.ts.map
|
|
@@ -15,4 +15,3 @@ export declare class HttpFirebaseHandler<TApp> implements HandlerContract<TApp,
|
|
|
15
15
|
*/
|
|
16
16
|
getHandler(app: TApp, framework: FrameworkContract<TApp>): (req: IncomingMessage, res: ServerResponse) => void | Promise<void>;
|
|
17
17
|
}
|
|
18
|
-
//# sourceMappingURL=http-firebase.handler.d.ts.map
|
|
@@ -57,4 +57,3 @@ export declare class HttpHuaweiHandler<TApp> implements HandlerContract<TApp, vo
|
|
|
57
57
|
protected createHttpServer(requestListener: RequestListener): http.Server;
|
|
58
58
|
}
|
|
59
59
|
export declare type __ΩHttpHuaweiHandlerOptions = any[];
|
|
60
|
-
//# sourceMappingURL=http-huawei.handler.d.ts.map
|
package/lib/index.d.ts
CHANGED
package/lib/network/index.d.ts
CHANGED
package/lib/network/request.d.ts
CHANGED