@nocobase/server 0.8.0-alpha.6 → 0.8.0-alpha.7
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.
|
@@ -30,7 +30,7 @@ export declare class PluginManager {
|
|
|
30
30
|
create(name: string | string[]): Promise<void>;
|
|
31
31
|
clone(): PluginManager;
|
|
32
32
|
addStatic(plugin?: any, options?: any): any;
|
|
33
|
-
add(plugin: any, options?: any): any;
|
|
33
|
+
add(plugin: any, options?: any, transaction?: any): any;
|
|
34
34
|
load(options?: any): Promise<void>;
|
|
35
35
|
install(options?: InstallOptions): Promise<void>;
|
|
36
36
|
enable(name: string | string[]): Promise<void>;
|
|
@@ -348,12 +348,21 @@ class PluginManager {
|
|
|
348
348
|
return instance;
|
|
349
349
|
}
|
|
350
350
|
|
|
351
|
-
add(plugin, options = {}) {
|
|
351
|
+
add(plugin, options = {}, transaction) {
|
|
352
352
|
var _this4 = this;
|
|
353
353
|
|
|
354
354
|
return _asyncToGenerator(function* () {
|
|
355
355
|
if (Array.isArray(plugin)) {
|
|
356
|
-
|
|
356
|
+
const t = transaction || (yield _this4.app.db.sequelize.transaction());
|
|
357
|
+
|
|
358
|
+
try {
|
|
359
|
+
const items = yield Promise.all(plugin.map(p => _this4.add(p, options, t)));
|
|
360
|
+
yield t.commit();
|
|
361
|
+
return items;
|
|
362
|
+
} catch (error) {
|
|
363
|
+
yield t.rollback();
|
|
364
|
+
throw error;
|
|
365
|
+
}
|
|
357
366
|
} // console.log(`adding ${plugin} plugin`);
|
|
358
367
|
|
|
359
368
|
|
|
@@ -366,6 +375,7 @@ class PluginManager {
|
|
|
366
375
|
}));
|
|
367
376
|
|
|
368
377
|
let model = yield _this4.repository.findOne({
|
|
378
|
+
transaction,
|
|
369
379
|
filter: {
|
|
370
380
|
name: plugin
|
|
371
381
|
}
|
|
@@ -381,6 +391,7 @@ class PluginManager {
|
|
|
381
391
|
others = _objectWithoutProperties(options, _excluded);
|
|
382
392
|
|
|
383
393
|
yield _this4.repository.create({
|
|
394
|
+
transaction,
|
|
384
395
|
values: {
|
|
385
396
|
name: plugin,
|
|
386
397
|
version: packageJson.version,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/server",
|
|
3
|
-
"version": "0.8.0-alpha.
|
|
3
|
+
"version": "0.8.0-alpha.7",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"@hapi/topo": "^6.0.0",
|
|
15
15
|
"@koa/cors": "^3.1.0",
|
|
16
16
|
"@koa/router": "^9.4.0",
|
|
17
|
-
"@nocobase/acl": "0.8.0-alpha.
|
|
18
|
-
"@nocobase/actions": "0.8.0-alpha.
|
|
19
|
-
"@nocobase/database": "0.8.0-alpha.
|
|
20
|
-
"@nocobase/resourcer": "0.8.0-alpha.
|
|
17
|
+
"@nocobase/acl": "0.8.0-alpha.7",
|
|
18
|
+
"@nocobase/actions": "0.8.0-alpha.7",
|
|
19
|
+
"@nocobase/database": "0.8.0-alpha.7",
|
|
20
|
+
"@nocobase/resourcer": "0.8.0-alpha.7",
|
|
21
21
|
"chalk": "^4.1.1",
|
|
22
22
|
"commander": "^9.2.0",
|
|
23
23
|
"find-package-json": "^1.2.0",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/semver": "^7.3.9"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "8d6ee41e3ff401922cd8d2d93bc15e289cdf2977"
|
|
36
36
|
}
|