@nocobase/server 1.7.0-beta.1 → 1.7.0-beta.10

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.
@@ -245,7 +245,7 @@ const _AppSupervisor = class _AppSupervisor extends import_events.EventEmitter {
245
245
  this.setAppStatus(app.name, "running");
246
246
  }
247
247
  });
248
- app.on("afterStop", async () => {
248
+ app.on("__stopped", async () => {
249
249
  this.setAppStatus(app.name, "stopped");
250
250
  });
251
251
  app.on("maintaining", (maintainingStatus) => {
@@ -365,6 +365,8 @@ const _Application = class _Application extends import_koa.default {
365
365
  return;
366
366
  }
367
367
  this.log.info("app reinitializing");
368
+ await this.emitAsync("beforeStop");
369
+ await this.emitAsync("afterStop");
368
370
  if (this.cacheManager) {
369
371
  await this.cacheManager.close();
370
372
  }
@@ -677,6 +679,7 @@ const _Application = class _Application extends import_koa.default {
677
679
  await this.telemetry.shutdown();
678
680
  }
679
681
  await this.emitAsync("afterStop", this, options);
682
+ this.emit("__stopped", this, options);
680
683
  this.stopped = true;
681
684
  log.info(`app has stopped`, { method: "stop" });
682
685
  this._started = null;
@@ -82,7 +82,7 @@ async function parseVariables(ctx, next) {
82
82
  // 新的命名方式,防止和 formily 内置变量冲突
83
83
  $nDate: (0, import_utils.getDateVars)(),
84
84
  $user: getUser(ctx),
85
- $nRole: ctx.state.currentRole
85
+ $nRole: ctx.state.currentRole === "__union__" ? ctx.state.currentRoles : ctx.state.currentRole
86
86
  }
87
87
  });
88
88
  await next();
@@ -30,17 +30,21 @@ __export(run_plugin_static_imports_exports, {
30
30
  runPluginStaticImports: () => runPluginStaticImports
31
31
  });
32
32
  module.exports = __toCommonJS(run_plugin_static_imports_exports);
33
+ var import_logger = require("@nocobase/logger");
33
34
  var import_server = require("@nocobase/server");
35
+ var import_utils = require("@nocobase/utils");
34
36
  async function runPluginStaticImports() {
35
37
  const packages = await (0, import_server.findAllPlugins)();
36
38
  for (const name of packages) {
37
39
  const { packageName } = await import_server.PluginManager.parseName(name);
38
40
  try {
39
- const plugin = require(packageName);
41
+ const plugin = await (0, import_utils.importModule)(packageName);
40
42
  if (plugin && plugin.staticImport) {
43
+ import_logger.logger.info("run static import", { packageName });
41
44
  await plugin.staticImport();
42
45
  }
43
46
  } catch (error) {
47
+ import_logger.logger.error(error, { packageName });
44
48
  continue;
45
49
  }
46
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/server",
3
- "version": "1.7.0-beta.1",
3
+ "version": "1.7.0-beta.10",
4
4
  "main": "lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "license": "AGPL-3.0",
@@ -10,19 +10,19 @@
10
10
  "@koa/cors": "^5.0.0",
11
11
  "@koa/multer": "^3.0.2",
12
12
  "@koa/router": "^9.4.0",
13
- "@nocobase/acl": "1.7.0-beta.1",
14
- "@nocobase/actions": "1.7.0-beta.1",
15
- "@nocobase/auth": "1.7.0-beta.1",
16
- "@nocobase/cache": "1.7.0-beta.1",
17
- "@nocobase/data-source-manager": "1.7.0-beta.1",
18
- "@nocobase/database": "1.7.0-beta.1",
19
- "@nocobase/evaluators": "1.7.0-beta.1",
20
- "@nocobase/lock-manager": "1.7.0-beta.1",
21
- "@nocobase/logger": "1.7.0-beta.1",
22
- "@nocobase/resourcer": "1.7.0-beta.1",
23
- "@nocobase/sdk": "1.7.0-beta.1",
24
- "@nocobase/telemetry": "1.7.0-beta.1",
25
- "@nocobase/utils": "1.7.0-beta.1",
13
+ "@nocobase/acl": "1.7.0-beta.10",
14
+ "@nocobase/actions": "1.7.0-beta.10",
15
+ "@nocobase/auth": "1.7.0-beta.10",
16
+ "@nocobase/cache": "1.7.0-beta.10",
17
+ "@nocobase/data-source-manager": "1.7.0-beta.10",
18
+ "@nocobase/database": "1.7.0-beta.10",
19
+ "@nocobase/evaluators": "1.7.0-beta.10",
20
+ "@nocobase/lock-manager": "1.7.0-beta.10",
21
+ "@nocobase/logger": "1.7.0-beta.10",
22
+ "@nocobase/resourcer": "1.7.0-beta.10",
23
+ "@nocobase/sdk": "1.7.0-beta.10",
24
+ "@nocobase/telemetry": "1.7.0-beta.10",
25
+ "@nocobase/utils": "1.7.0-beta.10",
26
26
  "@types/decompress": "4.2.7",
27
27
  "@types/ini": "^1.3.31",
28
28
  "@types/koa-send": "^4.1.3",
@@ -56,5 +56,5 @@
56
56
  "@types/serve-handler": "^6.1.1",
57
57
  "@types/ws": "^8.5.5"
58
58
  },
59
- "gitHead": "374a1bc60b3d55fd8b532a57c8fe0423eed1d11e"
59
+ "gitHead": "e9077cd02774330e9d9d0c9ff0324596207d90a0"
60
60
  }