@nocobase/plugin-client 0.7.7-alpha.1 → 0.8.0-alpha.10
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/server.d.ts +0 -1
- package/lib/server.js +27 -10
- package/package.json +4 -4
package/lib/server.d.ts
CHANGED
package/lib/server.js
CHANGED
|
@@ -97,6 +97,8 @@ class ClientPlugin extends _server().Plugin {
|
|
|
97
97
|
|
|
98
98
|
_this2.app.acl.allow('app', 'getInfo');
|
|
99
99
|
|
|
100
|
+
_this2.app.acl.allow('app', 'getPlugins');
|
|
101
|
+
|
|
100
102
|
_this2.app.acl.allow('plugins', 'getPinned', 'loggedIn');
|
|
101
103
|
|
|
102
104
|
_this2.app.resource({
|
|
@@ -139,6 +141,29 @@ class ClientPlugin extends _server().Plugin {
|
|
|
139
141
|
};
|
|
140
142
|
yield next();
|
|
141
143
|
})();
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
getPlugins(ctx, next) {
|
|
147
|
+
return _asyncToGenerator(function* () {
|
|
148
|
+
const pm = ctx.db.getRepository('applicationPlugins');
|
|
149
|
+
const items = yield pm.find({
|
|
150
|
+
filter: {
|
|
151
|
+
enabled: true
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
ctx.body = items.filter(item => {
|
|
155
|
+
try {
|
|
156
|
+
const packageName = _server().PluginManager.getPackageName(item.name);
|
|
157
|
+
|
|
158
|
+
require.resolve(`${packageName}/client`);
|
|
159
|
+
|
|
160
|
+
return true;
|
|
161
|
+
} catch (error) {}
|
|
162
|
+
|
|
163
|
+
return false;
|
|
164
|
+
}).map(item => item.name);
|
|
165
|
+
yield next();
|
|
166
|
+
})();
|
|
142
167
|
}
|
|
143
168
|
|
|
144
169
|
}
|
|
@@ -151,11 +176,7 @@ class ClientPlugin extends _server().Plugin {
|
|
|
151
176
|
getPinned(ctx, next) {
|
|
152
177
|
return _asyncToGenerator(function* () {
|
|
153
178
|
ctx.body = [{
|
|
154
|
-
component: '
|
|
155
|
-
pin: true
|
|
156
|
-
}, {
|
|
157
|
-
component: 'CollectionManagerShortcut',
|
|
158
|
-
pin: true
|
|
179
|
+
component: 'CollectionManagerShortcut'
|
|
159
180
|
}, {
|
|
160
181
|
component: 'ACLShortcut'
|
|
161
182
|
}, {
|
|
@@ -181,7 +202,7 @@ class ClientPlugin extends _server().Plugin {
|
|
|
181
202
|
}
|
|
182
203
|
|
|
183
204
|
if (process.env.APP_ENV !== 'production' && root) {
|
|
184
|
-
_this2.app.middleware.unshift( /*#__PURE__*/function () {
|
|
205
|
+
_this2.app.middleware.nodes.unshift( /*#__PURE__*/function () {
|
|
185
206
|
var _ref4 = _asyncToGenerator(function* (ctx, next) {
|
|
186
207
|
if (ctx.path.startsWith(_this2.app.resourcer.options.prefix)) {
|
|
187
208
|
return next();
|
|
@@ -204,10 +225,6 @@ class ClientPlugin extends _server().Plugin {
|
|
|
204
225
|
})();
|
|
205
226
|
}
|
|
206
227
|
|
|
207
|
-
getName() {
|
|
208
|
-
return this.getPackageName(__dirname);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
228
|
}
|
|
212
229
|
|
|
213
230
|
exports.ClientPlugin = ClientPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0-alpha.10",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"licenses": [
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
}
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@nocobase/server": "0.
|
|
13
|
+
"@nocobase/server": "0.8.0-alpha.10"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@nocobase/test": "0.
|
|
16
|
+
"@nocobase/test": "0.8.0-alpha.10"
|
|
17
17
|
},
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "a9723cdeadc764eba634b5815685177679025c83"
|
|
19
19
|
}
|