@nocobase/plugin-client 1.6.0-alpha.21 → 1.6.0-alpha.23

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.
@@ -8,14 +8,14 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.6.0-alpha.21",
11
+ "@nocobase/client": "1.6.0-alpha.23",
12
12
  "antd": "5.12.8",
13
13
  "react": "18.2.0",
14
14
  "@ant-design/icons": "5.2.6",
15
15
  "@formily/react": "2.3.0",
16
- "@nocobase/utils": "1.6.0-alpha.21",
16
+ "@nocobase/utils": "1.6.0-alpha.23",
17
17
  "lodash": "4.17.21",
18
18
  "react-i18next": "11.18.6",
19
- "@nocobase/database": "1.6.0-alpha.21",
20
- "@nocobase/server": "1.6.0-alpha.21"
19
+ "@nocobase/database": "1.6.0-alpha.23",
20
+ "@nocobase/server": "1.6.0-alpha.23"
21
21
  };
@@ -1 +1 @@
1
- {"name":"cronstrue","title":"cRonstrue","version":"2.47.0","description":"Convert cron expressions into human readable descriptions","author":"Brady Holt","license":"MIT","bugs":{"url":"https://github.com/bradymholt/cronstrue/issues"},"homepage":"https://github.com/bradymholt/cronstrue","keywords":["cron","cronjob","crontab","schedule","parser","cron expression","cron description","pretty cron","cron for humans","cron translated","cron english","cron schedule","cron english","cron schedule"],"main":"dist/cronstrue.js","bin":{"cronstrue":"bin/cli.js"},"typings":"dist/cronstrue.d.ts","files":["dist/","locales/","i18n.js","i18n.d.ts"],"repository":{"type":"git","url":"git+https://github.com/bradymholt/cronstrue.git"},"publishConfig":{"access":"public"},"prettier":{"printWidth":120},"devDependencies":{"@types/chai":"^4.2.11","@types/mocha":"^8.0.0","chai":"^4.2.0","handlebars":"^4.7.6","marked":"^4.0.10","mocha":"^10.1.0","pixl-xml":"^1.0.13","prettier":"^2.1.1","terser-webpack-plugin":"^5.3.1","ts-loader":"^9.2.6","ts-node":"^10.5.0","typescript":"^4.6.2","webpack":"^5.69.1","webpack-cli":"^4.9.2","xml2js":"^0.5.0"},"scripts":{"start":"npm run build","build":"npx tsc -p ./src --emitDeclarationOnly","test":"npx mocha --reporter spec --require ts-node/register \"./test/**/*.ts\"","prepublishOnly":"rm -rf ./dist && ./node_modules/webpack-cli/bin/cli.js && git add -A"},"dependencies":{},"_lastModified":"2025-02-07T02:40:14.575Z"}
1
+ {"name":"cronstrue","title":"cRonstrue","version":"2.47.0","description":"Convert cron expressions into human readable descriptions","author":"Brady Holt","license":"MIT","bugs":{"url":"https://github.com/bradymholt/cronstrue/issues"},"homepage":"https://github.com/bradymholt/cronstrue","keywords":["cron","cronjob","crontab","schedule","parser","cron expression","cron description","pretty cron","cron for humans","cron translated","cron english","cron schedule","cron english","cron schedule"],"main":"dist/cronstrue.js","bin":{"cronstrue":"bin/cli.js"},"typings":"dist/cronstrue.d.ts","files":["dist/","locales/","i18n.js","i18n.d.ts"],"repository":{"type":"git","url":"git+https://github.com/bradymholt/cronstrue.git"},"publishConfig":{"access":"public"},"prettier":{"printWidth":120},"devDependencies":{"@types/chai":"^4.2.11","@types/mocha":"^8.0.0","chai":"^4.2.0","handlebars":"^4.7.6","marked":"^4.0.10","mocha":"^10.1.0","pixl-xml":"^1.0.13","prettier":"^2.1.1","terser-webpack-plugin":"^5.3.1","ts-loader":"^9.2.6","ts-node":"^10.5.0","typescript":"^4.6.2","webpack":"^5.69.1","webpack-cli":"^4.9.2","xml2js":"^0.5.0"},"scripts":{"start":"npm run build","build":"npx tsc -p ./src --emitDeclarationOnly","test":"npx mocha --reporter spec --require ts-node/register \"./test/**/*.ts\"","prepublishOnly":"rm -rf ./dist && ./node_modules/webpack-cli/bin/cli.js && git add -A"},"dependencies":{},"_lastModified":"2025-02-07T12:03:15.126Z"}
@@ -12,3 +12,7 @@ export default class extends Migration {
12
12
  up(): Promise<void>;
13
13
  }
