@nocobase/plugin-collection-tree 1.6.0-alpha.17 → 1.6.0-alpha.18

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.6.0-alpha.17",
11
+ "@nocobase/client": "1.6.0-alpha.18",
12
12
  "lodash": "4.17.21",
13
- "@nocobase/database": "1.6.0-alpha.17",
14
- "@nocobase/utils": "1.6.0-alpha.17",
15
- "@nocobase/data-source-manager": "1.6.0-alpha.17",
16
- "@nocobase/server": "1.6.0-alpha.17",
13
+ "@nocobase/database": "1.6.0-alpha.18",
14
+ "@nocobase/utils": "1.6.0-alpha.18",
15
+ "@nocobase/data-source-manager": "1.6.0-alpha.18",
16
+ "@nocobase/server": "1.6.0-alpha.18",
17
17
  "sequelize": "6.35.2"
18
18
  };
@@ -117,6 +117,12 @@ class PluginCollectionTreeServer extends import_server.Plugin {
117
117
  transaction: options2.transaction
118
118
  });
119
119
  });
120
+ this.db.on(`${collection.name}.beforeSave`, async (model) => {
121
+ const tk = collection.filterTargetKey;
122
+ if (model.get(parentForeignKey) === model.get(tk)) {
123
+ throw new Error("Cannot set itself as the parent node");
124
+ }
125
+ });
120
126
  });
121
127
  }
122
128
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-collection-tree",
3
- "version": "1.6.0-alpha.17",
3
+ "version": "1.6.0-alpha.18",
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": "7212bf5f8f59bc3fcfa1e62387c60665112310fb"
17
+ "gitHead": "db361bebe9ed4a5ca19fc14183fe4576443568ef"
18
18
  }