@nocobase/plugin-data-source-main 1.4.0-alpha.5 → 1.4.0-alpha.7

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/README.md CHANGED
@@ -1,9 +1,30 @@
1
- # collection-manager
1
+ # NocoBase
2
2
 
3
- English | [中文](./README.zh-CN.md)
3
+ <video width="100%" controls>
4
+ <source src="https://static-docs.nocobase.com/NocoBase0510.mp4" type="video/mp4">
5
+ </video>
4
6
 
5
- ## 安装激活
6
7
 
7
- 内置插件无需手动安装激活。
8
+ ## What is NocoBase
8
9
 
9
- ## 使用方法
10
+ NocoBase is a scalability-first, open-source no-code development platform.
11
+ Instead of investing years of time and millions of dollars in research and development, deploy NocoBase in a few minutes and you'll have a private, controllable, and extremely scalable no-code development platform!
12
+
13
+ Homepage:
14
+ https://www.nocobase.com/
15
+
16
+ Online Demo:
17
+ https://demo.nocobase.com/new
18
+
19
+ Documents:
20
+ https://docs.nocobase.com/
21
+
22
+ Commericial license & plugins:
23
+ https://www.nocobase.com/en/commercial
24
+
25
+ License agreement:
26
+ https://www.nocobase.com/en/agreement
27
+
28
+
29
+ ## Contact Us:
30
+ hello@nocobase.com
@@ -8,14 +8,14 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.4.0-alpha.5",
12
- "@nocobase/database": "1.4.0-alpha.5",
13
- "@nocobase/plugin-error-handler": "1.4.0-alpha.5",
14
- "@nocobase/server": "1.4.0-alpha.5",
11
+ "@nocobase/client": "1.4.0-alpha.7",
12
+ "@nocobase/database": "1.4.0-alpha.7",
13
+ "@nocobase/plugin-error-handler": "1.4.0-alpha.7",
14
+ "@nocobase/server": "1.4.0-alpha.7",
15
15
  "async-mutex": "0.3.2",
16
16
  "lodash": "4.17.21",
17
- "@nocobase/test": "1.4.0-alpha.5",
18
- "@nocobase/utils": "1.4.0-alpha.5",
17
+ "@nocobase/test": "1.4.0-alpha.7",
18
+ "@nocobase/utils": "1.4.0-alpha.7",
19
19
  "sequelize": "6.35.2",
20
20
  "dayjs": "1.11.10"
21
21
  };
@@ -60,6 +60,7 @@ class CollectionRepository extends import_database.Repository {
60
60
  if (instance.get("view") || instance.get("sql")) {
61
61
  viewCollections.push(instance.get("name"));
62
62
  }
63
+ this.database.collectionsSort.set(instance.get("name"), instance.get("sort"));
63
64
  }
64
65
  for (const instance of instances) {
65
66
  const collectionName = instance.get("name");
@@ -7,6 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  declare const _default: {
10
+ "collections:listMeta"(ctx: any, next: any): Promise<void>;
10
11
  "collections:setFields"(ctx: any, next: any): Promise<void>;
11
12
  };
12
13
  export default _default;
@@ -7,9 +7,11 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
+ var __create = Object.create;
10
11
  var __defProp = Object.defineProperty;
11
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
13
  var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
13
15
  var __hasOwnProp = Object.prototype.hasOwnProperty;
14
16
  var __export = (target, all) => {
15
17
  for (var name in all)
@@ -23,13 +25,49 @@ var __copyProps = (to, from, except, desc) => {
23
25
  }
24
26
  return to;
25
27
  };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
26
36
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
37
  var collections_exports = {};
28
38
  __export(collections_exports, {
29
39
  default: () => collections_default
30
40
  });
31
41
  module.exports = __toCommonJS(collections_exports);
42
+ var import_lodash = __toESM(require("lodash"));
32
43
  var collections_default = {
44
+ async ["collections:listMeta"](ctx, next) {
45
+ const db = ctx.app.db;
46
+ const results = [];
47
+ db.collections.forEach((collection) => {
48
+ if (!collection.options.loadedFromCollectionManager) {
49
+ return;
50
+ }
51
+ const obj = {
52
+ ...collection.options,
53
+ filterTargetKey: collection.filterTargetKey
54
+ };
55
+ if (collection && collection.unavailableActions) {
56
+ obj["unavailableActions"] = collection.unavailableActions();
57
+ }
58
+ obj.fields = import_lodash.default.sortBy(
59
+ [...collection.fields.values()].map((field) => {
60
+ return {
61
+ ...field.options
62
+ };
63
+ }),
64
+ "sort"
65
+ );
66
+ results.push(obj);
67
+ });
68
+ ctx.body = import_lodash.default.sortBy(results, "sort");
69
+ await next();
70
+ },
33
71
  async ["collections:setFields"](ctx, next) {
34
72
  var _a;
35
73
  const { filterByTk, values } = ctx.action.params;
@@ -277,6 +277,7 @@ class PluginDataSourceMainServer extends import_server.Plugin {
277
277
  await next();
278
278
  });
279
279
  this.app.acl.allow("collections", "list", "loggedIn");
280
+ this.app.acl.allow("collections", "listMeta", "loggedIn");
280
281
  this.app.acl.allow("collectionCategories", "list", "loggedIn");
281
282
  this.app.acl.registerSnippet({
282
283
  name: `pm.data-source-manager.data-source-main`,
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "数据源:主数据库",
5
5
  "description": "NocoBase main database, supports relational databases such as PostgreSQL, MySQL, MariaDB and so on.",
6
6
  "description.zh-CN": "NocoBase 主数据库,支持 PostgreSQL、MySQL、MariaDB 等关系型数据库。",
7
- "version": "1.4.0-alpha.5",
7
+ "version": "1.4.0-alpha.7",
8
8
  "main": "./dist/server/index.js",
9
9
  "homepage": "https://docs.nocobase.com/handbook/data-source-main",
10
10
  "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/data-source-main",
@@ -22,7 +22,7 @@
22
22
  "@nocobase/test": "1.x",
23
23
  "@nocobase/utils": "1.x"
24
24
  },
25
- "gitHead": "101d541ccb57037bb28c11a0c33b56266da1840b",
25
+ "gitHead": "52bb98fe5fd95cc25baeaaef5aeae9cdd1a0e2fa",
26
26
  "keywords": [
27
27
  "Data sources"
28
28
  ]
package/README.zh-CN.md DELETED
@@ -1,9 +0,0 @@
1
- # collection-manager
2
-
3
- [English](./README.md) | 中文
4
-
5
- ## 安装激活
6
-
7
- 内置插件无需手动安装激活。
8
-
9
- ## 使用方法