14
14
  export declare function schemaToRoutes(schema: any, uiSchemas: any): any;
15
+ export declare function getIds(desktopRoutes: any[], menuUiSchemas: any[]): {
16
+ needRemoveIds: any[];
17
+ needAddIds: any[];
18
+ };
@@ -27,6 +27,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
27
27
  var transform_menu_schema_to_routes_exports = {};
28
28
  __export(transform_menu_schema_to_routes_exports, {
29
29
  default: () => transform_menu_schema_to_routes_default,
30
+ getIds: () => getIds,
30
31
  schemaToRoutes: () => schemaToRoutes
31
32
  });
32
33
  module.exports = __toCommonJS(transform_menu_schema_to_routes_exports);
@@ -53,20 +54,25 @@ class transform_menu_schema_to_routes_default extends import_server.Migration {
53
54
  transaction
54
55
  });
55
56
  const roles = await rolesRepository.find({
56
- appends: ["desktopRoutes", "menuUiSchemas"],
57
+ appends: ["menuUiSchemas"],
57
58
  transaction
58
59
  });
60
+ const allDesktopRoutes = await desktopRoutes.find({ transaction });
59
61
  for (const role of roles) {
60
62
  const menuUiSchemas = role.menuUiSchemas || [];
61
- const desktopRoutes2 = role.desktopRoutes || [];
62
- const needRemoveIds = getNeedRemoveIds(desktopRoutes2, menuUiSchemas);
63
- if (needRemoveIds.length === 0) {
64
- continue;
63
+ const { needRemoveIds, needAddIds } = getIds(allDesktopRoutes, menuUiSchemas);
64
+ if (needRemoveIds.length > 0) {
65
+ await this.db.getRepository("roles.desktopRoutes", role.name).remove({
66
+ tk: needRemoveIds,
67
+ transaction
68
+ });
69
+ }
70
+ if (needAddIds.length > 0) {
71
+ await this.db.getRepository("roles.desktopRoutes", role.name).add({
72
+ tk: needAddIds,
73
+ transaction
74
+ });
65
75
  }
66
- await this.db.getRepository("roles.desktopRoutes", role.name).remove({
67
- tk: needRemoveIds,
68
- transaction
69
- });
70
76
  }
71
77
  }
72
78
  if (mobileRoutes) {
@@ -165,9 +171,9 @@ async function schemaToRoutes(schema, uiSchemas) {
165
171
  });
166
172
  return Promise.all(result);
167
173
  }
