@nocobase/plugin-data-visualization 2.1.0-alpha.13 → 2.1.0-alpha.14
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/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 +12 -11
- package/dist/node_modules/koa-compose/package.json +1 -1
- package/dist/server/actions/query.d.ts +2 -4
- package/dist/server/actions/query.js +47 -210
- package/dist/server/plugin.js +2 -2
- package/dist/server/types.d.ts +3 -0
- package/package.json +4 -2
- package/dist/client/flow/components/AntdFilterSelector.d.ts +0 -35
- package/dist/node_modules/moment-timezone/LICENSE +0 -20
- package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-10-year-range.js +0 -1548
- package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-10-year-range.min.js +0 -1
- package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-1970-2030.js +0 -1548
- package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-1970-2030.min.js +0 -1
- package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-2012-2022.js +0 -1560
- package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-2012-2022.min.js +0 -1
- package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data.js +0 -1548
- package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data.min.js +0 -1
- package/dist/node_modules/moment-timezone/builds/moment-timezone.min.js +0 -1
- package/dist/node_modules/moment-timezone/composer.json +0 -43
- package/dist/node_modules/moment-timezone/data/meta/latest.json +0 -5889
- package/dist/node_modules/moment-timezone/data/packed/latest.json +0 -852
- package/dist/node_modules/moment-timezone/index.d.ts +0 -78
- package/dist/node_modules/moment-timezone/index.js +0 -15
- package/dist/node_modules/moment-timezone/moment-timezone-utils.d.ts +0 -70
- package/dist/node_modules/moment-timezone/moment-timezone-utils.js +0 -339
- package/dist/node_modules/moment-timezone/moment-timezone.js +0 -696
- package/dist/node_modules/moment-timezone/package.json +0 -1
- package/dist/server/formatter/formatter.d.ts +0 -27
- package/dist/server/formatter/formatter.js +0 -85
- package/dist/server/formatter/mysql-formatter.d.ts +0 -14
- package/dist/server/formatter/mysql-formatter.js +0 -93
- package/dist/server/formatter/oracle-formatter.d.ts +0 -14
- package/dist/server/formatter/oracle-formatter.js +0 -74
- package/dist/server/formatter/postgres-formatter.d.ts +0 -14
- package/dist/server/formatter/postgres-formatter.js +0 -74
- package/dist/server/formatter/sqlite-formatter.d.ts +0 -15
- package/dist/server/formatter/sqlite-formatter.js +0 -83
- package/dist/server/query-parser/index.d.ts +0 -11
- package/dist/server/query-parser/index.js +0 -56
- package/dist/server/query-parser/mysql-query-parser.d.ts +0 -15
- package/dist/server/query-parser/mysql-query-parser.js +0 -43
- package/dist/server/query-parser/oracle-query-parser.d.ts +0 -18
- package/dist/server/query-parser/oracle-query-parser.js +0 -60
- package/dist/server/query-parser/postgres-query-parser.d.ts +0 -15
- package/dist/server/query-parser/postgres-query-parser.js +0 -43
- package/dist/server/query-parser/query-parser.d.ts +0 -31
- package/dist/server/query-parser/query-parser.js +0 -146
- package/dist/server/query-parser/sqlite-query-parser.d.ts +0 -15
- package/dist/server/query-parser/sqlite-query-parser.js +0 -43
package/dist/externalVersion.js
CHANGED
|
@@ -8,18 +8,18 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.1.0-alpha.
|
|
11
|
+
"@nocobase/client": "2.1.0-alpha.14",
|
|
12
12
|
"@formily/react": "2.3.7",
|
|
13
|
-
"@nocobase/plugin-ai": "2.1.0-alpha.
|
|
14
|
-
"@nocobase/flow-engine": "2.1.0-alpha.
|
|
13
|
+
"@nocobase/plugin-ai": "2.1.0-alpha.14",
|
|
14
|
+
"@nocobase/flow-engine": "2.1.0-alpha.14",
|
|
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-alpha.
|
|
20
|
-
"@nocobase/server": "2.1.0-alpha.
|
|
21
|
-
"@nocobase/test": "2.1.0-alpha.
|
|
22
|
-
"@nocobase/utils": "2.1.0-alpha.
|
|
19
|
+
"@nocobase/cache": "2.1.0-alpha.14",
|
|
20
|
+
"@nocobase/server": "2.1.0-alpha.14",
|
|
21
|
+
"@nocobase/test": "2.1.0-alpha.14",
|
|
22
|
+
"@nocobase/utils": "2.1.0-alpha.14",
|
|
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-alpha.
|
|
31
|
-
"@nocobase/
|
|
32
|
-
"@nocobase/acl": "2.1.0-alpha.
|
|
33
|
-
"
|
|
30
|
+
"@nocobase/actions": "2.1.0-alpha.14",
|
|
31
|
+
"@nocobase/acl": "2.1.0-alpha.14",
|
|
32
|
+
"@nocobase/plugin-acl": "2.1.0-alpha.14",
|
|
33
|
+
"@nocobase/plugin-flow-engine": "2.1.0-alpha.14",
|
|
34
|
+
"@nocobase/database": "2.1.0-alpha.14",
|
|
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-07T15:55:45.644Z"}
|
|
@@ -7,10 +7,8 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import { Context, Next } from '@nocobase/actions';
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const checkPermission: (ctx: Context, next: Next) => Promise<void>;
|
|
11
11
|
export declare const queryData: (ctx: Context, next: Next) => Promise<void>;
|
|
12
|
-
export declare const parseFieldAndAssociations: (ctx: Context, next: Next) => Promise<void>;
|
|
13
12
|
export declare const parseVariables: (ctx: Context, next: Next) => Promise<void>;
|
|
14
13
|
export declare const cacheMiddleware: (ctx: Context, next: Next) => Promise<void>;
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const query: (ctx: Context, next: Next) => Promise<void>;
|
|
14
|
+
export declare const queryDataAction: (ctx: Context, next: Next) => Promise<void>;
|
|
@@ -38,195 +38,69 @@ var query_exports = {};
|
|
|
38
38
|
__export(query_exports, {
|
|
39
39
|
cacheMiddleware: () => cacheMiddleware,
|
|
40
40
|
checkPermission: () => checkPermission,
|
|
41
|
-
parseFieldAndAssociations: () => parseFieldAndAssociations,
|
|
42
41
|
parseVariables: () => parseVariables,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
queryData: () => queryData
|
|
42
|
+
queryData: () => queryData,
|
|
43
|
+
queryDataAction: () => queryDataAction
|
|
46
44
|
});
|
|
47
45
|
module.exports = __toCommonJS(query_exports);
|
|
48
|
-
var import_database = require("@nocobase/database");
|
|
49
46
|
var import_koa_compose = __toESM(require("koa-compose"));
|
|
50
|
-
var import_server = require("@nocobase/server");
|
|
51
|
-
var import_query_parser = require("../query-parser");
|
|
52
|
-
var import_utils = require("@nocobase/utils");
|
|
53
47
|
var import_acl = require("@nocobase/acl");
|
|
48
|
+
var import_plugin_acl = require("@nocobase/plugin-acl");
|
|
49
|
+
var import_server = require("@nocobase/server");
|
|
50
|
+
var import_plugin_flow_engine = require("@nocobase/plugin-flow-engine");
|
|
54
51
|
const getDB = (ctx, dataSource) => {
|
|
55
52
|
const ds = ctx.app.dataSourceManager.dataSources.get(dataSource);
|
|
56
53
|
return ds == null ? void 0 : ds.collectionManager.db;
|
|
57
54
|
};
|
|
58
|
-
const
|
|
59
|
-
var _a;
|
|
60
|
-
|
|
61
|
-
app: ctx.app,
|
|
62
|
-
db: ctx.db,
|
|
63
|
-
database: ctx.database ?? ctx.db,
|
|
64
|
-
getCurrentRepository: ctx.getCurrentRepository,
|
|
65
|
-
request: ctx.request,
|
|
66
|
-
req: ctx.req,
|
|
67
|
-
action: {
|
|
68
|
-
actionName: "list",
|
|
69
|
-
name: "list",
|
|
70
|
-
params: {},
|
|
71
|
-
resourceName: collection,
|
|
72
|
-
mergeParams() {
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
state: {
|
|
76
|
-
...ctx.state,
|
|
77
|
-
currentRole: ctx.state.currentRole,
|
|
78
|
-
currentRoles: ctx.state.currentRoles,
|
|
79
|
-
currentUser: ((_a = ctx.state.currentUser) == null ? void 0 : _a.toJSON) ? ctx.state.currentUser.toJSON() : ctx.state.currentUser
|
|
80
|
-
},
|
|
81
|
-
permission: {},
|
|
82
|
-
throw(...args) {
|
|
83
|
-
ctx.throw(...args);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
await acl.getActionParams(actionCtx);
|
|
87
|
-
return actionCtx.permission;
|
|
55
|
+
const getTimezone = (ctx) => {
|
|
56
|
+
var _a, _b, _c, _d, _e, _f;
|
|
57
|
+
return ((_b = (_a = ctx == null ? void 0 : ctx.request) == null ? void 0 : _a.get) == null ? void 0 : _b.call(_a, "x-timezone")) ?? ((_d = (_c = ctx == null ? void 0 : ctx.request) == null ? void 0 : _c.header) == null ? void 0 : _d["x-timezone"]) ?? ((_f = (_e = ctx == null ? void 0 : ctx.req) == null ? void 0 : _e.headers) == null ? void 0 : _f["x-timezone"]);
|
|
88
58
|
};
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
59
|
+
const checkPermission = async (ctx, next) => {
|
|
60
|
+
var _a, _b, _c, _d;
|
|
61
|
+
const values = ctx.action.params.values || {};
|
|
62
|
+
const acl = ((_a = ctx.app.dataSourceManager.get(values.dataSource)) == null ? void 0 : _a.acl) || ctx.app.acl;
|
|
63
|
+
try {
|
|
64
|
+
const result = await (0, import_plugin_acl.applyQueryPermission)({
|
|
65
|
+
acl,
|
|
66
|
+
db: getDB(ctx, values.dataSource) || ctx.db,
|
|
67
|
+
resourceName: values.collection,
|
|
68
|
+
query: values,
|
|
69
|
+
currentUser: (_b = ctx.state) == null ? void 0 : _b.currentUser,
|
|
70
|
+
currentRole: (_c = ctx.state) == null ? void 0 : _c.currentRole,
|
|
71
|
+
currentRoles: (_d = ctx.state) == null ? void 0 : _d.currentRoles,
|
|
72
|
+
timezone: getTimezone(ctx),
|
|
73
|
+
state: ctx.state
|
|
106
74
|
});
|
|
107
|
-
|
|
108
|
-
})
|
|
75
|
+
ctx.action.params.values = result.query;
|
|
76
|
+
} catch (err) {
|
|
77
|
+
if (!(err instanceof import_acl.NoPermissionError)) {
|
|
78
|
+
throw err;
|
|
79
|
+
}
|
|
80
|
+
ctx.throw(403, "No permissions");
|
|
81
|
+
}
|
|
109
82
|
await next();
|
|
110
83
|
};
|
|
111
84
|
const queryData = async (ctx, next) => {
|
|
112
|
-
const { dataSource, collection, queryParams, fieldMap } = ctx.action.params.values;
|
|
113
|
-
const db = getDB(ctx, dataSource) || ctx.db;
|
|
114
|
-
const model = db.getModel(collection);
|
|
115
|
-
const data = await model.findAll(queryParams);
|
|
116
|
-
ctx.action.params.values = {
|
|
117
|
-
data,
|
|
118
|
-
fieldMap
|
|
119
|
-
};
|
|
120
|
-
await next();
|
|
121
|
-
};
|
|
122
|
-
const parseFieldAndAssociations = async (ctx, next) => {
|
|
123
85
|
var _a;
|
|
124
|
-
const {
|
|
125
|
-
dataSource,
|
|
126
|
-
collection: collectionName,
|
|
127
|
-
measures,
|
|
128
|
-
dimensions,
|
|
129
|
-
orders,
|
|
130
|
-
filter
|
|
131
|
-
} = ctx.action.params.values;
|
|
86
|
+
const { dataSource, collection, ...queryOptions } = ctx.action.params.values;
|
|
132
87
|
const db = getDB(ctx, dataSource) || ctx.db;
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const parseField = (selected) => {
|
|
138
|
-
var _a2, _b, _c, _d, _e, _f;
|
|
139
|
-
let target;
|
|
140
|
-
let name;
|
|
141
|
-
if (!Array.isArray(selected.field)) {
|
|
142
|
-
name = selected.field;
|
|
143
|
-
} else if (selected.field.length === 1) {
|
|
144
|
-
name = selected.field[0];
|
|
145
|
-
} else if (selected.field.length > 1) {
|
|
146
|
-
[target, name] = selected.field;
|
|
147
|
-
}
|
|
148
|
-
const rawAttributes = collection.model.getAttributes();
|
|
149
|
-
let field = ((_a2 = rawAttributes[name]) == null ? void 0 : _a2.field) || name;
|
|
150
|
-
let fieldType = (_b = fields.get(name)) == null ? void 0 : _b.type;
|
|
151
|
-
let fieldOptions = (_c = fields.get(name)) == null ? void 0 : _c.options;
|
|
152
|
-
if (target) {
|
|
153
|
-
const targetField = fields.get(target);
|
|
154
|
-
const targetCollection = db.getCollection(targetField.target);
|
|
155
|
-
const targetFields = targetCollection.fields;
|
|
156
|
-
fieldType = (_d = targetFields.get(name)) == null ? void 0 : _d.type;
|
|
157
|
-
fieldOptions = (_e = targetFields.get(name)) == null ? void 0 : _e.options;
|
|
158
|
-
field = `${target}.${field}`;
|
|
159
|
-
name = `${target}.${name}`;
|
|
160
|
-
const targetType = (_f = fields.get(target)) == null ? void 0 : _f.type;
|
|
161
|
-
if (!models[target]) {
|
|
162
|
-
models[target] = { type: targetType };
|
|
163
|
-
}
|
|
164
|
-
} else {
|
|
165
|
-
field = `${collectionName}.${field}`;
|
|
166
|
-
}
|
|
167
|
-
return {
|
|
168
|
-
...selected,
|
|
169
|
-
field,
|
|
170
|
-
name,
|
|
171
|
-
type: fieldType,
|
|
172
|
-
options: fieldOptions,
|
|
173
|
-
alias: selected.alias || name
|
|
174
|
-
};
|
|
175
|
-
};
|
|
176
|
-
const parsedMeasures = (measures == null ? void 0 : measures.map(parseField)) || [];
|
|
177
|
-
const parsedDimensions = (dimensions == null ? void 0 : dimensions.map(parseField)) || [];
|
|
178
|
-
const parsedOrders = (orders == null ? void 0 : orders.map(parseField)) || [];
|
|
179
|
-
const include = Object.entries(models).map(([target, { type }]) => {
|
|
180
|
-
let options = {
|
|
181
|
-
association: target,
|
|
182
|
-
attributes: []
|
|
183
|
-
};
|
|
184
|
-
if (type === "belongsToMany") {
|
|
185
|
-
options["through"] = { attributes: [] };
|
|
186
|
-
}
|
|
187
|
-
if (type === "belongsToArray") {
|
|
188
|
-
const association = associations[target];
|
|
189
|
-
if (association) {
|
|
190
|
-
options = {
|
|
191
|
-
...options,
|
|
192
|
-
...association.generateInclude()
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return options;
|
|
197
|
-
});
|
|
198
|
-
const filterParser = new import_database.FilterParser(filter, {
|
|
199
|
-
collection
|
|
88
|
+
const repository = db.getRepository(collection);
|
|
89
|
+
ctx.body = await repository.query({
|
|
90
|
+
...queryOptions,
|
|
91
|
+
timezone: (_a = ctx.get) == null ? void 0 : _a.call(ctx, "x-timezone")
|
|
200
92
|
});
|
|
201
|
-
const { where, include: filterInclude } = filterParser.toSequelizeParams();
|
|
202
|
-
if (filterInclude) {
|
|
203
|
-
const stack = [...filterInclude];
|
|
204
|
-
while (stack.length) {
|
|
205
|
-
const item = stack.pop();
|
|
206
|
-
const parentCollection = db.getCollection(item.parentCollection || collectionName);
|
|
207
|
-
const field = parentCollection.fields.get(item.association);
|
|
208
|
-
if ((field == null ? void 0 : field.type) === "belongsToMany") {
|
|
209
|
-
item.through = { attributes: [] };
|
|
210
|
-
}
|
|
211
|
-
if ((field == null ? void 0 : field.target) && ((_a = item.include) == null ? void 0 : _a.length)) {
|
|
212
|
-
for (const child of item.include) {
|
|
213
|
-
child.parentCollection = field.target;
|
|
214
|
-
stack.push(child);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
ctx.action.params.values = {
|
|
220
|
-
...ctx.action.params.values,
|
|
221
|
-
where,
|
|
222
|
-
measures: parsedMeasures,
|
|
223
|
-
dimensions: parsedDimensions,
|
|
224
|
-
orders: parsedOrders,
|
|
225
|
-
include: [...include, ...filterInclude || []]
|
|
226
|
-
};
|
|
227
93
|
await next();
|
|
228
94
|
};
|
|
229
95
|
const parseVariables = async (ctx, next) => {
|
|
96
|
+
const { mode, contextParams, ...values } = ctx.action.params.values;
|
|
97
|
+
if (mode !== "sql") {
|
|
98
|
+
const resolvedValues = await (0, import_plugin_flow_engine.resolveVariablesTemplate)(ctx, values, contextParams || {});
|
|
99
|
+
ctx.action.params.values = {
|
|
100
|
+
...ctx.action.params.values,
|
|
101
|
+
...resolvedValues
|
|
102
|
+
};
|
|
103
|
+
}
|
|
230
104
|
const { filter } = ctx.action.params.values;
|
|
231
105
|
ctx.action.params.filter = filter;
|
|
232
106
|
await import_server.middlewares.parseVariables(ctx, async () => {
|
|
@@ -250,44 +124,9 @@ const cacheMiddleware = async (ctx, next) => {
|
|
|
250
124
|
await cache.set(uid, ctx.body, (cacheConfig == null ? void 0 : cacheConfig.ttl) * 1e3);
|
|
251
125
|
}
|
|
252
126
|
};
|
|
253
|
-
const
|
|
254
|
-
var _a, _b;
|
|
255
|
-
const { collection, dataSource } = ctx.action.params.values;
|
|
256
|
-
const acl = ((_a = ctx.app.dataSourceManager.get(dataSource)) == null ? void 0 : _a.acl) || ctx.app.acl;
|
|
257
|
-
const permission = await getChartQueryPermission(ctx, collection, acl);
|
|
258
|
-
const filterParams = (_b = permission == null ? void 0 : permission.parsedParams) == null ? void 0 : _b.filter;
|
|
259
|
-
if (filterParams) {
|
|
260
|
-
try {
|
|
261
|
-
(0, import_acl.checkFilterParams)(ctx.database.getCollection(collection), filterParams);
|
|
262
|
-
} catch (e) {
|
|
263
|
-
if (e instanceof import_acl.NoPermissionError) {
|
|
264
|
-
ctx.throw(403, "No permissions");
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
const filter = ctx.action.params.values.filter || {};
|
|
268
|
-
ctx.action.params.values = {
|
|
269
|
-
...ctx.action.params.values,
|
|
270
|
-
filter: (0, import_utils.assign)(filter, filterParams, {
|
|
271
|
-
filter: "andMerge"
|
|
272
|
-
})
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
return next();
|
|
276
|
-
};
|
|
277
|
-
const query = async (ctx, next) => {
|
|
278
|
-
const { dataSource } = ctx.action.params.values;
|
|
279
|
-
const db = getDB(ctx, dataSource) || ctx.db;
|
|
280
|
-
const queryParser = (0, import_query_parser.createQueryParser)(db);
|
|
127
|
+
const queryDataAction = async (ctx, next) => {
|
|
281
128
|
try {
|
|
282
|
-
await (0, import_koa_compose.default)([
|
|
283
|
-
checkPermission,
|
|
284
|
-
cacheMiddleware,
|
|
285
|
-
parseVariables,
|
|
286
|
-
parseFieldAndAssociations,
|
|
287
|
-
queryParser.parse(),
|
|
288
|
-
queryData,
|
|
289
|
-
postProcess
|
|
290
|
-
])(ctx, next);
|
|
129
|
+
await (0, import_koa_compose.default)([checkPermission, cacheMiddleware, parseVariables, queryData])(ctx, next);
|
|
291
130
|
} catch (err) {
|
|
292
131
|
ctx.throw(500, err);
|
|
293
132
|
}
|
|
@@ -296,9 +135,7 @@ const query = async (ctx, next) => {
|
|
|
296
135
|
0 && (module.exports = {
|
|
297
136
|
cacheMiddleware,
|
|
298
137
|
checkPermission,
|
|
299
|
-
parseFieldAndAssociations,
|
|
300
138
|
parseVariables,
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
queryData
|
|
139
|
+
queryData,
|
|
140
|
+
queryDataAction
|
|
304
141
|
});
|
package/dist/server/plugin.js
CHANGED
|
@@ -40,10 +40,10 @@ class PluginDataVisualizationServer extends import_server.Plugin {
|
|
|
40
40
|
this.app.resourceManager.define({
|
|
41
41
|
name: "charts",
|
|
42
42
|
actions: {
|
|
43
|
-
|
|
43
|
+
queryData: import_query.queryDataAction
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
|
-
this.app.acl.allow("charts", "
|
|
46
|
+
this.app.acl.allow("charts", "queryData", "loggedIn");
|
|
47
47
|
}
|
|
48
48
|
async load() {
|
|
49
49
|
this.cache = await this.app.cacheManager.createCache({
|
package/dist/server/types.d.ts
CHANGED
|
@@ -28,12 +28,15 @@ 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
|
+
having: any;
|
|
39
|
+
contextParams: Record<string, unknown>;
|
|
37
40
|
limit: number;
|
|
38
41
|
offset: number;
|
|
39
42
|
sql: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-data-visualization",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.14",
|
|
4
4
|
"displayName": "Data visualization",
|
|
5
5
|
"displayName.ru-RU": "Визуализация данных",
|
|
6
6
|
"displayName.zh-CN": "数据可视化",
|
|
@@ -40,13 +40,15 @@
|
|
|
40
40
|
"@nocobase/cache": "2.x",
|
|
41
41
|
"@nocobase/client": "2.x",
|
|
42
42
|
"@nocobase/database": "2.x",
|
|
43
|
+
"@nocobase/plugin-acl": "2.x",
|
|
43
44
|
"@nocobase/plugin-ai": "2.x",
|
|
44
45
|
"@nocobase/plugin-data-source-main": "2.x",
|
|
46
|
+
"@nocobase/plugin-flow-engine": "2.x",
|
|
45
47
|
"@nocobase/server": "2.x",
|
|
46
48
|
"@nocobase/test": "2.x",
|
|
47
49
|
"@nocobase/utils": "2.x"
|
|
48
50
|
},
|
|
49
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "d8735b541de0ff9557bba704de49c799b4962672",
|
|
50
52
|
"keywords": [
|
|
51
53
|
"Blocks"
|
|
52
54
|
],
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import type { CSSProperties } from 'react';
|
|
11
|
-
import type { VariableFilterItemValue } from '@nocobase/client';
|
|
12
|
-
import type { FlowModel } from '@nocobase/flow-engine';
|
|
13
|
-
type LogicOp = '$and' | '$or';
|
|
14
|
-
export type FilterCondition = VariableFilterItemValue;
|
|
15
|
-
export type FilterGroupValue = {
|
|
16
|
-
logic: LogicOp;
|
|
17
|
-
items: Array<FilterCondition | FilterGroupValue>;
|
|
18
|
-
};
|
|
19
|
-
export interface AntdFilterSelectorProps {
|
|
20
|
-
value?: FilterGroupValue;
|
|
21
|
-
onChange?: (next: FilterGroupValue) => void;
|
|
22
|
-
model: FlowModel;
|
|
23
|
-
rightAsVariable?: boolean;
|
|
24
|
-
collectionPath?: string[];
|
|
25
|
-
className?: string;
|
|
26
|
-
style?: CSSProperties;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* AntdFilterSelector
|
|
30
|
-
* - antd Form.Item 子组件
|
|
31
|
-
* - 内部用响应式对象驱动 FilterGroup/VariableFilterItem
|
|
32
|
-
* - reaction 桥接所有深层变更为 antd 的 onChange
|
|
33
|
-
*/
|
|
34
|
-
export declare const AntdFilterSelector: React.FC<AntdFilterSelectorProps>;
|
|
35
|
-
export default AntdFilterSelector;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) JS Foundation and other contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
-
the Software without restriction, including without limitation the rights to
|
|
8
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
-
subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|