@midwayjs/faas 3.4.0-beta.7 → 3.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/dist/framework.d.ts +2 -1
- package/dist/framework.js +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/interface.d.ts +2 -1
- package/dist/starter.d.ts +17 -0
- package/dist/starter.js +27 -0
- package/package.json +8 -8
package/dist/framework.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare class MidwayFaaSFramework extends BaseFramework<Application, Cont
|
|
|
33
33
|
*/
|
|
34
34
|
handleInvokeWrapper(handlerMapping: string): (...args: any[]) => Promise<any>;
|
|
35
35
|
getTriggerFunction(handlerMapping: string): (context: any, options: HandlerOptions) => Promise<any>;
|
|
36
|
-
wrapHttpRequest(req: http.IncomingMessage, res?: http.ServerResponse): Promise<unknown>;
|
|
36
|
+
wrapHttpRequest(req: http.IncomingMessage | Record<string, any>, res?: http.ServerResponse): Promise<unknown>;
|
|
37
37
|
/**
|
|
38
38
|
* @deprecated
|
|
39
39
|
* @param middlewareId
|
|
@@ -45,6 +45,7 @@ export declare class MidwayFaaSFramework extends BaseFramework<Application, Cont
|
|
|
45
45
|
createLogger(name: string, option?: LoggerOptions): import("@midwayjs/core").ILogger;
|
|
46
46
|
getFrameworkName(): string;
|
|
47
47
|
getServer(): http.Server;
|
|
48
|
+
beforeStop(): Promise<void>;
|
|
48
49
|
protected createHttpContext(req: any, res: any): Promise<unknown>;
|
|
49
50
|
useMiddleware(middleware: CommonMiddlewareUnion<Context, NextFunction, undefined>): void;
|
|
50
51
|
useEventMiddleware(middleware: CommonMiddlewareUnion<Context, NextFunction, undefined>): void;
|
package/dist/framework.js
CHANGED
|
@@ -383,6 +383,13 @@ let MidwayFaaSFramework = class MidwayFaaSFramework extends core_1.BaseFramework
|
|
|
383
383
|
getServer() {
|
|
384
384
|
return this.server;
|
|
385
385
|
}
|
|
386
|
+
async beforeStop() {
|
|
387
|
+
if (this.server) {
|
|
388
|
+
new Promise(resolve => {
|
|
389
|
+
this.server.close(resolve);
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}
|
|
386
393
|
async createHttpContext(req, res) {
|
|
387
394
|
return new Promise(resolve => {
|
|
388
395
|
this.respond(req, res, resolve);
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,10 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Configuration = exports.Framework = void 0;
|
|
17
|
+
exports.AbstractBootstrapStarter = exports.Configuration = exports.Framework = void 0;
|
|
18
18
|
__exportStar(require("./interface"), exports);
|
|
19
19
|
var framework_1 = require("./framework");
|
|
20
20
|
Object.defineProperty(exports, "Framework", { enumerable: true, get: function () { return framework_1.MidwayFaaSFramework; } });
|
|
21
21
|
var configuration_1 = require("./configuration");
|
|
22
22
|
Object.defineProperty(exports, "Configuration", { enumerable: true, get: function () { return configuration_1.FaaSConfiguration; } });
|
|
23
|
+
var starter_1 = require("./starter");
|
|
24
|
+
Object.defineProperty(exports, "AbstractBootstrapStarter", { enumerable: true, get: function () { return starter_1.AbstractBootstrapStarter; } });
|
|
23
25
|
//# sourceMappingURL=index.js.map
|
package/dist/interface.d.ts
CHANGED
|
@@ -65,6 +65,8 @@ export interface IWebMiddleware {
|
|
|
65
65
|
export interface ServerlessStarterOptions extends IMidwayBootstrapOptions {
|
|
66
66
|
initializeMethodName?: string;
|
|
67
67
|
handlerName?: string;
|
|
68
|
+
aggregationHandlerName?: string;
|
|
69
|
+
handlerNameMapping?: (handlerName: string, ...args: unknown[]) => [string, ...unknown[]];
|
|
68
70
|
createAdapter?: () => Promise<{
|
|
69
71
|
close(): any;
|
|
70
72
|
createAppHook(app?: any): any;
|
|
@@ -73,6 +75,5 @@ export interface ServerlessStarterOptions extends IMidwayBootstrapOptions {
|
|
|
73
75
|
mark(label: string): any;
|
|
74
76
|
end(): any;
|
|
75
77
|
};
|
|
76
|
-
exportAllHandler?: boolean;
|
|
77
78
|
}
|
|
78
79
|
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ServerlessStarterOptions } from './interface';
|
|
2
|
+
import { IMidwayBootstrapOptions } from '@midwayjs/core';
|
|
3
|
+
export declare abstract class AbstractBootstrapStarter {
|
|
4
|
+
protected options: ServerlessStarterOptions;
|
|
5
|
+
protected applicationContext: any;
|
|
6
|
+
protected framework: any;
|
|
7
|
+
constructor(options?: ServerlessStarterOptions);
|
|
8
|
+
getApplicationContext(): any;
|
|
9
|
+
close(): Promise<void>;
|
|
10
|
+
start(options?: ServerlessStarterOptions): any;
|
|
11
|
+
initFramework(bootstrapOptions?: IMidwayBootstrapOptions): Promise<void>;
|
|
12
|
+
abstract onStart(): any;
|
|
13
|
+
abstract onInit(...args: unknown[]): any;
|
|
14
|
+
abstract onRequest(...args: unknown[]): any;
|
|
15
|
+
abstract onClose(): any;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=starter.d.ts.map
|
package/dist/starter.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractBootstrapStarter = void 0;
|
|
4
|
+
const core_1 = require("@midwayjs/core");
|
|
5
|
+
class AbstractBootstrapStarter {
|
|
6
|
+
constructor(options = {}) {
|
|
7
|
+
this.options = options;
|
|
8
|
+
}
|
|
9
|
+
getApplicationContext() {
|
|
10
|
+
return this.applicationContext;
|
|
11
|
+
}
|
|
12
|
+
async close() {
|
|
13
|
+
await this.onClose();
|
|
14
|
+
}
|
|
15
|
+
start(options) {
|
|
16
|
+
this.options = Object.assign(this.options, options);
|
|
17
|
+
return this.onStart();
|
|
18
|
+
}
|
|
19
|
+
async initFramework(bootstrapOptions = {}) {
|
|
20
|
+
// init midway
|
|
21
|
+
this.applicationContext = await (0, core_1.initializeGlobalApplicationContext)(bootstrapOptions);
|
|
22
|
+
const midwayFrameworkService = this.applicationContext.get(core_1.MidwayFrameworkService);
|
|
23
|
+
this.framework = midwayFrameworkService.getMainFramework();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.AbstractBootstrapStarter = AbstractBootstrapStarter;
|
|
27
|
+
//# sourceMappingURL=starter.js.map
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/faas",
|
|
3
|
-
"version": "3.4.0
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"main": "dist/index",
|
|
5
5
|
"typings": "index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@midwayjs/core": "^3.4.0
|
|
7
|
+
"@midwayjs/core": "^3.4.0",
|
|
8
8
|
"@midwayjs/faas-typings": "^3.3.5",
|
|
9
9
|
"@midwayjs/logger": "^2.15.0",
|
|
10
|
-
"@midwayjs/serverless-http-parser": "^3.4.0
|
|
10
|
+
"@midwayjs/serverless-http-parser": "^3.4.0",
|
|
11
11
|
"@midwayjs/simple-lock": "^1.1.4"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@midwayjs/decorator": "^3.4.0
|
|
15
|
-
"@midwayjs/mock": "^3.4.0
|
|
16
|
-
"@midwayjs/serverless-fc-starter": "^3.4.0
|
|
17
|
-
"@midwayjs/serverless-scf-starter": "^3.4.0
|
|
14
|
+
"@midwayjs/decorator": "^3.4.0",
|
|
15
|
+
"@midwayjs/mock": "^3.4.0",
|
|
16
|
+
"@midwayjs/serverless-fc-starter": "^3.4.0",
|
|
17
|
+
"@midwayjs/serverless-scf-starter": "^3.4.0",
|
|
18
18
|
"mm": "3.2.0"
|
|
19
19
|
},
|
|
20
20
|
"engines": {
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"url": "git@github.com:midwayjs/midway.git"
|
|
47
47
|
},
|
|
48
48
|
"license": "MIT",
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "e48ea9cb52c6e70ab25b68f1188006100eab8184"
|
|
50
50
|
}
|