@nocobase/server 1.6.0-alpha.30 → 1.6.0-alpha.31

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.
@@ -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;
@@ -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();
@@ -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
  }
@@ -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);
@@ -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
- const url = `${process.env.APP_SERVER_BASE_URL}${process.env.PLUGIN_STATICS_PATH}${item.packageName}/${PLUGIN_CLIENT_ENTRY_FILE}?version=${item.version}`;
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/server",
3
- "version": "1.6.0-alpha.30",
3
+ "version": "1.6.0-alpha.31",
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.6.0-alpha.30",
14
- "@nocobase/actions": "1.6.0-alpha.30",
15
- "@nocobase/auth": "1.6.0-alpha.30",
16
- "@nocobase/cache": "1.6.0-alpha.30",
17
- "@nocobase/data-source-manager": "1.6.0-alpha.30",
18
- "@nocobase/database": "1.6.0-alpha.30",
19
- "@nocobase/evaluators": "1.6.0-alpha.30",
20
- "@nocobase/lock-manager": "1.6.0-alpha.30",
21
- "@nocobase/logger": "1.6.0-alpha.30",
22
- "@nocobase/resourcer": "1.6.0-alpha.30",
23
- "@nocobase/sdk": "1.6.0-alpha.30",
24
- "@nocobase/telemetry": "1.6.0-alpha.30",
25
- "@nocobase/utils": "1.6.0-alpha.30",
13
+ "@nocobase/acl": "1.6.0-alpha.31",
14
+ "@nocobase/actions": "1.6.0-alpha.31",
15
+ "@nocobase/auth": "1.6.0-alpha.31",
16
+ "@nocobase/cache": "1.6.0-alpha.31",
17
+ "@nocobase/data-source-manager": "1.6.0-alpha.31",
18
+ "@nocobase/database": "1.6.0-alpha.31",
19
+ "@nocobase/evaluators": "1.6.0-alpha.31",
20
+ "@nocobase/lock-manager": "1.6.0-alpha.31",
21
+ "@nocobase/logger": "1.6.0-alpha.31",
22
+ "@nocobase/resourcer": "1.6.0-alpha.31",
23
+ "@nocobase/sdk": "1.6.0-alpha.31",
24
+ "@nocobase/telemetry": "1.6.0-alpha.31",
25
+ "@nocobase/utils": "1.6.0-alpha.31",
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": "4d092cae372fada3df9b57c55705ea3b7dfa6786"
59
+ "gitHead": "2f118f0a0691dd51c437f208b1166258a615b6a8"
60
60
  }