@nocobase/plugin-data-visualization 2.1.0-beta.10 → 2.1.0-beta.12
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/client/d74f13d1f2300d39.js +47 -0
- package/dist/client/flow/models/ChartBlockModel.d.ts +1 -0
- package/dist/client/flow/models/ChartOptionsBuilder.d.ts +4 -0
- package/dist/client/flow/models/QueryBuilder.d.ts +1 -4
- package/dist/client/flow/resources/ChartResource.d.ts +1 -0
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +11 -10
- package/dist/node_modules/koa-compose/package.json +1 -1
- package/dist/node_modules/moment-timezone/package.json +1 -1
- package/dist/server/actions/query.js +46 -9
- package/dist/server/types.d.ts +2 -0
- package/package.json +3 -2
- package/dist/client/40e446571127c019.js +0 -47
- package/dist/client/flow/components/AntdFilterSelector.d.ts +0 -35
package/dist/externalVersion.js
CHANGED
|
@@ -8,18 +8,18 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.1.0-beta.
|
|
11
|
+
"@nocobase/client": "2.1.0-beta.12",
|
|
12
12
|
"@formily/react": "2.3.7",
|
|
13
|
-
"@nocobase/plugin-ai": "2.1.0-beta.
|
|
14
|
-
"@nocobase/flow-engine": "2.1.0-beta.
|
|
13
|
+
"@nocobase/plugin-ai": "2.1.0-beta.12",
|
|
14
|
+
"@nocobase/flow-engine": "2.1.0-beta.12",
|
|
15
15
|
"react-i18next": "11.18.6",
|
|
16
16
|
"dayjs": "1.11.13",
|
|
17
17
|
"@formily/shared": "2.3.7",
|
|
18
18
|
"lodash": "4.17.21",
|
|
19
|
-
"@nocobase/cache": "2.1.0-beta.
|
|
20
|
-
"@nocobase/server": "2.1.0-beta.
|
|
21
|
-
"@nocobase/test": "2.1.0-beta.
|
|
22
|
-
"@nocobase/utils": "2.1.0-beta.
|
|
19
|
+
"@nocobase/cache": "2.1.0-beta.12",
|
|
20
|
+
"@nocobase/server": "2.1.0-beta.12",
|
|
21
|
+
"@nocobase/test": "2.1.0-beta.12",
|
|
22
|
+
"@nocobase/utils": "2.1.0-beta.12",
|
|
23
23
|
"react": "18.2.0",
|
|
24
24
|
"@emotion/css": "11.13.0",
|
|
25
25
|
"@ant-design/icons": "5.6.1",
|
|
@@ -27,9 +27,10 @@ module.exports = {
|
|
|
27
27
|
"antd": "5.24.2",
|
|
28
28
|
"@formily/antd-v5": "1.2.3",
|
|
29
29
|
"@formily/core": "2.3.7",
|
|
30
|
-
"@nocobase/actions": "2.1.0-beta.
|
|
31
|
-
"@nocobase/database": "2.1.0-beta.
|
|
32
|
-
"@nocobase/acl": "2.1.0-beta.
|
|
30
|
+
"@nocobase/actions": "2.1.0-beta.12",
|
|
31
|
+
"@nocobase/database": "2.1.0-beta.12",
|
|
32
|
+
"@nocobase/acl": "2.1.0-beta.12",
|
|
33
|
+
"@nocobase/plugin-flow-engine": "2.1.0-beta.12",
|
|
33
34
|
"sequelize": "6.35.2",
|
|
34
35
|
"@formily/reactive": "2.3.7"
|
|
35
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"koa-compose","description":"compose Koa middleware","repository":"koajs/compose","version":"4.1.0","keywords":["koa","middleware","compose"],"files":["index.js"],"dependencies":{},"devDependencies":{"codecov":"^3.0.0","jest":"^21.0.0","matcha":"^0.7.0","standard":"^10.0.3"},"scripts":{"bench":"matcha bench/bench.js","lint":"standard --fix .","test":"jest --forceExit --coverage"},"jest":{"testEnvironment":"node"},"license":"MIT","_lastModified":"2026-
|
|
1
|
+
{"name":"koa-compose","description":"compose Koa middleware","repository":"koajs/compose","version":"4.1.0","keywords":["koa","middleware","compose"],"files":["index.js"],"dependencies":{},"devDependencies":{"codecov":"^3.0.0","jest":"^21.0.0","matcha":"^0.7.0","standard":"^10.0.3"},"scripts":{"bench":"matcha bench/bench.js","lint":"standard --fix .","test":"jest --forceExit --coverage"},"jest":{"testEnvironment":"node"},"license":"MIT","_lastModified":"2026-04-08T08:18:25.443Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"moment-timezone","version":"0.5.43","description":"Parse and display moments in any timezone.","homepage":"http://momentjs.com/timezone/","author":"Tim Wood <washwithcare@gmail.com> (http://timwoodcreates.com/)","keywords":["moment","date","time","timezone","olson","iana","zone","tz"],"main":"./index.js","typings":"./index.d.ts","engines":{"node":"*"},"repository":{"type":"git","url":"https://github.com/moment/moment-timezone.git"},"bugs":{"url":"https://github.com/moment/moment-timezone/issues"},"license":"MIT","dependencies":{"moment":"^2.29.4"},"devDependencies":{"grunt":"^1.5.3","grunt-contrib-clean":"^2.0.1","grunt-contrib-jshint":"^3.2.0","grunt-contrib-nodeunit":"^4.0.0","grunt-contrib-uglify":"^5.2.2","grunt-exec":"^3.0.0","typescript":"^3.5.1"},"jspm":{"main":"builds/moment-timezone-with-data","shim":{"moment-timezone":{"deps":["moment"]}}},"scripts":{"test":"grunt"},"_lastModified":"2026-
|
|
1
|
+
{"name":"moment-timezone","version":"0.5.43","description":"Parse and display moments in any timezone.","homepage":"http://momentjs.com/timezone/","author":"Tim Wood <washwithcare@gmail.com> (http://timwoodcreates.com/)","keywords":["moment","date","time","timezone","olson","iana","zone","tz"],"main":"./index.js","typings":"./index.d.ts","engines":{"node":"*"},"repository":{"type":"git","url":"https://github.com/moment/moment-timezone.git"},"bugs":{"url":"https://github.com/moment/moment-timezone/issues"},"license":"MIT","dependencies":{"moment":"^2.29.4"},"devDependencies":{"grunt":"^1.5.3","grunt-contrib-clean":"^2.0.1","grunt-contrib-jshint":"^3.2.0","grunt-contrib-nodeunit":"^4.0.0","grunt-contrib-uglify":"^5.2.2","grunt-exec":"^3.0.0","typescript":"^3.5.1"},"jspm":{"main":"builds/moment-timezone-with-data","shim":{"moment-timezone":{"deps":["moment"]}}},"scripts":{"test":"grunt"},"_lastModified":"2026-04-08T08:18:26.013Z"}
|
|
@@ -51,10 +51,42 @@ var import_server = require("@nocobase/server");
|
|
|
51
51
|
var import_query_parser = require("../query-parser");
|
|
52
52
|
var import_utils = require("@nocobase/utils");
|
|
53
53
|
var import_acl = require("@nocobase/acl");
|
|
54
|
+
var import_plugin_flow_engine = require("@nocobase/plugin-flow-engine");
|
|
54
55
|
const getDB = (ctx, dataSource) => {
|
|
55
56
|
const ds = ctx.app.dataSourceManager.dataSources.get(dataSource);
|
|
56
57
|
return ds == null ? void 0 : ds.collectionManager.db;
|
|
57
58
|
};
|
|
59
|
+
const getChartQueryPermission = async (ctx, collection, acl) => {
|
|
60
|
+
var _a;
|
|
61
|
+
const actionCtx = {
|
|
62
|
+
app: ctx.app,
|
|
63
|
+
db: ctx.db,
|
|
64
|
+
database: ctx.database ?? ctx.db,
|
|
65
|
+
getCurrentRepository: ctx.getCurrentRepository,
|
|
66
|
+
request: ctx.request,
|
|
67
|
+
req: ctx.req,
|
|
68
|
+
action: {
|
|
69
|
+
actionName: "list",
|
|
70
|
+
name: "list",
|
|
71
|
+
params: {},
|
|
72
|
+
resourceName: collection,
|
|
73
|
+
mergeParams() {
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
state: {
|
|
77
|
+
...ctx.state,
|
|
78
|
+
currentRole: ctx.state.currentRole,
|
|
79
|
+
currentRoles: ctx.state.currentRoles,
|
|
80
|
+
currentUser: ((_a = ctx.state.currentUser) == null ? void 0 : _a.toJSON) ? ctx.state.currentUser.toJSON() : ctx.state.currentUser
|
|
81
|
+
},
|
|
82
|
+
permission: {},
|
|
83
|
+
throw(...args) {
|
|
84
|
+
ctx.throw(...args);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
await acl.getActionParams(actionCtx);
|
|
88
|
+
return actionCtx.permission;
|
|
89
|
+
};
|
|
58
90
|
const postProcess = async (ctx, next) => {
|
|
59
91
|
const { data, fieldMap } = ctx.action.params.values;
|
|
60
92
|
ctx.body = data.map((record) => {
|
|
@@ -196,6 +228,14 @@ const parseFieldAndAssociations = async (ctx, next) => {
|
|
|
196
228
|
await next();
|
|
197
229
|
};
|
|
198
230
|
const parseVariables = async (ctx, next) => {
|
|
231
|
+
const { mode, contextParams, ...values } = ctx.action.params.values;
|
|
232
|
+
if (mode !== "sql") {
|
|
233
|
+
const resolvedValues = await (0, import_plugin_flow_engine.resolveVariablesTemplate)(ctx, values, contextParams || {});
|
|
234
|
+
ctx.action.params.values = {
|
|
235
|
+
...ctx.action.params.values,
|
|
236
|
+
...resolvedValues
|
|
237
|
+
};
|
|
238
|
+
}
|
|
199
239
|
const { filter } = ctx.action.params.values;
|
|
200
240
|
ctx.action.params.filter = filter;
|
|
201
241
|
await import_server.middlewares.parseVariables(ctx, async () => {
|
|
@@ -220,17 +260,14 @@ const cacheMiddleware = async (ctx, next) => {
|
|
|
220
260
|
}
|
|
221
261
|
};
|
|
222
262
|
const checkPermission = async (ctx, next) => {
|
|
223
|
-
var _a, _b
|
|
263
|
+
var _a, _b;
|
|
224
264
|
const { collection, dataSource } = ctx.action.params.values;
|
|
225
|
-
const roleNames = ctx.state.currentRoles || ["anonymous"];
|
|
226
265
|
const acl = ((_a = ctx.app.dataSourceManager.get(dataSource)) == null ? void 0 : _a.acl) || ctx.app.acl;
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
if ((_b = can == null ? void 0 : can.params) == null ? void 0 : _b.filter) {
|
|
266
|
+
const permission = await getChartQueryPermission(ctx, collection, acl);
|
|
267
|
+
const filterParams = (_b = permission == null ? void 0 : permission.parsedParams) == null ? void 0 : _b.filter;
|
|
268
|
+
if (filterParams) {
|
|
232
269
|
try {
|
|
233
|
-
(0, import_acl.checkFilterParams)(ctx.database.getCollection(collection),
|
|
270
|
+
(0, import_acl.checkFilterParams)(ctx.database.getCollection(collection), filterParams);
|
|
234
271
|
} catch (e) {
|
|
235
272
|
if (e instanceof import_acl.NoPermissionError) {
|
|
236
273
|
ctx.throw(403, "No permissions");
|
|
@@ -239,7 +276,7 @@ const checkPermission = async (ctx, next) => {
|
|
|
239
276
|
const filter = ctx.action.params.values.filter || {};
|
|
240
277
|
ctx.action.params.values = {
|
|
241
278
|
...ctx.action.params.values,
|
|
242
|
-
filter: (0, import_utils.assign)(filter,
|
|
279
|
+
filter: (0, import_utils.assign)(filter, filterParams, {
|
|
243
280
|
filter: "andMerge"
|
|
244
281
|
})
|
|
245
282
|
};
|
package/dist/server/types.d.ts
CHANGED
|
@@ -28,12 +28,14 @@ export type OrderProps = {
|
|
|
28
28
|
};
|
|
29
29
|
export type QueryParams = Partial<{
|
|
30
30
|
uid: string;
|
|
31
|
+
mode: 'builder' | 'sql';
|
|
31
32
|
dataSource: string;
|
|
32
33
|
collection: string;
|
|
33
34
|
measures: MeasureProps[];
|
|
34
35
|
dimensions: DimensionProps[];
|
|
35
36
|
orders: OrderProps[];
|
|
36
37
|
filter: any;
|
|
38
|
+
contextParams: Record<string, unknown>;
|
|
37
39
|
limit: number;
|
|
38
40
|
offset: number;
|
|
39
41
|
sql: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-data-visualization",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.12",
|
|
4
4
|
"displayName": "Data visualization",
|
|
5
5
|
"displayName.ru-RU": "Визуализация данных",
|
|
6
6
|
"displayName.zh-CN": "数据可视化",
|
|
@@ -42,11 +42,12 @@
|
|
|
42
42
|
"@nocobase/database": "2.x",
|
|
43
43
|
"@nocobase/plugin-ai": "2.x",
|
|
44
44
|
"@nocobase/plugin-data-source-main": "2.x",
|
|
45
|
+
"@nocobase/plugin-flow-engine": "2.x",
|
|
45
46
|
"@nocobase/server": "2.x",
|
|
46
47
|
"@nocobase/test": "2.x",
|
|
47
48
|
"@nocobase/utils": "2.x"
|
|
48
49
|
},
|
|
49
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "25cee9643f42f850afc4adc33c55a56850ac730d",
|
|
50
51
|
"keywords": [
|
|
51
52
|
"Blocks"
|
|
52
53
|
],
|