@h4ad/serverless-adapter 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -260
- package/lib/@types/binary-settings.d.ts +24 -6
- package/lib/@types/binary-settings.d.ts.map +1 -0
- package/lib/@types/binary-settings.js +1 -0
- package/lib/@types/binary-settings.js.map +1 -0
- package/lib/@types/headers.d.ts +16 -3
- package/lib/@types/headers.d.ts.map +1 -0
- package/lib/@types/headers.js +1 -0
- package/lib/@types/headers.js.map +1 -0
- package/lib/@types/helpers.d.ts +4 -0
- package/lib/@types/helpers.d.ts.map +1 -0
- package/lib/@types/helpers.js +1 -0
- package/lib/@types/helpers.js.map +1 -0
- package/lib/@types/huawei/huawei-api-gateway-event.d.ts +62 -0
- package/lib/@types/huawei/huawei-api-gateway-event.d.ts.map +1 -0
- package/lib/@types/huawei/huawei-api-gateway-event.js +2 -0
- package/lib/@types/huawei/huawei-api-gateway-event.js.map +1 -0
- package/lib/@types/huawei/huawei-api-gateway-response.d.ts +20 -0
- package/lib/@types/huawei/huawei-api-gateway-response.d.ts.map +1 -0
- package/lib/@types/huawei/huawei-api-gateway-response.js +2 -0
- package/lib/@types/huawei/huawei-api-gateway-response.js.map +1 -0
- package/lib/@types/huawei/huawei-context.d.ts +157 -0
- package/lib/@types/huawei/huawei-context.d.ts.map +1 -0
- package/lib/@types/huawei/huawei-context.js +1 -0
- package/lib/@types/huawei/huawei-context.js.map +1 -0
- package/lib/@types/huawei/index.d.ts +1 -0
- package/lib/@types/huawei/index.d.ts.map +1 -0
- package/lib/@types/huawei/index.js +6 -1
- package/lib/@types/huawei/index.js.map +1 -0
- package/lib/@types/index.d.ts +2 -1
- package/lib/@types/index.d.ts.map +1 -0
- package/lib/@types/index.js +7 -2
- package/lib/@types/index.js.map +1 -0
- package/lib/adapters/aws/alb.adapter.d.ts +18 -10
- package/lib/adapters/aws/alb.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/alb.adapter.js +14 -9
- package/lib/adapters/aws/alb.adapter.js.map +1 -0
- package/lib/adapters/aws/api-gateway-v1.adapter.d.ts +20 -12
- package/lib/adapters/aws/api-gateway-v1.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/api-gateway-v1.adapter.js +19 -14
- package/lib/adapters/aws/api-gateway-v1.adapter.js.map +1 -0
- package/lib/adapters/aws/api-gateway-v2.adapter.d.ts +19 -11
- package/lib/adapters/aws/api-gateway-v2.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/api-gateway-v2.adapter.js +15 -10
- package/lib/adapters/aws/api-gateway-v2.adapter.js.map +1 -0
- package/lib/adapters/aws/dynamodb.adapter.d.ts +18 -10
- package/lib/adapters/aws/dynamodb.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/dynamodb.adapter.js +13 -8
- package/lib/adapters/aws/dynamodb.adapter.js.map +1 -0
- package/lib/adapters/aws/event-bridge.adapter.d.ts +21 -10
- package/lib/adapters/aws/event-bridge.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/event-bridge.adapter.js +13 -8
- package/lib/adapters/aws/event-bridge.adapter.js.map +1 -0
- package/lib/adapters/aws/index.d.ts +1 -0
- package/lib/adapters/aws/index.d.ts.map +1 -0
- package/lib/adapters/aws/index.js +6 -1
- package/lib/adapters/aws/index.js.map +1 -0
- package/lib/adapters/aws/lambda-edge.adapter.d.ts +76 -46
- package/lib/adapters/aws/lambda-edge.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/lambda-edge.adapter.js +40 -24
- package/lib/adapters/aws/lambda-edge.adapter.js.map +1 -0
- package/lib/adapters/aws/sns.adapter.d.ts +18 -10
- package/lib/adapters/aws/sns.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/sns.adapter.js +13 -8
- package/lib/adapters/aws/sns.adapter.js.map +1 -0
- package/lib/adapters/aws/sqs.adapter.d.ts +18 -10
- package/lib/adapters/aws/sqs.adapter.d.ts.map +1 -0
- package/lib/adapters/aws/sqs.adapter.js +13 -8
- package/lib/adapters/aws/sqs.adapter.js.map +1 -0
- package/lib/adapters/dummy/dummy.adapter.d.ts +9 -5
- package/lib/adapters/dummy/dummy.adapter.d.ts.map +1 -0
- package/lib/adapters/dummy/dummy.adapter.js +9 -5
- package/lib/adapters/dummy/dummy.adapter.js.map +1 -0
- package/lib/adapters/dummy/index.d.ts +1 -0
- package/lib/adapters/dummy/index.d.ts.map +1 -0
- package/lib/adapters/dummy/index.js +6 -1
- package/lib/adapters/dummy/index.js.map +1 -0
- package/lib/adapters/huawei/huawei-api-gateway.adapter.d.ts +19 -12
- package/lib/adapters/huawei/huawei-api-gateway.adapter.d.ts.map +1 -0
- package/lib/adapters/huawei/huawei-api-gateway.adapter.js +14 -9
- package/lib/adapters/huawei/huawei-api-gateway.adapter.js.map +1 -0
- package/lib/adapters/huawei/index.d.ts +1 -0
- package/lib/adapters/huawei/index.d.ts.map +1 -0
- package/lib/adapters/huawei/index.js +6 -1
- package/lib/adapters/huawei/index.js.map +1 -0
- package/lib/contracts/adapter.contract.d.ts +30 -30
- package/lib/contracts/adapter.contract.d.ts.map +1 -0
- package/lib/contracts/adapter.contract.js +2 -0
- package/lib/contracts/adapter.contract.js.map +1 -0
- package/lib/contracts/framework.contract.d.ts +7 -3
- package/lib/contracts/framework.contract.d.ts.map +1 -0
- package/lib/contracts/framework.contract.js +1 -0
- package/lib/contracts/framework.contract.js.map +1 -0
- package/lib/contracts/handler.contract.d.ts +7 -0
- package/lib/contracts/handler.contract.d.ts.map +1 -0
- package/lib/contracts/handler.contract.js +1 -0
- package/lib/contracts/handler.contract.js.map +1 -0
- package/lib/contracts/index.d.ts +1 -0
- package/lib/contracts/index.d.ts.map +1 -0
- package/lib/contracts/index.js +6 -1
- package/lib/contracts/index.js.map +1 -0
- package/lib/contracts/resolver.contract.d.ts +17 -4
- package/lib/contracts/resolver.contract.d.ts.map +1 -0
- package/lib/contracts/resolver.contract.js +1 -0
- package/lib/contracts/resolver.contract.js.map +1 -0
- package/lib/core/base-handler.d.ts +9 -5
- package/lib/core/base-handler.d.ts.map +1 -0
- package/lib/core/base-handler.js +9 -5
- package/lib/core/base-handler.js.map +1 -0
- package/lib/core/constants.d.ts +27 -0
- package/lib/core/constants.d.ts.map +1 -0
- package/lib/core/constants.js +21 -0
- package/lib/core/constants.js.map +1 -0
- package/lib/core/current-invoke.d.ts +17 -6
- package/lib/core/current-invoke.d.ts.map +1 -0
- package/lib/core/current-invoke.js +12 -4
- package/lib/core/current-invoke.js.map +1 -0
- package/lib/core/event-body.d.ts +9 -3
- package/lib/core/event-body.d.ts.map +1 -0
- package/lib/core/event-body.js +9 -3
- package/lib/core/event-body.js.map +1 -0
- package/lib/core/headers.d.ts +17 -6
- package/lib/core/headers.d.ts.map +1 -0
- package/lib/core/headers.js +17 -6
- package/lib/core/headers.js.map +1 -0
- package/lib/core/index.d.ts +1 -0
- package/lib/core/index.d.ts.map +1 -0
- package/lib/core/index.js +6 -1
- package/lib/core/index.js.map +1 -0
- package/lib/core/is-binary.d.ts +29 -11
- package/lib/core/is-binary.d.ts.map +1 -0
- package/lib/core/is-binary.js +29 -11
- package/lib/core/is-binary.js.map +1 -0
- package/lib/core/logger.d.ts +22 -5
- package/lib/core/logger.d.ts.map +1 -0
- package/lib/core/logger.js +8 -3
- package/lib/core/logger.js.map +1 -0
- package/lib/core/no-op.d.ts +4 -0
- package/lib/core/no-op.d.ts.map +1 -0
- package/lib/core/no-op.js +4 -0
- package/lib/core/no-op.js.map +1 -0
- package/lib/core/optional.d.ts +8 -3
- package/lib/core/optional.d.ts.map +1 -0
- package/lib/core/optional.js +8 -3
- package/lib/core/optional.js.map +1 -0
- package/lib/core/path.d.ts +14 -5
- package/lib/core/path.d.ts.map +1 -0
- package/lib/core/path.js +14 -5
- package/lib/core/path.js.map +1 -0
- package/lib/core/stream.d.ts +5 -1
- package/lib/core/stream.d.ts.map +1 -0
- package/lib/core/stream.js +6 -2
- package/lib/core/stream.js.map +1 -0
- package/lib/frameworks/express/express.framework.d.ts +5 -1
- package/lib/frameworks/express/express.framework.d.ts.map +1 -0
- package/lib/frameworks/express/express.framework.js +5 -1
- package/lib/frameworks/express/express.framework.js.map +1 -0
- package/lib/frameworks/express/index.d.ts +1 -0
- package/lib/frameworks/express/index.d.ts.map +1 -0
- package/lib/frameworks/express/index.js +6 -1
- package/lib/frameworks/express/index.js.map +1 -0
- package/lib/frameworks/fastify/fastify.framework.d.ts +5 -1
- package/lib/frameworks/fastify/fastify.framework.d.ts.map +1 -0
- package/lib/frameworks/fastify/fastify.framework.js +5 -1
- package/lib/frameworks/fastify/fastify.framework.js.map +1 -0
- package/lib/frameworks/fastify/index.d.ts +1 -0
- package/lib/frameworks/fastify/index.d.ts.map +1 -0
- package/lib/frameworks/fastify/index.js +6 -1
- package/lib/frameworks/fastify/index.js.map +1 -0
- package/lib/frameworks/hapi/hapi.framework.d.ts +5 -1
- package/lib/frameworks/hapi/hapi.framework.d.ts.map +1 -0
- package/lib/frameworks/hapi/hapi.framework.js +5 -1
- package/lib/frameworks/hapi/hapi.framework.js.map +1 -0
- package/lib/frameworks/hapi/index.d.ts +1 -0
- package/lib/frameworks/hapi/index.d.ts.map +1 -0
- package/lib/frameworks/hapi/index.js +6 -1
- package/lib/frameworks/hapi/index.js.map +1 -0
- package/lib/frameworks/koa/index.d.ts +1 -0
- package/lib/frameworks/koa/index.d.ts.map +1 -0
- package/lib/frameworks/koa/index.js +6 -1
- package/lib/frameworks/koa/index.js.map +1 -0
- package/lib/frameworks/koa/koa.framework.d.ts +5 -1
- package/lib/frameworks/koa/koa.framework.d.ts.map +1 -0
- package/lib/frameworks/koa/koa.framework.js +5 -1
- package/lib/frameworks/koa/koa.framework.js.map +1 -0
- package/lib/frameworks/lazy/index.d.ts +2 -0
- package/lib/frameworks/lazy/index.d.ts.map +1 -0
- package/lib/frameworks/lazy/index.js +17 -0
- package/lib/frameworks/lazy/index.js.map +1 -0
- package/lib/frameworks/lazy/lazy.framework.d.ts +7 -2
- package/lib/frameworks/lazy/lazy.framework.d.ts.map +1 -0
- package/lib/frameworks/lazy/lazy.framework.js +7 -2
- package/lib/frameworks/lazy/lazy.framework.js.map +1 -0
- package/lib/frameworks/trpc/index.d.ts +2 -0
- package/lib/frameworks/trpc/index.d.ts.map +1 -0
- package/lib/frameworks/trpc/index.js +18 -0
- package/lib/frameworks/trpc/index.js.map +1 -0
- package/lib/frameworks/trpc/trpc.framework.d.ts +152 -0
- package/lib/frameworks/trpc/trpc.framework.d.ts.map +1 -0
- package/lib/frameworks/trpc/trpc.framework.js +119 -0
- package/lib/frameworks/trpc/trpc.framework.js.map +1 -0
- package/lib/handlers/default/default.handler.d.ts +36 -32
- package/lib/handlers/default/default.handler.d.ts.map +1 -0
- package/lib/handlers/default/default.handler.js +36 -32
- package/lib/handlers/default/default.handler.js.map +1 -0
- package/lib/handlers/default/index.d.ts +1 -0
- package/lib/handlers/default/index.d.ts.map +1 -0
- package/lib/handlers/default/index.js +6 -1
- package/lib/handlers/default/index.js.map +1 -0
- package/lib/handlers/huawei/http-huawei.handler.d.ts +14 -4
- package/lib/handlers/huawei/http-huawei.handler.d.ts.map +1 -0
- package/lib/handlers/huawei/http-huawei.handler.js +15 -4
- package/lib/handlers/huawei/http-huawei.handler.js.map +1 -0
- package/lib/handlers/huawei/index.d.ts +1 -0
- package/lib/handlers/huawei/index.d.ts.map +1 -0
- package/lib/handlers/huawei/index.js +6 -1
- package/lib/handlers/huawei/index.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +6 -1
- package/lib/index.js.map +1 -0
- package/lib/network/index.d.ts +1 -0
- package/lib/network/index.d.ts.map +1 -0
- package/lib/network/index.js +6 -1
- package/lib/network/index.js.map +1 -0
- package/lib/network/request.d.ts +28 -0
- package/lib/network/request.d.ts.map +1 -0
- package/lib/network/request.js +7 -0
- package/lib/network/request.js.map +1 -0
- package/lib/network/response.d.ts +18 -1
- package/lib/network/response.d.ts.map +1 -0
- package/lib/network/response.js +9 -1
- package/lib/network/response.js.map +1 -0
- package/lib/resolvers/aws-context/aws-context.resolver.d.ts +7 -9
- package/lib/resolvers/aws-context/aws-context.resolver.d.ts.map +1 -0
- package/lib/resolvers/aws-context/aws-context.resolver.js +7 -9
- package/lib/resolvers/aws-context/aws-context.resolver.js.map +1 -0
- package/lib/resolvers/aws-context/index.d.ts +1 -0
- package/lib/resolvers/aws-context/index.d.ts.map +1 -0
- package/lib/resolvers/aws-context/index.js +6 -1
- package/lib/resolvers/aws-context/index.js.map +1 -0
- package/lib/resolvers/callback/callback.resolver.d.ts +9 -2
- package/lib/resolvers/callback/callback.resolver.d.ts.map +1 -0
- package/lib/resolvers/callback/callback.resolver.js +6 -2
- package/lib/resolvers/callback/callback.resolver.js.map +1 -0
- package/lib/resolvers/callback/index.d.ts +1 -0
- package/lib/resolvers/callback/index.d.ts.map +1 -0
- package/lib/resolvers/callback/index.js +6 -1
- package/lib/resolvers/callback/index.js.map +1 -0
- package/lib/resolvers/dummy/dummy.resolver.d.ts +5 -1
- package/lib/resolvers/dummy/dummy.resolver.d.ts.map +1 -0
- package/lib/resolvers/dummy/dummy.resolver.js +5 -1
- package/lib/resolvers/dummy/dummy.resolver.js.map +1 -0
- package/lib/resolvers/dummy/index.d.ts +1 -0
- package/lib/resolvers/dummy/index.d.ts.map +1 -0
- package/lib/resolvers/dummy/index.js +6 -1
- package/lib/resolvers/dummy/index.js.map +1 -0
- package/lib/resolvers/promise/index.d.ts +1 -0
- package/lib/resolvers/promise/index.d.ts.map +1 -0
- package/lib/resolvers/promise/index.js +6 -1
- package/lib/resolvers/promise/index.js.map +1 -0
- package/lib/resolvers/promise/promise.resolver.d.ts +5 -1
- package/lib/resolvers/promise/promise.resolver.d.ts.map +1 -0
- package/lib/resolvers/promise/promise.resolver.js +5 -1
- package/lib/resolvers/promise/promise.resolver.js.map +1 -0
- package/lib/serverless-adapter.d.ts +17 -12
- package/lib/serverless-adapter.d.ts.map +1 -0
- package/lib/serverless-adapter.js +17 -12
- package/lib/serverless-adapter.js.map +1 -0
- package/package.json +29 -4
- package/lib/@types/proxy-params.d.ts +0 -8
- package/lib/@types/proxy-params.js +0 -2
package/lib/core/is-binary.d.ts
CHANGED
|
@@ -2,54 +2,72 @@ import { BinarySettings, BothValueHeaders } from '../@types';
|
|
|
2
2
|
/**
|
|
3
3
|
* The function that determines by the content encoding whether the response should be treated as binary
|
|
4
4
|
*
|
|
5
|
-
* @example
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
6
7
|
* const headers = { 'Content-Encoding': 'gzip' };
|
|
7
8
|
* const isBinary = isContentEncodingBinary(headers, ['gzip']);
|
|
8
9
|
* console.log(isBinary);
|
|
9
10
|
* // true
|
|
10
11
|
* ```
|
|
11
12
|
*
|
|
12
|
-
* @param headers The headers of the response
|
|
13
|
-
* @param binaryEncodingTypes The list of content encodings that will be treated as binary
|
|
13
|
+
* @param headers - The headers of the response
|
|
14
|
+
* @param binaryEncodingTypes - The list of content encodings that will be treated as binary
|
|
15
|
+
*
|
|
16
|
+
* @breadcrumb Core / isBinary
|
|
17
|
+
* @public
|
|
14
18
|
*/
|
|
15
19
|
export declare function isContentEncodingBinary(headers: BothValueHeaders, binaryEncodingTypes: string[]): boolean;
|
|
16
20
|
/**
|
|
17
21
|
* The function that returns the content type of headers
|
|
18
22
|
*
|
|
19
|
-
* @example
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
20
25
|
* const headers = { 'Content-Type': 'application/json' };
|
|
21
26
|
* const contentType = getContentType(headers);
|
|
22
27
|
* console.log(contentType);
|
|
23
28
|
* // application/json
|
|
24
29
|
* ```
|
|
25
30
|
*
|
|
26
|
-
* @param headers The headers of the response
|
|
31
|
+
* @param headers - The headers of the response
|
|
32
|
+
*
|
|
33
|
+
* @breadcrumb Core / isBinary
|
|
34
|
+
* @public
|
|
27
35
|
*/
|
|
28
36
|
export declare function getContentType(headers: BothValueHeaders): string;
|
|
29
37
|
/**
|
|
30
38
|
* The function that determines by the content type whether the response should be treated as binary
|
|
31
39
|
*
|
|
32
|
-
* @example
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
33
42
|
* const headers = { 'Content-Type': 'image/png' };
|
|
34
43
|
* const isBinary = isContentTypeBinary(headers, [new RegExp('^image/.*$')]);
|
|
35
44
|
* console.log(isBinary);
|
|
36
45
|
* // true
|
|
37
46
|
* ```
|
|
38
47
|
*
|
|
39
|
-
* @param headers The headers of the response
|
|
40
|
-
* @param binaryContentTypes The list of content types that will be treated as binary
|
|
48
|
+
* @param headers - The headers of the response
|
|
49
|
+
* @param binaryContentTypes - The list of content types that will be treated as binary
|
|
50
|
+
*
|
|
51
|
+
* @breadcrumb Core / isBinary
|
|
52
|
+
* @public
|
|
41
53
|
*/
|
|
42
54
|
export declare function isContentTypeBinary(headers: BothValueHeaders, binaryContentTypes: (string | RegExp)[]): boolean;
|
|
43
55
|
/**
|
|
44
56
|
* The function used to determine from the headers and the binary settings if a response should be encoded or not
|
|
45
57
|
*
|
|
46
|
-
* @example
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
47
60
|
* const headers = { 'Content-Type': 'image/png', 'Content-Encoding': 'gzip' };
|
|
48
61
|
* const isContentBinary = isBinary(headers, { contentEncodings: ['gzip'], contentTypes: [new RegExp('^image/.*$')] });
|
|
49
62
|
* console.log(isContentBinary);
|
|
50
63
|
* // true
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @param headers - The headers of the response
|
|
67
|
+
* @param binarySettings - The settings for the validation
|
|
51
68
|
*
|
|
52
|
-
* @
|
|
53
|
-
* @
|
|
69
|
+
* @breadcrumb Core / isBinary
|
|
70
|
+
* @public
|
|
54
71
|
*/
|
|
55
72
|
export declare function isBinary(headers: BothValueHeaders, binarySettings: BinarySettings): boolean;
|
|
73
|
+
//# sourceMappingURL=is-binary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-binary.d.ts","sourceRoot":"","sources":["../../src/core/is-binary.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAK7D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,gBAAgB,EACzB,mBAAmB,EAAE,MAAM,EAAE,GAC5B,OAAO,CAUT;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAMhE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,gBAAgB,EACzB,kBAAkB,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,WAexC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,QAAQ,CACtB,OAAO,EAAE,gBAAgB,EACzB,cAAc,EAAE,cAAc,GAC7B,OAAO,CAWT"}
|
package/lib/core/is-binary.js
CHANGED
|
@@ -7,15 +7,19 @@ const headers_1 = require("./headers");
|
|
|
7
7
|
/**
|
|
8
8
|
* The function that determines by the content encoding whether the response should be treated as binary
|
|
9
9
|
*
|
|
10
|
-
* @example
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
11
12
|
* const headers = { 'Content-Encoding': 'gzip' };
|
|
12
13
|
* const isBinary = isContentEncodingBinary(headers, ['gzip']);
|
|
13
14
|
* console.log(isBinary);
|
|
14
15
|
* // true
|
|
15
16
|
* ```
|
|
16
17
|
*
|
|
17
|
-
* @param headers The headers of the response
|
|
18
|
-
* @param binaryEncodingTypes The list of content encodings that will be treated as binary
|
|
18
|
+
* @param headers - The headers of the response
|
|
19
|
+
* @param binaryEncodingTypes - The list of content encodings that will be treated as binary
|
|
20
|
+
*
|
|
21
|
+
* @breadcrumb Core / isBinary
|
|
22
|
+
* @public
|
|
19
23
|
*/
|
|
20
24
|
function isContentEncodingBinary(headers, binaryEncodingTypes) {
|
|
21
25
|
const multiValueHeaders = (0, headers_1.getMultiValueHeadersMap)(headers);
|
|
@@ -28,14 +32,18 @@ exports.isContentEncodingBinary = isContentEncodingBinary;
|
|
|
28
32
|
/**
|
|
29
33
|
* The function that returns the content type of headers
|
|
30
34
|
*
|
|
31
|
-
* @example
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
32
37
|
* const headers = { 'Content-Type': 'application/json' };
|
|
33
38
|
* const contentType = getContentType(headers);
|
|
34
39
|
* console.log(contentType);
|
|
35
40
|
* // application/json
|
|
36
41
|
* ```
|
|
37
42
|
*
|
|
38
|
-
* @param headers The headers of the response
|
|
43
|
+
* @param headers - The headers of the response
|
|
44
|
+
*
|
|
45
|
+
* @breadcrumb Core / isBinary
|
|
46
|
+
* @public
|
|
39
47
|
*/
|
|
40
48
|
function getContentType(headers) {
|
|
41
49
|
const flattenedHeaders = (0, headers_1.getFlattenedHeadersMap)(headers, ';', true);
|
|
@@ -47,15 +55,19 @@ exports.getContentType = getContentType;
|
|
|
47
55
|
/**
|
|
48
56
|
* The function that determines by the content type whether the response should be treated as binary
|
|
49
57
|
*
|
|
50
|
-
* @example
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
51
60
|
* const headers = { 'Content-Type': 'image/png' };
|
|
52
61
|
* const isBinary = isContentTypeBinary(headers, [new RegExp('^image/.*$')]);
|
|
53
62
|
* console.log(isBinary);
|
|
54
63
|
* // true
|
|
55
64
|
* ```
|
|
56
65
|
*
|
|
57
|
-
* @param headers The headers of the response
|
|
58
|
-
* @param binaryContentTypes The list of content types that will be treated as binary
|
|
66
|
+
* @param headers - The headers of the response
|
|
67
|
+
* @param binaryContentTypes - The list of content types that will be treated as binary
|
|
68
|
+
*
|
|
69
|
+
* @breadcrumb Core / isBinary
|
|
70
|
+
* @public
|
|
59
71
|
*/
|
|
60
72
|
function isContentTypeBinary(headers, binaryContentTypes) {
|
|
61
73
|
const binaryContentTypesRegexes = binaryContentTypes.map(binaryContentType => binaryContentType instanceof RegExp
|
|
@@ -70,14 +82,19 @@ exports.isContentTypeBinary = isContentTypeBinary;
|
|
|
70
82
|
/**
|
|
71
83
|
* The function used to determine from the headers and the binary settings if a response should be encoded or not
|
|
72
84
|
*
|
|
73
|
-
* @example
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
74
87
|
* const headers = { 'Content-Type': 'image/png', 'Content-Encoding': 'gzip' };
|
|
75
88
|
* const isContentBinary = isBinary(headers, { contentEncodings: ['gzip'], contentTypes: [new RegExp('^image/.*$')] });
|
|
76
89
|
* console.log(isContentBinary);
|
|
77
90
|
* // true
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @param headers - The headers of the response
|
|
94
|
+
* @param binarySettings - The settings for the validation
|
|
78
95
|
*
|
|
79
|
-
* @
|
|
80
|
-
* @
|
|
96
|
+
* @breadcrumb Core / isBinary
|
|
97
|
+
* @public
|
|
81
98
|
*/
|
|
82
99
|
function isBinary(headers, binarySettings) {
|
|
83
100
|
if ('isBinary' in binarySettings) {
|
|
@@ -89,3 +106,4 @@ function isBinary(headers, binarySettings) {
|
|
|
89
106
|
isContentTypeBinary(headers, binarySettings.contentTypes));
|
|
90
107
|
}
|
|
91
108
|
exports.isBinary = isBinary;
|
|
109
|
+
//# sourceMappingURL=is-binary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-binary.js","sourceRoot":"","sources":["../../src/core/is-binary.ts"],"names":[],"mappings":";AAAA,8DAA8D;;;AAK9D,uCAA4E;AAE5E,YAAY;AAEZ;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,uBAAuB,CACrC,OAAyB,EACzB,mBAA6B;IAE7B,MAAM,iBAAiB,GAAG,IAAA,iCAAuB,EAAC,OAAO,CAAC,CAAC;IAE3D,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;IAE/D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC;QAAE,OAAO,KAAK,CAAC;IAEnD,OAAO,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CACnC,mBAAmB,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAC3E,CAAC;AACJ,CAAC;AAbD,0DAaC;AAED;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,cAAc,CAAC,OAAyB;IACtD,MAAM,gBAAgB,GAAG,IAAA,gCAAsB,EAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IACpE,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;IAEjE,+CAA+C;IAC/C,OAAO,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC;AAND,wCAMC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,mBAAmB,CACjC,OAAyB,EACzB,kBAAuC;IAEvC,MAAM,yBAAyB,GAAG,kBAAkB,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAC3E,iBAAiB,YAAY,MAAM;QACjC,CAAC,CAAC,iBAAiB;QACnB,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,iBAAiB,EAAE,CAAC,CACvC,CAAC;IAEF,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAE5C,IAAI,CAAC,WAAW;QAAE,OAAO,KAAK,CAAC;IAE/B,OAAO,yBAAyB,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CACxD,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,CACpC,CAAC;AACJ,CAAC;AAjBD,kDAiBC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,QAAQ,CACtB,OAAyB,EACzB,cAA8B;IAE9B,IAAI,UAAU,IAAI,cAAc,EAAE;QAChC,IAAI,cAAc,CAAC,QAAQ,KAAK,KAAK;YAAE,OAAO,KAAK,CAAC;QAEpD,OAAO,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;KACzC;IAED,OAAO,CACL,uBAAuB,CAAC,OAAO,EAAE,cAAc,CAAC,gBAAgB,CAAC;QACjE,mBAAmB,CAAC,OAAO,EAAE,cAAc,CAAC,YAAY,CAAC,CAC1D,CAAC;AACJ,CAAC;AAdD,4BAcC"}
|
package/lib/core/logger.d.ts
CHANGED
|
@@ -1,38 +1,55 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The type representing the possible log levels to choose from.
|
|
3
|
+
*
|
|
4
|
+
* @breadcrumb Core / Logger
|
|
5
|
+
* @public
|
|
3
6
|
*/
|
|
4
7
|
export declare type LogLevels = 'debug' | 'verbose' | 'info' | 'warn' | 'error' | 'none';
|
|
5
8
|
/**
|
|
6
9
|
* The options to customize {@link ILogger}
|
|
10
|
+
*
|
|
11
|
+
* @breadcrumb Core / Logger
|
|
12
|
+
* @public
|
|
7
13
|
*/
|
|
8
14
|
export declare type LoggerOptions = {
|
|
9
15
|
/**
|
|
10
|
-
* Select the log level, {@link LogLevels see more}.
|
|
16
|
+
* Select the log level, {@link LogLevels | see more}.
|
|
11
17
|
*
|
|
12
|
-
* @
|
|
18
|
+
* @defaultValue error
|
|
13
19
|
*/
|
|
14
20
|
level: LogLevels;
|
|
15
21
|
};
|
|
16
22
|
/**
|
|
17
23
|
* The log function used in any level.
|
|
24
|
+
*
|
|
25
|
+
* @breadcrumb Core / Logger
|
|
26
|
+
* @public
|
|
18
27
|
*/
|
|
19
28
|
export declare type LoggerFN = (message: any, ...additional: any[]) => void;
|
|
20
29
|
/**
|
|
21
30
|
* The interface representing the logger, you can provide a custom logger by implementing this interface.
|
|
31
|
+
*
|
|
32
|
+
* @breadcrumb Core / Logger
|
|
33
|
+
* @public
|
|
22
34
|
*/
|
|
23
35
|
export declare type ILogger = Record<Exclude<LogLevels, 'none'>, LoggerFN>;
|
|
24
36
|
/**
|
|
25
37
|
* The method used to create a simple logger instance to use in this library.
|
|
26
38
|
*
|
|
27
|
-
* @
|
|
39
|
+
* @remarks Behind the scenes, this simple logger sends the message to the `console` methods.
|
|
28
40
|
*
|
|
29
|
-
* @example
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
30
43
|
* const logger = createDefaultLogger();
|
|
31
44
|
*
|
|
32
45
|
* logger.error('An error happens.');
|
|
33
46
|
* // An error happens.
|
|
34
47
|
* ```
|
|
35
48
|
*
|
|
36
|
-
* @param level Select the level of the log
|
|
49
|
+
* @param level - Select the level of the log
|
|
50
|
+
*
|
|
51
|
+
* @breadcrumb Core / Logger
|
|
52
|
+
* @public
|
|
37
53
|
*/
|
|
38
54
|
export declare function createDefaultLogger({ level }?: LoggerOptions): ILogger;
|
|
55
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/core/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,oBAAY,SAAS,GACjB,OAAO,GACP,SAAS,GACT,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,CAAC;AAEX;;;;;GAKG;AACH,oBAAY,aAAa,GAAG;IAC1B;;;;OAIG;IACH,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF;;;;;GAKG;AACH,oBAAY,QAAQ,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,UAAU,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAEpE;;;;;GAKG;AACH,oBAAY,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;AAEnE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,KAAK,EAAE,GAAE,aAAkC,GAC5C,OAAO,CAiCT"}
|
package/lib/core/logger.js
CHANGED
|
@@ -4,16 +4,20 @@ exports.createDefaultLogger = void 0;
|
|
|
4
4
|
/**
|
|
5
5
|
* The method used to create a simple logger instance to use in this library.
|
|
6
6
|
*
|
|
7
|
-
* @
|
|
7
|
+
* @remarks Behind the scenes, this simple logger sends the message to the `console` methods.
|
|
8
8
|
*
|
|
9
|
-
* @example
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
10
11
|
* const logger = createDefaultLogger();
|
|
11
12
|
*
|
|
12
13
|
* logger.error('An error happens.');
|
|
13
14
|
* // An error happens.
|
|
14
15
|
* ```
|
|
15
16
|
*
|
|
16
|
-
* @param level Select the level of the log
|
|
17
|
+
* @param level - Select the level of the log
|
|
18
|
+
*
|
|
19
|
+
* @breadcrumb Core / Logger
|
|
20
|
+
* @public
|
|
17
21
|
*/
|
|
18
22
|
function createDefaultLogger({ level } = { level: 'error' }) {
|
|
19
23
|
const errorLogLevel = ['debug', 'verbose', 'info', 'warn', 'error'];
|
|
@@ -49,3 +53,4 @@ function createDefaultLogger({ level } = { level: 'error' }) {
|
|
|
49
53
|
};
|
|
50
54
|
}
|
|
51
55
|
exports.createDefaultLogger = createDefaultLogger;
|
|
56
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/core/logger.ts"],"names":[],"mappings":";;;AA6CA;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,mBAAmB,CACjC,EAAE,KAAK,KAAoB,EAAE,KAAK,EAAE,OAAO,EAAE;IAE7C,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACpE,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1D,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAClD,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAE7C,OAAO;QACL,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,UAAU,EAAE,EAAE;YAChC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAAE,OAAO;YAE3C,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,UAAU,CAAC,CAAC;QACxC,CAAC;QACD,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,UAAU,EAAE,EAAE;YAC/B,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAAE,OAAO;YAE1C,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,UAAU,CAAC,CAAC;QACvC,CAAC;QACD,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,UAAU,EAAE,EAAE;YAC/B,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAAE,OAAO;YAE1C,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,UAAU,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,UAAU,EAAE,EAAE;YAClC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAAE,OAAO;YAE7C,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,UAAU,CAAC,CAAC;QACxC,CAAC;QACD,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,UAAU,EAAE,EAAE;YAChC,IAAI,KAAK,KAAK,OAAO;gBAAE,OAAO;YAE9B,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,UAAU,CAAC,CAAC;QACxC,CAAC;KACF,CAAC;AACJ,CAAC;AAnCD,kDAmCC"}
|
package/lib/core/no-op.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-op.d.ts","sourceRoot":"","sources":["../../src/core/no-op.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAkB,CAAC"}
|
package/lib/core/no-op.js
CHANGED
|
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.NO_OP = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* No operation function is used when we need to pass a function, but we don't want to specify any behavior.
|
|
6
|
+
*
|
|
7
|
+
* @breadcrumb Core
|
|
8
|
+
* @public
|
|
6
9
|
*/
|
|
7
10
|
const NO_OP = () => void 0;
|
|
8
11
|
exports.NO_OP = NO_OP;
|
|
12
|
+
//# sourceMappingURL=no-op.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-op.js","sourceRoot":"","sources":["../../src/core/no-op.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACI,MAAM,KAAK,GAA4B,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;AAA9C,QAAA,KAAK,SAAyC"}
|
package/lib/core/optional.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Return the defaultValue whether the value is undefined, otherwise, return the value.
|
|
3
3
|
*
|
|
4
|
-
* @example
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
5
6
|
* const value1 = getDefaultIfUndefined(undefined, true);
|
|
6
7
|
* const value2 = getDefaultIfUndefined(false, true);
|
|
7
8
|
*
|
|
@@ -11,7 +12,11 @@
|
|
|
11
12
|
* // false
|
|
12
13
|
* ```
|
|
13
14
|
*
|
|
14
|
-
* @param value The value to be checked
|
|
15
|
-
* @param defaultValue The default value when value is undefined
|
|
15
|
+
* @param value - The value to be checked
|
|
16
|
+
* @param defaultValue - The default value when value is undefined
|
|
17
|
+
*
|
|
18
|
+
* @breadcrumb Core
|
|
19
|
+
* @public
|
|
16
20
|
*/
|
|
17
21
|
export declare function getDefaultIfUndefined<T>(value: T | undefined, defaultValue: T): T;
|
|
22
|
+
//# sourceMappingURL=optional.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional.d.ts","sourceRoot":"","sources":["../../src/core/optional.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,KAAK,EAAE,CAAC,GAAG,SAAS,EACpB,YAAY,EAAE,CAAC,GACd,CAAC,CAIH"}
|
package/lib/core/optional.js
CHANGED
|
@@ -4,7 +4,8 @@ exports.getDefaultIfUndefined = void 0;
|
|
|
4
4
|
/**
|
|
5
5
|
* Return the defaultValue whether the value is undefined, otherwise, return the value.
|
|
6
6
|
*
|
|
7
|
-
* @example
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
8
9
|
* const value1 = getDefaultIfUndefined(undefined, true);
|
|
9
10
|
* const value2 = getDefaultIfUndefined(false, true);
|
|
10
11
|
*
|
|
@@ -14,8 +15,11 @@ exports.getDefaultIfUndefined = void 0;
|
|
|
14
15
|
* // false
|
|
15
16
|
* ```
|
|
16
17
|
*
|
|
17
|
-
* @param value The value to be checked
|
|
18
|
-
* @param defaultValue The default value when value is undefined
|
|
18
|
+
* @param value - The value to be checked
|
|
19
|
+
* @param defaultValue - The default value when value is undefined
|
|
20
|
+
*
|
|
21
|
+
* @breadcrumb Core
|
|
22
|
+
* @public
|
|
19
23
|
*/
|
|
20
24
|
function getDefaultIfUndefined(value, defaultValue) {
|
|
21
25
|
if (typeof value === 'undefined')
|
|
@@ -23,3 +27,4 @@ function getDefaultIfUndefined(value, defaultValue) {
|
|
|
23
27
|
return value;
|
|
24
28
|
}
|
|
25
29
|
exports.getDefaultIfUndefined = getDefaultIfUndefined;
|
|
30
|
+
//# sourceMappingURL=optional.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional.js","sourceRoot":"","sources":["../../src/core/optional.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,qBAAqB,CACnC,KAAoB,EACpB,YAAe;IAEf,IAAI,OAAO,KAAK,KAAK,WAAW;QAAE,OAAO,YAAY,CAAC;IAEtD,OAAO,KAAK,CAAC;AACf,CAAC;AAPD,sDAOC"}
|
package/lib/core/path.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Transform the path and a map of query params to a string with formatted query params
|
|
3
3
|
*
|
|
4
|
-
* @example
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
5
6
|
* const path = '/pets/search';
|
|
6
7
|
* const queryParams = { batata: undefined, petType: [ 'dog', 'fish' ] };
|
|
7
8
|
* const result = getPathWithQueryStringParams(path, queryParams);
|
|
@@ -9,20 +10,28 @@
|
|
|
9
10
|
* // /pets/search?batata=&petType=dog&petType=fish
|
|
10
11
|
* ```
|
|
11
12
|
*
|
|
12
|
-
* @param path The path
|
|
13
|
-
* @param queryParams The query params
|
|
13
|
+
* @param path - The path
|
|
14
|
+
* @param queryParams - The query params
|
|
15
|
+
*
|
|
16
|
+
* @breadcrumb Core / Path
|
|
17
|
+
* @public
|
|
14
18
|
*/
|
|
15
19
|
export declare function getPathWithQueryStringParams(path: string, queryParams: string | Record<string, string | string[] | undefined> | undefined | null): string;
|
|
16
20
|
/**
|
|
17
21
|
* Map query params to a string with formatted query params
|
|
18
22
|
*
|
|
19
|
-
* @example
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
20
25
|
* const queryParams = { batata: undefined, petType: [ 'dog', 'fish' ] };
|
|
21
26
|
* const result = getQueryParamsStringFromRecord(queryParams);
|
|
22
27
|
* console.log(result);
|
|
23
28
|
* // batata=&petType=dog&petType=fish
|
|
24
29
|
* ```
|
|
25
30
|
*
|
|
26
|
-
* @param queryParamsRecord The query params record
|
|
31
|
+
* @param queryParamsRecord - The query params record
|
|
32
|
+
*
|
|
33
|
+
* @breadcrumb Core / Path
|
|
34
|
+
* @public
|
|
27
35
|
*/
|
|
28
36
|
export declare function getQueryParamsStringFromRecord(queryParamsRecord: Record<string, string | string[] | undefined> | undefined | null): string;
|
|
37
|
+
//# sourceMappingURL=path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/core/path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,MAAM,EACZ,WAAW,EACP,MAAM,GACN,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,GAC7C,SAAS,GACT,IAAI,GACP,MAAM,CAUR;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,8BAA8B,CAC5C,iBAAiB,EACb,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,GAC7C,SAAS,GACT,IAAI,GACP,MAAM,CAkBR"}
|
package/lib/core/path.js
CHANGED
|
@@ -4,7 +4,8 @@ exports.getQueryParamsStringFromRecord = exports.getPathWithQueryStringParams =
|
|
|
4
4
|
/**
|
|
5
5
|
* Transform the path and a map of query params to a string with formatted query params
|
|
6
6
|
*
|
|
7
|
-
* @example
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
8
9
|
* const path = '/pets/search';
|
|
9
10
|
* const queryParams = { batata: undefined, petType: [ 'dog', 'fish' ] };
|
|
10
11
|
* const result = getPathWithQueryStringParams(path, queryParams);
|
|
@@ -12,8 +13,11 @@ exports.getQueryParamsStringFromRecord = exports.getPathWithQueryStringParams =
|
|
|
12
13
|
* // /pets/search?batata=&petType=dog&petType=fish
|
|
13
14
|
* ```
|
|
14
15
|
*
|
|
15
|
-
* @param path The path
|
|
16
|
-
* @param queryParams The query params
|
|
16
|
+
* @param path - The path
|
|
17
|
+
* @param queryParams - The query params
|
|
18
|
+
*
|
|
19
|
+
* @breadcrumb Core / Path
|
|
20
|
+
* @public
|
|
17
21
|
*/
|
|
18
22
|
function getPathWithQueryStringParams(path, queryParams) {
|
|
19
23
|
if (String(queryParams || '').length === 0)
|
|
@@ -29,14 +33,18 @@ exports.getPathWithQueryStringParams = getPathWithQueryStringParams;
|
|
|
29
33
|
/**
|
|
30
34
|
* Map query params to a string with formatted query params
|
|
31
35
|
*
|
|
32
|
-
* @example
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
33
38
|
* const queryParams = { batata: undefined, petType: [ 'dog', 'fish' ] };
|
|
34
39
|
* const result = getQueryParamsStringFromRecord(queryParams);
|
|
35
40
|
* console.log(result);
|
|
36
41
|
* // batata=&petType=dog&petType=fish
|
|
37
42
|
* ```
|
|
38
43
|
*
|
|
39
|
-
* @param queryParamsRecord The query params record
|
|
44
|
+
* @param queryParamsRecord - The query params record
|
|
45
|
+
*
|
|
46
|
+
* @breadcrumb Core / Path
|
|
47
|
+
* @public
|
|
40
48
|
*/
|
|
41
49
|
function getQueryParamsStringFromRecord(queryParamsRecord) {
|
|
42
50
|
const searchParams = new URLSearchParams();
|
|
@@ -54,3 +62,4 @@ function getQueryParamsStringFromRecord(queryParamsRecord) {
|
|
|
54
62
|
return searchParams.toString();
|
|
55
63
|
}
|
|
56
64
|
exports.getQueryParamsStringFromRecord = getQueryParamsStringFromRecord;
|
|
65
|
+
//# sourceMappingURL=path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/core/path.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,4BAA4B,CAC1C,IAAY,EACZ,WAIQ;IAER,IAAI,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAExD,IAAI,OAAO,WAAW,KAAK,QAAQ;QAAE,OAAO,GAAG,IAAI,IAAI,WAAW,EAAE,CAAC;IAErE,MAAM,iBAAiB,GAAG,8BAA8B,CAAC,WAAW,CAAC,CAAC;IAEtE,IAAI,CAAC,iBAAiB;QAAE,OAAO,IAAI,CAAC;IAEpC,OAAO,GAAG,IAAI,IAAI,iBAAiB,EAAE,CAAC;AACxC,CAAC;AAjBD,oEAiBC;AAED;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,8BAA8B,CAC5C,iBAGQ;IAER,MAAM,YAAY,GAAG,IAAI,eAAe,EAAE,CAAC;IAE3C,MAAM,wBAAwB,GAC5B,MAAM,CAAC,OAAO,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;IAE1C,IAAI,wBAAwB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,wBAAwB,EAAE;QACnD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACzB,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;YACtC,SAAS;SACV;QAED,KAAK,MAAM,UAAU,IAAI,KAAK;YAAE,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;KACtE;IAED,OAAO,YAAY,CAAC,QAAQ,EAAE,CAAC;AACjC,CAAC;AAvBD,wEAuBC"}
|
package/lib/core/stream.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ import { Readable, Writable } from 'stream';
|
|
|
3
3
|
/**
|
|
4
4
|
* Wait asynchronous the stream to complete
|
|
5
5
|
*
|
|
6
|
-
* @param stream The stream
|
|
6
|
+
* @param stream - The stream
|
|
7
|
+
*
|
|
8
|
+
* @breadcrumb Core / Stream
|
|
9
|
+
* @public
|
|
7
10
|
*/
|
|
8
11
|
export declare function waitForStreamComplete<TStream extends Readable | Writable>(stream: TStream): Promise<TStream>;
|
|
12
|
+
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/core/stream.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAI5C;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,SAAS,QAAQ,GAAG,QAAQ,EACvE,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,OAAO,CAAC,CA+BlB"}
|
package/lib/core/stream.js
CHANGED
|
@@ -6,7 +6,10 @@ exports.waitForStreamComplete = void 0;
|
|
|
6
6
|
/**
|
|
7
7
|
* Wait asynchronous the stream to complete
|
|
8
8
|
*
|
|
9
|
-
* @param stream The stream
|
|
9
|
+
* @param stream - The stream
|
|
10
|
+
*
|
|
11
|
+
* @breadcrumb Core / Stream
|
|
12
|
+
* @public
|
|
10
13
|
*/
|
|
11
14
|
function waitForStreamComplete(stream) {
|
|
12
15
|
if ('readableEnded' in stream && stream.readableEnded)
|
|
@@ -14,7 +17,7 @@ function waitForStreamComplete(stream) {
|
|
|
14
17
|
if ('writableEnded' in stream && stream.writableEnded)
|
|
15
18
|
return Promise.resolve(stream);
|
|
16
19
|
return new Promise((resolve, reject) => {
|
|
17
|
-
// Reading the {@link https://github.com/nodejs/node/blob/v12.22.9/lib/events.js#L262 emit source code},
|
|
20
|
+
// Reading the {@link https://github.com/nodejs/node/blob/v12.22.9/lib/events.js#L262 | emit source code},
|
|
18
21
|
// it's almost impossible to complete being called twice because the emit function runs synchronously and removes the other listeners,
|
|
19
22
|
// but I'll leave it at that because I didn't write that code, so I couldn't figure out what the author thought when he wrote this.
|
|
20
23
|
let isComplete = false;
|
|
@@ -37,3 +40,4 @@ function waitForStreamComplete(stream) {
|
|
|
37
40
|
});
|
|
38
41
|
}
|
|
39
42
|
exports.waitForStreamComplete = waitForStreamComplete;
|
|
43
|
+
//# sourceMappingURL=stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/core/stream.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;AAIjB,YAAY;AAEZ;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CACnC,MAAe;IAEf,IAAI,eAAe,IAAI,MAAM,IAAI,MAAM,CAAC,aAAa;QACnD,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEjC,IAAI,eAAe,IAAI,MAAM,IAAI,MAAM,CAAC,aAAa;QACnD,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEjC,OAAO,IAAI,OAAO,CAAU,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC9C,0GAA0G;QAC1G,sIAAsI;QACtI,mIAAmI;QACnI,IAAI,UAAU,GAAG,KAAK,CAAC;QAEvB,SAAS,QAAQ,CAAC,GAAG;YACnB,0BAA0B;YAC1B,IAAI,UAAU;gBAAE,OAAO;YAEvB,UAAU,GAAG,IAAI,CAAC;YAElB,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YACzC,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YACvC,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAE1C,IAAI,GAAG;gBAAE,MAAM,CAAC,GAAG,CAAC,CAAC;;gBAChB,OAAO,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC/B,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC7B,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC;AAjCD,sDAiCC"}
|
|
@@ -4,10 +4,14 @@ import type { Express } from 'express';
|
|
|
4
4
|
import { FrameworkContract } from '../../contracts';
|
|
5
5
|
/**
|
|
6
6
|
* The framework that forwards requests to express handler
|
|
7
|
+
*
|
|
8
|
+
* @breadcrumb Frameworks / ExpressFramework
|
|
9
|
+
* @public
|
|
7
10
|
*/
|
|
8
11
|
export declare class ExpressFramework implements FrameworkContract<Express> {
|
|
9
12
|
/**
|
|
10
|
-
* @inheritDoc
|
|
13
|
+
* {@inheritDoc}
|
|
11
14
|
*/
|
|
12
15
|
sendRequest(app: Express, request: IncomingMessage, response: ServerResponse): void;
|
|
13
16
|
}
|
|
17
|
+
//# sourceMappingURL=express.framework.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"express.framework.d.ts","sourceRoot":"","sources":["../../../src/frameworks/express/express.framework.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIpD;;;;;GAKG;AACH,qBAAa,gBAAiB,YAAW,iBAAiB,CAAC,OAAO,CAAC;IACjE;;OAEG;IACI,WAAW,CAChB,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,cAAc,GACvB,IAAI;CAGR"}
|
|
@@ -5,13 +5,17 @@ exports.ExpressFramework = void 0;
|
|
|
5
5
|
//#endregion
|
|
6
6
|
/**
|
|
7
7
|
* The framework that forwards requests to express handler
|
|
8
|
+
*
|
|
9
|
+
* @breadcrumb Frameworks / ExpressFramework
|
|
10
|
+
* @public
|
|
8
11
|
*/
|
|
9
12
|
class ExpressFramework {
|
|
10
13
|
/**
|
|
11
|
-
* @inheritDoc
|
|
14
|
+
* {@inheritDoc}
|
|
12
15
|
*/
|
|
13
16
|
sendRequest(app, request, response) {
|
|
14
17
|
app(request, response);
|
|
15
18
|
}
|
|
16
19
|
}
|
|
17
20
|
exports.ExpressFramework = ExpressFramework;
|
|
21
|
+
//# sourceMappingURL=express.framework.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"express.framework.js","sourceRoot":"","sources":["../../../src/frameworks/express/express.framework.ts"],"names":[],"mappings":";AAAA,SAAS;;;AAMT,YAAY;AAEZ;;;;;GAKG;AACH,MAAa,gBAAgB;IAC3B;;OAEG;IACI,WAAW,CAChB,GAAY,EACZ,OAAwB,EACxB,QAAwB;QAExB,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACzB,CAAC;CACF;AAXD,4CAWC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/frameworks/express/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -11,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
15
|
};
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
17
|
__exportStar(require("./express.framework"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/frameworks/express/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC"}
|
|
@@ -4,10 +4,14 @@ import type { FastifyInstance } from 'fastify';
|
|
|
4
4
|
import { FrameworkContract } from '../../contracts';
|
|
5
5
|
/**
|
|
6
6
|
* The framework that forwards requests to fastify handler
|
|
7
|
+
*
|
|
8
|
+
* @breadcrumb Frameworks / FastifyFramework
|
|
9
|
+
* @public
|
|
7
10
|
*/
|
|
8
11
|
export declare class FastifyFramework implements FrameworkContract<FastifyInstance> {
|
|
9
12
|
/**
|
|
10
|
-
* @inheritDoc
|
|
13
|
+
* {@inheritDoc}
|
|
11
14
|
*/
|
|
12
15
|
sendRequest(app: FastifyInstance, request: IncomingMessage, response: ServerResponse): void;
|
|
13
16
|
}
|
|
17
|
+
//# sourceMappingURL=fastify.framework.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fastify.framework.d.ts","sourceRoot":"","sources":["../../../src/frameworks/fastify/fastify.framework.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIpD;;;;;GAKG;AACH,qBAAa,gBAAiB,YAAW,iBAAiB,CAAC,eAAe,CAAC;IACzE;;OAEG;IACI,WAAW,CAChB,GAAG,EAAE,eAAe,EACpB,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,cAAc,GACvB,IAAI;CAIR"}
|
|
@@ -5,10 +5,13 @@ exports.FastifyFramework = void 0;
|
|
|
5
5
|
//#endregion
|
|
6
6
|
/**
|
|
7
7
|
* The framework that forwards requests to fastify handler
|
|
8
|
+
*
|
|
9
|
+
* @breadcrumb Frameworks / FastifyFramework
|
|
10
|
+
* @public
|
|
8
11
|
*/
|
|
9
12
|
class FastifyFramework {
|
|
10
13
|
/**
|
|
11
|
-
* @inheritDoc
|
|
14
|
+
* {@inheritDoc}
|
|
12
15
|
*/
|
|
13
16
|
sendRequest(app, request, response) {
|
|
14
17
|
// ref: https://www.fastify.io/docs/latest/Guides/Serverless/#implement-and-export-the-function
|
|
@@ -16,3 +19,4 @@ class FastifyFramework {
|
|
|
16
19
|
}
|
|
17
20
|
}
|
|
18
21
|
exports.FastifyFramework = FastifyFramework;
|
|
22
|
+
//# sourceMappingURL=fastify.framework.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fastify.framework.js","sourceRoot":"","sources":["../../../src/frameworks/fastify/fastify.framework.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;AAMjB,YAAY;AAEZ;;;;;GAKG;AACH,MAAa,gBAAgB;IAC3B;;OAEG;IACI,WAAW,CAChB,GAAoB,EACpB,OAAwB,EACxB,QAAwB;QAExB,+FAA+F;QAC/F,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IACxE,CAAC;CACF;AAZD,4CAYC"}
|