@nocobase/server 0.9.3-alpha.1 → 0.9.4-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/app-manager.d.ts +2 -0
- package/lib/app-manager.js +13 -1
- package/package.json +8 -8
package/lib/app-manager.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ declare type AppSelector = (req: IncomingMessage) => AppSelectorReturn | Promise
|
|
|
6
6
|
export declare class AppManager {
|
|
7
7
|
applications: Map<string, Application>;
|
|
8
8
|
app: Application;
|
|
9
|
+
runningMode: 'single' | 'multiple';
|
|
10
|
+
singleAppName: string | null;
|
|
9
11
|
constructor(app: Application);
|
|
10
12
|
bindMainApplication(mainApp: Application): void;
|
|
11
13
|
appSelector: AppSelector;
|
package/lib/app-manager.js
CHANGED
|
@@ -22,6 +22,8 @@ class AppManager {
|
|
|
22
22
|
var _this = this;
|
|
23
23
|
this.applications = new Map();
|
|
24
24
|
this.app = void 0;
|
|
25
|
+
this.runningMode = 'multiple';
|
|
26
|
+
this.singleAppName = null;
|
|
25
27
|
this.appSelector = /*#__PURE__*/function () {
|
|
26
28
|
var _ref = _asyncToGenerator(function* (req) {
|
|
27
29
|
return _this.app;
|
|
@@ -31,6 +33,11 @@ class AppManager {
|
|
|
31
33
|
};
|
|
32
34
|
}();
|
|
33
35
|
this.bindMainApplication(app);
|
|
36
|
+
// if STARTUP_SUBAPP is set, run in single mode
|
|
37
|
+
if (process.env.STARTUP_SUBAPP) {
|
|
38
|
+
this.singleAppName = process.env.STARTUP_SUBAPP;
|
|
39
|
+
this.runningMode = 'single';
|
|
40
|
+
}
|
|
34
41
|
}
|
|
35
42
|
bindMainApplication(mainApp) {
|
|
36
43
|
var _this2 = this;
|
|
@@ -101,7 +108,12 @@ class AppManager {
|
|
|
101
108
|
return /*#__PURE__*/function () {
|
|
102
109
|
var _ref3 = _asyncToGenerator(function* (req, res) {
|
|
103
110
|
const appManager = _this5.app.appManager;
|
|
104
|
-
let handleApp
|
|
111
|
+
let handleApp;
|
|
112
|
+
if (_this5.runningMode === 'single') {
|
|
113
|
+
handleApp = _this5.singleAppName;
|
|
114
|
+
} else {
|
|
115
|
+
handleApp = (yield appManager.appSelector(req)) || appManager.app;
|
|
116
|
+
}
|
|
105
117
|
if (typeof handleApp === 'string') {
|
|
106
118
|
handleApp = yield appManager.getApplication(handleApp);
|
|
107
119
|
if (!handleApp) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/server",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4-alpha.2",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
"@hapi/topo": "^6.0.0",
|
|
9
9
|
"@koa/cors": "^3.1.0",
|
|
10
10
|
"@koa/router": "^9.4.0",
|
|
11
|
-
"@nocobase/acl": "0.9.
|
|
12
|
-
"@nocobase/actions": "0.9.
|
|
13
|
-
"@nocobase/database": "0.9.
|
|
14
|
-
"@nocobase/logger": "0.9.
|
|
15
|
-
"@nocobase/resourcer": "0.9.
|
|
16
|
-
"@nocobase/utils": "0.9.
|
|
11
|
+
"@nocobase/acl": "0.9.4-alpha.2",
|
|
12
|
+
"@nocobase/actions": "0.9.4-alpha.2",
|
|
13
|
+
"@nocobase/database": "0.9.4-alpha.2",
|
|
14
|
+
"@nocobase/logger": "0.9.4-alpha.2",
|
|
15
|
+
"@nocobase/resourcer": "0.9.4-alpha.2",
|
|
16
|
+
"@nocobase/utils": "0.9.4-alpha.2",
|
|
17
17
|
"chalk": "^4.1.1",
|
|
18
18
|
"commander": "^9.2.0",
|
|
19
19
|
"find-package-json": "^1.2.0",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/semver": "^7.3.9"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "2bc19a85bf9425aa220b6c467315c8087f333a7e"
|
|
33
33
|
}
|