@nocobase/server 1.0.0-alpha.11 → 1.0.0-alpha.13
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-supervisor.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export declare class AppSupervisor extends EventEmitter implements AsyncEmitter
|
|
|
25
25
|
apps: {
|
|
26
26
|
[appName: string]: Application;
|
|
27
27
|
};
|
|
28
|
+
lastSeenAt: Map<string, number>;
|
|
28
29
|
appErrors: {
|
|
29
30
|
[appName: string]: Error;
|
|
30
31
|
};
|
|
@@ -57,6 +58,7 @@ export declare class AppSupervisor extends EventEmitter implements AsyncEmitter
|
|
|
57
58
|
getAppStatus(appName: string, defaultStatus?: AppStatus): AppStatus | null;
|
|
58
59
|
bootMainApp(options: ApplicationOptions): Application<import("./application").DefaultState, import("./application").DefaultContext>;
|
|
59
60
|
hasApp(appName: string): boolean;
|
|
61
|
+
touchApp(appName: string): void;
|
|
60
62
|
addApp(app: Application): Application<import("./application").DefaultState, import("./application").DefaultContext>;
|
|
61
63
|
getAppsNames(): Promise<string[]>;
|
|
62
64
|
removeApp(appName: string): Promise<void>;
|
package/lib/app-supervisor.js
CHANGED
|
@@ -54,6 +54,7 @@ const _AppSupervisor = class _AppSupervisor extends import_events.EventEmitter {
|
|
|
54
54
|
runningMode = "multiple";
|
|
55
55
|
singleAppName = null;
|
|
56
56
|
apps = {};
|
|
57
|
+
lastSeenAt = /* @__PURE__ */ new Map();
|
|
57
58
|
appErrors = {};
|
|
58
59
|
appStatus = {};
|
|
59
60
|
lastMaintainingMessage = {};
|
|
@@ -156,6 +157,12 @@ const _AppSupervisor = class _AppSupervisor extends import_events.EventEmitter {
|
|
|
156
157
|
hasApp(appName) {
|
|
157
158
|
return !!this.apps[appName];
|
|
158
159
|
}
|
|
160
|
+
touchApp(appName) {
|
|
161
|
+
if (!this.hasApp(appName)) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
this.lastSeenAt.set(appName, Math.floor(Date.now() / 1e3));
|
|
165
|
+
}
|
|
159
166
|
// add app into supervisor
|
|
160
167
|
addApp(app) {
|
|
161
168
|
if (this.apps[app.name]) {
|
|
@@ -203,6 +210,7 @@ const _AppSupervisor = class _AppSupervisor extends import_events.EventEmitter {
|
|
|
203
210
|
delete this.appErrors[app.name];
|
|
204
211
|
delete this.lastMaintainingMessage[app.name];
|
|
205
212
|
delete this.statusBeforeCommanding[app.name];
|
|
213
|
+
this.lastSeenAt.delete(app.name);
|
|
206
214
|
});
|
|
207
215
|
app.on("maintainingMessageChanged", ({ message, maintainingStatus }) => {
|
|
208
216
|
if (this.lastMaintainingMessage[app.name] === message) {
|
package/lib/application.js
CHANGED
|
@@ -69,6 +69,7 @@ var import_data_source_manager = require("@nocobase/data-source-manager");
|
|
|
69
69
|
var import_package = __toESM(require("../package.json"));
|
|
70
70
|
var import_main_data_source = require("./main-data-source");
|
|
71
71
|
var import_validate_filter_params = __toESM(require("./middlewares/validate-filter-params"));
|
|
72
|
+
var import_path2 = __toESM(require("path"));
|
|
72
73
|
const _Application = class _Application extends import_koa.default {
|
|
73
74
|
constructor(options) {
|
|
74
75
|
super();
|
|
@@ -702,7 +703,7 @@ const _Application = class _Application extends import_koa.default {
|
|
|
702
703
|
const { dirname } = options;
|
|
703
704
|
return (0, import_logger.createLogger)({
|
|
704
705
|
...options,
|
|
705
|
-
dirname: (0, import_logger.getLoggerFilePath)(this.name || "main", dirname || "")
|
|
706
|
+
dirname: (0, import_logger.getLoggerFilePath)(import_path2.default.join(this.name || "main", dirname || ""))
|
|
706
707
|
});
|
|
707
708
|
}
|
|
708
709
|
createCLI() {
|
package/lib/gateway/index.js
CHANGED
|
@@ -240,6 +240,9 @@ const _Gateway = class _Gateway extends import_events.EventEmitter {
|
|
|
240
240
|
res.end("ok");
|
|
241
241
|
return;
|
|
242
242
|
}
|
|
243
|
+
if (handleApp !== "main") {
|
|
244
|
+
import_app_supervisor.AppSupervisor.getInstance().touchApp(handleApp);
|
|
245
|
+
}
|
|
243
246
|
app.callback()(req, res);
|
|
244
247
|
}
|
|
245
248
|
getAppSelectorMiddlewares() {
|
|
@@ -820,20 +820,18 @@ const _PluginManager = class _PluginManager {
|
|
|
820
820
|
if (!await this.app.isStarted()) {
|
|
821
821
|
this.app.log.debug("app upgrading");
|
|
822
822
|
await this.app.runCommand("upgrade");
|
|
823
|
-
await (0,
|
|
823
|
+
await (0, import_helper.tsxRerunning)();
|
|
824
|
+
await (0, import_execa.default)("yarn", ["nocobase", "pm2-restart"], {
|
|
824
825
|
env: process.env
|
|
825
826
|
});
|
|
826
827
|
return;
|
|
827
828
|
}
|
|
828
829
|
const file = (0, import_path.resolve)(process.cwd(), "storage/app-upgrading");
|
|
829
830
|
await import_fs.default.promises.writeFile(file, "", "utf-8");
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
env: process.env
|
|
835
|
-
});
|
|
836
|
-
}
|
|
831
|
+
await (0, import_helper.tsxRerunning)();
|
|
832
|
+
await (0, import_execa.default)("yarn", ["nocobase", "pm2-restart"], {
|
|
833
|
+
env: process.env
|
|
834
|
+
});
|
|
837
835
|
}, "upgrade");
|
|
838
836
|
if (Array.isArray(nameOrPkg)) {
|
|
839
837
|
for (const name of nameOrPkg) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/server",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.13",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -10,18 +10,18 @@
|
|
|
10
10
|
"@koa/cors": "^3.1.0",
|
|
11
11
|
"@koa/multer": "^3.0.2",
|
|
12
12
|
"@koa/router": "^9.4.0",
|
|
13
|
-
"@nocobase/acl": "1.0.0-alpha.
|
|
14
|
-
"@nocobase/actions": "1.0.0-alpha.
|
|
15
|
-
"@nocobase/auth": "1.0.0-alpha.
|
|
16
|
-
"@nocobase/cache": "1.0.0-alpha.
|
|
17
|
-
"@nocobase/data-source-manager": "1.0.0-alpha.
|
|
18
|
-
"@nocobase/database": "1.0.0-alpha.
|
|
19
|
-
"@nocobase/evaluators": "1.0.0-alpha.
|
|
20
|
-
"@nocobase/logger": "1.0.0-alpha.
|
|
21
|
-
"@nocobase/resourcer": "1.0.0-alpha.
|
|
22
|
-
"@nocobase/sdk": "1.0.0-alpha.
|
|
23
|
-
"@nocobase/telemetry": "1.0.0-alpha.
|
|
24
|
-
"@nocobase/utils": "1.0.0-alpha.
|
|
13
|
+
"@nocobase/acl": "1.0.0-alpha.13",
|
|
14
|
+
"@nocobase/actions": "1.0.0-alpha.13",
|
|
15
|
+
"@nocobase/auth": "1.0.0-alpha.13",
|
|
16
|
+
"@nocobase/cache": "1.0.0-alpha.13",
|
|
17
|
+
"@nocobase/data-source-manager": "1.0.0-alpha.13",
|
|
18
|
+
"@nocobase/database": "1.0.0-alpha.13",
|
|
19
|
+
"@nocobase/evaluators": "1.0.0-alpha.13",
|
|
20
|
+
"@nocobase/logger": "1.0.0-alpha.13",
|
|
21
|
+
"@nocobase/resourcer": "1.0.0-alpha.13",
|
|
22
|
+
"@nocobase/sdk": "1.0.0-alpha.13",
|
|
23
|
+
"@nocobase/telemetry": "1.0.0-alpha.13",
|
|
24
|
+
"@nocobase/utils": "1.0.0-alpha.13",
|
|
25
25
|
"@types/decompress": "4.2.4",
|
|
26
26
|
"@types/ini": "^1.3.31",
|
|
27
27
|
"@types/koa-send": "^4.1.3",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"@types/serve-handler": "^6.1.1",
|
|
55
55
|
"@types/ws": "^8.5.5"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "bd97adef70762a6691b5b58ca6572672a8cdf838"
|
|
58
58
|
}
|