@nocobase/preset-nocobase 0.9.1-alpha.2 → 0.9.2-alpha.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/index.js +5 -48
- package/lib/migrations/2022-del-sample-plugins.js +0 -11
- package/package.json +33 -32
- package/src/index.ts +6 -10
package/lib/index.js
CHANGED
|
@@ -4,108 +4,75 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.PresetNocoBase = void 0;
|
|
7
|
-
|
|
8
7
|
function _server() {
|
|
9
8
|
const data = require("@nocobase/server");
|
|
10
|
-
|
|
11
9
|
_server = function _server() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _lodash() {
|
|
19
15
|
const data = _interopRequireDefault(require("lodash"));
|
|
20
|
-
|
|
21
16
|
_lodash = function _lodash() {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
function _path() {
|
|
29
22
|
const data = _interopRequireDefault(require("path"));
|
|
30
|
-
|
|
31
23
|
_path = function _path() {
|
|
32
24
|
return data;
|
|
33
25
|
};
|
|
34
|
-
|
|
35
26
|
return data;
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
39
|
-
|
|
40
29
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
41
|
-
|
|
42
30
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
43
|
-
|
|
44
31
|
class PresetNocoBase extends _server().Plugin {
|
|
45
32
|
constructor(...args) {
|
|
46
33
|
super(...args);
|
|
47
34
|
this.builtInPlugins = ['error-handler', 'collection-manager', 'ui-schema-storage', 'ui-routes-storage', 'file-manager', 'system-settings', 'sequence-field', 'verification', 'users', 'acl', 'china-region', 'workflow', 'client', 'export', 'import', 'audit-logs', 'duplicator', 'iframe-block', 'formula-field', 'charts'];
|
|
48
|
-
this.localPlugins = ['sample-hello', 'multi-app-manager', 'oidc', 'saml', 'map', 'snapshot-field', 'graph-collection-manager'];
|
|
35
|
+
this.localPlugins = ['sample-hello', 'multi-app-manager', 'multi-app-share-collection', 'oidc', 'saml', 'map', 'snapshot-field', 'graph-collection-manager'];
|
|
49
36
|
}
|
|
50
|
-
|
|
51
37
|
splitNames(name) {
|
|
52
38
|
return (name || '').split(',').filter(Boolean);
|
|
53
39
|
}
|
|
54
|
-
|
|
55
40
|
getBuiltInPlugins() {
|
|
56
41
|
const _process$env = process.env,
|
|
57
|
-
|
|
58
|
-
|
|
42
|
+
PRESET_NOCOBASE_PLUGINS = _process$env.PRESET_NOCOBASE_PLUGINS,
|
|
43
|
+
APPEND_PRESET_BUILT_IN_PLUGINS = _process$env.APPEND_PRESET_BUILT_IN_PLUGINS;
|
|
59
44
|
return _lodash().default.uniq(this.splitNames(APPEND_PRESET_BUILT_IN_PLUGINS || PRESET_NOCOBASE_PLUGINS).concat(this.builtInPlugins));
|
|
60
45
|
}
|
|
61
|
-
|
|
62
46
|
getLocalPlugins() {
|
|
63
47
|
const APPEND_PRESET_LOCAL_PLUGINS = process.env.APPEND_PRESET_LOCAL_PLUGINS;
|
|
64
48
|
return _lodash().default.uniq(this.splitNames(APPEND_PRESET_LOCAL_PLUGINS).concat(this.localPlugins));
|
|
65
49
|
}
|
|
66
|
-
|
|
67
50
|
addBuiltInPlugins(options) {
|
|
68
51
|
var _this = this;
|
|
69
|
-
|
|
70
52
|
return _asyncToGenerator(function* () {
|
|
71
53
|
const builtInPlugins = _this.getBuiltInPlugins();
|
|
72
|
-
|
|
73
54
|
yield _this.app.pm.add(builtInPlugins, {
|
|
74
55
|
enabled: true,
|
|
75
56
|
builtIn: true,
|
|
76
57
|
installed: true
|
|
77
58
|
});
|
|
78
|
-
|
|
79
59
|
const localPlugins = _this.getLocalPlugins();
|
|
80
|
-
|
|
81
60
|
yield _this.app.pm.add(localPlugins, {});
|
|
82
61
|
yield _this.app.reload({
|
|
83
62
|
method: options.method
|
|
84
63
|
});
|
|
85
64
|
})();
|
|
86
65
|
}
|
|
87
|
-
|
|
88
66
|
afterAdd() {
|
|
89
67
|
var _this2 = this;
|
|
90
|
-
|
|
91
68
|
this.app.on('beforeLoad', /*#__PURE__*/function () {
|
|
92
69
|
var _ref = _asyncToGenerator(function* (app, options) {
|
|
93
70
|
if ((options === null || options === void 0 ? void 0 : options.method) !== 'upgrade') {
|
|
94
71
|
return;
|
|
95
72
|
}
|
|
96
|
-
|
|
97
73
|
const version = yield _this2.app.version.get();
|
|
98
|
-
console.log(`The version number before upgrade is ${version}`);
|
|
99
|
-
// if (result) {
|
|
100
|
-
// const r = await this.db.collectionExistsInDb('applicationPlugins');
|
|
101
|
-
// if (r) {
|
|
102
|
-
// console.log(`Clear the installed application plugins`);
|
|
103
|
-
// await this.db.getRepository('applicationPlugins').destroy({ truncate: true });
|
|
104
|
-
// await this.app.reload({ method: options.method });
|
|
105
|
-
// }
|
|
106
|
-
// }
|
|
74
|
+
console.log(`The version number before upgrade is ${version}`);
|
|
107
75
|
});
|
|
108
|
-
|
|
109
76
|
return function (_x, _x2) {
|
|
110
77
|
return _ref.apply(this, arguments);
|
|
111
78
|
};
|
|
@@ -113,16 +80,13 @@ class PresetNocoBase extends _server().Plugin {
|
|
|
113
80
|
this.app.on('beforeUpgrade', /*#__PURE__*/function () {
|
|
114
81
|
var _ref2 = _asyncToGenerator(function* (options) {
|
|
115
82
|
const result = yield _this2.app.version.satisfies('<0.8.0-alpha.1');
|
|
116
|
-
|
|
117
83
|
if (result) {
|
|
118
84
|
console.log(`Initialize all built-in plugins beforeUpgrade`);
|
|
119
85
|
yield _this2.addBuiltInPlugins({
|
|
120
86
|
method: 'upgrade'
|
|
121
87
|
});
|
|
122
88
|
}
|
|
123
|
-
|
|
124
89
|
const builtInPlugins = _this2.getBuiltInPlugins();
|
|
125
|
-
|
|
126
90
|
const plugins = yield _this2.app.db.getRepository('applicationPlugins').find();
|
|
127
91
|
const pluginNames = plugins.map(p => p.name);
|
|
128
92
|
yield _this2.app.pm.add(builtInPlugins.filter(plugin => !pluginNames.includes(plugin)), {
|
|
@@ -130,34 +94,29 @@ class PresetNocoBase extends _server().Plugin {
|
|
|
130
94
|
builtIn: true,
|
|
131
95
|
installed: true
|
|
132
96
|
});
|
|
133
|
-
|
|
134
97
|
const localPlugins = _this2.getLocalPlugins();
|
|
135
|
-
|
|
136
98
|
yield _this2.app.pm.add(localPlugins.filter(plugin => !pluginNames.includes(plugin)), {});
|
|
137
99
|
yield _this2.app.reload({
|
|
138
100
|
method: 'upgrade'
|
|
139
101
|
});
|
|
140
102
|
yield _this2.app.db.sync();
|
|
141
103
|
});
|
|
142
|
-
|
|
143
104
|
return function (_x3) {
|
|
144
105
|
return _ref2.apply(this, arguments);
|
|
145
106
|
};
|
|
146
107
|
}());
|
|
147
108
|
this.app.on('beforeInstall', /*#__PURE__*/function () {
|
|
148
109
|
var _ref3 = _asyncToGenerator(function* (options) {
|
|
149
|
-
console.log(`Initialize all built-in plugins beforeInstall`);
|
|
110
|
+
console.log(`Initialize all built-in plugins beforeInstall in ${_this2.app.name}`);
|
|
150
111
|
yield _this2.addBuiltInPlugins({
|
|
151
112
|
method: 'install'
|
|
152
113
|
});
|
|
153
114
|
});
|
|
154
|
-
|
|
155
115
|
return function (_x4) {
|
|
156
116
|
return _ref3.apply(this, arguments);
|
|
157
117
|
};
|
|
158
118
|
}());
|
|
159
119
|
}
|
|
160
|
-
|
|
161
120
|
beforeLoad() {
|
|
162
121
|
this.db.addMigrations({
|
|
163
122
|
namespace: this.getName(),
|
|
@@ -167,9 +126,7 @@ class PresetNocoBase extends _server().Plugin {
|
|
|
167
126
|
}
|
|
168
127
|
});
|
|
169
128
|
}
|
|
170
|
-
|
|
171
129
|
}
|
|
172
|
-
|
|
173
130
|
exports.PresetNocoBase = PresetNocoBase;
|
|
174
131
|
var _default = PresetNocoBase;
|
|
175
132
|
exports.default = _default;
|
|
@@ -4,32 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
function _server() {
|
|
9
8
|
const data = require("@nocobase/server");
|
|
10
|
-
|
|
11
9
|
_server = function _server() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
19
|
-
|
|
20
15
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
21
|
-
|
|
22
16
|
class DelSamplePluginMigration extends _server().Migration {
|
|
23
17
|
up() {
|
|
24
18
|
var _this = this;
|
|
25
|
-
|
|
26
19
|
return _asyncToGenerator(function* () {
|
|
27
20
|
const r1 = yield _this.app.version.satisfies('>=0.8.0-alpha.1');
|
|
28
21
|
const r2 = yield _this.app.version.satisfies('<=0.8.0-alpha.6');
|
|
29
|
-
|
|
30
22
|
if (r1 && r2) {
|
|
31
23
|
const repository = _this.context.db.getRepository('applicationPlugins');
|
|
32
|
-
|
|
33
24
|
yield repository.destroy({
|
|
34
25
|
filter: {
|
|
35
26
|
'name.$in': ['sample-command', 'sample-shop-modeling', 'sample-hello', 'sample-shop-events', 'sample-shop-i18n', 'sample-shop-actions', 'sample-ratelimit', 'sample-custom-signup-page', 'sample-custom-block', 'sample-custom-page']
|
|
@@ -38,7 +29,5 @@ class DelSamplePluginMigration extends _server().Migration {
|
|
|
38
29
|
}
|
|
39
30
|
})();
|
|
40
31
|
}
|
|
41
|
-
|
|
42
32
|
}
|
|
43
|
-
|
|
44
33
|
exports.default = DelSamplePluginMigration;
|
package/package.json
CHANGED
|
@@ -1,45 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/preset-nocobase",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2-alpha.2",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@nocobase/plugin-acl": "0.9.
|
|
9
|
-
"@nocobase/plugin-audit-logs": "0.9.
|
|
10
|
-
"@nocobase/plugin-charts": "0.9.
|
|
11
|
-
"@nocobase/plugin-china-region": "0.9.
|
|
12
|
-
"@nocobase/plugin-client": "0.9.
|
|
13
|
-
"@nocobase/plugin-collection-manager": "0.9.
|
|
14
|
-
"@nocobase/plugin-duplicator": "0.9.
|
|
15
|
-
"@nocobase/plugin-error-handler": "0.9.
|
|
16
|
-
"@nocobase/plugin-excel-formula-field": "0.9.
|
|
17
|
-
"@nocobase/plugin-export": "0.9.
|
|
18
|
-
"@nocobase/plugin-file-manager": "0.9.
|
|
19
|
-
"@nocobase/plugin-formula-field": "0.9.
|
|
20
|
-
"@nocobase/plugin-graph-collection-manager": "0.9.
|
|
21
|
-
"@nocobase/plugin-iframe-block": "0.9.
|
|
22
|
-
"@nocobase/plugin-import": "0.9.
|
|
23
|
-
"@nocobase/plugin-map": "0.9.
|
|
24
|
-
"@nocobase/plugin-math-formula-field": "0.9.
|
|
25
|
-
"@nocobase/plugin-multi-app-manager": "0.9.
|
|
26
|
-
"@nocobase/plugin-
|
|
27
|
-
"@nocobase/plugin-
|
|
28
|
-
"@nocobase/plugin-
|
|
29
|
-
"@nocobase/plugin-
|
|
30
|
-
"@nocobase/plugin-
|
|
31
|
-
"@nocobase/plugin-
|
|
32
|
-
"@nocobase/plugin-
|
|
33
|
-
"@nocobase/plugin-ui-
|
|
34
|
-
"@nocobase/plugin-
|
|
35
|
-
"@nocobase/plugin-
|
|
36
|
-
"@nocobase/plugin-
|
|
37
|
-
"@nocobase/
|
|
8
|
+
"@nocobase/plugin-acl": "0.9.2-alpha.2",
|
|
9
|
+
"@nocobase/plugin-audit-logs": "0.9.2-alpha.2",
|
|
10
|
+
"@nocobase/plugin-charts": "0.9.2-alpha.2",
|
|
11
|
+
"@nocobase/plugin-china-region": "0.9.2-alpha.2",
|
|
12
|
+
"@nocobase/plugin-client": "0.9.2-alpha.2",
|
|
13
|
+
"@nocobase/plugin-collection-manager": "0.9.2-alpha.2",
|
|
14
|
+
"@nocobase/plugin-duplicator": "0.9.2-alpha.2",
|
|
15
|
+
"@nocobase/plugin-error-handler": "0.9.2-alpha.2",
|
|
16
|
+
"@nocobase/plugin-excel-formula-field": "0.9.2-alpha.2",
|
|
17
|
+
"@nocobase/plugin-export": "0.9.2-alpha.2",
|
|
18
|
+
"@nocobase/plugin-file-manager": "0.9.2-alpha.2",
|
|
19
|
+
"@nocobase/plugin-formula-field": "0.9.2-alpha.2",
|
|
20
|
+
"@nocobase/plugin-graph-collection-manager": "0.9.2-alpha.2",
|
|
21
|
+
"@nocobase/plugin-iframe-block": "0.9.2-alpha.2",
|
|
22
|
+
"@nocobase/plugin-import": "0.9.2-alpha.2",
|
|
23
|
+
"@nocobase/plugin-map": "0.9.2-alpha.2",
|
|
24
|
+
"@nocobase/plugin-math-formula-field": "0.9.2-alpha.2",
|
|
25
|
+
"@nocobase/plugin-multi-app-manager": "0.9.2-alpha.2",
|
|
26
|
+
"@nocobase/plugin-multi-app-share-collection": "0.9.2-alpha.2",
|
|
27
|
+
"@nocobase/plugin-oidc": "0.9.2-alpha.2",
|
|
28
|
+
"@nocobase/plugin-saml": "0.9.2-alpha.2",
|
|
29
|
+
"@nocobase/plugin-sample-hello": "0.9.2-alpha.2",
|
|
30
|
+
"@nocobase/plugin-sequence-field": "0.9.2-alpha.2",
|
|
31
|
+
"@nocobase/plugin-snapshot-field": "0.9.2-alpha.2",
|
|
32
|
+
"@nocobase/plugin-system-settings": "0.9.2-alpha.2",
|
|
33
|
+
"@nocobase/plugin-ui-routes-storage": "0.9.2-alpha.2",
|
|
34
|
+
"@nocobase/plugin-ui-schema-storage": "0.9.2-alpha.2",
|
|
35
|
+
"@nocobase/plugin-users": "0.9.2-alpha.2",
|
|
36
|
+
"@nocobase/plugin-verification": "0.9.2-alpha.2",
|
|
37
|
+
"@nocobase/plugin-workflow": "0.9.2-alpha.2",
|
|
38
|
+
"@nocobase/server": "0.9.2-alpha.2"
|
|
38
39
|
},
|
|
39
40
|
"repository": {
|
|
40
41
|
"type": "git",
|
|
41
42
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
42
43
|
"directory": "packages/presets/nocobase"
|
|
43
44
|
},
|
|
44
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "1a0de6908b2b1854bdf434fcafa8909cb65bb8a3"
|
|
45
46
|
}
|
package/src/index.ts
CHANGED
|
@@ -29,6 +29,7 @@ export class PresetNocoBase extends Plugin {
|
|
|
29
29
|
localPlugins = [
|
|
30
30
|
'sample-hello',
|
|
31
31
|
'multi-app-manager',
|
|
32
|
+
'multi-app-share-collection',
|
|
32
33
|
'oidc',
|
|
33
34
|
'saml',
|
|
34
35
|
'map',
|
|
@@ -54,11 +55,13 @@ export class PresetNocoBase extends Plugin {
|
|
|
54
55
|
|
|
55
56
|
async addBuiltInPlugins(options?: any) {
|
|
56
57
|
const builtInPlugins = this.getBuiltInPlugins();
|
|
58
|
+
|
|
57
59
|
await this.app.pm.add(builtInPlugins, {
|
|
58
60
|
enabled: true,
|
|
59
61
|
builtIn: true,
|
|
60
62
|
installed: true,
|
|
61
63
|
});
|
|
64
|
+
|
|
62
65
|
const localPlugins = this.getLocalPlugins();
|
|
63
66
|
await this.app.pm.add(localPlugins, {});
|
|
64
67
|
await this.app.reload({ method: options.method });
|
|
@@ -71,23 +74,16 @@ export class PresetNocoBase extends Plugin {
|
|
|
71
74
|
}
|
|
72
75
|
const version = await this.app.version.get();
|
|
73
76
|
console.log(`The version number before upgrade is ${version}`);
|
|
74
|
-
// const result = await this.app.version.satisfies('<0.8.0-alpha.1');
|
|
75
|
-
// if (result) {
|
|
76
|
-
// const r = await this.db.collectionExistsInDb('applicationPlugins');
|
|
77
|
-
// if (r) {
|
|
78
|
-
// console.log(`Clear the installed application plugins`);
|
|
79
|
-
// await this.db.getRepository('applicationPlugins').destroy({ truncate: true });
|
|
80
|
-
// await this.app.reload({ method: options.method });
|
|
81
|
-
// }
|
|
82
|
-
// }
|
|
83
77
|
});
|
|
84
78
|
|
|
85
79
|
this.app.on('beforeUpgrade', async (options) => {
|
|
86
80
|
const result = await this.app.version.satisfies('<0.8.0-alpha.1');
|
|
81
|
+
|
|
87
82
|
if (result) {
|
|
88
83
|
console.log(`Initialize all built-in plugins beforeUpgrade`);
|
|
89
84
|
await this.addBuiltInPlugins({ method: 'upgrade' });
|
|
90
85
|
}
|
|
86
|
+
|
|
91
87
|
const builtInPlugins = this.getBuiltInPlugins();
|
|
92
88
|
const plugins = await this.app.db.getRepository('applicationPlugins').find();
|
|
93
89
|
const pluginNames = plugins.map((p) => p.name);
|
|
@@ -109,7 +105,7 @@ export class PresetNocoBase extends Plugin {
|
|
|
109
105
|
});
|
|
110
106
|
|
|
111
107
|
this.app.on('beforeInstall', async (options) => {
|
|
112
|
-
console.log(`Initialize all built-in plugins beforeInstall`);
|
|
108
|
+
console.log(`Initialize all built-in plugins beforeInstall in ${this.app.name}`);
|
|
113
109
|
await this.addBuiltInPlugins({ method: 'install' });
|
|
114
110
|
});
|
|
115
111
|
}
|