@nocobase/plugin-data-visualization 0.15.0-alpha.4 → 0.16.0-alpha.1

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.
@@ -1,10 +1,10 @@
1
1
  module.exports = {
2
- "@nocobase/client": "0.15.0-alpha.4",
2
+ "@nocobase/client": "0.16.0-alpha.1",
3
3
  "react": "18.2.0",
4
4
  "@formily/react": "2.2.27",
5
5
  "@formily/shared": "2.2.27",
6
- "@nocobase/cache": "0.15.0-alpha.4",
7
- "@nocobase/server": "0.15.0-alpha.4",
6
+ "@nocobase/cache": "0.16.0-alpha.1",
7
+ "@nocobase/server": "0.16.0-alpha.1",
8
8
  "@ant-design/icons": "5.1.4",
9
9
  "dayjs": "1.11.9",
10
10
  "@formily/antd-v5": "1.1.7",
@@ -14,7 +14,7 @@ module.exports = {
14
14
  "@emotion/css": "11.11.2",
15
15
  "react-i18next": "11.18.6",
16
16
  "ahooks": "3.7.8",
17
- "@nocobase/actions": "0.15.0-alpha.4",
18
- "@nocobase/database": "0.15.0-alpha.4",
19
- "@nocobase/utils": "0.15.0-alpha.4"
17
+ "@nocobase/actions": "0.16.0-alpha.1",
18
+ "@nocobase/database": "0.16.0-alpha.1",
19
+ "@nocobase/utils": "0.16.0-alpha.1"
20
20
  };
@@ -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":"2023-11-18T13:29:01.550Z"}
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":"2023-11-20T09:49:30.477Z"}
@@ -28,13 +28,14 @@ const dateFormatFn = (sequelize, dialect, field, format) => {
28
28
  format = format.replace(/YYYY/g, "%Y").replace(/MM/g, "%m").replace(/DD/g, "%d").replace(/hh/g, "%H").replace(/mm/g, "%M").replace(/ss/g, "%S");
29
29
  return sequelize.fn("strftime", format, sequelize.col(field));
30
30
  case "mysql":
31
+ case "mariadb":
31
32
  format = format.replace(/YYYY/g, "%Y").replace(/MM/g, "%m").replace(/DD/g, "%d").replace(/hh/g, "%H").replace(/mm/g, "%i").replace(/ss/g, "%S");
32
33
  return sequelize.fn("date_format", sequelize.col(field), format);
33
34
  case "postgres":
34
35
  format = format.replace(/hh/g, "HH24").replace(/mm/g, "MI").replace(/ss/g, "SS");
35
36
  return sequelize.fn("to_char", sequelize.col(field), format);
36
37
  default:
37
- return field;
38
+ return sequelize.col(field);
38
39
  }
39
40
  };
40
41
  const formatFn = (sequelize, dialect, field, format) => {
@@ -261,8 +261,7 @@ const parseVariables = async (ctx, next) => {
261
261
  };
262
262
  const cacheMiddleware = async (ctx, next) => {
263
263
  const { uid, cache: cacheConfig, refresh } = ctx.action.params.values;
264
- const plugin = ctx.app.getPlugin("data-visualization");
265
- const cache = plugin.cache;
264
+ const cache = ctx.app.cacheManager.getCache("data-visualization");
266
265
  const useCache = (cacheConfig == null ? void 0 : cacheConfig.enabled) && uid;
267
266
  if (useCache && !refresh) {
268
267
  const data = await cache.get(uid);
@@ -273,7 +272,7 @@ const cacheMiddleware = async (ctx, next) => {
273
272
  }
274
273
  await next();
275
274
  if (useCache) {
276
- await cache.set(uid, ctx.body, (cacheConfig == null ? void 0 : cacheConfig.ttl) || 30);
275
+ await cache.set(uid, ctx.body, (cacheConfig == null ? void 0 : cacheConfig.ttl) * 1e3);
277
276
  }
278
277
  };
279
278
  const checkPermission = (ctx, next) => {
@@ -21,7 +21,6 @@ __export(plugin_exports, {
21
21
  default: () => plugin_default
22
22
  });
23
23
  module.exports = __toCommonJS(plugin_exports);
24
- var import_cache = require("@nocobase/cache");
25
24
  var import_server = require("@nocobase/server");
26
25
  var import_query = require("./actions/query");
27
26
  var import_path = require("path");
@@ -46,11 +45,12 @@ class DataVisualizationPlugin extends import_server.Plugin {
46
45
  plugin: this
47
46
  }
48
47
  });
49
- this.cache = (0, import_cache.createCache)({
50
- ttl: 30,
51
- // seconds
52
- max: 1e3,
53
- store: "memory"
48
+ this.cache = await this.app.cacheManager.createCache({
49
+ name: "data-visualization",
50
+ store: "memory",
51
+ ttl: 30 * 1e3,
52
+ // millseconds
53
+ max: 1e3
54
54
  });
55
55
  }
56
56
  async install(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-data-visualization",
3
- "version": "0.15.0-alpha.4",
3
+ "version": "0.16.0-alpha.1",
4
4
  "displayName": "Data Visualization",
5
5
  "displayName.zh-CN": "数据可视化",
6
6
  "description": "Provides business intelligence and data visualization features",
@@ -33,5 +33,5 @@
33
33
  "@nocobase/test": "0.x",
34
34
  "@nocobase/utils": "0.x"
35
35
  },
36
- "gitHead": "380045c660ea0432f3e8fd7cf01c3cfe7275db34"
36
+ "gitHead": "e8aaf48d169448376a06d87f090786cd7649255e"
37
37
  }