@nocobase/plugin-multi-app-manager 1.4.0-beta.1 → 1.5.0-alpha.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.
package/dist/externalVersion.js
CHANGED
|
@@ -8,18 +8,18 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "1.
|
|
11
|
+
"@nocobase/client": "1.5.0-alpha.3",
|
|
12
12
|
"antd": "5.12.8",
|
|
13
13
|
"react": "18.2.0",
|
|
14
14
|
"@formily/react": "2.3.0",
|
|
15
15
|
"antd-style": "3.7.1",
|
|
16
16
|
"react-router-dom": "6.21.0",
|
|
17
17
|
"react-i18next": "11.18.6",
|
|
18
|
-
"@nocobase/database": "1.
|
|
19
|
-
"@nocobase/server": "1.
|
|
18
|
+
"@nocobase/database": "1.5.0-alpha.3",
|
|
19
|
+
"@nocobase/server": "1.5.0-alpha.3",
|
|
20
20
|
"lodash": "4.17.21",
|
|
21
21
|
"mysql2": "3.11.0",
|
|
22
22
|
"pg": "8.11.3",
|
|
23
|
-
"@nocobase/utils": "1.
|
|
23
|
+
"@nocobase/utils": "1.5.0-alpha.3",
|
|
24
24
|
"@formily/shared": "2.3.2"
|
|
25
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"mariadb","version":"2.5.6","description":"fast mariadb/mysql connector.","main":"promise.js","types":"types/index.d.ts","directories":{"lib":"lib","test":"test"},"private":false,"scripts":{"test":"npm run test:types-prettier && npm run test:prettier && npm run test:types && npm run test:lint && npm run test:base","test:base":"mocha --no-parallel --timeout 5000 \"test/**/*.js\" ","test:lint":"eslint \"{lib,test}/**/*.js\" ","test:types":"eslint \"types/*.ts\" ","test:types-prettier":"prettier --write \"types/*.ts\"","test:prettier":"prettier --write \"{tools,lib,test,benchmarks}/**/*.js\"","coverage":"npm run coverage:test && npm run coverage:report","coverage:test":"nyc mocha --no-parallel --timeout 5000 \"test/**/*.js\"","coverage:report":"nyc report --reporter=text-lcov > coverage.lcov && codecov","benchmark":"node ./benchmarks/benchmarks.js","generate":"node ./tools/generate-mariadb.js"},"repository":{"type":"git","url":"git+https://github.com/mariadb-corporation/mariadb-connector-nodejs.git"},"keywords":["mariadb","mysql","client","driver","connector"],"files":["lib","types/index.d.ts","promise.js","callback.js"],"engines":{"node":">= 10.13"},"author":"Diego Dupin <diego.dupin@mariadb.com>","license":"LGPL-2.1-or-later","dependencies":{"@types/geojson":"^7946.0.8","@types/node":"^17.0.10","denque":"^2.0.1","iconv-lite":"^0.6.3","long":"^5.2.0","moment-timezone":"^0.5.34","please-upgrade-node":"^3.2.0"},"devDependencies":{"@typescript-eslint/eslint-plugin":"^5.10.0","@typescript-eslint/parser":"^5.10.0","benchmark":"^2.1.4","chai":"^4.3.4","codecov":"^3.8.2","chalk":"^4.1.2","dom-parser":"^0.1.6","error-stack-parser":"^2.0.6","eslint":"^8.7.0","eslint-config-prettier":"^8.3.0","eslint-plugin-markdown":"^2.2.1","eslint-plugin-prettier":"^4.0.0","mocha":"^9.2.0","mocha-lcov-reporter":"^1.3.0","nyc":"^15.1.0","prettier":"^2.5.1","typescript":"^4.5.5"},"bugs":{"url":"https://jira.mariadb.org/projects/CONJS/"},"homepage":"https://github.com/mariadb-corporation/mariadb-connector-nodejs#readme","_lastModified":"2024-11-
|
|
1
|
+
{"name":"mariadb","version":"2.5.6","description":"fast mariadb/mysql connector.","main":"promise.js","types":"types/index.d.ts","directories":{"lib":"lib","test":"test"},"private":false,"scripts":{"test":"npm run test:types-prettier && npm run test:prettier && npm run test:types && npm run test:lint && npm run test:base","test:base":"mocha --no-parallel --timeout 5000 \"test/**/*.js\" ","test:lint":"eslint \"{lib,test}/**/*.js\" ","test:types":"eslint \"types/*.ts\" ","test:types-prettier":"prettier --write \"types/*.ts\"","test:prettier":"prettier --write \"{tools,lib,test,benchmarks}/**/*.js\"","coverage":"npm run coverage:test && npm run coverage:report","coverage:test":"nyc mocha --no-parallel --timeout 5000 \"test/**/*.js\"","coverage:report":"nyc report --reporter=text-lcov > coverage.lcov && codecov","benchmark":"node ./benchmarks/benchmarks.js","generate":"node ./tools/generate-mariadb.js"},"repository":{"type":"git","url":"git+https://github.com/mariadb-corporation/mariadb-connector-nodejs.git"},"keywords":["mariadb","mysql","client","driver","connector"],"files":["lib","types/index.d.ts","promise.js","callback.js"],"engines":{"node":">= 10.13"},"author":"Diego Dupin <diego.dupin@mariadb.com>","license":"LGPL-2.1-or-later","dependencies":{"@types/geojson":"^7946.0.8","@types/node":"^17.0.10","denque":"^2.0.1","iconv-lite":"^0.6.3","long":"^5.2.0","moment-timezone":"^0.5.34","please-upgrade-node":"^3.2.0"},"devDependencies":{"@typescript-eslint/eslint-plugin":"^5.10.0","@typescript-eslint/parser":"^5.10.0","benchmark":"^2.1.4","chai":"^4.3.4","codecov":"^3.8.2","chalk":"^4.1.2","dom-parser":"^0.1.6","error-stack-parser":"^2.0.6","eslint":"^8.7.0","eslint-config-prettier":"^8.3.0","eslint-plugin-markdown":"^2.2.1","eslint-plugin-prettier":"^4.0.0","mocha":"^9.2.0","mocha-lcov-reporter":"^1.3.0","nyc":"^15.1.0","prettier":"^2.5.1","typescript":"^4.5.5"},"bugs":{"url":"https://jira.mariadb.org/projects/CONJS/"},"homepage":"https://github.com/mariadb-corporation/mariadb-connector-nodejs#readme","_lastModified":"2024-11-21T01:47:12.362Z"}
|
|
@@ -41,7 +41,11 @@ class ApplicationModel extends import_database.Model {
|
|
|
41
41
|
...(0, import_utils.merge)(appOptions, appModelOptions),
|
|
42
42
|
name: appName
|
|
43
43
|
};
|
|
44
|
-
|
|
44
|
+
const subApp = new import_server.Application(subAppOptions);
|
|
45
|
+
subApp.on("afterStart", () => {
|
|
46
|
+
mainApp.emit("subAppStarted", subApp);
|
|
47
|
+
});
|
|
48
|
+
return subApp;
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/server/server.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare class PluginMultiAppManagerServer extends Plugin {
|
|
|
20
20
|
appOptionsFactory: AppOptionsFactory;
|
|
21
21
|
subAppUpgradeHandler: SubAppUpgradeHandler;
|
|
22
22
|
static getDatabaseConfig(app: Application): IDatabaseOptions;
|
|
23
|
+
handleSyncMessage(message: any): Promise<void>;
|
|
23
24
|
setSubAppUpgradeHandler(handler: SubAppUpgradeHandler): void;
|
|
24
25
|
setAppOptionsFactory(factory: AppOptionsFactory): void;
|
|
25
26
|
setAppDbCreator(appDbCreator: AppDbCreator): void;
|
package/dist/server/server.js
CHANGED
|
@@ -148,6 +148,31 @@ class PluginMultiAppManagerServer extends import_server.Plugin {
|
|
|
148
148
|
}
|
|
149
149
|
return import_lodash.default.cloneDeep(import_lodash.default.omit(oldConfig, ["migrator"]));
|
|
150
150
|
}
|
|
151
|
+
async handleSyncMessage(message) {
|
|
152
|
+
const { type } = message;
|
|
153
|
+
if (type === "subAppStarted") {
|
|
154
|
+
const { appName } = message;
|
|
155
|
+
const model = await this.app.db.getRepository("applications").findOne({
|
|
156
|
+
filter: {
|
|
157
|
+
name: appName
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
if (!model) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (import_server.AppSupervisor.getInstance().hasApp(appName)) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const subApp = model.registerToSupervisor(this.app, {
|
|
167
|
+
appOptionsFactory: this.appOptionsFactory
|
|
168
|
+
});
|
|
169
|
+
subApp.runCommand("start", "--quickstart");
|
|
170
|
+
}
|
|
171
|
+
if (type === "removeApp") {
|
|
172
|
+
const { appName } = message;
|
|
173
|
+
await import_server.AppSupervisor.getInstance().removeApp(appName);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
151
176
|
setSubAppUpgradeHandler(handler) {
|
|
152
177
|
this.subAppUpgradeHandler = handler;
|
|
153
178
|
}
|
|
@@ -176,6 +201,12 @@ class PluginMultiAppManagerServer extends import_server.Plugin {
|
|
|
176
201
|
const subApp = model.registerToSupervisor(this.app, {
|
|
177
202
|
appOptionsFactory: this.appOptionsFactory
|
|
178
203
|
});
|
|
204
|
+
subApp.on("afterStart", async () => {
|
|
205
|
+
this.sendSyncMessage({
|
|
206
|
+
type: "subAppStarted",
|
|
207
|
+
appName: name
|
|
208
|
+
});
|
|
209
|
+
});
|
|
179
210
|
const quickstart = async () => {
|
|
180
211
|
await this.appDbCreator(subApp, {
|
|
181
212
|
transaction,
|
|
@@ -190,8 +221,17 @@ class PluginMultiAppManagerServer extends import_server.Plugin {
|
|
|
190
221
|
}
|
|
191
222
|
}
|
|
192
223
|
);
|
|
193
|
-
this.db.on("applications.afterDestroy", async (model) => {
|
|
224
|
+
this.db.on("applications.afterDestroy", async (model, options) => {
|
|
194
225
|
await import_server.AppSupervisor.getInstance().removeApp(model.get("name"));
|
|
226
|
+
this.sendSyncMessage(
|
|
227
|
+
{
|
|
228
|
+
type: "removeApp",
|
|
229
|
+
appName: model.get("name")
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
transaction: options.transaction
|
|
233
|
+
}
|
|
234
|
+
);
|
|
195
235
|
});
|
|
196
236
|
const self = this;
|
|
197
237
|
async function LazyLoadApplication({
|
|
@@ -223,6 +263,12 @@ class PluginMultiAppManagerServer extends import_server.Plugin {
|
|
|
223
263
|
const subApp = applicationRecord.registerToSupervisor(mainApp, {
|
|
224
264
|
appOptionsFactory: self.appOptionsFactory
|
|
225
265
|
});
|
|
266
|
+
subApp.on("afterStart", async () => {
|
|
267
|
+
this.sendSyncMessage({
|
|
268
|
+
type: "subAppStarted",
|
|
269
|
+
appName: name
|
|
270
|
+
});
|
|
271
|
+
});
|
|
226
272
|
if (!loadButNotStart) {
|
|
227
273
|
await subApp.runCommand("start", "--quickstart");
|
|
228
274
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "多应用管理器",
|
|
5
5
|
"description": "Dynamically create multiple apps without separate deployments.",
|
|
6
6
|
"description.zh-CN": "无需单独部署即可动态创建多个应用。",
|
|
7
|
-
"version": "1.
|
|
7
|
+
"version": "1.5.0-alpha.3",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"homepage": "https://docs.nocobase.com/handbook/multi-app-manager",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"@formily/shared": "2.x",
|
|
15
15
|
"antd": "5.x",
|
|
16
16
|
"antd-style": "3.x",
|
|
17
|
-
"async-mutex": "^0.
|
|
17
|
+
"async-mutex": "^0.5.0",
|
|
18
18
|
"mysql2": "^3.11.0",
|
|
19
19
|
"pg": "^8.7.3",
|
|
20
20
|
"react": "18.x",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@nocobase/test": "1.x",
|
|
29
29
|
"@nocobase/utils": "1.x"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "5e01d81e7bb07f9a35b271ce903fb0dcd0d83fcf",
|
|
32
32
|
"keywords": [
|
|
33
33
|
"system"
|
|
34
34
|
]
|