@nocobase/plugin-snapshot-field 0.14.0-alpha.6 → 0.14.0-alpha.8
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SelectProps } from 'antd';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export type SnapshotOwnerCollectionFieldsSelectProps = Omit<SelectProps, 'options'>;
|
|
4
|
-
export declare const useSnapshotOwnerCollectionFields: () => any;
|
|
4
|
+
export declare const useSnapshotOwnerCollectionFields: () => any[];
|
|
5
5
|
export declare const SnapshotOwnerCollectionFieldsSelect: React.FC<SnapshotOwnerCollectionFieldsSelectProps>;
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@nocobase/client": "0.14.0-alpha.
|
|
2
|
+
"@nocobase/client": "0.14.0-alpha.8",
|
|
3
3
|
"react": "18.2.0",
|
|
4
4
|
"@formily/react": "2.2.27",
|
|
5
5
|
"@formily/core": "2.2.27",
|
|
6
6
|
"lodash": "4.17.21",
|
|
7
|
-
"@nocobase/database": "0.14.0-alpha.
|
|
8
|
-
"@nocobase/server": "0.14.0-alpha.
|
|
7
|
+
"@nocobase/database": "0.14.0-alpha.8",
|
|
8
|
+
"@nocobase/server": "0.14.0-alpha.8",
|
|
9
9
|
"antd": "5.8.6",
|
|
10
10
|
"react-i18next": "11.18.6",
|
|
11
11
|
"@ant-design/icons": "5.1.4",
|
package/dist/server/plugin.js
CHANGED
|
@@ -35,7 +35,8 @@ class SnapshotFieldPlugin extends import_server.Plugin {
|
|
|
35
35
|
const existCollection = await collectionsHistoryRepository.findOne({
|
|
36
36
|
filter: {
|
|
37
37
|
name: collectionDoc.name
|
|
38
|
-
}
|
|
38
|
+
},
|
|
39
|
+
transaction
|
|
39
40
|
});
|
|
40
41
|
if (existCollection) {
|
|
41
42
|
await existCollection.destroy({
|
|
@@ -52,19 +53,21 @@ class SnapshotFieldPlugin extends import_server.Plugin {
|
|
|
52
53
|
});
|
|
53
54
|
};
|
|
54
55
|
this.app.db.on("collections.afterCreateWithAssociations", collectionHandler);
|
|
55
|
-
const
|
|
56
|
-
const fieldDoc = model.get();
|
|
56
|
+
const deleteField = async (field, transaction) => {
|
|
57
57
|
const fieldsHistoryRepository = this.app.db.getRepository("fieldsHistory");
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
58
|
+
const { name, collectionName } = field;
|
|
59
|
+
await fieldsHistoryRepository.destroy({
|
|
60
|
+
filter: { name, collectionName },
|
|
61
|
+
transaction
|
|
63
62
|
});
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
};
|
|
64
|
+
const fieldHandler = async (model, { transaction }) => {
|
|
65
|
+
const fieldsHistoryRepository = this.app.db.getRepository("fieldsHistory");
|
|
66
|
+
const fieldDoc = model.get();
|
|
67
|
+
await deleteField(fieldDoc, transaction);
|
|
68
|
+
const reverseField = fieldDoc.reverseField;
|
|
69
|
+
if (reverseField) {
|
|
70
|
+
await deleteField(reverseField, transaction);
|
|
68
71
|
}
|
|
69
72
|
await fieldsHistoryRepository.create({
|
|
70
73
|
values: JSON.parse(JSON.stringify(fieldDoc)),
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "关系快照字段",
|
|
5
5
|
"description": "",
|
|
6
6
|
"description.zh-CN": "",
|
|
7
|
-
"version": "0.14.0-alpha.
|
|
7
|
+
"version": "0.14.0-alpha.8",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"devDependencies": {
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"@nocobase/test": "0.x",
|
|
25
25
|
"@nocobase/utils": "0.x"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "59c82fef6e34707802b5841f5ec4d9b3b6b68abb"
|
|
28
28
|
}
|