168
- function getNeedRemoveIds(desktopRoutes, menuUiSchemas) {
174
+ function getIds(desktopRoutes, menuUiSchemas) {
169
175
  const uidList = menuUiSchemas.map((item) => item["x-uid"]);
170
- return desktopRoutes.filter((item) => {
176
+ const needRemoveIds = desktopRoutes.filter((item) => {
171
177
  if (item.type === "tabs") {
172
178
  const page = desktopRoutes.find((route) => (route == null ? void 0 : route.id) === (item == null ? void 0 : item.parentId));
173
179
  return !uidList.includes(page == null ? void 0 : page.menuSchemaUid);
@@ -177,8 +183,11 @@ function getNeedRemoveIds(desktopRoutes, menuUiSchemas) {
177
183
  }
178
184
  return !uidList.includes(item == null ? void 0 : item.schemaUid);
179
185
  }).map((item) => item == null ? void 0 : item.id);
186
+ const needAddIds = desktopRoutes.map((item) => item == null ? void 0 : item.id).filter((id) => !needRemoveIds.includes(id));
187
+ return { needRemoveIds, needAddIds };
180
188
  }
181
189
  // Annotate the CommonJS export names for ESM import in node:
182
190
  0 && (module.exports = {
191
+ getIds,
183
192
  schemaToRoutes
184
193
  });
@@ -0,0 +1,17 @@
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 { Migration } from '@nocobase/server';
10
+ export default class extends Migration {
11
+ appVersion: string;
12
+ up(): Promise<void>;
13
+ }
14
+ export declare function getIds(desktopRoutes: any[], menuUiSchemas: any[]): {
15
+ needRemoveIds: any[];
16
+ needAddIds: any[];
17
+ };
@@ -0,0 +1,85 @@
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
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var fix_permissions_exports = {};
28
+ __export(fix_permissions_exports, {
29
+ default: () => fix_permissions_default,
30
+ getIds: () => getIds
31
+ });
32
+ module.exports = __toCommonJS(fix_permissions_exports);
33
+ var import_server = require("@nocobase/server");
34
+ class fix_permissions_default extends import_server.Migration {
35
+ appVersion = "<1.6.0";
36
+ async up() {
37
+ const desktopRoutes = this.db.getRepository("desktopRoutes");
38
+ const count = await desktopRoutes.count();
39
+ if (!count) {
40
+ return;
41
+ }
42
+ const rolesRepository = this.db.getRepository("roles");
43
+ try {
44
+ await this.db.sequelize.transaction(async (transaction) => {
45
+ const roles = await rolesRepository.find({
46
+ appends: ["menuUiSchemas"],
47
+ transaction
48
+ });
49
+ const allDesktopRoutes = await desktopRoutes.find({ transaction });
50
+ for (const role of roles) {
51
+ const menuUiSchemas = role.menuUiSchemas || [];
52
+ const { needAddIds } = getIds(allDesktopRoutes, menuUiSchemas);
53
+ if (needAddIds.length > 0) {
54
+ await this.db.getRepository("roles.desktopRoutes", role.name).add({
55
+ tk: needAddIds,
56
+ transaction
57
+ });
58
+ }
59
+ }
60
+ });
61
+ } catch (error) {
62
+ console.error("Migration failed:", error);
63
+ throw error;
64
+ }
65
+ }
66
+ }
67
+ function getIds(desktopRoutes, menuUiSchemas) {
68
+ const uidList = menuUiSchemas.map((item) => item["x-uid"]);
69
+ const needRemoveIds = desktopRoutes.filter((item) => {
70
+ if (item.type === "tabs") {
71
+ const page = desktopRoutes.find((route) => (route == null ? void 0 : route.id) === (item == null ? void 0 : item.parentId));
72
+ return !uidList.includes(page == null ? void 0 : page.menuSchemaUid);
73
+ }
74
+ if (item.type === "page") {
75
+ return !uidList.includes(item == null ? void 0 : item.menuSchemaUid);
76
+ }
77
+ return !uidList.includes(item == null ? void 0 : item.schemaUid);
78
+ }).map((item) => item == null ? void 0 : item.id);
79
+ const needAddIds = desktopRoutes.map((item) => item == null ? void 0 : item.id).filter((id) => !needRemoveIds.includes(id));
80
+ return { needRemoveIds, needAddIds };
81
+ }
82
+ // Annotate the CommonJS export names for ESM import in node:
83
+ 0 && (module.exports = {
84
+ getIds
85
+ });
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "WEB 客户端",
5
5
  "description": "Provides a client interface for the NocoBase server",
6
6
  "description.zh-CN": "为 NocoBase 服务端提供客户端界面",
7
- "version": "1.6.0-alpha.21",
7
+ "version": "1.6.0-alpha.23",
8
8
  "main": "./dist/server/index.js",
9
9
  "license": "AGPL-3.0",
10
10
  "devDependencies": {
@@ -20,5 +20,5 @@
20
20
  "@nocobase/test": "1.x",
21
21
  "@nocobase/utils": "1.x"
22
22
  },
23
- "gitHead": "873cbaec9554e684781b8dc6cfd4386bb5cfa5b0"
23
+ "gitHead": "34e9bab601ea8364f10730f6da9f132e906b1908"
24
24
  }