@h4ad/serverless-adapter 2.15.0 → 2.16.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 +5 -0
- package/lib/core/logger.js +36 -13
- package/lib/core/logger.js.map +1 -1
- package/lib/handlers/default/default.handler.js +4 -4
- package/lib/handlers/default/default.handler.js.map +1 -1
- package/lib/handlers/firebase/http-firebase-v2.handler.d.ts +26 -0
- package/lib/handlers/firebase/http-firebase-v2.handler.js +50 -0
- package/lib/handlers/firebase/http-firebase-v2.handler.js.map +1 -0
- package/lib/handlers/firebase/http-firebase.handler.d.ts +1 -1
- package/lib/handlers/firebase/http-firebase.handler.js +3 -3
- package/lib/handlers/firebase/http-firebase.handler.js.map +1 -1
- package/lib/handlers/firebase/index.d.ts +1 -0
- package/lib/handlers/firebase/index.js +1 -0
- package/lib/handlers/firebase/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
<a href="#usage">Usage</a> |
|
|
8
8
|
<a href="#support">Support</a> |
|
|
9
9
|
<a href="#examples">Examples</a> |
|
|
10
|
+
<a href="#benchmark">Benchmark</a> |
|
|
10
11
|
<a href="#architecture">Architecture</a> |
|
|
11
12
|
<a href="#credits">Credits</a>
|
|
12
13
|
</p>
|
|
@@ -89,6 +90,10 @@ See how to use this library [here](https://viniciusl.com.br/serverless-adapter/d
|
|
|
89
90
|
|
|
90
91
|
You can see some examples of how to use this library [here](https://github.com/H4ad/serverless-adapter-examples).
|
|
91
92
|
|
|
93
|
+
# Benchmark
|
|
94
|
+
|
|
95
|
+
See the speed comparison between other libraries that have the same purpose in the [Benchmark Section](./benchmark).
|
|
96
|
+
|
|
92
97
|
# Credits
|
|
93
98
|
|
|
94
99
|
Honestly, I just refactored all the code that the @vendia team and many other contributors wrote, thanks so much to them
|
package/lib/core/logger.js
CHANGED
|
@@ -22,6 +22,33 @@ exports.__ΩILogger = __ΩILogger;
|
|
|
22
22
|
* @public
|
|
23
23
|
*/
|
|
24
24
|
const InternalLoggerSymbol = Symbol('InternalLogger');
|
|
25
|
+
const errorLogLevel = new Map([
|
|
26
|
+
['debug', true],
|
|
27
|
+
['verbose', true],
|
|
28
|
+
['info', true],
|
|
29
|
+
['warn', true],
|
|
30
|
+
['error', true],
|
|
31
|
+
]);
|
|
32
|
+
const warnLogLevel = new Map([
|
|
33
|
+
['debug', true],
|
|
34
|
+
['verbose', true],
|
|
35
|
+
['info', true],
|
|
36
|
+
['warn', true],
|
|
37
|
+
]);
|
|
38
|
+
const infoLogLevel = new Map([
|
|
39
|
+
['debug', true],
|
|
40
|
+
['verbose', true],
|
|
41
|
+
['info', true],
|
|
42
|
+
]);
|
|
43
|
+
const verboseLogLevel = new Map([
|
|
44
|
+
['debug', true],
|
|
45
|
+
['verbose', true],
|
|
46
|
+
]);
|
|
47
|
+
const lazyPrint = __assignType(value => {
|
|
48
|
+
if (typeof value === 'function')
|
|
49
|
+
return value();
|
|
50
|
+
return value;
|
|
51
|
+
}, ['value', '', 'P"2!"/"']);
|
|
25
52
|
/**
|
|
26
53
|
* The method used to create a simple logger instance to use in this library.
|
|
27
54
|
*
|
|
@@ -41,36 +68,32 @@ const InternalLoggerSymbol = Symbol('InternalLogger');
|
|
|
41
68
|
* @public
|
|
42
69
|
*/
|
|
43
70
|
function createDefaultLogger({ level } = { level: 'error' }) {
|
|
44
|
-
const errorLogLevel = ['debug', 'verbose', 'info', 'warn', 'error'];
|
|
45
|
-
const warnLogLevel = ['debug', 'verbose', 'info', 'warn'];
|
|
46
|
-
const infoLogLevel = ['debug', 'verbose', 'info'];
|
|
47
|
-
const verboseLogLevel = ['debug', 'verbose'];
|
|
48
71
|
return {
|
|
49
72
|
[InternalLoggerSymbol]: true,
|
|
50
73
|
error: __assignType((message, ...additional) => {
|
|
51
|
-
if (!errorLogLevel.
|
|
74
|
+
if (!errorLogLevel.has(level))
|
|
52
75
|
return;
|
|
53
|
-
console.error(message, ...additional);
|
|
76
|
+
console.error(message, ...additional.map(lazyPrint));
|
|
54
77
|
}, ['message', 'additional', '', 'P"2!"@2""/#']),
|
|
55
78
|
warn: __assignType((message, ...additional) => {
|
|
56
|
-
if (!warnLogLevel.
|
|
79
|
+
if (!warnLogLevel.has(level))
|
|
57
80
|
return;
|
|
58
|
-
console.warn(message, ...additional);
|
|
81
|
+
console.warn(message, ...additional.map(lazyPrint));
|
|
59
82
|
}, ['message', 'additional', '', 'P"2!"@2""/#']),
|
|
60
83
|
info: __assignType((message, ...additional) => {
|
|
61
|
-
if (!infoLogLevel.
|
|
84
|
+
if (!infoLogLevel.has(level))
|
|
62
85
|
return;
|
|
63
|
-
console.info(message, ...additional);
|
|
86
|
+
console.info(message, ...additional.map(lazyPrint));
|
|
64
87
|
}, ['message', 'additional', '', 'P"2!"@2""/#']),
|
|
65
88
|
verbose: __assignType((message, ...additional) => {
|
|
66
|
-
if (!verboseLogLevel.
|
|
89
|
+
if (!verboseLogLevel.has(level))
|
|
67
90
|
return;
|
|
68
|
-
console.debug(message, ...additional);
|
|
91
|
+
console.debug(message, ...additional.map(lazyPrint));
|
|
69
92
|
}, ['message', 'additional', '', 'P"2!"@2""/#']),
|
|
70
93
|
debug: __assignType((message, ...additional) => {
|
|
71
94
|
if (level !== 'debug')
|
|
72
95
|
return;
|
|
73
|
-
console.debug(message, ...additional);
|
|
96
|
+
console.debug(message, ...additional.map(lazyPrint));
|
|
74
97
|
}, ['message', 'additional', '', 'P"2!"@2""/#']),
|
|
75
98
|
};
|
|
76
99
|
}
|
package/lib/core/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/core/logger.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA6CA;;;;;GAKG;AACH,MAAM,oBAAoB,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAEtD
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src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OAAO,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;AACxC,CAAC;AAFD,4CAEC"}
|
|
@@ -61,12 +61,12 @@ class DefaultHandler extends core_1.BaseHandler {
|
|
|
61
61
|
* @param respondWithErrors - Indicates whether the error stack should be included in the response or not
|
|
62
62
|
*/
|
|
63
63
|
onReceiveRequest(log, event, context, binarySettings, respondWithErrors) {
|
|
64
|
-
log.debug('SERVERLESS_ADAPTER:PROXY', {
|
|
64
|
+
log.debug('SERVERLESS_ADAPTER:PROXY', () => ({
|
|
65
65
|
event: util_1.default.inspect(event, { depth: null }),
|
|
66
66
|
context: util_1.default.inspect(context, { depth: null }),
|
|
67
67
|
binarySettings,
|
|
68
68
|
respondWithErrors,
|
|
69
|
-
});
|
|
69
|
+
}));
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* The hook executed after resolve the adapter that will be used to handle the request and response
|
|
@@ -129,10 +129,10 @@ class DefaultHandler extends core_1.BaseHandler {
|
|
|
129
129
|
* @param body - The body of the response sent by the framework
|
|
130
130
|
*/
|
|
131
131
|
onForwardResponseAdapterResponse(log, successResponse, body) {
|
|
132
|
-
log.debug('SERVERLESS_ADAPTER:FORWARD_RESPONSE:EVENT_SOURCE_RESPONSE', {
|
|
132
|
+
log.debug('SERVERLESS_ADAPTER:FORWARD_RESPONSE:EVENT_SOURCE_RESPONSE', () => ({
|
|
133
133
|
successResponse: util_1.default.inspect(successResponse, { depth: null }),
|
|
134
134
|
body,
|
|
135
|
-
});
|
|
135
|
+
}));
|
|
136
136
|
}
|
|
137
137
|
//#endregion
|
|
138
138
|
//#region Protected Methods
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.handler.js","sourceRoot":"","sources":["../../../src/handlers/default/default.handler.ts"],"names":[],"mappings":";;;;;;yCAUO,iBAAiB;uCAAjB,iBAAiB;wCAAjB,iBAAiB;sCAP2B,cAAc;+BAc1D,YAAY;yCAPZ,iBAAiB;sCAAjB,iBAAi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C,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;QACrD,MAAM,IAAI,GAAG,4BAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAClE,MAAM,OAAO,GAAG,eAAe,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC;QAE5D,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;QAE3E,MAAM,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;YAC1C,KAAK;YACL,UAAU;YACV,IAAI;YACJ,OAAO;YACP,eAAe;YACf,QAAQ;YACR,GAAG;SACJ,CAAC,CAAC;QAEH,IAAI,CAAC,gCAAgC,CAAC,GAAG,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;QAErE,OAAO,eAAe,CAAC;IACzB,CAAC;;AAvRH,wCA0RC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { https } from 'firebase-functions/v2';
|
|
2
|
+
import { FrameworkContract, HandlerContract } from '../../contracts';
|
|
3
|
+
import { RawRequest } from '../base';
|
|
4
|
+
/**
|
|
5
|
+
* The class that implements a handler for Firebase Https Events
|
|
6
|
+
*
|
|
7
|
+
* @remarks Read more about Https Events {@link https://firebase.google.com/docs/functions/http-events | here}
|
|
8
|
+
*
|
|
9
|
+
* @breadcrumb Handlers / HttpFirebaseHandler
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare class HttpFirebaseV2Handler<TApp> extends RawRequest<TApp> implements HandlerContract<TApp, never, never, never, void, void | Promise<void>> {
|
|
13
|
+
protected readonly options?: https.HttpsOptions | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Construtor padrão
|
|
16
|
+
*/
|
|
17
|
+
constructor(options?: https.HttpsOptions | undefined);
|
|
18
|
+
/**
|
|
19
|
+
* {@inheritDoc}
|
|
20
|
+
*/
|
|
21
|
+
getHandler(app: TApp, framework: FrameworkContract<TApp>): ReturnType<HttpFirebaseV2Handler<TApp>['onRequestCallback']>;
|
|
22
|
+
/**
|
|
23
|
+
* Wrapper method around onRequest for better testability
|
|
24
|
+
*/
|
|
25
|
+
protected onRequestWithOptions(options: https.HttpsOptions, callback: ReturnType<HttpFirebaseV2Handler<TApp>['onRequestCallback']>): ReturnType<HttpFirebaseV2Handler<TApp>['onRequestCallback']>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpFirebaseV2Handler = void 0;
|
|
4
|
+
const { __ΩFrameworkContract } = require('../../contracts');
|
|
5
|
+
const __ΩReturnType = ['T', 'args', '', 'l>e"!R"RPde#!P"@2"h"!/#qk#\'QRb!Pde"!p)'];
|
|
6
|
+
//#region Imports
|
|
7
|
+
// eslint-disable-next-line import/no-unresolved
|
|
8
|
+
const v2_1 = require("firebase-functions/v2");
|
|
9
|
+
const base_1 = require("../base");
|
|
10
|
+
//#endregion
|
|
11
|
+
/**
|
|
12
|
+
* The class that implements a handler for Firebase Https Events
|
|
13
|
+
*
|
|
14
|
+
* @remarks Read more about Https Events {@link https://firebase.google.com/docs/functions/http-events | here}
|
|
15
|
+
*
|
|
16
|
+
* @breadcrumb Handlers / HttpFirebaseHandler
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
class HttpFirebaseV2Handler extends base_1.RawRequest {
|
|
20
|
+
//#region Constructor
|
|
21
|
+
/**
|
|
22
|
+
* Construtor padrão
|
|
23
|
+
*/
|
|
24
|
+
constructor(options) {
|
|
25
|
+
super();
|
|
26
|
+
this.options = options;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region Public Methods
|
|
30
|
+
/**
|
|
31
|
+
* {@inheritDoc}
|
|
32
|
+
*/
|
|
33
|
+
getHandler(app, framework) {
|
|
34
|
+
if (this.options) {
|
|
35
|
+
return this.onRequestWithOptions(this.options, this.onRequestCallback(app, framework));
|
|
36
|
+
}
|
|
37
|
+
return v2_1.https.onRequest(this.onRequestCallback(app, framework));
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region Protected Method
|
|
41
|
+
/**
|
|
42
|
+
* Wrapper method around onRequest for better testability
|
|
43
|
+
*/
|
|
44
|
+
onRequestWithOptions(options, callback) {
|
|
45
|
+
return v2_1.https.onRequest(options, callback);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.HttpFirebaseV2Handler = HttpFirebaseV2Handler;
|
|
49
|
+
HttpFirebaseV2Handler.__type = ['TApp', () => base_1.RawRequest, 'options', 'constructor', 'app', () => __ΩFrameworkContract, 'framework', () => __ΩReturnType, () => HttpFirebaseV2Handler, "onRequestCallback", 'getHandler', () => __ΩReturnType, () => HttpFirebaseV2Handler, "onRequestCallback", 'callback', () => __ΩReturnType, () => HttpFirebaseV2Handler, "onRequestCallback", 'onRequestWithOptions', 'b!Pe"!7"P!2#8<9"0$Pe"!2%e"!o&"2\'Pe#!7).*fo("0+P!2#Pe#!7-..fo,"2/Pe#!71.2fo0"03<5e!!6"'];
|
|
50
|
+
//# sourceMappingURL=http-firebase-v2.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-firebase-v2.handler.js","sourceRoot":"","sources":["../../../src/handlers/firebase/http-firebase-v2.handler.ts"],"names":[],"mappings":";;;yCAImD,iBAAiB;;AAJpE,iBAAiB;AAEjB,gDAAgD;AAChD,8CAA8C;AAE9C,kCAAqC;AAErC,YAAY;AAEZ;;;;;;;GAOG;AACH,MAAa,qBACX,SAAQ,iBAAgB;IAIxB,qBAAqB;IAErB;;OAEG;IACH,YAA+B,OAA4B;QACzD,KAAK,EAAE,CAAC;QADqB,YAAO,GAAP,OAAO,CAAqB;IAE3D,CAAC;IAED,YAAY;IAEZ,wBAAwB;IAExB;;OAEG;IACI,UAAU,CACf,GAAS,EACT,SAAkC;QAElC,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,OAAO,IAAI,CAAC,oBAAoB,CAC9B,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,SAAS,CAAC,CACvC,CAAC;SACH;QAED,OAAO,UAAK,CAAC,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,YAAY;IAEZ,0BAA0B;IAE1B;;OAEG;IACO,oBAAoB,CAC5B,OAA2B,EAC3B,QAAsE;QAEtE,OAAO,UAAK,CAAC,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC5C,CAAC;;AA/CH,sDAkDC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
3
3
|
import { FrameworkContract, HandlerContract } from '../../contracts';
|
|
4
|
-
import { RawRequest } from '../base
|
|
4
|
+
import { RawRequest } from '../base';
|
|
5
5
|
/**
|
|
6
6
|
* The class that implements a handler for Firebase Https Events
|
|
7
7
|
*
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.HttpFirebaseHandler = void 0;
|
|
4
4
|
const { __ΩFrameworkContract } = require('../../contracts');
|
|
5
5
|
const firebase_functions_1 = require("firebase-functions");
|
|
6
|
-
const
|
|
6
|
+
const base_1 = require("../base");
|
|
7
7
|
//#endregion
|
|
8
8
|
/**
|
|
9
9
|
* The class that implements a handler for Firebase Https Events
|
|
@@ -13,7 +13,7 @@ const index_1 = require("../base/index");
|
|
|
13
13
|
* @breadcrumb Handlers / HttpFirebaseHandler
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
|
-
class HttpFirebaseHandler extends
|
|
16
|
+
class HttpFirebaseHandler extends base_1.RawRequest {
|
|
17
17
|
//#region Public Methods
|
|
18
18
|
/**
|
|
19
19
|
* {@inheritDoc}
|
|
@@ -23,5 +23,5 @@ class HttpFirebaseHandler extends index_1.RawRequest {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
exports.HttpFirebaseHandler = HttpFirebaseHandler;
|
|
26
|
-
HttpFirebaseHandler.__type = ['TApp', () =>
|
|
26
|
+
HttpFirebaseHandler.__type = ['TApp', () => base_1.RawRequest, 'app', () => __ΩFrameworkContract, 'framework', 'req', 'res', '', 'getHandler', 'b!Pe"!7"Pe"!2#e"!o$"2%P!2&!2\'P$$`J/(0)5e!!6"'];
|
|
27
27
|
//# sourceMappingURL=http-firebase.handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-firebase.handler.js","sourceRoot":"","sources":["../../../src/handlers/firebase/http-firebase.handler.ts"],"names":[],"mappings":";;;yCAImD,iBAAiB;AADpE,2DAA2C;AAE3C,
|
|
1
|
+
{"version":3,"file":"http-firebase.handler.js","sourceRoot":"","sources":["../../../src/handlers/firebase/http-firebase.handler.ts"],"names":[],"mappings":";;;yCAImD,iBAAiB;AADpE,2DAA2C;AAE3C,kCAAqC;AAErC,YAAY;AACZ;;;;;;;GAOG;AACH,MAAa,mBACX,SAAQ,iBAAgB;IAIxB,wBAAwB;IAExB;;OAEG;IACI,UAAU,CACf,GAAS,EACT,SAAkC;QAElC,OAAO,0BAAK,CAAC,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC;IACjE,CAAC;;AAfH,kDAkBC"}
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./http-firebase.handler"), exports);
|
|
18
|
+
__exportStar(require("./http-firebase-v2.handler"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/handlers/firebase/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/handlers/firebase/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,6DAA2C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h4ad/serverless-adapter",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.0",
|
|
4
4
|
"description": "Run REST APIs and other web applications using your existing Node.js application framework (NestJS, Express, Koa, Hapi, Fastify and many others), on top of AWS, Azure, Digital Ocean and many other clouds.",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"files": [
|