@nocobase/server 1.6.0-beta.9 → 1.7.0-alpha.1
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/application.js +1 -0
- package/lib/gateway/index.d.ts +2 -1
- package/lib/gateway/index.js +2 -1
- package/lib/gateway/ws-server.d.ts +1 -0
- package/lib/gateway/ws-server.js +10 -1
- package/lib/helper.js +3 -0
- package/lib/plugin-manager/deps.js +1 -1
- package/lib/plugin-manager/options/resource.js +8 -1
- package/package.json +58 -58
package/lib/application.js
CHANGED
package/lib/gateway/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ import http, { IncomingMessage, ServerResponse } from 'http';
|
|
|
15
15
|
import { ApplicationOptions } from '../application';
|
|
16
16
|
import { IPCSocketClient } from './ipc-socket-client';
|
|
17
17
|
import { IPCSocketServer } from './ipc-socket-server';
|
|
18
|
+
import { WSServer } from './ws-server';
|
|
18
19
|
export interface IncomingRequest {
|
|
19
20
|
url: string;
|
|
20
21
|
headers: any;
|
|
@@ -41,10 +42,10 @@ export declare class Gateway extends EventEmitter {
|
|
|
41
42
|
selectorMiddlewares: Toposort<AppSelectorMiddleware>;
|
|
42
43
|
server: http.Server | null;
|
|
43
44
|
ipcSocketServer: IPCSocketServer | null;
|
|
45
|
+
wsServer: WSServer;
|
|
44
46
|
loggers: Registry<SystemLogger>;
|
|
45
47
|
private port;
|
|
46
48
|
private host;
|
|
47
|
-
private wsServer;
|
|
48
49
|
private socketPath;
|
|
49
50
|
private constructor();
|
|
50
51
|
static getInstance(options?: any): Gateway;
|
package/lib/gateway/index.js
CHANGED
|
@@ -81,10 +81,10 @@ const _Gateway = class _Gateway extends import_events.EventEmitter {
|
|
|
81
81
|
selectorMiddlewares = new import_utils.Toposort();
|
|
82
82
|
server = null;
|
|
83
83
|
ipcSocketServer = null;
|
|
84
|
+
wsServer;
|
|
84
85
|
loggers = new import_utils.Registry();
|
|
85
86
|
port = import_node_process.default.env.APP_PORT ? parseInt(import_node_process.default.env.APP_PORT) : null;
|
|
86
87
|
host = "0.0.0.0";
|
|
87
|
-
wsServer;
|
|
88
88
|
socketPath = (0, import_path.resolve)(import_node_process.default.cwd(), "storage", "gateway.sock");
|
|
89
89
|
constructor() {
|
|
90
90
|
super();
|
|
@@ -308,6 +308,7 @@ const _Gateway = class _Gateway extends import_events.EventEmitter {
|
|
|
308
308
|
await (0, import_plugin_symlink.createStoragePluginsSymlink)();
|
|
309
309
|
}
|
|
310
310
|
const mainApp = import_app_supervisor.AppSupervisor.getInstance().bootMainApp(options.mainAppOptions);
|
|
311
|
+
mainApp.setMaxListeners(50);
|
|
311
312
|
let runArgs = [import_node_process.default.argv, { throwError: true, from: "node" }];
|
|
312
313
|
if (!import_node_worker_threads.isMainThread) {
|
|
313
314
|
runArgs = [import_node_worker_threads.workerData.argv, { throwError: true, from: "user" }];
|
|
@@ -46,6 +46,7 @@ export declare class WSServer extends EventEmitter {
|
|
|
46
46
|
tagValue: string;
|
|
47
47
|
}>, sendMessage: object): void;
|
|
48
48
|
sendToClient(clientId: string, sendMessage: object): void;
|
|
49
|
+
sendToAppUser(appName: string, userId: string, message: object): void;
|
|
49
50
|
loopThroughConnections(callback: (client: WebSocketClient) => void): void;
|
|
50
51
|
close(): void;
|
|
51
52
|
}
|
package/lib/gateway/ws-server.js
CHANGED
|
@@ -209,7 +209,7 @@ const _WSServer = class _WSServer extends import_events.default {
|
|
|
209
209
|
removeClientTag(clientId, tagKey) {
|
|
210
210
|
const client = this.webSocketClients.get(clientId);
|
|
211
211
|
client.tags.forEach((tag) => {
|
|
212
|
-
if (tag.startsWith(tagKey)) {
|
|
212
|
+
if (tag.startsWith(`${tagKey}#`)) {
|
|
213
213
|
client.tags.delete(tag);
|
|
214
214
|
}
|
|
215
215
|
});
|
|
@@ -257,6 +257,15 @@ const _WSServer = class _WSServer extends import_events.default {
|
|
|
257
257
|
this.sendMessageToConnection(client, sendMessage);
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
+
sendToAppUser(appName, userId, message) {
|
|
261
|
+
this.sendToConnectionsByTags(
|
|
262
|
+
[
|
|
263
|
+
{ tagName: "userId", tagValue: `${userId}` },
|
|
264
|
+
{ tagName: "app", tagValue: appName }
|
|
265
|
+
],
|
|
266
|
+
message
|
|
267
|
+
);
|
|
268
|
+
}
|
|
260
269
|
loopThroughConnections(callback) {
|
|
261
270
|
this.webSocketClients.forEach((client) => {
|
|
262
271
|
callback(client);
|
package/lib/helper.js
CHANGED
|
@@ -164,7 +164,14 @@ var resource_default = {
|
|
|
164
164
|
const pkgPath = import_path.default.resolve(process.env.NODE_MODULES_PATH, item.packageName);
|
|
165
165
|
const r = await import_fs_extra.default.exists(pkgPath);
|
|
166
166
|
if (r) {
|
|
167
|
-
|
|
167
|
+
let t = "";
|
|
168
|
+
const dist = import_path.default.resolve(pkgPath, PLUGIN_CLIENT_ENTRY_FILE);
|
|
169
|
+
const distExists = await import_fs_extra.default.exists(dist);
|
|
170
|
+
if (distExists) {
|
|
171
|
+
const fsState = await import_fs_extra.default.stat(distExists ? dist : pkgPath);
|
|
172
|
+
t = `&t=${fsState.mtime.getTime()}`;
|
|
173
|
+
}
|
|
174
|
+
const url = `${process.env.APP_SERVER_BASE_URL}${process.env.PLUGIN_STATICS_PATH}${item.packageName}/${PLUGIN_CLIENT_ENTRY_FILE}?version=${item.version}${t}`;
|
|
168
175
|
arr.push({
|
|
169
176
|
...item.toJSON(),
|
|
170
177
|
url
|
package/package.json
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
2
|
+
"name": "@nocobase/server",
|
|
3
|
+
"version": "1.7.0-alpha.1",
|
|
4
|
+
"main": "lib/index.js",
|
|
5
|
+
"types": "./lib/index.d.ts",
|
|
6
|
+
"license": "AGPL-3.0",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@formily/json-schema": "2.x",
|
|
9
|
+
"@hapi/topo": "^6.0.0",
|
|
10
|
+
"@koa/cors": "^5.0.0",
|
|
11
|
+
"@koa/multer": "^3.0.2",
|
|
12
|
+
"@koa/router": "^9.4.0",
|
|
13
|
+
"@nocobase/acl": "1.7.0-alpha.1",
|
|
14
|
+
"@nocobase/actions": "1.7.0-alpha.1",
|
|
15
|
+
"@nocobase/auth": "1.7.0-alpha.1",
|
|
16
|
+
"@nocobase/cache": "1.7.0-alpha.1",
|
|
17
|
+
"@nocobase/data-source-manager": "1.7.0-alpha.1",
|
|
18
|
+
"@nocobase/database": "1.7.0-alpha.1",
|
|
19
|
+
"@nocobase/evaluators": "1.7.0-alpha.1",
|
|
20
|
+
"@nocobase/lock-manager": "1.7.0-alpha.1",
|
|
21
|
+
"@nocobase/logger": "1.7.0-alpha.1",
|
|
22
|
+
"@nocobase/resourcer": "1.7.0-alpha.1",
|
|
23
|
+
"@nocobase/sdk": "1.7.0-alpha.1",
|
|
24
|
+
"@nocobase/telemetry": "1.7.0-alpha.1",
|
|
25
|
+
"@nocobase/utils": "1.7.0-alpha.1",
|
|
26
|
+
"@types/decompress": "4.2.7",
|
|
27
|
+
"@types/ini": "^1.3.31",
|
|
28
|
+
"@types/koa-send": "^4.1.3",
|
|
29
|
+
"@types/multer": "^1.4.5",
|
|
30
|
+
"async-mutex": "^0.5.0",
|
|
31
|
+
"axios": "^1.7.0",
|
|
32
|
+
"chalk": "^4.1.1",
|
|
33
|
+
"commander": "^9.2.0",
|
|
34
|
+
"cron": "^2.4.4",
|
|
35
|
+
"cronstrue": "^2.11.0",
|
|
36
|
+
"dayjs": "^1.11.8",
|
|
37
|
+
"decompress": "4.2.1",
|
|
38
|
+
"find-package-json": "^1.2.0",
|
|
39
|
+
"fs-extra": "^11.1.1",
|
|
40
|
+
"i18next": "^22.4.9",
|
|
41
|
+
"ini": "^4.1.1",
|
|
42
|
+
"koa": "^2.15.4",
|
|
43
|
+
"koa-bodyparser": "^4.3.0",
|
|
44
|
+
"koa-send": "^5.0.1",
|
|
45
|
+
"koa-static": "^5.0.0",
|
|
46
|
+
"lodash": "^4.17.21",
|
|
47
|
+
"multer": "^1.4.2",
|
|
48
|
+
"nanoid": "3.3.4",
|
|
49
|
+
"semver": "^7.3.7",
|
|
50
|
+
"serve-handler": "^6.1.5",
|
|
51
|
+
"ws": "^8.13.0",
|
|
52
|
+
"xpipe": "^1.0.5"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@types/semver": "^7.3.9",
|
|
56
|
+
"@types/serve-handler": "^6.1.1",
|
|
57
|
+
"@types/ws": "^8.5.5"
|
|
58
|
+
},
|
|
59
|
+
"gitHead": "e411c9728b4d1f16b0beac16e40dd3499352b052"
|
|
60
60
|
}
|