@nocobase/plugin-collection-tree 1.5.0-beta.8 → 1.5.0

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,11 +8,11 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.5.0-beta.8",
11
+ "@nocobase/client": "1.5.0",
12
12
  "lodash": "4.17.21",
13
- "@nocobase/database": "1.5.0-beta.8",
14
- "@nocobase/utils": "1.5.0-beta.8",
15
- "@nocobase/data-source-manager": "1.5.0-beta.8",
16
- "@nocobase/server": "1.5.0-beta.8",
13
+ "@nocobase/database": "1.5.0",
14
+ "@nocobase/utils": "1.5.0",
15
+ "@nocobase/data-source-manager": "1.5.0",
16
+ "@nocobase/server": "1.5.0",
17
17
  "sequelize": "6.35.2"
18
18
  };
@@ -116,6 +116,12 @@ class PluginCollectionTreeServer extends import_server.Plugin {
116
116
  transaction: options2.transaction
117
117
  });
118
118
  });
119
+ this.db.on(`${collection.name}.beforeSave`, async (model) => {
120
+ const tk = collection.filterTargetKey;
121
+ if (model.get(parentForeignKey) === model.get(tk)) {
122
+ throw new Error("Cannot set itself as the parent node");
123
+ }
124
+ });
119
125
  });
120
126
  }
121
127
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-collection-tree",
3
- "version": "1.5.0-beta.8",
3
+ "version": "1.5.0",
4
4
  "displayName": "Collection: Tree",
5
5
  "displayName.zh-CN": "数据表:树",
6
6
  "description": "Provides tree collection template",
@@ -14,5 +14,5 @@
14
14
  "@nocobase/server": "1.x",
15
15
  "@nocobase/test": "1.x"
16
16
  },
17
- "gitHead": "eb7db7301ac5eed305e73540884611832bc761f6"
17
+ "gitHead": "1eae52e1fc837e9b1c6b63fc31bda7945b6101e9"
18
18
  }