@nocobase/server 1.9.26 → 1.9.27

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.
Files changed (2) hide show
  1. package/lib/gateway/errors.js +45 -12
  2. package/package.json +16 -16
@@ -44,6 +44,15 @@ __export(errors_exports, {
44
44
  module.exports = __toCommonJS(errors_exports);
45
45
  var import_app_supervisor = require("../app-supervisor");
46
46
  var import_lodash = __toESM(require("lodash"));
47
+ function getMaintaining(app) {
48
+ var _a;
49
+ return (_a = app == null ? void 0 : app.getMaintaining) == null ? void 0 : _a.call(app);
50
+ }
51
+ __name(getMaintaining, "getMaintaining");
52
+ function getAppName(app) {
53
+ return (app == null ? void 0 : app.name) || "unknown";
54
+ }
55
+ __name(getAppName, "getAppName");
47
56
  const errors = {
48
57
  APP_NOT_FOUND: {
49
58
  status: 404,
@@ -53,6 +62,9 @@ const errors = {
53
62
  APP_ERROR: {
54
63
  status: 503,
55
64
  message: /* @__PURE__ */ __name(({ app }) => {
65
+ if (!(app == null ? void 0 : app.name)) {
66
+ return "";
67
+ }
56
68
  const error = import_app_supervisor.AppSupervisor.getInstance().appErrors[app.name];
57
69
  if (!error) {
58
70
  return "";
@@ -64,25 +76,31 @@ const errors = {
64
76
  return message;
65
77
  }, "message"),
66
78
  code: /* @__PURE__ */ __name(({ app }) => {
79
+ if (!(app == null ? void 0 : app.name)) {
80
+ return "APP_ERROR";
81
+ }
67
82
  const error = import_app_supervisor.AppSupervisor.getInstance().appErrors[app.name];
68
- return error["code"] || "APP_ERROR";
83
+ return (error == null ? void 0 : error["code"]) || "APP_ERROR";
69
84
  }, "code"),
70
- command: /* @__PURE__ */ __name(({ app }) => app.getMaintaining().command, "command"),
85
+ command: /* @__PURE__ */ __name(({ app }) => {
86
+ var _a;
87
+ return (_a = getMaintaining(app)) == null ? void 0 : _a.command;
88
+ }, "command"),
71
89
  maintaining: true
72
90
  },
73
91
  APP_STARTING: {
74
92
  status: 503,
75
- message: /* @__PURE__ */ __name(({ app }) => app.maintainingMessage, "message"),
93
+ message: /* @__PURE__ */ __name(({ app }) => (app == null ? void 0 : app.maintainingMessage) || "", "message"),
76
94
  maintaining: true
77
95
  },
78
96
  APP_STOPPED: {
79
97
  status: 503,
80
- message: /* @__PURE__ */ __name(({ app }) => `application ${app.name} is stopped`, "message"),
98
+ message: /* @__PURE__ */ __name(({ app }) => `application ${getAppName(app)} is stopped`, "message"),
81
99
  maintaining: true
82
100
  },
83
101
  APP_INITIALIZED: {
84
102
  status: 503,
85
- message: /* @__PURE__ */ __name(({ app }) => `application ${app.name} is initialized, waiting for command`, "message"),
103
+ message: /* @__PURE__ */ __name(({ app }) => `application ${getAppName(app)} is initialized, waiting for command`, "message"),
86
104
  maintaining: true
87
105
  },
88
106
  APP_INITIALIZING: {
@@ -93,25 +111,40 @@ const errors = {
93
111
  COMMAND_ERROR: {
94
112
  status: 503,
95
113
  maintaining: true,
96
- message: /* @__PURE__ */ __name(({ app }) => app.getMaintaining().error.message, "message"),
97
- command: /* @__PURE__ */ __name(({ app }) => app.getMaintaining().command, "command")
114
+ message: /* @__PURE__ */ __name(({ app }) => {
115
+ var _a, _b;
116
+ return ((_b = (_a = getMaintaining(app)) == null ? void 0 : _a.error) == null ? void 0 : _b.message) || "";
117
+ }, "message"),
118
+ command: /* @__PURE__ */ __name(({ app }) => {
119
+ var _a;
120
+ return (_a = getMaintaining(app)) == null ? void 0 : _a.command;
121
+ }, "command")
98
122
  },
99
123
  COMMAND_END: {
100
124
  status: 503,
101
125
  maintaining: true,
102
- message: /* @__PURE__ */ __name(({ app }) => `${app.getMaintaining().command.name} running end`, "message"),
103
- command: /* @__PURE__ */ __name(({ app }) => app.getMaintaining().command, "command")
126
+ message: /* @__PURE__ */ __name(({ app }) => {
127
+ var _a, _b;
128
+ return `${((_b = (_a = getMaintaining(app)) == null ? void 0 : _a.command) == null ? void 0 : _b.name) || "command"} running end`;
129
+ }, "message"),
130
+ command: /* @__PURE__ */ __name(({ app }) => {
131
+ var _a;
132
+ return (_a = getMaintaining(app)) == null ? void 0 : _a.command;
133
+ }, "command")
104
134
  },
105
135
  APP_COMMANDING: {
106
136
  status: 503,
107
137
  maintaining: true,
108
- message: /* @__PURE__ */ __name(({ app, message }) => message || app.maintainingMessage, "message"),
109
- command: /* @__PURE__ */ __name(({ app, command }) => command || app.getMaintaining().command, "command")
138
+ message: /* @__PURE__ */ __name(({ app, message }) => message || (app == null ? void 0 : app.maintainingMessage) || "", "message"),
139
+ command: /* @__PURE__ */ __name(({ app, command }) => {
140
+ var _a;
141
+ return command || ((_a = getMaintaining(app)) == null ? void 0 : _a.command);
142
+ }, "command")
110
143
  },
111
144
  APP_RUNNING: {
112
145
  status: 200,
113
146
  maintaining: false,
114
- message: /* @__PURE__ */ __name(({ message, app }) => message || `application ${app.name} is running`, "message")
147
+ message: /* @__PURE__ */ __name(({ message, app }) => message || `application ${getAppName(app)} is running`, "message")
115
148
  },
116
149
  UNKNOWN_ERROR: {
117
150
  status: 500,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/server",
3
- "version": "1.9.26",
3
+ "version": "1.9.27",
4
4
  "main": "lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "license": "AGPL-3.0",
@@ -10,20 +10,20 @@
10
10
  "@koa/cors": "^5.0.0",
11
11
  "@koa/multer": "^3.1.0",
12
12
  "@koa/router": "^13.1.0",
13
- "@nocobase/acl": "1.9.26",
14
- "@nocobase/actions": "1.9.26",
15
- "@nocobase/auth": "1.9.26",
16
- "@nocobase/cache": "1.9.26",
17
- "@nocobase/data-source-manager": "1.9.26",
18
- "@nocobase/database": "1.9.26",
19
- "@nocobase/evaluators": "1.9.26",
20
- "@nocobase/lock-manager": "1.9.26",
21
- "@nocobase/logger": "1.9.26",
22
- "@nocobase/resourcer": "1.9.26",
23
- "@nocobase/sdk": "1.9.26",
24
- "@nocobase/snowflake-id": "1.9.26",
25
- "@nocobase/telemetry": "1.9.26",
26
- "@nocobase/utils": "1.9.26",
13
+ "@nocobase/acl": "1.9.27",
14
+ "@nocobase/actions": "1.9.27",
15
+ "@nocobase/auth": "1.9.27",
16
+ "@nocobase/cache": "1.9.27",
17
+ "@nocobase/data-source-manager": "1.9.27",
18
+ "@nocobase/database": "1.9.27",
19
+ "@nocobase/evaluators": "1.9.27",
20
+ "@nocobase/lock-manager": "1.9.27",
21
+ "@nocobase/logger": "1.9.27",
22
+ "@nocobase/resourcer": "1.9.27",
23
+ "@nocobase/sdk": "1.9.27",
24
+ "@nocobase/snowflake-id": "1.9.27",
25
+ "@nocobase/telemetry": "1.9.27",
26
+ "@nocobase/utils": "1.9.27",
27
27
  "@types/decompress": "4.2.7",
28
28
  "@types/ini": "^1.3.31",
29
29
  "@types/koa-send": "^4.1.3",
@@ -59,5 +59,5 @@
59
59
  "@types/serve-handler": "^6.1.1",
60
60
  "@types/ws": "^8.5.5"
61
61
  },
62
- "gitHead": "794e25d4aca20fbc68769ad7b1266860bd45ac5c"
62
+ "gitHead": "0d262aa7ddb76d88184eabd408686bb3960a67f6"
63
63
  }