@nocobase/plugin-data-visualization 2.1.0-beta.15 → 2.1.0-beta.16
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/102.ae672a174b9de2c5.js +47 -0
- package/dist/client/176.0b68fc9582cfe5a3.js +10 -0
- package/dist/client/214.6dda3ffed1dca904.js +10 -0
- package/dist/client/680.55c8681f2ccb5c51.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +12 -12
- package/dist/node_modules/koa-compose/index.js +1 -1
- 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 +38 -210
- package/dist/server/plugin.js +2 -2
- package/dist/server/types.d.ts +1 -0
- package/package.json +3 -2
- package/dist/client/453.b679367b7bb897b6.js +0 -10
- package/dist/client/754.d08ce02d24408fc0.js +0 -10
- package/dist/client/950.2f7edb365698561a.js +0 -47
- package/dist/client/969.7fbbb4fa78123d3a.js +0 -10
- 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 -91
- 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 -148
- 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-beta.
|
|
11
|
+
"@nocobase/client": "2.1.0-beta.16",
|
|
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.16",
|
|
14
|
+
"@nocobase/flow-engine": "2.1.0-beta.16",
|
|
15
15
|
"react-i18next": "11.18.6",
|
|
16
16
|
"dayjs": "1.11.13",
|
|
17
17
|
"@formily/shared": "2.3.7",
|
|
18
18
|
"lodash": "4.18.1",
|
|
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.16",
|
|
20
|
+
"@nocobase/server": "2.1.0-beta.16",
|
|
21
|
+
"@nocobase/test": "2.1.0-beta.16",
|
|
22
|
+
"@nocobase/utils": "2.1.0-beta.16",
|
|
23
23
|
"react": "18.2.0",
|
|
24
24
|
"@emotion/css": "11.13.0",
|
|
25
25
|
"@ant-design/icons": "5.6.1",
|
|
@@ -27,10 +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/
|
|
32
|
-
"@nocobase/acl": "2.1.0-beta.
|
|
33
|
-
"@nocobase/plugin-flow-engine": "2.1.0-beta.
|
|
34
|
-
"
|
|
30
|
+
"@nocobase/actions": "2.1.0-beta.16",
|
|
31
|
+
"@nocobase/acl": "2.1.0-beta.16",
|
|
32
|
+
"@nocobase/plugin-acl": "2.1.0-beta.16",
|
|
33
|
+
"@nocobase/plugin-flow-engine": "2.1.0-beta.16",
|
|
34
|
+
"@nocobase/database": "2.1.0-beta.16",
|
|
35
35
|
"@formily/reactive": "2.3.7"
|
|
36
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(
|
|
1
|
+
(()=>{"use strict";var e={979:e=>{e.exports=compose;function compose(e){if(!Array.isArray(e))throw new TypeError("Middleware stack must be an array!");for(const r of e){if(typeof r!=="function")throw new TypeError("Middleware must be composed of functions!")}return function(r,t){let i=-1;return dispatch(0);function dispatch(o){if(o<=i)return Promise.reject(new Error("next() called multiple times"));i=o;let n=e[o];if(o===e.length)n=t;if(!n)return Promise.resolve();try{return Promise.resolve(n(r,dispatch.bind(null,o+1)))}catch(e){return Promise.reject(e)}}}}}};var r={};function __nccwpck_require__(t){var i=r[t];if(i!==undefined){return i.exports}var o=r[t]={exports:{}};var n=true;try{e[t](o,o.exports,__nccwpck_require__);n=false}finally{if(n)delete r[t]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t=__nccwpck_require__(979);module.exports=t})();
|
|
@@ -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-04-
|
|
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-24T10:37:12.884Z"}
|
|
@@ -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,193 +38,58 @@ 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");
|
|
54
50
|
var import_plugin_flow_engine = require("@nocobase/plugin-flow-engine");
|
|
55
51
|
const getDB = (ctx, dataSource) => {
|
|
56
52
|
const ds = ctx.app.dataSourceManager.dataSources.get(dataSource);
|
|
57
53
|
return ds == null ? void 0 : ds.collectionManager.db;
|
|
58
54
|
};
|
|
59
|
-
const
|
|
60
|
-
var _a;
|
|
61
|
-
|
|
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;
|
|
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"]);
|
|
89
58
|
};
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
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
|
|
107
74
|
});
|
|
108
|
-
|
|
109
|
-
})
|
|
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
|
+
}
|
|
110
82
|
await next();
|
|
111
83
|
};
|
|
112
84
|
const queryData = async (ctx, next) => {
|
|
113
|
-
const { dataSource, collection, queryParams, fieldMap } = ctx.action.params.values;
|
|
114
|
-
const db = getDB(ctx, dataSource) || ctx.db;
|
|
115
|
-
const model = db.getModel(collection);
|
|
116
|
-
const data = await model.findAll(queryParams);
|
|
117
|
-
ctx.action.params.values = {
|
|
118
|
-
data,
|
|
119
|
-
fieldMap
|
|
120
|
-
};
|
|
121
|
-
await next();
|
|
122
|
-
};
|
|
123
|
-
const parseFieldAndAssociations = async (ctx, next) => {
|
|
124
85
|
var _a;
|
|
125
|
-
const {
|
|
126
|
-
dataSource,
|
|
127
|
-
collection: collectionName,
|
|
128
|
-
measures,
|
|
129
|
-
dimensions,
|
|
130
|
-
orders,
|
|
131
|
-
filter
|
|
132
|
-
} = ctx.action.params.values;
|
|
86
|
+
const { dataSource, collection, ...queryOptions } = ctx.action.params.values;
|
|
133
87
|
const db = getDB(ctx, dataSource) || ctx.db;
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const parseField = (selected) => {
|
|
139
|
-
var _a2, _b, _c, _d, _e, _f;
|
|
140
|
-
let target;
|
|
141
|
-
let name;
|
|
142
|
-
if (!Array.isArray(selected.field)) {
|
|
143
|
-
name = selected.field;
|
|
144
|
-
} else if (selected.field.length === 1) {
|
|
145
|
-
name = selected.field[0];
|
|
146
|
-
} else if (selected.field.length > 1) {
|
|
147
|
-
[target, name] = selected.field;
|
|
148
|
-
}
|
|
149
|
-
const rawAttributes = collection.model.getAttributes();
|
|
150
|
-
let field = ((_a2 = rawAttributes[name]) == null ? void 0 : _a2.field) || name;
|
|
151
|
-
let fieldType = (_b = fields.get(name)) == null ? void 0 : _b.type;
|
|
152
|
-
let fieldOptions = (_c = fields.get(name)) == null ? void 0 : _c.options;
|
|
153
|
-
if (target) {
|
|
154
|
-
const targetField = fields.get(target);
|
|
155
|
-
const targetCollection = db.getCollection(targetField.target);
|
|
156
|
-
const targetFields = targetCollection.fields;
|
|
157
|
-
fieldType = (_d = targetFields.get(name)) == null ? void 0 : _d.type;
|
|
158
|
-
fieldOptions = (_e = targetFields.get(name)) == null ? void 0 : _e.options;
|
|
159
|
-
field = `${target}.${field}`;
|
|
160
|
-
name = `${target}.${name}`;
|
|
161
|
-
const targetType = (_f = fields.get(target)) == null ? void 0 : _f.type;
|
|
162
|
-
if (!models[target]) {
|
|
163
|
-
models[target] = { type: targetType };
|
|
164
|
-
}
|
|
165
|
-
} else {
|
|
166
|
-
field = `${collectionName}.${field}`;
|
|
167
|
-
}
|
|
168
|
-
return {
|
|
169
|
-
...selected,
|
|
170
|
-
field,
|
|
171
|
-
name,
|
|
172
|
-
type: fieldType,
|
|
173
|
-
options: fieldOptions,
|
|
174
|
-
alias: selected.alias || name
|
|
175
|
-
};
|
|
176
|
-
};
|
|
177
|
-
const parsedMeasures = (measures == null ? void 0 : measures.map(parseField)) || [];
|
|
178
|
-
const parsedDimensions = (dimensions == null ? void 0 : dimensions.map(parseField)) || [];
|
|
179
|
-
const parsedOrders = (orders == null ? void 0 : orders.map(parseField)) || [];
|
|
180
|
-
const include = Object.entries(models).map(([target, { type }]) => {
|
|
181
|
-
let options = {
|
|
182
|
-
association: target,
|
|
183
|
-
attributes: []
|
|
184
|
-
};
|
|
185
|
-
if (type === "belongsToMany") {
|
|
186
|
-
options["through"] = { attributes: [] };
|
|
187
|
-
}
|
|
188
|
-
if (type === "belongsToArray") {
|
|
189
|
-
const association = associations[target];
|
|
190
|
-
if (association) {
|
|
191
|
-
options = {
|
|
192
|
-
...options,
|
|
193
|
-
...association.generateInclude()
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
return options;
|
|
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")
|
|
198
92
|
});
|
|
199
|
-
const filterParser = new import_database.FilterParser(filter, {
|
|
200
|
-
collection
|
|
201
|
-
});
|
|
202
|
-
const { where, include: filterInclude } = filterParser.toSequelizeParams();
|
|
203
|
-
if (filterInclude) {
|
|
204
|
-
const stack = [...filterInclude];
|
|
205
|
-
while (stack.length) {
|
|
206
|
-
const item = stack.pop();
|
|
207
|
-
const parentCollection = db.getCollection(item.parentCollection || collectionName);
|
|
208
|
-
const field = parentCollection.fields.get(item.association);
|
|
209
|
-
if ((field == null ? void 0 : field.type) === "belongsToMany") {
|
|
210
|
-
item.through = { attributes: [] };
|
|
211
|
-
}
|
|
212
|
-
if ((field == null ? void 0 : field.target) && ((_a = item.include) == null ? void 0 : _a.length)) {
|
|
213
|
-
for (const child of item.include) {
|
|
214
|
-
child.parentCollection = field.target;
|
|
215
|
-
stack.push(child);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
ctx.action.params.values = {
|
|
221
|
-
...ctx.action.params.values,
|
|
222
|
-
where,
|
|
223
|
-
measures: parsedMeasures,
|
|
224
|
-
dimensions: parsedDimensions,
|
|
225
|
-
orders: parsedOrders,
|
|
226
|
-
include: [...include, ...filterInclude || []]
|
|
227
|
-
};
|
|
228
93
|
await next();
|
|
229
94
|
};
|
|
230
95
|
const parseVariables = async (ctx, next) => {
|
|
@@ -259,44 +124,9 @@ const cacheMiddleware = async (ctx, next) => {
|
|
|
259
124
|
await cache.set(uid, ctx.body, (cacheConfig == null ? void 0 : cacheConfig.ttl) * 1e3);
|
|
260
125
|
}
|
|
261
126
|
};
|
|
262
|
-
const
|
|
263
|
-
var _a, _b;
|
|
264
|
-
const { collection, dataSource } = ctx.action.params.values;
|
|
265
|
-
const acl = ((_a = ctx.app.dataSourceManager.get(dataSource)) == null ? void 0 : _a.acl) || ctx.app.acl;
|
|
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) {
|
|
269
|
-
try {
|
|
270
|
-
(0, import_acl.checkFilterParams)(ctx.database.getCollection(collection), filterParams);
|
|
271
|
-
} catch (e) {
|
|
272
|
-
if (e instanceof import_acl.NoPermissionError) {
|
|
273
|
-
ctx.throw(403, "No permissions");
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
const filter = ctx.action.params.values.filter || {};
|
|
277
|
-
ctx.action.params.values = {
|
|
278
|
-
...ctx.action.params.values,
|
|
279
|
-
filter: (0, import_utils.assign)(filter, filterParams, {
|
|
280
|
-
filter: "andMerge"
|
|
281
|
-
})
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
return next();
|
|
285
|
-
};
|
|
286
|
-
const query = async (ctx, next) => {
|
|
287
|
-
const { dataSource } = ctx.action.params.values;
|
|
288
|
-
const db = getDB(ctx, dataSource) || ctx.db;
|
|
289
|
-
const queryParser = (0, import_query_parser.createQueryParser)(db);
|
|
127
|
+
const queryDataAction = async (ctx, next) => {
|
|
290
128
|
try {
|
|
291
|
-
await (0, import_koa_compose.default)([
|
|
292
|
-
checkPermission,
|
|
293
|
-
cacheMiddleware,
|
|
294
|
-
parseVariables,
|
|
295
|
-
parseFieldAndAssociations,
|
|
296
|
-
queryParser.parse(),
|
|
297
|
-
queryData,
|
|
298
|
-
postProcess
|
|
299
|
-
])(ctx, next);
|
|
129
|
+
await (0, import_koa_compose.default)([checkPermission, cacheMiddleware, parseVariables, queryData])(ctx, next);
|
|
300
130
|
} catch (err) {
|
|
301
131
|
ctx.throw(500, err);
|
|
302
132
|
}
|
|
@@ -305,9 +135,7 @@ const query = async (ctx, next) => {
|
|
|
305
135
|
0 && (module.exports = {
|
|
306
136
|
cacheMiddleware,
|
|
307
137
|
checkPermission,
|
|
308
|
-
parseFieldAndAssociations,
|
|
309
138
|
parseVariables,
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
queryData
|
|
139
|
+
queryData,
|
|
140
|
+
queryDataAction
|
|
313
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
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.16",
|
|
4
4
|
"displayName": "Data visualization",
|
|
5
5
|
"displayName.ru-RU": "Визуализация данных",
|
|
6
6
|
"displayName.zh-CN": "数据可视化",
|
|
@@ -40,6 +40,7 @@
|
|
|
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",
|
|
45
46
|
"@nocobase/plugin-flow-engine": "2.x",
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
"@nocobase/test": "2.x",
|
|
48
49
|
"@nocobase/utils": "2.x"
|
|
49
50
|
},
|
|
50
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "b9a191705a440a336c85d82fd877fdf152bec70f",
|
|
51
52
|
"keywords": [
|
|
52
53
|
"Blocks"
|
|
53
54
|
],
|