@nocobase/server 1.9.2 → 1.9.3

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.
@@ -17,8 +17,8 @@ export declare class PubSubManager {
17
17
  protected adapter: IPubSubAdapter;
18
18
  protected handlerManager: HandlerManager;
19
19
  constructor(app: Application, options?: PubSubManagerOptions);
20
- get channelPrefix(): string;
21
20
  setAdapter(adapter: IPubSubAdapter): void;
21
+ getFullChannel(channel: string): string;
22
22
  isConnected(): Promise<boolean>;
23
23
  connect(): Promise<void>;
24
24
  close(): Promise<any>;
@@ -55,13 +55,13 @@ const _PubSubManager = class _PubSubManager {
55
55
  publisherId;
56
56
  adapter;
57
57
  handlerManager;
58
- get channelPrefix() {
59
- var _a;
60
- return ((_a = this.options) == null ? void 0 : _a.channelPrefix) ? `${this.options.channelPrefix}.` : "";
61
- }
62
58
  setAdapter(adapter) {
63
59
  this.adapter = adapter;
64
60
  }
61
+ getFullChannel(channel) {
62
+ var _a;
63
+ return [this.app.name, (_a = this.options) == null ? void 0 : _a.channelPrefix, channel].filter(Boolean).join(".");
64
+ }
65
65
  async isConnected() {
66
66
  if (this.adapter) {
67
67
  return this.adapter.isConnected();
@@ -79,7 +79,7 @@ const _PubSubManager = class _PubSubManager {
79
79
  await this.adapter.connect();
80
80
  await this.handlerManager.each(async (channel, headler) => {
81
81
  this.app.logger.debug(`[PubSubManager] subscribe ${channel} added before connected`);
82
- await this.adapter.subscribe(`${this.channelPrefix}${channel}`, headler);
82
+ await this.adapter.subscribe(this.getFullChannel(channel), headler);
83
83
  });
84
84
  }
85
85
  async close() {
@@ -93,7 +93,7 @@ const _PubSubManager = class _PubSubManager {
93
93
  const handler = this.handlerManager.set(channel, callback, options);
94
94
  if (await this.isConnected()) {
95
95
  this.app.logger.debug(`[PubSubManager] subscribe ${channel} added after connected`);
96
- await this.adapter.subscribe(`${this.channelPrefix}${channel}`, handler);
96
+ await this.adapter.subscribe(this.getFullChannel(channel), handler);
97
97
  }
98
98
  }
99
99
  async unsubscribe(channel, callback) {
@@ -101,7 +101,7 @@ const _PubSubManager = class _PubSubManager {
101
101
  if (!this.adapter || !handler) {
102
102
  return;
103
103
  }
104
- return this.adapter.unsubscribe(`${this.channelPrefix}${channel}`, handler);
104
+ return this.adapter.unsubscribe(this.getFullChannel(channel), handler);
105
105
  }
106
106
  async publish(channel, message, options) {
107
107
  var _a;
@@ -116,7 +116,7 @@ const _PubSubManager = class _PubSubManager {
116
116
  ...options,
117
117
  message
118
118
  });
119
- await this.adapter.publish(`${this.channelPrefix}${channel}`, wrappedMessage);
119
+ await this.adapter.publish(this.getFullChannel(channel), wrappedMessage);
120
120
  this.app.logger.trace(`[PubSubManager] published message to channel ${channel}`);
121
121
  }
122
122
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/server",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
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.2",
14
- "@nocobase/actions": "1.9.2",
15
- "@nocobase/auth": "1.9.2",
16
- "@nocobase/cache": "1.9.2",
17
- "@nocobase/data-source-manager": "1.9.2",
18
- "@nocobase/database": "1.9.2",
19
- "@nocobase/evaluators": "1.9.2",
20
- "@nocobase/lock-manager": "1.9.2",
21
- "@nocobase/logger": "1.9.2",
22
- "@nocobase/resourcer": "1.9.2",
23
- "@nocobase/sdk": "1.9.2",
24
- "@nocobase/snowflake-id": "1.9.2",
25
- "@nocobase/telemetry": "1.9.2",
26
- "@nocobase/utils": "1.9.2",
13
+ "@nocobase/acl": "1.9.3",
14
+ "@nocobase/actions": "1.9.3",
15
+ "@nocobase/auth": "1.9.3",
16
+ "@nocobase/cache": "1.9.3",
17
+ "@nocobase/data-source-manager": "1.9.3",
18
+ "@nocobase/database": "1.9.3",
19
+ "@nocobase/evaluators": "1.9.3",
20
+ "@nocobase/lock-manager": "1.9.3",
21
+ "@nocobase/logger": "1.9.3",
22
+ "@nocobase/resourcer": "1.9.3",
23
+ "@nocobase/sdk": "1.9.3",
24
+ "@nocobase/snowflake-id": "1.9.3",
25
+ "@nocobase/telemetry": "1.9.3",
26
+ "@nocobase/utils": "1.9.3",
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": "2a511560ce123d02a20b2a7757133e25ac664614"
62
+ "gitHead": "e691264453aac97972d2cf18412d5a0228dff361"
63
63
  }