@nocobase/plugin-collection-tree 2.2.0-beta.9 → 3.0.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.
@@ -8,13 +8,13 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.2.0-beta.9",
12
- "@nocobase/client-v2": "2.2.0-beta.9",
13
- "@nocobase/plugin-data-source-manager": "2.2.0-beta.9",
14
- "@nocobase/database": "2.2.0-beta.9",
15
- "@nocobase/utils": "2.2.0-beta.9",
11
+ "@nocobase/client": "3.0.0-alpha.1",
12
+ "@nocobase/client-v2": "3.0.0-alpha.1",
13
+ "@nocobase/plugin-data-source-manager": "3.0.0-alpha.1",
14
+ "@nocobase/database": "3.0.0-alpha.1",
15
+ "@nocobase/utils": "3.0.0-alpha.1",
16
16
  "lodash": "4.18.1",
17
- "@nocobase/data-source-manager": "2.2.0-beta.9",
18
- "@nocobase/server": "2.2.0-beta.9",
17
+ "@nocobase/data-source-manager": "3.0.0-alpha.1",
18
+ "@nocobase/server": "3.0.0-alpha.1",
19
19
  "sequelize": "6.35.2"
20
20
  };
@@ -65,10 +65,17 @@ class PluginCollectionTreeServer extends import_server.Plugin {
65
65
  if (collection.options.schema) {
66
66
  options["schema"] = collection.options.schema;
67
67
  }
68
+ let nodePkType = "bigInt";
68
69
  if (eventOptions.fieldModels) {
69
- options["fieldModels"] = eventOptions.fieldModels;
70
+ const pk = eventOptions.fieldModels.find((x) => x.options.primaryKey === true);
71
+ if (pk) {
72
+ nodePkType = pk.type;
73
+ }
70
74
  }
71
- this.defineTreePathCollection(name, options);
75
+ this.defineTreePathCollection(name, {
76
+ ...options,
77
+ nodePkType
78
+ });
72
79
  collectionManager.db.on(`${collection.name}.afterSync`, async ({ transaction }) => {
73
80
  await this.db.getCollection(name).sync({ transaction });
74
81
  });
@@ -183,13 +190,7 @@ class PluginCollectionTreeServer extends import_server.Plugin {
183
190
  });
184
191
  }
185
192
  async defineTreePathCollection(name, options) {
186
- let nodePkType = "bigInt";
187
- if (options.fieldModels) {
188
- const pk = options.fieldModels.find((x) => x.options.primaryKey === true);
189
- if (pk) {
190
- nodePkType = pk.type;
191
- }
192
- }
193
+ const { nodePkType, ...collectionOptions } = options;
193
194
  this.db.collection({
194
195
  name,
195
196
  autoGenId: false,
@@ -204,7 +205,7 @@ class PluginCollectionTreeServer extends import_server.Plugin {
204
205
  fields: [{ name: "path", length: 191 }]
205
206
  }
206
207
  ],
207
- ...options
208
+ ...collectionOptions
208
209
  });
209
210
  }
210
211
  async getTreePath(model, path, collection, pathCollectionName, transaction) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-collection-tree",
3
- "version": "2.2.0-beta.9",
3
+ "version": "3.0.0-alpha.1",
4
4
  "displayName": "Collection: Tree",
5
5
  "displayName.ru-RU": "Древовидная Коллекция",
6
6
  "displayName.zh-CN": "数据表:树",
@@ -19,5 +19,5 @@
19
19
  "@nocobase/test": "2.x"
20
20
  },
21
21
  "license": "Apache-2.0",
22
- "gitHead": "60e3d7abbaa0c7cead76f71a4f3d5eedb6b8acdb"
22
+ "gitHead": "22d8be8ece179cfa5c8a4ebb2c896c92bd418e03"
23
23
  }