@nocobase/server 1.5.0-alpha.5 → 1.5.0-beta.2
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.d.ts +2 -9
- package/lib/application.js +3 -15
- package/lib/commands/pm.js +3 -0
- package/lib/gateway/index.js +0 -5
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -2
- package/lib/locale/locale.d.ts +0 -1
- package/lib/locale/locale.js +1 -12
- package/lib/middlewares/validate-filter-params.d.ts +1 -1
- package/lib/middlewares/validate-filter-params.js +26 -0
- package/lib/plugin-manager/deps.js +1 -1
- package/lib/plugin-manager/options/resource.js +2 -1
- package/lib/plugin-manager/plugin-manager-repository.js +6 -1
- package/lib/plugin-manager/plugin-manager.js +5 -3
- package/lib/plugin.d.ts +13 -4
- package/lib/plugin.js +19 -12
- package/lib/sync-manager.d.ts +46 -0
- package/lib/sync-manager.js +137 -0
- package/package.json +14 -16
- package/lib/pub-sub-manager/handler-manager.d.ts +0 -34
- package/lib/pub-sub-manager/handler-manager.js +0 -149
- package/lib/pub-sub-manager/index.d.ts +0 -11
- package/lib/pub-sub-manager/index.js +0 -34
- package/lib/pub-sub-manager/pub-sub-manager.d.ts +0 -27
- package/lib/pub-sub-manager/pub-sub-manager.js +0 -116
- package/lib/pub-sub-manager/types.d.ts +0 -27
- package/lib/pub-sub-manager/types.js +0 -24
- package/lib/sync-message-manager.d.ts +0 -25
- package/lib/sync-message-manager.js +0 -105
package/lib/application.d.ts
CHANGED
|
@@ -16,7 +16,6 @@ import { Logger, LoggerOptions, RequestLoggerOptions, SystemLogger, SystemLogger
|
|
|
16
16
|
import { ResourceOptions, Resourcer } from '@nocobase/resourcer';
|
|
17
17
|
import { Telemetry, TelemetryOptions } from '@nocobase/telemetry';
|
|
18
18
|
import { AsyncEmitter, ToposortOptions } from '@nocobase/utils';
|
|
19
|
-
import { LockManager, LockManagerOptions } from '@nocobase/lock-manager';
|
|
20
19
|
import { Command, CommandOptions, ParseOptions } from 'commander';
|
|
21
20
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
22
21
|
import { i18n, InitOptions } from 'i18next';
|
|
@@ -29,8 +28,7 @@ import { ApplicationVersion } from './helpers/application-version';
|
|
|
29
28
|
import { Locale } from './locale';
|
|
30
29
|
import { Plugin } from './plugin';
|
|
31
30
|
import { InstallOptions, PluginManager } from './plugin-manager';
|
|
32
|
-
import {
|
|
33
|
-
import { SyncMessageManager } from './sync-message-manager';
|
|
31
|
+
import { SyncManager } from './sync-manager';
|
|
34
32
|
export type PluginType = string | typeof Plugin;
|
|
35
33
|
export type PluginConfiguration = PluginType | [PluginType, any];
|
|
36
34
|
export interface ResourceManagerOptions {
|
|
@@ -60,8 +58,6 @@ export interface ApplicationOptions {
|
|
|
60
58
|
*/
|
|
61
59
|
resourcer?: ResourceManagerOptions;
|
|
62
60
|
resourceManager?: ResourceManagerOptions;
|
|
63
|
-
pubSubManager?: PubSubManagerOptions;
|
|
64
|
-
syncMessageManager?: any;
|
|
65
61
|
bodyParser?: any;
|
|
66
62
|
cors?: any;
|
|
67
63
|
dataWrapping?: boolean;
|
|
@@ -76,7 +72,6 @@ export interface ApplicationOptions {
|
|
|
76
72
|
pmSock?: string;
|
|
77
73
|
name?: string;
|
|
78
74
|
authManager?: AuthManagerOptions;
|
|
79
|
-
lockManager?: LockManagerOptions;
|
|
80
75
|
/**
|
|
81
76
|
* @internal
|
|
82
77
|
*/
|
|
@@ -157,8 +152,7 @@ export declare class Application<StateT = DefaultState, ContextT = DefaultContex
|
|
|
157
152
|
/**
|
|
158
153
|
* @internal
|
|
159
154
|
*/
|
|
160
|
-
|
|
161
|
-
syncMessageManager: SyncMessageManager;
|
|
155
|
+
syncManager: SyncManager;
|
|
162
156
|
requestLogger: Logger;
|
|
163
157
|
protected plugins: Map<string, Plugin<any>>;
|
|
164
158
|
protected _appSupervisor: AppSupervisor;
|
|
@@ -167,7 +161,6 @@ export declare class Application<StateT = DefaultState, ContextT = DefaultContex
|
|
|
167
161
|
private _maintainingCommandStatus;
|
|
168
162
|
private _maintainingStatusBeforeCommand;
|
|
169
163
|
private _actionCommand;
|
|
170
|
-
lockManager: LockManager;
|
|
171
164
|
constructor(options: ApplicationOptions);
|
|
172
165
|
private static staticCommands;
|
|
173
166
|
static addCommand(callback: (app: Application) => void): void;
|
package/lib/application.js
CHANGED
|
@@ -50,7 +50,6 @@ var import_database = __toESM(require("@nocobase/database"));
|
|
|
50
50
|
var import_logger = require("@nocobase/logger");
|
|
51
51
|
var import_telemetry = require("@nocobase/telemetry");
|
|
52
52
|
var import_utils = require("@nocobase/utils");
|
|
53
|
-
var import_lock_manager = require("@nocobase/lock-manager");
|
|
54
53
|
var import_crypto = require("crypto");
|
|
55
54
|
var import_glob = __toESM(require("glob"));
|
|
56
55
|
var import_koa = __toESM(require("koa"));
|
|
@@ -73,8 +72,7 @@ var import_middlewares = require("./middlewares");
|
|
|
73
72
|
var import_data_template = require("./middlewares/data-template");
|
|
74
73
|
var import_validate_filter_params = __toESM(require("./middlewares/validate-filter-params"));
|
|
75
74
|
var import_plugin_manager = require("./plugin-manager");
|
|
76
|
-
var
|
|
77
|
-
var import_sync_message_manager = require("./sync-message-manager");
|
|
75
|
+
var import_sync_manager = require("./sync-manager");
|
|
78
76
|
var import_package = __toESM(require("../package.json"));
|
|
79
77
|
const _Application = class _Application extends import_koa.default {
|
|
80
78
|
constructor(options) {
|
|
@@ -114,8 +112,7 @@ const _Application = class _Application extends import_koa.default {
|
|
|
114
112
|
/**
|
|
115
113
|
* @internal
|
|
116
114
|
*/
|
|
117
|
-
|
|
118
|
-
syncMessageManager;
|
|
115
|
+
syncManager;
|
|
119
116
|
requestLogger;
|
|
120
117
|
plugins = /* @__PURE__ */ new Map();
|
|
121
118
|
_appSupervisor = import_app_supervisor.AppSupervisor.getInstance();
|
|
@@ -124,7 +121,6 @@ const _Application = class _Application extends import_koa.default {
|
|
|
124
121
|
_maintainingCommandStatus;
|
|
125
122
|
_maintainingStatusBeforeCommand;
|
|
126
123
|
_actionCommand;
|
|
127
|
-
lockManager;
|
|
128
124
|
static addCommand(callback) {
|
|
129
125
|
this.staticCommands.push(callback);
|
|
130
126
|
}
|
|
@@ -350,9 +346,6 @@ const _Application = class _Application extends import_koa.default {
|
|
|
350
346
|
if (this.cacheManager) {
|
|
351
347
|
await this.cacheManager.close();
|
|
352
348
|
}
|
|
353
|
-
if (this.pubSubManager) {
|
|
354
|
-
await this.pubSubManager.close();
|
|
355
|
-
}
|
|
356
349
|
if (this.telemetry.started) {
|
|
357
350
|
await this.telemetry.shutdown();
|
|
358
351
|
}
|
|
@@ -827,12 +820,7 @@ const _Application = class _Application extends import_koa.default {
|
|
|
827
820
|
this._cronJobManager = new import_cron_job_manager.CronJobManager(this);
|
|
828
821
|
this._cli = this.createCLI();
|
|
829
822
|
this._i18n = (0, import_helper.createI18n)(options);
|
|
830
|
-
this.
|
|
831
|
-
this.syncMessageManager = new import_sync_message_manager.SyncMessageManager(this, options.syncMessageManager);
|
|
832
|
-
this.lockManager = new import_lock_manager.LockManager({
|
|
833
|
-
defaultAdapter: process.env.LOCK_ADAPTER_DEFAULT,
|
|
834
|
-
...options.lockManager
|
|
835
|
-
});
|
|
823
|
+
this.syncManager = new import_sync_manager.SyncManager(this);
|
|
836
824
|
this.context.db = this.db;
|
|
837
825
|
this.context.resourcer = this.resourceManager;
|
|
838
826
|
this.context.resourceManager = this.resourceManager;
|
package/lib/commands/pm.js
CHANGED
|
@@ -69,6 +69,9 @@ var pm_default = /* @__PURE__ */ __name((app) => {
|
|
|
69
69
|
try {
|
|
70
70
|
await app.pm.enable(plugins);
|
|
71
71
|
} catch (error) {
|
|
72
|
+
await app.tryReloadOrRestart({
|
|
73
|
+
recover: true
|
|
74
|
+
});
|
|
72
75
|
throw new import_plugin_command_error.PluginCommandError(`Failed to enable plugin`, { cause: error });
|
|
73
76
|
}
|
|
74
77
|
});
|
package/lib/gateway/index.js
CHANGED
|
@@ -161,9 +161,7 @@ const _Gateway = class _Gateway extends import_events.EventEmitter {
|
|
|
161
161
|
res.end(JSON.stringify({ error }));
|
|
162
162
|
}
|
|
163
163
|
responseErrorWithCode(code, res, options) {
|
|
164
|
-
const log = this.getLogger(options.appName, res);
|
|
165
164
|
const error = (0, import_errors.applyErrorWithArgs)((0, import_errors.getErrorWithCode)(code), options);
|
|
166
|
-
log.error(error.message, { method: "responseErrorWithCode", error });
|
|
167
165
|
this.responseError(res, error);
|
|
168
166
|
}
|
|
169
167
|
async requestHandler(req, res) {
|
|
@@ -206,14 +204,12 @@ const _Gateway = class _Gateway extends import_events.EventEmitter {
|
|
|
206
204
|
});
|
|
207
205
|
}
|
|
208
206
|
const handleApp = await this.getRequestHandleAppName(req);
|
|
209
|
-
const log = this.getLogger(handleApp, res);
|
|
210
207
|
const hasApp = import_app_supervisor.AppSupervisor.getInstance().hasApp(handleApp);
|
|
211
208
|
if (!hasApp) {
|
|
212
209
|
void import_app_supervisor.AppSupervisor.getInstance().bootStrapApp(handleApp);
|
|
213
210
|
}
|
|
214
211
|
let appStatus = import_app_supervisor.AppSupervisor.getInstance().getAppStatus(handleApp, "initializing");
|
|
215
212
|
if (appStatus === "not_found") {
|
|
216
|
-
log.warn(`app not found`, { method: "requestHandler" });
|
|
217
213
|
this.responseErrorWithCode("APP_NOT_FOUND", res, { appName: handleApp });
|
|
218
214
|
return;
|
|
219
215
|
}
|
|
@@ -228,7 +224,6 @@ const _Gateway = class _Gateway extends import_events.EventEmitter {
|
|
|
228
224
|
}
|
|
229
225
|
const app = await import_app_supervisor.AppSupervisor.getInstance().getApp(handleApp);
|
|
230
226
|
if (appStatus !== "running") {
|
|
231
|
-
log.warn(`app is not running`, { method: "requestHandler", status: appStatus });
|
|
232
227
|
this.responseErrorWithCode(`${appStatus}`, res, { app, appName: handleApp });
|
|
233
228
|
return;
|
|
234
229
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export * as middlewares from './middlewares';
|
|
|
14
14
|
export * from './migration';
|
|
15
15
|
export * from './plugin';
|
|
16
16
|
export * from './plugin-manager';
|
|
17
|
-
export * from './
|
|
17
|
+
export * from './sync-manager';
|
|
18
18
|
export declare const OFFICIAL_PLUGIN_PREFIX = "@nocobase/plugin-";
|
|
19
19
|
export { appendToBuiltInPlugins, findAllPlugins, findBuiltInPlugins, findLocalPlugins, packageNameTrim, } from './plugin-manager/findPackageNames';
|
|
20
20
|
export { runPluginStaticImports } from './run-plugin-static-imports';
|
package/lib/index.js
CHANGED
|
@@ -56,7 +56,7 @@ var middlewares = __toESM(require("./middlewares"));
|
|
|
56
56
|
__reExport(src_exports, require("./migration"), module.exports);
|
|
57
57
|
__reExport(src_exports, require("./plugin"), module.exports);
|
|
58
58
|
__reExport(src_exports, require("./plugin-manager"), module.exports);
|
|
59
|
-
__reExport(src_exports, require("./
|
|
59
|
+
__reExport(src_exports, require("./sync-manager"), module.exports);
|
|
60
60
|
var import_findPackageNames = require("./plugin-manager/findPackageNames");
|
|
61
61
|
var import_run_plugin_static_imports = require("./run-plugin-static-imports");
|
|
62
62
|
const OFFICIAL_PLUGIN_PREFIX = "@nocobase/plugin-";
|
|
@@ -76,5 +76,5 @@ const OFFICIAL_PLUGIN_PREFIX = "@nocobase/plugin-";
|
|
|
76
76
|
...require("./migration"),
|
|
77
77
|
...require("./plugin"),
|
|
78
78
|
...require("./plugin-manager"),
|
|
79
|
-
...require("./
|
|
79
|
+
...require("./sync-manager")
|
|
80
80
|
});
|
package/lib/locale/locale.d.ts
CHANGED
|
@@ -25,7 +25,6 @@ export declare class Locale {
|
|
|
25
25
|
resourceStorers: Registry<ResourceStorer>;
|
|
26
26
|
constructor(app: Application);
|
|
27
27
|
load(): Promise<void>;
|
|
28
|
-
reset(): Promise<void>;
|
|
29
28
|
reload(): Promise<void>;
|
|
30
29
|
setLocaleFn(name: string, fn: (lang: string) => Promise<any>): void;
|
|
31
30
|
registerResourceStorer(name: string, storer: ResourceStorer): void;
|
package/lib/locale/locale.js
CHANGED
|
@@ -61,13 +61,6 @@ const _Locale = class _Locale {
|
|
|
61
61
|
this.app.log.debug("locale resource loaded", { submodule: "locale", method: "onAfterLoad" });
|
|
62
62
|
this.app.setMaintainingMessage("locale resource loaded");
|
|
63
63
|
});
|
|
64
|
-
this.app.syncMessageManager.subscribe("localeManager", async (message) => {
|
|
65
|
-
switch (message.type) {
|
|
66
|
-
case "reload":
|
|
67
|
-
await this.reset();
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
64
|
}
|
|
72
65
|
async load() {
|
|
73
66
|
this.cache = await this.app.cacheManager.createCache({
|
|
@@ -77,15 +70,11 @@ const _Locale = class _Locale {
|
|
|
77
70
|
});
|
|
78
71
|
await this.get(this.defaultLang);
|
|
79
72
|
}
|
|
80
|
-
async
|
|
73
|
+
async reload() {
|
|
81
74
|
const storers = Array.from(this.resourceStorers.getValues());
|
|
82
75
|
const promises = storers.map((storer) => storer.reset());
|
|
83
76
|
await Promise.all([this.cache.reset(), ...promises]);
|
|
84
77
|
}
|
|
85
|
-
async reload() {
|
|
86
|
-
await this.reset();
|
|
87
|
-
this.app.syncMessageManager.publish("localeManager", { type: "reload" });
|
|
88
|
-
}
|
|
89
78
|
setLocaleFn(name, fn) {
|
|
90
79
|
this.localeFn.set(name, fn);
|
|
91
80
|
}
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
export default function validateFilterParams(ctx: any, next: any): Promise<
|
|
9
|
+
export default function validateFilterParams(ctx: any, next: any): Promise<any>;
|
|
@@ -34,9 +34,35 @@ var import_utils = require("@nocobase/utils");
|
|
|
34
34
|
async function validateFilterParams(ctx, next) {
|
|
35
35
|
const { params } = ctx.action;
|
|
36
36
|
const guardedActions = ["update", "destroy"];
|
|
37
|
+
const { actionName } = params;
|
|
38
|
+
if (skipValidate(params)) {
|
|
39
|
+
return await next();
|
|
40
|
+
}
|
|
41
|
+
if (emptyFilter(params) && emptyFilterByTk(params)) {
|
|
42
|
+
throw new Error(`to do ${actionName} action, filter or filterByTk is required`);
|
|
43
|
+
}
|
|
37
44
|
if (params.filter && !(0, import_utils.isValidFilter)(params.filter) && guardedActions.includes(params.actionName)) {
|
|
38
45
|
throw new Error(`Invalid filter: ${JSON.stringify(params.filter)}`);
|
|
39
46
|
}
|
|
40
47
|
await next();
|
|
41
48
|
}
|
|
42
49
|
__name(validateFilterParams, "validateFilterParams");
|
|
50
|
+
function emptyFilter(params) {
|
|
51
|
+
return !(0, import_utils.isValidFilter)(params.filter);
|
|
52
|
+
}
|
|
53
|
+
__name(emptyFilter, "emptyFilter");
|
|
54
|
+
function emptyFilterByTk(params) {
|
|
55
|
+
return !params.filterByTk;
|
|
56
|
+
}
|
|
57
|
+
__name(emptyFilterByTk, "emptyFilterByTk");
|
|
58
|
+
function skipValidate(actionParams) {
|
|
59
|
+
const { actionName } = actionParams;
|
|
60
|
+
if (actionName === "update") {
|
|
61
|
+
return actionParams.forceUpdate;
|
|
62
|
+
}
|
|
63
|
+
if (actionName === "destroy") {
|
|
64
|
+
return actionParams.truncate;
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
__name(skipValidate, "skipValidate");
|
|
@@ -119,7 +119,8 @@ var resource_default = {
|
|
|
119
119
|
if (!filterByTk) {
|
|
120
120
|
ctx.throw(400, "plugin name invalid");
|
|
121
121
|
}
|
|
122
|
-
|
|
122
|
+
const keys = Array.isArray(filterByTk) ? filterByTk : [filterByTk];
|
|
123
|
+
app.runAsCLI(["pm", "enable", ...keys], { from: "user" });
|
|
123
124
|
ctx.body = filterByTk;
|
|
124
125
|
await next();
|
|
125
126
|
},
|
|
@@ -148,7 +148,12 @@ const _PluginManagerRepository = class _PluginManagerRepository extends import_d
|
|
|
148
148
|
}
|
|
149
149
|
const sorter = new import_topo.default.Sorter();
|
|
150
150
|
for (const pluginName of pluginNames) {
|
|
151
|
-
|
|
151
|
+
let packageJson = {};
|
|
152
|
+
try {
|
|
153
|
+
packageJson = await import_plugin_manager.PluginManager.getPackageJson(pluginName);
|
|
154
|
+
} catch (error) {
|
|
155
|
+
packageJson = {};
|
|
156
|
+
}
|
|
152
157
|
const peerDependencies = Object.keys((packageJson == null ? void 0 : packageJson.peerDependencies) || {});
|
|
153
158
|
sorter.add(pluginName, { after: peerDependencies, group: (packageJson == null ? void 0 : packageJson.packageName) || pluginName });
|
|
154
159
|
}
|
|
@@ -129,9 +129,11 @@ const _PluginManager = class _PluginManager {
|
|
|
129
129
|
*/
|
|
130
130
|
static async getPackageJson(nameOrPkg) {
|
|
131
131
|
const { packageName } = await this.parseName(nameOrPkg);
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
const packageFile = (0, import_path.resolve)(process.env.NODE_MODULES_PATH, packageName, "package.json");
|
|
133
|
+
if (!await import_fs_extra.default.exists(packageFile)) {
|
|
134
|
+
throw new Error(`Cannot find plugin '${nameOrPkg}'`);
|
|
135
|
+
}
|
|
136
|
+
return import_fs_extra.default.readJSON(packageFile);
|
|
135
137
|
}
|
|
136
138
|
/**
|
|
137
139
|
* @internal
|
package/lib/plugin.d.ts
CHANGED
|
@@ -6,11 +6,12 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
import { Model
|
|
9
|
+
import { Model } from '@nocobase/database';
|
|
10
10
|
import { LoggerOptions } from '@nocobase/logger';
|
|
11
11
|
import type { TFuncKey, TOptions } from 'i18next';
|
|
12
12
|
import { Application } from './application';
|
|
13
13
|
import { InstallOptions } from './plugin-manager';
|
|
14
|
+
import { SyncMessageData } from './sync-manager';
|
|
14
15
|
export interface PluginInterface {
|
|
15
16
|
beforeLoad?: () => void;
|
|
16
17
|
load(): any;
|
|
@@ -65,8 +66,16 @@ export declare abstract class Plugin<O = any> implements PluginInterface {
|
|
|
65
66
|
afterDisable(): Promise<void>;
|
|
66
67
|
beforeRemove(): Promise<void>;
|
|
67
68
|
afterRemove(): Promise<void>;
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Fired when a sync message is received.
|
|
71
|
+
* @experimental
|
|
72
|
+
*/
|
|
73
|
+
onSync(message?: SyncMessageData): Promise<void> | void;
|
|
74
|
+
/**
|
|
75
|
+
* Publish a sync message.
|
|
76
|
+
* @experimental
|
|
77
|
+
*/
|
|
78
|
+
sync(message?: SyncMessageData): void;
|
|
70
79
|
/**
|
|
71
80
|
* @deprecated
|
|
72
81
|
*/
|
|
@@ -83,6 +92,7 @@ export declare abstract class Plugin<O = any> implements PluginInterface {
|
|
|
83
92
|
afterSync: any[];
|
|
84
93
|
afterLoad: any[];
|
|
85
94
|
}>;
|
|
95
|
+
private getPluginBasePath;
|
|
86
96
|
/**
|
|
87
97
|
* @internal
|
|
88
98
|
*/
|
|
@@ -96,6 +106,5 @@ export declare abstract class Plugin<O = any> implements PluginInterface {
|
|
|
96
106
|
* @experimental
|
|
97
107
|
*/
|
|
98
108
|
toJSON(options?: any): Promise<any>;
|
|
99
|
-
private getPluginBasePath;
|
|
100
109
|
}
|
|
101
110
|
export default Plugin;
|
package/lib/plugin.js
CHANGED
|
@@ -124,13 +124,18 @@ const _Plugin = class _Plugin {
|
|
|
124
124
|
}
|
|
125
125
|
async afterRemove() {
|
|
126
126
|
}
|
|
127
|
-
|
|
127
|
+
/**
|
|
128
|
+
* Fired when a sync message is received.
|
|
129
|
+
* @experimental
|
|
130
|
+
*/
|
|
131
|
+
onSync(message = {}) {
|
|
128
132
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
/**
|
|
134
|
+
* Publish a sync message.
|
|
135
|
+
* @experimental
|
|
136
|
+
*/
|
|
137
|
+
sync(message) {
|
|
138
|
+
this.app.syncManager.publish(this.name, message);
|
|
134
139
|
}
|
|
135
140
|
/**
|
|
136
141
|
* @deprecated
|
|
@@ -161,6 +166,13 @@ const _Plugin = class _Plugin {
|
|
|
161
166
|
}
|
|
162
167
|
});
|
|
163
168
|
}
|
|
169
|
+
async getPluginBasePath() {
|
|
170
|
+
if (!this.options.packageName) {
|
|
171
|
+
this.app.log.trace(`plugin '${this.name}' is missing packageName`);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
return (0, import_utils2.getPluginBasePath)(this.options.packageName);
|
|
175
|
+
}
|
|
164
176
|
/**
|
|
165
177
|
* @internal
|
|
166
178
|
*/
|
|
@@ -171,6 +183,7 @@ const _Plugin = class _Plugin {
|
|
|
171
183
|
}
|
|
172
184
|
const directory = (0, import_path.resolve)(basePath, "server/collections");
|
|
173
185
|
if (await (0, import_utils.fsExists)(directory)) {
|
|
186
|
+
this.app.log.trace(`load plugin collections [${this.name}]`);
|
|
174
187
|
await this.db.import({
|
|
175
188
|
directory,
|
|
176
189
|
from: this.options.packageName
|
|
@@ -220,12 +233,6 @@ const _Plugin = class _Plugin {
|
|
|
220
233
|
}
|
|
221
234
|
return results;
|
|
222
235
|
}
|
|
223
|
-
async getPluginBasePath() {
|
|
224
|
-
if (!this.options.packageName) {
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
return (0, import_utils2.getPluginBasePath)(this.options.packageName);
|
|
228
|
-
}
|
|
229
236
|
};
|
|
230
237
|
__name(_Plugin, "Plugin");
|
|
231
238
|
let Plugin = _Plugin;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
/// <reference types="node" />
|
|
10
|
+
import EventEmitter from 'node:events';
|
|
11
|
+
import Application from './application';
|
|
12
|
+
export declare abstract class SyncAdapter extends EventEmitter {
|
|
13
|
+
abstract get ready(): boolean;
|
|
14
|
+
abstract publish(data: SyncMessage): void | Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export type SyncMessageData = Record<string, string>;
|
|
17
|
+
export type SyncEventCallback = (message: SyncMessageData) => void;
|
|
18
|
+
export type SyncMessage = {
|
|
19
|
+
namespace: string;
|
|
20
|
+
nodeId: string;
|
|
21
|
+
appName: string;
|
|
22
|
+
} & SyncMessageData;
|
|
23
|
+
/**
|
|
24
|
+
* @experimental
|
|
25
|
+
*/
|
|
26
|
+
export declare class SyncManager {
|
|
27
|
+
private app;
|
|
28
|
+
private nodeId;
|
|
29
|
+
private eventEmitter;
|
|
30
|
+
private adapter;
|
|
31
|
+
private incomingBuffer;
|
|
32
|
+
private outgoingBuffer;
|
|
33
|
+
private flushTimer;
|
|
34
|
+
get available(): boolean;
|
|
35
|
+
private onMessage;
|
|
36
|
+
private onSync;
|
|
37
|
+
private onReady;
|
|
38
|
+
constructor(app: Application);
|
|
39
|
+
init(adapter: SyncAdapter): void;
|
|
40
|
+
subscribe(namespace: string, callback: SyncEventCallback): void;
|
|
41
|
+
unsubscribe(namespace: string, callback: SyncEventCallback): void;
|
|
42
|
+
/**
|
|
43
|
+
* Publish a message to the sync manager
|
|
44
|
+
*/
|
|
45
|
+
publish(namespace: string, data?: SyncMessageData): void | Promise<void>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
17
|
+
var __export = (target, all) => {
|
|
18
|
+
for (var name in all)
|
|
19
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
20
|
+
};
|
|
21
|
+
var __copyProps = (to, from, except, desc) => {
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
+
for (let key of __getOwnPropNames(from))
|
|
24
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
+
}
|
|
27
|
+
return to;
|
|
28
|
+
};
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
+
mod
|
|
36
|
+
));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
var sync_manager_exports = {};
|
|
39
|
+
__export(sync_manager_exports, {
|
|
40
|
+
SyncAdapter: () => SyncAdapter,
|
|
41
|
+
SyncManager: () => SyncManager
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(sync_manager_exports);
|
|
44
|
+
var import_node_crypto = require("node:crypto");
|
|
45
|
+
var import_node_events = __toESM(require("node:events"));
|
|
46
|
+
var import_lodash = require("lodash");
|
|
47
|
+
const _SyncAdapter = class _SyncAdapter extends import_node_events.default {
|
|
48
|
+
};
|
|
49
|
+
__name(_SyncAdapter, "SyncAdapter");
|
|
50
|
+
let SyncAdapter = _SyncAdapter;
|
|
51
|
+
const _SyncManager = class _SyncManager {
|
|
52
|
+
constructor(app) {
|
|
53
|
+
this.app = app;
|
|
54
|
+
this.nodeId = `${process.env.NODE_ID || (0, import_node_crypto.randomUUID)()}-${process.pid}`;
|
|
55
|
+
}
|
|
56
|
+
nodeId;
|
|
57
|
+
eventEmitter = new import_node_events.default();
|
|
58
|
+
adapter = null;
|
|
59
|
+
incomingBuffer = [];
|
|
60
|
+
outgoingBuffer = [];
|
|
61
|
+
flushTimer = null;
|
|
62
|
+
get available() {
|
|
63
|
+
return this.adapter ? this.adapter.ready : false;
|
|
64
|
+
}
|
|
65
|
+
onMessage(namespace, message) {
|
|
66
|
+
this.app.logger.info(`emit sync event in namespace ${namespace}`);
|
|
67
|
+
this.eventEmitter.emit(namespace, message);
|
|
68
|
+
const pluginInstance = this.app.pm.get(namespace);
|
|
69
|
+
pluginInstance.onSync(message);
|
|
70
|
+
}
|
|
71
|
+
onSync = /* @__PURE__ */ __name((messages) => {
|
|
72
|
+
this.app.logger.info("sync messages received, save into buffer:", messages);
|
|
73
|
+
if (this.flushTimer) {
|
|
74
|
+
clearTimeout(this.flushTimer);
|
|
75
|
+
this.flushTimer = null;
|
|
76
|
+
}
|
|
77
|
+
this.incomingBuffer = (0, import_lodash.uniqWith)(
|
|
78
|
+
this.incomingBuffer.concat(
|
|
79
|
+
messages.filter((item) => item.nodeId !== this.nodeId && item.appName === this.app.name).map(({ nodeId, appName, ...message }) => message)
|
|
80
|
+
),
|
|
81
|
+
import_lodash.isEqual
|
|
82
|
+
);
|
|
83
|
+
this.flushTimer = setTimeout(() => {
|
|
84
|
+
this.incomingBuffer.forEach(({ namespace, ...message }) => {
|
|
85
|
+
this.onMessage(namespace, message);
|
|
86
|
+
});
|
|
87
|
+
this.incomingBuffer = [];
|
|
88
|
+
}, 1e3);
|
|
89
|
+
}, "onSync");
|
|
90
|
+
onReady = /* @__PURE__ */ __name(() => {
|
|
91
|
+
while (this.outgoingBuffer.length) {
|
|
92
|
+
const [namespace, data] = this.outgoingBuffer.shift();
|
|
93
|
+
this.publish(namespace, data);
|
|
94
|
+
}
|
|
95
|
+
}, "onReady");
|
|
96
|
+
init(adapter) {
|
|
97
|
+
if (this.adapter) {
|
|
98
|
+
throw new Error("sync adapter is already exists");
|
|
99
|
+
}
|
|
100
|
+
if (!adapter) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
this.adapter = adapter;
|
|
104
|
+
this.adapter.on("message", this.onSync);
|
|
105
|
+
this.adapter.on("ready", this.onReady);
|
|
106
|
+
}
|
|
107
|
+
subscribe(namespace, callback) {
|
|
108
|
+
this.eventEmitter.on(namespace, callback);
|
|
109
|
+
}
|
|
110
|
+
unsubscribe(namespace, callback) {
|
|
111
|
+
this.eventEmitter.off(namespace, callback);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Publish a message to the sync manager
|
|
115
|
+
*/
|
|
116
|
+
publish(namespace, data = {}) {
|
|
117
|
+
if (!this.adapter) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (!this.adapter.ready) {
|
|
121
|
+
this.outgoingBuffer.push([namespace, data]);
|
|
122
|
+
this.app.logger.warn(`sync adapter is not ready for now, message will be send when it is ready`);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
this.app.logger.info(`publishing sync message from #${this.nodeId} (${this.app.name}) in namespace ${namespace}:`, {
|
|
126
|
+
data
|
|
127
|
+
});
|
|
128
|
+
return this.adapter.publish({ ...data, nodeId: this.nodeId, appName: this.app.name, namespace });
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
__name(_SyncManager, "SyncManager");
|
|
132
|
+
let SyncManager = _SyncManager;
|
|
133
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
134
|
+
0 && (module.exports = {
|
|
135
|
+
SyncAdapter,
|
|
136
|
+
SyncManager
|
|
137
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/server",
|
|
3
|
-
"version": "1.5.0-
|
|
3
|
+
"version": "1.5.0-beta.2",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -10,24 +10,22 @@
|
|
|
10
10
|
"@koa/cors": "^3.1.0",
|
|
11
11
|
"@koa/multer": "^3.0.2",
|
|
12
12
|
"@koa/router": "^9.4.0",
|
|
13
|
-
"@nocobase/acl": "1.5.0-
|
|
14
|
-
"@nocobase/actions": "1.5.0-
|
|
15
|
-
"@nocobase/auth": "1.5.0-
|
|
16
|
-
"@nocobase/cache": "1.5.0-
|
|
17
|
-
"@nocobase/data-source-manager": "1.5.0-
|
|
18
|
-
"@nocobase/database": "1.5.0-
|
|
19
|
-
"@nocobase/evaluators": "1.5.0-
|
|
20
|
-
"@nocobase/
|
|
21
|
-
"@nocobase/
|
|
22
|
-
"@nocobase/
|
|
23
|
-
"@nocobase/
|
|
24
|
-
"@nocobase/
|
|
25
|
-
"@nocobase/utils": "1.5.0-alpha.5",
|
|
13
|
+
"@nocobase/acl": "1.5.0-beta.2",
|
|
14
|
+
"@nocobase/actions": "1.5.0-beta.2",
|
|
15
|
+
"@nocobase/auth": "1.5.0-beta.2",
|
|
16
|
+
"@nocobase/cache": "1.5.0-beta.2",
|
|
17
|
+
"@nocobase/data-source-manager": "1.5.0-beta.2",
|
|
18
|
+
"@nocobase/database": "1.5.0-beta.2",
|
|
19
|
+
"@nocobase/evaluators": "1.5.0-beta.2",
|
|
20
|
+
"@nocobase/logger": "1.5.0-beta.2",
|
|
21
|
+
"@nocobase/resourcer": "1.5.0-beta.2",
|
|
22
|
+
"@nocobase/sdk": "1.5.0-beta.2",
|
|
23
|
+
"@nocobase/telemetry": "1.5.0-beta.2",
|
|
24
|
+
"@nocobase/utils": "1.5.0-beta.2",
|
|
26
25
|
"@types/decompress": "4.2.7",
|
|
27
26
|
"@types/ini": "^1.3.31",
|
|
28
27
|
"@types/koa-send": "^4.1.3",
|
|
29
28
|
"@types/multer": "^1.4.5",
|
|
30
|
-
"async-mutex": "^0.5.0",
|
|
31
29
|
"axios": "^1.7.0",
|
|
32
30
|
"chalk": "^4.1.1",
|
|
33
31
|
"commander": "^9.2.0",
|
|
@@ -56,5 +54,5 @@
|
|
|
56
54
|
"@types/serve-handler": "^6.1.1",
|
|
57
55
|
"@types/ws": "^8.5.5"
|
|
58
56
|
},
|
|
59
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "8a9c29fdac5c6295dcc7abf00c3fa81bd9e01a36"
|
|
60
58
|
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
import { type PubSubManagerSubscribeOptions } from './types';
|
|
10
|
-
export declare class HandlerManager {
|
|
11
|
-
protected publisherId: string;
|
|
12
|
-
handlers: Map<any, any>;
|
|
13
|
-
uniqueMessageHandlers: Map<any, any>;
|
|
14
|
-
constructor(publisherId: string);
|
|
15
|
-
protected getMessageHash(message: any): Promise<string>;
|
|
16
|
-
protected verifyMessage({ onlySelf, skipSelf, publisherId }: {
|
|
17
|
-
onlySelf: any;
|
|
18
|
-
skipSelf: any;
|
|
19
|
-
publisherId: any;
|
|
20
|
-
}): boolean;
|
|
21
|
-
protected debounce(func: any, wait: number): any;
|
|
22
|
-
handleMessage({ channel, message, callback, debounce }: {
|
|
23
|
-
channel: any;
|
|
24
|
-
message: any;
|
|
25
|
-
callback: any;
|
|
26
|
-
debounce: any;
|
|
27
|
-
}): Promise<void>;
|
|
28
|
-
wrapper(channel: any, callback: any, options: any): (wrappedMessage: any) => Promise<void>;
|
|
29
|
-
set(channel: string, callback: any, options: PubSubManagerSubscribeOptions): (wrappedMessage: any) => Promise<void>;
|
|
30
|
-
get(channel: string, callback: any): any;
|
|
31
|
-
delete(channel: string, callback: any): any;
|
|
32
|
-
reset(): void;
|
|
33
|
-
each(callback: any): Promise<void>;
|
|
34
|
-
}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __create = Object.create;
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
17
|
-
var __export = (target, all) => {
|
|
18
|
-
for (var name in all)
|
|
19
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
20
|
-
};
|
|
21
|
-
var __copyProps = (to, from, except, desc) => {
|
|
22
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
-
for (let key of __getOwnPropNames(from))
|
|
24
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
-
}
|
|
27
|
-
return to;
|
|
28
|
-
};
|
|
29
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
-
mod
|
|
36
|
-
));
|
|
37
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
-
var handler_manager_exports = {};
|
|
39
|
-
__export(handler_manager_exports, {
|
|
40
|
-
HandlerManager: () => HandlerManager
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(handler_manager_exports);
|
|
43
|
-
var import_node_crypto = __toESM(require("node:crypto"));
|
|
44
|
-
var import_lodash = __toESM(require("lodash"));
|
|
45
|
-
const _HandlerManager = class _HandlerManager {
|
|
46
|
-
constructor(publisherId) {
|
|
47
|
-
this.publisherId = publisherId;
|
|
48
|
-
this.reset();
|
|
49
|
-
}
|
|
50
|
-
handlers;
|
|
51
|
-
uniqueMessageHandlers;
|
|
52
|
-
async getMessageHash(message) {
|
|
53
|
-
const encoder = new TextEncoder();
|
|
54
|
-
const data = encoder.encode(JSON.stringify(message));
|
|
55
|
-
const hashBuffer = await import_node_crypto.default.subtle.digest("SHA-256", data);
|
|
56
|
-
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
57
|
-
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
58
|
-
return hashHex;
|
|
59
|
-
}
|
|
60
|
-
verifyMessage({ onlySelf, skipSelf, publisherId }) {
|
|
61
|
-
if (onlySelf && publisherId !== this.publisherId) {
|
|
62
|
-
return;
|
|
63
|
-
} else if (!onlySelf && skipSelf && publisherId === this.publisherId) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
return true;
|
|
67
|
-
}
|
|
68
|
-
debounce(func, wait) {
|
|
69
|
-
if (wait) {
|
|
70
|
-
return import_lodash.default.debounce(func, wait);
|
|
71
|
-
}
|
|
72
|
-
return func;
|
|
73
|
-
}
|
|
74
|
-
async handleMessage({ channel, message, callback, debounce }) {
|
|
75
|
-
if (!debounce) {
|
|
76
|
-
await callback(message);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
const messageHash = channel + await this.getMessageHash(message);
|
|
80
|
-
if (!this.uniqueMessageHandlers.has(messageHash)) {
|
|
81
|
-
this.uniqueMessageHandlers.set(messageHash, this.debounce(callback, debounce));
|
|
82
|
-
}
|
|
83
|
-
const handler = this.uniqueMessageHandlers.get(messageHash);
|
|
84
|
-
try {
|
|
85
|
-
await handler(message);
|
|
86
|
-
setTimeout(() => {
|
|
87
|
-
this.uniqueMessageHandlers.delete(messageHash);
|
|
88
|
-
}, debounce);
|
|
89
|
-
} catch (error) {
|
|
90
|
-
this.uniqueMessageHandlers.delete(messageHash);
|
|
91
|
-
throw error;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
wrapper(channel, callback, options) {
|
|
95
|
-
const { debounce = 0 } = options;
|
|
96
|
-
return async (wrappedMessage) => {
|
|
97
|
-
const json = JSON.parse(wrappedMessage);
|
|
98
|
-
if (!this.verifyMessage(json)) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
await this.handleMessage({ channel, message: json.message, debounce, callback });
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
set(channel, callback, options) {
|
|
105
|
-
if (!this.handlers.has(channel)) {
|
|
106
|
-
this.handlers.set(channel, /* @__PURE__ */ new Map());
|
|
107
|
-
}
|
|
108
|
-
const headlerMap = this.handlers.get(channel);
|
|
109
|
-
const headler = this.wrapper(channel, callback, options);
|
|
110
|
-
headlerMap.set(callback, headler);
|
|
111
|
-
return headler;
|
|
112
|
-
}
|
|
113
|
-
get(channel, callback) {
|
|
114
|
-
const headlerMap = this.handlers.get(channel);
|
|
115
|
-
if (!headlerMap) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
return headlerMap.get(callback);
|
|
119
|
-
}
|
|
120
|
-
delete(channel, callback) {
|
|
121
|
-
if (!callback) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
const headlerMap = this.handlers.get(channel);
|
|
125
|
-
if (!headlerMap) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
const headler = headlerMap.get(callback);
|
|
129
|
-
headlerMap.delete(callback);
|
|
130
|
-
return headler;
|
|
131
|
-
}
|
|
132
|
-
reset() {
|
|
133
|
-
this.handlers = /* @__PURE__ */ new Map();
|
|
134
|
-
this.uniqueMessageHandlers = /* @__PURE__ */ new Map();
|
|
135
|
-
}
|
|
136
|
-
async each(callback) {
|
|
137
|
-
for (const [channel, headlerMap] of this.handlers) {
|
|
138
|
-
for (const headler of headlerMap.values()) {
|
|
139
|
-
await callback(channel, headler);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
__name(_HandlerManager, "HandlerManager");
|
|
145
|
-
let HandlerManager = _HandlerManager;
|
|
146
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
147
|
-
0 && (module.exports = {
|
|
148
|
-
HandlerManager
|
|
149
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
export * from './handler-manager';
|
|
10
|
-
export * from './pub-sub-manager';
|
|
11
|
-
export * from './types';
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __copyProps = (to, from, except, desc) => {
|
|
15
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
-
for (let key of __getOwnPropNames(from))
|
|
17
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
23
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
var pub_sub_manager_exports = {};
|
|
25
|
-
module.exports = __toCommonJS(pub_sub_manager_exports);
|
|
26
|
-
__reExport(pub_sub_manager_exports, require("./handler-manager"), module.exports);
|
|
27
|
-
__reExport(pub_sub_manager_exports, require("./pub-sub-manager"), module.exports);
|
|
28
|
-
__reExport(pub_sub_manager_exports, require("./types"), module.exports);
|
|
29
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
-
0 && (module.exports = {
|
|
31
|
-
...require("./handler-manager"),
|
|
32
|
-
...require("./pub-sub-manager"),
|
|
33
|
-
...require("./types")
|
|
34
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
import Application from '../application';
|
|
10
|
-
import { HandlerManager } from './handler-manager';
|
|
11
|
-
import { PubSubCallback, type IPubSubAdapter, type PubSubManagerOptions, type PubSubManagerPublishOptions, type PubSubManagerSubscribeOptions } from './types';
|
|
12
|
-
export declare const createPubSubManager: (app: Application, options: PubSubManagerOptions) => PubSubManager;
|
|
13
|
-
export declare class PubSubManager {
|
|
14
|
-
protected options: PubSubManagerOptions;
|
|
15
|
-
protected publisherId: string;
|
|
16
|
-
protected adapter: IPubSubAdapter;
|
|
17
|
-
protected handlerManager: HandlerManager;
|
|
18
|
-
constructor(options?: PubSubManagerOptions);
|
|
19
|
-
get channelPrefix(): string;
|
|
20
|
-
setAdapter(adapter: IPubSubAdapter): void;
|
|
21
|
-
isConnected(): Promise<boolean>;
|
|
22
|
-
connect(): Promise<void>;
|
|
23
|
-
close(): Promise<any>;
|
|
24
|
-
subscribe(channel: string, callback: PubSubCallback, options?: PubSubManagerSubscribeOptions): Promise<void>;
|
|
25
|
-
unsubscribe(channel: string, callback: PubSubCallback): Promise<any>;
|
|
26
|
-
publish(channel: string, message: any, options?: PubSubManagerPublishOptions): Promise<any>;
|
|
27
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
15
|
-
var __export = (target, all) => {
|
|
16
|
-
for (var name in all)
|
|
17
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
18
|
-
};
|
|
19
|
-
var __copyProps = (to, from, except, desc) => {
|
|
20
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
21
|
-
for (let key of __getOwnPropNames(from))
|
|
22
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
23
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
24
|
-
}
|
|
25
|
-
return to;
|
|
26
|
-
};
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var pub_sub_manager_exports = {};
|
|
29
|
-
__export(pub_sub_manager_exports, {
|
|
30
|
-
PubSubManager: () => PubSubManager,
|
|
31
|
-
createPubSubManager: () => createPubSubManager
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(pub_sub_manager_exports);
|
|
34
|
-
var import_utils = require("@nocobase/utils");
|
|
35
|
-
var import_handler_manager = require("./handler-manager");
|
|
36
|
-
const createPubSubManager = /* @__PURE__ */ __name((app, options) => {
|
|
37
|
-
const pubSubManager = new PubSubManager(options);
|
|
38
|
-
app.on("afterStart", async () => {
|
|
39
|
-
await pubSubManager.connect();
|
|
40
|
-
});
|
|
41
|
-
app.on("afterStop", async () => {
|
|
42
|
-
await pubSubManager.close();
|
|
43
|
-
});
|
|
44
|
-
return pubSubManager;
|
|
45
|
-
}, "createPubSubManager");
|
|
46
|
-
const _PubSubManager = class _PubSubManager {
|
|
47
|
-
constructor(options = {}) {
|
|
48
|
-
this.options = options;
|
|
49
|
-
this.publisherId = (0, import_utils.uid)();
|
|
50
|
-
this.handlerManager = new import_handler_manager.HandlerManager(this.publisherId);
|
|
51
|
-
}
|
|
52
|
-
publisherId;
|
|
53
|
-
adapter;
|
|
54
|
-
handlerManager;
|
|
55
|
-
get channelPrefix() {
|
|
56
|
-
var _a;
|
|
57
|
-
return ((_a = this.options) == null ? void 0 : _a.channelPrefix) ? `${this.options.channelPrefix}.` : "";
|
|
58
|
-
}
|
|
59
|
-
setAdapter(adapter) {
|
|
60
|
-
this.adapter = adapter;
|
|
61
|
-
}
|
|
62
|
-
async isConnected() {
|
|
63
|
-
if (this.adapter) {
|
|
64
|
-
return this.adapter.isConnected();
|
|
65
|
-
}
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
async connect() {
|
|
69
|
-
if (!this.adapter) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
await this.adapter.connect();
|
|
73
|
-
await this.handlerManager.each(async (channel, headler) => {
|
|
74
|
-
await this.adapter.subscribe(`${this.channelPrefix}${channel}`, headler);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
async close() {
|
|
78
|
-
if (!this.adapter) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
return await this.adapter.close();
|
|
82
|
-
}
|
|
83
|
-
async subscribe(channel, callback, options = {}) {
|
|
84
|
-
await this.unsubscribe(channel, callback);
|
|
85
|
-
const handler = this.handlerManager.set(channel, callback, options);
|
|
86
|
-
if (await this.isConnected()) {
|
|
87
|
-
await this.adapter.subscribe(`${this.channelPrefix}${channel}`, handler);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
async unsubscribe(channel, callback) {
|
|
91
|
-
const handler = this.handlerManager.delete(channel, callback);
|
|
92
|
-
if (!this.adapter || !handler) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
return this.adapter.unsubscribe(`${this.channelPrefix}${channel}`, handler);
|
|
96
|
-
}
|
|
97
|
-
async publish(channel, message, options) {
|
|
98
|
-
var _a;
|
|
99
|
-
if (!((_a = this.adapter) == null ? void 0 : _a.isConnected())) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
const wrappedMessage = JSON.stringify({
|
|
103
|
-
publisherId: this.publisherId,
|
|
104
|
-
...options,
|
|
105
|
-
message
|
|
106
|
-
});
|
|
107
|
-
return this.adapter.publish(`${this.channelPrefix}${channel}`, wrappedMessage);
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
__name(_PubSubManager, "PubSubManager");
|
|
111
|
-
let PubSubManager = _PubSubManager;
|
|
112
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
113
|
-
0 && (module.exports = {
|
|
114
|
-
PubSubManager,
|
|
115
|
-
createPubSubManager
|
|
116
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
export interface PubSubManagerOptions {
|
|
10
|
-
channelPrefix?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface PubSubManagerPublishOptions {
|
|
13
|
-
skipSelf?: boolean;
|
|
14
|
-
onlySelf?: boolean;
|
|
15
|
-
}
|
|
16
|
-
export interface PubSubManagerSubscribeOptions {
|
|
17
|
-
debounce?: number;
|
|
18
|
-
}
|
|
19
|
-
export type PubSubCallback = (message: any) => Promise<void>;
|
|
20
|
-
export interface IPubSubAdapter {
|
|
21
|
-
isConnected(): Promise<boolean> | boolean;
|
|
22
|
-
connect(): Promise<any>;
|
|
23
|
-
close(): Promise<any>;
|
|
24
|
-
subscribe(channel: string, callback: PubSubCallback): Promise<any>;
|
|
25
|
-
unsubscribe(channel: string, callback: PubSubCallback): Promise<any>;
|
|
26
|
-
publish(channel: string, message: string): Promise<any>;
|
|
27
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __copyProps = (to, from, except, desc) => {
|
|
15
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
-
for (let key of __getOwnPropNames(from))
|
|
17
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
-
var types_exports = {};
|
|
24
|
-
module.exports = __toCommonJS(types_exports);
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
import { Transactionable } from '@nocobase/database';
|
|
10
|
-
import Application from './application';
|
|
11
|
-
import { PubSubCallback, PubSubManager, PubSubManagerPublishOptions } from './pub-sub-manager';
|
|
12
|
-
export declare class SyncMessageManager {
|
|
13
|
-
protected app: Application;
|
|
14
|
-
protected options: any;
|
|
15
|
-
protected versionManager: SyncMessageVersionManager;
|
|
16
|
-
protected pubSubManager: PubSubManager;
|
|
17
|
-
constructor(app: Application, options?: any);
|
|
18
|
-
get debounce(): any;
|
|
19
|
-
publish(channel: string, message: any, options?: PubSubManagerPublishOptions & Transactionable): Promise<any>;
|
|
20
|
-
subscribe(channel: string, callback: PubSubCallback): Promise<void>;
|
|
21
|
-
unsubscribe(channel: string, callback: PubSubCallback): Promise<any>;
|
|
22
|
-
sync(): Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
export declare class SyncMessageVersionManager {
|
|
25
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
15
|
-
var __export = (target, all) => {
|
|
16
|
-
for (var name in all)
|
|
17
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
18
|
-
};
|
|
19
|
-
var __copyProps = (to, from, except, desc) => {
|
|
20
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
21
|
-
for (let key of __getOwnPropNames(from))
|
|
22
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
23
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
24
|
-
}
|
|
25
|
-
return to;
|
|
26
|
-
};
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var sync_message_manager_exports = {};
|
|
29
|
-
__export(sync_message_manager_exports, {
|
|
30
|
-
SyncMessageManager: () => SyncMessageManager,
|
|
31
|
-
SyncMessageVersionManager: () => SyncMessageVersionManager
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(sync_message_manager_exports);
|
|
34
|
-
const _SyncMessageManager = class _SyncMessageManager {
|
|
35
|
-
constructor(app, options = {}) {
|
|
36
|
-
this.app = app;
|
|
37
|
-
this.options = options;
|
|
38
|
-
this.versionManager = new SyncMessageVersionManager();
|
|
39
|
-
app.on("beforeLoadPlugin", async (plugin) => {
|
|
40
|
-
if (!plugin.name) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
await this.subscribe(plugin.name, plugin.handleSyncMessage.bind(plugin));
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
versionManager;
|
|
47
|
-
pubSubManager;
|
|
48
|
-
get debounce() {
|
|
49
|
-
return this.options.debounce || 1e3;
|
|
50
|
-
}
|
|
51
|
-
async publish(channel, message, options) {
|
|
52
|
-
const { transaction, ...others } = options || {};
|
|
53
|
-
if (transaction) {
|
|
54
|
-
return await new Promise((resolve, reject) => {
|
|
55
|
-
const timer = setTimeout(() => {
|
|
56
|
-
reject(
|
|
57
|
-
new Error(
|
|
58
|
-
`Publish message to ${channel} timeout, channel: ${channel}, message: ${JSON.stringify(message)}`
|
|
59
|
-
)
|
|
60
|
-
);
|
|
61
|
-
}, 5e4);
|
|
62
|
-
transaction.afterCommit(async () => {
|
|
63
|
-
try {
|
|
64
|
-
const r = await this.app.pubSubManager.publish(`${this.app.name}.sync.${channel}`, message, {
|
|
65
|
-
skipSelf: true,
|
|
66
|
-
...others
|
|
67
|
-
});
|
|
68
|
-
resolve(r);
|
|
69
|
-
} catch (error) {
|
|
70
|
-
reject(error);
|
|
71
|
-
} finally {
|
|
72
|
-
clearTimeout(timer);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
} else {
|
|
77
|
-
return await this.app.pubSubManager.publish(`${this.app.name}.sync.${channel}`, message, {
|
|
78
|
-
skipSelf: true,
|
|
79
|
-
...options
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
async subscribe(channel, callback) {
|
|
84
|
-
return await this.app.pubSubManager.subscribe(`${this.app.name}.sync.${channel}`, callback, {
|
|
85
|
-
debounce: this.debounce
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
async unsubscribe(channel, callback) {
|
|
89
|
-
return this.app.pubSubManager.unsubscribe(`${this.app.name}.sync.${channel}`, callback);
|
|
90
|
-
}
|
|
91
|
-
async sync() {
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
__name(_SyncMessageManager, "SyncMessageManager");
|
|
95
|
-
let SyncMessageManager = _SyncMessageManager;
|
|
96
|
-
const _SyncMessageVersionManager = class _SyncMessageVersionManager {
|
|
97
|
-
// TODO
|
|
98
|
-
};
|
|
99
|
-
__name(_SyncMessageVersionManager, "SyncMessageVersionManager");
|
|
100
|
-
let SyncMessageVersionManager = _SyncMessageVersionManager;
|
|
101
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
102
|
-
0 && (module.exports = {
|
|
103
|
-
SyncMessageManager,
|
|
104
|
-
SyncMessageVersionManager
|
|
105
|
-
});
|